Commit graph

2690 commits

Author SHA1 Message Date
Evelyn Eastmond
fe43ecfa73 Renaming byte allocation enum values. 2019-06-23 21:23:28 -04:00
Evelyn Eastmond
1e124657e5 Fix comments and formatting. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
ca28b4ff1b Fix device type return parsing to be clearer when it tries to avoid null values and convert them to 'none'. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
20b0d4da78 Remove some stale comments and add reminder to rename some byte value enums. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
f3d50dbe5a Add global var index 0 value to enum. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
63d9b0249a Removed a TODO and clarified with a better comment. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
5314be8310 More byte value updates, and change global index comments. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
50c80a8abc Adding comment to explain byte value enum values. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
14e8a93ac6 Add global var 1-byte-to-follow to enum. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
f8d9f687ec Move Ev3 byte values into their own enum, separate from parameter values. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
c237f1326d Clean up some null checks. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
6b9c3d12ef Shorten a comment. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
b476169f84 Change variable name to be shorter / more legible. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
6284cbdd85 Removing todo, decided not to rename. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
6c706b410f Removing label. 2019-06-23 21:23:27 -04:00
Evelyn Eastmond
3712b6fe72 Fixing GDX_FOR disconnect to new ble variable, fixing an error from a recent merge. 2019-06-23 18:42:32 -04:00
Eric Rosenbaum
a115f6dde5
Merge branch 'develop' into enhancement/1929 2019-06-19 11:09:14 -04:00
Karishma Chadha
aae7607e10 fix extension dropdown menu item conversion 2019-06-18 21:03:17 -07:00
Chris Willis-Ford
eba89d57d8 Merge branch 'develop' into non-droppable-extension-menus 2019-06-18 16:52:47 -07:00
Karishma Chadha
9af2e4c086
Merge pull request #2161 from LLK/e16n
Supporting VM changes for extensionification
2019-06-18 18:53:20 -04:00
Christopher Willis-Ford
fd776025e5 refactor _refreshExtensionPrimitives for clarity
The previous form made it harder to see that at most one extension
category is handled per call.
2019-06-18 15:08:03 -07:00
Chris Willis-Ford
edd6aafed0 call out capitalization change since it's important but easy to miss
Co-Authored-By: Karishma Chadha <kchadha@media.mit.edu>
2019-06-18 15:07:58 -07:00
Christopher Willis-Ford
3c28f714bb respond to code review 2019-06-17 21:14:21 -07:00
Chris Willis-Ford
18b1551cdb
remove redundant check
Co-Authored-By: Karishma Chadha <kchadha@media.mit.edu>
2019-06-17 13:22:52 -07:00
Evelyn Eastmond
f3f307b59c
Merge pull request #2207 from evhan55/ergonomics/2017
Removing comment in WeDo2 extension
2019-06-17 12:19:42 -04:00
Christopher Willis-Ford
33a6071466 for compatibility, make all existing extension menus accept reporters 2019-06-14 12:29:32 -07:00
Christopher Willis-Ford
cfee656306 fix tests: empty menus shouldn't be an array 2019-06-14 12:29:32 -07:00
Christopher Willis-Ford
3fbed88a95 switch from rejectReporters flag to acceptReporters
Also add more extensive documentation around extension menu definitions,
including some considerations to think about before making a menu accept
reporters.
2019-06-14 12:29:32 -07:00
Christopher Willis-Ford
e7bf49c8df support non-droppable menus in extensions 2019-06-14 12:29:32 -07:00
Evelyn Eastmond
418cd0a0f4 Removing comment after decision that this function name is accurate and distinct from coastAfter. 2019-06-12 10:20:21 -04:00
Evelyn Eastmond
704774d6d1 Fixing debug statements and also adding a safety check for timeoutIDs. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
0e250aef37 Fixing a comment. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
37fe83c057 Adding disconnect/state resetting behavior to rest of hardware extensions. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
f8a0ea281f Adding/fixing debug statements throughout. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
a1243fd897 Change cleanup/disconnect behavior for BT and EV3. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
6a032087ce Fixing up BOOST reset and disconnect behavior splitting. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
56fdd45242 Adding reset and resetCallback to BLE and Boost extension only for now. 2019-06-12 09:02:12 -04:00
Evelyn Eastmond
f192c181bd Rename scratchLinkSocket variables to 'socket' and 'ble' to avoid confusion with upcoming ScratchLinkWebSocket class. 2019-06-12 09:01:49 -04:00
picklesrus
b88d5d05b0
Merge pull request #2084 from picklesrus/update-languages-in-translate-list
Fixing some translate language menu bugs.
2019-06-10 11:13:52 -04:00
Eric Rosenbaum
8243d0f53a Update sound sampleCount and rate 2019-06-05 17:06:27 -04:00
Eric Rosenbaum
b6a33cc3ed
Merge branch 'develop' into extensions/ev3-rate-limiting 2019-06-04 11:37:43 -04:00
Evelyn Eastmond
6e80c92703
Merge pull request #2191 from evhan55/bt-pairing-changes
Add optional 'pin' parameter to BT connections
2019-06-04 11:26:47 -04:00
Michael "Z" Goddard
e1254bd8c7
elevate stack block id and frame info into thread
- Add pointer member to thread. This is the current executing block.
- Add stackFrame member to thread. This is the current frame
  information like procedure parameters.

