Commit graph

21 commits

Author SHA1 Message Date
Evelyn Eastmond
ec432e3b2f Refactor for hardware extensions (#1555)
* Beginning refactor: renaming 'device' to 'peripheral', shortening function names, reordering functions, etc.

* Continuing refactoring: renaming some functions to be more verbose in the runtime, adding JSDocs, etc.

* Changing 'device' to 'peripheral', etc.

* Changing 'session' to 'socket'.

* Fixing EV3 menus and menu arg validation, reordering functions, etc.

* Add _send, add some references to documentation, etc.

* Factored out _outputCommand and _inputCommand, renamed some enums, etc.

* Fixed _outputCommand, some other minor cleanup.

* Make _outputCommand and _inputCommand public.

* Added TODO.

* Renamed BLE UUID enums to be clearer.

* Change WeDo2 in comments to WeDo 2.0, etc.

* Changed some WeDo2Motor command names, cleaned up some JSDocs.

* Beginning a major EV3 refactor.

* WeDo2 formatting and comment changes.

* Motor refactoring in EV3: motorTurnClockwise and motorTurnCounterClockwise initial working state.

* Add reminders to possibly cast motor menu args in WeDo2.

* Continue to move motor commands in EV3 to EV3Motor class, don't create new EV3Motor on every poll cycle, etc.

* Factoring EV3 polling value commands, etc.

* Fixing EV3 motor power, position and button pressed, and some commenting, etc.

* Move EV3 motor position parsing to EV3Motor class, move directCommand and directCompoundCommand functions, some commenting, etc.

* Changed WeDo2 motor label enum name.

* Removed some EV3 motor functions that aren't needed, changed menu label enum names, moved some opcodes up to enums.

* Fixing comments and documentation.

* Some commenting.

* Adding further documentation and references to PDFs, changed reply check to be safer, etc.

* Some comment changes.

* Moving some functions around in EV3 and WeDo2 to match.

* Commenting, etc.

* Some renaming of session, etc.

* Fix stopAllMotors in EV3.

* Fixing clearing of motors in EV3.

* Some comment changes.

* Change runtime .extensions/registerExtension to .peripheralExtensions/registerPeripheralExtension.

* Renaming outputCommand/inputCommand to generateOutputCommand/generateInputCommand, etc.

* Moved motorCommandIDs to EV3Motor class, renamed directCommand to generateCommand, etc.

* Adding a reminder to rename something.

* JSDoc fix in EV3Motor class.

* Fixing microbit function name.

* Adding a todo item.

* Changing Ev3 menu formats to be backwards compatible, moving a BLE function up.

* Fixing EV3 ports again, and button pressed returning a boolean.

* Fixing menu value to be a string in EV3.
2018-09-07 17:01:23 -04:00
Evelyn Eastmond
5320dfb676 WeDo2 backwards compatibility update (#1518)
* Resolving #1492: No longer trying to make WeDo2 backwards compatible with Scratch Link API v1.0.

* Closing the socket on all BLE/BT errors.

* Adding BT disconnection.
2018-08-22 17:45:26 -04:00
Evelyn Eastmond
5395f9c321 WeDo2 changes for upcoming smoke test (#1493)
* Starting on #1491: use 'startNotifications' instead of 'read'.  Still need to make backwards compatible.

* Fixing #1489: WeDo2 set light color block should wrap values to 0-100.

* Fixing #1488: WeDo2 should not clear LED light on stop button.

* Fixing to support negative LED light color inputs.

* Removing a binding.

* Using wrapClamp for inputHue for LED color block.
2018-08-19 22:09:57 -04:00
Eric Rosenbaum
83b3eabf1d
Regulate micro:bit send timing (#1471)
* display blocks yield for 50ms

* WIP on microbit command send timing

* WIP on microbit command send timing

* Cleanup and JSDOC

* Send “withResponse” param to Link

* Remove caching, add busy timeout
2018-08-16 15:38:03 -04:00
Evelyn Eastmond
82df80a04c Fixing lint error. 2018-08-15 11:44:49 -04:00
Evelyn Eastmond
d61f6e3d6f Fixing #1460: 'set motor direction' block should work while a motor is running. 2018-08-15 11:39:26 -04:00
Evelyn Eastmond
f01733f019 WeDo2 Extension: First Pass (#1441)
* Adding WeDo2 connection/disconnection over Scratch Link BLE.

* Testing motor and LED output.

* Reading sensor attachment and registering for sensor notifications.

* Motor indexing.

* Some refactoring notes.  Moving some functions around.

* Refactoring and enums.

* Removing some comments

* Fixing linting error.

* Fixing tilt reporter values and added stopAll bound to stop button to stop piezo, LED and motors.
2018-08-13 17:10:55 -04:00
Evelyn Eastmond
6444cf071d Feature/critical extension fixes (#1383)
* Resolves - Turning micro bit power off doesn't disconnect microbit #1366.

* Resolves EV3 motor block causes distance to return 0 #1363.

* Fixing linting.

* Tweak micro:bit auto-disconnect timeout.
2018-07-24 11:08:48 -04:00
Evelyn Eastmond
c4ee7065a2 EV3/Microbit critical fixes for code freeze (#1354)
* Resolves - BLESession and BTSession should emit PERIPHERAL_SCAN_TIMEOUT #1348.

* Resolves - BLESession should handle 'could not find service' error #1350.

* Resolves - BTSession should handle 'no peripheral connected' error #1351.

* Fixing a typo that caused device scan timeout bugs.

* Resolves - Add casting and clamping throughout the EV3 extension #1352.

* Fixing a linting error.

* Further fixes for issue #1351.
2018-07-17 16:03:05 -04:00
Eric Rosenbaum
1dcdfc9548
Use secure web socket address for ble and bt connection (#1359) 2018-07-17 15:40:47 -04:00
Evelyn Eastmond
133ade7f48 EV3 port and sensor polling updates (#1342)
* Add motor rotate, without coasting yet.  Fixed some todos.

* Removing logging.

* Implemented motor set position, motor set power, and beep note for time blocks.  Changed labels on motor blocks.  Tracking motor speeds for all ports.

* Fixing motor ports to 0-3 and then output bit field when sending commands.

* Added stop all motors with stop button.  Added port masking function.  Some cleanup.  Moved beeping up an octave.

* Combine device list polling and sensor polling into a single timeout call, device list requested every 20 times.

* Don't reset sensors on device update.  Don't store undefined sensor/motor values.  Some comments.

* Fixing some linting.
2018-07-13 13:14:53 -04:00
Paul Kaplan
82a33691d3 Set internal connected flag before emitting event 2018-07-10 15:57:25 -04:00
Eric Rosenbaum
1cc013ea1b Stringify errors 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
d79efbece8 Some logging cleanup. 2018-07-09 13:49:41 -04:00
Eric Rosenbaum
6f5ff31eb3 Add disconnectExtensionSession and getPeripheralIsConnected 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
2d8ad05a78 Adding Ev3 extension with three test blocks to latest device-connection work, auto-connecting to device for now. 2018-07-09 13:49:40 -04:00
Evelyn Eastmond
4332725d33 Adding more errors based on web socket onerror and onclose. Moved extension runtime mapping of devices back to MicroBit class. 2018-07-09 13:41:57 -04:00
Evelyn Eastmond
9d66c54f8a Adding error reporting to runtime from BLESession. 2018-07-09 13:41:57 -04:00
Evelyn Eastmond
73cc149783 Adding promises to return on BLE write. Some refactoring. 2018-07-09 13:41:57 -04:00
Evelyn Eastmond
701f430e56 Remove pinging in BLE connection. 2018-07-09 13:41:57 -04:00
Evelyn Eastmond
730b798686 Extension/runtime protocol refactoring. 2018-07-09 13:41:57 -04:00