Commit graph

280 commits

Author SHA1 Message Date
jokebookservice1
bbefc18158
test: correct typo for function name 2018-09-17 23:25:40 +01:00
jokebookservice1
460b1745be
test: Ensure less-than compares well 2018-09-17 23:12:30 +01:00
Chris Willis-Ford
8977ce1e93
Merge pull request #1565 from cwillisf/extension-monitors
Extension monitors
2018-09-12 18:10:12 -04:00
Christopher Willis-Ford
2a13697621 Add tests for getLabelForOpcode 2018-09-12 17:23:01 -04:00
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
Eric Rosenbaum
39be6d873c
Rate-limiting with a token bucket for the WeDo extension (#1540)
* Initial version of token bucket

* Add rateLimiter util

* Remove check for motor.isOn in stopAllMotors

* Fix unit test

* Fix unit test with stubbed timer, and cleanup

* Add comment

* Reduce WeDo rate limit to 20 sends/sec

* Move rate limit into a constant

* Stop button stops motors and tone even if rate limit exceeded
2018-08-29 17:37:59 -04:00
Karishma Chadha
3fb48f9aa4 Add and update tests for deleteCostume functionality. 2018-08-21 15:42:14 -04:00
Karishma Chadha
6f9da87abe
Merge pull request #1503 from kchadha/restore-sound
Restore sound
2018-08-21 15:28:39 -04:00
Karishma Chadha
a8c56948cb Clean up test. 2018-08-21 15:23:14 -04:00
Karishma Chadha
0c53659476
Merge pull request #1475 from towerofnix/fix-repeat-count
Use round() instead of floor() in repeat
2018-08-21 12:58:54 -04:00
Corey Frang
ae219e361a Add comments for deserialization and add tests 2018-08-20 13:25:24 -04:00
Karishma Chadha
e0a1f464ce Add and update unit tests for sound deletion. 2018-08-20 12:49:30 -04:00
Florrie
5af79a086b Use round() instead of floor() in repeat, add unit test 2018-08-14 20:27:18 -03:00
Karishma Chadha
5d25a5afcf Add unit tests for new duplicate variable functions on target. 2018-08-07 18:21:01 -04:00
Paul Kaplan
79ab2fcb72 Add turbo mode events 2018-08-02 10:00:21 -04:00
Paul Kaplan
ac550d2d38
Merge pull request #1387 from paulkaplan/userdata-io-device
Add UserData ioDevice for setting and getting username from blocks
2018-07-24 15:13:15 -04:00
Karishma Chadha
812e7a3772 Preserve sprite layer order information across saving and loading an sb3. 2018-07-24 11:00:48 -04:00
Karishma Chadha
2508dc46ca Order sprites in 2.0 projects based on the serailzied indexInLibrary property. Store original ordering (e.g. layer order of sprites on the stage) to use when installing targets. 2018-07-23 15:25:05 -04:00
Paul Kaplan
6d4c6df692 Add UserData ioDevice for setting and getting username from blocks 2018-07-23 09:38:58 -04:00
Karishma Chadha
99c1ce9286 Fix variable conflict that arises during sprite upload where the sprite may reference a global variable that conflicts with the name of a local variable on a different sprite in the project. 2018-07-17 15:37:28 -04:00
Karishma Chadha
2b2fc2e561 Code cleanup, refactor, abstraction 2018-07-13 12:58:45 -04:00
Karishma Chadha
13df3e7bd6 Add unit tests and fix object shallow vs. deep copying bug. 2018-07-13 09:36:43 -04:00
Paul Kaplan
2c7de6380e Add implementation for "When loudness >" block 2018-07-05 09:42:00 -04:00
Ray Schamp
4525139d59
Merge pull request #1212 from mzgoddard/unwrapped
execute optimization by unwrapping recursion
2018-07-02 11:20:01 -04:00
kchadha
d187517d85
Merge pull request #1256 from kchadha/sprite-save-load
Sprite save load
2018-06-25 11:21:01 -04:00
Karishma Chadha
f06b8a3943 Clean up calls to fixUpVariableReferences 2018-06-25 09:11:48 -04:00
Ray Schamp
9afe401dca Revert "Revert #1260, #1258, #1239"
This reverts commit 28f90648b0.
2018-06-22 09:33:08 -04:00
Ray Schamp
28f90648b0 Revert #1260, #1258, #1239
This reverts commits
c268bbae47
61dacfc915
30b8cb8eb1
2018-06-22 09:30:17 -04:00
Corey Frang
c087cf326a soundbank tests 2018-06-21 17:00:03 -04:00
Karishma Chadha
889443fcef fixUpVariableReferences should handle conflicting local variables that don't have blocks referencing them. Add unit tests for the function. 2018-06-20 12:07:42 -04:00
Karishma Chadha
073bb37c30 Add a test for 'getAllVariableAndListReferences' function. 2018-06-20 10:32:36 -04:00
Paul Kaplan
6e2af4f3cc
Merge pull request #1244 from paulkaplan/sharing-apis
Add shareSound and shareCostume APIs with unit tests to the VM
2018-06-19 11:31:00 -04:00
Evelyn Eastmond
d09c3f0418 MicroBit extension, Scratch Link first draft. (#1230)
* First microbit gui tests

* Fixed JSONRPC inheritance.  Renamed ScratchBLE/ScratchBT files.  Removed ScratchBT test code from Microbit extension.  Renamed addLine to log.

* Fixed log comments.  Removed addLine from Microbit.

* Adding auto-connect to Microbit at extension loading.  Adding hack for displayText block to Scratch-Link.

* Resolved merge conflicts and brought in latest microbit extension example code.

* Updated microbit write tests for displayText and displaySymbol blocks.  Some linting.

* Some linting and adding of BLE Characteristic consts.

* Linting fixes.

* Moving micro:bit device connection code all to the MicroBit class, decoupling Scratch3MicroBitBlocks from connection code.

* Removing old disconenct handlers from MicroBit class.  Moved service into new BLEUUID data structure.

* Renamed _write to _send.  Moved all BLE encoding concerns to the _send method.

* Using the util log.  Some linting.

* Added _read method to MicroBit class.  Renamed _send to _write.

* Some linting and formatting comments.

* First pass at peripheral chooser pattern for ScratchBLE.

* Testing characteristicDidChange events, and some changes to ScratchBLE on ready events.

* Refactoring work on PeripheralChooser and ScratchBLE.

* Some variable renaming and method signature stubs.

* Peripheral chooser method signatures.

* Moved base64 encoding/decoding to util.  Some method signature formatting.

* Adding test stubs for new util and io classes.

* Adding test stub for MicroBit extension.

* Clean up for PR.

* Clean up for PR.

* Final cleanup for PR.

* Removed logging to console.

* Adding 'btoa' and 'atob' node modules and using them in Base64Util.
2018-06-18 14:56:51 -04:00
Paul Kaplan
1dcd174dea Add shareSound and shareCostume APIs with unit tests to the VM 2018-06-18 10:39:22 -04:00
kchadha
da30abbfb5
Merge pull request #1240 from kchadha/block-comment-disappearing-bugfix
Add comment id to block when converting from XML to vm representation.
2018-06-15 17:36:48 -04:00
Karishma Chadha
f3d49f75c8 Clean up comment serialization, add tests for new and old serialization (old is still valid, just more verbose). 2018-06-15 14:57:49 -04:00
Karishma Chadha
76b423e481 Make sure to set comment property of block when creating a new block via XML using the adapter. Update unit tests. 2018-06-15 13:58:03 -04:00
Karishma Chadha
861d801d88 Add tests for comment save and load. 2018-06-14 16:58:03 -04:00
Paul Kaplan
bd80e4262d
Merge pull request #1231 from paulkaplan/reorder-tarrgets
Add top-level `reorderTarget` API to VM
2018-06-13 11:07:52 -04:00
kchadha
3308a7c6a2
Merge pull request #1229 from kchadha/imported-comment-positioning-fix
Update position for comments imported from 2.0 projects after auto-positioning.
2018-06-13 09:51:45 -04:00
Paul Kaplan
0ec0ea6ef7 Add reorderTarget API to VM 2018-06-13 09:20:22 -04:00
Florrie
c24e34d4e3 Remove unused getCostumeName function 2018-06-12 19:32:29 -03:00
Karishma Chadha
240701d65a Add some tests for comments... 2018-06-12 18:29:43 -04:00
Michael "Z" Goddard
05291aa254
turn reporter tree into instruction sequence
Turn the reporter tree execute walks into a sequence of block
functions. After calling a block function store the reported value in
the arguments object its depending block will use.

- Set the reported value on the thread. There is only ever one "just"
  reported value, which is read and stored elsewhere after being
  reported.
2018-06-12 14:21:40 -04:00
Florrie
93d6b23772 Test for getCostumeName 2018-06-09 21:52:46 -03:00
Paul Kaplan
0cd50fbb2c Propagate the return value of reorder functions, update comments 2018-06-06 11:13:30 -04:00
Paul Kaplan
837703d4ac Make reorder functions return if a change occurred.
Gotta get that testing coverage percent up :)
2018-06-06 09:43:54 -04:00
Paul Kaplan
e6ebc33e9e Add sound and costume reordering methods and tests to top-level API 2018-06-06 09:43:54 -04:00
Paul Kaplan
d3fd3ff806 Add reorderSound and unit test to rendered-target 2018-06-06 09:43:54 -04:00
Paul Kaplan
5fd5b30ccf Add reorderCostume method and unit test to rendered target 2018-06-06 09:43:54 -04:00