This is a step potentially towards stack-less threads. With further
modifications we could have stack and stackFrames be null if a script
does not call a procedure.
2019-06-03 18:13:01 -04:00
Michael "Z" Goddard
ffcd0e6518
remove empty procedure_definetion block
The engine supports blocks that do not have defined functions.
2019-06-03 15:49:11 -04:00
apple502j
558f43a3d6 Fix Cast.LIST_ALL casting case 2019-06-01 14:43:53 +09:00
Evelyn Eastmond
ae791b3f26 Don't send null pin. 2019-05-31 11:27:20 -04:00
Evelyn Eastmond
b6913b7828 Move EV3 pin to a static var. 2019-05-31 11:14:32 -04:00
Evelyn Eastmond
8e302ac90c Add optional pin parameter to peripheral connection. 2019-05-31 11:10:13 -04:00
Paul Kaplan
615f60252d Set connected to false before closing to prevent infinite loop
There is an implicit assumption that socket.close is async, but if it is sync, it may go into an infinite loop of close callbacks if the connected flag is not set to false before trying to close

Co-Authored-By: chrisgarrity <chrisg@media.mit.edu>
2019-05-31 09:42:00 -04:00
Paul Kaplan
706354d2f0 Update documentation about required methods on ScratchLinkSocket
Co-Authored-By: chrisgarrity <chrisg@media.mit.edu>
2019-05-31 08:55:20 -04:00
Paul Kaplan
64cff3d161 Fix documentation on what methods to implement for ScratchLinkSocket
Co-Authored-By: chrisgarrity <chrisg@media.mit.edu>
2019-05-31 08:41:20 -04:00
Paul Kaplan
94afd58b2f Require handleMessage to be set before opening scratch-link-socket 2019-05-31 08:35:27 -04:00
Paul Kaplan
5e626eb7e9 Initial prototype of configurable scratch link socket 2019-05-24 12:51:58 -04:00
Karishma Chadha
dbcbe8b94f Revert "synth extension"
This reverts commit dbd513d85b.
2019-05-24 11:27:20 -04:00
Karishma Chadha
d1b261d56e Revert "lightplay extension stub"
This reverts commit 36de7517bd.
2019-05-24 11:27:08 -04:00
Karishma Chadha
7501af4c6b Revert "lightplay extension stub"
This reverts commit 1ee3cea144.
2019-05-24 11:26:54 -04:00
Carmelo Presicce
1ee3cea144 lightplay extension stub 2019-05-23 21:27:10 -04:00
Carmelo Presicce
36de7517bd lightplay extension stub 2019-05-23 21:26:57 -04:00
Carmelo Presicce
dbd513d85b synth extension 2019-05-23 20:22:03 -04:00
Evelyn Eastmond
565f11d4fc
Merge pull request #2168 from evhan55/ergonomics/2153
Change BOOST variable names regarding duration and rotation blocks
2019-05-22 16:23:35 -04:00
Eric Rosenbaum
79c8a815a3 Do not load speech2text extension 2019-05-20 12:53:16 -04:00
Evelyn Eastmond
58908bb1a4 Changing BTSendRateMax to help with key-down scenarios. 2019-05-17 11:43:06 -04:00
Evelyn Eastmond
d76756f5f6 Removing BTSendInterval, not needed. 2019-05-17 11:28:51 -04:00
Evelyn Eastmond
62a8f2d0f2 Fix typo. 2019-05-17 11:28:51 -04:00
Evelyn Eastmond
52519ae1e0 Add comment. 2019-05-17 11:28:51 -04:00
Evelyn Eastmond
9d231b7887 Adding RateLimiter and useLimiter rate limiting approach to EV3. 2019-05-17 11:28:51 -04:00
Karishma Chadha
14d2820460
Merge pull request #1648 from mzgoddard/stop-all-next-tick
Stop all next tick
2019-05-15 11:25:15 -04:00
Evelyn Eastmond
6e6d6140cc Rename duration timeout setter/getter. 2019-05-11 11:21:07 -04:00
Evelyn Eastmond
b7e0edcabc Fixing linting. 2019-05-11 11:08:00 -04:00
Evelyn Eastmond
6e0b4351d8 Clarify comment. 2019-05-11 10:55:51 -04:00
Evelyn Eastmond
693038972e Clarify comment. 2019-05-11 10:54:45 -04:00
Evelyn Eastmond
bdda6f7fc6 Fix inaccurate comment. 2019-05-11 10:52:00 -04:00
Evelyn Eastmond
048598aef8 Fix inaccurate comment. 2019-05-11 10:50:25 -04:00
Evelyn Eastmond
14ffae04f8 Fix inaccurate comment. 2019-05-11 10:48:35 -04:00
Evelyn Eastmond
0256fff8ce Update public getters to new variable names. 2019-05-11 10:46:45 -04:00
Evelyn Eastmond
9ae2c4b1f1 Adding a comment. 2019-05-11 10:40:27 -04:00
Evelyn Eastmond
eabff71461 Changing some variable names regarding duration and rotation blocks for clarity. 2019-05-11 10:37:42 -04:00
Karishma Chadha
f2301e0e4d
Merge pull request #2126 from mzgoddard/runtime-script-cache-fix
Runtime script cache fix
2019-05-08 16:00:28 -04:00
Eric Rosenbaum
86f4ca5806 Do not localize motor IDs 2019-05-02 16:21:08 -04:00
Eric Rosenbaum
b75b8027a1 Always clear motor promises when setting state 2019-04-30 11:37:10 -04:00
Eric Rosenbaum
8245b46d56 Change extension name to all-caps BOOST 2019-04-29 15:43:38 -04:00
Eric Rosenbaum
85f3a3c3c5
Merge branch 'develop' into bugfix/2125 2019-04-29 14:06:13 -04:00
Evelyn Eastmond
2a04e9c7f2 Don't set motor power or direction if in rotation state. 2019-04-29 11:58:34 -04:00
Evelyn Eastmond
8745c9b3ac Move false flag left because it will get fixed by PR 2140 instead. 2019-04-29 11:54:12 -04:00
Evelyn Eastmond
c1292f6a59 Don't set motor power if it's already equal to the input power. 2019-04-29 11:53:40 -04:00
Evelyn Eastmond
71c3b72892 Moving false flag from Math.abs to turnOnForDegrees, fixing typo. 2019-04-29 11:53:40 -04:00
Evelyn Eastmond
7e01326d71 Fixing linting. 2019-04-29 11:45:15 -04:00
Evelyn Eastmond
a67b303294 Remove console logs and change a comment. 2019-04-29 11:42:09 -04:00
Evelyn Eastmond
c37a41c352 Only clear pending duration timeout if not in _ON_FOR_TIME state. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
75eae9a58a Fixing motor status setter to not clear rotation if already in rotation state. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
5109cd474c Remove more power===0 checks. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
410e13b4e3 Remove resetState and all power===0 checks. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
d0ed16d47c Fixing Math.abs false arg? and moving it to turnOnForDegrees call. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
dd82079bad Fixing a comment style. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
bb6514f1d6 Removing some tabs. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
14162b9920 Adding an empty line back in. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
7ed8d376c5 Putting in a comment. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
99c7528a1e Removing some empty changed lines. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
12233b73dd Fixing comments to reflect original code. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
73fc5b8723 Fixing lint. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
83bf1be066 Comment out all the power = 0 checks that came over from WeDo. 2019-04-29 09:22:36 -04:00
Evelyn Eastmond
270a445703 Playing with power states while we figure out the design. 2019-04-29 09:22:36 -04:00
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