Evelyn Eastmond
597bd68c0d
Remove commented line.
2019-04-29 09:21:06 -04:00
Evelyn Eastmond
f0edd10346
Change turnOnForever and turnOff behavior for power = 0 case.
2019-04-29 09:21:06 -04:00
adroitwhiz
3410f42e5e
Remove Number.isNaN IE polyfill
2019-04-25 16:41:51 -04:00
Karishma Chadha
39f15d3699
Update comment for new extension update event
2019-04-25 11:36:31 -04:00
unknown
a0f0a4092c
Moving position reversal back to reporter to avoid conflicts.
2019-04-24 22:42:54 -04:00
Evelyn Eastmond
a61b01628e
Putting back a line deleted by accident.
2019-04-24 11:28:29 -04:00
Karishma Chadha
92a73fef55
Add a runtime event to track when the toolbox extension blocks need updating.
2019-04-24 11:28:02 -04:00
Evelyn Eastmond
e3ec614173
Move reversing of sign to _onMessage, before clamping.
2019-04-24 11:24:56 -04:00
Evelyn Eastmond
adb4c0482c
Reversing the sign on Motor A reported position.
2019-04-23 19:05:12 -04:00
Eric Rosenbaum
b80b05ead7
Merge pull request #2131 from ericrosenbaum/feature/add-tts-arabic
...
Add Arabic to Text to Speech extension
2019-04-23 17:23:19 -04:00
Christopher Willis-Ford
91f0d59be0
fix extension block color application
2019-04-23 12:31:31 -07:00
Karishma Chadha
297047a6b9
Fix serialization of blockInfo mutation property to XML
2019-04-23 11:44:45 -04:00
Christopher Willis-Ford
a27ea76d25
add "scratch_extension" only if a block has an icon
2019-04-22 17:47:31 -07:00
Christopher Willis-Ford
107e49245f
adjust getBlocksXML to return categories separately
...
before: getBlocksXML returns one big XML string
after: getBlocksXML returns an array of {id,xml}, one entry per category
2019-04-22 12:32:52 -07:00
Christopher Willis-Ford
0247447792
embed extension blockInfo into block XML
2019-04-22 09:53:05 -07:00
Evelyn Eastmond
9a60d10190
Adding send interval delay to setMotorDirection opcode.
2019-04-22 12:17:47 -04:00
Evelyn Eastmond
26e6d25325
Make set motor speed opcode yield for send interval duration.
2019-04-22 11:59:02 -04:00
Eric Rosenbaum
f1c1883881
Add Arabic to Text to Speech
2019-04-21 21:18:56 -04:00
Christopher Willis-Ford
bd1aaecdf3
add category info to extension add & update events
2019-04-19 16:06:11 -07:00
Christopher Willis-Ford
833d33355c
retrieve blockInfo from args when isDynamic is set
2019-04-19 16:06:11 -07:00
Christopher Willis-Ford
638062e982
pass blockInfo
to extension methods
...
Sometimes a single extension method needs to service several different
instances of the same opcode. This can happen with variables or custom
procedures, for example. This change allows the extension method to
inspect the `blockInfo` for instance data, including arbitrary
extension-specific properties if necessary.
2019-04-19 14:35:35 -07:00
Michael "Z" Goddard
ebdf3865d4
retire new threads if they have no block after the hat
2019-04-19 16:48:09 -04:00
Michael "Z" Goddard
548e28480a
add BlocksRuntimeCache; rewrite startHats
2019-04-19 13:22:22 -04:00
Michael "Z" Goddard
c3f9e0945b
determine _pushThread defaults without Object.assign
2019-04-19 13:22:20 -04:00
Christopher Willis-Ford
a308b1e02f
use xmlEscape instead of escape-html for extensions
2019-04-17 16:48:58 -07:00
Karishma Chadha
23136ad9c3
Revert "Cache hat block information for the runtime"
2019-04-17 16:05:24 -04:00
Karishma Chadha
a984d1ae9d
Merge pull request #1930 from mzgoddard/runtime-script-cache
...
Cache hat block information for the runtime
2019-04-17 15:55:47 -04:00
Eric Rosenbaum
ddd5bb2d7b
Merge pull request #2119 from ericrosenbaum/bugfix/boost-color-sensing-fixes
...
BOOST color sensing fixes
2019-04-16 15:44:13 -04:00
Eric Rosenbaum
8dc4832100
Reorganize color ids and indices
2019-04-16 15:24:39 -04:00
Katie Broida
eedc0b16e0
Merge pull request #2041 from ktbee/use-empty-bitmap-size
...
Set height and width to zero for the canvas and costume size if bitmap's sourceHeight or sourceWidth are zero
2019-04-16 14:50:42 -04:00
Kevin Nørby Andersen
1c8dfea382
Merge pull request #2115 from knandersen/bugfix/2108
...
Fix #2108 by making setMotorPower() and setMotorDirection() yield for a tick
2019-04-15 18:41:28 -04:00
Eric Rosenbaum
07768652f9
clean up whencolor is seeingcolor functions
2019-04-15 11:34:02 -04:00
Eric Rosenbaum
1381d2c4c0
Add boolean “seeing color brick?”
2019-04-15 09:59:03 -04:00
Eric Rosenbaum
bd5bc7947b
rename hat to “when color brick seen”
2019-04-15 09:58:44 -04:00
Eric Rosenbaum
0cadf685b2
Remove color reporter
2019-04-12 17:14:34 -04:00
Eric Rosenbaum
d77944beff
Clean up detection of color any
2019-04-12 17:09:10 -04:00
Eric Rosenbaum
c25b84d510
Clean up color sensing using IDs
2019-04-12 16:56:09 -04:00
Kevin Andersen
6611abec9e
Makes setMotorPower() and setMotorDirection() yield for a tick
2019-04-12 14:12:43 -04:00
Kevin Andersen
12e969119a
Simplified the return value for when power is 0 in motorOnForRotation()
2019-04-12 14:07:26 -04:00
Kevin Andersen
a98f3af2e1
Added a special case in motorOnForRotation() to avoid hanging blocks if power is 0
2019-04-12 13:56:29 -04:00
Kevin Andersen
8ece9757aa
changes BoostMotor.status(value) to reset all motor state
2019-04-12 12:27:54 -04:00
Kevin Andersen
3f0816bac8
This commit addresses point 1 from the discussion with @ericrosenbaum around moving the setting of motor-state into the BoostMotor-class rather than having it in the opcodes.
...
- turnOn() renamed to _turnOn() and marked as a private function, i.e. it should only be called by BoostMotor-functions, not opcodes.
- New function turnOnForever() to be called by opcodes.
- turnOff() now sets the motor state.
- _clearRotationState now does a check for null rather than a truthy value
- all motor state setting removed from Boost-class and opcodes: stopAllMotors(), motorOnFor(), motorOnForRotation(), motorOn(), motorOff()
- turnOnForever(), turnOnFor() and turnOnForDegrees() now have a resetState-parameter with the default value of true. This allows the setMotorPower() and setMotorDirection()-functions to not reset state, to avoid them resolving the promises of the original motor commands that they are affecting.
2019-04-12 11:33:10 -04:00
Michael "Z" Goddard
39b18fedde
stop all removes threads from future execution
...
Stop all does not **stop** all threads. It stops the active thread and
removes all other threads from executing in the future.
2019-04-11 14:42:10 -04:00
Kevin Andersen
cd7319d044
Added state-change for Boost.stopAllMotors()
2019-04-11 14:07:07 -04:00
Kevin Andersen
c3908b5f2c
removed power wrongly being set in setMotorDirection()
2019-04-11 11:16:51 -04:00
Kevin Andersen
ba2aaf90dd
Corrected documentation for BoostMotor._clearRotationState()
2019-04-11 11:12:52 -04:00
Kevin Andersen
63726044e4
Major change of motor state handling to increase reliability, clear responsibility of handling state, and readability of the code.
...
BoostMotor now has a status getter/setter that replaces isOn() and is responsible for clearing various motor state parameters.
A new BoostMotorState-enum contains the possible states a motor can be in.
Since time-based motor commands really just trigger a BoostMotor.turnOn(), it's the opcodes that are responsible for setting the motor state.
2019-04-11 10:39:56 -04:00
Eric Rosenbaum
66ff92433e
Merge pull request #2107 from ericrosenbaum/bugfix/boost-when-color
...
Fix BOOST whenColor hat
2019-04-10 10:30:20 -04:00
picklesrus
d182659a57
Merge pull request #2065 from picklesrus/duplicate-sprites
...
Fix #4573 by using an existing utitlity that re-ids blocks when we du…
2019-04-10 09:05:53 -04:00
Karishma Chadha
51ad4185d1
Update src/sprites/sprite.js
...
Don't use object.values because it doesn't work in old Safaris.
Co-Authored-By: picklesrus <picklesrus@users.noreply.github.com>
2019-04-10 08:55:54 -04:00
Eric Rosenbaum
c0ea5be1d3
Fix whenColor hat
2019-04-09 17:36:14 -04:00
Kevin Andersen
b8bbe80c4f
get position from this._peripheral.motor()
2019-04-09 16:20:21 -04:00
Kevin Andersen
b2c18e9dcd
BoostMotor.power(value) now sets to 0 if value is 0 rather than scaling, to ensure that blocks skip immediately if speed set to 0
2019-04-09 15:34:08 -04:00
Kevin Andersen
75fc37aa30
Fixed conflicts
2019-04-09 14:57:27 -04:00
Kevin Andersen
41873bf7bf
Use the power-getter rather than accessing the property directly
2019-04-09 14:52:41 -04:00
Kevin Andersen
3e55841011
Resolves #2087 and #2088 . Because we weren't clearing a motor's _pendingPromiseFunction after executing it, it kept lingering, which made setMotorPower() and setMotorDirection() trigger a rotation-based command even if was responding to a timed or forever motorcommand. By clearing the property every time we fire the function, and by using pendingPromiseFunction as the conditional in setMotorPower() and setMotorDirection(), this should be taken care of.
2019-04-09 11:45:42 -04:00
Kevin Andersen
7b917cabb4
Added isBusy-flag in onMessage to make sure promises aren't resolved if the motor is still busy. Added check in motorOnForRotation() that ensure that any previous pendingPromiseFunction() is resolved before creating a new one, to avoid hanging blocks
2019-04-09 09:30:26 -04:00
Kevin Andersen
19e6a1d4c9
Merge branch 'develop' of https://github.com/LLK/scratch-vm into bugfix/2089,2088,2087
2019-04-09 08:51:28 -04:00
Kevin Andersen
c664fca9d7
changed getMotorPosition() to use the Boost.motor()-function instead of accessing the _motors-property directly
2019-04-09 08:47:00 -04:00
Kevin Andersen
ecbbacd4c0
It seems like there's a tradeoff between how we choose to set the max power of the motors. Previously, I had set the motors' max power (torque) to follow their target speed, meaning they accelerated smoothly, but also lost their torque. Then in the following commit I changed the max power to 100 which means maximum torque to achieve the target speed, which resulted in very abrupt accelerations and erratic motor movement when changing speeds:
...
873b56c985
In the following commit I changed the functionality so that we add a fixed amount (10) more power than the target speed, e.g. for speed 50 it would provide power 60. This is fine for high speeds, but for low speeds it provides poor torque:
e3cdbffa2a
I assume it would be possible to design some sort of calculation that enabled high torque for low speeds, and vice versa. I will discuss with the team.
2019-04-08 17:56:54 -04:00
Kevin Andersen
e24ace83a0
noticed several instances of getting especially power and direction properties from private variables instead of using the getter
2019-04-08 17:48:30 -04:00
Kevin Andersen
e986b0f4cb
- changed max power setting in motor functions to be calculated with MathUtil.clamp() instead of MathUtil.wrapClamp() to avoid values rolling over!
...
- added an else-case to both setMotorDirection() and setMotorPower() so that dynamic speed/direction changes also affect the motorOn()-blocks just like the time- and rotation-based ones.
2019-04-08 13:48:10 -04: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
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
Christopher Willis-Ford
d59c6a0b73
Fix missing arg for extension block separators
2019-04-02 15:23:48 -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
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
138af7a491
Stabilize facing up and facing down
2019-03-25 15:15:45 -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
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
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
Eric Rosenbaum
6951151fd5
Merge pull request #2056 from ericrosenbaum/bugfix/text2speech-name-localization
...
Localize name of Text to Speech extension
2019-03-20 10:28:57 -04:00
Kevin Andersen
5f6c8b1efd
Reworked motor-system to allow the setMotorPower- and setMotorDirection-blocks to modify the motor behavior if the motor is already running.
...
- BoostMotor-class now has pendingPositionDestination, the rotation-equivalent of pendingTimeout, that stores a destination the motor should reach. When using setMotorPower() or setMotorDirection() while a motorOnForRotation()-block is running, a new motorOnForRotation()-command will be run for the remaining amount of degrees but with new power/direction, cancelling the old command.
- BoostMotor._status is only affected by feedback from the hub.
- setMotorPower() and setMotorDirection() no longer yields, since they just set state.
From design meeting regarding block design:
- Renamed all motors-label to ABCD.
- Added 'AB' motor label to address built-in motor pair.
- use the word direction in the setMotorDirection-block
- moved argument label in motor position reporter
- changed wording of color-sensing block.
- removed isTilted-boolean reporter
- removed changeLightHueBy-block
- fixed pingDevice-function bug.
2019-03-19 18:34:12 -04:00
Michael "Z" Goddard
f6616eb2b8
Merge pull request #2009 from mzgoddard/sb3-load-assets-first
...
Deserialize sb3 assets before loading data
2019-03-19 17:24:58 -04:00
Eric Rosenbaum
55257c0bf7
Localize name of Text to Speech extension
2019-03-19 12:24:51 -04:00
Evelyn Eastmond
65b05a9da4
Fixing disconnect to handle different cases differently.
2019-03-19 10:44:33 -04:00
Eric Rosenbaum
68e7f24bb9
Revert "Rate limiting for micro:bit using TaskQueue"
2019-03-18 10:16:50 -04:00
Eric Rosenbaum
7f69e0ce3f
Merge pull request #2046 from ericrosenbaum/feature/tts-add-single-language-voices2
...
Add eight new languages to Text to Speech extension
2019-03-14 16:42:07 -04:00
Evelyn Eastmond
94ca11f721
Merge pull request #2024 from evhan55/extensions/microbit-rate-limiting
...
Rate limiting for micro:bit using TaskQueue
2019-03-13 22:02:26 -04:00
Evelyn Eastmond
7d7193cb29
Merge pull request #2043 from evhan55/bug/extensions-device-scan
...
Device scan discovery fix
2019-03-13 19:39:07 -04:00
Paul Kaplan
8d4be4eec5
Merge pull request #2045 from paulkaplan/fix-adding-custom-input
...
Allow for situation where we get a move event to attach a shadow.
2019-03-13 17:04:15 -04:00
picklesrus
7807dcecb4
Merge pull request #2042 from ktbee/clamp-graphics-effect
...
add clampEffect for limiting range of brightness and ghost effects
2019-03-13 15:23:18 -04:00
Kevin Andersen
55ccc4e77a
Implemented pingDevice() which, like the WeDo 2.0 extension, tries to read from the Boost Hub at a given interval. If it doesn't hear back from the hub, it assumes the device has been disconnected.
2019-03-13 14:35:53 -04:00
Kevin Andersen
873b56c985
- Motor-power functionality changed!
...
-- Using a max-power setting of 100 rather than following the speed in the motor-commands will allow motors to run at really slow speeds.
-- As a result, motor-commands now use max-power of 100 regardless of speed and setMotorPower no longer scales according to a minimum speed of 20.
- BLE-rate enums consolidated into BoostBLE enum
2019-03-12 17:35:43 -04:00
Michael "Z" Goddard
f4e49563d6
start loading sb3 assets before handling sb3 data
2019-03-12 17:16:13 -04:00
Michael "Z" Goddard
82d19bac4d
Merge pull request #1956 from mzgoddard/lazy-eval-big-dependencies
...
Lazy eval big dependencies
2019-03-12 17:11:26 -04:00
Michael "Z" Goddard
96f3e3414e
add BlocksRuntimeCache; rewrite startHats
2019-03-12 17:09:59 -04:00
Eric Rosenbaum
bed0b05bc9
Log error instead of returning null
2019-03-12 14:29:39 -04:00
Katie Broida
92c1711937
add clampEffect for limiting range of brightness and ghost effects
2019-03-12 11:14:11 -04:00
Joke Book
4b3234c9d8
Resolve linting issues
2019-03-11 23:51:27 +00:00
Joke Book
7e2012c805
Switch algorithm to map most things to +1
2019-03-11 22:01:11 +00:00
Joke Book
7e23168913
Remove and fix comments
2019-03-11 21:59:03 +00:00
Paul Kaplan
2b53b8b647
Allow for situation where we get a move event to attach a shadow.
...
This happens after adding a custom procedure input to an existing custom procedure call block.
2019-03-11 14:52:40 -04:00
unknown
80196093a4
Changing disconnect connection check to websocket open status instead of peripheral connection.
2019-03-11 11:59:33 -04:00
Joke Book
43faf2a64d
Use a utility function for random number picking
2019-03-09 14:30:17 +00:00
Eric Rosenbaum
580e93d15a
fix norwegian id
2019-03-07 17:00:48 -05:00
Eric Rosenbaum
9455112d74
improve variable name
2019-03-07 17:00:40 -05:00
Katie Broida
c37745e97e
Cast sprite name to string before getSpriteTargetByName
2019-03-07 16:09:46 -05:00
unknown
c603e0d653
Fixing linting errors.
2019-03-07 08:38:52 -05:00
unknown
0a9f629fb4
Comment out console logs.
2019-03-07 08:26:38 -05:00
unknown
43fde03f57
Fixing the comment yet again.
2019-03-06 13:17:06 -05:00
unknown
f1fc54bfaf
Fixing comment based on cwf suggestion.
2019-03-06 13:13:57 -05:00
unknown
2148e9ead1
Adding stopAll binding back in after un-rebased merge.
2019-03-06 13:08:55 -05:00
unknown
54ed67ac22
Adding TaskQueue import back in after un-rebased merge.
2019-03-06 12:57:32 -05:00
unknown
7a14dad668
Removing console logs that came in accidentally via un-rebased merge.
2019-03-06 12:55:04 -05:00
unknown
fed43e1841
Removing busy flag again which was reintroduced via a un-rebased merge.
2019-03-06 12:53:17 -05:00
unknown
b31a1f0e98
Move argument processing outside of TaskQueue.do calls.
2019-03-06 12:47:44 -05:00
Evelyn Eastmond
f5dc90f729
Fixing comment again.
2019-03-06 12:47:44 -05:00
Evelyn Eastmond
d2c14f872c
Fixing comment.
2019-03-06 12:47:44 -05:00
Evelyn Eastmond
00d1a407ac
Fixing some comments.
2019-03-06 12:47:44 -05:00
Evelyn Eastmond
3c77f82238
Changing maxTokens and refillRate for microbit test.
2019-03-06 12:47:44 -05:00
Evelyn Eastmond
fb36731ce4
Add catches for task queue Promise rejections, and some debug console logs.
2019-03-06 12:47:44 -05:00
Evelyn Eastmond
eecd508464
Fix usage of task queue with an opcode that has its own promise/time delay resolution (i.e. displayText in microbit).
2019-03-06 12:46:56 -05:00
Evelyn Eastmond
dbb884ddef
Removing task queue constructor hacks.
2019-03-06 12:46:08 -05:00
Evelyn Eastmond
6688106852
Continuing to test the newest TaskQueue with microbit.
2019-03-06 12:44:22 -05:00
Eric Rosenbaum
59586291d7
Comments
2019-03-06 12:03:54 -05:00
Eric Rosenbaum
ee0d395b9c
Cleanup check supported and get extension locale
2019-03-06 12:03:46 -05:00
Michael "Z" Goddard
882a83db9a
do not evaluate text-encoding until it is needed
...
text-encoding has about ~700KB of data that is great to skip decoding
for systems that have a browser provided TextDecoder.
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
bc5605cf80
lazy evaluate project loading related code
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
a5009b4c59
delay extension evaluation until that extension is installed
...
Reduce the amount of code that needs to evaluated before we can
starting the target project if there is one. It is key to note that the
music extension includes ~2MB of base64 encoded sound samples. This
skips evaluating those samples and decoding base64 into binary typed
arrays.
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
d05a414439
turn getCanvas into a class CanvasPool
2019-03-06 10:53:15 -05:00
Eric Rosenbaum
8fc3111b21
use id for default language
2019-03-06 10:51:08 -05:00
Michael "Z" Goddard
c01175613b
load-costume: idiomatic promise and createImageBitmap
2019-03-06 10:49:27 -05:00
Michael "Z" Goddard
9bd1bc5915
load-costume: use one canvas pool
2019-03-06 10:49:27 -05:00
Eric Rosenbaum
65d0a3aa11
cleanup
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
d059f8baa6
Check and set language, handling many-to-one mapping
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
ab633d3448
WIP updating to use new language info data
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
bc9e215ee8
Fill in language info data
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
04c6bc189a
Add language ids
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
da212bcf06
wip switching from using locales to language IDs internally
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
920096d061
Add romanian and fix ordering
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
3996cc0c6b
Add Welsh, Swedish and Turkish
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
f33e07132e
Add hindi, korean, norwegian, and adjust rates
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
5b5c0d80eb
Set tenor playback rate for single gender languages
2019-03-06 10:37:36 -05:00
Eric Rosenbaum
0d12cead31
key language info by locale id, and add chinese
2019-03-06 10:37:36 -05:00
Katie Broida
aeea9c1a51
Use bitmap source width
2019-03-05 16:05:07 -05:00
Kevin Andersen
a4e005cf2b
Merge branch 'develop' of https://github.com/LLK/scratch-vm into boostextension
2019-03-04 18:11:26 -05:00
Kevin Andersen
6cf00a4235
Linted
2019-03-04 17:39:02 -05:00
Evelyn Eastmond
cd85e8ddfa
Merge pull request #2014 from evhan55/extensions/microbit-timeout
...
Fix micro:bit auto-disconnect from setInterval to setTimeout
2019-03-04 15:29:38 -05:00
Michael "Z" Goddard
33f4482127
Merge pull request #1972 from mzgoddard/sound-bank-over-sprite
...
Sound bank over sprite
2019-03-04 12:51:10 -05:00
Michael "Z" Goddard
9350c2a9c2
Merge pull request #1947 from mzgoddard/sb2-load-assets-first
...
Deserialize sb2 assets before other sprite data and blocks
2019-03-04 12:50:09 -05:00
Kevin Andersen
852ae43348
This commit is a combination of changes after an internal play test with the Scratch Team, as well as code cleanup.
...
Motors:
- motor position will now initially report 0 instead of false
- removed remaining motor position zeroing functions.
- removed startBraking().
- turnOn() and turnOnForDegrees() are now using an absolute max power as per the protocol documentation.
- the "turn for rotations"-block now accepts negative values.
-- turnOnForDegrees() accepts a direction to reflect the change above. The direction from the block is calculated against the motors current direction.
- commented EV3 tacho calculation code for motor positioning removed.
- Changed BoostMotorLabel to reflect actual motor block argument.
- startMotorPower() renamed to setMotorPower() since it doesn't start the motor.
- setMotorPower() will not start the motor.
- Max number of rotations for a motor-block is clamped to 100 rotations.
- 'Default' removed from BoostMotorLabel-enum as it wasn't used.
Sensors:
- removed remaining distance-related functions.
- color-reporters default value is now none rather than black.
- tilt-angles left and right switched to reflect the hubs orientation.
2019-03-04 12:38:02 -05:00
Kevin Andersen
669ff1abf1
- Boost-icon added to blocks
...
- Added BoostColorLabel-enum for color sensing block argument labels
- Regrouped blocks to be grouped by functionality, promoting color sensing
- Added 'any' to whenColor hat-block which triggers if the color sensor reports a value that is not none. Implemented an oldColor-value that allows the hat-block to trigger between color-changes, even if the sensor doesnt see 'none' in the meantime.
2019-03-01 11:36:57 -05:00
Evelyn Eastmond
59ab3b717d
Fixing clearInterval > clearTimeout.
2019-03-01 10:04:56 -05:00
Evelyn Eastmond
7a1367d81a
Change from setInterval to setTimeout for auto disconnect feature.
2019-03-01 10:02:30 -05:00
Kevin Andersen
ed051cdd82
Changed color-sensing values to be strings instead of LEGO numbering, which seems more intuitive.
2019-02-27 15:49:24 -05:00
Kevin Andersen
d2d236d282
After discussion with @ericrosenbaum, decided to change the following:
...
- Regroup blocks by functionality, i.e. motors, led, color-sensing, etc.
- Remove motor position zero-ing as concept and use MathUtil.wrapClamp to instead wrap everything around 360 degrees.
- WIP: "Set motor power to"-block should update motors that are currently running to emphasize principle that blocks have actions.
2019-02-27 15:19:40 -05:00
Kevin Andersen
7fc705b741
- Consolidated BLE enums for brevity
...
- Added IOs from documentation to BoostIO enumotor follows the speed set by Scratch and not the highest possible speed.
- Cleaned up line breaks in codebrake rather than float when stopping.
- Cleaned up documentationensors
- Deleted unused MOTOR_OUTPUT from BoostMode-enumbased on BoostMode-enum
- Set default-value for "set motor power to"-block to be all motors after feedback from @ericrosenbaum
- Implemented check in getMotorPosition() to see if motor is actually there before reporting position
2019-02-26 14:44:13 -05:00
Chris Willis-Ford
bb42c0019c
Merge pull request #1998 from cwillisf/task-queue-enhancements
...
Task queue enhancements
2019-02-25 21:28:05 -05:00
Katie Broida
cff1c2c0a4
Merge pull request #1959 from ktbee/declare-const-once
...
Declare const once to be reused in for loop
2019-02-25 15:57:52 -05:00
Karishma Chadha
475eaf3dfa
Merge pull request #1969 from mzgoddard/benchmark-more-data
...
Benchmark more data
2019-02-25 11:38:09 -05:00
Michael "Z" Goddard
0e9357b062
benchmark load now
...
This is a slight ergonomics improvement for faster benchmark loading.
We should be able to apply this to gui as well if it already does do
the same thing.
2019-02-22 16:01:09 -05:00
Michael "Z" Goddard
991acbb36a
benchmark more loading stats
...
- Display time to load just the (json) data
- Display progress and time for content
- Display progress and time hydrating the downloaded assets
2019-02-22 16:01:08 -05:00
Michael "Z" Goddard
84de5cdc7e
determine _pushThread defaults without Object.assign
2019-02-22 15:56:34 -05:00
Kevin Andersen
40c022ca8e
- Refactoring of output commands:
...
- Simplified generateOutputCommand() to follow the LEGO Wireless Protocol command-structure. Every output-command must have a portID, execution information, sub-command, and then followed by a custom payload which must be defined according to the protocol documentation mentioned in the extension.
- Simple motor commands now use the above subcommand-structure rather than the former primitive command structure.
- stopLED()-function removed since it's not used
- Implemented check of pendingPromiseFunction() for motors before firing.
2019-02-22 12:50:19 -05:00
Kevin Andersen
9767d72188
- Cleaned up TODOs!
...
- Added and made use of more enums rather than hardcoded bytes
2019-02-21 14:47:30 -05:00
Kevin Andersen
a3dcdd01dd
Merge branch 'develop' of https://github.com/LLK/scratch-vm into boostextension
2019-02-21 14:00:43 -05:00
Kevin Andersen
1d72b3b971
- Removed unused distance-mode from BoostMode-enum
...
- Added descriptions to BoostMode-enums
- Improved motor-position handling
- Added helper-functions for converting to/from motor position values
- Added default value to BoostMotor._pendingPromiseFunction
- Added changeLedColorBy-block
- Only motors will now try to resolve motor-promises
- Changed motor position wording from 'zero' to 'reset'
- Modified tilt-thresholds to improve tilt-handling
2019-02-21 13:35:21 -05:00
Joke Book
b29f07636d
fix: Equalise the chances when picking a random backdrop
2019-02-20 21:11:27 +00:00
Eric Rosenbaum
c0e80edfcc
Update block and menu icons
2019-02-20 11:13:00 -05:00
Eric Rosenbaum
931d7e9a62
More re-ordering
2019-02-20 11:00:21 -05:00
Eric Rosenbaum
9e650279a6
Re-order blocks
2019-02-20 10:59:07 -05:00
Eric Rosenbaum
7da54dd067
Add tilted any option
2019-02-20 10:49:03 -05:00
Eric Rosenbaum
a19585af75
Add tilt blocks
2019-02-19 16:09:58 -05:00
Eric Rosenbaum
ba548701e2
Set update rate to 80ms
2019-02-19 15:14:37 -05:00
Eric Rosenbaum
f4662f833f
rename “tilt angle” and “spin speed” reporters
2019-02-19 15:06:03 -05:00
Eric Rosenbaum
ec2ca32ffa
Remove “moved” gesture
2019-02-19 13:55:24 -05:00
Christopher Willis-Ford
e6dd3f1175
Fix TaskQueue constructor when no options passed
2019-02-15 15:20:38 -08:00
Michael "Z" Goddard
146e93e4ec
start loading sb2 sounds before handling sb2 data
2019-02-15 17:43:55 -05:00
Michael "Z" Goddard
d4320f1c26
start loading sb2 assets before handling sb2 data
2019-02-15 17:34:14 -05:00
Karishma Chadha
a86dc5bb58
Merge pull request #1944 from mzgoddard/benchmark-load-time
...
Benchmark load time
2019-02-15 13:52:48 -05:00
Kevin Andersen
e99a217ba5
Merge branch 'develop' of https://github.com/LLK/scratch-vm into boostextension
2019-02-14 13:31:13 -05:00
Kevin Andersen
32a9674b5d
Added disconnect-handling per new extensions-spec. Motor-commands that fail will now also cause their blocks to complete
2019-02-14 13:30:58 -05:00
unknown
ac571ece5a
Fixing comment.
2019-02-13 14:14:05 -05:00
Evelyn Eastmond
8bbdc4e691
Resolves #1988 : Vernier gdxfor tilt values should be 0 when disconnected.
2019-02-13 14:14:05 -05:00
Chris Willis-Ford
7ab41d2bd9
Merge pull request #1881 from apple502j/pen-legacy
...
Fix legacy `set pen color` block's transparency behavior
2019-02-13 10:51:47 -08:00
Chris Willis-Ford
a02fb3877b
Merge pull request #1871 from Affonso-Gui/fix_dynamic_menu_string
...
Fix dynamic menus for string arrays
2019-02-13 10:41:36 -08:00
Paul Kaplan
3b203a2a9b
Merge pull request #1995 from paulkaplan/is-discrete
...
Support isDiscrete flag on monitors
2019-02-13 11:19:51 -05:00
Christopher Willis-Ford
be040f4c9b
TaskQueue: Add option for max total cost
2019-02-12 18:57:58 -08:00
Christopher Willis-Ford
2a9a3b11b9
TaskQueue: support canceling a single task
2019-02-12 18:11:13 -08:00
Kevin Andersen
245ba998d2
merge changes from origin/develop
2019-02-12 13:18:28 -05:00
chrisgarrity
77fd88302f
Merge pull request #1993 from chrisgarrity/handle-nested-sb2
...
handle sb2 files zipped in a folder
2019-02-12 16:41:27 +01:00
Kevin Andersen
e2bd28b85e
Cleaned up documentation (WIP). Added Output subcommand enum for use throughout extension
2019-02-12 10:10:21 -05:00
Karishma Chadha
59f58b0284
Merge pull request #1933 from ErikMejerHansen/feature/field_type_support
...
Feature/field type support
2019-02-12 09:59:22 -05:00
Christopher Willis-Ford
d27dc5d54a
TaskQueue: reduce number of async steps before task runs
2019-02-11 12:46:48 -08:00
Christopher Willis-Ford
5a17bb1451
Add clearTimeout
to Timer and MockTimer
2019-02-11 12:14:44 -08:00
Kevin Andersen
c902bbaa0d
Cleaned up some documentation. Consolidated and renamed Boost enums
2019-02-11 11:30:22 -05:00
Paul Kaplan
6754fa9334
Add isDiscrete to monitor record, update sb2,3 and conversion tests
2019-02-11 11:09:01 -05:00
Kevin Andersen
bf02426a4a
added named variables to onMessage for readability. Changed wording of motor-blocks. Added BLE Advertisement Manufacturer Data as filter for scanning, for https://github.com/LLK/scratch-link/issues/112
2019-02-11 10:57:57 -05:00
chrisgarrity
a4b0550013
handle sb2 files zipped in a folder
...
If the asset can’t be found by name, look for the same asset in a folder within the zipfile.
2019-02-08 15:03:27 +01:00
Chris Willis-Ford
51252531af
Update src/extensions/scratch3_pen/index.js
...
Co-Authored-By: apple502j <33279053+apple502j@users.noreply.github.com>
2019-02-08 20:03:54 +09:00
Chris Willis-Ford
2d575a9208
Update src/extensions/scratch3_pen/index.js
...
Co-Authored-By: apple502j <33279053+apple502j@users.noreply.github.com>
2019-02-08 20:03:48 +09:00
Christopher Willis-Ford
46a1ae83a0
Use MockTimer for TaskQueue tests
2019-02-07 16:35:33 -08:00
Christopher Willis-Ford
7f80fe17b3
Build a mock Timer class and add tests for it
2019-02-07 16:35:32 -08:00
Evelyn Eastmond
b5eb54fc44
Resolves 1975: Vernier gdxfor extension should disconnect on sensor timeout.
2019-02-07 16:18:56 -05:00
Evelyn Eastmond
16ebcb82b2
Merge pull request #1986 from evhan55/bug/gdxfor-falling
...
Vernier gdxfor "falling?" report false when not connected
2019-02-07 15:54:46 -05:00
Evelyn Eastmond
7e7326f474
Merge pull request #1984 from evhan55/extensions/gdxfor-update-rate
...
Vernier gdxfor input rate change
2019-02-07 15:24:11 -05:00
Evelyn Eastmond
a68886cee9
Resolves #1977 : Vernier gdxfor extension falling? reports true while hardware disconnected.
2019-02-07 14:51:59 -05:00
picklesrus
b03d6ee7a5
Merge pull request #1985 from kchadha/fix-type-handling-xml-escape
...
Fix issue where non-strings were getting passed in to escape functions
2019-02-07 13:35:50 -05:00
Eric Rosenbaum
9dd8e9398a
Merge pull request #1982 from VernierST/extensions/gdx-for-freefall-and-tilt
...
GDX-FOR better freefall algorithm and different tilt options
2019-02-07 11:59:50 -05:00
Karishma Chadha
c761a9c82e
Fix issue where non-strings were getting passed in to escape functions for handling special characters that can appear in xml. Add tests.
2019-02-07 11:58:10 -05:00
Evelyn Eastmond
104e997b59
Changing the input rate, resolves 1976.
2019-02-07 10:48:48 -05:00
Paul Kaplan
765f2b2549
Merge pull request #1983 from picklesrus/broadcast-msg-chars
...
Broadcast msg chars
2019-02-07 08:32:55 -05:00
Paul Kaplan
6deab79903
Merge pull request #1979 from paulkaplan/share-blocks-new-ids
...
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-07 08:31:25 -05:00
picklesrus
b904f19c1d
Fix loading broadcast messages with special characters for projects that were converted from 2.0.
2019-02-06 16:58:46 -05:00
picklesrus
ecbfcd78bd
Fix sb2 loading of broadcast messages with special characters.
2019-02-06 16:48:39 -05:00
Ian Honohan
7b3996a173
Add localization to the front/back/left/right menu items
2019-02-06 12:51:32 -08:00
Ian Honohan
7cbf4e2a60
Changes the tilt options from x/y to front/back and left/right. Also limits the tilt range to +/-90, just like micro::bit
2019-02-06 10:52:18 -08:00
Eric Rosenbaum
7f6fa5f272
Merge pull request #1978 from ericrosenbaum/feature/vernier-spacers-and-rename
...
Vernier gdxfor extension: add spacers and rename "spin"
2019-02-06 11:55:10 -05:00
Eric Rosenbaum
3ae6c93394
Change l10n id so translations will update
2019-02-06 10:40:06 -05:00
Paul Kaplan
31fbcfa4d7
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-06 10:16:22 -05:00
Eric Rosenbaum
48e01fe1a3
Rename “spin speed” to “spin”
2019-02-05 17:22:17 -05:00
Eric Rosenbaum
78c72f4185
Add spacers
2019-02-05 17:22:06 -05:00
Karishma Chadha
4e924bf4b5
Merge pull request #1973 from kchadha/fix-variable-characters
...
Fix variable characters
2019-02-05 17:01:43 -05:00
Karishma Chadha
c796a8b1cc
Merge pull request #1962 from LLK/project-dirty-state-fixes
...
Project dirty state fixes
2019-02-05 16:38:30 -05:00
Ian Honohan
5a2eb3b296
Accounts for any rotation in the GDX-FOR while trying to detect freefall
2019-02-05 12:12:17 -08:00
Karishma Chadha
af0bebb773
Fix typo in comment
2019-02-04 23:33:18 -05:00
Evelyn Eastmond
39f69bd8c1
Separate out _spinSpeedFromGyro function.
2019-02-04 21:56:20 -05:00
Evelyn Eastmond
8da82cfe01
Adding JSDoc and removing extension manager gdx uncommenting.
2019-02-04 21:45:23 -05:00
Evelyn Eastmond
da3fc930b1
Factoring out a _onSensorValueChanged function.
2019-02-04 21:41:57 -05:00
Evelyn Eastmond
e87dd01629
Add clearing of values on disconnect.
2019-02-04 19:43:50 -05:00
Evelyn Eastmond
93aecc88be
Filling in some comments.
2019-02-04 19:41:07 -05:00