Commit graph

3700 commits

Author SHA1 Message Date
Christopher Willis-Ford
bcda700818 add existing extension docs in docs directory 2019-04-05 14:26:59 -07:00
Kevin Andersen
d9e0267fa0 Resolves #2086. This issue was caused by turnOnForDegrees() not resolving a promise. Additionally, this promise can only be resolved if its assigned before turnOnDegrees() was called, so in motorOnForRotation() it is now switched around. 2019-04-05 14:18:33 -04:00
Kevin Andersen
2ee8042b6a Resolves #2085
This was caused because the case for BoostMessage.PORT_FEEDBACK didn't handle the BoostPortFeedback.DISCARDED type, which corresponds to a command failing on the Boost hub.
2019-04-05 13:35:28 -04:00
Kevin Andersen
2c6a9d85cf Resolves #2087 and #2088 for rotation-based commands.
There's quite a few interactions between degrees, their sign, and the currently set direction for the motor the degrees relate to. In this case, BoostMotor.turnOnDegrees() was being run with -degrees, and since that function does a Math.max between 0 and degrees, it resulted in 0 degrees.

Because of this, and for clarity, turnOnDegrees now only gets called with positive values. If running CCW, that should be specified in the direction-parameter.
2019-04-05 13:05:52 -04:00
Kevin Andersen
e3cdbffa2a Resolves #2089.
Partly resolves #2087, #2088.

This was happening because scratch-vm is responsible for timed motor commands rather than using the Boost hubs commands to run motors for a specific amount of time.
This meant that when we simply sent a motorOn-command, the hub would immediately return feedback for the motor that the command had completed.
The fix for this was, for timed motor commands, to not receive feedback from the motor, and instead have scratch-vm modify the BoostMotor._status.

TODO: Fix for rotation-based commands.

Agreed. Changed to 50%.

- BoostMotorMaxPower changed to BoostMotorMaxPowerAdd and now describes an extra boost (no pun intended) to the motor. Documentation added that describes the feature.
- _colorBucket renamed to _colorSamples for clarity.
- oldColor is renamed to previousColor, and is now initialized in this._sensors.
- Modified documentation.
2019-04-04 15:37:48 -04:00
Kevin Nørby Andersen
f02433510a
Merge pull request #2061 from knandersen/boostextension
Add LEGO BOOST Scratch 3.0 extension
2019-04-03 19:05:37 -04:00
Chris Willis-Ford
e6cc678cef
Merge pull request #2083 from cwillisf/extension-buttons
Allow extensions to make buttons
2019-04-03 12:28:09 -07:00
Christopher Willis-Ford
a1abcf3226 Add a comment clarifying the items in _blockInfo[0].blocks 2019-04-03 11:36:38 -07:00
Christopher Willis-Ford
0162bfc71e Test the info field in converted extension data
There are parts of the extension registration process which rely on the
`info` field being non-null, even for block separators. At one point
during development I broke that, so here's a test to hopefully prevent
someone else from getting bitten by the same thing.
2019-04-03 11:02:56 -07:00
Christopher Willis-Ford
4cdbb26f57 Explicitly check that every extension block has an opcode 2019-04-03 11:01:00 -07:00
Christopher Willis-Ford
87a88e2caf Add a button to the CoreEx extension 2019-04-02 23:13:01 -07:00
Christopher Willis-Ford
9eef05a7c5 Use new Scratch-specific callback keys for extension buttons 2019-04-02 22:47:26 -07:00
Kevin Andersen
d8f7b2c74f updated package-lock.json 2019-04-02 19:32:07 -04:00
Christopher Willis-Ford
d59c6a0b73 Fix missing arg for extension block separators 2019-04-02 15:23:48 -07:00
Christopher Willis-Ford
254edd48d5 Add unit test for extension button 2019-04-01 18:09:09 -07:00
Christopher Willis-Ford
bed54bae1f Allow extensions to make buttons 2019-04-01 18:09:09 -07:00
picklesrus
b951e2b74b Use new items from the translate extension languages map to show the right things in edge cases where Scratch and Google have different language codes and support different things.
Also standarizes some last uses of the langauge code where it hadn't 
been lowercased yet.
2019-04-01 17:40:57 -04:00
Kevin Andersen
330fcc5297 Merge branch 'boostextension' of https://github.com/knandersen/scratch-vm into boostextension 2019-04-01 06:40:18 -04:00
Kevin Andersen
7f0355169e Cleaned up documentation and removed extra line breaks in response to @evhan55 PR comments 2019-04-01 06:38:29 -04:00
Katie Broida
445ee46984
Merge pull request #1943 from ktbee/clock-timer-compat-fix
Start executing hats before other threads change values
2019-03-29 13:01:28 -04:00
Katie Broida
2a60391fb4 Make Scratch 3 project timer more compatible with Scratch 2 currentMSecs usage
These compatibility changes:
 - Use runtime.currentMSecs for the Clock timer "now" value
 - Start executing hats before other threads change values
 - Update test and fixtures to work with earlier hat execution
 - Add test for hat execution block order
