├── .eslintrc.json ├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── keymaps └── language-circuitpython.json ├── lib ├── atom-serialport.js ├── board-view.js ├── language-circuitpython.js ├── parser-delay.js └── plotter-view.js ├── menus └── language-circuitpython.json ├── package-lock.json ├── package.json ├── spec └── language-circuitpython-spec.js └── styles └── language-circuitpython.less /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "node": true 5 | }, 6 | "extends": "eslint:recommended", 7 | "parserOptions": { 8 | "ecmaVersion": 2018, 9 | "sourceType": "module" 10 | }, 11 | "rules": { 12 | "indent": [ 13 | "error", 14 | 4 15 | ], 16 | "linebreak-style": [ 17 | "error", 18 | "unix" 19 | ], 20 | "quotes": [ 21 | "error", 22 | "double" 23 | ], 24 | "semi": [ 25 | "error", 26 | "always" 27 | ] 28 | } 29 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.0 - First Release 2 | * Every feature added 3 | * Every bug fixed 4 | 5 | ## 0.4.0 - Plotter 6 | * I found the changelog and figured I should use it 7 | * Plotter added 8 | 9 | ## 0.4.1 - Plotter enhancements 10 | * Added plotter to readme 11 | * Changed some limiting things on the plotter 12 | 13 | ## 0.4.2 - Plotter enhancements 14 | * Change colour of plotted lines to make it more visible 15 | * Updated readme to show coloured graphs 16 | 17 | ## 0.5.0 - More plotter enhancements and small fixes 18 | * `7c8acec0d7e188bbdfd4f5478bf5974a5be616d4` Fix spec 19 | * `5da0d627ba06e80f5975b6a061bb186ece50f731` Re-enable bezier curves (tested, no loss of performance) 20 | * `70cb0d76ff240e4dfac5fe17e9b5cd1e029221a6` Enable animations, but fast, just to smooth things a bit 21 | * `f92f571e173c56938b05659995641f0d531c840c` Change from 20 to 80 points 22 | * `b3535549dc43ecfbf8c5f01c31902ebf32e7ccd5` Spec improvements 23 | 24 | ## 0.5.1 - Accessibility & performance settings 25 | * `733cfa7997468a389452ef743136c023185da098` commit hashes should be coded in changelog 26 | * `d92eff867fa7878f815046ccba3a02a0c00b5cc6` Make headings smaller in changelog 27 | * `03f777f2b38aabdf808507f1355fd30282837e16` Make colors darker so they are more suitable for light themes as well 28 | * `c0fee8f91ad63cc90a03915414fc7db8ff966dfd` Add atom global var 29 | * `6d836a8faf97f36c404f2ca8fd983308f974b370` Add colors dependent on theme 30 | * `4586b2ee354575f3abaa06ea3f38ee0073f124ba` Add max lines dependent on settings 31 | * `d514df8fb528e48e5178ac6edb95b61fe6827d18` Add config specification 32 | 33 | ## 0.6.0 - Rename 34 | * `eda30fcebc6c988e6aa1e9fdb76fec9cb303ab15` rename to language-circuitpython 35 | 36 | ## 0.7.0 - REPL 37 | * `ec3cfdf6c4b66de20b9b35142f323e2665bb7ed3` add support for serial input for REPL within Atom (thanks to @dunkmann00!) 38 | * `aa2149405321273cd3356bf074f40c5317aad672` Security fixes 39 | 40 | ## 0.9.0 - Tab completion 41 | * `565db070ff3b0394b9ac34dfc4c5561d5b9cb632` add tab completion to the Serial REPL 42 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Joseph Banks 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Atom CircuitPython 2 | 3 | CircuitPython language support in Atom. Support for serial outputs, Python REPL, and plotting of data. 4 | 5 | This plugin contains the code from the [`fsync-on-save`](https://atom.io/packages/fsync-on-save) package to ensure data is flushed to the device immediately after saving, therefore preventing loss or corruption of data when working with CircuitPython devices. 6 | 7 | Should be compatible with Windows & Linux as the serial port library *should* be cross-platform, let me know in the issues of any errors cropping up. 8 | 9 | Open to any form of feedback in the form of GitHub Issues or you can ping me (joseph#1337) in the `#circuitpython` channel of the [Adafruit Discord Server](https://discord.gg/adafruit). 10 | 11 | ![Serial Monitor](https://cdn.discordapp.com/attachments/327298996332658690/582660763215331338/unknown.png) 12 | ![Plotter](https://cdn.discordapp.com/attachments/238737601648001024/582923548583264261/unknown.png) 13 | -------------------------------------------------------------------------------- /keymaps/language-circuitpython.json: -------------------------------------------------------------------------------- 1 | { 2 | "atom-workspace": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /lib/atom-serialport.js: -------------------------------------------------------------------------------- 1 | "use babel"; 2 | 3 | /* global atom */ 4 | 5 | import SerialPort from "serialport"; 6 | 7 | const vendorIDs = [ 8 | "239a" // Adafruit vendor ID 9 | ]; 10 | 11 | export class AtomSerialPort { 12 | constructor() { 13 | this.sp = null; 14 | this.callbacks = []; 15 | 16 | this.connecting = false; 17 | this.listeners = 0; 18 | } 19 | 20 | connect() { 21 | this.connecting = true; 22 | SerialPort.list().then((ports) => { 23 | atom.notifications.addInfo("Attempting to locate board"); 24 | 25 | ports = ports.map((v) => { 26 | if (!v.vendorId) { 27 | v.vendorId = ""; 28 | } 29 | 30 | return v; 31 | }); 32 | 33 | let chosenBoard = ports.find(e => vendorIDs.indexOf(e.vendorId.toLowerCase()) != -1); 34 | 35 | if (chosenBoard) { 36 | // Create a stream to the serial 37 | this.sp = new SerialPort(chosenBoard.path, { 38 | baudRate: 115200 39 | }); 40 | 41 | this.sp.on("close", (err) => { 42 | if (err && err.disconnected) { 43 | atom.notifications.addWarning("Board Disconnected"); 44 | this.sp = null; 45 | } 46 | }); 47 | 48 | atom.notifications.addSuccess("Acquired board!"); 49 | 50 | for (var callback of this.callbacks) { 51 | callback(this.sp); 52 | } 53 | }else { 54 | atom.notifications.addError("Could not find a valid device"); 55 | } 56 | this.callbacks = []; 57 | this.connecting = false; 58 | }); 59 | } 60 | 61 | disconnect() { 62 | // Close the stream if one is opened 63 | if (this.sp) { 64 | atom.notifications.addInfo("Disconnecting from board"); 65 | if(this.sp.isOpen) { 66 | this.sp.close(); 67 | } 68 | this.sp = null; 69 | } 70 | } 71 | 72 | data(callback) { 73 | this.listeners+=1; 74 | if (this.sp != null) { 75 | callback(this.sp); 76 | }else { 77 | if (!this.connecting) { 78 | this.connect(); 79 | } 80 | this.callbacks.push(callback); 81 | } 82 | } 83 | 84 | close() { 85 | this.listeners-=1; 86 | if (this.listeners == 0) { 87 | this.disconnect(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/board-view.js: -------------------------------------------------------------------------------- 1 | "use babel"; 2 | 3 | /* global atom document */ 4 | 5 | import { DelayParser } from "./parser-delay"; 6 | 7 | var keydownOutput = { 8 | "Enter" : "\r\n", 9 | "Backspace" : "\b", 10 | "Delete" : "\x1B[\x33\x7E", 11 | "ArrowLeft" : "\x1B[D", 12 | "ArrowUp" : "\x1B[A", 13 | "ArrowRight" : "\x1B[C", 14 | "ArrowDown" : "\x1B[B", 15 | "Home" : "\x1B[H", 16 | "End" : "\x1B[F", 17 | "Tab" : "\t" 18 | }; 19 | 20 | export class BoardView { 21 | constructor(atomSerialPort) { 22 | this.element = document.createElement("div"); 23 | this.element.classList.add("language-circuitpython-serial"); 24 | this.element.style = "width: 100% height: 100%;"; 25 | 26 | // This textarea is the CircuitPython REPL 27 | const message = document.createElement("textarea"); 28 | message.style = "width: 100%; height: 100%; overflow-y: scroll;"; 29 | message.classList.add("atom-circuitp-code"); 30 | this.element.appendChild(message); 31 | 32 | this.repl = message; 33 | 34 | this.cursorPosition = 0; 35 | this.lineCount = 1; 36 | this.stickToBottom = false; 37 | 38 | this.truncateOutput = atom.config.get("language-circuitpython.truncateOutput"); 39 | atom.config.observe("language-circuitpython.truncateOutput", (newValue) => { 40 | this.truncateOutput = newValue; 41 | }); 42 | 43 | this.maxLines = atom.config.get("language-circuitpython.maxLines"); 44 | atom.config.observe("language-circuitpython.maxLines", (newValue) => { 45 | this.maxLines = newValue; 46 | }); 47 | 48 | this.outputBuffer = Buffer.alloc(0); 49 | this.printingOutput = false; 50 | this.floodCount = 0; 51 | this.bufferFlooded = false; 52 | this.resetFlooded = null; 53 | 54 | this.line = ""; 55 | 56 | this.atomSerialPort = atomSerialPort; 57 | 58 | this.connect(); 59 | this.textareaListeners(); 60 | } 61 | 62 | connect() { 63 | this.atomSerialPort.data( (sp) => { 64 | this.sp = sp; 65 | this.parser = new DelayParser(); // This makes sure text is printed smoothly 66 | this.sp.pipe(this.parser); 67 | 68 | this.parser.on("data", (data) => { 69 | this.outputBuffer = Buffer.concat([this.outputBuffer, data]); 70 | this.floodCount++; 71 | this.checkForFlooding(); 72 | // If printingOutput is already scheduled to run, don't call again 73 | if (!this.printingOutput) { 74 | this.printOutput(); 75 | } 76 | }); 77 | 78 | this.sp.on("close", (err) => { 79 | if (err && err.disconnected) { 80 | let shouldScroll = false; 81 | if (this.repl.scrollHeight - this.repl.clientHeight <= this.repl.scrollTop + 10) { 82 | shouldScroll = true; 83 | } 84 | this.repl.value += "\n--- Board Disconnected ---\nUse CTRL-R to attempt reconnect.\n\n"; 85 | this.lineCount+=4; 86 | this.clearLine(); 87 | this.removeExcessLines(); 88 | 89 | if(shouldScroll) { 90 | this.repl.scrollTop = this.repl.scrollHeight; 91 | } 92 | } 93 | }); 94 | }); 95 | } 96 | 97 | textareaListeners() { 98 | // We no longer block the keydown events. If the keydown is a non printing character, 99 | // that is relevant, we send that to the microcontroller. Otherwise, anything that 100 | // results in output to the textarea is handled in the beforeinput event handler. 101 | // This is done so we can properly handle a wider variety of input methods for utf-8 102 | // characters. 103 | this.repl.addEventListener("keydown", (event) => { 104 | // event.keyCode is deprecated but it seems to be the only way to check for a 105 | // keydown event that is part of an IME composition 106 | // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event 107 | // To Note: While it seems like you should be able to use 'key' and check for 108 | // the value "Process", this does not work as the actual key is returned instead 109 | if (this.sp == null || event.isComposing || event.keyCode == 229) 110 | return; 111 | 112 | var shouldScroll = false; 113 | 114 | if (event.key === "Tab") { 115 | event.preventDefault(); 116 | } 117 | 118 | if (event.key in keydownOutput) { 119 | this.sp.write(keydownOutput[event.key]); 120 | shouldScroll = true; 121 | }else if (event.getModifierState("Meta") || // cmd on Mac 122 | (process.platform != "darwin" && // control + shift on anything else 123 | event.getModifierState("Control") && event.getModifierState("Shift"))) { 124 | if (event.key.toLowerCase() == "c") { // Need 'toLowerCase' because on Windows shift key 125 | atom.clipboard.write(this.selectedText()); // is pressed so character is capitalized 126 | }else if (event.key.toLowerCase() == "v") { 127 | this.sp.write(atom.clipboard.read()); 128 | shouldScroll = true; 129 | }else if (event.key.toLowerCase() == "a") { 130 | this.selectAllText(); 131 | } 132 | }else if (event.getModifierState("Control")) { 133 | if (event.key == "r" && !this.sp.isOpen) { // r attempt board reconnect 134 | this.atomSerialPort.close(); 135 | this.connect(); 136 | shouldScroll = true; 137 | }else if (event.key != "Control") { // Ignore keydown of Control key itself 138 | // The microbit treats an input of \x01 as Ctrl+A, etc. 139 | var char = event.key.charCodeAt(0); 140 | if (char >= 97 && char <= 122) { 141 | this.sp.write(String.fromCharCode(1+char-97)); 142 | shouldScroll = true; 143 | } 144 | } 145 | } 146 | 147 | if (shouldScroll) { 148 | this.scrollToBottom(true); 149 | } 150 | }); 151 | 152 | this.repl.addEventListener("beforeinput", (event) => { 153 | if (this.sp == null) 154 | return; 155 | 156 | this.scrollToBottom(true); 157 | var replace = event.isComposing ? this.charsOverBytes(this.cursorPosition, this.repl.selectionStart - this.repl.selectionEnd) : 0; // Needed for IME 158 | if (event.data != null) { 159 | var input = event.data; 160 | if (replace > 0) { 161 | input = "\b".repeat(replace) + input; 162 | } 163 | this.sp.write(input); 164 | } 165 | }); 166 | } 167 | 168 | 169 | printOutput() { 170 | this.printingOutput = true; 171 | this.checkForFlooding(); 172 | 173 | // If 10 or less pixels from bottom then scroll with new output 174 | if (this.repl.scrollHeight - this.repl.clientHeight <= this.repl.scrollTop + 10) { 175 | this.stickToBottom = true; 176 | } 177 | 178 | // Much of this code for communicating with the REPL over Serial 179 | // was converted from the mu text editor. 180 | // https://github.com/mu-editor/mu/blob/ee600ff16753194f33e39975662aba438a8f5608/mu/interface/panes.py#L243:L304 181 | var i = 0; 182 | var data = this.outputBuffer; 183 | // If the buffer is being flooded with too much data, truncate the buffer so the repl will still 184 | // be responsive. This will help if there is a loop outputting text with no delay. 185 | // This functionality can be turned on or off through the 'Truncate Output' setting. 186 | if (this.truncateOutput && this.bufferFlooded && data.length > 2000) { 187 | this.outputBuffer = this.outputBuffer.slice(-500); 188 | data = this.outputBuffer; 189 | this.repl.value += "\n... (Output Truncated) ...\n"; 190 | this.lineCount+=2; 191 | this.insertNewLine(); 192 | } 193 | var start = Date.now(); 194 | while (i < data.length && ((Date.now() - start) < 1000)) { 195 | // If the buffer is flooded, only print out characters for the duration of the parser delay. This is done 196 | // to avoid blocking for too long in this loop. By limiting the duration, new input from the parser 197 | // won't be blocked and won't get too 'backed up'. This also allows for more data to be truncated, if 198 | // necessary, once again avoiding the printing falling too far behind the microcontroller's output. 199 | if (this.bufferFlooded && ((Date.now() - start) >= this.parser.delay)) { 200 | break; 201 | } 202 | 203 | if (data[i] == 8) { // \b 204 | this.moveCursorLeft(1); 205 | }else if (data[i] == 13) { // \r 206 | this.moveCursorTo(0); 207 | }else if (data.length > i + 1 && data[i] == 27 && data[i + 1] == 91) { 208 | // VT100 cursor detected: [ 209 | i+=2; // move index to after the [ 210 | let re = /(?[0-9]*)(;?[0-9]*)*(?[ABCDKm])/; 211 | var m = re.exec(data.slice(i).toString()); 212 | if (m != null) { 213 | // move to (almost) after control seq 214 | // (will ++ at end of loop) 215 | let mEnd = m.index + m[0].length; 216 | i += mEnd-1; 217 | 218 | var count = 1; 219 | if (m.groups.count == "") { 220 | count = 1; 221 | }else{ 222 | count = parseInt(m.groups.count); 223 | } 224 | 225 | if (m.groups.action == "A") { // up 226 | // Not Used 227 | }else if (m.groups.action == "B") { // down 228 | // Not Used 229 | }else if (m.groups.action == "C") { // right 230 | // Not Used 231 | }else if (m.groups.action == "D") { // left 232 | this.moveCursorLeft(count); 233 | }else if (m.groups.action == "K") { // delete things 234 | if (m.groups.count == "") { 235 | this.deleteToEndOfLine(); 236 | } 237 | } 238 | } 239 | }else if (data[i] == 10) { // \n 240 | this.insertNewLine(); 241 | this.removeExcessLines(); 242 | }else{ 243 | var unicodeBytes = this.numberOfBytes(data[i]); 244 | this.writeChar(data, i, i+unicodeBytes); 245 | i+=unicodeBytes-1; 246 | } 247 | i++; 248 | } 249 | 250 | this.updateREPL(); 251 | 252 | if(this.stickToBottom) { 253 | this.scrollToBottom(false); 254 | } 255 | if (this.outputBuffer.length > i) { 256 | // Buffer isn't empty, schedule another printOutput 257 | setTimeout(this.printOutput.bind(this), 0); 258 | this.floodCount++; 259 | }else{ 260 | this.printingOutput = false; 261 | } 262 | this.outputBuffer = this.outputBuffer.slice(i); // Update the buffer to whatever hasn't been printed 263 | 264 | // If enough time passes, reset the flood count 265 | this.resetFlooded = setTimeout(() => { 266 | this.floodCount = 0; 267 | this.resetFlooded = null; 268 | }, 70); 269 | } 270 | 271 | selectedText() { 272 | return this.repl.value.substring(this.repl.selectionStart, this.repl.selectionEnd); 273 | } 274 | 275 | selectAllText() { 276 | this.repl.selectionStart = 0; 277 | this.repl.selectionEnd = this.repl.textLength; 278 | } 279 | 280 | moveCursorTo(position) { 281 | this.cursorPosition = position; 282 | } 283 | 284 | moveCursorLeft(count) { 285 | this.moveCursorTo(this.cursorPosition-this.bytesOverChars(this.cursorPosition,count*-1)); 286 | } 287 | 288 | moveCursorToEnd() { 289 | this.moveCursorTo(this.line.length); 290 | } 291 | 292 | writeChar(charBuffer, start, end) { 293 | var char = charBuffer.toString("utf8", start, end); 294 | this.line = this.line.substring(0, this.cursorPosition) + char + this.line.substring(this.cursorPosition+this.bytesOverChars(this.cursorPosition,1)); 295 | this.moveCursorTo(this.cursorPosition+char.length); 296 | } 297 | 298 | insertNewLine() { 299 | this.line += "\n"; 300 | this.lineCount++; 301 | this.moveCursorToEnd(); 302 | this.updateREPL(); 303 | this.clearLine(); 304 | } 305 | 306 | clearLine() { 307 | this.cursorPosition = 0; 308 | this.line = ""; 309 | } 310 | 311 | deleteToEndOfLine() { 312 | this.line = this.line.substring(0, this.cursorPosition); 313 | this.moveCursorTo(this.cursorPosition); 314 | } 315 | 316 | updateREPL() { 317 | var newLineIndex = this.repl.value.lastIndexOf("\n") + 1; 318 | this.repl.value = this.repl.value.substring(0, newLineIndex) + this.line; 319 | this.repl.selectionStart = this.cursorPosition + newLineIndex; 320 | this.repl.selectionEnd = this.cursorPosition + newLineIndex; 321 | } 322 | 323 | scrollToBottom(stick) { 324 | this.stickToBottom = stick; 325 | var newLineIndex = this.repl.value.lastIndexOf("\n") + 1; 326 | if (this.cursorPosition+newLineIndex != this.repl.selectionEnd) { 327 | this.repl.selectionStart = this.cursorPosition + newLineIndex; 328 | this.repl.selectionEnd = this.cursorPosition + newLineIndex; 329 | } 330 | this.repl.scrollTop = this.repl.scrollHeight; 331 | } 332 | 333 | numberOfBytes(char) { 334 | return (char >= 0xc0 && char < 0xf8) ? ((0xe5 >> ((char >> 3) & 0x6)) & 3) + 1 : 1; 335 | } 336 | 337 | bytesOverChars(pos, numberOfChars) { 338 | var step = numberOfChars > 0 ? 1 : -1; 339 | numberOfChars *= step; 340 | var numBytes = 0; 341 | for(;numberOfChars > 0; numberOfChars--) { 342 | pos += step; 343 | numBytes++; 344 | var charCode = this.line.charCodeAt(pos); 345 | if(charCode >= 0xDC00 && charCode <= 0xDFFF) { 346 | pos += step; 347 | numBytes++; 348 | } 349 | } 350 | return numBytes; 351 | } 352 | 353 | charsOverBytes(pos, numberOfBytes) { 354 | var step = numberOfBytes > 0 ? 1 : -1; 355 | numberOfBytes *= step; 356 | var numChars = 0; 357 | for(;numberOfBytes > 0; numberOfBytes--) { 358 | pos += step; 359 | numChars++; 360 | var charCode = this.line.charCodeAt(pos); 361 | if(charCode >= 0xDC00 && charCode <= 0xDFFF) { 362 | pos += step; 363 | numberOfBytes--; 364 | } 365 | } 366 | return numChars; 367 | } 368 | 369 | removeExcessLines() { 370 | if (this.lineCount > this.maxLines) { 371 | var lines = this.repl.value.split("\n"); 372 | this.repl.value = lines.slice(-40).join("\n"); 373 | this.moveCursorToEnd(); 374 | this.lineCount = 40; 375 | } 376 | } 377 | 378 | checkForFlooding() { 379 | // Clear the resetFlooded scheduled function and check if we are flooded 380 | clearTimeout(this.resetFlooded); 381 | this.resetFlooded = null; 382 | this.bufferFlooded = this.floodCount >= 5; 383 | } 384 | 385 | getTitle() { 386 | return "CircuitPython Serial"; 387 | } 388 | 389 | getDefaultLocation() { 390 | return "bottom"; 391 | } 392 | 393 | getAllowedLocations() { 394 | return ["left", "right", "bottom"]; 395 | } 396 | 397 | serialize() { 398 | return { 399 | deserializer: "language-circuitpython/BoardView" 400 | }; 401 | } 402 | 403 | destroy() { 404 | this.element.remove(); 405 | this.atomSerialPort.close(); 406 | } 407 | 408 | getElement() { 409 | return this.element; 410 | } 411 | } 412 | -------------------------------------------------------------------------------- /lib/language-circuitpython.js: -------------------------------------------------------------------------------- 1 | "use babel"; 2 | 3 | /* global atom */ 4 | 5 | import { BoardView } from "./board-view"; 6 | import { PlotterView } from "./plotter-view"; 7 | import { CompositeDisposable, Disposable } from "atom"; 8 | 9 | import { AtomSerialPort } from "./atom-serialport"; 10 | 11 | import * as fs from "fs"; 12 | 13 | export default { 14 | subscriptions: null, 15 | config: { 16 | darkMode: { 17 | type: "string", 18 | default: "dark", 19 | enum: [ 20 | {value: "dark", description: "Dark Mode - Lines drawn on the plotter will be light"}, 21 | {value: "light", description: "Light Mode - Lines drawn on the plotter will be dark"} 22 | ] 23 | }, 24 | maxLines: { 25 | type: "integer", 26 | default: 100, 27 | minimum: 50, 28 | description: "Maximum lines to display in the serial output console" 29 | }, 30 | truncateOutput: { 31 | type: "boolean", 32 | default: true, 33 | description: "Truncate the output from the microcontroller when it is very long. This can help improve responsiveness." 34 | } 35 | }, 36 | activate() { 37 | // Code taken from https://github.com/adafruit/Atom-fsync-on-save 38 | atom.workspace.observeTextEditors( 39 | function(editor) { 40 | editor.onDidSave(function(event) { 41 | // Sync the file. 42 | var fd = fs.openSync(event.path, "a"); 43 | fs.fsyncSync(fd); 44 | fs.closeSync(fd); 45 | }); 46 | } 47 | ); 48 | this.subscriptions = new CompositeDisposable( 49 | atom.workspace.addOpener(uri => { 50 | if (uri === "atom://language-circuitpython-serial") { 51 | let found = false; 52 | atom.workspace.getPanes().forEach(item => { 53 | item.getItems().forEach(p => { 54 | if (p instanceof BoardView) { 55 | item.activateItemAtIndex(p); 56 | found = p; 57 | } 58 | }); 59 | }); 60 | 61 | if (!found) { 62 | found = new BoardView(this.getAtomSerialPort()); 63 | this.boardView = found; 64 | } 65 | return found; 66 | } 67 | }), 68 | 69 | atom.workspace.addOpener(uri => { 70 | if (uri === "atom://language-circuitpython-plotter") { 71 | // We need a serial connection before we can plot, so toggle 72 | // the serial as well 73 | 74 | // atom.workspace.toggle("atom://language-circuitpython-serial"); 75 | let found = false; 76 | atom.workspace.getPanes().forEach(item => { 77 | item.getItems().forEach(p => { 78 | if (p instanceof PlotterView) { 79 | item.activateItemAtIndex(p); 80 | found = p; 81 | } 82 | }); 83 | }); 84 | 85 | if (!found) { 86 | found = new PlotterView(this.getAtomSerialPort()); 87 | } 88 | return found; 89 | } 90 | }), 91 | 92 | // Register command that toggles this view 93 | atom.commands.add("atom-workspace", { 94 | "language-circuitpython:toggle-serial": () => this.toggleSerial(), 95 | "language-circuitpython:toggle-plotter": () => this.togglePlotter() 96 | }), 97 | 98 | // Destroy any ActiveEditorInfoViews when the package is deactivated. 99 | new Disposable(() => { 100 | atom.workspace.getPaneItems().forEach(item => { 101 | if (item instanceof BoardView || item instanceof PlotterView) { 102 | item.destroy(); 103 | } 104 | }); 105 | }) 106 | ); 107 | 108 | }, 109 | 110 | deactivate() { 111 | this.subscriptions.dispose(); 112 | }, 113 | 114 | togglePlotter() { 115 | atom.workspace.toggle("atom://language-circuitpython-plotter"); 116 | }, 117 | 118 | toggleSerial() { 119 | atom.workspace.toggle("atom://language-circuitpython-serial"); 120 | }, 121 | 122 | deserializeBoardView() { 123 | return new BoardView(this.getAtomSerialPort()); 124 | }, 125 | 126 | deserializePlotterView() { 127 | return new PlotterView(this.getAtomSerialPort()); 128 | }, 129 | 130 | getAtomSerialPort() { 131 | if(this.atomSerialPort == null) { 132 | this.atomSerialPort = new AtomSerialPort(); 133 | } 134 | return this.atomSerialPort; 135 | } 136 | }; 137 | -------------------------------------------------------------------------------- /lib/parser-delay.js: -------------------------------------------------------------------------------- 1 | "use babel"; 2 | 3 | const { Transform } = require("stream"); 4 | 5 | /** 6 | * A transform stream that emits data after a delay, combining any chunks that come in during the delay. 7 | * Useful when the serial out is being broken up, even though it is sent from the device with virtually 8 | * no delay. This combines the data from multiple receptions and presents it as one buffer. 9 | * @extends Transform 10 | * @summary To use the `Delay` parser, you can provide a delay in ms. If no delay is given the default is 10ms. 11 | * @example 12 | const SerialPort = require('serialport') 13 | const { DelayParser } = require("./parser-delay") 14 | const port = new SerialPort('/dev/tty-usbserial1') 15 | const parser = port.pipe(new DelayParser({ delimiter: '\n' })) 16 | parser.on('data', console.log) 17 | */ 18 | export class DelayParser extends Transform { 19 | constructor(options = {}) { 20 | super(options); 21 | 22 | this.delay = options.delay !== undefined ? options.delay : 10; 23 | this.timeoutCall = null; 24 | this.buffer = Buffer.alloc(0); 25 | } 26 | 27 | _transform(chunk, encoding, callback) { 28 | this.buffer = Buffer.concat([this.buffer, chunk]); 29 | if (this.timeoutCall == null) { 30 | this.delayedPush(); 31 | } 32 | callback(); 33 | } 34 | 35 | _flush(callback) { 36 | if (this.timeoutCall != null) { 37 | clearTimeout(this.timeoutCall); 38 | this.timeoutCall = null; 39 | } 40 | this.push(this.buffer); 41 | this.buffer = Buffer.alloc(0); 42 | callback(); 43 | } 44 | 45 | delayedPush() { 46 | this.timeoutCall = setTimeout(() => { 47 | this.push(this.buffer); 48 | this.buffer = Buffer.alloc(0); 49 | this.timeoutCall = null; 50 | }, this.delay); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/plotter-view.js: -------------------------------------------------------------------------------- 1 | "use babel"; 2 | 3 | /* global document atom */ 4 | 5 | import Chart from "chart.js"; 6 | 7 | export class PlotterView { 8 | constructor(atomSerialPort) { 9 | 10 | this.element = document.createElement("div"); 11 | this.element.style = "position: relative; width: 100%; height: 100%; overflow-y: scroll;"; 12 | this.element.classList.add("chart-container"); 13 | 14 | this.chartElem = document.createElement("canvas"); 15 | this.chartElem.classList.add("language-circuitpython-plotter"); 16 | this.chartElem.id = "language-circuitpython-plotter"; 17 | 18 | this.element.appendChild(this.chartElem); 19 | 20 | this.datasetColors = []; 21 | 22 | this.atomSerialPort = atomSerialPort; 23 | this.inputBuffer = Buffer.alloc(0); 24 | 25 | this.connect(); 26 | } 27 | 28 | connect() { 29 | this.atomSerialPort.data( (sp) => { 30 | this.sp = sp; 31 | this.sp.on("data", (data) => { 32 | this.inputBuffer = Buffer.concat([this.inputBuffer, data]); 33 | var lines = this.inputBuffer.toString().split("\r\n"); 34 | for(var line of lines.slice(0,-1)) { 35 | this.useData(line); 36 | } 37 | this.inputBuffer = Buffer.alloc(0); 38 | if (lines[lines.length -1]) { 39 | this.inputBuffer = Buffer.from(lines[lines.length -1], "utf-8"); 40 | } 41 | }); 42 | }); 43 | } 44 | 45 | randomColour() { 46 | let maximum, minimum; 47 | 48 | if (atom.config.get("language-circuitpython.darkMode") == "dark") { 49 | maximum = 255; 50 | minimum = 150; 51 | } else { 52 | maximum = 150; 53 | minimum = 25; 54 | } 55 | 56 | let r = Math.floor(Math.random() * (maximum - minimum + 1) + minimum); 57 | let g = Math.floor(Math.random() * (maximum - minimum + 1) + minimum); 58 | let b = Math.floor(Math.random() * (maximum - minimum + 1) + minimum); 59 | 60 | return [r, g, b]; 61 | } 62 | 63 | createChart(data) { 64 | let ctx = document.getElementById("language-circuitpython-plotter").getContext("2d"); 65 | 66 | let datasets = data.map((v) => { 67 | const [r,g,b] = this.randomColour(); 68 | let d = { 69 | data: [v], 70 | backgroundColor: `rgba(${r}, ${g}, ${b}, 0.2)`, 71 | borderColor: `rgba(${r}, ${g}, ${b}, 1)` 72 | }; 73 | return d; 74 | }); 75 | 76 | this.chart = new Chart(ctx, { 77 | // The type of chart we want to create 78 | type: "line", 79 | 80 | // The data for our dataset 81 | data: { 82 | labels: ["Point 0"], 83 | datasets: datasets 84 | }, 85 | 86 | // Configuration options go here 87 | options: { 88 | maintainAspectRatio: false, 89 | legend: 90 | { 91 | display: false 92 | }, 93 | scales: { 94 | xAxes: [{ 95 | display: false 96 | }] 97 | }, 98 | animation: { 99 | duration: 10 // general animation time 100 | }, 101 | hover: { 102 | animationDuration: 0 // duration of animations when hovering an item 103 | }, 104 | responsiveAnimationDuration: 0 // animation duration after a resize 105 | } 106 | }); 107 | } 108 | 109 | useData(data) { 110 | if(!(data.startsWith("(") && data.endsWith(")"))) { 111 | return; 112 | } 113 | 114 | let values = data.slice(1,-1).split(", ").map(v => parseFloat(v)); 115 | 116 | if(!this.chart) { 117 | this.createChart(values); 118 | this.pointCount = 0; 119 | return; 120 | } 121 | 122 | if(this.pointCount < 80) { 123 | this.chart.data.labels.push(`Point ${this.pointCount + 1}`); 124 | this.pointCount += 1; 125 | 126 | this.chart.data.datasets.forEach((dataset, i) => { 127 | dataset.data.push(values[i]); 128 | }); 129 | 130 | 131 | } else { 132 | this.chart.data.datasets.forEach((dataset, i) => { 133 | dataset.data = dataset.data.slice(1); 134 | dataset.data.push(values[i]); 135 | }); 136 | } 137 | 138 | this.chart.update(); 139 | } 140 | 141 | getTitle() { 142 | return "CircuitPython Plotter"; 143 | } 144 | 145 | getDefaultLocation() { 146 | return "bottom"; 147 | } 148 | 149 | getAllowedLocations() { 150 | return ["left", "right", "bottom"]; 151 | } 152 | 153 | serialize() { 154 | return { 155 | deserializer: "language-circuitpython/PlotterView" 156 | }; 157 | } 158 | 159 | destroy() { 160 | this.element.remove(); 161 | this.atomSerialPort.close(); 162 | } 163 | 164 | getElement() { 165 | return this.element; 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /menus/language-circuitpython.json: -------------------------------------------------------------------------------- 1 | { 2 | "menu": [ 3 | { 4 | "label": "Packages", 5 | "submenu": [ 6 | { 7 | "label": "CircuitPython", 8 | "submenu": [ 9 | { 10 | "label": "Open Serial", 11 | "command": "language-circuitpython:toggle-serial" 12 | }, 13 | { 14 | "label": "Open Plotter", 15 | "command": "language-circuitpython:toggle-plotter" 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-circuitpython", 3 | "version": "0.9.2", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@serialport/binding-abstract": { 8 | "version": "9.0.7", 9 | "resolved": "https://registry.npmjs.org/@serialport/binding-abstract/-/binding-abstract-9.0.7.tgz", 10 | "integrity": "sha512-g1ncCMIG9rMsxo/28ObYmXZcHThlvtZygsCANmyMUuFS7SwXY4+PhcEnt2+ZcMkEDNRiOklT+ngtIVx5GGpt/A==", 11 | "requires": { 12 | "debug": "^4.3.1" 13 | } 14 | }, 15 | "@serialport/binding-mock": { 16 | "version": "9.0.7", 17 | "resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-9.0.7.tgz", 18 | "integrity": "sha512-aR8H+htZwwZZkVb1MdbnNvGWw8eXVRqQ2qPhkbKyx0N/LY5aVIgCgT98Kt1YylLsG7SzNG+Jbhd4wzwEuPVT5Q==", 19 | "requires": { 20 | "@serialport/binding-abstract": "^9.0.7", 21 | "debug": "^4.3.1" 22 | } 23 | }, 24 | "@serialport/bindings": { 25 | "version": "9.0.3", 26 | "resolved": "https://registry.npmjs.org/@serialport/bindings/-/bindings-9.0.3.tgz", 27 | "integrity": "sha512-hnqVqEc4IqGCIjztGkd30V0KcTatQ1T/SS03MZ9KLn6e3y2PSXFqf0TqxB0qF7K9lGHWldMTiPOQaZnuV/oZLQ==", 28 | "requires": { 29 | "@serialport/binding-abstract": "^9.0.2", 30 | "@serialport/parser-readline": "^9.0.1", 31 | "bindings": "^1.5.0", 32 | "debug": "^4.3.1", 33 | "nan": "^2.14.2", 34 | "prebuild-install": "^6.0.0" 35 | } 36 | }, 37 | "@serialport/parser-byte-length": { 38 | "version": "9.0.7", 39 | "resolved": "https://registry.npmjs.org/@serialport/parser-byte-length/-/parser-byte-length-9.0.7.tgz", 40 | "integrity": "sha512-evf7oOOSBMBn2AZZbgBFMRIyEzlsyQkhqaPm7IBCPTxMDXRf4tKkFYJHYZB0/6d1W4eI0meH079UqmSsh/uoDA==" 41 | }, 42 | "@serialport/parser-cctalk": { 43 | "version": "9.0.7", 44 | "resolved": "https://registry.npmjs.org/@serialport/parser-cctalk/-/parser-cctalk-9.0.7.tgz", 45 | "integrity": "sha512-ert5jhMkeiTfr44TkbdySC09J8UwAsf/RxBucVN5Mz5enG509RggnkfFi4mfj3UCG2vZ7qsmM6gtZ62DshY02Q==" 46 | }, 47 | "@serialport/parser-delimiter": { 48 | "version": "9.0.7", 49 | "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-9.0.7.tgz", 50 | "integrity": "sha512-Vb2NPeXPZ/28M4m5x4OAHFd8jRAeddNCgvL+Q+H/hqFPY1w47JcMLchC7pigRW8Cnt1fklmzfwdNQ8Fb+kMkxQ==" 51 | }, 52 | "@serialport/parser-readline": { 53 | "version": "9.0.7", 54 | "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-9.0.7.tgz", 55 | "integrity": "sha512-ydoLbgVQQPxWrwbe3Fhh4XnZexbkEQAC6M/qgRTzjnKvTjrD61CJNxLc3vyDaAPI9bJIhTiI7eTX3JB5jJv8Hg==", 56 | "requires": { 57 | "@serialport/parser-delimiter": "^9.0.7" 58 | } 59 | }, 60 | "@serialport/parser-ready": { 61 | "version": "9.0.7", 62 | "resolved": "https://registry.npmjs.org/@serialport/parser-ready/-/parser-ready-9.0.7.tgz", 63 | "integrity": "sha512-3qYhI4cNUPAYqVYvdwV57Y+PVRl4dJf1fPBtMoWtwDgwopsAXTR93WCs49WuUq9JCyNW+8Hrfqv8x8eNAD5Dqg==" 64 | }, 65 | "@serialport/parser-regex": { 66 | "version": "9.0.7", 67 | "resolved": "https://registry.npmjs.org/@serialport/parser-regex/-/parser-regex-9.0.7.tgz", 68 | "integrity": "sha512-5XF+FXbhqQ/5bVKM4NaGs1m+E9KjfmeCx/obwsKaUZognQF67jwoTfjJJWNP/21jKfxdl8XoCYjZjASl3XKRAw==" 69 | }, 70 | "@serialport/stream": { 71 | "version": "9.0.7", 72 | "resolved": "https://registry.npmjs.org/@serialport/stream/-/stream-9.0.7.tgz", 73 | "integrity": "sha512-c/h7HPAeFiryD9iTGlaSvPqHFHSZ0NMQHxC4rcmKS2Vu3qJuEtkBdTLABwsMp7iWEiSnI4KC3s7bHapaXP06FQ==", 74 | "requires": { 75 | "debug": "^4.3.1" 76 | } 77 | }, 78 | "ansi-regex": { 79 | "version": "2.1.1", 80 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 81 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" 82 | }, 83 | "aproba": { 84 | "version": "1.2.0", 85 | "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", 86 | "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" 87 | }, 88 | "base64-js": { 89 | "version": "1.5.1", 90 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", 91 | "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" 92 | }, 93 | "bindings": { 94 | "version": "1.5.0", 95 | "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", 96 | "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", 97 | "requires": { 98 | "file-uri-to-path": "1.0.0" 99 | } 100 | }, 101 | "buffer": { 102 | "version": "5.7.1", 103 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", 104 | "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", 105 | "requires": { 106 | "base64-js": "^1.3.1", 107 | "ieee754": "^1.1.13" 108 | } 109 | }, 110 | "chart.js": { 111 | "version": "2.9.4", 112 | "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz", 113 | "integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==", 114 | "requires": { 115 | "chartjs-color": "^2.1.0", 116 | "moment": "^2.10.2" 117 | } 118 | }, 119 | "chartjs-color": { 120 | "version": "2.4.1", 121 | "resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz", 122 | "integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==", 123 | "requires": { 124 | "chartjs-color-string": "^0.6.0", 125 | "color-convert": "^1.9.3" 126 | } 127 | }, 128 | "chartjs-color-string": { 129 | "version": "0.6.0", 130 | "resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz", 131 | "integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==", 132 | "requires": { 133 | "color-name": "^1.0.0" 134 | } 135 | }, 136 | "chownr": { 137 | "version": "1.1.4", 138 | "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", 139 | "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" 140 | }, 141 | "code-point-at": { 142 | "version": "1.1.0", 143 | "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", 144 | "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" 145 | }, 146 | "color-convert": { 147 | "version": "1.9.3", 148 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 149 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 150 | "requires": { 151 | "color-name": "1.1.3" 152 | }, 153 | "dependencies": { 154 | "color-name": { 155 | "version": "1.1.3", 156 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 157 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" 158 | } 159 | } 160 | }, 161 | "color-name": { 162 | "version": "1.1.4", 163 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 164 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" 165 | }, 166 | "console-control-strings": { 167 | "version": "1.1.0", 168 | "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", 169 | "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" 170 | }, 171 | "core-util-is": { 172 | "version": "1.0.2", 173 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 174 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 175 | }, 176 | "debug": { 177 | "version": "4.3.1", 178 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", 179 | "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", 180 | "requires": { 181 | "ms": "2.1.2" 182 | } 183 | }, 184 | "decompress-response": { 185 | "version": "4.2.1", 186 | "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", 187 | "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", 188 | "requires": { 189 | "mimic-response": "^2.0.0" 190 | } 191 | }, 192 | "deep-extend": { 193 | "version": "0.6.0", 194 | "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", 195 | "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" 196 | }, 197 | "delegates": { 198 | "version": "1.0.0", 199 | "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", 200 | "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" 201 | }, 202 | "detect-libc": { 203 | "version": "1.0.3", 204 | "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", 205 | "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" 206 | }, 207 | "end-of-stream": { 208 | "version": "1.4.4", 209 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 210 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 211 | "requires": { 212 | "once": "^1.4.0" 213 | } 214 | }, 215 | "expand-template": { 216 | "version": "2.0.3", 217 | "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", 218 | "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" 219 | }, 220 | "file-uri-to-path": { 221 | "version": "1.0.0", 222 | "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", 223 | "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" 224 | }, 225 | "fs-constants": { 226 | "version": "1.0.0", 227 | "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", 228 | "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" 229 | }, 230 | "github-from-package": { 231 | "version": "0.0.0", 232 | "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", 233 | "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" 234 | }, 235 | "has-unicode": { 236 | "version": "2.0.1", 237 | "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", 238 | "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" 239 | }, 240 | "ieee754": { 241 | "version": "1.2.1", 242 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", 243 | "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" 244 | }, 245 | "inherits": { 246 | "version": "2.0.4", 247 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 248 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 249 | }, 250 | "ini": { 251 | "version": "1.3.8", 252 | "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", 253 | "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" 254 | }, 255 | "is-fullwidth-code-point": { 256 | "version": "1.0.0", 257 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", 258 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", 259 | "requires": { 260 | "number-is-nan": "^1.0.0" 261 | } 262 | }, 263 | "mimic-response": { 264 | "version": "2.1.0", 265 | "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", 266 | "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==" 267 | }, 268 | "minimist": { 269 | "version": "1.2.5", 270 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 271 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" 272 | }, 273 | "mkdirp-classic": { 274 | "version": "0.5.3", 275 | "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", 276 | "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" 277 | }, 278 | "moment": { 279 | "version": "2.29.1", 280 | "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", 281 | "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" 282 | }, 283 | "ms": { 284 | "version": "2.1.2", 285 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 286 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 287 | }, 288 | "nan": { 289 | "version": "2.14.2", 290 | "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", 291 | "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" 292 | }, 293 | "napi-build-utils": { 294 | "version": "1.0.2", 295 | "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", 296 | "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" 297 | }, 298 | "node-abi": { 299 | "version": "2.30.0", 300 | "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.30.0.tgz", 301 | "integrity": "sha512-g6bZh3YCKQRdwuO/tSZZYJAw622SjsRfJ2X0Iy4sSOHZ34/sPPdVBn8fev2tj7njzLwuqPw9uMtGsGkO5kIQvg==", 302 | "requires": { 303 | "semver": "^5.4.1" 304 | } 305 | }, 306 | "npmlog": { 307 | "version": "4.1.2", 308 | "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", 309 | "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", 310 | "requires": { 311 | "are-we-there-yet": "~1.1.2", 312 | "console-control-strings": "~1.1.0", 313 | "gauge": "~2.7.3", 314 | "set-blocking": "~2.0.0" 315 | }, 316 | "dependencies": { 317 | "are-we-there-yet": { 318 | "version": "1.1.5", 319 | "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", 320 | "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", 321 | "requires": { 322 | "delegates": "^1.0.0", 323 | "readable-stream": "^2.0.6" 324 | } 325 | }, 326 | "gauge": { 327 | "version": "2.7.4", 328 | "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", 329 | "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", 330 | "requires": { 331 | "aproba": "^1.0.3", 332 | "console-control-strings": "^1.0.0", 333 | "has-unicode": "^2.0.0", 334 | "object-assign": "^4.1.0", 335 | "signal-exit": "^3.0.0", 336 | "string-width": "^1.0.1", 337 | "strip-ansi": "^3.0.1", 338 | "wide-align": "^1.1.0" 339 | } 340 | }, 341 | "isarray": { 342 | "version": "1.0.0", 343 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 344 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 345 | }, 346 | "readable-stream": { 347 | "version": "2.3.7", 348 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 349 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 350 | "requires": { 351 | "core-util-is": "~1.0.0", 352 | "inherits": "~2.0.3", 353 | "isarray": "~1.0.0", 354 | "process-nextick-args": "~2.0.0", 355 | "safe-buffer": "~5.1.1", 356 | "string_decoder": "~1.1.1", 357 | "util-deprecate": "~1.0.1" 358 | } 359 | }, 360 | "string_decoder": { 361 | "version": "1.1.1", 362 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 363 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 364 | "requires": { 365 | "safe-buffer": "~5.1.0" 366 | } 367 | } 368 | } 369 | }, 370 | "number-is-nan": { 371 | "version": "1.0.1", 372 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", 373 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" 374 | }, 375 | "object-assign": { 376 | "version": "4.1.1", 377 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 378 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 379 | }, 380 | "once": { 381 | "version": "1.4.0", 382 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 383 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 384 | "requires": { 385 | "wrappy": "1" 386 | } 387 | }, 388 | "prebuild-install": { 389 | "version": "6.1.3", 390 | "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.3.tgz", 391 | "integrity": "sha512-iqqSR84tNYQUQHRXalSKdIaM8Ov1QxOVuBNWI7+BzZWv6Ih9k75wOnH1rGQ9WWTaaLkTpxWKIciOF0KyfM74+Q==", 392 | "requires": { 393 | "detect-libc": "^1.0.3", 394 | "expand-template": "^2.0.3", 395 | "github-from-package": "0.0.0", 396 | "minimist": "^1.2.3", 397 | "mkdirp-classic": "^0.5.3", 398 | "napi-build-utils": "^1.0.1", 399 | "node-abi": "^2.21.0", 400 | "npmlog": "^4.0.1", 401 | "pump": "^3.0.0", 402 | "rc": "^1.2.7", 403 | "simple-get": "^3.0.3", 404 | "tar-fs": "^2.0.0", 405 | "tunnel-agent": "^0.6.0" 406 | } 407 | }, 408 | "process-nextick-args": { 409 | "version": "2.0.1", 410 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 411 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 412 | }, 413 | "pump": { 414 | "version": "3.0.0", 415 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", 416 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", 417 | "requires": { 418 | "end-of-stream": "^1.1.0", 419 | "once": "^1.3.1" 420 | } 421 | }, 422 | "rc": { 423 | "version": "1.2.8", 424 | "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", 425 | "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", 426 | "requires": { 427 | "deep-extend": "^0.6.0", 428 | "ini": "~1.3.0", 429 | "minimist": "^1.2.0", 430 | "strip-json-comments": "~2.0.1" 431 | } 432 | }, 433 | "safe-buffer": { 434 | "version": "5.1.2", 435 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 436 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 437 | }, 438 | "semver": { 439 | "version": "5.7.1", 440 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 441 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 442 | }, 443 | "serialport": { 444 | "version": "9.0.3", 445 | "resolved": "https://registry.npmjs.org/serialport/-/serialport-9.0.3.tgz", 446 | "integrity": "sha512-1JjH9jtWZ5up2SQTeNPA4I3vhHCDYh1AjN3SybZYf5m9KF9tFVIOGLGIMncqnWKYx3ks/wqfCpmpYUHkFYC3wg==", 447 | "requires": { 448 | "@serialport/binding-mock": "^9.0.2", 449 | "@serialport/bindings": "^9.0.3", 450 | "@serialport/parser-byte-length": "^9.0.1", 451 | "@serialport/parser-cctalk": "^9.0.1", 452 | "@serialport/parser-delimiter": "^9.0.1", 453 | "@serialport/parser-readline": "^9.0.1", 454 | "@serialport/parser-ready": "^9.0.1", 455 | "@serialport/parser-regex": "^9.0.1", 456 | "@serialport/stream": "^9.0.2", 457 | "debug": "^4.1.1" 458 | } 459 | }, 460 | "set-blocking": { 461 | "version": "2.0.0", 462 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 463 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" 464 | }, 465 | "signal-exit": { 466 | "version": "3.0.3", 467 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", 468 | "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" 469 | }, 470 | "simple-concat": { 471 | "version": "1.0.1", 472 | "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", 473 | "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" 474 | }, 475 | "simple-get": { 476 | "version": "3.1.0", 477 | "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", 478 | "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", 479 | "requires": { 480 | "decompress-response": "^4.2.0", 481 | "once": "^1.3.1", 482 | "simple-concat": "^1.0.0" 483 | } 484 | }, 485 | "string-width": { 486 | "version": "1.0.2", 487 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", 488 | "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", 489 | "requires": { 490 | "code-point-at": "^1.0.0", 491 | "is-fullwidth-code-point": "^1.0.0", 492 | "strip-ansi": "^3.0.0" 493 | } 494 | }, 495 | "strip-ansi": { 496 | "version": "3.0.1", 497 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 498 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 499 | "requires": { 500 | "ansi-regex": "^2.0.0" 501 | } 502 | }, 503 | "strip-json-comments": { 504 | "version": "2.0.1", 505 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 506 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" 507 | }, 508 | "tar-fs": { 509 | "version": "2.1.1", 510 | "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", 511 | "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", 512 | "requires": { 513 | "chownr": "^1.1.1", 514 | "mkdirp-classic": "^0.5.2", 515 | "pump": "^3.0.0", 516 | "tar-stream": "^2.1.4" 517 | } 518 | }, 519 | "tar-stream": { 520 | "version": "2.2.0", 521 | "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", 522 | "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", 523 | "requires": { 524 | "bl": "^4.0.3", 525 | "end-of-stream": "^1.4.1", 526 | "fs-constants": "^1.0.0", 527 | "inherits": "^2.0.3", 528 | "readable-stream": "^3.1.1" 529 | }, 530 | "dependencies": { 531 | "bl": { 532 | "version": "4.1.0", 533 | "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", 534 | "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", 535 | "requires": { 536 | "buffer": "^5.5.0", 537 | "inherits": "^2.0.4", 538 | "readable-stream": "^3.4.0" 539 | } 540 | }, 541 | "readable-stream": { 542 | "version": "3.6.0", 543 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", 544 | "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", 545 | "requires": { 546 | "inherits": "^2.0.3", 547 | "string_decoder": "^1.1.1", 548 | "util-deprecate": "^1.0.1" 549 | } 550 | }, 551 | "safe-buffer": { 552 | "version": "5.2.1", 553 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 554 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 555 | }, 556 | "string_decoder": { 557 | "version": "1.3.0", 558 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", 559 | "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", 560 | "requires": { 561 | "safe-buffer": "~5.2.0" 562 | } 563 | } 564 | } 565 | }, 566 | "tunnel-agent": { 567 | "version": "0.6.0", 568 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 569 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 570 | "requires": { 571 | "safe-buffer": "^5.0.1" 572 | } 573 | }, 574 | "util-deprecate": { 575 | "version": "1.0.2", 576 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 577 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 578 | }, 579 | "wide-align": { 580 | "version": "1.1.3", 581 | "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", 582 | "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", 583 | "requires": { 584 | "string-width": "^1.0.2 || 2" 585 | } 586 | }, 587 | "wrappy": { 588 | "version": "1.0.2", 589 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 590 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 591 | } 592 | } 593 | } 594 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-circuitpython", 3 | "main": "./lib/language-circuitpython", 4 | "version": "0.9.2", 5 | "description": "Integrate CircuitPython devices straight into Atom!", 6 | "keywords": [], 7 | "activationCommands": { 8 | "atom-workspace": [ 9 | "language-circuitpython:toggle-serial", 10 | "language-circuitpython:toggle-plotter" 11 | ] 12 | }, 13 | "repository": "https://github.com/jb3/language-circuitpython", 14 | "license": "MIT", 15 | "engines": { 16 | "atom": ">=1.0.0 <2.0.0" 17 | }, 18 | "dependencies": { 19 | "chart.js": "^2.8.0", 20 | "serialport": "9.0.3", 21 | "@serialport/bindings": "9.0.3" 22 | }, 23 | "deserializers": { 24 | "language-circuitpython/BoardView": "deserializeBoardView", 25 | "language-circuitpython/PlotterView": "deserializePlotterView" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spec/language-circuitpython-spec.js: -------------------------------------------------------------------------------- 1 | "use babel"; 2 | 3 | /* global describe beforeEach atom it expect waitsForPromise runs */ 4 | 5 | import { BoardView } from "../lib/board-view"; 6 | 7 | // Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs. 8 | // 9 | // To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit` 10 | // or `fdescribe`). Remove the `f` to unfocus the block. 11 | 12 | describe("CircuitPython", () => { 13 | let workspaceElement, activationPromise; 14 | 15 | beforeEach(() => { 16 | workspaceElement = atom.views.getView(atom.workspace); 17 | activationPromise = atom.packages.activatePackage("language-circuitpython"); 18 | }); 19 | 20 | describe("when the language-circuitpython:toggle-serial event is triggered", () => { 21 | it("hides and shows the modal panel", () => { 22 | // Before the activation event the view is not on the DOM, and no panel 23 | // has been created 24 | expect(workspaceElement.querySelector(".language-circuitpython")).not.toExist(); 25 | 26 | // This is an activation event, triggering it will cause the package to be 27 | // activated. 28 | atom.commands.dispatch(workspaceElement, "language-circuitpython:toggle-serial"); 29 | 30 | waitsForPromise(() => { 31 | return activationPromise; 32 | }); 33 | 34 | runs(() => { 35 | let found; 36 | atom.workspace.getPanes().forEach(item => { 37 | item.getItems().forEach(p => { 38 | if (p instanceof BoardView) { 39 | item.activateItemAtIndex(p); 40 | found = true; 41 | } 42 | }); 43 | }); 44 | 45 | expect(found).toBe(true); 46 | }); 47 | }); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /styles/language-circuitpython.less: -------------------------------------------------------------------------------- 1 | // The ui-variables file is provided by base themes provided by Atom. 2 | // 3 | // See https://github.com/atom/atom-dark-ui/blob/master/styles/ui-variables.less 4 | // for a full listing of what's available. 5 | @import "ui-variables"; 6 | 7 | .language-circuitpython-serial { 8 | } 9 | 10 | // These styles are used to make the textarea appear like a
 element.
11 | .atom-circuitp-code {
12 |   font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
13 |   font-size: var(--editor-font-size);
14 |   line-height: var(--editor-line-height);
15 |   padding: 8px;
16 |   box-shadow: none;
17 |   color: @text-color;
18 |   background: @inset-panel-background-color;
19 |   border-radius: @component-border-radius;
20 |   border: none;
21 |   margin: 0;
22 | }
23 | 


--------------------------------------------------------------------------------