2019-03-29 11:43:37 -04:00
Karishma Chadha
e89f5d0361
Merge pull request #2060 from kchadha/load-core-extension
Load core extensions synchronously
2019-03-28 14:05:16 -04:00
Karishma Chadha
2fbd152c53 Make loadExtensionURL consistent with error handling logic in loadExtensionIdSync 2019-03-27 17:42:10 -04:00
Kevin Nørby Andersen
b608a4856b
Merge branch 'develop' into boostextension 2019-03-27 10:21:32 -07:00
Karishma Chadha
eccdeff2ce Use async require with coreExample extension. Log a warning when attempting to load a non-built in extension synchronously. Simplify unit test. 2019-03-26 12:03:00 -04:00
Eric Rosenbaum
d49c7b732c stub timer to fix flaky test 2019-03-26 11:56:50 -04:00
Ray Schamp
2f62773984
Merge pull request #2069 from ericrosenbaum/bugfix/load-vernier-code
Load Vernier extension code
2019-03-26 09:46:06 -04:00
Eric Rosenbaum
b9a6f4165a Load Vernier extension code 2019-03-25 17:13:39 -04:00
Karishma Chadha
061b0b081f Refactor loadExtensionURL for readability. 2019-03-25 16:39:00 -04:00
Karishma Chadha
efcb801fe3
Apply suggestions from code review
Add error cases in new functions and remove todo comment.

Co-Authored-By: kchadha <kchadha@media.mit.edu>
2019-03-25 16:32:51 -04:00
Eric Rosenbaum
fce555fc7d
Merge pull request #2068 from ericrosenbaum/bugfix/vernier-stabilize-facing
Stabilize Vernier "turned faced up/down" hat events
2019-03-25 16:24:22 -04:00
Eric Rosenbaum
138af7a491 Stabilize facing up and facing down 2019-03-25 15:15:45 -04:00
picklesrus
45ef63a648 Remove unused import. 2019-03-25 11:35:06 -04:00
Eric Rosenbaum
d07cc5dffb
Merge pull request #2063 from ericrosenbaum/feature/vernier-facing-options
Move facing options into gesture menu
2019-03-25 10:56:03 -04:00
picklesrus
2cf1d21b09 Fix #4573 by using an existing utitlity that re-ids blocks when we duplicate a sprite. 2019-03-25 10:18:00 -04:00
Eric Rosenbaum
b5bdc20d13 Move facing options into gesture menu 2019-03-22 17:13:46 -04:00
Eric Rosenbaum
e236d29ff5
Merge pull request #2059 from ericrosenbaum/feature/add-tts-hindi
Add Hindi language to Text to Speech
2019-03-22 16:42:35 -04:00
Karishma Chadha
30c9b7fd84 Add tests and update core example to handle stage being undefined. 2019-03-22 12:20:07 -04:00
Karishma Chadha
0e710ba3d9 Allow loading extensions synchronously. Add example extension to list of known internal extensions. 2019-03-22 12:20:06 -04:00
Karishma Chadha
bc2824dfdc Add an example core blocks category using the extension spec. 2019-03-22 12:17:10 -04:00
Eric Rosenbaum
b3ef49a8bb Add Hindi language to Text to Speech 2019-03-21 16:06:42 -04:00
Kevin Andersen
601c9d230f Moved Scratch3BoostBlocks-functions around so that they are properly grouped, i.e. motors, tilt, color, etc 2019-03-21 14:50:39 -04:00
Kevin Andersen
256758122d Merge changes from LLK/develop 2019-03-21 14:11:27 -04:00
Kevin Andersen
64355e8584 changed BoostColorSampleSize to 5 to avoid false readings of black 2019-03-21 14:01:49 -04:00
Kevin Andersen
20967fe768 changed wording of setMotorPower-block to use speed instead of power 2019-03-21 13:56:47 -04:00
Kevin Andersen
02d047cfbd Stabilized color-sensing by:
- Creating Boost._colorBucket will contains BoostColorSampleSize-amount of samples
- Boost._onMessage administers the _colorBucket and assigns Boost._sensors.color a value if all items in the bucket match.

E.g. if BoostColorSampleSize is set to 3, three continuous readings of the same color are required for the color to be detected by scratch-vm.
2019-03-21 13:46:51 -04:00
Paul Kaplan
f33b15affa
Merge pull request #2058 from ericrosenbaum/bugfix/remove-tts-hindi
Remove Hindi from text2speech extension
2019-03-21 11:06:33 -04:00
Eric Rosenbaum
1339841bc4 Remove Hindi from text2speech extension
Low quality speech synthesis, needs investigation
2019-03-21 11:00:43 -04:00
Kevin Andersen
bfb61c0df4 - Removed unused IOs
- Renamed BoostOutputCommandFeedback to BoostPortFeedback and its values for brevity
- Removed buf2hex-function
- Removed BoostMotor._pendingPositionOrigin (unused)
- Removed Boost._led (unused)
- Simplified _onMessage-handling of BoostPortFeedback-messages
- motorOnForRotation() now returns a Promise.all rather than a single promise. This solves  two bugs:
-- when running turn ABCD for 3 rotations without motors connected to CD, the block would finish yielding immediately.
-- when running turn C for X rotations without a motor connected to C, the motor would never finish yielding.
2019-03-20 13:50:24 -04:00
Evelyn Eastmond
35d255319b
Merge pull request #2055 from evhan55/extensions/disconnect-fixes
Fix hardware extension disconnect behavior
2019-03-20 11:01:36 -04:00