Compare commits

..

1341 Commits

Author SHA1 Message Date
01d08c6d4f 1.4.11 2019-11-02 07:35:43 -07:00
426ad005d5 bump pxt 5.28.11 2019-11-02 07:35:25 -07:00
853625107c 1.4.10 2019-11-01 12:33:48 -07:00
9c1b29cc80 bump pxt5.28.9 (#956) 2019-11-01 12:33:26 -07:00
9badaffee9 1.4.9 2019-10-31 11:44:54 -07:00
c3f539f396 Bump pxt 5.28.7 (#954)
* bump

* bump pxt
2019-10-31 10:22:37 -07:00
991813fff7 update elecron version to 1.2.26 (#953) 2019-10-23 11:22:30 -07:00
85a8f1c2c5 bump to v1.2.26 2019-10-20 16:37:57 -07:00
ea33b81b2a is color detectedd 2019-10-20 09:31:09 -07:00
c8381d7626 1.2.26 2019-10-20 09:02:44 -07:00
62b5941143 is color detected (#952)
* added query function

* reshuffle
2019-10-20 09:02:17 -07:00
1d5d18dc88 1.2.25 2019-10-18 22:53:46 -07:00
bc4b71e0d6 Pulling updates from master (#951)
* show ports on start

* don't run show ports automatically

* polarity in synched motor (#945)

* account for polarity

* more comments

* handle dual motor in runtime

* invert steer

* don't use firmware polarity

* add block to stop program (#943)

* add block to stop program

* renaming

* fix translation
2019-10-18 22:53:30 -07:00
5c47ce2f91 add stable path 2019-10-18 22:53:17 -07:00
6a577287c1 1.4.8 2019-10-16 21:24:06 -07:00
8bd884e155 bump blockly 2019-10-16 21:23:14 -07:00
20be398c2c refactor constants 2019-10-13 09:32:43 -07:00
ccf6164d87 logging 2019-10-13 09:22:07 -07:00
58294883d7 blink fix (#949) 2019-10-13 00:36:44 -07:00
00194d4aa6 1.2.24 2019-10-13 00:36:00 -07:00
ec900f805e 1.2.23 2019-10-13 00:35:47 -07:00
5f5bdd7294 blink fix (#949) 2019-10-13 00:35:20 -07:00
38b2fc7b95 Add run it again to try tutorial to show where to find programs on brick (#947) 2019-10-12 15:36:13 -07:00
8cc2f1219f 1.4.7 2019-10-11 21:56:27 -07:00
39a629cc58 bump pxt 5.25.13 2019-10-11 21:50:00 -07:00
df65c34f15 1.4.6 2019-10-10 09:16:19 -07:00
00fefe10d6 Boot sequence (#946)
* refactor bootsequence

* inf can be null

* align elements
2019-10-10 09:15:57 -07:00
d442f5aa41 don't ban image 2019-10-10 08:00:21 -07:00
3311865817 1.4.5 2019-10-10 07:45:53 -07:00
2cd2950496 polarity in synched motor (#945)
* account for polarity

* more comments

* handle dual motor in runtime

* invert steer

* don't use firmware polarity
2019-10-10 07:44:53 -07:00
b0de3d8c1b 1.4.4 2019-10-09 15:40:54 -07:00
acefe3ae11 bump pxt 2019-10-09 15:40:45 -07:00
cb6c83eec7 Add sources for the file manager program (#944) 2019-10-09 13:57:06 -07:00
e0c8f65a65 1.4.3 2019-10-09 09:57:53 -07:00
a4e02dcd03 add block to stop program (#943)
* add block to stop program

* renaming
2019-10-09 09:30:42 -07:00
fb5776ec41 1.4.2 2019-10-08 22:19:50 -07:00
d852fd961b fix python build 2019-10-08 22:19:34 -07:00
1ed8122804 1.4.1 2019-10-08 21:58:33 -07:00
c5cec3a6ba update to pxt 5 and pxt-common-packages 6 (#934)
* bump pxt

* fix build issues

* Auto-gen of projects/summary

* removing feild editors moved to pxt

* various typing fixes

* more typing fixes

* fixing various typing issues

* Start on integration of new pxt

* serial number fixes

* gc-ify MMap object

* Re-build generated files

* fix console listeners

* clear lf() warnings

* More generated files

* also auto-generated

* Compilation fixes

* fix merge

* mostly fixing blocks

* fix sim

* fix field motors

* enable a few features

* moving to tsx

* try to fix edtiro compilation

* more defs

* removing commands

* removing extra $

* fix blockly warning

* hiding images

* enabling more pxt features

* hide images

* setup autorun

* add lock on target_reset

* update deps

* return trylock result

* updated pxt

* rename video section

* add alpha channel

* upgraded pxt

* bump pxt/version

* removed alpha ref

* var ceanup

* don't do major bump
2019-10-08 21:57:55 -07:00
ba94322d4c 1.2.23 2019-10-08 21:26:38 -07:00
225f1da6d5 fix translation 2019-10-08 21:26:17 -07:00
a06331eef1 added channel 2019-10-08 14:23:57 -07:00
aa741ce8de rename again 2019-10-08 14:21:55 -07:00
61fe5091fe rename 2019-10-08 14:21:45 -07:00
3d90e13797 shrinkg image 2019-10-08 14:21:12 -07:00
469767a40a Add information to Try example to show where to find downloaded programs on the control brick. (#936) 2019-10-08 14:12:43 -07:00
604fa764e6 Create calibreapp-image-actions.yml 2019-10-08 14:03:58 -07:00
25cf2a9cdb move electron to 1.2.22 (#937) 2019-10-07 14:43:34 -07:00
7549f865d6 move master to 1.2.22 2019-10-02 13:59:58 -07:00
a5de9d88bb adding latest video 2019-10-02 13:53:22 -07:00
0437df10de 1.2.22 2019-10-02 13:27:53 -07:00
2079173dfa lock execution thread before exiting (#935) 2019-10-02 12:40:45 -07:00
018a1e7528 added proportional line follower 2019-10-02 12:26:51 -07:00
757f95d984 move master to v1.2.21 2019-10-02 10:59:50 -07:00
8bc3fdc8ba 1.2.21 2019-10-01 15:56:22 -07:00
e8a1e73cf5 1.2.20 2019-10-01 14:54:42 -07:00
e9b2b239ad More gyro lessons (#933)
* updated pauseuntil

* updated youtube link

* updated docs
2019-10-01 14:54:17 -07:00
5ad2288a9f updated docs 2019-10-01 13:38:33 -07:00
92d13ef343 updated bluetooth info 2019-10-01 13:36:53 -07:00
471ca5d915 1.2.19 2019-10-01 13:28:01 -07:00
f745079728 Don't reset threashold when resetting color mode (#932)
* don't reset threshold when changing modes

* updated docs
2019-10-01 13:27:37 -07:00
d179f18ef3 added gyro movies 2019-10-01 11:05:44 -07:00
805fc6c787 1.2.18 2019-10-01 10:12:21 -07:00
374bbb8304 Drift-compensated angle in gyro (#931)
* compute angle based on undrifted rate

* add is calibrating function

* fix integrator

* added example

* docs

* poll faster
2019-10-01 10:11:58 -07:00
25452efc92 1.2.17 2019-09-30 22:44:09 -07:00
80b9c715b2 Gyro tutorials (#930)
* gyro tutorials

* tutorials

* fix gyro simulator

* images

* updated image

* fix svg errors
2019-09-30 22:43:50 -07:00
cb816c91ad updated drift 2019-09-30 14:33:57 -07:00
3012068986 1.2.16 2019-09-30 13:44:27 -07:00
4c9c7d6a69 add delay to fix mac deployment (#929) 2019-09-30 13:43:12 -07:00
ad3652c290 bump master to 1.2.15 2019-09-30 13:03:48 -07:00
d8971829e3 1.2.15 2019-09-30 11:13:45 -07:00
8ca4558fc2 web serial cleanup (#928)
* updated ticks

* fix enable and compile

* add debug mode

* don't try to change UI while downloading

* cleanup

* don't double open

* use cu

* add delay before reconnecting

* support for 200 ragne in field turn ratio

* updated docs

* fix docs
2019-09-30 11:13:28 -07:00
d85b5c5129 updated info for macs (#925) 2019-09-30 10:30:21 -07:00
95b1c6a50f 1.2.14 2019-09-29 23:09:07 -07:00
4dc2872286 Better bt download flow (#927)
* round the drif

* restart compile automatically

* add settle
2019-09-29 23:08:46 -07:00
6c9ff804c8 1.2.13 2019-09-29 09:49:35 -07:00
7581b5af9e Drift support (#926)
* upgrading drift support

* updated showports

* typos
2019-09-29 09:49:13 -07:00
07504027f9 1.2.12 2019-09-27 16:46:20 -07:00
a0e133864a background show ports (#924)
* background show ports

* render once at least

* better rendering

* bumped up scale
2019-09-27 16:45:57 -07:00
0285711954 added automation package 2019-09-27 16:08:54 -07:00
91be998d7e 1.2.11 2019-09-27 15:49:43 -07:00
e862869327 Snap backwards (#923)
* snap to multiple of 5

* normalize negative values
2019-09-27 15:49:21 -07:00
8047cb2612 beta notation 2019-09-27 11:45:25 -07:00
8e2ffefd2c adding walkthrough video 2019-09-27 11:43:04 -07:00
092e7b0522 1.2.10 2019-09-27 11:15:29 -07:00
42454ecd57 graceful handling of bluetooth connectivity issues (#922)
* more cleanup

* cleanup life cycle

* more error checking
2019-09-27 11:15:10 -07:00
2563fd6031 move image 2019-09-27 09:36:25 -07:00
e0c1f2dca0 added other issue 2019-09-27 09:25:46 -07:00
c80574ed3f 1.2.9 2019-09-27 09:16:45 -07:00
b28b5cb6b7 better flow + handle unclosed connection (#921)
* better flow + handle unclosed connection

* more checks
2019-09-27 09:16:27 -07:00
d1f11059db updated text 2019-09-27 08:46:50 -07:00
6de5c6afdf added beta note 2019-09-27 06:56:03 -07:00
b72c7c0c4f 1.2.8 2019-09-27 06:54:03 -07:00
352c1ca5ec Experiment BT support using Chrome web serial (#920)
* plumbing

* plumbing

* logging

* more notes

* fixing typing

* more plumbing

* more plumbing

* different baud rate

* talking to the brick

* first over the air drop

* fix buffer

* tweak paraetmers

* formatting fixing double upload

* reduce console.log

* cleanup

* add BLE button to download dialog

* changed label

* recover from broken COM port

* fix function call

* reduce log level

* adding ticks

* some help

* updated support matrix

* more docs

* updated browser help

* more docs

* add link

* add device

* added image
2019-09-27 06:53:26 -07:00
6d940a9ec7 other color snesor tutorial (#919) 2019-09-25 22:35:10 -07:00
c070173346 adding moods 2019-09-25 21:12:45 -07:00
6fcf68f174 fix tutorial 2019-09-25 21:08:44 -07:00
02f2a85d28 added images 2019-09-25 15:16:36 -07:00
f63196908e updated robot 1 2019-09-25 13:20:20 -07:00
ad48ee12ca 1.2.7 2019-09-24 21:45:20 -07:00
83aeb24a98 broadcast project (#918)
* broadcast project

* revert chaanges
2019-09-24 21:44:59 -07:00
fc5ecd9f10 added pause-on-start uttorial 2019-09-24 20:47:29 -07:00
0b3b840ac1 1.2.6 2019-09-17 15:14:32 -07:00
60c09809e7 Stall (#897)
* stall detection

* arrange blocks

* updated blocks

* tested on hw
2019-09-17 15:14:14 -07:00
148067a143 1.2.5 2019-09-17 14:30:20 -07:00
6f34887c94 Safepolling (#915)
* headstart on safe polling

* poke in sensors

* more poking

* typo
2019-09-17 14:30:02 -07:00
64a9930c2e 1.2.4 2019-09-17 12:36:35 -07:00
5815e16647 update pxt reference (#914) 2019-09-17 12:36:11 -07:00
c4f5e425c2 1.2.3 2019-09-17 11:26:52 -07:00
361ae7a2d2 adding a few pause to allow motors to settle 2019-09-17 11:23:40 -07:00
3769402ade 1.2.2 2019-09-17 10:52:14 -07:00
5c3c83eb52 add a run to avoid tight loop hogging (#913) 2019-09-17 10:52:00 -07:00
0f07a89981 updated docs on offline-app 2019-09-11 19:37:26 -07:00
11d887a213 Releaseing offline app version 1.1.20 (#912) 2019-09-11 18:24:47 -07:00
8150b2dbb0 fix turtle link 2019-09-11 13:23:09 -07:00
89f41f23da 1.2.1 2019-09-10 07:13:42 -07:00
6b78e08053 Edits for 'citys shaper' robot tutorials (#911) 2019-09-09 16:59:12 -07:00
186c86d2b1 rev minor version 2019-09-09 09:09:27 -07:00
181c71d2dd 1.1.22 2019-09-09 09:08:50 -07:00
be05da3232 enabled green screen 2019-09-09 09:08:38 -07:00
5958157a76 1.1.21 2019-09-09 09:04:28 -07:00
f72b825377 reenable permanent storage (#909) 2019-09-09 09:04:12 -07:00
d76af5e5af moving turtle 2019-09-08 21:36:04 -07:00
23f48db20b added turtle program 2019-09-08 21:29:27 -07:00
2975bf2b55 Console to dmesg (#910)
* always pip console.log to dmesg

* trim new line

* restore storage

* restore new line

* remove unused variable
2019-09-07 18:22:39 -07:00
5314515619 Crane mission (#907)
* dummy page

* robot 1 lesson

* added lesson 2

* added mission 2

* added link
2019-09-06 16:10:33 -07:00
75b2db9f67 releasing to 1.1.20 (#908) 2019-09-06 14:24:19 -07:00
cf2e39f1b2 renamed tutorial 2019-09-06 08:47:56 -07:00
6d15d69aa1 updated fll page 2019-09-06 08:33:25 -07:00
72a0940235 1.1.20 2019-09-06 06:22:43 -07:00
b08dd8a7d2 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2019-09-06 06:22:36 -07:00
def648a98b Block updates follow blog post (#905)
* fix battery block comment

* update run phase blocks

* some more docs
2019-09-06 06:22:12 -07:00
32a92789b3 fix battery block comment 2019-09-06 05:23:48 -07:00
9956bb06fb adding wall follower 2019-09-04 21:42:08 -07:00
83b9aecd7a 1.1.19 2019-09-04 14:52:02 -07:00
17ab24eaa9 Ramp (#904)
* updated ramp block

* updated example
2019-09-04 14:51:45 -07:00
9c5d5f9a86 updated block 2019-09-04 13:50:13 -07:00
43a13e0877 added example 2019-09-04 13:42:29 -07:00
fe0915484d 1.1.18 2019-09-04 12:57:17 -07:00
87a65aa38f battery properties (#903)
* Battery params

* move category

* cleanup

* use property

* fix level

* fix battery computation

* fix level comp

* docs
2019-09-04 12:56:45 -07:00
1317da8904 Remove old instructions 2019-09-03 17:34:34 -07:00
62b2881e2a Embed file deleter in PDF file so we can serve it 2019-09-03 16:29:31 -07:00
bf482a2ac9 Do ZIP not UF2 for file manager 2019-09-03 16:11:02 -07:00
243600ad8f Adding file manager program 2019-09-03 16:08:56 -07:00
349caa4aed 1.1.17 2019-09-02 20:58:29 -07:00
56bbcde299 Support for smooth acceleration/deceleration in run (#900)
* removed logging

* removing more logging

* always use step for single/multiple motors

* refactored schedule

* account for accel ramp up and down

* added default acc/decel

* rounding speed/angle

* remove hack

* use acceleration time in run too

* handle missing case

* adding notes on motors

* adding sample

* fixed ramp simulation

* clear defaults

* some docs, more later

* adding basic examples

* remove debug msg

* clean json

* added move schedule

* docs

* basic docs
2019-09-02 20:57:23 -07:00
7e9cc791ec Some edits for the new sensor/motor examples (#901)
* Some edits for the new sensor/motor examples

* article typo

* dark and bright

* fix block styling

* I like 'on'

* more block styling
2019-09-02 04:20:42 -07:00
d5194b8d28 More samples (#896)
* coast or brake

* fix title

* added lesson
2019-08-31 06:05:36 -07:00
12b1eb349b 1.1.16 2019-08-30 16:53:03 -07:00
68dc195ea4 motor tutorials (#895)
* updated pivots

* redirect support to forum

* adding top level FLL link

* updated wording
2019-08-30 16:52:37 -07:00
0251b914f2 color sensor examples (#894)
* tank zigzag

* reflected light measure

* adding links

* added reflected light calibration

* updated summary
2019-08-30 15:03:09 -07:00
1fc818767c added vscode workspace 2019-08-30 13:57:27 -07:00
9aeaec477f updated FLL page 2019-08-30 12:03:43 -07:00
7fc796d2cb 1.1.15 2019-08-30 11:55:49 -07:00
cb1cd2a4b4 Tutorial category breakout (#437)
* Tutorial category breakout

* Put galleries in config

* restore default tutorial

* updated links

* update tutorials pages

* add infrared
2019-08-30 11:54:30 -07:00
39bd7aa0eb 1.1.14 2019-08-30 10:59:15 -07:00
140ba64462 Gyrofix (#893)
* disable drift correction by default

* disable drift correction

* better calibration sequence

* add comments

* updated comment about beta
2019-08-30 10:58:49 -07:00
42fe96aa5a fix link 2019-08-30 09:40:41 -07:00
1a5b42026d adding redirects for missing links 2019-08-30 09:39:28 -07:00
9fe649aa3c fixed extensions.md 2019-08-30 05:48:41 -07:00
a97dfb17b2 1.1.13 2019-08-30 05:41:11 -07:00
277c9903bb Tank fixes (#892)
* fixing turnration computation

* updated tank computation

* fix rendering glitch

* restore tank computation

* rounding errors
2019-08-30 05:40:51 -07:00
0de8a84de2 1.1.12 2019-08-29 13:11:34 -07:00
a302bbfc2b Single tank (#891)
* add note about dual blocks

* fix simulator to match hardware

* updated wording
2019-08-29 13:11:01 -07:00
bcb682b602 1.1.11 2019-08-28 23:00:03 -07:00
e4a7531541 add rgbraw (#890) 2019-08-28 22:59:41 -07:00
348964c888 1.1.10 2019-08-28 22:43:42 -07:00
8b3461bebd Add exitThread() polling the exit button (#888)
* Add exitThread() polling the exit button

* Add missing includes

* Remove redundant code
2019-08-28 22:43:21 -07:00
e511630c2e Update README.md 2019-08-28 16:27:03 -07:00
db156d5df0 Update README.md 2019-08-28 16:24:55 -07:00
93c6975400 1.1.9 2019-08-28 16:21:41 -07:00
abc93dd7da Multi sensor fix (#887)
* more logging

* set uart mode all at once

* updated logging

* pr feedback
2019-08-28 16:21:06 -07:00
85cfc86bf8 1.1.8 2019-08-28 13:36:50 -07:00
b66d4f2d64 enable storage extension (#886)
* enable storage extension

* fix -beta
2019-08-28 13:36:23 -07:00
5843deab11 1.1.7 2019-08-28 11:39:18 -07:00
8d5edc38bb bump common version (#885) 2019-08-28 11:30:59 -07:00
0309e50058 1.1.6 2019-08-28 08:52:24 -07:00
aa40e7b169 Endprogram (#884)
* moving end program logic to c++

* typo

* always stop on reset
2019-08-28 08:52:01 -07:00
75cf8da396 1.1.5 2019-08-27 17:57:44 -07:00
Max
db9b6a995b IIC added (#870)
* IIC added

* Fixed bug with not detecting device
2019-08-27 17:57:21 -07:00
fb255edafe 1.1.4 2019-08-27 17:28:57 -07:00
f4c39f74e8 1.1.3 2019-08-27 17:05:49 -07:00
3e56e2c3e2 Rgb raw tuning of blocs (#883)
* refactor blocks

* make non-private
2019-08-27 17:05:16 -07:00
79b5f8cc88 Add rgb and reflection raw mods for color sensor (#876)
* Add reflection raw value

Add reflection raw value for color sensor

* update

* Combined rgbraw and refraw
2019-08-27 16:45:12 -07:00
312729142f 1.1.2 2019-08-27 16:42:36 -07:00
Max
5bd4aed0e1 Multiple sensors 2 (#877)
* Fixed -1 mode in libs

* Deleted todo
2019-08-27 16:34:55 -07:00
cfaa4ae3ef migrate build to travis 2019-08-27 16:29:18 -07:00
faa839d59f 1.1.1 2019-08-27 16:26:37 -07:00
630687bfce bump to 1.1 2019-08-27 16:26:19 -07:00
2b300a4094 Maximmasterr set settle (#882)
* Added set settle time

* updated blocks
2019-08-27 14:57:28 -07:00
5fb8c0de6e delete package-lock.json 2019-08-27 14:45:25 -07:00
1f65cd59a8 Fixes to "Line Following in Loop" Sample Solutions (#871)
Sample Solutions were wrong for both Methods of Line Following in a Loop
2019-08-27 14:27:20 -07:00
fd75bb61d6 Fix typos in sample programme description (#872)
1500 milliseconds is not one quarter of a second - fixed the text to reflect.
2019-08-06 14:50:19 -07:00
Max
4d2f72575b Fixed multiple sensor bug (#868) 2019-07-15 15:26:25 -07:00
1fe3d3e01a plug in offline page (#836) 2019-03-07 19:40:21 -08:00
0c6e65d828 Updateing Trademark in readme (#834)
* Updateing Trademark in readme

* Removed chat reference
2019-03-04 16:39:23 -08:00
ae9c0603f2 Releasing electron 1.0.11 (#832) 2018-12-06 10:16:17 -08:00
06aeca228a Updating offline-app.html to right version (#833) 2018-12-06 10:15:40 -08:00
31fd4799a5 Hot fix release (v1.0.11) (#831)
* Hot fix release (v1.0.10)
2018-12-04 13:24:06 -08:00
7d8e6891ee 1.0.11 2018-12-04 13:03:59 -08:00
462234b1c0 Re-enable trace from simulator configuration (#830) 2018-12-04 13:03:34 -08:00
dad1bd0cd4 1.0.10 2018-12-03 16:38:08 -08:00
b71bfef418 Call setOutputType with the right arguments (#828)
* Call setOutputType with the right arguments
2018-12-03 16:37:53 -08:00
2e0a34c99b Calibration states (#820)
* color calibration
2018-12-03 16:37:40 -08:00
4133828a10 Update the join up link to the FLL Slack channel (#824) 2018-11-19 19:49:46 -08:00
f0c19bc976 Add LEGO video links to FLL page (#822) 2018-11-12 12:20:37 -08:00
a09b4a083f FLL page changes/add-ons (#821) 2018-11-12 12:02:19 -08:00
15dff9af08 Update fll.md 2018-11-12 07:49:04 -08:00
6fa5c1b688 Update fll.md 2018-11-12 07:47:31 -08:00
d76cea1477 1.0.9 2018-11-06 09:08:51 -08:00
ca09a0a833 Add file delete workaround to 'FLL' page (#816) 2018-11-06 09:08:14 -08:00
fcc864823e Use single sentence 'getting-started' card (#817) 2018-11-05 18:04:42 -08:00
166dc27b93 Add FLL page to SUMMARY (#815) 2018-11-01 17:38:21 -07:00
66e50473c4 FLL info page (#814) 2018-11-01 07:46:43 -07:00
58452e1ca3 Fix for missing CAPS in certain parts of EULA 2018-10-26 09:13:03 -07:00
2b7498ea2d Updating new EULA from legal (#813) 2018-10-26 09:09:11 -07:00
5ab2b97663 Remove titles from videos in homescreen (#812) 2018-10-23 08:44:02 -07:00
ffe0f0fb32 Enable tracing from simulator to appTheme (#810) 2018-10-17 11:33:18 -07:00
f27d13f88e Updating offline docs to new release 1.0.8 (#808) 2018-09-26 16:26:35 -07:00
31067dcef8 enable light toc 2018-09-26 16:13:15 -07:00
123f6c84b2 Release electron for auto update (#807)
This will enable auto update of the packages
2018-09-26 16:11:42 -07:00
c5f07ca67c removing light toc 2018-09-26 15:43:20 -07:00
22fc7dee18 added lighttoc 2018-09-26 15:42:28 -07:00
1f58b649c5 Release of 1.0.8 to live (#806)
Beta->release
2018-09-26 15:41:03 -07:00
fc75fe8e16 fixed video title 2018-09-26 11:31:24 -07:00
b399c37527 adding videos page to home 2018-09-26 11:28:32 -07:00
a054fdd3d3 1.0.8 2018-09-25 16:58:51 -07:00
a239589913 Move back to 4.0.9 2018-09-25 16:58:40 -07:00
98a046237c bump pxt-core to 4.1.1, 2018-09-25 16:56:45 -07:00
eb385ec532 1.0.7 2018-09-25 10:28:59 -07:00
2fdce16685 Update field motors editor to support localized languages (#803)
* Use the value for options, and hardcode localized versions of first dropdown
2018-09-25 10:28:34 -07:00
74eb77a9ae 1.0.6 2018-09-25 08:42:24 -07:00
4fba96588f Bumping pxt-core to 4.0.8 2018-09-25 07:56:19 -07:00
03c07bdcf5 1.0.5 2018-09-21 20:00:18 -07:00
6da1bc3cb1 bump pxt 2018-09-21 18:49:39 -07:00
dfc9ca1db4 fxing leading / in docs 2018-09-21 14:07:11 -07:00
83b64c1e54 1.0.4 2018-09-21 11:25:26 -07:00
a0cf8655f2 updated pxt 2018-09-21 11:25:13 -07:00
e4cf2c99c0 removoing lightToc 2018-09-21 11:07:04 -07:00
076fb8487e 1.0.3 2018-09-21 09:41:31 -07:00
c725561389 bump pxt 2018-09-21 09:41:19 -07:00
3dc781f4fd remove docs in image paths 2018-09-21 09:38:48 -07:00
4456767f2d Change tables to bullet lists for docs (#789) 2018-09-20 17:07:38 -07:00
6dba240899 1.0.2 2018-09-20 14:24:19 -07:00
d7172a1f3a Light theme docs (#786)
* lighttheme toc

* use LEGO edu logo everywhere

* bump pxt
2018-09-20 14:23:08 -07:00
245ff9d5b2 Adding link instructions (#787) 2018-09-20 14:05:59 -07:00
bfb258ce61 Add 'Explorer' section to editor features page (#785) 2018-09-20 07:35:24 -07:00
63beb2cac7 missing github logo 2018-09-19 21:26:35 -07:00
73d3dce139 missing comma 2018-09-19 16:16:37 -07:00
21be8a5021 1.0.1 2018-09-19 16:09:35 -07:00
03a82d6bcd upgrade to pxt v4 (#783)
* upgrade to v4

* Update pxt-common-packages

* bump to 1.0
2018-09-19 16:09:05 -07:00
60ea0f0cd5 allow for numbers in filename filter 2018-09-19 11:27:30 -07:00
f69a0d5289 enable save in menu 2018-09-19 09:50:21 -07:00
e2e8536b37 enable print (#779) 2018-09-19 09:48:48 -07:00
4096875a88 Removing beta tag (#781) 2018-09-19 09:39:12 -07:00
9825a90df2 Buildfix for lego and bumping common-packages to 0.23.54 (#780)
* fixing build failure

* Bumping common-packages to 0.23.54
2018-09-18 16:31:40 -07:00
7ad5d123a3 Replace brick info images (#777) 2018-09-18 15:46:13 -07:00
3599483ed2 Shorten showString and set default tone (#735) 2018-09-11 13:52:09 -07:00
7a6818931f Derive 'base' package file list from pxt-common-packages (#770) 2018-09-04 08:23:11 -07:00
eda38ebbc4 Fix the double entry for 'About' in SUMMARY (#764) 2018-08-10 14:30:44 -07:00
026f7a3180 0.4.3 2018-07-18 11:35:43 -07:00
f58fcb60e2 Enable additional langs for new translations (#760) 2018-07-18 11:35:10 -07:00
dbda86abb5 Release 0.4.2 (#748)
This is release of latest editor
2018-07-13 16:10:05 -07:00
3c13565e7c Beautify the download (#747) 2018-07-13 14:56:08 -07:00
f8524cf1a7 Release app 0.4.2 (#742)
* Add MacOS download link and update Windows download link

* Update electron manifest to latest app
2018-07-13 16:10:01 -04:00
bf4b1090fc 0.4.2 2018-07-13 10:59:44 -07:00
ea4d8cf66a Bumping pxt-core to 3.21.7 and pxt-common-packages to 0.23.45 2018-07-13 10:57:35 -07:00
b32ae4e61a Give a link to the instructions 2018-07-11 11:29:28 -07:00
1df90a6ea3 0.4.1 2018-06-28 15:49:43 -04:00
09ac2a7a47 Run motors tutorial - step 5 fix 2018-06-25 13:15:34 -07:00
06565995d3 fix offline app url 2018-06-22 14:54:08 -07:00
1a73aec74d Release app 0.3.6 (#732) 2018-06-22 14:52:33 -07:00
5516d041d6 Enable offline download page (#733)
* Enable offline download page

* avoid clashing with docs
2018-06-22 14:52:17 -07:00
7aac8ab5f3 Fix typo in what animal am I tutorial (#731) 2018-06-22 07:06:31 -07:00
73da17a395 Set organizationUrl to https://makecode.com/org so that it redirects to the about page, rather than makecode.com 2018-06-21 16:19:31 -07:00
16197f2987 Move to v0.4 2018-06-21 14:53:23 -07:00
5ec7eb6f04 Release v0.3.6 (#730) 2018-06-21 14:50:51 -07:00
f05ad887b8 0.3.6 2018-06-21 14:22:24 -07:00
c8a7b73101 Fix music field editor font size (#728) 2018-06-21 14:21:40 -07:00
0b9d029ecc 0.3.5 2018-06-21 13:24:13 -07:00
d6f0fee300 bump pxt-core to 3.20.11, bump pxt-common-packages to 0.23.39, 2018-06-21 13:24:08 -07:00
d78b4c5ee3 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-06-21 13:12:51 -07:00
13f5ebd6a7 legoeducation.com -> mindstorms.com 2018-06-21 13:12:44 -07:00
ccbebabc55 Update offline page (#719)
* Update offline page

* Remove const
2018-06-21 13:51:09 -04:00
5c61677ab9 0.3.4 2018-06-20 22:08:04 -07:00
21025b5f83 better handling end of integration step 2018-06-20 22:03:48 -07:00
f9a0729b63 0.3.3 2018-06-20 16:49:36 -07:00
8e456f5c3c bump pxt-core to 3.20.8, bump pxt-common-packages to 0.23.38, 2018-06-20 16:49:30 -07:00
e05e147d6a fix for motor driver (#716) 2018-06-20 16:45:02 -07:00
fc83cc5d5b Fix note field editor authoring such that it limits the notes that show up (#715) 2018-06-20 16:29:03 -07:00
7974f36c31 Fix tank and steer blocks in the simulator, making them ignore polarity just like labview (#713) 2018-06-20 16:10:59 -07:00
6513dbc901 Remove object near tutorial, until we fix the issue with variables and decompile blocks (#710) 2018-06-20 16:00:17 -07:00
97215e894a do a single green pulse when starting 2018-06-20 15:21:09 -07:00
1368ee824b restoring consol eicon 2018-06-20 15:18:31 -07:00
f2344ac52e upgrading comm on packages (#708) 2018-06-20 13:59:20 -07:00
299acea61f Offline app download page (#707) 2018-06-20 16:37:15 -04:00
a99f0212ac Fix browser download (#706) 2018-06-20 13:32:58 -07:00
d128dad3dc Startup sequence (#696)
* set light, play sound, show eyes, wait, clear screen, light

* play a sound, turn on lights
2018-06-20 13:32:00 -07:00
3d7ebeb7b7 fixed 1.10 -> 1.10E 2018-06-18 08:16:16 -07:00
304cbb5ee3 Match Color Sensor ports in the 'Try' tutorial (#689) 2018-06-14 15:01:44 -07:00
0f7ec45db4 Fix home screen close icon background color (#687) 2018-06-14 11:55:14 -07:00
2bc2bda502 Fix extensions dialog header color (#686) 2018-06-14 11:03:20 -07:00
51cb7a5299 0.3.2 2018-06-14 13:56:45 -04:00
068eb7017f pxt.commands null check 2018-06-14 13:40:19 -04:00
bb4966dca7 Bump pxt-core to 3.19.4 + Support drive deploy in Electron offline app (#677)
* initial

* Bump pxt-core to 3.19.4 for drive deploy
2018-06-14 13:33:53 -04:00
e981d1b95d Release patch fix with copyright text change (#680) 2018-06-13 16:11:52 -07:00
4f91d992a5 0.3.1 2018-06-13 14:49:52 -07:00
c91bf3ea7c Move master to v0.3 2018-06-13 14:49:24 -07:00
c6f92aa1cb Update footer as a product of docupdates (#678) 2018-06-13 11:34:26 -07:00
5de5b64e61 Edits from LEGO team review (#676) 2018-06-12 06:46:44 -07:00
1d442b7de9 Fix piano field editor (when it's on its own) (#675) 2018-06-07 16:42:49 -07:00
8508d5e8ba converting try into tutorial 2018-06-07 07:00:12 -07:00
f04a76a95f 0.1.62 2018-06-07 00:28:51 -07:00
88969da972 bump pxt-core to 3.18.17, bump pxt-common-packages to 0.23.15, 2018-06-07 00:28:45 -07:00
b19e5c4e4b Releasing app v0.1.60 2018-06-06 13:36:46 -04:00
15caad8b02 0.1.61 2018-06-01 09:04:15 -07:00
22ce6a8716 bump to pxt 3.18.10 (#671) 2018-06-01 09:03:47 -07:00
c288242b9c add "pause on run" flag to disable waiting after command (#663)
* add "pause on run" flag to disable waiting after command

* refactor

* fixing build
2018-06-01 08:51:50 -07:00
a8249e94c5 Make the troubleshoot menu item pop out into a new tab (#670) 2018-05-31 13:42:37 -07:00
92fbc1552b 0.1.60 2018-05-31 10:19:14 -07:00
92f29ef5d6 bump pxt-common-packages to 0.23.8, 2018-05-31 10:19:08 -07:00
c7fabfd994 0.1.59 2018-05-31 10:16:04 -07:00
df49475a26 bump pxt-core to 3.18.9, 2018-05-31 10:15:58 -07:00
17d8e61ebc 0.1.58 2018-05-31 10:13:17 -07:00
dbdc1810cd Add copyright text (#667) 2018-05-30 15:42:37 -07:00
d3b7530b17 EV3 Brick terminology (#665)
* reprhased

* EV3 brick => EV3 Brick

* revert a change
2018-05-30 15:42:17 -07:00
e31f4c934f Update README.md 2018-05-29 11:04:22 -07:00
b22ec74f7e Tshoot page edits (#658)
* T-shoot page edits post revert

* Restyle link

* Merge in revert page

* Clarify brick info step

* Keep periods off simple steps this time
2018-05-23 16:25:05 -07:00
cd38f670d2 T shoot page revert (#657)
* T-shoot page edits

* Revert t-shoot page
2018-05-23 12:04:32 -07:00
8fca537251 T-shoot page edits 2018-05-23 11:18:46 -07:00
cf39956e2d Tiny tweak to troubleshooting page 2018-05-23 09:10:47 -07:00
9e3a8ab4ed updated troubleshoot page 2018-05-23 07:50:38 -07:00
022a6765bf removing libs/automation, libs/chassis 2018-05-21 15:19:26 -07:00
1e4edc5109 Patch release (0.1.57) (#655)
Release 0.1.57 with tutorial fix patch
2018-05-18 14:26:13 -07:00
caf273be84 fix line following paragraph 2018-05-18 13:53:59 -07:00
ccba83cfab 0.1.57 2018-05-18 16:32:14 -04:00
8417c6ce57 Bumping pxt-core to 3.13.29 2018-05-18 16:31:36 -04:00
39236fe8b2 Release app 0.1.56 2018-05-18 10:51:16 -04:00
f50aabeec5 Update issue templates 2018-05-17 16:25:35 -07:00
c2167b6405 0.1.56 2018-05-16 06:37:29 -07:00
59dcd1ee72 fix another support link 2018-05-16 06:37:17 -07:00
bf8f73f885 Update favicon as per Lego spec (#650) 2018-05-15 13:40:55 -07:00
a81e3b9f11 Better description for stop all sounds. (#649) 2018-05-15 11:21:24 -07:00
e90b6a7946 0.1.55 2018-05-15 07:41:06 -07:00
7ce6c8b773 updated support with https link 2018-05-15 07:40:54 -07:00
022651b338 removing blurb 2018-05-15 07:38:18 -07:00
8d0bc280a0 Adding prepare card. (#594) 2018-05-14 11:49:06 -07:00
7b61a8fbc3 Releasing patch 0.1.54 (#628) 2018-05-11 18:04:53 -07:00
1d45652ab2 0.1.54 2018-05-11 15:58:11 -07:00
4db9c8bc0a Bump pxt-core to 3.13.28 2018-05-11 15:57:54 -07:00
df99fa1699 adding filename filter 2018-05-10 11:05:16 -07:00
ef218bcc24 0.1.53 2018-05-09 15:02:27 -04:00
99ccbfc348 0.1.52 2018-05-09 13:00:30 -04:00
101306b8f8 Add crowdin project 2018-05-09 12:59:52 -04:00
e167f109b0 0.1.51 2018-05-09 12:39:56 -04:00
e5d78d65cb Add crowdin to build (#591) 2018-05-09 12:39:25 -04:00
b79881ade0 Release 0.1.50 2018-05-07 16:52:57 -07:00
a05d12abdf 0.1.50 2018-05-07 15:13:07 -07:00
6c2cd1a658 Revert beta fix 2018-05-07 15:12:53 -07:00
90204ce58f 0.1.49 2018-05-07 15:07:28 -07:00
d8c4eeeb13 bump pxt-core to 3.12.26, 2018-05-07 15:07:22 -07:00
df6249931d Update download dialog (#589) 2018-05-07 14:59:29 -07:00
de61919fc1 Don't use ```block in tutorials. (#588) 2018-05-07 13:20:10 -07:00
105da90f3f Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-05-07 13:03:26 -07:00
023fc8fe96 typo 2018-05-07 13:03:20 -07:00
442b014233 Release beta (#587) 2018-05-07 12:57:46 -07:00
54681668ad 0.1.48 2018-05-07 12:35:51 -07:00
db1724b9fa moving to .24 2018-05-07 12:29:30 -07:00
7ed5a9bca6 0.1.47 2018-05-07 11:25:04 -07:00
7de61c7254 Remove beta (#586) 2018-05-07 11:24:45 -07:00
df99f18c8d 0.1.46 2018-05-07 11:07:12 -07:00
6d7bd63c3a bump pxt-core to 3.12.23, 2018-05-07 11:07:06 -07:00
9d1f39981d Release electron 0.1.43 2018-05-07 10:01:47 -04:00
e4e87c427d 0.1.45 2018-05-05 07:45:59 -07:00
1fece05e5e bump pxt 2018-05-05 07:37:24 -07:00
186c7e2e3f Small tutorial fixes and FE image updates (#585) 2018-05-04 18:43:29 -07:00
3322119f35 Unplug tutorial intros from step path (#584) 2018-05-04 16:23:53 -07:00
515be621a0 0.1.44 2018-05-04 15:54:10 -07:00
b337f4cf1c bump pxt-core to 3.12.21, 2018-05-04 15:54:04 -07:00
e6e6016bc0 0.1.43 2018-05-04 10:37:55 -07:00
3f23f5afa8 bump pxt-core to 3.12.19, bump pxt-common-packages to 0.22.7, 2018-05-04 10:37:48 -07:00
f0df0222c0 Fixes for High contrast mode as per lego design. Most changes are in PXT. Adding high contrast theme in the simulator (#564) 2018-05-04 10:36:48 -07:00
2a371b9cc6 Release electron v0.1.40 2018-05-04 10:04:39 -04:00
3211999583 0.1.42 2018-05-03 17:07:09 -07:00
b29862d566 update packaglock 2018-05-03 17:04:22 -07:00
b262d944b7 bump pxt-core to 3.12.18, bump pxt-common-packages to 0.22.2, 2018-05-03 17:03:16 -07:00
1b89d08337 Reduce size of tutorial gifs (#562) 2018-05-03 17:02:22 -07:00
6bdae6547a 0.1.41 2018-05-03 15:03:24 -07:00
30a67b729d Align all modules to a minimum height. (#563) 2018-05-03 15:02:13 -07:00
3e2c61e212 0.1.40 2018-05-03 11:59:50 -07:00
7a37dec196 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-05-03 11:48:19 -07:00
bac792f188 upgrade firmware -> troubleshoot 2018-05-03 11:48:10 -07:00
e4c3fa0e57 Make the light around the color sensor appear bright and not a reflection of the current color detected. (#561) 2018-05-03 08:39:06 -07:00
76f7df7579 Update favicon 2018-05-03 08:06:39 -07:00
d7e671175c 0.1.39 2018-05-03 06:57:18 -07:00
f4b7230a67 remove "pxtrequire" 2018-05-03 06:55:50 -07:00
afe0f9b0f7 updated pxt 2018-05-03 06:54:30 -07:00
23b6edc4bf Release app 0.1.36 2018-05-03 09:22:18 -04:00
13b3c1a194 Attempt to shorten color sensor ambient and reflected blocks by removing detected keyword (#560) 2018-05-02 22:09:04 -07:00
7e58b9b699 Motor angle (#559)
* control angle with slider

* called changed state

* remove logging
2018-05-02 22:04:29 -07:00
08a860bd80 Update tutorial gifs to match new sim inputs (#558) 2018-05-02 17:15:29 -07:00
4a966a73f1 0.1.38 2018-05-02 16:24:41 -07:00
542216000c 0.1.37 2018-05-02 16:24:35 -07:00
b323929f03 Fix color grid on IE. (#556) 2018-05-02 16:23:53 -07:00
1e3647738d Update download dialog. (#555) 2018-05-02 15:15:25 -07:00
838b3f7f9a 0.1.36 2018-05-02 15:07:55 -07:00
0ff2d7866d bump pxt-core to 3.12.16, 2018-05-02 15:07:45 -07:00
4c978d793a 0.1.35 2018-05-02 14:00:27 -07:00
06ca53ae89 Remove unused dependencies 2018-05-02 14:00:08 -07:00
84990d66a9 Update simulator as per latest lego UI design for sensors. Fix full screen layout issues. (#554) 2018-05-02 13:58:59 -07:00
4825172423 Update numbers music icon (from lego) (#553) 2018-05-02 13:55:44 -07:00
b69af383a6 Better mouse event handling (#552)
* Use learnings from touch events in Blockly and apply to the Ev3 sim. Register move and up events on the document rather than the individual element allowing users greater flexibility where they move their mouse once it's down.

* Add mouse leave events
2018-05-02 13:54:06 -07:00
6e1a613798 0.1.34 2018-05-02 12:58:27 -07:00
b5005f3b10 bump pxt-core to 3.12.12, 2018-05-02 12:57:46 -07:00
044b585f24 Release Electron app v0.1.30 2018-05-02 10:13:07 -04:00
94fe26e390 0.1.33 2018-05-01 22:05:57 -07:00
ca832f52db upgrading pxt 2018-05-01 22:05:46 -07:00
6f2fe212df Tutorial updates (#551)
* updated line following, added simulator step

* full screen

* resizing some images
2018-05-01 21:53:28 -07:00
96be357af1 updated package-lock 2018-05-01 16:16:19 -07:00
36df6cfb03 0.1.32 2018-05-01 14:13:09 -04:00
e1095b3d4a Integrating field music icons (#549)
* Use the music icons provided by lego in the music field editor
2018-05-01 14:12:42 -04:00
9257e08f0d 0.1.31 2018-05-01 13:08:38 -04:00
149f256454 bump pxt-core to 3.12.9, 2018-05-01 13:08:33 -04:00
ba00d91bf2 Fixes for the download dialog (className), and update the location of the troubleshoot link. (#548) 2018-05-01 13:08:05 -04:00
764994a633 updates to troubleshoot page 2018-05-01 08:48:02 -07:00
ab85cf2d0a Remove jquery typings (#547) 2018-04-30 16:29:23 -04:00
ce7ecd5121 Update favicons to the lego icon. (#546) 2018-04-30 13:33:56 -04:00
40fb4107cf 0.1.30 2018-04-30 13:08:13 -04:00
9b8816f781 bump pxt-common-packages to 0.21.13, 2018-04-30 13:08:09 -04:00
27756d922e bump pxt-core to 3.12.5, 2018-04-30 13:06:45 -04:00
0b1d7068e9 Changes accompanying the new blockly toolbox (#545) 2018-04-30 13:06:24 -04:00
0a5b4b9329 0.1.29 2018-04-27 10:55:37 -04:00
2da1b3111f Bumping pxt-core to 3.12.4 2018-04-27 10:55:07 -04:00
f600ee270e 0.1.28 2018-04-27 10:53:34 -04:00
7c3d499109 fix dmesg duplicate definition issue (#542) 2018-04-25 16:45:26 -04:00
8ed79e7133 Swap X/y in images (#528)
* Swap X/Y in image encoding

* Fix PNG decoder

* Now really fix png

* reducing deps

* moving png.cpp into ev3

* bumped pxt

* updated shims

* fixing c++ compilation

* updated shims

* Fix pixel order

* update pxt

* Fix C++ image decoding

* Add expanded PNG images

* Generate E1 format images (in libs/ev3 run 'pxt buildsprites images')

* Go back to white background

* Remove PNG support
2018-04-19 12:08:16 -07:00
95ab3be26e Diagram and linking fixes for 'Maker Design Process' (#533) 2018-04-18 13:15:53 -07:00
83700b4e14 Music field editor (#529)
Music fiele editor
2018-04-17 22:16:19 -07:00
989699c620 Update hero banner 2018-04-17 16:26:51 -07:00
e0c80361db Editor feature page override with button images (#521)
* Editor feature page override with button images

* Update the 'about' a bit

* Bold the 'drivename'

* Add a ref to the editor features page in about
2018-04-17 16:10:54 -07:00
67153fccc5 Reduce the use of @boardname@ (#527)
* Reduce the use of @boardname@

* Use literal 'EV3 Brick' string instead

* Use the new 'nickname' form
2018-04-16 16:15:58 -07:00
3c96cfcc0a Change to always show the sensor controls. (#526) 2018-04-16 11:50:12 -07:00
03add213d9 Only using main loader for editor loader, other loaders use standard spinning loader. (#524) 2018-04-16 10:52:39 -07:00
e43837d358 Hide or remove logging (#523)
* Hide or remove logging

* Remote dmsg
2018-04-15 19:36:10 -07:00
be207282e3 Move blockly toolbox css to semantic.css (#522) 2018-04-15 10:29:37 -07:00
d6e4c5a717 Use pxtsemantic which includes only the semantic components we use in PXT. (#520) 2018-04-14 00:55:29 -07:00
5384ec567d split editors (#516)
* spliteditor
2018-04-13 21:46:19 -07:00
6ea8a59f58 Release v0.1.27 (#519)
* Release v0.1.26

* Update index-ref.json
2018-04-13 21:03:43 -07:00
03c6100635 0.1.27 2018-04-13 20:52:51 -07:00
173b5dfd18 0.1.26 2018-04-13 20:06:50 -07:00
c86331b857 0.1.25 2018-04-13 20:06:16 -07:00
43a3942147 bump pxt-core to 3.8.15, 2018-04-13 20:06:09 -07:00
10cc883ef7 Fix serial editor theme. (#517) 2018-04-13 19:59:10 -07:00
2cbb3e05b0 Fix card border radius 2018-04-13 19:15:34 -07:00
eac73932be Release v0.1.24 (#515)
Release ev3
2018-04-13 17:04:27 -07:00
62e8f698a5 0.1.24 2018-04-13 15:53:09 -07:00
d0331720b4 Fix slider gradient bug when loading components from a previous sim run. (#514) 2018-04-13 15:52:38 -07:00
724ac19281 0.1.23 2018-04-13 15:24:28 -07:00
3e193e97bf bump pxt-core to 3.8.14, 2018-04-13 15:24:23 -07:00
23c1789976 Fix IE11 for in bug in motor field (#513)
* Fix IE11 for in bug in motor field

* minor fix
2018-04-13 15:21:41 -07:00
87b08bf6f3 0.1.22 2018-04-13 14:02:04 -07:00
3e534f7329 Update state of the landscape brick view as well to be consistent with the portrait view (main) (#508) 2018-04-13 14:01:37 -07:00
7f8499bb5f Always show the motor value regardless if it's 0. (#509) 2018-04-13 14:01:25 -07:00
4bcde58c0c 0.1.21 2018-04-13 12:37:36 -07:00
dd5df88dea Update test 2018-04-13 14:50:20 -04:00
f35ed0205b 0.1.20 2018-04-13 11:47:55 -07:00
7379c8dfe7 Friday 13th using .13 builfd 2018-04-13 11:37:51 -07:00
574de3a15e bumping pxt 2018-04-13 11:29:00 -07:00
a3c08ddb01 branding fixes 2018-04-13 09:05:34 -07:00
070cc42d36 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-04-12 15:05:19 -07:00
77aa7b86d8 fixing summary 2018-04-12 15:05:14 -07:00
f912ea6104 0.1.19 2018-04-12 15:01:43 -07:00
b06bc6bc6c bump pxt-core to 3.8.11, 2018-04-12 15:01:38 -07:00
af3189d8b5 removing mindstorms from tutorial names (#496)
* removing mindstorms from tutorial names

* lego feedback

* file name issues

* bring back bang
2018-04-12 14:41:22 -07:00
661157f112 0.1.18 2018-04-12 14:29:52 -07:00
141bc6bddb bump pxt-core to 3.8.10, 2018-04-12 14:29:44 -07:00
bd06fb80f3 Threshold to calibration (#495)
* renaming threshold to calibration

* rename threshold to calibration
2018-04-12 14:25:44 -07:00
2c874570ce Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-04-12 10:33:27 -07:00
08ee2b2017 fixing branding 2018-04-12 10:33:21 -07:00
499d97b07c Update targetconfig.json 2018-04-12 13:26:02 -04:00
32b7400e9e Optimizing Logos. 2018-04-12 00:36:11 -07:00
90717cfc33 Change drive label to EV3 (#494) 2018-04-11 17:20:07 -06:00
bd3b149dcc Tutorial theming (#493)
* Tutorial theming

* no border
2018-04-11 13:22:21 -06:00
fafd3d37da Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-04-11 09:33:01 -07:00
138425c0fb missed renaming 2018-04-11 09:32:54 -07:00
231cd41f7a rename intruder to security (#492) 2018-04-11 10:31:53 -06:00
eb7cd5d97c 0.1.17 2018-04-11 08:59:01 -07:00
a4a9af28a4 Switch to reflected light when calling threshold (#489)
* fix typo

* fixing threshold functions

* switch to reflected mode when calling threshold
2018-04-11 09:58:34 -06:00
6c253182e4 0.1.16 2018-04-11 08:00:47 -07:00
0198be6dda add screen mode to auto clear screen between modes (#486) 2018-04-11 09:00:22 -06:00
57ab6d153d added support links 2018-04-11 08:00:01 -07:00
fd0bd4ef39 update drive name 2018-04-11 07:58:02 -07:00
8b2ae10980 Initial 'troubleshoot' page (#484)
* Initial 'troubleshoot' page

* Define 'driveDisplayName'

* Tutorial name goof

* Add fake label for drive

* And typo

* Add firmware update section

* Add a hint for offline firmware update
2018-04-11 08:57:29 -06:00
4627328bcd Output set Type fix (#487)
* properly send outputsettype info

* fix simulator

* bump pxt

* typo in docs
2018-04-11 08:48:07 -06:00
80989cf4c9 More tutorial typos (#485) 2018-04-11 08:45:44 -06:00
00b193b126 Add 'intruder alert' tutorial (#452)
* Add 'intrduer alert' tutorial

* Use 'detected' option instead of 'near'
2018-04-10 23:43:28 -06:00
e65db0b756 Update dimmer background, refactor top menu background. (#483)
Minor ui changes (dimmer background)
2018-04-10 12:48:00 -07:00
8f211a5c19 Use sort option in FieldImages to sort the options after showing the editor (not before) (#482) 2018-04-10 11:51:08 -07:00
379a6a26be Add large and medium motor speed labels (#480)
* Add large and medium motor speed labels

* Support dual motor labels.
2018-04-10 11:50:58 -07:00
8398c8efdb Dispose correctly of gradient definitions in the control. Attach to port number not id. 2018-04-10 11:49:15 -07:00
f41310e879 Update large motor holes to be transparent (like the real thing) (#476) 2018-04-09 17:27:57 -07:00
82198020de 0.1.15 2018-04-09 17:22:07 -07:00
09d6b728b0 bump pxt-core to 3.8.6, 2018-04-09 17:22:01 -07:00
9147cb98c2 Updates to the download dialog. Fixes #424 (#443)
* Updates to the download dialog. Fixes #424
2018-04-09 17:20:38 -07:00
6d29cd40cb Make both the simulator color picker and the Blockly editor color picker match in shape and the colors as well as order of colors. (#474) 2018-04-09 16:48:57 -07:00
d5b4ec5255 Center align the toggle buttons (#473) 2018-04-09 16:26:46 -07:00
b8286ab0b9 Medium motor resizing (#472) 2018-04-09 16:24:01 -07:00
ac1380ec92 Better screen zoom that makes use of the full width of the simulator. (#471) 2018-04-09 16:21:41 -07:00
a433988929 New motor field editor (#470)
* New motor field editor showing two dropdown, first to select the type and the second to select the port.
2018-04-09 15:59:28 -07:00
d837a515dc Fix brick color not changing to the color red. Fixes 453 (#456) 2018-04-08 03:35:02 -06:00
4be657e84d Remove about from the help menu (#451) 2018-04-06 13:30:14 -07:00
c90f00f6d0 Object near tutorial (#445)
* Add 'Object Near?' tutorial

* Add to SUMMARY

* Fix screen line index

* Redo tutorial

* Paste fail typo
2018-04-06 13:09:27 -07:00
ecc880cf8d Move on start to the top of the list in loops. (#448) 2018-04-06 09:51:54 -07:00
fbb3280bc8 Showimagedelay (#446)
* add delay on "show image"

* removing optional duration
2018-04-05 20:42:03 -07:00
29f081eb03 Remove social share links from footer (#444) 2018-04-05 20:36:02 -07:00
49ab5ec099 Shrink some of the tutorial sentences (#440)
* Shrink some of the tutorial sentences

* Match the less than order for blocks

* Include later tutorials in SUMMARY

* Ditch 'using' in name
2018-04-05 17:32:32 -07:00
5277cc847c removing support for far in ultrasonic (#441)
* removing support for far in ultrasonic

* removing more far
2018-04-05 17:07:14 -07:00
e11b11d19c Add 'red light, green light' tutorial (#436) 2018-04-05 16:02:46 -07:00
57c1ae0f99 Add 'line following' tutorial (#435) 2018-04-05 13:37:24 -07:00
2129601e6a 0.1.14 2018-04-05 11:03:20 -07:00
e1727dc917 update pxt (#433)
* update pxt

* hide image field editors
2018-04-05 10:40:11 -07:00
ecc9319334 Switch the backing of the blocks JS toggle. (#431)
* Switch the backing of the blocks JS toggle.

* Minor changes
2018-04-05 06:48:27 -07:00
81758f2555 What color tutorial (#430)
* Add 'What color' tutorial

* More edits and thumbnail
2018-04-04 22:15:09 -07:00
7825bd1579 Use the correct sig for ultrasonic onEvent doc (#429) 2018-04-04 16:21:00 -07:00
ac81067f82 Tutorial format and macro fixes (#425)
* Tutorial format and macro fixes

* Remove branded names
2018-04-04 15:12:55 -07:00
b1958d77e7 Add 'Touch sensor values` tutorial (#421)
* Add 'Touch sensor values` tutorial

* Edits and thumbnail

* Modify activity to no restart motor
2018-04-04 13:57:40 -07:00
232744520b Remove 'examples' from summary (#423) 2018-04-04 13:57:17 -07:00
ac9ebf6776 Add 'Touch to Run` tutorial (#420)
* Add 'Touch to Run` tutorial

* Edits and thumbnail image
2018-04-03 21:33:53 -07:00
c97098b99e Add 'Run Motors' tutorial (#419)
* Add 'Run Motors' tutorial

* Finish edits and add thumbnail
2018-04-03 20:53:35 -07:00
b39a7f3484 Add 'Mindstorms Music' tutorial (#418)
* Add 'Mindstorms Music' tutorial

* Add image and edits
2018-04-03 19:31:35 -07:00
806f60a419 Add 'What Animal Am I' tutorial (#417) 2018-04-03 17:55:15 -07:00
0bb7295d86 Press button tutorial (#416)
* Add tutorial for 'Make Animation'

* Finish off the tutorial
2018-04-03 16:37:07 -07:00
60bf3df1d8 Show mood tutorial prototype (#414)
* Show mood tutorial prototype

* Missed block styling
2018-04-03 15:45:11 -07:00
b8a3fa345f Include doc stubs for excluded music methods (#411) 2018-04-03 14:39:30 -07:00
ec1ceea138 bump version to 0.1.13 (#407)
* bump version

* Light Condition -> Light

* roll back 0.1.11
2018-04-03 12:03:15 -07:00
b618bfec59 0.1.13 2018-04-03 05:05:32 -07:00
2467b3c4c9 renaming pauseforcolor to pause until color detected (#405)
* renaming pauseforcolor to pause until color detected

* pauseForLight -> pauseUntilLightConditionDetected

* on light changed -> on light condition detected

* fixing docs

* docs tweaks
2018-04-03 05:05:01 -07:00
69194b0b76 Erase on showstring + showports improvements (#402)
* erase line before show string + show ports upgrade

* fixed font size

* fixing console output
2018-04-03 04:30:23 -07:00
3339a7660a moving motor properties to lower group (#403) 2018-04-03 04:30:10 -07:00
9c3be9fe37 Remove duplicate lessons (#391) 2018-04-03 04:11:48 -07:00
c0413aa192 hiding the was pressed block (#401) 2018-04-03 04:10:35 -07:00
6c626f9c98 0.1.12 2018-03-30 15:47:03 -07:00
f95b39cd62 updated shims 2018-03-30 15:46:04 -07:00
bba0af6193 adding defaults to music 2018-03-30 15:45:36 -07:00
a8a92ca806 moving to 0.1.11 2018-03-30 14:51:20 -07:00
6f066e4397 0.1.11 2018-03-30 13:32:37 -07:00
7dd27b3da1 bumping pxt 2018-03-30 13:27:49 -07:00
41514cfa64 0.1.10 2018-03-30 09:56:55 -07:00
53ad94d0ad bump pxt-common-packages to 0.20.30, 2018-03-30 09:56:50 -07:00
220a774238 bump pxt-core to 3.6.2, 2018-03-30 09:48:28 -07:00
7444b28ebb Update monaco editor background 2018-03-30 09:11:13 -07:00
8abc137d60 Add 'showPorts' api doc (#392) 2018-03-29 16:43:17 -07:00
3cad464ea5 Activity category & description fixes (#390) 2018-03-29 15:16:26 -07:00
b6b23314cb 0.1.9 2018-03-29 17:02:56 -04:00
34381ed171 bump pxt-core to 3.6.1, 2018-03-29 17:02:50 -04:00
a627d19ebf Add locales entry to pxtarget (#389)
* Add locales entry to pxtarget

* Remove languages from targetconfig
2018-03-29 17:01:05 -04:00
4cbdd72770 fixed support url 2018-03-28 21:36:53 -07:00
6412d52f99 fixing tacho references 2018-03-28 21:28:15 -07:00
c75bd0b06d 0.1.8 2018-03-28 21:20:56 -07:00
79afed3667 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-03-28 21:20:54 -07:00
e040407070 bumping pxt 2018-03-28 21:20:35 -07:00
123d41cb64 adding english to language option (#387) 2018-03-28 20:20:16 -07:00
0dc2548d0b Optimize simulator for light mode. (#379)
* Optimize simulator for light mode.

* Add user-select none.
2018-03-28 13:36:52 -07:00
b4b3a24ed2 test release manifest (#381) 2018-03-28 12:31:42 -04:00
ed653e8a37 0.1.7 2018-03-28 09:05:10 -07:00
31f91d4e24 upgrading to latest common packages (#383) 2018-03-28 09:04:49 -07:00
8536126e23 removing tacho (#382) 2018-03-28 09:04:28 -07:00
f1ea113fc0 0.1.6 2018-03-28 08:50:34 -07:00
550528c695 bringing back show ports (#377)
* bringing back show ports

* added firmware links in docs

* updated color rendering

* better rendering of touch/ultra/ir

* better data per sensor
2018-03-28 08:50:14 -07:00
89e1819399 Applying home screen UI changes (#378) 2018-03-27 16:30:43 -07:00
e8fea031b2 0.1.5 2018-03-26 11:38:24 -07:00
0429c77d94 bump pxt-core to 3.5.11, 2018-03-26 11:38:20 -07:00
f41a646541 Small batch of 'activity' edits (#376) 2018-03-23 16:26:46 -07:00
988bec00b2 More updates for 'Try' and 'Use' topix (#375) 2018-03-22 14:16:14 -07:00
6e714caa2b Remove console log from colour field 2018-03-22 09:55:08 -07:00
336b7a5bf5 Incremental update to 'try' and 'use' topics (#374) 2018-03-21 12:36:49 -07:00
918dc802e9 Update 'make it faster' lesson (#373) 2018-03-20 16:11:32 -07:00
adbda6e35f Update 'make it communicate' lesson (#372) 2018-03-19 21:07:30 -07:00
77365ddd92 Snap to a specific version of less and semantic ui. (#371) 2018-03-19 13:42:15 -07:00
5ba1e85f84 Update 'Make it Move WO Wheels' lesson (#370) 2018-03-19 13:27:44 -07:00
f577c61998 Make corrections to coding activities (#369)
* Make corrections to coding activities

* Bit of format and typos
2018-03-19 12:26:29 -07:00
06f66571cf Upgrading to pxt 3.5.4 (#367)
* pxt/common updates

* added game lib

* removing gamelib
2018-03-16 14:32:11 -07:00
d714e4df42 Update lessons and change images (#368)
* Update lessons and change images

* Delete suptopic file
2018-03-16 14:26:14 -07:00
fc877b889c 0.1.4 2018-03-08 14:34:47 -08:00
49dc3b0a75 Fix resizing of screen canvas to ensure it fits within the area in the ev3 svg (#365) 2018-03-08 14:34:27 -08:00
994e57c395 Remove all external packages, will add later the ones we want (#364) 2018-03-08 14:20:52 -08:00
a6298078ba 0.1.3 2018-03-08 14:15:48 -08:00
acc55506cb Update index-ref.json 2018-03-08 14:14:33 -08:00
0c7d31770d Make a sound machine lesson (#363) 2018-03-08 07:12:52 -08:00
8c2ede17a0 'Make a security gadget' lesson (#362)
* Make a sound machine lesson

* Switch to security gadget
2018-03-08 07:12:18 -08:00
be55a342ff Bring back the pxt footer (#361) 2018-03-07 09:49:49 -08:00
d356c87c83 Remove social buttons in footer (#360) 2018-03-07 09:46:57 -08:00
2abf59010e Import 'object detection' activity (#359) 2018-03-02 18:02:26 -07:00
9360f938b7 Import 'line detection' activity (#358) 2018-03-02 17:35:40 -07:00
3006af3e63 Import 'autonomous parking' activity (#357) 2018-03-02 17:03:40 -07:00
d5b55585cd Remove redundant color word in the color blocks, refer to the color sensor with 'color sensor' (#356) 2018-03-02 09:01:18 -07:00
ab3c4c5267 Example overrides for 'music' api docs (#353)
* Example overrides for 'music' api docs

* Drop 'music' into card page
2018-02-27 17:15:26 -08:00
6d07d5bd23 Consolidate 'coding' activities into single pages (#354) 2018-02-27 17:15:12 -08:00
eb45a76928 Example overrides for 'control' api docs (#352)
* Add 'playSound' api docs

* Example overrides for 'control' api docs
2018-02-27 15:12:23 -08:00
fcba14aae1 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-02-27 11:48:54 -08:00
44c68a7c0e fixing layout images 2018-02-27 11:48:50 -08:00
d4b3ebc2e4 Missing updatestats (#351)
* aligning screeninit with pxt32

* remove shim

* missing shim

* missing shim
2018-02-26 21:25:04 -08:00
fa5ba504c5 bump common packages 2018-02-26 16:21:18 -08:00
2d639b9a90 pointing master to 0.1.2 2018-02-26 16:14:04 -08:00
f8b8fbb1b4 0.1.2 2018-02-26 15:59:57 -08:00
594ead703c fixing mood block (#349) 2018-02-26 15:59:36 -08:00
5f05934dda 0.1.1 2018-02-26 15:17:14 -08:00
3e0ca1acb9 bump minor 2018-02-26 15:17:06 -08:00
c2d26a8418 Integrate screen APIs from common packages (#343)
* starting screen api intergration

* Further image integration

* Aligning with new screen apis

* Build fixes

* Adjust to common screen state

* Fix unpackPNG

* Add game library

* Optimize screen rendering

* bumping common packages

* updated shims

* moving images into ev3

* upgrading to common packages

* added try/use

* cap

* fixed tryp age
2018-02-26 15:16:17 -08:00
5bd9705966 0.0.109 2018-02-26 14:49:15 -08:00
1160d73b16 bump pxt-core to 3.4.9, bump pxt-common-packages to 0.20.3, 2018-02-26 14:49:00 -08:00
a2218d9ba5 Fix canvas (screen) user select options to disable selection in Safari, Mozilla, etc. (#348) 2018-02-26 13:58:51 -08:00
54576ae77a Fix authoring of the mood field editor. (#347) 2018-02-26 13:52:26 -08:00
f16549d7cd 0.0.108 2018-02-26 13:38:20 -08:00
a021c0b292 Use a color picker for the color field (color enum picker) (#346) 2018-02-26 13:37:58 -08:00
cda7013e96 fixing links 2018-02-26 13:27:03 -08:00
2f0fefbeaf updated images 2018-02-26 13:25:53 -08:00
b5303a660b 0.0.107 2018-02-26 11:22:44 -08:00
a60958f72a Update search icon and avatar SVG (#345) 2018-02-26 10:43:29 -08:00
33dcb6deee renaming infraredSensor to infrared (#344) 2018-02-26 10:39:15 -08:00
130a47d684 Sensor names are now part of the block text (#341)
* Sensor names are now part of the block text

* Use ports field editor
2018-02-26 11:33:50 -05:00
2d355bb2ca Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-02-23 20:38:53 -08:00
8ee63df325 Add in 'console' doc stuff (#342)
* Add 'playSound' api docs

* Add in 'console' doc stuff

* Add 'send to screen' in summary\
2018-02-23 14:13:08 -08:00
7d16cf10ac added make it smarter 2018-02-23 07:37:32 -08:00
60ec3f1c99 Add 'playSound' api docs (#340)
* Add 'playSound' api docs

* Linkup summary
2018-02-22 16:23:07 -08:00
6524b0a841 Add 'timer' api docs (#339) 2018-02-22 14:56:15 -08:00
d778232155 removing .mp4 file 2018-02-22 10:24:40 -08:00
c157b4d922 0.0.106 2018-02-22 10:18:13 -08:00
0837123828 bumping pxt 2018-02-22 10:15:58 -08:00
e51a32b69f use full motor names (#338) 2018-02-22 10:03:25 -08:00
029066000d updated style 2018-02-22 08:28:42 -08:00
7e35abeff3 lock on 0.0.104 2018-02-22 06:54:18 -08:00
0166785c1b 0.0.105 2018-02-22 06:36:41 -08:00
ea0f6a4734 updated pxt 2018-02-22 06:36:26 -08:00
271721561d turn sample into blocks 2018-02-21 22:39:35 -08:00
ed8f8bafa7 Add 'infrared beacon' api topics (#330)
* Add 'infrared beacon' api topics

* Include note about channel selection
2018-02-21 22:35:51 -08:00
8cfb70c97b Threshold api docs - 01 (#336)
* Local commit

* Throw on more topics

* Throw in threshold topics for infrared
2018-02-21 22:35:25 -08:00
84c8e31ff5 First burst of 'color' pages (#335)
* Add 'color sensor' api topics

* Last set of edits/adds
2018-02-21 14:03:55 -08:00
ceb9b7fabf 0.0.104 2018-02-21 06:45:29 -08:00
9e0670551f upgrading pxt 2018-02-21 06:45:14 -08:00
6613607503 Make it comm lesson (#331)
* integrating lego lesson

* fixed link

* adding various solutions

* updatring to 3.4.6

* using play sound effect until done

* revert pxtversion

* fixing link
2018-02-21 06:43:53 -08:00
3a67190914 Add some 'infrared' api docs (#326)
* Add some 'infrared' api docs

* Fix display messages

* Change discussion of distance to relative

* Include motor speed note
2018-02-20 10:38:41 -08:00
05e916e247 0.0.103 2018-02-19 07:35:38 -08:00
fad4ca98db renaming 'set speed' to 'run' (#327) 2018-02-19 07:35:08 -08:00
3b6cfed5b2 added distance measurer 2018-02-15 13:56:50 -08:00
472ea170d0 fixing default light 2018-02-15 13:49:04 -08:00
80f24948ec 0.0.102 2018-02-14 16:05:40 -08:00
daa88b299d replacing loops.pause -> pause, loops.forever -> forever 2018-02-14 16:05:31 -08:00
0384eb4d9d upgrading common packages 2018-02-14 15:59:08 -08:00
f33f88e87c fixing struture 2018-02-14 11:20:56 -08:00
239827c259 0.0.101 2018-02-14 11:06:56 -08:00
cd0097749a updated readme 2018-02-14 11:00:12 -08:00
94db31beb7 bring back the shims 2018-02-14 10:56:50 -08:00
408631d426 upgrading common packages 2018-02-14 10:32:09 -08:00
2407e7e179 0.0.100 2018-02-14 10:16:57 -08:00
f63b447fee upgraded to v3.4.3 2018-02-14 10:16:27 -08:00
bbd1a9d215 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-02-14 10:15:28 -08:00
cfc4688fbe adding targetconfig to package 2018-02-14 09:49:47 -08:00
24d48c0171 update firmware url 2018-02-14 09:36:20 -08:00
523c507c35 Projectupdate1 (#325)
* integrating test lesson from lego

* adding side card annotations
2018-02-14 08:56:12 -08:00
d6cbbcc3d9 support for importing urls 2018-02-13 21:41:49 -08:00
2b5cedb404 0.0.99 2018-02-13 11:26:41 -08:00
224e9c54f0 color dropdown for color sensor (#324) 2018-02-13 10:44:46 -08:00
f3f33828f3 Fixed the dropdown for colors (#323) 2018-02-12 21:23:16 -08:00
2905814898 0.0.98 2018-02-12 12:26:08 -08:00
96f1086c8f Applying UI updates from Lego (#322) 2018-02-12 12:23:25 -08:00
7bd2192a0a Fill in some ultrasonic sensor topics (#321)
* Fill in some ultrasonic sensor topics

* Busted link

* Adjust those sea also links

* Busted snippets
2018-02-11 09:01:46 -08:00
6f539de2d2 Touch sensor doc fill-in (#320) 2018-02-09 18:17:12 -08:00
1d83d6c40e 0.0.97 2018-02-09 10:26:28 -08:00
53bff7b133 updated package lock 2018-02-09 10:26:20 -08:00
2f6ad3110a motor blocks with optional args (#290)
* motor blocks with optional args

* updated signatures

* added toggle mode

* adding annotations
2018-02-09 10:25:39 -08:00
22ce840181 Widget fixes (#316)
* Use bBox in motor slider

* Use setRate instead of setAngle in gyro widget
2018-02-08 16:55:23 -08:00
d8589ea98c Discussion note for gyro precsion (#317)
* Discussion note for gyro precsion

* Wrong sig
2018-02-08 15:06:08 -08:00
adb577547d 0.0.96 2018-02-08 12:53:17 -08:00
ab6290c76d Add blocky grid (#313) 2018-02-08 11:49:26 -08:00
99d4d87894 0.0.95 2018-02-08 09:36:08 -08:00
b73696e918 Gyro sensor topics (#311) 2018-02-08 09:35:47 -08:00
f53dbf4d83 Include Open Sans font and some UI tweaks reducing white space in the editor. (#312) 2018-02-08 09:35:27 -08:00
c9f6d873b1 Edit LabView user help doc (#310) 2018-02-07 13:55:49 -08:00
c274259472 0.0.94 2018-02-07 09:54:24 -08:00
74ca722aac updated IR arts 2018-02-07 09:53:58 -08:00
931ca40f49 updated IR art 2018-02-07 08:13:46 -08:00
458ac847b7 updated assets for LEGO 2018-02-07 07:13:22 -08:00
653d8f6f5c 0.0.93 2018-02-07 01:50:28 -08:00
ac0a9f0710 Various example of LavView vs MakeCode (#309)
* screenshots

* more screenshots

* added pics

* more writup

* more examples
2018-02-07 01:42:46 -08:00
2cce2a39b8 updated colors for motor/math 2018-02-07 01:42:16 -08:00
a337403afa 0.0.92 2018-02-06 23:19:06 -08:00
fd9d118fa4 reversed => Inverted (#308)
* renaming "setReversed" to "setInverted" to match LabView

* fixing samples

* typo
2018-02-06 23:18:36 -08:00
e94ac6f6f1 renaming brick.setLight to brick.setStatusLight (#307)
* renaming brick.setLight to brick.setStatusLight

* updated docs
2018-02-06 22:18:39 -08:00
88c58b4e76 First set of 'motors' topics (#305)
* Start of 'motors' topics

* Draft the 'motor motion' side doc

* Add / update more topics

* Last blast of edits

* Capture some more edits

* Put in movement and steering details
2018-02-06 19:43:50 -08:00
e2eb5f35af upgrading to node.js 8 (#306) 2018-02-06 12:50:39 -08:00
71fe612ced 0.0.91 2018-02-05 16:38:50 -08:00
e58ec06e91 IR button indexing fixes (#303)
* IR remote id fixes

* hiding private api

* fixing indexing of buttons
2018-02-05 15:11:11 -08:00
538493369b adding button class on remote buttons 2018-02-05 13:57:24 -08:00
56dd8e0875 enabling doc checks 2018-02-03 09:11:49 -08:00
1f7ef637b2 Fix links in target 2018-02-03 09:09:10 -08:00
f4f2e0ba0e 0.0.90 2018-02-02 14:19:17 -08:00
22c31c57df fix port bug 2018-02-02 14:19:07 -08:00
6879961297 0.0.89 2018-02-02 13:39:18 -08:00
69fcb7407a Simulator support for remote (#302)
* fixing up state

* upgrading ir simulator

* displaying remote

* updated infrared svg
2018-02-02 13:38:54 -08:00
4dfada877c Implement simulator sensor for ambient and reflected light (#301)
* Initial work

* More stuff

* Stuff

* Stuff

* Hardcoded dashed line

* High and low thresholds

* Use rect bBox

* Add back grabbing hand

* Threshold placement

* Cleanup

* Don't need defs

* pxtarget

* Remove dashed lines for now
2018-02-02 13:24:50 -08:00
b10b636766 0.0.88 2018-02-02 09:48:51 -08:00
ba47fb0589 Support for remote control buttons (#300)
* refactor beacon function inside IR sensor

* towards sim support

* channel labels

* reverting to singletons

* hiding unused apis

* lazy allocation of button instances

* tracking button state

* hook up the state
2018-02-02 09:48:27 -08:00
f36e14fe69 renaming remote button names 2018-02-01 22:33:05 -08:00
8bab919db2 0.0.87 2018-02-01 22:21:15 -08:00
89a82b54dc Ir proximity in simulator (#299)
* support for IR proximity

* fixing build issue

* missing break

* remove auto-start of sensor

* setting mode on onEvent

* flooring slider value

* bump up proximity

* fixing threshold blocks
2018-02-01 22:03:01 -08:00
15ee6ebe9c 0.0.86 2018-02-01 16:46:10 -08:00
9bf50665fc improving the spacing & block names (#298) 2018-02-01 16:21:08 -08:00
f594cdefac add infrared sensor in ev3 library (#296) 2018-02-01 16:18:20 -08:00
5ce7a83f5d 0.0.85 2018-02-01 14:41:42 -08:00
d7ef7c353c typo in generated filter 2018-02-01 14:08:28 -08:00
c7cb300cd9 fixing lights in Edge/Firefox 2018-02-01 14:03:36 -08:00
4e194536d3 0.0.84 2018-01-31 20:10:23 -08:00
570cd7474f upgrade pxt 2018-01-31 20:10:13 -08:00
9ea5597734 0.0.83 2018-01-31 18:10:38 -08:00
2c0cc6a3d7 Use decodebase64 (#295)
* avoid atob directly

* prevent port names to be selected

* updated pxt
2018-01-31 18:10:15 -08:00
08f79c5a1a 0.0.82 2018-01-31 15:39:03 -08:00
f817912e07 bump pxt 2018-01-31 15:38:51 -08:00
603932c2b6 0.0.81 2018-01-31 14:21:45 -08:00
a0907e7229 fixing button down issues on touch/mouse (#294) 2018-01-31 14:21:17 -08:00
635d4a7624 Fixing race condition of button animation (#292) 2018-01-31 11:48:53 -08:00
69d3938d85 0.0.80 2018-01-31 10:04:55 -08:00
f08f9105ba Clean generated files (#289)
* clean generated files

* updating gitingore to drop generated files

* updated package lock
2018-01-31 10:04:40 -08:00
7228cbe1cb updated logo 2018-01-31 09:04:52 -08:00
1ea0a0172a adding highcontrast logo 2018-01-31 08:53:21 -08:00
d548dfb578 moving print ports to examples (#288) 2018-01-31 08:44:58 -08:00
a52ce112dc adding high contrast lego logo 2018-01-31 08:44:35 -08:00
ea956f1a73 Buttons rename (#287)
* renaming up/down/click to released/pressed/bump

* missing images

* fixing signature issue

* updated strings

* white lego logo
2018-01-31 08:28:00 -08:00
ba1b9a54b4 0.0.79 2018-01-30 22:41:37 -08:00
59e39fa76d fixing field width 2018-01-30 22:41:18 -08:00
9187c47e09 0.0.78 2018-01-30 22:22:44 -08:00
fcf91caeb4 Zoom screen (#285)
* always start with full brick layout

* adding 'on start' to template

* render entire board when selected

* zoom brick when clicking on screen

* resize when zooming

* toggle zooming of the brick

* inject close icon when selected

* fix toggling
2018-01-30 22:22:21 -08:00
822227eb48 Brick ref topics 02 (#283)
* Add brick button topics

* Add the rest of the brick api
2018-01-30 20:58:18 -08:00
8a331648d6 Field editor fixes in Firefox (#284)
* fixing speed field picker

* switching to open sans

* alignment-baseline not support in FF
2018-01-30 20:40:41 -08:00
4f70d341e4 Start on the 'brick' api topics (#280)
* Start on the 'brick' api topics

* Add the delay to clear screen example

* Better output for clearsceen example
2018-01-30 17:02:22 -08:00
e06659ab4c removing group icons (#282) 2018-01-30 16:40:08 -08:00
437c36b983 0.0.77 2018-01-30 16:16:07 -08:00
3d73f193a8 fix for #260 (#279) 2018-01-30 16:14:54 -08:00
a71dee2923 rebuild for sampling (#261)
* rebuild for sampling

* bump pxt
2018-01-30 16:01:12 -08:00
9ef5b8d4ad 0.0.76 2018-01-30 11:05:29 -08:00
8aa47f3d1e updated chassis (#250) 2018-01-30 08:49:10 -08:00
02b0716043 0.0.75 2018-01-30 08:28:12 -08:00
188d5b3aa7 threshold query api 2018-01-30 08:27:23 -08:00
16c67f0e30 Refactoring datalog in common packages (#249)
* using datalog from common packages

* upgrading common package link

* updated block signatures

* more docs
2018-01-29 19:46:54 -08:00
104185a41e 0.0.74 2018-01-29 15:21:37 -08:00
73363d11b2 Download dialog (#248)
* download dialog

* updated pxt reference

* typo
2018-01-29 15:21:15 -08:00
61996acdd9 0.0.73 2018-01-29 13:26:46 -08:00
21deb45728 fixing release fiber 2018-01-29 13:26:31 -08:00
34578d2370 0.0.72 2018-01-29 11:20:46 -08:00
3f50b5c39a updated pxt references + hero banner 2018-01-29 11:20:34 -08:00
d371225066 0.0.71 2018-01-23 14:53:09 -08:00
387effbdd0 upgraded to run in parallel 2018-01-23 14:52:41 -08:00
18480080e7 updated tutorial format 2018-01-19 15:42:23 -08:00
bf6a932e5f Color calibration (#245)
* better handling of thresholds, color calibration strategy

* updating calibration parameters
2018-01-19 13:11:11 -08:00
23bb316403 settle robot once brake is applied 2018-01-18 21:28:00 -08:00
138de504e5 minor high contrast fixes 2018-01-18 21:03:57 -08:00
df13e40a45 fixing make it move 2018-01-18 16:47:00 -08:00
511ea2374b fixing summary 2018-01-18 16:44:57 -08:00
db4ed6daf3 fixing a bunch of snippets 2018-01-18 16:43:16 -08:00
a60427e2cf using audio context manager function (#243)
* using audio context manager function

* updated pxt reference

* trigger build
2018-01-18 13:53:33 -08:00
ef5b4172e8 missing file logo 2018-01-18 12:42:11 -08:00
7baf7cfede 0.0.70 2018-01-18 12:13:17 -08:00
efd6718ea3 converted lesson to tutorial 2018-01-18 12:09:43 -08:00
057a1d66dc PID support (#242)
* updated block definitions

* updated dependency on common packages
2018-01-18 10:34:06 -08:00
5ddfcd5508 Prototype lesson 'Make it Move" (#241)
* Prototype lesson 'Make it Move"

* Wrong blockq type
2018-01-17 19:45:07 -08:00
00f0922189 Merge pull request #240 from Microsoft/line-detect-lesson
Prototype lesson for 'Line Detection'
2018-01-17 19:07:29 -08:00
41f4b64087 Add to gallerys 2018-01-17 18:52:49 -08:00
ea5ee1c007 Prototype lesson for 'Line Detection' 2018-01-17 17:02:11 -08:00
603e4c0fc1 0.0.69 2018-01-16 17:06:52 -08:00
e50c88008a updated gyrobox 2018-01-16 17:05:57 -08:00
f057964a50 pausing until sound is done in mood 2018-01-16 16:44:32 -08:00
2eda2061cf updated modified gyro boy 2018-01-16 16:26:49 -08:00
a4ebf4c746 moving moods in separate namespace 2018-01-16 16:21:02 -08:00
f1880897d4 0.0.68 2018-01-16 16:08:53 -08:00
ad2e82060d removing BrickLight blockIdenity notations 2018-01-16 15:59:40 -08:00
d1bb19e30e adding a mood block (image+sound+light) 2018-01-16 14:52:49 -08:00
280963d1eb 0.0.67 2018-01-15 23:58:31 -08:00
9fadf49b0e Support for multiple motors in "used" logic. (#238)
* handle registerion of dual / single motors

* updated puppy
2018-01-15 23:57:21 -08:00
3c2be25384 some core set adapted codes 2018-01-15 21:27:19 -08:00
e1f623a94d Added description to timers 2018-01-15 03:41:14 -08:00
cb5f9648f5 fixed sound name 2018-01-14 19:49:40 -08:00
9158cfe4f6 0.0.66 2018-01-13 08:31:38 -08:00
0b763978f2 gyro boy improvements (#236)
gyro boy improvements
2018-01-13 08:31:10 -08:00
25fded6afb 0.0.65 2018-01-13 00:02:01 -08:00
fc6fb0811f Timers (#235)
* adding timer support

* updates strings
2018-01-13 00:00:55 -08:00
49bedcbcc5 0.0.64 2018-01-12 16:12:02 -08:00
32876f4584 Merge pull request #234 from Microsoft/largemotorview
Fix large motor SVG hole
2018-01-12 13:51:00 -08:00
da9bea30b5 Update large motor view SVG so that the drop shadow is outside the hole SVG 2018-01-12 13:50:09 -08:00
d0aa68aeee 0.0.63 2018-01-12 13:33:45 -08:00
51731fbbc9 bump pxt-common-packages to 0.15.5, 2018-01-12 13:33:40 -08:00
751ea1494b motor slider fixes and fix motor output in vm 2018-01-12 13:33:25 -08:00
dfe84471e8 Merge pull request #144 from Microsoft/motorslider
Add motor slider control
2018-01-12 13:04:45 -08:00
0f3de6cf07 0.0.62 2018-01-11 22:56:34 -08:00
21195e4abf Datalog (#233)
* support for custom csv separator

* simple datalog frameowrk

* api strings

* hide setfile

* storage fixes

* log seconds, not milliseconds
2018-01-11 22:53:28 -08:00
c992100a38 added option to append CSV headers 2018-01-11 21:36:43 -08:00
20a4673f98 First draft of storage APIs (#122)
* First draft of storage APIs

* bumped pxt-core

* using fixed instances to seprate temp from permanent

* send console to storage

* sim support

* missing sim stubs

* adding storage blocks

* more sim support

* remove storage from default package

* fix rendering of ms

* render raw ms

* slize at better place

* duplicate bundled dir

* refactor limit

* simplify limit logic
2018-01-11 20:05:45 -08:00
966fd81870 0.0.61 2018-01-11 14:08:14 -08:00
cb9d2aeb39 bumping pxt dependency 2018-01-11 14:08:01 -08:00
3cee55f4c2 0.0.60 2018-01-11 13:43:41 -08:00
3815d2fd3b simplifiying brick light api (#231) 2018-01-11 13:43:11 -08:00
1453b7e0a3 gyro reset fix 2018-01-11 11:17:23 -08:00
6fb5c54280 fix build break 2018-01-11 08:55:31 -08:00
9d5ca35e83 fix battery encoding 2018-01-11 08:47:09 -08:00
893dd0f9c4 rename "enter..." to "button enter" 2018-01-11 08:28:25 -08:00
c3419c0b74 support for unregulated motors (#227) 2018-01-10 23:34:27 -08:00
a4164470d8 updated api to align with labview 2018-01-10 22:29:35 -08:00
0dd5ab9bde appliying manual speed 2018-01-10 14:08:50 -08:00
e93e659e8a nit: remove unnecessary comment 2018-01-10 13:51:35 -08:00
8357372fb5 Update to make it more like a crank 2018-01-10 13:47:39 -08:00
54cb076002 Merge pull request #226 from Microsoft/legoavatar
Add lego avatar
2018-01-10 13:03:15 -08:00
dbd3eb464b Add lego avatar 2018-01-10 12:59:53 -08:00
10cd39a4ec Merge branch 'master' into motorslider 2018-01-10 12:52:51 -08:00
fddc4e647a 0.0.59 2018-01-10 12:52:48 -08:00
798a351f15 updated package lock 2018-01-10 12:52:36 -08:00
e61dffff03 fixing threshold 2018-01-10 11:45:08 -08:00
b9f5096480 pause until motor measured move is done 2018-01-10 11:29:27 -08:00
9912d68c8b fixing chassis 2018-01-10 11:14:25 -08:00
951b9be6e4 fixing motors 2018-01-10 11:14:18 -08:00
aa8635c4e7 Always use the motor slider control 2018-01-10 10:00:48 -08:00
4e4f5495da Merge branch 'master' into motorslider 2018-01-10 09:56:59 -08:00
f64bf57000 Merge master 2018-01-10 09:56:32 -08:00
f1242724b5 Fix legofont icons 2018-01-10 09:55:58 -08:00
cd0c9df86e bump to 3.0.8 2018-01-10 08:58:54 -08:00
337d42287a 0.0.58 2018-01-09 22:14:43 -08:00
ce3383f1b7 Turn ratio field editor (#225)
* Turn ratio field editor (initial draft)

* Add field turn ratio editor

* Fix arrow rotation

* Fix left and right direction, remove unnecessary SVG circles.

* Update UI a little. add marker.

* updated math for turnratio angle

* slightly cuter

* cleanup

* consistent naming

* more cleanup

* fixing motor node issue

* updated package version
2018-01-09 22:05:26 -08:00
e51721303a Merge pull request #224 from Microsoft/fixportlabels
Fix port labels in the simulator.
2018-01-09 14:43:26 -08:00
50f6c77fdb Fix port labels in the simulator. Fixes #219 2018-01-09 14:43:01 -08:00
5ed0135124 cleaning up images (#223)
* cleaning up images

* extra comma
2018-01-09 12:51:44 -08:00
892a2d585f Thresholds (#222)
* add threshold blocks

* updated strings

* added gap

* reorg color/gyro blocks

* fixing sound names

* adding stop block

* fixing exanmples
2018-01-09 12:46:48 -08:00
9890f2340a Add no-drag class and set on synced motor labels. Fixes #213 (#221) 2018-01-09 12:04:37 -08:00
109b809909 Sort field port values. Fixes #212 (#220) 2018-01-09 12:01:42 -08:00
9cbf5efd7e 0.0.57 2018-01-08 22:01:11 -08:00
a27a7fcd55 removing measured overloads until blocks support (#215) 2018-01-08 15:27:37 -08:00
85263fb84d Merge branch 'master' of https://github.com/Microsoft/pxt-ev3 2018-01-08 15:13:20 -08:00
b5ad898c9e Screentweak (#214)
* adding pid

* hiding functions

* precision of value
2018-01-08 15:00:00 -08:00
456df3c442 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-01-08 14:43:19 -08:00
1552eb05b4 matter most info 2018-01-08 14:43:15 -08:00
d60e2c4a7d adding pid 2018-01-08 14:36:34 -08:00
f4b78c3ee7 PID example 2018-01-08 14:06:39 -08:00
dd5e1957d5 fix coding page 2018-01-08 14:06:29 -08:00
d61a63f70a avoid overlaps in port view 2018-01-08 09:08:59 -08:00
4207bd06c0 removing microbit font 2018-01-08 08:53:03 -08:00
58763e398b 0.0.56 2018-01-07 23:39:04 -08:00
f77bf165eb updates strings 2018-01-07 20:51:48 -08:00
4880d9ea5b Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-01-07 20:45:56 -08:00
ab4fb019f9 more changes to "print" 2018-01-07 20:45:48 -08:00
2c2df31ba3 Merge pull request #205 from Microsoft/motorshuffle
shuffling motor blocks
2018-01-07 20:34:20 -08:00
0f2bda2496 shuffling motor blocks 2018-01-07 20:33:02 -08:00
44386be3c7 Merge pull request #185 from Microsoft/printlineinverted
invert arguments in print line
2018-01-07 12:14:16 -08:00
89ca66b8a9 Merge pull request #201 from Microsoft/speedfield
Add a speed field editor
2018-01-07 12:11:40 -08:00
64389a7689 more annotations 2018-01-07 10:06:02 -08:00
f77778ef85 Merge branch 'master' into speedfield 2018-01-07 09:59:11 -08:00
7d01823caf remove stopAllMotors on escape key 2018-01-07 09:58:08 -08:00
b3f9a4c92f Make sure we stop motors on exit (#199) 2018-01-07 07:54:40 -08:00
7fe8580de8 Add brick buttons field editor (#202)
* Add brick buttons field editor

* add hover title text
2018-01-07 07:52:07 -08:00
c70d6fe01a Remove unnecessary extra 'light' text in block pauseUntilLight (#203) 2018-01-07 00:12:29 -08:00
ed7099cc97 more square shaped corners 2018-01-06 21:00:39 -08:00
a79704fecc Decompilation and minor PR feedback 2018-01-06 17:16:08 -08:00
6a1b560101 Fix default 2018-01-06 14:40:09 -08:00
5e21f9ab6d Add a speed field editor 2018-01-06 14:25:50 -08:00
74648bd1df Merge pull request #198 from Microsoft/moresquarecorners
More square shaped corners on blocks
2018-01-06 12:55:51 -08:00
e24d4d56b1 More square shaped corners on blocks (toggle rect and arrow corner) 2018-01-06 00:12:32 -08:00
0345277bef 0.0.55 2018-01-06 00:00:40 -08:00
9ae6482f28 fixing isReady query on motors (#197) 2018-01-06 00:00:04 -08:00
77fb64043d stop all motors when pressing escape 2018-01-05 22:56:11 -08:00
f875681661 added roaming 2018-01-05 22:04:18 -08:00
fbb1fa688d fixing gallery 2018-01-05 21:50:50 -08:00
485f02ed27 cruise control activities 2018-01-05 21:49:04 -08:00
81f406c6cc ignition activities 2018-01-05 21:40:11 -08:00
ac0a7b326f 0.0.54 2018-01-05 21:30:05 -08:00
c814728354 pdated ultrasonic default 2018-01-05 21:29:52 -08:00
abeb378b17 reverse beeper 2018-01-05 21:20:00 -08:00
6928f9e50e traffic lights activity 2018-01-05 19:28:24 -08:00
931987468a light the way activities 2018-01-05 19:14:55 -08:00
94c4e508fe reversing the robot 2018-01-05 18:36:20 -08:00
ea46f1cbc7 3 activies from curriculum (#194)
* 3 activies from curriculum

* fixing style
2018-01-05 18:24:23 -08:00
9f9ce29476 Merge branch 'master' of https://github.com/Microsoft/pxt-ev3 2018-01-05 17:35:47 -08:00
50f6b04ed4 Re-implement Math.sign so it works on IE 11 (not supported). Square shaped corners for Flyout 2018-01-05 17:35:25 -08:00
64d6c2b090 Motors cleanup (#192)
* refactoring

* moving chassis into separate project

* added set motors
2018-01-05 16:02:52 -08:00
76ff39605a Remove synced motor label when motors are no longer in sync (#189) 2018-01-05 10:54:42 -08:00
2d3ea5631a Merge pull request #190 from Microsoft/consoleicon
Add console icon and set color.
2018-01-05 10:38:52 -08:00
e938f354fd Add console icon and set color. Fixes #152 2018-01-05 10:38:26 -08:00
886464b470 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-01-05 08:47:26 -08:00
b9ff9d21f1 bump common packages 2018-01-05 08:47:22 -08:00
aa06fd344a store synched motor info always (#187) 2018-01-05 08:40:49 -08:00
dc6ce0efc7 0.0.53 2018-01-05 08:39:30 -08:00
4039a85bc9 Make sure the ESC button always stops the program 2018-01-05 16:17:33 +00:00
7bd6280292 Disable HID deploy from command line (seems broken; was crashing until my previous checkin) 2018-01-05 16:17:20 +00:00
2ebe96e563 Fix command line deploy 2018-01-05 15:33:09 +00:00
a9be582f90 gyro calibration done right (#186) 2018-01-04 23:21:19 -08:00
ac428a3936 invert arguments in print line 2018-01-04 22:13:17 -08:00
de91dc6ab7 Handle the case where multiple motors or multiple sensors are connected to the same port. (#181) 2018-01-04 21:57:01 -08:00
1e460eef9e basic reading of battery level (#182) 2018-01-04 21:50:13 -08:00
0db6987ee5 Add loader and animation (#180) 2018-01-04 16:17:14 -08:00
148657908c Merge pull request #179 from Microsoft/syncedmotorui
Synced motors label (in simulator)
2018-01-04 14:38:29 -08:00
f3f87331c8 nit 2018-01-04 14:09:10 -08:00
5aef77ccc6 Generalizing motorView for both medium and large motor views. Initial work towards synced motor views. Adding sync label for controller motor. 2018-01-04 14:03:50 -08:00
59ca9cf463 0.0.52 2018-01-04 13:04:23 -08:00
7da811246c Behaviors Driven Robotics (#178)
* adding avoid crash behavior

* more implementation

* add another simple behavior

* fixed synched motors

* bump common packages
2018-01-04 12:55:30 -08:00
69f8453947 Merge pull request #177 from Microsoft/sounds_bug_fix
Fix stopAllSounds simulator bug
2018-01-04 12:52:17 -08:00
39ba9b81af Initial work 2018-01-04 12:20:31 -08:00
51a14596cd 0.0.51 2018-01-04 11:41:49 -08:00
8518c446cd Merge pull request #176 from Microsoft/iefonticons
Fix font icons on IE, and add package icon on Windows
2018-01-04 11:40:42 -08:00
2f69df0d9d Fix font icons on IE, and add package icon on Windows 2018-01-04 11:39:20 -08:00
1789d0ce21 Lowercase menubar titles. 2018-01-04 10:42:37 -08:00
d0809510c4 Merge pull request #174 from Microsoft/addbetatag
Add beta tag.
2018-01-04 10:14:43 -08:00
6b9c0eaf65 Add beta tag. #150 2018-01-04 10:14:11 -08:00
52bdf94233 Merge pull request #173 from Microsoft/blockiconfont
Add block icon font
2018-01-04 09:57:11 -08:00
fd50ed8f7c Add block icon font 2018-01-04 09:52:12 -08:00
ba0eb93b0f use common packages tests implementation (#171) 2018-01-04 09:23:28 -08:00
9a4ed45797 0.0.50 2018-01-04 09:19:33 -08:00
820fdf3a3c Merge pull request #172 from Microsoft/fixwinicons
Fix check and cancel icons on windows
2018-01-04 09:18:30 -08:00
348d5ffc26 Fix check and cancel icons on windows 2018-01-04 09:17:30 -08:00
95e47a0b25 Merge pull request #169 from Microsoft/screenimgeditor
Initial screen field editor.
2018-01-04 08:37:56 -08:00
c3312ed5d1 Merge pull request #170 from Microsoft/clearcounts
moving motor blocks around
2018-01-04 08:37:39 -08:00
b7cdc7d0fe moving blocks around 2018-01-04 08:25:02 -08:00
dde5a35cd9 Initial screen field editor. Adding Lego designer assets to legoresources 2018-01-03 17:20:35 -08:00
be398d84ee Merge pull request #135 from Microsoft/field_ports
Add an output port field editor
2018-01-03 17:07:34 -08:00
4445acce7a Split editor extensions into multiple module loaded files. Re-using editor/deploy.ts for cmds. Fixing field ports 2018-01-03 16:18:39 -08:00
d6d8b0655b Merge branch 'master' into field_ports 2018-01-03 15:12:35 -08:00
216aa1ddaf Fix save icon 2018-01-03 15:07:45 -08:00
783a561941 0.0.49 2018-01-03 15:02:35 -08:00
c916664ae7 Fix download and save icons. 2018-01-03 15:02:24 -08:00
4b836ede1b Merge pull request #167 from Microsoft/blockfixes
Block layout fixes.
2018-01-03 14:22:18 -08:00
52fdaeec99 remove colon from print line block 2018-01-03 14:22:00 -08:00
2aaa45e10d Merge pull request #168 from Microsoft/remainingiconfixes
Remaining icon fixes.
2018-01-03 14:21:04 -08:00
7993363e89 Remaining icon fixes. Using blockIcons to show custom icons for built in categories 2018-01-03 14:20:33 -08:00
4d671f6cb0 Block layout fixes. Fixes to screen blocks. Adding print line API. 2018-01-03 14:00:08 -08:00
cc020d5a81 Merge pull request #124 from Microsoft/icon_font
Icon font
2018-01-03 12:35:52 -08:00
5c39862a44 Fix the rest of the icons (sensors, math, variables and extensions) 2018-01-03 12:35:33 -08:00
e0e5c95989 Merge branch 'master' into icon_font 2018-01-03 11:56:28 -08:00
800b4ad224 Merge pull request #165 from Microsoft/fixnullrefthis
Fix null ref for this when _update is called.
2018-01-03 11:42:38 -08:00
40c3b4b0cf Tweaking sensor icon 2018-01-03 11:36:43 -08:00
64bdc35e6f Merge paths for sensor icon 2018-01-03 11:29:49 -08:00
2b5f702bb6 Fix null ref for this when _update is called. 2018-01-03 11:20:37 -08:00
1c81ecd23f send ports data to console 2018-01-03 08:24:54 -08:00
4d223374b5 Differential drive (#164)
* clear sync speed cmd

* differential drive model

* use cm/s

* fixed aggressive clearing of motor sync command

* better computation of turn artio

* improved robot dimensions

* moving block up

* hanbdle infinite case

* correct handling of inifinte time/step

* better stop handling
2018-01-03 00:27:05 -08:00
dd9cf9014f Merge pull request #163 from Microsoft/fixnullderefbuttons
Fix null dereferencing issue for buttons
2018-01-02 23:19:55 -08:00
eb11d7926c Fix null dereferencing issue for buttons 2018-01-02 23:18:54 -08:00
609740dc48 Merge pull request #162 from Microsoft/moresensorfixes
Better fix for null dereferencing issue.
2018-01-02 22:51:45 -08:00
955a2c9757 Better fix for null dereferencing issue. Fix initial Color sensor mode (default). 2018-01-02 22:51:12 -08:00
02838e6c30 Merge pull request #161 from Microsoft/colorgridfixes
Update Color sensor control (colorGrid) to match spec
2018-01-02 22:30:04 -08:00
b0c54e84e6 Update Color sensor control (colorGrid) to match spec 2018-01-02 22:29:12 -08:00
b6644b7a23 Merge pull request #160 from Microsoft/sensorfixes
Sensor fixes. Fix race condition
2018-01-02 22:23:14 -08:00
3c4c38eb59 Fix null dereferencing issue. Fix sensor mode changed not clearing cached control. 2018-01-02 22:22:14 -08:00
29aba7b10b Fix advanced icons 2018-01-02 17:30:19 -08:00
7427142243 Merge branch 'icon_font' of https://github.com/Microsoft/pxt-ev3 into icon_font 2018-01-02 17:17:13 -08:00
436500babb Merge 2018-01-02 17:11:24 -08:00
82be4e344b More work 2018-01-02 17:07:36 -08:00
81bfca4ed6 0.0.48 2018-01-02 16:20:30 -08:00
c35dbdd38f Motor sync support in simulator (#159)
* parse sync motor command

* better sim support

* sync support

* fixing tank
2018-01-02 16:20:00 -08:00
1bc93013e6 0.0.47 2018-01-02 14:51:00 -08:00
58148eb1c3 Square shaped corners for Blockly blocks and dropdowns. (#158) 2018-01-02 13:32:07 -08:00
a7c62b45b2 Use legoIcons font for flyout headings 2018-01-02 13:01:28 -08:00
bd765d49ee Add lego resources.AI 2018-01-02 12:59:48 -08:00
383ca5467d Remove advexpanded/advcollapsed 2018-01-02 12:49:25 -08:00
e240e3b394 Check, cancel 2018-01-02 10:47:04 -08:00
7affbf8cb6 Save, download 2018-01-02 10:47:04 -08:00
4dff282633 Initial work 2018-01-02 10:47:04 -08:00
5d470fdcef Merge pull request #143 from Microsoft/persistselected
Persist selected state of controls across simulator restarts
2017-12-29 14:02:50 -08:00
16b9a5027d Add rotate icons 2017-12-29 11:39:06 -08:00
cbe68b3199 Add motor slider control 2017-12-28 13:23:30 -08:00
f30eac41e9 Persist selected state of controls across simulator restarts 2017-12-28 11:17:18 -08:00
d7f46c0fb5 Hide screen picker properly from typescript 2017-12-28 11:15:53 -08:00
58384017f2 0.0.46 2017-12-28 09:08:27 -08:00
01f7fe633c Motorworks2 (#141)
* fixing polarity

* allocate motor on motorUsed only

* perform sub-step integration step for better precision
2017-12-28 09:07:57 -08:00
a9a9a89811 Better fonts and better alignment of motor reporter control 2017-12-27 20:43:39 -08:00
7e2251d8ac Fix negative motor reporting 2017-12-27 20:35:36 -08:00
1903a6e347 Merge pull request #140 from Microsoft/motorreporters
Add motor reporter control
2017-12-27 20:32:53 -08:00
2fb75a2d83 Added todo 2017-12-27 17:07:50 -08:00
0da175a8cd Add motor reporter control 2017-12-27 17:06:23 -08:00
f01370e4fd Simulator support for motor commands (#137)
* support for "step" functions

* locale files

* enum issue

* fixing decoding of array

* implement clear count

* log unknown commands
2017-12-27 17:05:15 -08:00
751df2fe8c Merge pull request #139 from Microsoft/colorandsliderresizefixes
Fix resizing in controls to work for all sizes including full screen
2017-12-27 16:31:20 -08:00
8be4bb11d8 Fix resizing in controls to work for all sizes including full screen 2017-12-27 16:30:42 -08:00
342e714ae2 Merge pull request #138 from Microsoft/updatemotorassets
Update motor SVG assets and connections
2017-12-27 14:48:50 -08:00
fb31b81f7e Update motor SVG assets and connections 2017-12-27 14:48:15 -08:00
8204995749 Fix wire view to match spec size of wires. 2017-12-26 23:28:29 -08:00
85c14bb05a Fix rotation and distance slider update state 2017-12-26 23:23:26 -08:00
c398a5a133 Update padding and fix wiring order 2017-12-26 23:19:04 -08:00
a1b059171b Add a output port field editor 2017-12-24 17:46:58 -08:00
afaedaa0b2 Merge pull request #134 from Microsoft/fixflickering
Fix resizing flickering issue in the simulator
2017-12-24 16:19:36 -08:00
0aa41e9a64 Fix resizing flickering issue, remove flip animation on start, remove the need for a default height and width in the layout engine 2017-12-24 11:59:01 -08:00
88df2e14cb Merge pull request #125 from Microsoft/sim_refactor_resize
Refactor sim for better resizing and support for multiple controls to be open
2017-12-22 14:01:35 -08:00
180f32f25c Simulator refactoring to support better resizing of modules and controls 2017-12-22 14:00:23 -08:00
995527675a Check, cancel 2017-12-21 11:30:32 -08:00
84eb849bc7 Save, download 2017-12-21 11:10:47 -08:00
5e0e35b4bd Initial work 2017-12-21 11:00:54 -08:00
300a2c1476 Merge pull request #123 from Microsoft/gradient_circle
Gradient circle
2017-12-20 16:34:59 -08:00
703bd01931 Increase stroke width 2017-12-20 16:25:26 -08:00
75a65eeab2 Add lego icons 2017-12-20 16:16:13 -08:00
38a9f153f7 pxtarget 2017-12-20 15:15:12 -08:00
3c5dae8c7b Small changes 2017-12-20 15:11:44 -08:00
85345969d3 Initial work 2017-12-20 14:58:41 -08:00
ac1e5d2846 Remove constant resize 2017-12-19 21:20:06 -08:00
11b4bbc07e Fix controls 2017-12-19 17:20:01 -08:00
7f5b8aed99 more tweaking of angle encoding 2017-12-19 17:15:53 -08:00
c989e2fdab Merge pull request #121 from Microsoft/motorphysics
Motor work
2017-12-19 17:07:15 -08:00
d3dcb5de85 Use setChangedState for touch and color sensors 2017-12-19 17:01:45 -08:00
9cca35d49f encoding 32bit angle into data buffer 2017-12-19 16:54:44 -08:00
7123bfecd3 removing cancel animation stuff 2017-12-19 16:21:14 -08:00
c8ac770983 read motor state into lms_motor 2017-12-19 16:18:17 -08:00
aa031036ee updating motor state in game loop 2017-12-19 16:03:26 -08:00
a7d002d949 0.0.45 2017-12-19 15:10:32 -08:00
93fd8c8c78 removing more icons 2017-12-19 15:10:13 -08:00
1765ca2d35 Merge pull request #116 from Microsoft/revert_screenopt
Use game loop instead of animation queue
2017-12-19 14:58:37 -08:00
1ab7ae6cfa minor PR feedback 2017-12-19 14:57:28 -08:00
3acf4e9ac5 More hardware tests (#119) 2017-12-19 14:55:48 -08:00
ef5fa9ae82 Minor fix to killing the animation when the sim is killed 2017-12-19 14:55:43 -08:00
e1f7a5b8cf Merge pull request #118 from Microsoft/ambient_light_threshold
Set high/low to 20/5 for ambient light mode
2017-12-19 14:42:54 -08:00
2c73bfc813 Set high/low to 20/5 2017-12-19 14:40:30 -08:00
d78d9c8686 basic ports view (#115)
* basic ports view

* slight adjustement of rendering
2017-12-19 14:26:57 -08:00
2157af3e63 Using game loop instead of queueAnimationUpdate 2017-12-19 14:20:35 -08:00
eac3e183c3 better test support 2017-12-19 13:10:40 -08:00
785ddff706 Reverting screen optimization to use SetInterval and didChange 2017-12-19 12:53:12 -08:00
e07d6e3a31 0.0.44 2017-12-19 11:53:50 -08:00
763ad3f763 0.0.43 2017-12-19 11:38:02 -08:00
919a03951c Removing icons (#114)
* removing icons

* added "pause for light"
2017-12-19 11:37:33 -08:00
9e427898ae added test framework (#113)
* added test framework

* added toString on motors

* enabling logs
2017-12-19 07:07:50 -08:00
60bf3a17d3 a mini-console support with scroll up / down (#112)
* a mini-console support with scroll up / down

* fix compile error
2017-12-18 22:36:32 -08:00
0529759a80 Fix ultrasonic value to use cm instead of 0.1 cm units (#110)
* Fix simulator

* use 250 instead of 255
2017-12-18 20:30:56 -08:00
b07f157181 0.0.42 2017-12-18 18:24:46 -08:00
2f5f7d4133 Merge pull request #111 from Microsoft/scale_screen
Add tiny padding around the screen for the canvas.
2017-12-18 17:08:02 -08:00
e6e1dce59f Add tiny padding around the screen for the canvas. 2017-12-18 17:07:23 -08:00
43a9d03231 fixing pauseUntilReady signature 2017-12-18 14:45:44 -08:00
c0f6cd3651 test passing on hw 2017-12-18 14:31:17 -08:00
f1445c6e89 Motor pause until ready (#108)
* adding command to pause until ready

* adding console API

* adding ready support for motors

* fix time output scale

* fixing angle
2017-12-18 14:13:38 -08:00
04275ee35c 0.0.41 2017-12-18 13:22:13 -08:00
f8d0594eca Merge pull request #107 from Microsoft/initial_sim
Initial sim implementation
2017-12-18 13:21:48 -08:00
5be3b31e00 Merge branch 'master' into initial_sim 2017-12-18 13:21:35 -08:00
84c1079e50 Fix Safari bug. 2017-12-18 13:19:49 -08:00
6320379d02 Initial sim implementation 2017-12-18 13:04:17 -08:00
b166f6034e storing test 2017-12-18 09:43:44 -08:00
d07f672b28 fixing single motor set speed 2017-12-18 09:17:19 -08:00
363e076f36 fixing motor compilation 2017-12-18 08:54:53 -08:00
8bf6f265f7 Merge pull request #105 from Microsoft/motorfixes
Motor fixes
2017-12-18 00:54:53 -08:00
217958aec3 fix polarity 2017-12-17 23:19:38 -08:00
367b1b0d1a properly setting multiple-motor options 2017-12-17 23:00:07 -08:00
6836852122 refactoring motors wiht base class (#104) 2017-12-17 22:47:13 -08:00
944098b9f9 Minor refactor fix (#102)
* Minor fix to a refactor of motor output this.brake to this._brake

* No (_this) in global context

* Minor fix
2017-12-17 21:12:18 -08:00
539cf3d73e 0.0.40 2017-12-15 14:30:51 -08:00
4b3e7cfb7d bump pxt-core to 3.0.2, bump pxt-common-packages to 0.14.13, 2017-12-15 14:30:43 -08:00
b144744509 Add tsconfig.json for easier library editing (#96) 2017-12-15 14:29:31 -08:00
e591bed6ad Add 'clear screen' block to brick category (#100) 2017-12-15 14:29:10 -08:00
6a4e64eac0 Merge pull request #79 from Microsoft/motorsync
Motor sync block
2017-12-15 14:28:03 -08:00
f7dd14ff7b Merge pull request #88 from Microsoft/even_more_sounds
Add 'stopAllSounds' block
2017-12-15 11:36:31 -08:00
bfd34cedd6 Update built files 2017-12-15 11:04:16 -08:00
8e1c075911 Merge pull request #98 from Microsoft/portFixes
Fix order of color and ultrasonic sensor ports.
2017-12-15 10:45:34 -08:00
a02f364a4c Update function names for consistency 2017-12-15 10:42:44 -08:00
48fee2c215 Merge pull request #99 from Microsoft/ui_changes
Some UI theming. square buttons
2017-12-15 08:55:45 -08:00
5780d1982c Some UI theming. square buttons 2017-12-15 08:55:21 -08:00
6fb08f0f7b Fix order of color and ultrasonic sensor ports. 2017-12-15 07:48:42 -08:00
13f8659b98 Merge pull request #97 from Microsoft/startup_delay
Startup delay for sensors to get values
2017-12-15 07:05:21 -08:00
edc9d17a8c Merge pull request #95 from Microsoft/serialnumber
Implement getSerialNumber (based on BT MAC)
2017-12-15 07:04:21 -08:00
c7a3f5bbd0 Delay user code by 100ms to get sensor reading (fixes #90) 2017-12-15 11:55:20 +00:00
41d5052583 Run sensor "change handler" also with the initial value 2017-12-15 11:54:53 +00:00
07ddec343a Formatting 2017-12-15 11:30:15 +00:00
5a9a5e997a Error reporting fixes 2017-12-15 11:29:18 +00:00
55b6549999 Implement getSerialNumber (based on BT MAC) 2017-12-15 11:25:23 +00:00
fcdc350e40 more motor work 2017-12-14 17:01:23 -08:00
9dedbeae1b updated parameters 2017-12-14 13:26:04 -08:00
124d8a0fd8 tank support 2017-12-14 13:25:27 -08:00
81fcbb6916 tweaks of blocks 2017-12-14 13:07:10 -08:00
d436bd1227 Fix simulator stop() method 2017-12-14 09:41:01 -08:00
cb648019bb Progress 2017-12-14 09:17:47 -08:00
11a88a9d94 updated signatures 2017-12-13 23:00:37 -08:00
92178f3371 bring back speed 2017-12-13 22:54:08 -08:00
3c86ae286f more work on motors 2017-12-13 22:40:40 -08:00
1b6d84a9b8 Merge branch 'master' into motorsync 2017-12-13 21:16:33 -08:00
2d81be3b24 Add 'stopAllSounds' block 2017-12-13 16:31:42 -08:00
14f57f54bf Merge pull request #87 from Microsoft/motor_fix_2
Motor data fix
2017-12-13 15:56:17 -08:00
e7c697c24d Merge pull request #85 from Microsoft/on_color_fix
Fix "on color detected" block
2017-12-13 15:55:47 -08:00
7ac63f038c Merge pull request #84 from Microsoft/fix_image_attrs
Adding block identity
2017-12-13 15:55:36 -08:00
557926d631 Merge pull request #78 from Microsoft/waitUntiltopauseUntil
renaming all "wait until" to "pause until"
2017-12-13 15:52:46 -08:00
da62d51615 Merge branch 'master' into motor_fix_2 2017-12-13 15:48:43 -08:00
3918857fcc Merge branch 'master' into on_color_fix 2017-12-13 15:48:24 -08:00
f1dcebdd88 Merge branch 'master' into fix_image_attrs 2017-12-13 15:48:09 -08:00
1d35c78737 Merge branch 'master' into motorsync 2017-12-13 15:47:52 -08:00
d17326ad7a Merge branch 'master' into waitUntiltopauseUntil 2017-12-13 15:47:27 -08:00
4948a88833 Merge pull request #83 from Microsoft/new_ts_cleanup
New ts cleanup
2017-12-13 15:46:58 -08:00
b73b924ec4 ignoreing docs errors 2017-12-13 15:35:53 -08:00
641d292c33 Clean commit for motor fix 2017-12-13 14:55:14 -08:00
223275fd65 Moving a line of code 2017-12-13 13:35:28 -08:00
6e42e816d3 Adding block identity 2017-12-13 10:42:49 -08:00
5678cf5df9 Fixing test file 2017-12-13 10:29:12 -08:00
67ec4accb9 Monitor memory usage and panic on over 8MB used 2017-12-13 15:28:52 +00:00
fa867c3a34 Cleanup 2017-12-12 15:24:36 -08:00
7865876e64 Merge branch 'master' into waitUntiltopauseUntil 2017-12-12 14:19:35 -08:00
113b42656c sync command working 2017-12-12 14:08:45 -08:00
7557380722 adding sync command 2017-12-12 13:20:25 -08:00
3e2a1ec9e1 missing strings files 2017-12-12 11:23:29 -08:00
09db613620 updated docs 2017-12-12 10:49:45 -08:00
bacb4673c9 renaming all "wait until" to "pause until" 2017-12-12 10:46:56 -08:00
e649a167cd Merge pull request #74 from Microsoft/powertospeed
some speed renamings
2017-12-11 23:20:17 -08:00
997e8efb20 Merge branch 'master' of https://github.com/Microsoft/pxt-ev3 2017-12-11 17:08:12 -08:00
1f380ce959 0.0.39 2017-12-11 17:00:06 -08:00
8cbf601131 0.0.38 2017-12-11 17:00:03 -08:00
bdbb2a8c2f Fix on start color 2017-12-11 16:58:29 -08:00
5e90cb4434 Merge pull request #75 from Microsoft/new_ts
Update to latest TS and update blocks colors to match Lego's edu colors
2017-12-11 16:55:25 -08:00
1bf1eb16f0 Update to latest TS and update blocks colors to match Lego's edu colors 2017-12-11 16:55:00 -08:00
fbc6fc30a7 some speed renamings 2017-12-11 16:07:46 -08:00
fee2329ca7 Merge branch 'master' of https://github.com/Microsoft/pxt-ev3 2017-12-08 11:23:07 -08:00
5656031e2d Merge pull request #73 from Microsoft/more_sounds
Limit sound concurrency to 1
2017-12-08 11:21:21 -08:00
e87e1767b5 Null check 2017-12-08 11:16:47 -08:00
2d7a108e79 Fix merge conflict 2017-12-07 16:28:30 -08:00
193f66fd2d Limit sound concurrency to 1 2017-12-07 16:27:28 -08:00
5768fcaf35 Merge branch 'master' of https://github.com/Microsoft/pxt-ev3 2017-12-07 13:58:38 -08:00
2c22ea925f Merge pull request #69 from Microsoft/sounds
Get rid of "play sound" blocks; add non-blocking "play sound effect"
2017-12-07 11:53:04 -08:00
4e4aa266d5 Limit sound concurrency 2017-12-07 11:27:29 -08:00
05bdbd7b40 icon resources 2017-12-07 08:33:13 -08:00
085ab0844b rename "power" to "set speed" for consistency 2017-12-06 22:41:51 -08:00
4ad229cb37 0.0.37 2017-12-06 22:35:03 -08:00
170ee33848 bump pxt-core to 2.3.37, 2017-12-06 22:34:52 -08:00
162e437527 using icons on drop downs 2017-12-06 22:34:11 -08:00
ab13cb9047 adding a few more icons 2017-12-06 21:40:00 -08:00
80454f55c7 0.0.36 2017-12-06 16:31:06 -08:00
30e576345b more icon updates 2017-12-06 16:29:21 -08:00
dfc4c83718 resizing svg to sqaures
updates some icons
2017-12-06 16:22:31 -08:00
e25d273765 LEGO resources 2017-12-06 15:57:40 -08:00
903e98ca22 Merge pull request #70 from Microsoft/nodefaultinfrared
removing infrared from default ev3 configuration
2017-12-05 11:15:17 -08:00
8a64085288 enable language/high contrast 2017-12-05 10:53:26 -08:00
22ab1cba8d removing infrared from default ev3 configuration 2017-12-05 10:49:48 -08:00
064d6f9411 Check if sound not defined 2017-12-04 12:24:41 -08:00
330aff8082 Restore 'play sound effect' name 2017-12-01 09:59:59 -08:00
0886a5d4e1 Merge branch 'master' of https://github.com/Microsoft/pxt-ev3 2017-11-30 15:54:11 -08:00
aa636aef96 Separate blocks for 'play sound' and 'play sound until done' 2017-11-30 15:49:50 -08:00
1865ced312 Merge pull request #67 from Microsoft/note_default
Default piano note should be 1046
2017-11-30 15:41:55 -08:00
b940befe85 Default piano note should be 1046 2017-11-30 12:44:22 -08:00
c6bae5e17b missed files 2017-11-30 11:28:20 -08:00
83e4898eab Merge pull request #66 from Microsoft/gyroproject
moving gyro into separate project
2017-11-30 10:47:13 -08:00
7bdb9683c9 fixing naming 2017-11-30 10:37:59 -08:00
3c675892aa moving gyro into separate project 2017-11-30 10:34:34 -08:00
3d29c5e323 0.0.35 2017-11-30 10:16:04 -08:00
15d59269d4 bump pxt-core to 2.3.31, 2017-11-30 10:15:54 -08:00
73b5e7dc3f Merge pull request #65 from Microsoft/ultrasonicsensor
Ultrasonic/IR sensor refactoring work
2017-11-30 10:14:30 -08:00
a92edcffee adding waitUntil to buttons 2017-11-30 10:05:00 -08:00
305a650125 using threshold detector 2017-11-30 09:59:28 -08:00
34a5aeb7d2 moving IR as well 2017-11-30 09:53:43 -08:00
32f524ddd8 fixing build 2017-11-30 09:48:43 -08:00
b690c1634b updated distance detection 2017-11-30 09:41:34 -08:00
8089841892 wait until 2017-11-30 09:39:24 -08:00
3d8c697586 moving into separate project 2017-11-30 09:38:04 -08:00
e365e3d1be Merge pull request #64 from Microsoft/color-sensor
Color sensor refactoring
2017-11-30 08:55:50 -08:00
4ed41adb6a avoid conflicts of event values 2017-11-30 08:31:31 -08:00
39b7f99741 update mode selection 2017-11-30 08:20:00 -08:00
ad17191ae2 collapse reflected/ambient blocks 2017-11-29 22:47:17 -08:00
4a8633f506 updated descriptions 2017-11-29 22:11:59 -08:00
3690f409b0 docs skeleton 2017-11-29 22:09:12 -08:00
97663d2b83 updated naming 2017-11-29 21:57:05 -08:00
4d2b7ced71 moving color sensor to separate project 2017-11-29 21:41:00 -08:00
5676103052 Merge pull request #63 from Microsoft/speedispower
use speed when setting power
2017-11-29 21:22:32 -08:00
cb8c14fbb1 Allow waitForEvent on main thread; fixes #60
also use target_panic() instead of assert
2017-11-29 19:54:17 -03:00
815d438d86 use speed when setting power 2017-11-29 00:04:54 -08:00
da8de1e31e Merge pull request #56 from Microsoft/note 2017-11-28 17:00:57 -08:00
b028916025 Increment pxt-core and pxt-common-packages dependencies 2017-11-28 16:48:16 -08:00
b9be74bad8 Merge pull request #59 from Microsoft/touch
adding touch button examples
2017-11-28 16:35:48 -08:00
7e502b1749 adding bare docs 2017-11-28 16:24:22 -08:00
f22edac84d moving touch stuff into separate projects 2017-11-28 16:11:15 -08:00
ef2807a84e Fill in real min and max 2017-11-28 16:04:25 -08:00
580b40876c fixing bumped 2017-11-28 16:02:04 -08:00
b57ae5d588 implement wasPressed 2017-11-28 15:33:43 -08:00
71479d0caa adding touch button examples 2017-11-28 15:23:54 -08:00
7e39cdde9d Add a todo 2017-11-27 17:21:32 -08:00
85ca6b3698 Support for new data structure 2017-11-27 14:12:04 -08:00
2c89848fda More 2017-11-21 17:11:11 -08:00
ed1c187514 Initial work 2017-11-21 11:35:53 -08:00
52816e6de7 Merge pull request #51 from Microsoft/debugging
Add debug function
2017-11-20 10:54:44 -08:00
60ac3a9d00 0.0.34 2017-11-18 07:37:59 -08:00
d2c7a5ace0 support for wait/when 2017-11-18 07:37:46 -08:00
79fcd1c01e 0.0.33 2017-11-18 07:34:50 -08:00
2d48725c63 bump pxt-core to 2.3.28, bump pxt-common-packages to 0.14.3, 2017-11-18 07:34:40 -08:00
802c3db0ba 0.0.32 2017-11-17 14:12:32 -08:00
4a7e8c5fa8 adding block for sounds 2017-11-16 23:28:44 -08:00
0ebffd8549 0.0.31 2017-11-16 22:55:51 -08:00
988a2b638b add icon 2017-11-16 22:52:29 -08:00
fb743dea74 Merge pull request #50 from Microsoft/icons
Icons in blocks
2017-11-16 22:48:35 -08:00
e400637ba1 Merge branch 'master' into icons 2017-11-16 22:47:40 -08:00
b2768b1099 added showimage 2017-11-16 22:46:51 -08:00
3a5885b28e 0.0.30 2017-11-16 22:25:36 -08:00
b602b52f7d bump pxt-core to 2.3.27, 2017-11-16 22:25:26 -08:00
90afb60cc4 bump pxt-core to 2.3.26, bump pxt-common-packages to 0.14.2, 2017-11-16 22:04:29 -08:00
c936c16c33 more icons 2017-11-16 22:03:43 -08:00
ead69e3c6e Add debug function 2017-11-16 16:28:10 -08:00
d100026d5c more icons 2017-11-16 13:05:50 -08:00
41c2899feb more icons 2017-11-16 13:03:15 -08:00
9437873427 more images 2017-11-16 12:58:37 -08:00
dab281a9cb including a few icons in block names 2017-11-16 12:41:47 -08:00
f27fb4d93c 0.0.29 2017-11-09 10:29:24 -08:00
11fb82eba9 Merge pull request #49 from Microsoft/updatepxt
Update pxt
2017-11-09 19:28:55 +01:00
170e6b700b updating to latest pxt 2017-11-09 10:24:12 -08:00
387ad763f8 bump pxt-core to 2.3.19, bump pxt-common-packages to 0.12.17, 2017-11-09 10:14:47 -08:00
0e61f162bb Fix style to match latest changes in master. 2017-10-31 11:27:18 -07:00
400f01a6be fixing duplicate block id 2017-10-31 09:42:53 -07:00
afcbe69c44 0.0.28 2017-10-31 09:04:27 -07:00
9165fe09fc bump pxt-core to 2.3.6, 2017-10-31 09:04:20 -07:00
08f36fbb94 Merge pull request #30 from Microsoft/jres
Import images and sounds from ev3 EDU
2017-10-31 16:48:24 +01:00
afca2aa4d1 Merge pull request #45 from Microsoft/motorsrename
API tinkering
2017-10-31 16:43:27 +01:00
3c6c766412 removing lego resources 2017-10-30 21:54:23 -07:00
329a1e15ea simplified IR API 2017-10-30 21:39:50 -07:00
16a025f3a0 simplified motor API 2017-10-30 21:29:18 -07:00
26b975b5f2 images 2017-10-30 14:51:14 -07:00
79b9bce904 Merge branch 'master' into jres 2017-10-30 13:29:45 -07:00
d3d9fa6ca0 Merge branch 'master' into jres 2017-10-30 13:29:16 -07:00
8f5c930f76 Update UI to latest. 2017-10-30 13:21:03 -07:00
a082807455 Fix locking in waitForEvent() and sample playing 2017-10-30 19:18:01 +00:00
3469f51b7b Don't need to use freshcoat branch of pxt (#31) 2017-10-30 19:06:49 +00:00
e8e31e6aa7 Fix brick.print() 2017-10-30 19:03:45 +00:00
2df90152fe Remove debug output 2017-10-30 18:56:03 +00:00
e25590539e Add sample-playing code 2017-10-30 18:55:23 +00:00
a7795302fc Make it compile with master 2017-10-30 18:54:53 +00:00
480d89ba8e Added swift stuff 2017-10-30 11:46:06 -07:00
9487d324fd added link to gitlab 2017-10-30 11:45:02 -07:00
bfc95e075e Merge branch 'master' into jres 2017-10-30 18:48:18 +01:00
7d4ba9b2b2 0.0.27 2017-10-30 10:47:03 -07:00
71b83040e6 bump pxt-core to 2.3.5, bump pxt-common-packages to 0.12.4, 2017-10-30 10:46:56 -07:00
1976534da0 Merge pull request #28 from Microsoft/sensorscat
Aligning categories with LabView/RobotC
2017-10-30 18:46:27 +01:00
ebbbe6e86c Add sounds (only simulator for now) 2017-10-30 17:25:58 +00:00
c4a9b4a381 updated brick color 2017-10-30 09:58:00 -07:00
c7d36a5e82 moving motors up 2017-10-30 09:55:36 -07:00
c8c45be057 fixing brick groups 2017-10-30 09:51:18 -07:00
a8a7267851 Add LEGO EDU images 2017-10-30 15:34:47 +00:00
9cdb4081fd Add PNG decompressor in SIM 2017-10-30 14:42:08 +00:00
dcb398d3d5 Rename Icon to Image 2017-10-30 13:28:01 +00:00
f6e350cf9f Add separate type for Icons (same repr as buffer) 2017-10-30 13:04:12 +00:00
c085094394 Add screen::unpackPNG() 2017-10-30 12:45:37 +00:00
7c2ea7c406 fixing more groups 2017-10-28 09:20:34 -07:00
84b98a2788 brick namespace 2017-10-28 09:13:02 -07:00
4e99cd3ef1 0.0.26 2017-10-27 19:23:01 +01:00
57647318c4 Sensor fixes 2017-10-27 19:18:56 +01:00
2720698864 Fix infinite loop 2017-10-27 19:18:47 +01:00
dfe2fe3cff brick refactoring 2017-10-27 11:05:04 -07:00
18fefa2a44 output -> motors 2017-10-27 11:01:11 -07:00
c0bab4877a Merge branch 'master' of github.com:Microsoft/pxt-ev3 2017-10-27 15:17:24 +01:00
d2a1d10ada Add converter from RGF to PNG 2017-10-27 15:17:21 +01:00
bcb68d937d Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2017-10-27 02:52:47 -07:00
05a8395028 stop all motors 2017-10-27 02:52:42 -07:00
3a1601a419 Add rsf2wav.js 2017-10-27 10:42:33 +01:00
712c2178d2 simplify motor API 2017-10-27 01:47:25 -07:00
12cdad72c8 added puppet 2017-10-27 00:13:51 -07:00
95076f8f24 differentiate large/medium motors 2017-10-27 00:09:00 -07:00
6391620373 added 2 more activities 2017-10-26 23:58:34 -07:00
86212e2153 added sound of color 2017-10-26 23:46:55 -07:00
98e430f3c1 added example of converted lesson 2017-10-26 22:19:16 -07:00
5c7e856e7b removed incorrect buy link 2017-10-26 21:57:48 -07:00
a47988913e 0.0.25 2017-10-26 21:27:51 -07:00
ea72dba6c7 Merge pull request #17 from Microsoft/irevents
Ultrasonic + IR events + Remote events
2017-10-27 06:25:02 +02:00
215e846a54 refactored remote button 2017-10-26 21:10:37 -07:00
21b34cb459 simplified events 2017-10-26 20:57:18 -07:00
282134f5dc refactoring IR 2017-10-26 20:51:13 -07:00
6b44352839 event for ultrasonic module 2017-10-26 20:38:17 -07:00
9a883d5672 Merge branch 'master' into irevents 2017-10-26 20:21:06 -07:00
59ce4338d3 renaming IR events 2017-10-26 20:20:24 -07:00
90560050b8 Merge pull request #16 from Microsoft/fonts
Mounting events on various sensors
2017-10-27 05:19:36 +02:00
2c72173bfe Use the _query() infrastructure for polling 2017-10-25 13:34:05 +02:00
1a5992408b added event for color changes 2017-10-24 23:10:27 -07:00
0e1a3b7e6b adding setpixel 2017-10-24 22:05:24 -07:00
ea6bfa03bd touched -> pressed 2017-10-24 21:55:37 -07:00
20d584db2b 0.0.24 2017-10-24 21:18:16 -07:00
0e4e0d8899 0.0.23 2017-10-24 21:09:56 -07:00
a18a690417 Merge pull request #12 from Microsoft/motors
Converting motors to fixed instances
2017-10-25 06:09:27 +02:00
c9d57c5e8d enabling banner 2017-10-24 21:08:02 -07:00
7e9d42a571 reset motors on start 2017-10-24 20:28:31 -07:00
1b51320edb pausing while running motor 2017-10-24 20:20:07 -07:00
4f44238237 use fixed instances for motors 2017-10-24 20:16:33 -07:00
c8ffa0ded7 fixed test 2017-10-24 18:49:15 -07:00
6b07d5f716 0.0.22 2017-10-24 18:48:30 -07:00
8784e23b60 fixed build link 2017-10-24 17:01:36 -07:00
4b8409fbc0 0.0.21 2017-10-24 16:56:52 -07:00
3237978cba Merge pull request #4 from Microsoft/blockupdate
Blocks update
2017-10-24 16:56:32 -07:00
33c8902050 aligning groups with hardware name components 2017-10-24 16:52:13 -07:00
fa6c81cf80 buttons -> brick buttons 2017-10-24 16:25:03 -07:00
46175fc7db separating touch sensor stuff 2017-10-24 15:58:47 -07:00
e6ef86101f more renaming 2017-10-24 15:37:48 -07:00
c4d3d7634e fixed naming of sonar 2017-10-24 15:35:42 -07:00
b0380fbef8 more annotations 2017-10-24 15:33:28 -07:00
c85c68ab68 fixing color / gyro 2017-10-24 15:22:07 -07:00
334d5aca9a on/off field editors on motors 2017-10-24 15:03:21 -07:00
1330a0fb82 fixed gyro def 2017-10-24 14:54:36 -07:00
005447ce44 4 times more sensors\! 2017-10-24 19:58:52 +01:00
60d5271de2 Merge branch 'master' into blockupdate 2017-10-24 10:02:27 -07:00
e3ab6ace55 0.0.20 2017-10-24 10:01:49 -07:00
5f4488dea7 Merge pull request #3 from Microsoft/pxtupdate
Updated to latest of pxt / common
2017-10-24 10:00:41 -07:00
07dc3bdae1 fixing docs compilation 2017-10-24 09:55:38 -07:00
5d5d78ced0 compiled strings 2017-10-24 09:47:30 -07:00
fe46461c4c adding a few more blocks 2017-10-24 05:30:05 -07:00
ccda971fd1 Bump PXT and common packages 2017-10-24 12:50:00 +01:00
8fa6cf41ca updated build files 2017-10-23 13:43:59 -07:00
aa3c6d5fc0 bump pxt-core to 2.3.1, bump pxt-common-packages to 0.10.16, 2017-10-23 13:41:38 -07:00
6a719e7718 Use field toggle for switching the motor on / off 2017-10-04 17:04:26 -04:00
b18b8333d0 Remove button group 2017-10-03 02:31:06 -04:00
84d80131d4 Various UI fixes. Block refactoring and adding touch and color blocks. 2017-10-03 02:28:44 -04:00
4977358718 0.0.19 2017-09-15 10:06:47 -07:00
15b2ef6c92 Update theme.config 2017-09-15 10:06:33 -07:00
e0288ed741 bump pxt-core to 2.0.49, bump pxt-common-packages to 0.9.6, 2017-09-15 10:04:01 -07:00
df1caf9741 0.0.18 2017-09-01 16:50:18 -07:00
a755420d06 bump pxt-core to 2.0.34, bump pxt-common-packages to 0.9.3, 2017-09-01 16:50:13 -07:00
a139727fea 0.0.17 2017-08-28 21:52:26 -07:00
48e081e584 Update json strings 2017-08-28 21:52:09 -07:00
124ad5c915 bump pxt-core to 2.0.29, 2017-08-28 21:51:33 -07:00
75a571fda7 Update README.md 2017-08-14 14:35:03 -07:00
bb842056d4 0.0.16 2017-08-10 17:11:02 -07:00
41b023f83f bump pxt-core to 2.0.12, 2017-08-10 17:10:57 -07:00
1ff058460f Split out blockly into blockly.less 2017-08-10 17:10:08 -07:00
cb0895f166 Moving UF2 related code away from this repo 2017-08-10 09:49:30 -07:00
1340fd0162 0.0.15 2017-08-09 10:03:14 -07:00
a3f56f4c9a Fix pattern enum decompilation and setSpeed when no speed is set. 2017-08-09 10:02:58 -07:00
c0e2252157 0.0.14 2017-08-08 13:45:39 -07:00
92ad67315b bump pxt-core to 2.0.10, 2017-08-08 13:45:33 -07:00
8b3064f4e0 0.0.13 2017-08-08 13:05:00 -07:00
138709285a bump pxt-core to 2.0.9, 2017-08-08 13:04:55 -07:00
65dd4617f1 Add get speed block 2017-08-08 13:02:11 -07:00
bdc8c1c62c bump pxt-core to 2.0.8, 2017-08-08 12:04:54 -07:00
ebcde71950 Fix hid deployment from command line 2017-08-08 11:47:10 +02:00
d42117a2a5 Add reading motor speed data (untested) 2017-08-08 11:41:47 +02:00
b0145cf378 Fix test.ts so it compiles 2017-08-08 11:41:31 +02:00
868ee826ab 0.0.12 2017-08-07 23:40:14 -07:00
ce489bba56 Update core-strings 2017-08-07 23:39:54 -07:00
b0944ba431 Change say to print. 2017-08-07 21:50:45 -07:00
8736d32f09 Add screen blocks 2017-08-07 21:50:04 -07:00
f8c481555c 0.0.11 2017-08-07 17:39:55 -07:00
15f50966aa Update motor APIs 2017-08-07 17:39:37 -07:00
88e21db35e fixing raiseEvent 2017-08-07 12:07:43 -07:00
4e9d3aa413 0.0.10 2017-08-07 11:33:51 -07:00
1efad776e6 bump pxt-core to 2.0.6, 2017-08-07 11:33:46 -07:00
5e7af872b5 Add setLights shadow block 2017-08-07 10:19:38 -07:00
17683033b1 Add branch info 2017-08-07 12:15:56 +02:00
31f3d108c5 Update build instructions 2017-08-07 12:15:06 +02:00
b45bf7512c 0.0.9 2017-08-07 11:13:05 +02:00
2dec405a9b Catch errors from initAsync 2017-08-07 11:12:52 +02:00
29009aa5e5 0.0.8 2017-08-07 11:08:15 +02:00
86011827dc Fix initialization without HID 2017-08-07 10:56:21 +02:00
c20cfab069 Fix web deployment, only use HF2 when in localhost (#2) 2017-08-05 17:54:18 +01:00
197f9096f8 0.0.7 2017-08-04 22:53:11 -07:00
6d499cb683 Fix package.json 2017-08-04 22:52:53 -07:00
163a4f89f8 0.0.6 2017-08-04 22:41:39 -07:00
b32aa61cd1 Update package.json 2017-08-04 21:17:52 -07:00
db7cf212d4 0.0.5 2017-08-04 21:06:51 -07:00
c8fb59cdde bump pxt-common-packages to 0.9.2, 2017-08-04 21:06:46 -07:00
264156c485 0.0.4 2017-08-04 20:58:47 -07:00
440dbbe82a Update style, use freshcoat 2017-08-04 20:54:22 -07:00
f4660b4366 0.0.3 2017-08-04 15:25:45 -07:00
a4be9f07ea Add robots no index 2017-08-04 15:25:33 -07:00
975 changed files with 47836 additions and 19891 deletions

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
Add screenshots to help explain your problem. You can copy paste the screenshot in the github report. The .gif screen recording is very useful as well.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

3
.gitignore vendored
View File

@ -16,6 +16,8 @@ clients/win10/*.opendb
clients/**/bin/**
clients/**/obj/**
clients/electron/projects
libs/**/_locales/**
package-lock.json
videos/**
@ -31,3 +33,4 @@ videos/**
lib/
.vscode/
bin
scripts/out.*

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
language: node_js
node_js:
- "8.9.0"
script:
- "node node_modules/pxt-core/built/pxt.js travis"
sudo: false
cache:
directories:
- node_modules

View File

@ -1,29 +1,34 @@
# LEGO Mindstorms EV3 target for PXT
# LEGO® MINDSTORMS® Education EV3 for Microsoft MakeCode [![Build Status](https://travis-ci.org/microsoft/pxt-ev3.svg?branch=master)](https://travis-ci.org/microsoft/pxt-ev3)
[![Build Status](https://ci2.dot.net/buildStatus/icon?job=Private/pxt_project_pink/master/pxt-ev3_Push)](https://ci2.dot.net/job/Private/job/pxt_project_pink/job/master/job/pxt-ev3_Push/)
This repo contains the editor target hosted at https://makecode.mindstorms.com
This repo contains the editor target hosted at https://lego.makecode.com
## Local Dev setup
## Local setup
These instructions assume familiarity with dev tools and languages.
* install Node.js 6+
* install [yotta](http://docs.yottabuild.org/#installing)
* install Node.js 8.9.4+
* install Docker; make sure `docker` command is in your `PATH`
* (optional) install [Visual Studio Code](https://code.visualstudio.com/)
In a common folder,
* clone https://github.com/Microsoft/pxt to ``pxt`` folder
* clone https://github.com/Microsoft/pxt-common-packages to ``pxt-common-packages`` folder
* clone https://github.com/Microsoft/pxt-ev3 to ``pxt-ev3`` folder
* go to ``pxt`` and run
```
npm install
typings install
```
* to run the local server,
```
pxt serve --cloud
```
## Local Dev setup
In the common folder,
* clone https://github.com/Microsoft/pxt to ``pxt`` folder
* clone https://github.com/Microsoft/pxt-common-packages to ``pxt-common-packages`` folder
* go to ``pxt-common-packages`` and run
```
@ -55,18 +60,12 @@ cd libs/core
pxt deploy
```
### Hosted editor
Currently hosted at:
https://d541eec2-1e96-4b7b-a223-da9d01d0337a.pxt.io/
### Jenkins build
https://ci2.dot.net/job/Private/job/pxt_project_rainbow/job/master/
## License
MIT
## Trademarks
MICROSOFT, the Microsoft Logo, and MAKECODE are registered trademarks of Microsoft Corporation. They can only be used for the purposes described in and in accordance with Microsofts Trademark and Brand guidelines published at https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general.aspx. If the use is not covered in Microsofts published guidelines or you are not sure, please consult your legal counsel or the MakeCode team (makecode@microsoft.com).
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

View File

@ -1,12 +0,0 @@
all: mod uf2
mod:
$(MAKE) -C .. MOD=d_usbdev M=`pwd`/kernel ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
@mkdir -p bin
cp kernel/*.ko bin/
uf2:
$(MAKE) -C uf2daemon
@mkdir -p bin
cp uf2daemon/server bin/uf2d

View File

@ -1,35 +0,0 @@
# Support code to run on EV3 brick
## Kernel module
Kernel module is based on LEGO's `d_usbdev` module, with the addition of slightly modified `g_mass_storage`
module from the Linux kernel. The module and supporting sources are licensed under GPLv2 (since
they are derived from GPLv2 code).
### Modifications
* the `d_usbdev` uses the composite framework to register an additional mass storage function in addtion
to the pre-existing custom USB HID function
* the `g_mass_storage` module has the following changes:
* additional `/sys/.../lun0/active` entry is added, which allows for signaling drive eject to the host
* `d_usbdev` has an additional `ioctl()` to pretend data came from the USB host - this can be used to direct
the VM to do stuff
### Kernel modifications
The kernel itself has modified FIFO queue sizes. The LEGO kernel uses `1024` for `ep1in` and `ep1out`,
and then `64` for `ep2` and `ep3`. Note that this is non-standard modification done with a kernel patch,
that I didn't manage to find. The MSD requires `512` for `ep2` and `ep3`. I have binary edited the kernel
to do so.
Note that there's 4k of FIFO memory in the hardware. If you set the queue sizes with a sum of more than
4k, the kernel will hang, and you will not know why.
## UF2 Daemon
The [UF2](https://github.com/Microsoft/uf2) daemon is based on
[UF2 ATSAMD21](https://github.com/Microsoft/uf2-samd21) bootloader code. It exposes a virtual
FAT16 file system over Linux Network Block Device interface (`/dev/nbd0` to be precise).
This device is then exposed via the `g_mass_storage` module to the host computer.
The Daemon is licensed under MIT.

View File

@ -1,10 +0,0 @@
#!/bin/sh
set -ex
echo Y > /sys/module/printk/parameters/time
cd /mnt/ramdisk/prjs/ko
#echo 3 > /proc/sys/kernel/printk
insmod ./nbd.ko
sleep 1
./uf2d /dev/nbd1 > /tmp/uf2d.log 2> /tmp/uf2derr.log
sleep 1
insmod ./d_usbdev.ko file=/dev/nbd1 HostStr=EV3 SerialStr=0016535543af

View File

@ -1,2 +0,0 @@
obj-m += $(MOD).o

File diff suppressed because it is too large Load Diff

View File

@ -1,762 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* This UsbDev file is based on and inheritated from
* the original file (zero.c) and work done by David Brownell
*
* >> zero.c -- Gadget Zero, for USB development <<
*
* >> Copyright (C) 2003-2008 David Brownell <<
* >> Copyright (C) 2008 by Nokia Corporation <<
*
*/
/*! \page UsbdevModule USB device Module
*
*
*- \subpage UsbdevModuleResources
*/
#ifndef PCASM
#include <asm/types.h>
#endif
#include "source/lms2012.h"
#include "source/am1808.h"
#define MODULE_NAME "usbdev_module"
#define DEVICE1_NAME USBDEV_DEVICE
static int ModuleInit(void);
static void ModuleExit(void);
#define __USE_POSIX
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sched.h>
#ifndef PCASM
#include <linux/hrtimer.h>
#include <linux/mm.h>
#include <linux/hrtimer.h>
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include <linux/ioport.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
#include <linux/hid.h>
#include <linux/utsname.h>
#include <linux/device.h>
static struct fsg_common *fsg_common;
#include "computil.c" // The composite framework used as utility file
#include <../drivers/usb/gadget/gadget_chips.h>
#include <../drivers/usb/gadget/usbstring.c>
#include <../drivers/usb/gadget/config.c>
#include <../drivers/usb/gadget/epautoconf.c>
#include "f_mass_storage.c"
/*-------------------------------------------------------------------------*/
/*
* Kbuild is not very cooperative with respect to linking separately
* compiled library objects into one module. So for now we won't use
* separate compilation ... ensuring init/exit sections work to shrink
* the runtime footprint, and giving us at least some parts of what
* a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/
#include <../drivers/usb/gadget/g_zero.h>
#define MAX_EP_SIZE 1024
#define MAX_FULLSPEED_EP_SIZE 64
unsigned buflen = MAX_EP_SIZE ;
char usb_char_buffer_in[MAX_EP_SIZE];
char usb_full_buffer_in[MAX_FULLSPEED_EP_SIZE];
int usb_char_in_length = 0;
char usb_char_buffer_out[MAX_EP_SIZE];
char usb_full_buffer_out[MAX_FULLSPEED_EP_SIZE];
int usb_char_out_length = 0;
#define SHM_LENGTH (sizeof(UsbSpeedDefault))
#define NPAGES ((SHM_LENGTH + PAGE_SIZE - 1) / PAGE_SIZE)
static void *kmalloc_ptr;
#include "usb_function.c" // Specific USB functionality
/*-------------------------------------------------------------------------*/
MODULE_LICENSE("GPL");
MODULE_AUTHOR("The LEGO Group");
MODULE_DESCRIPTION(MODULE_NAME);
MODULE_SUPPORTED_DEVICE(DEVICE1_NAME);
module_init(ModuleInit);
module_exit(ModuleExit);
#else
// Keep Eclipse happy
#endif
// USB main stuff
#define DRIVER_VERSION "31jan2011->"
#ifndef PCASM
module_param(buflen, uint, 0);
#else
// Keep Eclipse happy
#endif
static int loopdefault = 0;
#ifndef PCASM
module_param(loopdefault, bool, S_IRUGO|S_IWUSR);
#else
// Keep Eclipse happy
#endif
#define DRIVER_VENDOR_NUM 0x0694 // LEGO Group
#define DRIVER_PRODUCT_NUM 0x0005 // No. 5 in a row
#define DEFAULT_AUTORESUME 0
/* If the optional "autoresume" mode is enabled, it provides good
* functional coverage for the "USBCV" test harness from USB-IF.
* It's always set if OTG mode is enabled.
*/
unsigned autoresume = DEFAULT_AUTORESUME;
module_param(autoresume, uint, S_IRUGO);
#ifndef PCASM
MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup");
#else
// Keep Eclipse happy
#endif
/*-------------------------------------------------------------------------*/
static struct usb_device_descriptor device_desc = {
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,
.bcdUSB = cpu_to_le16(0x0200),
.bDeviceClass = 0xEF,
.bDeviceSubClass = 2,
.bDeviceProtocol = 1,
/*.bMaxPacketSize0 = f(hardware) */
.idVendor = cpu_to_le16(DRIVER_VENDOR_NUM),
.idProduct = cpu_to_le16(DRIVER_PRODUCT_NUM),
.bNumConfigurations = 1,
};
#ifdef CONFIG_USB_OTG
struct usb_otg_descriptor otg_descriptor = {
.bLength = sizeof otg_descriptor,
.bDescriptorType = USB_DT_OTG,
/* REVISIT SRP-only hardware is possible, although
* it would not be called "OTG" ...
*/
.bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
};
const struct usb_descriptor_header *otg_desc[] = {
(struct usb_descriptor_header *) &otg_descriptor,
NULL,
};
#endif
/* string IDs are assigned dynamically */
#define STRING_MANUFACTURER_IDX 0
#define STRING_PRODUCT_IDX 1
#define STRING_SERIAL_IDX 2
static char manufacturer[] = "LEGO Group";
static char serial[] = "123456789ABC ";
static char longname[] = "EV3 brick ";
static struct usb_string strings_dev[3] = {
[STRING_MANUFACTURER_IDX].s = manufacturer,
[STRING_PRODUCT_IDX].s = longname,
[STRING_SERIAL_IDX].s = serial
};
static struct usb_gadget_strings stringtab_dev = {
.language = 0x0409, /* en-us */
.strings = strings_dev,
};
static struct usb_gadget_strings *dev_strings[] = {
&stringtab_dev,
NULL,
};
/*-------------------------------------------------------------------------*/
struct usb_request *alloc_ep_req(struct usb_ep *ep)
{
struct usb_request *req;
req = usb_ep_alloc_request(ep, GFP_ATOMIC);
if (req) {
req->length = buflen;
req->buf = kmalloc(buflen, GFP_ATOMIC);
if (!req->buf) {
usb_ep_free_request(ep, req);
req = NULL;
}
}
return req;
}
void free_ep_req(struct usb_ep *ep, struct usb_request *req)
{
kfree(req->buf);
usb_ep_free_request(ep, req);
}
static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep)
{
int value;
if (ep->driver_data) {
value = usb_ep_disable(ep);
if (value < 0)
DBG(cdev, "disable %s --> %d\n",
ep->name, value);
ep->driver_data = NULL;
}
}
void disable_endpoints(struct usb_composite_dev *cdev,
struct usb_ep *in, struct usb_ep *out)
{
disable_ep(cdev, in);
disable_ep(cdev, out);
}
/*-------------------------------------------------------------------------*/
static struct timer_list autoresume_timer;
static void zero_autoresume(unsigned long _c)
{
struct usb_composite_dev *cdev = (void *)_c;
struct usb_gadget *g = cdev->gadget;
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("zero_autoresume\n\r");
#endif
/* unconfigured devices can't issue wakeups */
if (!cdev->config)
return;
/* Normally the host would be woken up for something
* more significant than just a timer firing; likely
* because of some direct user request.
*/
if (g->speed != USB_SPEED_UNKNOWN) {
int status = usb_gadget_wakeup(g);
INFO(cdev, "%s --> %d\n", __func__, status);
}
}
static void zero_suspend(struct usb_composite_dev *cdev)
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("zero_suspend\n\r");
#endif
if (cdev->gadget->speed == USB_SPEED_UNKNOWN)
return;
if (autoresume) {
mod_timer(&autoresume_timer, jiffies + (HZ * autoresume));
DBG(cdev, "suspend, wakeup in %d seconds\n", autoresume);
} else
DBG(cdev, "%s\n", __func__);
}
static void zero_resume(struct usb_composite_dev *cdev)
{
DBG(cdev, "%s\n", __func__);
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("zero_resume\n\r");
#endif
del_timer(&autoresume_timer);
}
/*-------------------------------------------------------------------------*/
static int msg_bind(struct usb_composite_dev *cdev);
static void msg_bind2(struct usb_composite_dev *cdev);
static int zero_bind(struct usb_composite_dev *cdev)
{
int gcnum;
struct usb_gadget *gadget = cdev->gadget;
int id;
/* Allocate string descriptor numbers ... note that string
* contents can be overridden by the composite_dev glue.
*/
id = usb_string_id(cdev);
if (id < 0)
return id;
strings_dev[STRING_MANUFACTURER_IDX].id = id;
device_desc.iManufacturer = id;
id = usb_string_id(cdev);
if (id < 0)
return id;
strings_dev[STRING_PRODUCT_IDX].id = id;
device_desc.iProduct = id;
id = usb_string_id(cdev);
if (id < 0)
return id;
strings_dev[STRING_SERIAL_IDX].id = id;
device_desc.iSerialNumber = id;
id = msg_bind(cdev);
if (id < 0)
return id;
setup_timer(&autoresume_timer, zero_autoresume, (unsigned long) cdev);
rudolf_add(cdev, autoresume != 0);
gcnum = usb_gadget_controller_number(gadget);
if (gcnum >= 0)
device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum);
else {
/* gadget zero is so simple (for now, no altsettings) that
* it SHOULD NOT have problems with bulk-capable hardware.
* so just warn about unrcognized controllers -- don't panic.
*
* things like configuration and altsetting numbering
* can need hardware-specific attention though.
*/
pr_warning("%s: controller '%s' not recognized\n",
longname, gadget->name);
device_desc.bcdDevice = cpu_to_le16(0x9999);
}
msg_bind2(cdev);
return 0;
}
static int zero_unbind(struct usb_composite_dev *cdev)
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("zero_unbind\n\r");
#endif
del_timer_sync(&autoresume_timer);
return 0;
}
static struct usb_composite_driver zero_driver = {
.name = "zero",
.dev = &device_desc,
.strings = dev_strings,
.bind = zero_bind,
.unbind = zero_unbind,
.suspend = zero_suspend,
.resume = zero_resume,
};
static int dUsbInit(void)
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("dUsbInit\n\r");
#endif
UsbSpeed.Speed = FULL_SPEED; // default to FULL_SPEED if not connected to a HIGH-SPEED
(*pUsbSpeed).Speed = FULL_SPEED; // HOST. If not connected to HIGH-SPEED we assume we're
// wanting (or at least doing) Daisy Chain
return usb_composite_register(&zero_driver);
}
static void dUsbExit(void)
{
usb_composite_unregister(&zero_driver);
}
// DEVICE1 char device stuff ********************************************************************
static ssize_t Device1Write(struct file *File,const char *Buffer,size_t Count,loff_t *Data)
{
// Write data for the HOST to poll - Stuff sent to the HOST
int BytesWritten = 0;
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
printk("Device1Write - usb_char_in_length = %d\n", usb_char_in_length);
#endif
if (usb_char_in_length == 0) // ready for more
{ // else wait in USER layer
BytesWritten = Count;
copy_from_user(usb_char_buffer_in, Buffer, BytesWritten);
usb_char_in_length = BytesWritten;
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("WR = %d, %d -- ", usb_char_buffer_in[2], usb_char_buffer_in[3]);
#endif
if(USB_DATA_PENDING == input_state)
{
// Already we've a failed tx (HOST part starwing??
input_state = USB_DATA_READY;
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
printk("DATA_PENDING SECOND time and reset!! in Device1Write\n\r");
#endif
}
if(USB_DATA_READY == input_state)
{
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
printk("USB_DATA_READY in Device1Write\n\r");
#endif
input_state = USB_DATA_BUSY;
write_data_to_the_host(save_in_ep, save_in_req);
usb_req_arm(save_in_ep, save_in_req); // new request
}
else
{
input_state = USB_DATA_PENDING;
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
printk("DATA_PENDING in Device1Write\n\r");
#endif
}
}
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("usbdev %d written\n\r", BytesWritten);
#endif
return (BytesWritten); // Zero means USB was not ready yet
}
static ssize_t Device1Read(struct file *File,char *Buffer,size_t Count,loff_t *Offset)
{
// Read the bits'n'bytes from the HOST
int BytesRead = 0;
if (usb_char_out_length > 0) // Something to look at
{
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
printk("Some bytes to READ?\n\r");
#endif
copy_to_user(Buffer, usb_char_buffer_out, Count);
BytesRead = usb_char_out_length;
usb_char_out_length = 0;
}
return (BytesRead);
}
static int Device1Mmap(struct file *filp, struct vm_area_struct *vma)
{
int ret;
ret = remap_pfn_range(vma,vma->vm_start,virt_to_phys((void*)((unsigned long)pUsbSpeed)) >> PAGE_SHIFT,vma->vm_end-vma->vm_start,PAGE_SHARED);
if (ret != 0)
{
ret = -EAGAIN;
}
return (ret);
}
#define FEED_DATA _IOC(_IOC_WRITE, 't', 108, 1024)
static int Device1Ioctl(struct inode *pNode, struct file *File, unsigned int Request, unsigned long Pointer)
{
if (Request != FEED_DATA)
return -EINVAL;
copy_from_user(usb_char_buffer_out,(void*)Pointer,1024);
usb_char_out_length = 1024;
return 0;
}
static const struct file_operations Device1Entries =
{
.owner = THIS_MODULE,
.read = Device1Read,
.write = Device1Write,
.mmap = Device1Mmap,
.ioctl = Device1Ioctl
};
static struct miscdevice Device1 =
{
MISC_DYNAMIC_MINOR,
DEVICE1_NAME,
&Device1Entries
};
static int Device1Init(void)
{
int Result = -1;
UWORD *pTemp;
int i;
Result = misc_register(&Device1);
if (Result)
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk(" %s device register failed\n",DEVICE1_NAME);
#endif
}
else
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk(" %s device register OK\n",DEVICE1_NAME);
#endif
// allocate kernel shared memory for DaisyChain Speed info
if ((kmalloc_ptr = kmalloc((NPAGES + 2) * PAGE_SIZE, GFP_KERNEL)) != NULL)
{
pTemp = (UWORD*)((((unsigned long)kmalloc_ptr) + PAGE_SIZE - 1) & PAGE_MASK);
for (i = 0; i < NPAGES * PAGE_SIZE; i += PAGE_SIZE)
{
SetPageReserved(virt_to_page(((unsigned long)pTemp) + i));
}
pUsbSpeed = (USB_SPEED*)pTemp;
}
dUsbInit();
}
return (Result);
}
static void Device1Exit(void)
{
int i;
UWORD *pTemp = (UWORD*)pUsbSpeed;
dUsbExit();
pUsbSpeed = &UsbSpeedDefault;
for (i = 0; i < NPAGES * PAGE_SIZE; i+= PAGE_SIZE)
{
ClearPageReserved(virt_to_page(((unsigned long)pTemp) + i));
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk(" %s memory page %d unmapped\n",DEVICE1_NAME,i);
#endif
}
kfree(kmalloc_ptr);
misc_deregister(&Device1);
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk(" %s device unregistered\n",DEVICE1_NAME);
#endif
}
// MODULE *********************************************************************
char *HostStr; // Used for HostName - or NOT used at all
char *SerialStr; // Used for Serial number (I.e. BT number)
module_param (HostStr, charp, 0);
module_param (SerialStr, charp, 0);
static int ModuleInit(void)
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("%s Module init started\r\n",MODULE_NAME);
#endif
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("This is DEFAULT NAME: %s\n\r", longname);
#endif
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("\n\rThis is the HostStr: %s\n\r", HostStr);
#endif
strcpy(longname, HostStr);
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("\n\rThis is the INSMODed NAME: %s\n\r", longname);
#endif
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("\n\rThis is the DEFAULT SerialNumber: %s\n\r", serial);
#endif
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("\n\rThis is the SerialStr: %s\n\r", SerialStr);
#endif
strcpy(serial, SerialStr);
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("\n\rThis is the INSMODed SerialNumber (BT mac): %s\n\r", serial);
#endif
Device1Init();
return (0);
}
static void ModuleExit(void)
{
//#define DEBUG
#undef DEBUG
#ifdef DEBUG
printk("%s exit started\n",MODULE_NAME);
#endif
Device1Exit();
}
// MSG
/****************************** Configurations ******************************/
static struct fsg_module_parameters fsg_mod_data = {
.stall = 1
};
FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data);
/****************************** Gadget Bind ******************************/
static void msg_bind2(struct usb_composite_dev *cdev)
{
fsg_common_put(fsg_common);
}
static int msg_bind(struct usb_composite_dev *cdev)
{
/* set up mass storage function */
fsg_common = fsg_common_from_params(0, cdev, &fsg_mod_data);
if (IS_ERR(fsg_common)) {
return PTR_ERR(fsg_common);
}
return 0;
}
static int msg_config(struct usb_configuration *c) {
return fsg_add(c->cdev, c, fsg_common);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,276 +0,0 @@
/*
* USB device controllers have lots of quirks. Use these macros in
* gadget drivers or other code that needs to deal with them, and which
* autoconfigures instead of using early binding to the hardware.
*
* This SHOULD eventually work like the ARM mach_is_*() stuff, driven by
* some config file that gets updated as new hardware is supported.
* (And avoiding all runtime comparisons in typical one-choice configs!)
*
* NOTE: some of these controller drivers may not be available yet.
* Some are available on 2.4 kernels; several are available, but not
* yet pushed in the 2.6 mainline tree.
*/
#ifndef __GADGET_CHIPS_H
#define __GADGET_CHIPS_H
#ifdef CONFIG_USB_GADGET_NET2280
#define gadget_is_net2280(g) !strcmp("net2280", (g)->name)
#else
#define gadget_is_net2280(g) 0
#endif
#ifdef CONFIG_USB_GADGET_AMD5536UDC
#define gadget_is_amd5536udc(g) !strcmp("amd5536udc", (g)->name)
#else
#define gadget_is_amd5536udc(g) 0
#endif
#ifdef CONFIG_USB_GADGET_DUMMY_HCD
#define gadget_is_dummy(g) !strcmp("dummy_udc", (g)->name)
#else
#define gadget_is_dummy(g) 0
#endif
#ifdef CONFIG_USB_GADGET_PXA25X
#define gadget_is_pxa(g) !strcmp("pxa25x_udc", (g)->name)
#else
#define gadget_is_pxa(g) 0
#endif
#ifdef CONFIG_USB_GADGET_GOKU
#define gadget_is_goku(g) !strcmp("goku_udc", (g)->name)
#else
#define gadget_is_goku(g) 0
#endif
/* SH3 UDC -- not yet ported 2.4 --> 2.6 */
#ifdef CONFIG_USB_GADGET_SUPERH
#define gadget_is_sh(g) !strcmp("sh_udc", (g)->name)
#else
#define gadget_is_sh(g) 0
#endif
/* not yet stable on 2.6 (would help "original Zaurus") */
#ifdef CONFIG_USB_GADGET_SA1100
#define gadget_is_sa1100(g) !strcmp("sa1100_udc", (g)->name)
#else
#define gadget_is_sa1100(g) 0
#endif
#ifdef CONFIG_USB_GADGET_LH7A40X
#define gadget_is_lh7a40x(g) !strcmp("lh7a40x_udc", (g)->name)
#else
#define gadget_is_lh7a40x(g) 0
#endif
/* handhelds.org tree (?) */
#ifdef CONFIG_USB_GADGET_MQ11XX
#define gadget_is_mq11xx(g) !strcmp("mq11xx_udc", (g)->name)
#else
#define gadget_is_mq11xx(g) 0
#endif
#ifdef CONFIG_USB_GADGET_OMAP
#define gadget_is_omap(g) !strcmp("omap_udc", (g)->name)
#else
#define gadget_is_omap(g) 0
#endif
/* not yet ported 2.4 --> 2.6 */
#ifdef CONFIG_USB_GADGET_N9604
#define gadget_is_n9604(g) !strcmp("n9604_udc", (g)->name)
#else
#define gadget_is_n9604(g) 0
#endif
/* various unstable versions available */
#ifdef CONFIG_USB_GADGET_PXA27X
#define gadget_is_pxa27x(g) !strcmp("pxa27x_udc", (g)->name)
#else
#define gadget_is_pxa27x(g) 0
#endif
#ifdef CONFIG_USB_GADGET_ATMEL_USBA
#define gadget_is_atmel_usba(g) !strcmp("atmel_usba_udc", (g)->name)
#else
#define gadget_is_atmel_usba(g) 0
#endif
#ifdef CONFIG_USB_GADGET_S3C2410
#define gadget_is_s3c2410(g) !strcmp("s3c2410_udc", (g)->name)
#else
#define gadget_is_s3c2410(g) 0
#endif
#ifdef CONFIG_USB_GADGET_AT91
#define gadget_is_at91(g) !strcmp("at91_udc", (g)->name)
#else
#define gadget_is_at91(g) 0
#endif
#ifdef CONFIG_USB_GADGET_IMX
#define gadget_is_imx(g) !strcmp("imx_udc", (g)->name)
#else
#define gadget_is_imx(g) 0
#endif
#ifdef CONFIG_USB_GADGET_FSL_USB2
#define gadget_is_fsl_usb2(g) !strcmp("fsl-usb2-udc", (g)->name)
#else
#define gadget_is_fsl_usb2(g) 0
#endif
/* Mentor high speed function controller */
/* from Montavista kernel (?) */
#ifdef CONFIG_USB_GADGET_MUSBHSFC
#define gadget_is_musbhsfc(g) !strcmp("musbhsfc_udc", (g)->name)
#else
#define gadget_is_musbhsfc(g) 0
#endif
/* Mentor high speed "dual role" controller, in peripheral role */
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
#define gadget_is_musbhdrc(g) !strcmp("musb_hdrc", (g)->name)
#else
#define gadget_is_musbhdrc(g) 0
#endif
#ifdef CONFIG_USB_GADGET_LANGWELL
#define gadget_is_langwell(g) (!strcmp("langwell_udc", (g)->name))
#else
#define gadget_is_langwell(g) 0
#endif
/* from Montavista kernel (?) */
#ifdef CONFIG_USB_GADGET_MPC8272
#define gadget_is_mpc8272(g) !strcmp("mpc8272_udc", (g)->name)
#else
#define gadget_is_mpc8272(g) 0
#endif
#ifdef CONFIG_USB_GADGET_M66592
#define gadget_is_m66592(g) !strcmp("m66592_udc", (g)->name)
#else
#define gadget_is_m66592(g) 0
#endif
/* Freescale CPM/QE UDC SUPPORT */
#ifdef CONFIG_USB_GADGET_FSL_QE
#define gadget_is_fsl_qe(g) !strcmp("fsl_qe_udc", (g)->name)
#else
#define gadget_is_fsl_qe(g) 0
#endif
#ifdef CONFIG_USB_GADGET_CI13XXX
#define gadget_is_ci13xxx(g) (!strcmp("ci13xxx_udc", (g)->name))
#else
#define gadget_is_ci13xxx(g) 0
#endif
// CONFIG_USB_GADGET_SX2
// CONFIG_USB_GADGET_AU1X00
// ...
#ifdef CONFIG_USB_GADGET_R8A66597
#define gadget_is_r8a66597(g) !strcmp("r8a66597_udc", (g)->name)
#else
#define gadget_is_r8a66597(g) 0
#endif
/**
* usb_gadget_controller_number - support bcdDevice id convention
* @gadget: the controller being driven
*
* Return a 2-digit BCD value associated with the peripheral controller,
* suitable for use as part of a bcdDevice value, or a negative error code.
*
* NOTE: this convention is purely optional, and has no meaning in terms of
* any USB specification. If you want to use a different convention in your
* gadget driver firmware -- maybe a more formal revision ID -- feel free.
*
* Hosts see these bcdDevice numbers, and are allowed (but not encouraged!)
* to change their behavior accordingly. For example it might help avoiding
* some chip bug.
*/
static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
{
if (gadget_is_net2280(gadget))
return 0x01;
else if (gadget_is_dummy(gadget))
return 0x02;
else if (gadget_is_pxa(gadget))
return 0x03;
else if (gadget_is_sh(gadget))
return 0x04;
else if (gadget_is_sa1100(gadget))
return 0x05;
else if (gadget_is_goku(gadget))
return 0x06;
else if (gadget_is_mq11xx(gadget))
return 0x07;
else if (gadget_is_omap(gadget))
return 0x08;
else if (gadget_is_lh7a40x(gadget))
return 0x09;
else if (gadget_is_n9604(gadget))
return 0x10;
else if (gadget_is_pxa27x(gadget))
return 0x11;
else if (gadget_is_s3c2410(gadget))
return 0x12;
else if (gadget_is_at91(gadget))
return 0x13;
else if (gadget_is_imx(gadget))
return 0x14;
else if (gadget_is_musbhsfc(gadget))
return 0x15;
else if (gadget_is_musbhdrc(gadget))
return 0x16;
else if (gadget_is_mpc8272(gadget))
return 0x17;
else if (gadget_is_atmel_usba(gadget))
return 0x18;
else if (gadget_is_fsl_usb2(gadget))
return 0x19;
else if (gadget_is_amd5536udc(gadget))
return 0x20;
else if (gadget_is_m66592(gadget))
return 0x21;
else if (gadget_is_fsl_qe(gadget))
return 0x22;
else if (gadget_is_ci13xxx(gadget))
return 0x23;
else if (gadget_is_langwell(gadget))
return 0x24;
else if (gadget_is_r8a66597(gadget))
return 0x25;
return -ENOENT;
}
/**
* gadget_supports_altsettings - return true if altsettings work
* @gadget: the gadget in question
*/
static inline bool gadget_supports_altsettings(struct usb_gadget *gadget)
{
/* PXA 21x/25x/26x has no altsettings at all */
if (gadget_is_pxa(gadget))
return false;
/* PXA 27x and 3xx have *broken* altsetting support */
if (gadget_is_pxa27x(gadget))
return false;
/* SH3 hardware just doesn't do altsettings */
if (gadget_is_sh(gadget))
return false;
/* Everything else is *presumably* fine ... */
return true;
}
#endif /* __GADGET_CHIPS_H */

View File

@ -1,249 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef AM1808_H_
#define AM1808_H_
#ifndef PCASM
#include <mach/da8xx.h>
#else
#define __iomem
#endif
enum
{
GP0_0,GP0_1,GP0_2,GP0_3,GP0_4,GP0_5,GP0_6,GP0_7,GP0_8,GP0_9,GP0_10,GP0_11,GP0_12,GP0_13,GP0_14,GP0_15,
GP1_0,GP1_1,GP1_2,GP1_3,GP1_4,GP1_5,GP1_6,GP1_7,GP1_8,GP1_9,GP1_10,GP1_11,GP1_12,GP1_13,GP1_14,GP1_15,
GP2_0,GP2_1,GP2_2,GP2_3,GP2_4,GP2_5,GP2_6,GP2_7,GP2_8,GP2_9,GP2_10,GP2_11,GP2_12,GP2_13,GP2_14,GP2_15,
GP3_0,GP3_1,GP3_2,GP3_3,GP3_4,GP3_5,GP3_6,GP3_7,GP3_8,GP3_9,GP3_10,GP3_11,GP3_12,GP3_13,GP3_14,GP3_15,
GP4_0,GP4_1,GP4_2,GP4_3,GP4_4,GP4_5,GP4_6,GP4_7,GP4_8,GP4_9,GP4_10,GP4_11,GP4_12,GP4_13,GP4_14,GP4_15,
GP5_0,GP5_1,GP5_2,GP5_3,GP5_4,GP5_5,GP5_6,GP5_7,GP5_8,GP5_9,GP5_10,GP5_11,GP5_12,GP5_13,GP5_14,GP5_15,
GP6_0,GP6_1,GP6_2,GP6_3,GP6_4,GP6_5,GP6_6,GP6_7,GP6_8,GP6_9,GP6_10,GP6_11,GP6_12,GP6_13,GP6_14,GP6_15,
GP7_0,GP7_1,GP7_2,GP7_3,GP7_4,GP7_5,GP7_6,GP7_7,GP7_8,GP7_9,GP7_10,GP7_11,GP7_12,GP7_13,GP7_14,GP7_15,
GP8_0,GP8_1,GP8_2,GP8_3,GP8_4,GP8_5,GP8_6,GP8_7,GP8_8,GP8_9,GP8_10,GP8_11,GP8_12,GP8_13,GP8_14,GP8_15,
NO_OF_GPIOS,
UART0_TXD,UART0_RXD,UART1_TXD,UART1_RXD,
SPI0_MOSI,SPI0_MISO,SPI0_SCL,SPI0_CS,
SPI1_MOSI,SPI1_MISO,SPI1_SCL,SPI1_CS,
EPWM1A,EPWM1B,APWM0,APWM1,EPWM0B,AXR3,AXR4
};
typedef struct
{
int Pin;
u16 MuxReg;
u32 Mask;
u32 Mode;
}
MRM;
MRM MuxRegMap[] =
{ // Pin MuxReg Mask Mode
{ GP0_1 , 1, 0xF0FFFFFF, 0x08000000 },
{ GP0_2 , 1, 0xFF0FFFFF, 0x00800000 },
{ GP0_3 , 1, 0xFFF0FFFF, 0x00080000 },
{ GP0_4 , 1, 0xFFFF0FFF, 0x00008000 },
{ GP0_5 , 1, 0xFFFFF0FF, 0x00000800 },
{ GP0_6 , 1, 0xFFFFFF0F, 0x00000080 },
{ GP0_7 , 1, 0xFFFFFFF0, 0x00000008 },
{ GP0_11, 0, 0xFFF0FFFF, 0x00080000 },
{ GP0_12, 0, 0xFFFF0FFF, 0x00008000 },
{ GP0_13, 0, 0xFFFFF0FF, 0x00000800 },
{ GP0_14, 0, 0xFFFFFF0F, 0x00000080 },
{ GP0_15, 0, 0xFFFFFFF0, 0x00000008 },
{ GP1_0 , 4, 0x0FFFFFFF, 0x80000000 },
{ GP1_8 , 3, 0xFFFFFFF0, 0x00000004 },
{ GP1_9, 2, 0xF0FFFFFF, 0x04000000 },
{ GP1_10, 2, 0xFF0FFFFF, 0x00400000 },
{ GP1_11, 2, 0xFFF0FFFF, 0x00040000 },
{ GP1_12, 2, 0xFFFF0FFF, 0x00004000 },
{ GP1_13, 2, 0xFFFFF0FF, 0x00000400 },
{ GP1_14, 2, 0xFFFFFF0F, 0x00000040 },
{ GP1_15, 2, 0xFFFFFFF0, 0x00000008 },
{ GP2_0, 6, 0x0FFFFFFF, 0x80000000 },
{ GP2_1, 6, 0xF0FFFFFF, 0x08000000 },
{ GP2_2, 6, 0xFF0FFFFF, 0x00800000 },
{ GP2_3, 6, 0xFFF0FFFF, 0x00080000 },
{ GP2_4, 6, 0xFFFF0FFF, 0x00008000 },
{ GP2_5, 6, 0xFFFFF0FF, 0x00000800 },
{ GP2_6, 6, 0xFFFFFF0F, 0x00000080 },
{ GP2_7, 6, 0xFFFFFFF0, 0x00000008 },
{ GP2_8, 5, 0x0FFFFFFF, 0x80000000 },
{ GP2_9, 5, 0xF0FFFFFF, 0x08000000 },
{ GP2_10, 5, 0xFF0FFFFF, 0x00800000 },
{ GP2_11, 5, 0xFFF0FFFF, 0x00080000 },
{ GP2_12, 5, 0xFFFF0FFF, 0x00008000 },
{ GP2_13, 5, 0xFFFFF0FF, 0x00000800 },
{ GP3_0, 8, 0x0FFFFFFF, 0x80000000 },
{ GP3_1 , 8, 0xF0FFFFFF, 0x08000000 },
{ GP3_2, 8, 0xFF0FFFFF, 0x00800000 },
{ GP3_3, 8, 0xFFF0FFFF, 0x00080000 },
{ GP3_4, 8, 0xFFFF0FFF, 0x00008000 },
{ GP3_5, 8, 0xFFFFF0FF, 0x00000800 },
{ GP3_6, 8, 0xFFFFFF0F, 0x00000080 },
{ GP3_7, 8, 0xFFFFFFF0, 0x00000008 },
{ GP3_8, 7, 0x0FFFFFFF, 0x80000000 },
{ GP3_9, 7, 0xF0FFFFFF, 0x08000000 },
{ GP3_10, 7, 0xFF0FFFFF, 0x00800000 },
{ GP3_11, 7, 0xFFF0FFFF, 0x00080000 },
{ GP3_12, 7, 0xFFFF0FFF, 0x00008000 },
{ GP3_13, 7, 0xFFFFF0FF, 0x00000800 },
{ GP3_14, 7, 0xFFFFFF0F, 0x00000080 },
{ GP3_15, 7, 0xFFFFFFF0, 0x00000008 },
{ GP4_1, 10, 0xF0FFFFFF, 0x08000000 },
{ GP4_8, 9, 0x0FFFFFFF, 0x80000000 },
{ GP4_9, 9, 0xF0FFFFFF, 0x08000000 },
{ GP4_10, 9, 0xFF0FFFFF, 0x00800000 },
{ GP4_12, 9, 0xFFFF0FFF, 0x00008000 },
{ GP4_14, 9, 0xFFFFFF0F, 0x00000080 },
{ GP5_0, 12, 0x0FFFFFFF, 0x80000000 },
{ GP5_1, 12, 0xF0FFFFFF, 0x08000000 },
{ GP5_2, 12, 0xFF0FFFFF, 0x00800000 },
{ GP5_3, 12, 0xFFF0FFFF, 0x00080000 },
{ GP5_4, 12, 0xFFFF0FFF, 0x00008000 },
{ GP5_5, 12, 0xFFFFF0FF, 0x00000800 },
{ GP5_6, 12, 0xFFFFFF0F, 0x00000080 },
{ GP5_7, 12, 0xFFFFFFF0, 0x00000008 },
{ GP5_8, 11, 0x0FFFFFFF, 0x80000000 },
{ GP5_9, 11, 0xF0FFFFFF, 0x08000000 },
{ GP5_10, 11, 0xFF0FFFFF, 0x00800000 },
{ GP5_11, 11, 0xFFF0FFFF, 0x00080000 },
{ GP5_12, 11, 0xFFFF0FFF, 0x00008000 },
{ GP5_13, 11, 0xFFFFF0FF, 0x00000800 },
{ GP5_14, 11, 0xFFFFFF0F, 0x00000080 },
{ GP5_15, 11, 0xFFFFFFF0, 0x00000008 },
{ GP6_0 , 19, 0xF0FFFFFF, 0x08000000 },
{ GP6_1, 19, 0xFF0FFFFF, 0x00800000 },
{ GP6_2, 19, 0xFFF0FFFF, 0x00080000 },
{ GP6_3, 19, 0xFFFF0FFF, 0x00008000 },
{ GP6_4, 19, 0xFFFFF0FF, 0x00000800 },
{ GP6_5, 16, 0xFFFFFF0F, 0x00000080 },
{ GP6_6, 14, 0xFFFFFF0F, 0x00000080 },
{ GP6_7, 14, 0xFFFFFFF0, 0x00000008 },
{ GP6_8, 13, 0x0FFFFFFF, 0x80000000 },
{ GP6_9, 13, 0xF0FFFFFF, 0x08000000 },
{ GP6_10, 13, 0xFF0FFFFF, 0x00800000 },
{ GP6_11, 13, 0xFFF0FFFF, 0x00080000 },
{ GP6_12, 13, 0xFFFF0FFF, 0x00008000 },
{ GP6_13, 13, 0xFFFFF0FF, 0x00000800 },
{ GP6_14, 13, 0xFFFFFF0F, 0x00000080 },
{ GP6_15, 13, 0xFFFFFFF0, 0x00000008 },
{ GP7_4, 17, 0xFF0FFFFF, 0x00800000 },
{ GP7_8, 17, 0xFFFFFF0F, 0x00000080 },
{ GP7_9, 17, 0xFFFFFFF0, 0x00000008 },
{ GP7_10, 16, 0x0FFFFFFF, 0x80000000 },
{ GP7_11, 16, 0xF0FFFFFF, 0x08000000 },
{ GP7_12, 16, 0xFF0FFFFF, 0x00800000 },
{ GP7_13, 16, 0xFFF0FFFF, 0x00080000 },
{ GP7_14, 16, 0xFFFF0FFF, 0x00008000 },
{ GP7_15, 16, 0xFFFFF0FF, 0x00000800 },
{ GP8_2 , 3 , 0xF0FFFFFF, 0x04000000 },
{ GP8_3 , 3 , 0xFF0FFFFF, 0x00400000 },
{ GP8_5 , 3 , 0xFFFF0FFF, 0x00004000 },
{ GP8_6 , 3 , 0xFFFFF0FF, 0x00000400 },
{ GP8_8 , 19, 0xFFFFFF0F, 0x00000080 },
{ GP8_9 , 19, 0xFFFFFFF0, 0x00000008 },
{ GP8_10, 18, 0x0FFFFFFF, 0x80000000 },
{ GP8_11, 18, 0xF0FFFFFF, 0x08000000 },
{ GP8_12, 18, 0xFF0FFFFF, 0x00800000 },
{ GP8_13, 18, 0xFFF0FFFF, 0x00080000 },
{ GP8_14, 18, 0xFFFF0FFF, 0x00008000 },
{ GP8_15, 18, 0xFFFFF0FF, 0x00000800 },
{ UART0_TXD, 3, 0xFF0FFFFF, 0x00200000 },
{ UART0_RXD, 3, 0xFFF0FFFF, 0x00020000 },
{ UART1_TXD, 4, 0x0FFFFFFF, 0x20000000 },
{ UART1_RXD, 4, 0xF0FFFFFF, 0x02000000 },
{ SPI0_MOSI, 3, 0xFFFF0FFF, 0x00001000 },
{ SPI0_MISO, 3, 0xFFFFF0FF, 0x00000100 },
{ SPI0_SCL, 3, 0xFFFFFFF0, 0x00000001 },
{ SPI0_CS, 3, 0xF0FFFFFF, 0x01000000 },
{ SPI1_MOSI, 5, 0xFF0FFFFF, 0x00100000 },
{ SPI1_MISO, 5, 0xFFF0FFFF, 0x00010000 },
{ SPI1_SCL, 5, 0xFFFFF0FF, 0x00000100 },
{ SPI1_CS, 5, 0xFFFF0FFF, 0x00008000 },
{ EPWM1A, 5, 0xFFFFFFF0, 0x00000002 },
{ EPWM1B, 5, 0xFFFFFF0F, 0x00000020 },
{ APWM0, 2, 0x0FFFFFFF, 0x20000000 },
{ APWM1, 1, 0x0FFFFFFF, 0x40000000 },
{ EPWM0B, 3, 0xFFFFFF0F, 0x00000020 },
{ AXR3, 2, 0xFFF0FFFF, 0x00010000 },
{ AXR4, 2, 0xFFFF0FFF, 0x00001000 },
{-1 }
};
typedef struct gpio_controller *__iomem GPIOC;
typedef struct
{
int Pin; // GPIO pin number
GPIOC pGpio; // GPIO bank base address
u32 Mask; // GPIO pin mask
}
INPIN;
#define REGUnlock {\
iowrite32(0x83E70B13,da8xx_syscfg0_base + 0x38);\
iowrite32(0x95A4F1E0,da8xx_syscfg0_base + 0x3C);\
}
#define REGLock {\
iowrite32(0x00000000,da8xx_syscfg0_base + 0x38);\
iowrite32(0x00000000,da8xx_syscfg0_base + 0x3C);\
}
#else
extern MRM MuxRegMap[];
#endif /* AM1808_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef C_BRANCH_H_
#define C_BRANCH_H_
void cBranchJr(void);
void cBranchJrFalse(void);
void cBranchJrTrue(void);
void cBranchJrNan(void);
void cBranchJrLt8(void);
void cBranchJrLt16(void);
void cBranchJrLt32(void);
void cBranchJrLtF(void);
void cBranchJrGt8(void);
void cBranchJrGt16(void);
void cBranchJrGt32(void);
void cBranchJrGtF(void);
void cBranchJrLtEq8(void);
void cBranchJrLtEq16(void);
void cBranchJrLtEq32(void);
void cBranchJrLtEqF(void);
void cBranchJrGtEq8(void);
void cBranchJrGtEq16(void);
void cBranchJrGtEq32(void);
void cBranchJrGtEqF(void);
void cBranchJrEq8(void);
void cBranchJrEq16(void);
void cBranchJrEq32(void);
void cBranchJrEqF(void);
void cBranchJrNEq8(void);
void cBranchJrNEq16(void);
void cBranchJrNEq32(void);
void cBranchJrNEqF(void);
#endif /* C_BRANCH_H_ */

View File

@ -1,81 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef C_COMPARE_H_
#define C_COMPARE_H_
void cCompareLt8(void);
void cCompareLt16(void);
void cCompareLt32(void);
void cCompareLtF(void);
void cCompareGt8(void);
void cCompareGt16(void);
void cCompareGt32(void);
void cCompareGtF(void);
void cCompareEq8(void);
void cCompareEq16(void);
void cCompareEq32(void);
void cCompareEqF(void);
void cCompareNEq8(void);
void cCompareNEq16(void);
void cCompareNEq32(void);
void cCompareNEqF(void);
void cCompareLtEq8(void);
void cCompareLtEq16(void);
void cCompareLtEq32(void);
void cCompareLtEqF(void);
void cCompareGtEq8(void);
void cCompareGtEq16(void);
void cCompareGtEq32(void);
void cCompareGtEqF(void);
void cCompareSelect8(void);
void cCompareSelect16(void);
void cCompareSelect32(void);
void cCompareSelectF(void);
#endif /* C_COMPARE_H_ */

View File

@ -1,88 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef C_MATH_H_
#define C_MATH_H_
#define DegToRad(D) (D * 0.0174532925)
#define RadToDeg(R) (R * 57.2957795)
void cMathAdd8(void);
void cMathAdd16(void);
void cMathAdd32(void);
void cMathAddF(void);
void cMathSub8(void);
void cMathSub16(void);
void cMathSub32(void);
void cMathSubF(void);
void cMathMul8(void);
void cMathMul16(void);
void cMathMul32(void);
void cMathMulF(void);
void cMathDiv8(void);
void cMathDiv16(void);
void cMathDiv32(void);
void cMathDivF(void);
void cMathOr8(void);
void cMathOr16(void);
void cMathOr32(void);
void cMathAnd8(void);
void cMathAnd16(void);
void cMathAnd32(void);
void cMathXor8(void);
void cMathXor16(void);
void cMathXor32(void);
void cMathRl8(void);
void cMathRl16(void);
void cMathRl32(void);
void cMath(void);
#endif /* C_MATH_H_ */

View File

@ -1,76 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef C_MOVE_H_
#define C_MOVE_H_
void cMove8to8(void);
void cMove8to16(void);
void cMove8to32(void);
void cMove8toF(void);
void cMove16to8(void);
void cMove16to16(void);
void cMove16to32(void);
void cMove16toF(void);
void cMove32to8(void);
void cMove32to16(void);
void cMove32to32(void);
void cMove32toF(void);
void cMoveFto8(void);
void cMoveFto16(void);
void cMoveFto32(void);
void cMoveFtoF(void);
void cMoveInitBytes(void);
void cMoveRead8(void);
void cMoveRead16(void);
void cMoveRead32(void);
void cMoveReadF(void);
void cMoveWrite8(void);
void cMoveWrite16(void);
void cMoveWrite32(void);
void cMoveWriteF(void);
#endif /* C_MOVE_H_ */

View File

@ -1,38 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef C_TIMER_H_
#define C_TIMER_H_
#if (HARDWARE != SIMULATION)
ULONG cTimerGetuS(void);
ULONG cTimerGetmS(void);
#endif
void cTimerWait(void);
void cTimerReady(void);
void cTimerRead(void);
void cTimerReaduS(void);
#endif /* C_TIMER_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,195 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* As a special exception, if other files instantiate templates or use macros or
* inline functions from this file, or you compile this file and link it with
* other works to produce a work based on this file, this file does not by itself
* cause the resulting work to be covered by the GNU General Public License.
* However the source code for this file must still be made available in accordance
* with section (3) of the GNU General Public License.
*
*/
#ifndef LMSTYPES_H_
#define LMSTYPES_H_
// BASIC DATA TYPES
#ifndef LEGO_SIMULATION
typedef unsigned char UBYTE; //!< Basic Type used to symbolise 8 bit unsigned values
typedef unsigned short UWORD; //!< Basic Type used to symbolise 16 bit unsigned values
typedef unsigned int ULONG; //!< Basic Type used to symbolise 32 bit unsigned values
typedef signed char SBYTE; //!< Basic Type used to symbolise 8 bit signed values
typedef signed short SWORD; //!< Basic Type used to symbolise 16 bit signed values
typedef signed int SLONG; //!< Basic Type used to symbolise 32 bit signed values
typedef float FLOAT; //!< Basic Type used to symbolise 32 bit floating point values
#define LFILE FILE
#else
#include <Base/BasicTypes.h>
#include <VMCalls.h>
typedef LEGO::UInt8 UBYTE; //!< Basic Type used to symbolise 8 bit unsigned values
typedef LEGO::UInt16 UWORD; //!< Basic Type used to symbolise 16 bit unsigned values
typedef unsigned long ULONG; //!< Basic Type used to symbolise 32 bit unsigned values
typedef LEGO::Int8 SBYTE; //!< Basic Type used to symbolise 8 bit signed values
typedef LEGO::Int16 SWORD; //!< Basic Type used to symbolise 16 bit signed values
typedef LEGO::Int32 SLONG; //!< Basic Type used to symbolise 32 bit signed values
typedef LEGO::Real32 FLOAT; //!< Basic Type used to symbolise 32 bit floating point values
#endif
// VM DATA TYPES
typedef SBYTE DATA8; //!< VM Type for 1 byte signed value
typedef SWORD DATA16; //!< VM Type for 2 byte signed value
typedef SLONG DATA32; //!< VM Type for 4 byte signed value
typedef FLOAT DATAF; //!< VM Type for 4 byte floating point value
// VM VARIABLE TYPES
typedef UBYTE VARDATA; //!< Variable base type
typedef UBYTE IMGDATA; //!< Image base type
typedef UWORD PRGID; //!< Program id type
typedef UWORD OBJID; //!< Object id type
typedef IMGDATA* IP; //!< Instruction pointer type
typedef VARDATA* LP; //!< Local variable pointer type
typedef VARDATA* GP; //!< global variable pointer type
typedef ULONG IMINDEX; //!< ImageData index type
typedef ULONG GBINDEX; //!< GlobalBytes index type
typedef ULONG LBINDEX; //!< LocalBytes index type
typedef UWORD TRIGGER; //!< TriggerCount type
typedef UBYTE PARS; //!< NoOfParameters type
typedef SLONG IMOFFS; //!< ImageData offset type
typedef DATA16 HANDLER; //!< Memory list index
/*! \page imagelayout Image Layout
* The image consists of three different components in this fixed order: imageheader, objectheaders and byte codes.
*
* The imageheader tells something about image version, filesize, no of objectheaders (objects) and no of global variable bytes.
*
*
* Objectheaders contains different informations depending on the nature of the object:
*
*- The VMTHREAD object (former TBC_TOPVI) \n
* - OffsetToInstructions tells were to find the corresponding byte codes (offset from image start) \n
* - OwnerObjectId must be zero \n
* - TriggerCount is used but must be zero \n
* - LocalBytes describes the number of bytes for local variables \n
*
*- The SUBCALL object (former TBC_VI and TBC_VI_ALIAS) \n
* - OffsetToInstructions tells were to find the corresponding byte codes (if alias this is equal to mother object) \n
* - OwnerObjectId must be zero \n
* - TriggerCount is used and must be one \n
* - LocalBytes describes the number of bytes for local variables \n
*
*- The BLOCK object (former CLUMP) \n
* - OffsetToInstructions tells were to find the corresponding byte codes (offset from image start) \n
* - OwnerObjectId is equal to object id it belongs to (not equal to zero) \n
* - TriggerCount is used to determine how many triggers needed before the BLOCK object is activated \n
* - LocalBytes must be zero (locals are defined in the owner object) \n
*
* Byte codes are described in a different section.
*
* Little Endian are used (addresses and data are represented with LSB on lowest address and MSB on highest address).
*
* Offset to instructions is number of bytes from start of image to start of object instructions.
*
* Index to global variables are byte based and counted from start of globals (zero based).
*
* Index to local variables are byte based and counted from start of object locals (zero based).
*
* Object ID's is not zero based - First object (VMTHEAD) is named 1.
*
*/
/*! \page imagelayout
*
* FILE layout (aligned)
*
*- IMGHEAD (aligned)
* - Sign (4 bytes)
* - ImageSize (4 bytes)
* - VersionInfo (2 bytes)
* - NumberOfObjects (2 bytes)
* - GlobalBytes (4 bytes)
*/
/*! \struct IMGHEAD
* Image header
*/
typedef struct
{
UBYTE Sign[4]; //!< Place holder for the file type identifier
IMINDEX ImageSize; //!< Image size
UWORD VersionInfo; //!< Version identifier
OBJID NumberOfObjects; //!< Total number of objects in image
GBINDEX GlobalBytes; //!< Number of bytes to allocate for global variables
}
IMGHEAD;
/*! \page imagelayout
*
*- OBJHEAD (aligned)
* - OffsetToInstructions (4 bytes)
* - OwnerObjectId (2 bytes)
* - TriggerCount (2 bytes)
* - LocalBytes (4 bytes)
*
*/
/*! \struct OBJHEAD
* Object header used for all types of objects (VMTHREAD, SUBCALL, BLOCK and ALIAS)
*/
typedef struct // Object header
{
IP OffsetToInstructions; //!< Offset to instructions from image start
OBJID OwnerObjectId; //!< Used by BLOCK's to hold the owner id
TRIGGER TriggerCount; //!< Used to determine how many triggers needed before the BLOCK object is activated
LBINDEX LocalBytes; //!< Number of bytes to allocate for local variables
}
OBJHEAD;
/*! \struct LABEL
* Label data hold information used for labels
*/
typedef struct
{
IMINDEX Addr; //!< Offset to breakpoint address from image start
}
LABEL;
#endif /* LMSTYPES_H_ */

View File

@ -1,56 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef VALIDATE_H_
#define VALIDATE_H_
RESULT cValidateInit(void);
RESULT cValidateExit(void);
RESULT cValidateDisassemble(IP pI,IMINDEX *pIndex,LABEL *pLabel);
RESULT cValidateProgram(PRGID PrgId,IP pI,LABEL *pLabel,DATA8 Disassemble);
typedef struct
{
//*****************************************************************************
// Validate Global variables
//*****************************************************************************
int Row;
IMINDEX ValidateErrorIndex;
}
VALIDATE_GLOBALS;
#ifndef LEGO_SIMULATION
extern VALIDATE_GLOBALS ValidateInstance;
#else
extern VALIDATE_GLOBALS * gValidateInstance;
#define ValidateInstance (*gValidateInstance)
void setValidateInstance(VALIDATE_GLOBALS * _Instance);
VALIDATE_GLOBALS * getValidateInstance();
#endif
#endif /* VALIDATE_H_ */

View File

@ -1,779 +0,0 @@
/*
* storage_common.c -- Common definitions for mass storage functionality
*
* Copyright (C) 2003-2008 Alan Stern
* Copyeight (C) 2009 Samsung Electronics
* Author: Michal Nazarewicz (m.nazarewicz@samsung.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file requires the following identifiers used in USB strings to
* be defined (each of type pointer to char):
* - fsg_string_manufacturer -- name of the manufacturer
* - fsg_string_product -- name of the product
* - fsg_string_serial -- product's serial
* - fsg_string_config -- name of the configuration
* - fsg_string_interface -- name of the interface
* The first four are only needed when FSG_DESCRIPTORS_DEVICE_STRINGS
* macro is defined prior to including this file.
*/
/*
* When FSG_NO_INTR_EP is defined fsg_fs_intr_in_desc and
* fsg_hs_intr_in_desc objects as well as
* FSG_FS_FUNCTION_PRE_EP_ENTRIES and FSG_HS_FUNCTION_PRE_EP_ENTRIES
* macros are not defined.
*
* When FSG_NO_DEVICE_STRINGS is defined FSG_STRING_MANUFACTURER,
* FSG_STRING_PRODUCT, FSG_STRING_SERIAL and FSG_STRING_CONFIG are not
* defined (as well as corresponding entries in string tables are
* missing) and FSG_STRING_INTERFACE has value of zero.
*
* When FSG_NO_OTG is defined fsg_otg_desc won't be defined.
*/
/*
* When FSG_BUFFHD_STATIC_BUFFER is defined when this file is included
* the fsg_buffhd structure's buf field will be an array of FSG_BUFLEN
* characters rather then a pointer to void.
*/
#include <asm/unaligned.h>
/* Thanks to NetChip Technologies for donating this product ID.
*
* DO NOT REUSE THESE IDs with any other driver!! Ever!!
* Instead: allocate your own, using normal USB-IF procedures. */
#define FSG_VENDOR_ID 0x0525 /* NetChip */
#define FSG_PRODUCT_ID 0xa4a5 /* Linux-USB File-backed Storage Gadget */
/*-------------------------------------------------------------------------*/
#ifndef DEBUG
#undef VERBOSE_DEBUG
#undef DUMP_MSGS
#endif /* !DEBUG */
#ifdef VERBOSE_DEBUG
#define VLDBG LDBG
#else
#define VLDBG(lun, fmt, args...) do { } while (0)
#endif /* VERBOSE_DEBUG */
#define LDBG(lun, fmt, args...) dev_dbg (&(lun)->dev, fmt, ## args)
#define LERROR(lun, fmt, args...) dev_err (&(lun)->dev, fmt, ## args)
#define LWARN(lun, fmt, args...) dev_warn(&(lun)->dev, fmt, ## args)
#define LINFO(lun, fmt, args...) dev_info(&(lun)->dev, fmt, ## args)
/* Keep those macros in sync with thos in
* include/linux/ubs/composite.h or else GCC will complain. If they
* are identical (the same names of arguments, white spaces in the
* same places) GCC will allow redefinition otherwise (even if some
* white space is removed or added) warning will be issued. No
* checking if those symbols is defined is performed because warning
* is desired when those macros were defined by someone else to mean
* something else. */
#define DBG(d, fmt, args...) dev_dbg(&(d)->gadget->dev , fmt , ## args)
#define VDBG(d, fmt, args...) dev_vdbg(&(d)->gadget->dev , fmt , ## args)
#define ERROR(d, fmt, args...) dev_err(&(d)->gadget->dev , fmt , ## args)
#define WARNING(d, fmt, args...) dev_warn(&(d)->gadget->dev , fmt , ## args)
#define INFO(d, fmt, args...) dev_info(&(d)->gadget->dev , fmt , ## args)
#ifdef DUMP_MSGS
# define dump_msg(fsg, /* const char * */ label, \
/* const u8 * */ buf, /* unsigned */ length) do { \
if (length < 512) { \
DBG(fsg, "%s, length %u:\n", label, length); \
print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, \
16, 1, buf, length, 0); \
} \
} while (0)
# define dump_cdb(fsg) do { } while (0)
#else
# define dump_msg(fsg, /* const char * */ label, \
/* const u8 * */ buf, /* unsigned */ length) do { } while (0)
# ifdef VERBOSE_DEBUG
# define dump_cdb(fsg) \
print_hex_dump(KERN_DEBUG, "SCSI CDB: ", DUMP_PREFIX_NONE, \
16, 1, (fsg)->cmnd, (fsg)->cmnd_size, 0) \
# else
# define dump_cdb(fsg) do { } while (0)
# endif /* VERBOSE_DEBUG */
#endif /* DUMP_MSGS */
/*-------------------------------------------------------------------------*/
/* SCSI device types */
#define TYPE_DISK 0x00
#define TYPE_CDROM 0x05
/* USB protocol value = the transport method */
#define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */
#define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */
#define USB_PR_BULK 0x50 /* Bulk-only */
/* USB subclass value = the protocol encapsulation */
#define USB_SC_RBC 0x01 /* Reduced Block Commands (flash) */
#define USB_SC_8020 0x02 /* SFF-8020i, MMC-2, ATAPI (CD-ROM) */
#define USB_SC_QIC 0x03 /* QIC-157 (tape) */
#define USB_SC_UFI 0x04 /* UFI (floppy) */
#define USB_SC_8070 0x05 /* SFF-8070i (removable) */
#define USB_SC_SCSI 0x06 /* Transparent SCSI */
/* Bulk-only data structures */
/* Command Block Wrapper */
struct fsg_bulk_cb_wrap {
__le32 Signature; /* Contains 'USBC' */
u32 Tag; /* Unique per command id */
__le32 DataTransferLength; /* Size of the data */
u8 Flags; /* Direction in bit 7 */
u8 Lun; /* LUN (normally 0) */
u8 Length; /* Of the CDB, <= MAX_COMMAND_SIZE */
u8 CDB[16]; /* Command Data Block */
};
#define USB_BULK_CB_WRAP_LEN 31
#define USB_BULK_CB_SIG 0x43425355 /* Spells out USBC */
#define USB_BULK_IN_FLAG 0x80
/* Command Status Wrapper */
struct bulk_cs_wrap {
__le32 Signature; /* Should = 'USBS' */
u32 Tag; /* Same as original command */
__le32 Residue; /* Amount not transferred */
u8 Status; /* See below */
};
#define USB_BULK_CS_WRAP_LEN 13
#define USB_BULK_CS_SIG 0x53425355 /* Spells out 'USBS' */
#define USB_STATUS_PASS 0
#define USB_STATUS_FAIL 1
#define USB_STATUS_PHASE_ERROR 2
/* Bulk-only class specific requests */
#define USB_BULK_RESET_REQUEST 0xff
#define USB_BULK_GET_MAX_LUN_REQUEST 0xfe
/* CBI Interrupt data structure */
struct interrupt_data {
u8 bType;
u8 bValue;
};
#define CBI_INTERRUPT_DATA_LEN 2
/* CBI Accept Device-Specific Command request */
#define USB_CBI_ADSC_REQUEST 0x00
/* Length of a SCSI Command Data Block */
#define MAX_COMMAND_SIZE 16
/* SCSI commands that we recognize */
#define SC_FORMAT_UNIT 0x04
#define SC_INQUIRY 0x12
#define SC_MODE_SELECT_6 0x15
#define SC_MODE_SELECT_10 0x55
#define SC_MODE_SENSE_6 0x1a
#define SC_MODE_SENSE_10 0x5a
#define SC_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
#define SC_READ_6 0x08
#define SC_READ_10 0x28
#define SC_READ_12 0xa8
#define SC_READ_CAPACITY 0x25
#define SC_READ_FORMAT_CAPACITIES 0x23
#define SC_READ_HEADER 0x44
#define SC_READ_TOC 0x43
#define SC_RELEASE 0x17
#define SC_REQUEST_SENSE 0x03
#define SC_RESERVE 0x16
#define SC_SEND_DIAGNOSTIC 0x1d
#define SC_START_STOP_UNIT 0x1b
#define SC_SYNCHRONIZE_CACHE 0x35
#define SC_TEST_UNIT_READY 0x00
#define SC_VERIFY 0x2f
#define SC_WRITE_6 0x0a
#define SC_WRITE_10 0x2a
#define SC_WRITE_12 0xaa
/* SCSI Sense Key/Additional Sense Code/ASC Qualifier values */
#define SS_NO_SENSE 0
#define SS_COMMUNICATION_FAILURE 0x040800
#define SS_INVALID_COMMAND 0x052000
#define SS_INVALID_FIELD_IN_CDB 0x052400
#define SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x052100
#define SS_LOGICAL_UNIT_NOT_SUPPORTED 0x052500
#define SS_MEDIUM_NOT_PRESENT 0x023a00
#define SS_MEDIUM_REMOVAL_PREVENTED 0x055302
#define SS_NOT_READY_TO_READY_TRANSITION 0x062800
#define SS_RESET_OCCURRED 0x062900
#define SS_SAVING_PARAMETERS_NOT_SUPPORTED 0x053900
#define SS_UNRECOVERED_READ_ERROR 0x031100
#define SS_WRITE_ERROR 0x030c02
#define SS_WRITE_PROTECTED 0x072700
#define SK(x) ((u8) ((x) >> 16)) /* Sense Key byte, etc. */
#define ASC(x) ((u8) ((x) >> 8))
#define ASCQ(x) ((u8) (x))
/*-------------------------------------------------------------------------*/
struct fsg_lun {
struct file *filp;
loff_t file_length;
loff_t num_sectors;
unsigned int initially_ro:1;
unsigned int ro:1;
unsigned int removable:1;
unsigned int cdrom:1;
unsigned int prevent_medium_removal:1;
unsigned int registered:1;
unsigned int info_valid:1;
u32 sense_data;
u32 sense_data_info;
u32 unit_attention_data;
struct device dev;
};
#define fsg_lun_is_open(curlun) ((curlun)->filp != NULL)
static struct fsg_lun *fsg_lun_from_dev(struct device *dev)
{
return container_of(dev, struct fsg_lun, dev);
}
/* Big enough to hold our biggest descriptor */
#define EP0_BUFSIZE 256
#define DELAYED_STATUS (EP0_BUFSIZE + 999) /* An impossibly large value */
/* Number of buffers we will use. 2 is enough for double-buffering */
#define FSG_NUM_BUFFERS 2
/* Default size of buffer length. */
#define FSG_BUFLEN ((u32)16384)
/* Maximal number of LUNs supported in mass storage function */
#define FSG_MAX_LUNS 8
enum fsg_buffer_state {
BUF_STATE_EMPTY = 0,
BUF_STATE_FULL,
BUF_STATE_BUSY
};
struct fsg_buffhd {
#ifdef FSG_BUFFHD_STATIC_BUFFER
char buf[FSG_BUFLEN];
#else
void *buf;
#endif
enum fsg_buffer_state state;
struct fsg_buffhd *next;
/* The NetChip 2280 is faster, and handles some protocol faults
* better, if we don't submit any short bulk-out read requests.
* So we will record the intended request length here. */
unsigned int bulk_out_intended_length;
struct usb_request *inreq;
int inreq_busy;
struct usb_request *outreq;
int outreq_busy;
};
enum fsg_state {
/* This one isn't used anywhere */
FSG_STATE_COMMAND_PHASE = -10,
FSG_STATE_DATA_PHASE,
FSG_STATE_STATUS_PHASE,
FSG_STATE_IDLE = 0,
FSG_STATE_ABORT_BULK_OUT,
FSG_STATE_RESET,
FSG_STATE_INTERFACE_CHANGE,
FSG_STATE_CONFIG_CHANGE_DISABLE,
FSG_STATE_CONFIG_CHANGE,
FSG_STATE_DISCONNECT,
FSG_STATE_EXIT,
FSG_STATE_TERMINATED
};
enum data_direction {
DATA_DIR_UNKNOWN = 0,
DATA_DIR_FROM_HOST,
DATA_DIR_TO_HOST,
DATA_DIR_NONE
};
/*-------------------------------------------------------------------------*/
static inline u32 get_unaligned_be24(u8 *buf)
{
return 0xffffff & (u32) get_unaligned_be32(buf - 1);
}
/*-------------------------------------------------------------------------*/
enum {
#ifndef FSG_NO_DEVICE_STRINGS
FSG_STRING_MANUFACTURER = 1,
FSG_STRING_PRODUCT,
FSG_STRING_SERIAL,
FSG_STRING_CONFIG,
#endif
FSG_STRING_INTERFACE
};
#ifndef FSG_NO_OTG
static struct usb_otg_descriptor
fsg_otg_desc = {
.bLength = sizeof fsg_otg_desc,
.bDescriptorType = USB_DT_OTG,
.bmAttributes = USB_OTG_SRP,
};
#endif
/* There is only one interface. */
static struct usb_interface_descriptor
fsg_intf_desc = {
.bLength = sizeof fsg_intf_desc,
.bDescriptorType = USB_DT_INTERFACE,
.bNumEndpoints = 2, /* Adjusted during fsg_bind() */
.bInterfaceClass = USB_CLASS_MASS_STORAGE,
.bInterfaceSubClass = USB_SC_SCSI, /* Adjusted during fsg_bind() */
.bInterfaceProtocol = USB_PR_BULK, /* Adjusted during fsg_bind() */
.iInterface = FSG_STRING_INTERFACE,
};
/* Three full-speed endpoint descriptors: bulk-in, bulk-out,
* and interrupt-in. */
static struct usb_endpoint_descriptor
fsg_fs_bulk_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
/* wMaxPacketSize set by autoconfiguration */
};
static struct usb_endpoint_descriptor
fsg_fs_bulk_out_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
/* wMaxPacketSize set by autoconfiguration */
};
#ifndef FSG_NO_INTR_EP
static struct usb_endpoint_descriptor
fsg_fs_intr_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(2),
.bInterval = 32, /* frames -> 32 ms */
};
#ifndef FSG_NO_OTG
# define FSG_FS_FUNCTION_PRE_EP_ENTRIES 2
#else
# define FSG_FS_FUNCTION_PRE_EP_ENTRIES 1
#endif
#endif
static struct usb_descriptor_header *fsg_fs_function[] = {
#ifndef FSG_NO_OTG
(struct usb_descriptor_header *) &fsg_otg_desc,
#endif
(struct usb_descriptor_header *) &fsg_intf_desc,
(struct usb_descriptor_header *) &fsg_fs_bulk_in_desc,
(struct usb_descriptor_header *) &fsg_fs_bulk_out_desc,
#ifndef FSG_NO_INTR_EP
(struct usb_descriptor_header *) &fsg_fs_intr_in_desc,
#endif
NULL,
};
/*
* USB 2.0 devices need to expose both high speed and full speed
* descriptors, unless they only run at full speed.
*
* That means alternate endpoint descriptors (bigger packets)
* and a "device qualifier" ... plus more construction options
* for the config descriptor.
*/
static struct usb_endpoint_descriptor
fsg_hs_bulk_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
/* bEndpointAddress copied from fs_bulk_in_desc during fsg_bind() */
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16(512),
};
static struct usb_endpoint_descriptor
fsg_hs_bulk_out_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
/* bEndpointAddress copied from fs_bulk_out_desc during fsg_bind() */
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16(512),
.bInterval = 1, /* NAK every 1 uframe */
};
#ifndef FSG_NO_INTR_EP
static struct usb_endpoint_descriptor
fsg_hs_intr_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
/* bEndpointAddress copied from fs_intr_in_desc during fsg_bind() */
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(2),
.bInterval = 9, /* 2**(9-1) = 256 uframes -> 32 ms */
};
#ifndef FSG_NO_OTG
# define FSG_HS_FUNCTION_PRE_EP_ENTRIES 2
#else
# define FSG_HS_FUNCTION_PRE_EP_ENTRIES 1
#endif
#endif
static struct usb_descriptor_header *fsg_hs_function[] = {
#ifndef FSG_NO_OTG
(struct usb_descriptor_header *) &fsg_otg_desc,
#endif
(struct usb_descriptor_header *) &fsg_intf_desc,
(struct usb_descriptor_header *) &fsg_hs_bulk_in_desc,
(struct usb_descriptor_header *) &fsg_hs_bulk_out_desc,
#ifndef FSG_NO_INTR_EP
(struct usb_descriptor_header *) &fsg_hs_intr_in_desc,
#endif
NULL,
};
/* Maxpacket and other transfer characteristics vary by speed. */
static struct usb_endpoint_descriptor *
fsg_ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *fs,
struct usb_endpoint_descriptor *hs)
{
if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
return hs;
return fs;
}
/* Static strings, in UTF-8 (for simplicity we use only ASCII characters) */
static struct usb_string fsg_strings[] = {
#ifndef FSG_NO_DEVICE_STRINGS
{FSG_STRING_MANUFACTURER, fsg_string_manufacturer},
{FSG_STRING_PRODUCT, fsg_string_product},
{FSG_STRING_SERIAL, fsg_string_serial},
{FSG_STRING_CONFIG, fsg_string_config},
#endif
{FSG_STRING_INTERFACE, fsg_string_interface},
{}
};
static struct usb_gadget_strings fsg_stringtab = {
.language = 0x0409, /* en-us */
.strings = fsg_strings,
};
/*-------------------------------------------------------------------------*/
/* If the next two routines are called while the gadget is registered,
* the caller must own fsg->filesem for writing. */
static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
{
int ro;
struct file *filp = NULL;
int rc = -EINVAL;
struct inode *inode = NULL;
loff_t size;
loff_t num_sectors;
loff_t min_sectors;
/* R/W if we can, R/O if we must */
ro = curlun->initially_ro;
if (!ro) {
filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0);
if (-EROFS == PTR_ERR(filp))
ro = 1;
}
if (ro)
filp = filp_open(filename, O_RDONLY | O_LARGEFILE, 0);
if (IS_ERR(filp)) {
LINFO(curlun, "unable to open backing file: %s\n", filename);
return PTR_ERR(filp);
}
if (!(filp->f_mode & FMODE_WRITE))
ro = 1;
if (filp->f_path.dentry)
inode = filp->f_path.dentry->d_inode;
if (inode && S_ISBLK(inode->i_mode)) {
if (bdev_read_only(inode->i_bdev))
ro = 1;
} else if (!inode || !S_ISREG(inode->i_mode)) {
LINFO(curlun, "invalid file type: %s\n", filename);
goto out;
}
/* If we can't read the file, it's no good.
* If we can't write the file, use it read-only. */
if (!filp->f_op || !(filp->f_op->read || filp->f_op->aio_read)) {
LINFO(curlun, "file not readable: %s\n", filename);
goto out;
}
if (!(filp->f_op->write || filp->f_op->aio_write))
ro = 1;
size = i_size_read(inode->i_mapping->host);
if (size < 0) {
LINFO(curlun, "unable to find file size: %s\n", filename);
rc = (int) size;
goto out;
}
num_sectors = size >> 9; /* File size in 512-byte blocks */
min_sectors = 1;
if (curlun->cdrom) {
num_sectors &= ~3; /* Reduce to a multiple of 2048 */
min_sectors = 300*4; /* Smallest track is 300 frames */
if (num_sectors >= 256*60*75*4) {
num_sectors = (256*60*75 - 1) * 4;
LINFO(curlun, "file too big: %s\n", filename);
LINFO(curlun, "using only first %d blocks\n",
(int) num_sectors);
}
}
if (num_sectors < min_sectors) {
LINFO(curlun, "file too small: %s\n", filename);
rc = -ETOOSMALL;
goto out;
}
get_file(filp);
curlun->ro = ro;
curlun->filp = filp;
curlun->file_length = size;
curlun->num_sectors = num_sectors;
LDBG(curlun, "open backing file: %s\n", filename);
rc = 0;
out:
filp_close(filp, current->files);
return rc;
}
static void fsg_lun_close(struct fsg_lun *curlun)
{
if (curlun->filp) {
LDBG(curlun, "close backing file\n");
fput(curlun->filp);
curlun->filp = NULL;
}
}
/*-------------------------------------------------------------------------*/
/* Sync the file data, don't bother with the metadata.
* This code was copied from fs/buffer.c:sys_fdatasync(). */
static int fsg_lun_fsync_sub(struct fsg_lun *curlun)
{
struct file *filp = curlun->filp;
if (curlun->ro || !filp)
return 0;
return vfs_fsync(filp, filp->f_path.dentry, 1);
}
static void store_cdrom_address(u8 *dest, int msf, u32 addr)
{
if (msf) {
/* Convert to Minutes-Seconds-Frames */
addr >>= 2; /* Convert to 2048-byte frames */
addr += 2*75; /* Lead-in occupies 2 seconds */
dest[3] = addr % 75; /* Frames */
addr /= 75;
dest[2] = addr % 60; /* Seconds */
addr /= 60;
dest[1] = addr; /* Minutes */
dest[0] = 0; /* Reserved */
} else {
/* Absolute sector */
put_unaligned_be32(addr, dest);
}
}
/*-------------------------------------------------------------------------*/
static ssize_t fsg_show_ro(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct fsg_lun *curlun = fsg_lun_from_dev(dev);
return sprintf(buf, "%d\n", fsg_lun_is_open(curlun)
? curlun->ro
: curlun->initially_ro);
}
static ssize_t fsg_show_file(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct fsg_lun *curlun = fsg_lun_from_dev(dev);
struct rw_semaphore *filesem = dev_get_drvdata(dev);
char *p;
ssize_t rc;
down_read(filesem);
if (fsg_lun_is_open(curlun)) { /* Get the complete pathname */
p = d_path(&curlun->filp->f_path, buf, PAGE_SIZE - 1);
if (IS_ERR(p))
rc = PTR_ERR(p);
else {
rc = strlen(p);
memmove(buf, p, rc);
buf[rc] = '\n'; /* Add a newline */
buf[++rc] = 0;
}
} else { /* No file, return 0 bytes */
*buf = 0;
rc = 0;
}
up_read(filesem);
return rc;
}
static ssize_t fsg_store_ro(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
ssize_t rc = count;
struct fsg_lun *curlun = fsg_lun_from_dev(dev);
struct rw_semaphore *filesem = dev_get_drvdata(dev);
int i;
if (sscanf(buf, "%d", &i) != 1)
return -EINVAL;
/* Allow the write-enable status to change only while the backing file
* is closed. */
down_read(filesem);
if (fsg_lun_is_open(curlun)) {
LDBG(curlun, "read-only status change prevented\n");
rc = -EBUSY;
} else {
curlun->ro = !!i;
curlun->initially_ro = !!i;
LDBG(curlun, "read-only status set to %d\n", curlun->ro);
}
up_read(filesem);
return rc;
}
static ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct fsg_lun *curlun = fsg_lun_from_dev(dev);
struct rw_semaphore *filesem = dev_get_drvdata(dev);
int rc = 0;
if (curlun->prevent_medium_removal && fsg_lun_is_open(curlun)) {
LDBG(curlun, "eject attempt prevented\n");
return -EBUSY; /* "Door is locked" */
}
/* Remove a trailing newline */
if (count > 0 && buf[count-1] == '\n')
((char *) buf)[count-1] = 0; /* Ugh! */
/* Eject current medium */
down_write(filesem);
if (fsg_lun_is_open(curlun)) {
fsg_lun_close(curlun);
curlun->unit_attention_data = SS_MEDIUM_NOT_PRESENT;
}
/* Load new medium */
if (count > 0 && buf[0]) {
rc = fsg_lun_open(curlun, buf);
if (rc == 0)
curlun->unit_attention_data =
SS_NOT_READY_TO_READY_TRANSITION;
}
up_write(filesem);
return (rc < 0 ? rc : count);
}

View File

@ -1,738 +0,0 @@
/*
* LEGO® MINDSTORMS EV3
*
* Copyright (C) 2010-2013 The LEGO Group
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* This UsbFunction file is based on and inheritated from
* the original file (f_sourcesink.c) and work done by
* David Brownell
*
* >> f_sourcesink.c - USB peripheral source/sink configuration driver <<
*
* >> Copyright (C) 2003-2008 David Brownell <<
* >> Copyright (C) 2008 by Nokia Corporation <<
*
*/
/*
*
* HID IN/OUT Interrupt transfer FUNCTION ...
*
*/
struct f_rudolf {
struct usb_function function;
struct usb_ep *in_ep;
struct usb_ep *out_ep;
};
enum // Used for signaling the IN stuff USB-state
{ // Data from the Brick to the HOST
USB_DATA_IDLE, //
USB_DATA_BUSY, // Ongoing USB request
USB_DATA_PENDING, // Data ready for X-fer, but USB busy
USB_DATA_READY, // Initial setting
};
int input_state = USB_DATA_IDLE;
struct usb_ep *save_in_ep;
struct usb_request *save_in_req;
#ifndef PCASM
static inline struct f_rudolf *func_to_rudolf(struct usb_function *f)
{
return container_of(f, struct f_rudolf, function);
}
#else
// Keep Eclipse happy
#endif
static struct usb_interface_descriptor rudolf_intf = {
.bLength = sizeof rudolf_intf,
.bDescriptorType = USB_DT_INTERFACE,
.bInterfaceNumber = 0,
.bAlternateSetting = 0,
.bNumEndpoints = 2, // Just plain in and out
.bInterfaceClass = USB_CLASS_HID, // We go for NONE custom-driver
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
/* .iInterface = DYNAMIC */
};
static struct hid_descriptor hs_hid_rudolf_desc = {
.bLength = sizeof hs_hid_rudolf_desc,
.bDescriptorType = HID_DT_HID,
.bcdHID = cpu_to_le16(0x0110),
.bCountryCode = 0x00,
.bNumDescriptors = 0x01, // "The one and only"
.desc[0].bDescriptorType = 0x22, // Report Descriptor Type - 0x22 = HID
.desc[0].wDescriptorLength = sizeof hs_hid_report_descriptor,
/*.desc[0].bDescriptorType = DYNAMIC */
/*.desc[0].wDescriptorLenght= DYNAMIC */
};
static struct hid_descriptor fs_hid_rudolf_desc = {
.bLength = sizeof fs_hid_rudolf_desc,
.bDescriptorType = HID_DT_HID,
.bcdHID = cpu_to_le16(0x0110),
.bCountryCode = 0x00,
.bNumDescriptors = 0x01, // "The one and only"
.desc[0].bDescriptorType = 0x22, // Report Descriptor Type - 0x22 = HID
.desc[0].wDescriptorLength = sizeof fs_hid_report_descriptor,
};
/* full speed support: */
static struct usb_endpoint_descriptor rudolf_out_fs_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(64),
.bInterval = 1, /* 1 = 1 mSec POLL rate for FS */
};
static struct usb_endpoint_descriptor rudolf_in_fs_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(64),
.bInterval = 1, /* 1 = 1 mSec POLL rate for FS */
};
/* high speed support: */
static struct usb_endpoint_descriptor rudolf_in_hs_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(1024),
.bInterval = 4, /* Calculated as :
* 2^(value-1) * 125uS
* i.e. value 1: 2^(1-1) * 125 uSec = 125 uSec
* - 4: 2^(4-1) * 125 uSec = 1 mSec
*/
};
static struct usb_endpoint_descriptor rudolf_out_hs_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(1024),
.bInterval = 4, /* Calculated as :
* 2^(value-1) * 125uS
* i.e. value 1: 2^(1-1) * 125 uSec = 125 uSec
* - 4: 2^(4-1) * 125 uSec = 1 mSec
*/
};
static struct usb_descriptor_header *hs_rudolf_descs[] = {
(struct usb_descriptor_header *) &rudolf_intf,
(struct usb_descriptor_header *) &hs_hid_rudolf_desc,
(struct usb_descriptor_header *) &rudolf_in_hs_desc,
(struct usb_descriptor_header *) &rudolf_out_hs_desc,
NULL,
};
static struct usb_descriptor_header *fs_rudolf_descs[] = {
(struct usb_descriptor_header *) &rudolf_intf,
(struct usb_descriptor_header *) &fs_hid_rudolf_desc,
(struct usb_descriptor_header *) &rudolf_in_fs_desc,
(struct usb_descriptor_header *) &rudolf_out_fs_desc,
NULL,
};
/* function-specific strings: */
static struct usb_string strings_rudolf[] = {
[0].s = "Xfer data to and from EV3 brick",
{ } /* end of list */
};
static struct usb_gadget_strings stringtab_rudolf = {
.language = 0x0409, /* en-us */
.strings = strings_rudolf,
};
static struct usb_gadget_strings *rudolf_strings[] = {
&stringtab_rudolf,
NULL,
};
/*-------------------------------------------------------------------------*/
static int
f_rudolf_bind(struct usb_configuration *c, struct usb_function *f)
{
struct usb_composite_dev *cdev = c->cdev;
struct f_rudolf *rudolf = func_to_rudolf(f);
int id;
/* allocate interface ID(s) */
id = usb_interface_id(c, f);
if (id < 0)
return id;
rudolf_intf.bInterfaceNumber = id;
/* allocate endpoints */
rudolf->in_ep = usb_ep_autoconfig(cdev->gadget, &rudolf_in_fs_desc);
if (!rudolf->in_ep) {
autoconf_fail:
ERROR(cdev, "%s: can't autoconfigure on %s\n",
f->name, cdev->gadget->name);
return -ENODEV;
}
rudolf->in_ep->driver_data = cdev; /* claim */
rudolf->out_ep = usb_ep_autoconfig(cdev->gadget, &rudolf_out_fs_desc);
if (!rudolf->out_ep)
goto autoconf_fail;
rudolf->out_ep->driver_data = cdev; /* claim */
/* support high speed hardware */
if (gadget_is_dualspeed(c->cdev->gadget)) {
rudolf_in_hs_desc.bEndpointAddress =
rudolf_in_fs_desc.bEndpointAddress;
rudolf_out_hs_desc.bEndpointAddress =
rudolf_out_fs_desc.bEndpointAddress;
f->hs_descriptors = hs_rudolf_descs;
f->descriptors = fs_rudolf_descs;
}
DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n",
gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
f->name, rudolf->in_ep->name, rudolf->out_ep->name);
return 0;
}
static void
f_rudolf_unbind(struct usb_configuration *c, struct usb_function *f)
{
kfree(func_to_rudolf(f));
}
static void usb_req_arm(struct usb_ep *ep, struct usb_request *req)
{
int status;
if (UsbSpeed.Speed == FULL_SPEED)
{
req->length = 64;
req->actual = 64;
}
else
{
req->length = 1024;
req->actual = 1024;
}
status = usb_ep_queue(ep, req, GFP_ATOMIC);
if (status) {
usb_ep_set_halt(ep);
/* FIXME recover later ... somehow */
}
}
static int read_data_from_host(struct usb_request *req)
{
unsigned i;
u8 *buf = req->buf;
int from_host_length = 0; // NO ACCESS LOCKS YET
// test for actual length > 0
for (i = 0; i < req->actual; i++, buf++)
{
usb_char_buffer_out[i] = *buf;
from_host_length++;
}
return (from_host_length);
}
static void write_data_to_the_host(struct usb_ep *ep, struct usb_request *req)
{
unsigned i;
u8 *buf = req->buf;
//#define DEBUG
#ifdef DEBUG
printk("WR to HOST req->length = %d\r\n", req->length);
#endif
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
printk("USB = %d, %d\r\n", usb_char_buffer_in[2], usb_char_buffer_in[3]);
#endif
#undef DEBUG
for (i = 0; i < req->length; i++)
*buf++ = usb_char_buffer_in[i];
usb_char_in_length = 0; // Reset and ready
}
static void rudolf_complete(struct usb_ep *ep, struct usb_request *req)
{
struct f_rudolf *rudolf = ep->driver_data;
int status = req->status;
switch ( status ) {
case 0: /* normal completion? */
if (ep == rudolf->out_ep) // An OUT completion?
{
//#define DEBUG
#ifdef DEBUG
printk("Rudolf_complete OUT\n");
#endif
usb_char_out_length = read_data_from_host(req);
usb_req_arm(ep, req);
}
else // We have an INPUT request complete
{
//#define DEBUG
#ifdef DEBUG
printk("Rudolf_complete IN\n");
#endif
switch(input_state) // State of Brick data x-fer
{
case USB_DATA_READY: //should be BUSY or PENDING....
#ifdef DEBUG
printk("IN_IN_IN - READY ?????\n");
#endif
break;
case USB_DATA_PENDING: //
// #define DEBUG
#ifdef DEBUG
printk("IN_IN_IN - PENDING settes to BUSY\n");
#endif
input_state = USB_DATA_BUSY;
write_data_to_the_host(ep, req);
usb_req_arm(ep, req); // new request
break;
case USB_DATA_BUSY: //
#ifdef DEBUG
printk("IN_IN_IN - BUSY settes to READY\n");
#endif
#undef DEBUG
input_state = USB_DATA_READY;
// and relax
break;
case USB_DATA_IDLE: // too lazy
#ifdef DEBUG
printk("IN_IN_IN - IDLE\n");
#endif
//#undef DEBUG
break;
default: break; // hmmm.
}
// Reset the buffer size - Ready again
usb_char_in_length = 0;
}
break;
/* this endpoint is normally active while we're configured */
case -ESHUTDOWN: /* disconnect from host */
// REMOVED 26102012 (*pUsbSpeed).Speed = FULL_SPEED;
case -ECONNABORTED: /* hardware forced ep reset */
case -ECONNRESET: /* request dequeued */
//case -ESHUTDOWN: /* disconnect from host */
if (ep == rudolf->out_ep)
read_data_from_host(req);
free_ep_req(ep, req);
return;
case -EOVERFLOW: /* buffer overrun on read means that
we didn't provide a big enough
buffer.
*/
default:
//#if 1
// DBG(cdev, "%s complete --> %d, %d/%d\n", ep->name,
// status, req->actual, req->length);
//#endif
case -EREMOTEIO: /* short read */
break;
}
}
static int rudolf_start_ep(struct f_rudolf *rudolf, bool is_in)
{
struct usb_ep *ep;
struct usb_request *req;
int status;
ep = is_in ? rudolf->in_ep : rudolf->out_ep;
req = alloc_ep_req(ep);
if (!req)
return -ENOMEM;
req->complete = rudolf_complete;
#ifdef DEBUG
printk("UsbSpeed.Speed = %d\n\r", UsbSpeed.Speed);
#endif
if (UsbSpeed.Speed == FULL_SPEED)
{
#ifdef DEBUG
printk("rudolf_start_ep FULL\n\r");
#endif
(*pUsbSpeed).Speed = FULL_SPEED;
req->length = 64; // Full speed max buffer size
req->actual = 64;
}
else
{
#ifdef DEBUG
printk("rudolf_start_ep HIGH\n\r");
#endif
(*pUsbSpeed).Speed = HIGH_SPEED;
req->length = 1024; // High speed max buffer size
req->actual = 1024;
}
if (is_in)
{
save_in_ep = ep;
save_in_req = req;
#ifdef DEBUG
printk("req->length = %d ***** Rudolf_Start_Ep_in\n\r", req->length);
#endif
// reinit_write_data(ep, req);
input_state = USB_DATA_BUSY;
}
else
{
#ifdef DEBUG
printk("***** Rudolf_Start_Ep_out\n");
#endif
}
status = usb_ep_queue(ep, req, GFP_ATOMIC);
if (status) {
struct usb_composite_dev *cdev;
cdev = rudolf->function.config->cdev;
ERROR(cdev, "start %s %s --> %d\n",
is_in ? "IN" : "OUT",
ep->name, status);
free_ep_req(ep, req);
}
return status;
}
static void disable_rudolf(struct f_rudolf *rudolf)
{
struct usb_composite_dev *cdev;
cdev = rudolf->function.config->cdev;
disable_endpoints(cdev, rudolf->in_ep, rudolf->out_ep);
VDBG(cdev, "%s disabled\n", rudolf->function.name);
}
static int
enable_rudolf(struct usb_composite_dev *cdev, struct f_rudolf *rudolf)
{
int result = 0;
const struct usb_endpoint_descriptor *ep_in, *ep_out;
struct usb_ep *ep;
ep_in = ep_choose(cdev->gadget, &rudolf_in_hs_desc, &rudolf_in_fs_desc);
ep_out = ep_choose(cdev->gadget, &rudolf_out_hs_desc, &rudolf_out_fs_desc);
ep = rudolf->in_ep;
result = usb_ep_enable(ep, ep_in);
if (result < 0)
return result;
ep->driver_data = rudolf;
result = rudolf_start_ep(rudolf, true);
if (result < 0) {
fail:
ep = rudolf->in_ep;
usb_ep_disable(ep);
ep->driver_data = NULL;
return result;
}
/* one endpoint reads (sinks) anything OUT (from the host) */
ep = rudolf->out_ep;
result = usb_ep_enable(ep, ep_out);
if (result < 0)
goto fail;
ep->driver_data = rudolf;
result = rudolf_start_ep(rudolf, false);
if (result < 0) {
usb_ep_disable(ep);
ep->driver_data = NULL;
goto fail;
}
DBG(cdev, "%s enabled\n", rudolf->function.name);
return result;
}
static int f_rudolf_set_alt(struct usb_function *f,
unsigned intf, unsigned alt)
{
struct f_rudolf *rudolf = func_to_rudolf(f);
struct usb_composite_dev *cdev = f->config->cdev;
/* we know alt is zero */
if (rudolf->in_ep->driver_data)
disable_rudolf(rudolf);
return enable_rudolf(cdev, rudolf);
}
static void f_rudolf_disable(struct usb_function *f)
{
struct f_rudolf *rudolf = func_to_rudolf(f);
disable_rudolf(rudolf);
}
/*-------------------------------------------------------------------------*/
static int msg_config(struct usb_configuration *c);
static int rudolf_bind_config(struct usb_configuration *c)
{
struct f_rudolf *rudolf;
int status;
rudolf = kzalloc(sizeof *rudolf, GFP_KERNEL);
if (!rudolf)
return -ENOMEM;
rudolf->function.name = "rudolf xfer";
rudolf->function.descriptors = hs_rudolf_descs;
rudolf->function.bind = f_rudolf_bind;
rudolf->function.unbind = f_rudolf_unbind;
rudolf->function.set_alt = f_rudolf_set_alt;
rudolf->function.disable = f_rudolf_disable;
status = usb_add_function(c, &rudolf->function);
if (status) {
kfree(rudolf);
return status;
}
status = msg_config(c);
if (status) {
kfree(rudolf);
return status;
}
return status;
}
#ifndef PCASM
static int rudolf_setup(struct usb_configuration *c,
const struct usb_ctrlrequest *ctrl)
{
struct usb_request *req = c->cdev->req;
int value = -EOPNOTSUPP;
u16 w_index = le16_to_cpu(ctrl->wIndex);
u16 w_value = le16_to_cpu(ctrl->wValue);
u16 w_length = le16_to_cpu(ctrl->wLength);
u16 length = 0;
/* composite driver infrastructure handles everything except
* the two control test requests.
*/
switch (ctrl->bRequest) {
/*
* These are the same vendor-specific requests supported by
* Intel's USB 2.0 compliance test devices. We exceed that
* device spec by allowing multiple-packet requests.
*
* NOTE: the Control-OUT data stays in req->buf ... better
* would be copying it into a scratch buffer, so that other
* requests may safely intervene.
*/
case 0x5b: /* control WRITE test -- fill the buffer */
if (ctrl->bRequestType != (USB_DIR_OUT|USB_TYPE_VENDOR))
goto unknown;
if (w_value || w_index)
break;
/* just read that many bytes into the buffer */
if (w_length > req->length)
break;
value = w_length;
break;
case 0x5c: /* control READ test -- return the buffer */
if (ctrl->bRequestType != (USB_DIR_IN|USB_TYPE_VENDOR))
goto unknown;
if (w_value || w_index)
break;
/* expect those bytes are still in the buffer; send back */
if (w_length > req->length)
break;
value = w_length;
break;
default:
unknown:
VDBG(c->cdev,
"unknown control req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
w_value, w_index, w_length);
}
//HER SKAL HID DESC SENDES!!!
switch ((ctrl->bRequestType << 8) | ctrl->bRequest) {
case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8
| USB_REQ_GET_DESCRIPTOR):
switch (w_value >> 8) {
case HID_DT_REPORT:
//VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n");
length = w_length;
length = min_t(unsigned short, length,
sizeof hs_hid_report_descriptor);
memcpy(req->buf, hs_hid_report_descriptor, length);
value = length;
goto respond;
break;
default:
//VDBG(cdev, "Unknown decriptor request 0x%x\n",
// value >> 8);
goto stall;
break;
}
break;
default:
//VDBG(cdev, "Unknown request 0x%x\n",
// ctrl->bRequest);
goto stall;
break;
}
//HERTIL
/* respond with data transfer or status phase? */
stall:
return -EOPNOTSUPP;
respond:
if (value >= 0) {
VDBG(c->cdev, "source/sink req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
w_value, w_index, w_length);
req->zero = 0;
req->length = value;
value = usb_ep_queue(c->cdev->gadget->ep0, req, GFP_ATOMIC);
if (value < 0)
ERROR(c->cdev, "source/sinkc response, err %d\n",
value);
}
/* device either stalls (value < 0) or reports success */
return value;
}
#else
// Keep Eclipse happy
#endif
static struct usb_configuration rudolf_driver = {
.label = "rudolf driver",
.strings = rudolf_strings,
.bind = rudolf_bind_config,
.setup = rudolf_setup,
.bConfigurationValue = 1,
.bmAttributes = USB_CONFIG_ATT_SELFPOWER,
/* .iConfiguration = DYNAMIC */
};
/**
*
*/
int rudolf_add(struct usb_composite_dev *cdev, bool autoresume)
{
int id;
/* allocate string ID(s) */
id = usb_string_id(cdev);
if (id < 0)
return id;
strings_rudolf[0].id = id;
rudolf_intf.iInterface = id;
rudolf_driver.iConfiguration = 1; // id;
/* support autoresume for remote wakeup testing */
if (autoresume)
rudolf_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
/* support OTG systems */
if (gadget_is_otg(cdev->gadget)) {
rudolf_driver.descriptors = otg_desc;
rudolf_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
}
return usb_add_config(cdev, &rudolf_driver);
}

View File

@ -1,7 +0,0 @@
#!/bin/sh
set -xe
scp -qr kernel uf2daemon Makefile vm:linux/pxt/
ssh vm "cd linux/pxt; make $1"
mkdir -p bin
scp vm:linux/pxt/bin/* bin/

View File

@ -1,14 +0,0 @@
# Patched EV3 image
The file `ev3-fs.patch` summarizes the changes done to the original V1.09D image.
You can see some text files are edited, the `d_usbdev.ko` is updated (sources in `../kernel`),
`uf2d` added (sources in `../uf2daemon`), and a stock `nbd.ko` module is added.
Additionally, the `edimax01.ko` is replaced by now much more popular `rtl8192cu.ko` (also stock).
The init script has a hook for running a shell script from `/mnt/ramdisk/`. This can be used
for testing different modules etc.
The kernel command line has been modified to:
* disable DMA for the MUSB driver - otherwise the mass storage device is very unstable
* increase the size of dmesg buffer to 128k

View File

@ -1,34 +0,0 @@
#!/bin/sh
let fs = require("fs")
let styles = {
"0": "rxtx",
"1": " tx",
"2": "rx ",
}
function build() {
let kern = fs.readFileSync( "foo")
let off = 0x0001df30
kern = kern.slice(off + 6 * 5, off + 6 * (5 + 6))
console.log(kern.toString("hex"))
off = 0
for (let i = 0; i < 30; ++i) {
if (kern[off+4] == 64) {
kern[off+4] = 0
kern[off+5] = 2
}
if(kern[off] == 3 || kern[off] == 4) {
kern[off+4] = 0
kern[off+5] = 1
}
console.log(`ep=${kern[off]} style=${styles[kern[off+1]]} buf=${kern[off+2] == 0 ? "sin" : kern[off+2] == 1 ? "dbl" : "XXX"} pad=${kern[off+3]} sz=${kern[off+4]+(kern[off+5]<<8)}`)
off += 6
}
console.log(kern.toString("hex"))
}
build()

View File

@ -1,53 +0,0 @@
diff -ur orig-ev3/etc/init.d/ev3init.sh dev-ev3/etc/init.d/ev3init.sh
--- orig-ev3/etc/init.d/ev3init.sh 1970-01-01 01:00:00.000000000 +0100
+++ dev-ev3/etc/init.d/ev3init.sh 2017-07-27 12:19:43.195041798 +0100
@@ -1,5 +1,7 @@
#!/bin/sh
+echo Y > /sys/module/printk/parameters/time
+
bluetoothd -n > /dev/null 2>&1 &
echo "Setting up VirtualDrive...";
@@ -60,3 +62,6 @@
sleep 2
hciattach /dev/ttyS2 texas 2000000 "flow" "nosleep" $STRING
sdptool add SP
+
+insmod /lib/modules/2.6.33-rc4/kernel/drivers/net/wireless/rtl8192cu.ko
+. /mnt/ramdisk/rc.local || :
Only in orig-ev3/home/root/lms2012/sys: exit~
diff -ur orig-ev3/home/root/lms2012/sys/init dev-ev3/home/root/lms2012/sys/init
--- orig-ev3/home/root/lms2012/sys/init 1970-01-01 01:00:00.000000000 +0100
+++ dev-ev3/home/root/lms2012/sys/init 2017-07-27 12:23:43.072605126 +0100
@@ -5,13 +5,15 @@
var=$(printf 'HostStr=%s SerialStr=%s' $(cat /home/root/lms2012/sys/settings/BrickName) $(cat /home/root/lms2012/sys/settings/BTser))
echo $var > /home/root/lms2012/sys/settings/UsbInfo.dat
+insmod ${PWD}/mod/nbd.ko
+${PWD}/uf2d
insmod ${PWD}/mod/d_iic.ko `cat /home/root/lms2012/sys/settings/HwId`
insmod ${PWD}/mod/d_uart.ko `cat /home/root/lms2012/sys/settings/HwId`
insmod ${PWD}/mod/d_power.ko `cat /home/root/lms2012/sys/settings/HwId`
insmod ${PWD}/mod/d_pwm.ko `cat /home/root/lms2012/sys/settings/HwId`
insmod ${PWD}/mod/d_ui.ko `cat /home/root/lms2012/sys/settings/HwId`
insmod ${PWD}/mod/d_analog.ko `cat /home/root/lms2012/sys/settings/HwId`
-insmod ${PWD}/mod/d_usbdev.ko `cat /home/root/lms2012/sys/settings/UsbInfo.dat`
+insmod ${PWD}/mod/d_usbdev.ko `cat /home/root/lms2012/sys/settings/UsbInfo.dat` file=/dev/nbd0
insmod ${PWD}/mod/d_usbhost.ko
insmod ${PWD}/mod/d_sound.ko `cat /home/root/lms2012/sys/settings/HwId`
insmod ${PWD}/mod/d_bt.ko `cat /home/root/lms2012/sys/settings/HwId`
@@ -29,6 +31,8 @@
chmod 666 /dev/lms_iic
chmod 666 /dev/lms_bt
+echo 4 > /proc/sys/kernel/printk
+
cd ..
ls -R > /dev/null
cd sys
Binary files orig-ev3/home/root/lms2012/sys/mod/d_usbdev.ko and dev-ev3/home/root/lms2012/sys/mod/d_usbdev.ko differ
Only in dev-ev3/home/root/lms2012/sys/mod: nbd.ko
Only in dev-ev3/home/root/lms2012/sys: uf2d
Only in orig-ev3/lib/modules/2.6.33-rc4/kernel/drivers/net/wireless: edimax01.ko
Only in dev-ev3/lib/modules/2.6.33-rc4/kernel/drivers/net/wireless: rtl8192cu.ko

View File

@ -1,55 +0,0 @@
#!/bin/sh
let fs = require("fs")
// we try to use shorter versions of all parameters for the additional parameters to fit
let bootargs = "mem=${memsize} initrd=${filesysaddr},${filesyssize} root=/dev/ram0 rw rootfstype=cramfs console=${console} ip=${ipaddr} lpj=747520 quiet"
let bootnews = "mem=64M initrd=0xC1180000,10M root=1:0 rw rootfstype=cramfs console=${console} lpj=747520 musb_hdrc.use_dma=0 log_buf_len=128k quiet"
let piggy = true
function build() {
if (bootnews.length > bootargs.length) {
console.log("args too long")
return
}
while (bootnews.length < bootargs.length)
bootnews += " "
let cr = fs.readFileSync("cram.bin")
if (cr.length > 10485760) {
console.log("too big by " + (cr.length - 10485760))
return
}
let img = fs.readFileSync("EV3 Firmware V1.09D.bin")
for (let i = 0; i < bootnews.length; ++i) {
if (img[0x21DDA + i] != bootargs.charCodeAt(i)) {
console.log("boot args mismatch")
return
}
img[0x21DDA + i] = bootnews.charCodeAt(i)
}
let off = 0x250000
if (img[off] != 0x45 || img[off + 1] != 0x3d) {
console.log("bad magic: " + img[off] + " / " + img[off+1])
return
}
cr.copy(img, off)
let kern = fs.readFileSync(piggy ? "piggy-patched.gzip" : "linux/arch/arm/boot/uImage")
off = piggy ? 0x0005540f : 0x00050000
if (img[off] != kern[0] || img[off+1] != kern[1]) {
console.log("bad kernel magic: " + img[off] + " / " + img[off+1])
return
}
kern.copy(img, off)
fs.writeFileSync("firmware.bin", img)
}
build()

View File

@ -1,9 +0,0 @@
#!/bin/sh
# dd if=EV3\ Firmware\ V1.09D.bin of=orig.cram bs=65536 skip=37 count=400
sudo cp linux/pxt/uf2daemon/server dev-ev3/home/root/lms2012/sys/uf2d
sudo cp linux/pxt/kernel/d_usbdev.ko dev-ev3/home/root/lms2012/sys/mod/d_usbdev.ko
sudo chown -R root:root dev-ev3/home/root/lms2012
sudo mkfs.cramfs dev-ev3 cram.bin
node img
ls -l firmware.bin

View File

@ -1,8 +0,0 @@
let small = "010100000004010200000004020100004000020200004000030100000004040000008000"
let big = "010100000004010200000004020100000002020200000002030100000001040000000001"
let fs = require("fs")
let kern = fs.readFileSync( "foo")
let kern2 = new Buffer(kern.toString("hex").replace(small, big), "hex")
fs.writeFileSync("foo2", kern2)

View File

@ -1,10 +0,0 @@
#!/bin/sh
./mk
ev3duder up bin/d_usbdev.ko ../prjs/ko/d_usbdev.ko
ev3duder up bin/nbd.ko ../prjs/ko/nbd.ko
ev3duder up ins ../prjs/ko/ins
ev3duder exec 'rm ../prjs/ko/uf2d'
ev3duder up bin/uf2d ../prjs/ko/uf2d
#ev3duder exec 'echo . /mnt/ramdisk/prjs/ko/ins > /mnt/ramdisk/rc.local'

View File

@ -1,6 +0,0 @@
CFLAGS = -std=c99 -W -Wall
SRC = main.c fat.c
all:
gcc -DX86=1 -g $(CFLAGS) $(SRC) -o server86
arm-none-linux-gnueabi-gcc -Os -s $(CFLAGS) $(SRC) -o server

View File

@ -1,784 +0,0 @@
#define VENDOR_NAME "The LEGO Group"
#define PRODUCT_NAME "Mindstorms EV3"
#define VOLUME_LABEL "EV3"
#define INDEX_URL "https://makecode.com/lego"
#define BOARD_ID "LEGO-EV3-v0"
#define _XOPEN_SOURCE 500
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <fcntl.h>
#include <time.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <string.h>
#include <errno.h>
#define max(a, b) \
({ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a > _b ? _a : _b; \
})
#define min(a, b) \
({ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a < _b ? _a : _b; \
})
#include "uf2.h"
#define DBG LOG
typedef struct {
uint8_t JumpInstruction[3];
uint8_t OEMInfo[8];
uint16_t SectorSize;
uint8_t SectorsPerCluster;
uint16_t ReservedSectors;
uint8_t FATCopies;
uint16_t RootDirectoryEntries;
uint16_t TotalSectors16;
uint8_t MediaDescriptor;
uint16_t SectorsPerFAT;
uint16_t SectorsPerTrack;
uint16_t Heads;
uint32_t HiddenSectors;
uint32_t TotalSectors32;
uint8_t PhysicalDriveNum;
uint8_t Reserved;
uint8_t ExtendedBootSig;
uint32_t VolumeSerialNumber;
char VolumeLabel[11];
uint8_t FilesystemIdentifier[8];
} __attribute__((packed)) FAT_BootBlock;
typedef struct {
char name[8];
char ext[3];
uint8_t attrs;
uint8_t reserved;
uint8_t createTimeFine;
uint16_t createTime;
uint16_t createDate;
uint16_t lastAccessDate;
uint16_t highStartCluster;
uint16_t updateTime;
uint16_t updateDate;
uint16_t startCluster;
uint32_t size;
} __attribute__((packed)) DirEntry;
typedef struct {
uint8_t seqno;
uint16_t name0[5];
uint8_t attrs;
uint8_t type;
uint8_t checksum;
uint16_t name1[6];
uint16_t startCluster;
uint16_t name2[2];
} __attribute__((packed)) VFatEntry;
STATIC_ASSERT(sizeof(DirEntry) == 32);
#define STR0(x) #x
#define STR(x) STR0(x)
const char infoUf2File[] = //
"UF2 Bootloader " UF2_VERSION "\r\n"
"Model: " PRODUCT_NAME "\r\n"
"Board-ID: " BOARD_ID "\r\n";
const char indexFile[] = //
"<!doctype html>\n"
"<html>"
"<body>"
"<script>\n"
"location.replace(\"" INDEX_URL "\");\n"
"</script>"
"</body>"
"</html>\n";
#define RESERVED_SECTORS 1
#define ROOT_DIR_SECTORS 4
#define SECTORS_PER_FAT ((NUM_FAT_BLOCKS * 2 + 511) / 512)
#define START_FAT0 RESERVED_SECTORS
#define START_FAT1 (START_FAT0 + SECTORS_PER_FAT)
#define START_ROOTDIR (START_FAT1 + SECTORS_PER_FAT)
#define START_CLUSTERS (START_ROOTDIR + ROOT_DIR_SECTORS)
#define ROOT_DIR_ENTRIES (ROOT_DIR_SECTORS * 512 / 32)
#define F_TEXT 1
#define F_UF2 2
#define F_DIR 4
#define F_CONT 8
static const FAT_BootBlock BootBlock = {
.JumpInstruction = {0xeb, 0x3c, 0x90},
.OEMInfo = "UF2 UF2 ",
.SectorSize = 512,
.SectorsPerCluster = 1,
.ReservedSectors = RESERVED_SECTORS,
.FATCopies = 2,
.RootDirectoryEntries = ROOT_DIR_ENTRIES,
.TotalSectors16 = NUM_FAT_BLOCKS - 2,
.MediaDescriptor = 0xF8,
.SectorsPerFAT = SECTORS_PER_FAT,
.SectorsPerTrack = 1,
.Heads = 1,
.ExtendedBootSig = 0x29,
.VolumeSerialNumber = 0x00420042,
.VolumeLabel = VOLUME_LABEL,
.FilesystemIdentifier = "FAT16 ",
};
int currCluster = 2;
struct FsEntry *rootDir;
struct ClusterData *firstCluster, *lastCluster;
typedef struct ClusterData {
int flags;
int numclusters;
struct stat st;
struct ClusterData *dnext;
struct ClusterData *cnext;
struct FsEntry *dirdata;
struct FsEntry *myfile;
char name[0];
} ClusterData;
typedef struct FsEntry {
int startCluster;
uint8_t attrs;
int size;
int numdirentries;
time_t ctime, mtime;
struct FsEntry *next;
struct ClusterData *data;
char fatname[12];
char vfatname[0];
} FsEntry;
struct DirMap {
const char *mapName;
const char *fsName;
};
struct DirMap dirMaps[] = { //
#ifdef X86
{"foo qux baz", "dirs/bar"}, //
{"foo", "dirs/foo"}, //
{"xyz", "dirs/bar2"}, //
#else
{"Projects", "/mnt/ramdisk/prjs/BrkProg_SAVE"},
{"SD Card", "/media/card/myapps"},
{"USB Stick", "/media/usb/myapps"},
#endif
{NULL, NULL}};
void timeToFat(time_t t, uint16_t *dateP, uint16_t *timeP) {
struct tm tm;
localtime_r(&t, &tm);
if (timeP)
*timeP = (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec / 2);
if (dateP)
*dateP = (max(0, tm.tm_year - 80) << 9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday;
}
void padded_memcpy(char *dst, const char *src, int len) {
for (int i = 0; i < len; ++i) {
if (*src)
*dst = *src++;
else
*dst = ' ';
dst++;
}
}
char *expandMap(const char *mapName) {
static char mapbuf[300];
const char *rest = "";
for (int i = 0; i < (int)sizeof(mapbuf); ++i) {
char c = mapName[i];
if (c == '/' || c == 0) {
mapbuf[i] = 0;
rest = mapName + i;
break;
}
mapbuf[i] = c;
}
for (int i = 0; dirMaps[i].mapName; ++i) {
if (strcmp(dirMaps[i].mapName, mapbuf) == 0) {
strcpy(mapbuf, dirMaps[i].fsName);
strcat(mapbuf, rest);
return mapbuf;
}
}
return NULL;
}
ClusterData *mkClusterData(int namelen) {
ClusterData *c = malloc(sizeof(*c) + namelen + 1);
memset(c, 0, sizeof(*c) + namelen + 1);
return c;
}
ClusterData *readDir(const char *mapName) {
DIR *d = opendir(expandMap(mapName));
if (!d)
return NULL;
ClusterData *res = NULL;
for (;;) {
struct dirent *ent = readdir(d);
if (!ent)
break;
ClusterData *c = mkClusterData(strlen(mapName) + 1 + strlen(ent->d_name));
c->flags = F_UF2;
c->dnext = res;
sprintf(c->name, "%s/%s", mapName, ent->d_name);
int err = stat(expandMap(c->name), &c->st);
assert(err >= 0);
if (S_ISREG(c->st.st_mode) && strlen(c->name) < UF2_FILENAME_MAX) {
c->numclusters = (c->st.st_size + 255) / 256;
} else {
free(c);
continue;
}
res = c;
}
closedir(d);
return res;
}
int filechar(int c) {
if (!c)
return 0;
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') ||
strchr("_-", c);
}
void copyFsChars(char *dst, const char *src, int len) {
for (int i = 0; i < len; ++i) {
if (filechar(*src))
dst[i] = toupper(*src++);
else {
if (*src == '.')
src = "";
if (*src == 0)
dst[i] = ' ';
else
dst[i] = '_';
while (*src && !filechar(*src))
src++;
}
}
}
FsEntry *mkFsEntry(const char *name) {
int sz = sizeof(FsEntry) + strlen(name) + 1;
FsEntry *e = malloc(sz);
memset(e, 0, sz);
e->startCluster = currCluster;
e->next = NULL;
// +1 for final 0x0000, and +12 for alignment
e->numdirentries = 1 + (strlen(name) + 1 + 12) / 13;
strcpy(e->vfatname, name);
const char *src = name;
copyFsChars(e->fatname, src, 8);
while (*src && *src != '.')
src++;
if (*src == '.')
src++;
else
src = "";
copyFsChars(e->fatname + 8, src, 3);
return e;
}
void addClusterData(ClusterData *c, FsEntry *e) {
currCluster += c->numclusters;
if (firstCluster == NULL) {
firstCluster = c;
} else {
lastCluster->cnext = c;
}
lastCluster = c;
if (c->st.st_ctime)
e->ctime = min(e->ctime, c->st.st_ctime);
e->mtime = max(e->mtime, c->st.st_mtime);
c->myfile = e;
DBG("add cluster: flags=%d size=%d numcl=%d", c->flags, (int)c->st.st_size, c->numclusters);
}
FsEntry *addRootText(const char *filename, const char *contents) {
FsEntry *e = mkFsEntry(filename);
e->next = rootDir;
rootDir = e;
int sz = strlen(contents);
e->size = sz;
if (sz > 0) {
assert(sz <= 512);
ClusterData *c = mkClusterData(sz);
c->st.st_mtime = c->st.st_ctime = time(NULL);
c->flags = F_TEXT;
strcpy(c->name, contents);
c->st.st_size = sz;
c->numclusters = 1;
addClusterData(c, e);
}
return e;
}
int baseLen(const char *a) {
int len = 0;
while (*a && *a != '.') {
a++;
len++;
}
return len;
}
int nameMatches(const char *a, const char *b) {
for (;;) {
if ((*a == 0 || *a == '.') && (*b == 0 || *b == '.'))
return 1;
if (*a != *b)
return 0;
a++;
b++;
}
}
void setFatNames(FsEntry *dirent) {
for (FsEntry *p = dirent; p; p = p->next) {
// check for collisions
int k = 1;
retry:
for (FsEntry *o = dirent; o && o != p; o = o->next) {
if (strcmp(o->fatname, p->fatname) == 0) {
char buf[20];
sprintf(buf, "~%d", k++);
int len = strlen(buf);
memcpy(p->fatname + 8 - len, buf, len);
goto retry;
}
}
DBG("setname: %s [%s] cl=%s @ %d sz=%d dents=%d", p->vfatname, p->fatname,
p->data ? p->data->name : "(no data)", p->startCluster, p->size, p->numdirentries);
}
}
void addFullDir(const char *mapName) {
int numEntries = 0;
FsEntry *dirents = NULL;
time_t mtime = 0, ctime = 0;
for (ClusterData *cl = readDir(mapName); cl; cl = cl->dnext) {
if (cl->cnext || cl == lastCluster)
continue; // already done
// vfat entries
const char *filename = strchr(cl->name, '/') + 1;
int len = baseLen(filename) + 4;
char namebuf[len];
memcpy(namebuf, filename, len - 4);
strcpy(namebuf + len - 4, ".uf2");
assert(cl->flags & F_UF2);
FsEntry *fent = mkFsEntry(namebuf);
numEntries += fent->numdirentries;
fent->next = dirents;
fent->data = cl;
fent->size = cl->numclusters * 512;
dirents = fent;
addClusterData(cl, fent);
for (ClusterData *other = cl->dnext; other; other = other->dnext) {
if (nameMatches(cl->name, other->name)) {
other->flags |= F_CONT;
fent->size += other->numclusters * 512;
addClusterData(other, fent);
}
}
if (mtime == 0) {
mtime = fent->mtime;
ctime = fent->ctime;
} else {
mtime = max(mtime, fent->mtime);
ctime = min(ctime, fent->ctime);
}
}
setFatNames(dirents);
FsEntry *dent = mkFsEntry(mapName);
dent->data = mkClusterData(0);
dent->data->dirdata = dirents;
dent->data->numclusters = (numEntries + 16) / 16; // at least 1
addClusterData(dent->data, dent);
dent->mtime = mtime;
dent->ctime = ctime;
dent->next = rootDir;
dent->attrs = 0x10;
dent->data->flags = F_DIR;
rootDir = dent;
}
void setupFs() {
addRootText("info_uf2.txt", infoUf2File);
addRootText("index.html", indexFile);
for (int i = 0; dirMaps[i].mapName; ++i) {
addFullDir(dirMaps[i].mapName);
}
setFatNames(rootDir); // make names unique
FsEntry *e = addRootText(BootBlock.VolumeLabel, "");
e->numdirentries = 1;
e->attrs = 0x28;
}
#define WRITE_ENT(v) \
do { \
if (skip++ >= 0) \
*dest++ = v; \
if (skip >= 256) \
return; \
cl++; \
} while (0)
void readFat(uint16_t *dest, int skip) {
int cl = 0;
skip = -skip;
WRITE_ENT(0xfff0);
WRITE_ENT(0xffff);
for (ClusterData *c = firstCluster; c; c = c->cnext) {
for (int i = 0; i < c->numclusters - 1; i++)
WRITE_ENT(cl + 1);
if (c->cnext && c->cnext->flags & F_CONT)
WRITE_ENT(cl + 1);
else
WRITE_ENT(0xffff);
}
}
// note that ptr might be unaligned
const char *copyVFatName(const char *ptr, void *dest, int len) {
uint8_t *dst = dest;
for (int i = 0; i < len; ++i) {
if (ptr == NULL) {
*dst++ = 0xff;
*dst++ = 0xff;
} else {
*dst++ = *ptr;
*dst++ = 0;
if (*ptr)
ptr++;
else
ptr = NULL;
}
}
return ptr;
}
uint8_t fatChecksum(const char *name) {
uint8_t sum = 0;
for (int i = 0; i < 11; ++i)
sum = ((sum & 1) << 7) + (sum >> 1) + *name++;
return sum;
}
void readDirData(uint8_t *dest, FsEntry *dirdata, int blkno) {
DirEntry *d = (void *)dest;
int idx = blkno * -16;
for (FsEntry *e = dirdata; e; e = e->next) {
if (idx >= 16)
break;
// DBG("dir idx=%d %s", idx, e->vfatname);
for (int i = 0; i < e->numdirentries; ++i, ++idx) {
if (0 <= idx && idx < 16) {
if (i == e->numdirentries - 1) {
memcpy(d->name, e->fatname, 11);
d->attrs = e->attrs;
d->size = e->size;
d->startCluster = e->startCluster;
timeToFat(e->mtime, &d->updateDate, &d->updateTime);
timeToFat(e->ctime, &d->createDate, &d->createTime);
} else {
VFatEntry *f = (void *)d;
int seq = e->numdirentries - i - 2;
f->seqno = seq + 1; // they start at 1
if (i == 0)
f->seqno |= 0x40;
f->attrs = 0x0F;
f->type = 0x00;
f->checksum = fatChecksum(e->fatname);
f->startCluster = 0;
const char *ptr = e->vfatname + (13 * seq);
ptr = copyVFatName(ptr, f->name0, 5);
ptr = copyVFatName(ptr, f->name1, 6);
ptr = copyVFatName(ptr, f->name2, 2);
}
d++;
}
}
}
}
void readBlock(uint8_t *dest, int blkno) {
// DBG("readbl %d", blkno);
int blkno0 = blkno;
for (ClusterData *c = firstCluster; c; c = c->cnext) {
// DBG("off=%d sz=%d", blkno, c->numclusters);
if (blkno >= c->numclusters) {
blkno -= c->numclusters;
continue;
}
// DBG("readbl off=%d %p", blkno, c);
if (c->dirdata) {
readDirData(dest, c->dirdata, blkno);
} else if (c->flags & F_TEXT) {
strcpy((char *)dest, c->name);
} else if (c->flags & F_UF2) {
UF2_Block *bl = (void *)dest;
bl->magicStart0 = UF2_MAGIC_START0;
bl->magicStart1 = UF2_MAGIC_START1;
bl->magicEnd = UF2_MAGIC_END;
bl->flags = UF2_FLAG_FILE;
bl->blockNo = blkno0 - (c->myfile->startCluster - 2);
bl->numBlocks = c->myfile->size / 512;
bl->targetAddr = blkno * 256;
bl->payloadSize = 256;
bl->fileSize = c->st.st_size;
int fd = open(expandMap(c->name), O_RDONLY);
if (fd >= 0) {
lseek(fd, bl->targetAddr, SEEK_SET);
bl->payloadSize = read(fd, bl->data, 256);
close(fd);
} else {
bl->payloadSize = -1;
}
if (bl->payloadSize < 475 - strlen(c->name))
strcpy((char *)bl->data + bl->payloadSize, c->name);
}
return;
}
}
void read_block(uint32_t block_no, uint8_t *data) {
memset(data, 0, 512);
uint32_t sectionIdx = block_no;
if (block_no == 0) {
memcpy(data, &BootBlock, sizeof(BootBlock));
data[510] = 0x55;
data[511] = 0xaa;
// logval("data[0]", data[0]);
} else if (block_no < START_ROOTDIR) {
sectionIdx -= START_FAT0;
if (sectionIdx >= SECTORS_PER_FAT) // second copy of fat?
sectionIdx -= SECTORS_PER_FAT;
readFat((void *)data, sectionIdx * 256);
} else if (block_no < START_CLUSTERS) {
sectionIdx -= START_ROOTDIR;
readDirData(data, rootDir, sectionIdx);
} else {
sectionIdx -= START_CLUSTERS;
readBlock(data, sectionIdx);
}
}
char rbfPath[300];
uint8_t stopApp[] = {
0x05, 0x00, // size
0x00, 0x00, // seq. no.
0x3f, 0x3d, // usb magic,
0x02, // req. no.
};
uint8_t runStart[] = {0x00, 0x00, // size
0x00, 0x00, // seq. no.
0x00, 0x00, 0x08, // something
0xC0, 0x08, 0x82, 0x01, 0x00, 0x84};
uint8_t runEnd[] = {0x00, 0x60, 0x64, 0x03, 0x01, 0x60, 0x64, 0x00};
#define FEED_DATA _IOC(_IOC_WRITE, 't', 108, 1024)
void startRbf() {
char buf[1024];
memset(buf, 0, sizeof(buf));
memcpy(buf, stopApp, sizeof(stopApp));
int fd = open("/dev/lms_usbdev", O_RDWR);
ioctl(fd, FEED_DATA, buf);
usleep(500000);
int off = 0;
memcpy(buf + off, runStart, sizeof(runStart));
off += sizeof(runStart);
strcpy(buf + off, rbfPath);
off += strlen(rbfPath);
memcpy(buf + off, runEnd, sizeof(runEnd));
off += sizeof(runEnd);
off -= 2;
buf[0] = off & 0xff;
buf[1] = off >> 8;
ioctl(fd, FEED_DATA, buf);
close(fd);
}
#define MAX_BLOCKS 8000
typedef struct {
uint32_t numBlocks;
uint32_t numWritten;
uint8_t writtenMask[MAX_BLOCKS / 8 + 1];
} WriteState;
void restartProgram() {
if (!rbfPath[0])
exit(0);
startRbf();
exit(0); // causes parent to eject MSD etc
}
int numWrites = 0;
static WriteState wrState;
void write_block(uint32_t block_no, uint8_t *data) {
WriteState *state = &wrState;
UF2_Block *bl = (void *)data;
if (bl->magicStart0 == 0x20da6d81 && bl->magicStart1 == 0x747e09d4) {
DBG("restart req, #wr=%d", numWrites);
if (numWrites) {
exit(0);
}
return;
}
numWrites++;
if (!is_uf2_block(bl)) {
return;
}
(void)block_no;
bl->data[475] = 0; // make sure we have NUL terminator
char *fn0 = (char *)bl->data + bl->payloadSize;
int namelen = 0;
if (bl->payloadSize <= UF2_MAX_PAYLOAD) {
namelen = strlen(fn0);
}
if ((bl->flags & UF2_FLAG_FILE) && bl->fileSize <= UF2_MAX_FILESIZE &&
bl->targetAddr < bl->fileSize && 1 <= namelen && namelen <= UF2_FILENAME_MAX) {
char *firstSL = strchr(fn0, '/');
char *lastSL = strrchr(fn0, '/');
if (!lastSL)
lastSL = fn0;
else
lastSL++;
int baseLen = strlen(lastSL);
char fallback[strlen(dirMaps[0].fsName) + 1 + baseLen + 1];
sprintf(fallback, "%s/%s", dirMaps[0].fsName, lastSL);
char *fn = NULL;
if (firstSL && firstSL + 1 == lastSL)
fn = expandMap(fn0);
if (!fn)
fn = fallback;
char *p = strrchr(fn, '/');
*p = 0;
mkdir(fn, 0777);
*p = '/';
int fd = open(fn, O_WRONLY | O_CREAT, 0777);
if (fd < 0 && errno == ETXTBSY) {
unlink(fn);
fd = open(fn, O_WRONLY | O_CREAT, 0777);
}
if (fd >= 0) {
ftruncate(fd, bl->fileSize);
lseek(fd, bl->targetAddr, SEEK_SET);
// DBG("write %d bytes at %d to %s", bl->payloadSize, bl->targetAddr, fn);
write(fd, bl->data, bl->payloadSize);
close(fd);
if (strlen(fn) > 4 && !strcmp(fn + strlen(fn) - 4, ".rbf")) {
strcpy(rbfPath, fn);
}
}
}
if (state && bl->numBlocks) {
if (state->numBlocks != bl->numBlocks) {
if (bl->numBlocks >= MAX_BLOCKS || state->numBlocks)
state->numBlocks = 0xffffffff;
else
state->numBlocks = bl->numBlocks;
}
if (bl->blockNo < MAX_BLOCKS) {
uint8_t mask = 1 << (bl->blockNo % 8);
uint32_t pos = bl->blockNo / 8;
if (!(state->writtenMask[pos] & mask)) {
// logval("incr", state->numWritten);
state->writtenMask[pos] |= mask;
state->numWritten++;
DBG("write %d/%d #%d", state->numWritten, state->numBlocks, bl->blockNo);
}
if (state->numWritten >= state->numBlocks) {
restartProgram();
}
}
} else {
// TODO timeout for restart?
}
}

View File

@ -1,231 +0,0 @@
#define _GNU_SOURCE 1
#include <sys/types.h>
#include <linux/nbd.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdarg.h>
#include "uf2.h"
const char *dev_file = "/dev/nbd0";
#define NUM_BLOCKS NUM_FAT_BLOCKS
uint64_t ntohll(uint64_t a) {
return ((uint64_t)ntohl(a & 0xffffffff) << 32) | ntohl(a >> 32);
}
#define htonll ntohll
void mylog(const char *fmt, ...) {
va_list args;
char *p, *p2;
va_start(args, fmt);
vasprintf(&p, fmt, args);
vprintf(fmt, args);
va_end(args);
if (p[0] != '<')
asprintf(&p2, "<6>%s\n", p);
else
asprintf(&p2, "%s\n", p);
int len = strlen(p2);
#ifdef X86
write(2, p2, len);
#else
int fd = open("/dev/kmsg", O_WRONLY);
write(fd, p2, len);
close(fd);
#endif
free(p);
free(p2);
}
void readAll(int fd, void *dst, uint32_t length) {
while (length) {
int curr = read(fd, dst, length);
if (curr < 0)
FAIL("read failed on fd:%d", fd);
length -= curr;
dst = (char *)dst + curr;
}
}
void writeAll(int fd, void *dst, uint32_t length) {
while (length) {
int curr = write(fd, dst, length);
if (curr < 0)
FAIL("write failed on fd:%d", fd);
length -= curr;
dst = (char *)dst + curr;
}
}
int nbd;
int sock;
int sockets[2];
struct nbd_request request;
struct nbd_reply reply;
void nbd_ioctl(unsigned id, int arg) {
int err = ioctl(nbd, id, arg);
if (err < 0)
FAIL("ioctl(%ud) failed [%s]", id, strerror(errno));
}
void startclient() {
close(sockets[0]);
nbd_ioctl(NBD_SET_SOCK, sockets[1]);
nbd_ioctl(NBD_DO_IT, 0);
nbd_ioctl(NBD_CLEAR_QUE, 0);
nbd_ioctl(NBD_CLEAR_SOCK, 0);
exit(0);
}
void handleread(int off, int len) {
uint8_t buf[512];
LOG("read @%d len=%d", off, len);
reply.error = 0; // htonl(EPERM);
writeAll(sock, &reply, sizeof(struct nbd_reply));
for (int i = 0; i < len; ++i) {
read_block(off + i, buf);
writeAll(sock, buf, 512);
}
}
void handlewrite(int off, int len) {
uint8_t buf[512];
LOG("write @%d len=%d", off, len);
for (int i = 0; i < len; ++i) {
readAll(sock, buf, 512);
write_block(off + i, buf);
}
reply.error = 0;
writeAll(sock, &reply, sizeof(struct nbd_reply));
}
void setupFs();
void runNBD() {
setupFs();
int err = socketpair(AF_UNIX, SOCK_STREAM, 0, sockets);
assert(err >= 0);
nbd = open(dev_file, O_RDWR);
assert(nbd >= 0);
nbd_ioctl(BLKFLSBUF, 0);
nbd_ioctl(NBD_SET_BLKSIZE, 512);
nbd_ioctl(NBD_SET_SIZE_BLOCKS, NUM_BLOCKS);
nbd_ioctl(NBD_CLEAR_SOCK, 0);
if (!fork())
startclient();
int fd = open(dev_file, O_RDONLY);
assert(fd != -1);
close(fd);
close(sockets[1]);
sock = sockets[0];
reply.magic = htonl(NBD_REPLY_MAGIC);
reply.error = htonl(0);
for (;;) {
// nbd_ioctl(BLKFLSBUF, 0); // flush buffers - we don't want the kernel to cache the writes
int nread = read(sock, &request, sizeof(request));
if (nread < 0) {
FAIL("nbd read err %s", strerror(errno));
}
if (nread == 0)
return;
assert(nread == sizeof(request));
memcpy(reply.handle, request.handle, sizeof(reply.handle));
reply.error = htonl(0);
assert(request.magic == htonl(NBD_REQUEST_MAGIC));
uint32_t len = ntohl(request.len);
assert((len & 511) == 0);
len >>= 9;
uint64_t from = ntohll(request.from);
assert((from & 511) == 0);
from >>= 9;
switch (ntohl(request.type)) {
case NBD_CMD_READ:
handleread(from, len);
break;
case NBD_CMD_WRITE:
handlewrite(from, len);
break;
case NBD_CMD_DISC:
return;
default:
FAIL("invalid cmd: %d", ntohl(request.type));
}
}
}
void enableMSD(int enabled) {
#ifndef X86
int fd = open("/sys/devices/platform/musb_hdrc/gadget/lun0/active", O_WRONLY);
write(fd, enabled ? "1" : "0", 1);
close(fd);
#else
LOG("fake enable MSD: %d", enabled);
#endif
}
int main(int argc, char **argv) {
#ifndef X86
daemon(0, 1);
#endif
if (argc > 1)
dev_file = argv[1];
for (;;) {
pid_t child = fork();
if (child == 0) {
runNBD();
return 0;
}
sleep(1);
enableMSD(1);
int wstatus = 0;
waitpid(child, &wstatus, 0);
enableMSD(0); // force "eject"
if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) != 0) {
LOG("abnormal child return, %d", child);
sleep(5);
} else {
sleep(2);
}
}
return 0;
}

View File

@ -1,46 +0,0 @@
#ifndef UF2_H
#define UF2_H 1
#include "uf2format.h"
#include <stdio.h>
#include <string.h>
#ifndef INDEX_URL
#define INDEX_URL "https://www.pxt.io/"
#endif
#define UF2_VERSION_BASE "v0.1.0"
// needs to be more than ~4200 and less than ~65000 (to force FAT16)
#define NUM_FAT_BLOCKS 65000
#define UF2_VERSION UF2_VERSION_BASE " F"
//! Static block size for all memories
#define UDI_MSC_BLOCK_SIZE 512L
void read_block(uint32_t block_no, uint8_t *data);
void write_block(uint32_t block_no, uint8_t *data);
#define CONCAT_1(a, b) a##b
#define CONCAT_0(a, b) CONCAT_1(a, b)
#define STATIC_ASSERT(e) enum { CONCAT_0(_static_assert_, __LINE__) = 1 / ((e) ? 1 : 0) }
extern const char infoUf2File[];
void readAll(int fd, void *dst, uint32_t length);
STATIC_ASSERT(sizeof(UF2_Block) == 512);
void mylog(const char *fmt, ...);
#define FAIL(args...) \
do { \
mylog("<4>" args); \
exit(1); \
} while (0)
#define LOG mylog
#endif

View File

@ -1,48 +0,0 @@
#ifndef UF2FORMAT_H
#define UF2FORMAT_H 1
#include <stdint.h>
#include <stdbool.h>
// All entries are little endian.
// if you increase that, you will also need to update the linker script file
#define APP_START_ADDRESS 0x00002000
#define UF2_MAGIC_START0 0x0A324655UL // "UF2\n"
#define UF2_MAGIC_START1 0x9E5D5157UL // Randomly selected
#define UF2_MAGIC_END 0x0AB16F30UL // Ditto
// If set, the block is "comment" and should not be flashed to the device
#define UF2_FLAG_NOFLASH 0x00000001
#define UF2_FLAG_FILE 0x00001000
#define UF2_FILENAME_MAX 150
#define UF2_MAX_PAYLOAD (476 - 10) // leaving some space for filename
// for this bootloader
#define UF2_MAX_FILESIZE (64 * 1024 * 1024)
typedef struct {
// 32 byte header
uint32_t magicStart0;
uint32_t magicStart1;
uint32_t flags;
uint32_t targetAddr;
uint32_t payloadSize;
uint32_t blockNo;
uint32_t numBlocks;
uint32_t fileSize;
// raw data, followed by filename (NUL-terminated) at payloadSize
uint8_t data[476];
// store magic also at the end to limit damage from partial block reads
uint32_t magicEnd;
} UF2_Block;
static inline bool is_uf2_block(void *data) {
UF2_Block *bl = (UF2_Block *)data;
return bl->magicStart0 == UF2_MAGIC_START0 && bl->magicStart1 == UF2_MAGIC_START1 &&
bl->magicEnd == UF2_MAGIC_END;
}
#endif

View File

@ -1,106 +0,0 @@
#ifndef UF2_HID_H
#define UF2_HID_H 1
#define HF2_CMD_BININFO 0x0001
// no arguments
#define HF2_MODE_BOOTLOADER 0x01
#define HF2_MODE_USERSPACE 0x02
struct HF2_BININFO_Result {
uint32_t mode;
uint32_t flash_page_size;
uint32_t flash_num_pages;
uint32_t max_message_size;
};
#define HF2_CMD_INFO 0x0002
// no arguments
// results is utf8 character array
#define HF2_CMD_RESET_INTO_APP 0x0003
// no arguments, no result
#define HF2_CMD_RESET_INTO_BOOTLOADER 0x0004
// no arguments, no result
#define HF2_CMD_START_FLASH 0x0005
// no arguments, no result
#define HF2_CMD_WRITE_FLASH_PAGE 0x0006
struct HF2_WRITE_FLASH_PAGE_Command {
uint32_t target_addr;
uint32_t data[0];
};
// no result
#define HF2_CMD_CHKSUM_PAGES 0x0007
struct HF2_CHKSUM_PAGES_Command {
uint32_t target_addr;
uint32_t num_pages;
};
struct HF2_CHKSUM_PAGES_Result {
uint16_t chksums[0 /* num_pages */];
};
#define HF2_CMD_READ_WORDS 0x0008
struct HF2_READ_WORDS_Command {
uint32_t target_addr;
uint32_t num_words;
};
struct HF2_READ_WORDS_Result {
uint32_t words[0 /* num_words */];
};
#define HF2_CMD_WRITE_WORDS 0x0009
struct HF2_WRITE_WORDS_Command {
uint32_t target_addr;
uint32_t num_words;
uint32_t words[0 /* num_words */];
};
// no result
#define HF2_CMD_DMESG 0x0010
// no arguments
// results is utf8 character array
typedef struct {
uint32_t command_id;
uint16_t tag;
uint8_t reserved0;
uint8_t reserved1;
union {
struct HF2_WRITE_FLASH_PAGE_Command write_flash_page;
struct HF2_WRITE_WORDS_Command write_words;
struct HF2_READ_WORDS_Command read_words;
struct HF2_CHKSUM_PAGES_Command chksum_pages;
};
} HF2_Command;
typedef struct {
uint16_t tag;
union {
struct {
uint8_t status;
uint8_t status_info;
};
uint16_t status16;
};
union {
struct HF2_BININFO_Result bininfo;
uint8_t data8[0];
uint16_t data16[0];
uint32_t data32[0];
};
} HF2_Response;
#define HF2_FLAG_SERIAL_OUT 0x80
#define HF2_FLAG_SERIAL_ERR 0xC0
#define HF2_FLAG_CMDPKT_LAST 0x40
#define HF2_FLAG_CMDPKT_BODY 0x00
#define HF2_FLAG_MASK 0xC0
#define HF2_SIZE_MASK 63
#define HF2_STATUS_OK 0x00
#define HF2_STATUS_INVALID_CMD 0x01
#endif

View File

@ -1,19 +0,0 @@
/// <reference path="../node_modules/pxt-core/typings/globals/node/index.d.ts"/>
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
import * as fs from 'fs';
require("./editor")
declare namespace pxt.editor {
function deployCoreAsync(resp: pxtc.CompileResult, disconnect?: boolean): Promise<void>;
}
export function deployCoreAsync(resp: pxtc.CompileResult) {
return pxt.editor.deployCoreAsync(resp, process.env["PXT_SERIAL"] ? false : true)
.then(() => {
fs.writeFileSync("built/full-" + pxtc.BINARY_UF2, resp.outfiles[pxtc.BINARY_UF2], {
encoding: "base64"
})
})
}

View File

@ -1,7 +0,0 @@
/// <reference path="../node_modules/pxt-core/typings/globals/node/index.d.ts"/>
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
import * as path from "path";
export let pxtCore = require("pxt-core");
// require.resolve() gives path to [pxt dir]/built/pxt.js, so move up twice to get pxt root dir
export let pxtCoreDir = path.resolve(require.resolve("pxt-core"), "..", "..");

18
docfiles/footer.html Normal file
View File

@ -0,0 +1,18 @@
<footer class="ui vertical footer segment hideprint" aria-hidden="false">
<div class="ui center aligned container">
<div class="ui section divider"></div>
<div class="ui container horizontal small divided link list">
<!-- <a class="item" href="https://makecode.com/contact" target="_blank" rel="noopener">Contact Us</a> -->
<a class="item" href="https://makecode.com/privacy" target="_blank" rel="noopener">Privacy &amp; Cookies</a>
<a class="item" href="https://makecode.com/termsofuse" target="_blank" rel="noopener"> Terms Of Use</a>
<a class="item" href="https://makecode.com/trademarks" target="_blank" rel="noopener">Trademarks</a>
<div class="item">© 2018 Microsoft</div>
</div>
<div class="ui container horizontal small divided link list">
<a class="ui centered item" href="https://makecode.com/" title="Microsoft MakeCode" target="_blank" rel="noopener">Powered by Microsoft MakeCode</a>
</div>
<div class="ui centered container small list">
<p class="item">LEGO, the LEGO logo, MINDSTORMS and the MINDSTORMS EV3 logo are trademarks and/ or copyrights of the LEGO Group. ©2018 The LEGO Group. All rights reserved.</p>
</div>
</div>
</footer>

1
docfiles/robotsmeta.html Normal file
View File

@ -0,0 +1 @@
<meta name="robots" content="noindex">

View File

@ -1,11 +1,135 @@
# @extends
## Support #support
* [Troubleshoot](/troubleshoot)
* [EV3 Manager](https://ev3manager.education.lego.com/)
* [Bluetooth](/bluetooth)
* [Forum](https://forum.makecode.com)
* [LEGO Support](https://www.lego.com/service/)
* [FIRST LEGO League](/fll)
## Projects #projects
* [Getting Started](/getting-started)
* [Try](/getting-started/try)
* [Use](/getting-started/use)
* [Tutorials](/tutorials)
* [Wake Up!](/tutorials/wake-up)
* [Make An Animation](/tutorials/make-an-animation)
* [What Animal Am I?](/tutorials/what-animal-am-i)
* [Music Brick](/tutorials/music-brick)
* [Run Motors](/tutorials/run-motors)
* [Tank ZigZag](/tutorials/tank-zigzag)
* [Touch to Run](/tutorials/touch-to-run)
* [Touch Sensor Values](/tutorials/touch-sensor-values)
* [What Color?](/tutorials/what-color)
* [Line Following](/tutorials/line-following)
* [Red Light, Green Light](/tutorials/redlight-greenlight)
* [Reflected Light Measure](/tutorials/reflected-light-measure)
* [Reflected Light Calibration](/tutorials/reflected-light-calibration)
* [Object Near?](/tutorials/object-near)
* [Security Alert](/tutorials/security-alert)
* [Coding](/coding)
* [Autonomous Parking](/coding/autonomous-parking)
* [Object Detection](/coding/object-detection)
* [Line Detection](/coding/line-detection)
* [Design Engineering](/design-engineering)
* [Make It Move Without Wheels](/design-engineering/make-it-move)
* [Make It Smarter and Faster](/design-engineering/make-it-smarter)
* [Make a System that Communicates](/design-engineering/make-it-communicate)
* [Maker](/maker)
* [Make a Sound Machine](/maker/sound-machine)
* [Make a Security Gadget](/maker/security-gadget)
## Reference #reference
* [Reference](/reference)
* [input](/reference/input)
* [light](/reference/light)
* [music](/reference/music)
* [pins](/reference/pins)
* [control](/reference/control)
* [serial](/reference/serial)
* [Brick](/reference/brick)
* [show string](/reference/brick/show-string)
* [show number](/reference/brick/show-number)
* [show value](/reference/brick/show-value)
* [show mood](/reference/brick/show-mood)
* [show image](/reference/brick/show-image)
* [clear screen](/reference/brick/clear-screen)
* [show ports](/reference/brick/show-ports)
* [on event](/reference/brick/button/on-event)
* [is pressed](/reference/brick/button/is-pressed)
* [was pressed](/reference/brick/button/was-pressed)
* [pause until](/reference/brick/button/pause-until)
* [set light](/reference/brick/set-status-light)
* [battery level](/reference/brick/battery-level)
* [Motors](/reference/motors)
* [run](/reference/motors/motor/run)
* [stop](/reference/motors/motor/stop)
* [reset](/reference/motors/motor/reset)
* [set brake](/reference/motors/motor/set-brake)
* [set inverted](/reference/motors/motor/set-inverted)
* [set regulated](/reference/motors/motor/set-regulated)
* [tank](/reference/motors/synced/tank)
* [steer](/reference/motors/synced/steer)
* [angle](/reference/motors/motor/angle)
* [speed](/reference/motors/motor/speed)
* [clear counts](/reference/motors/motor/clear-counts)
* [stop all motors](/reference/motors/stop-all)
* [Sensors](/reference/sensors)
* [Touch](/reference/sensors/touch-sensor)
* [on event](/reference/sensors/touch-sensor/on-event)
* [pause until](/reference/sensors/touch-sensor/pause-until)
* [is pressed](/reference/sensors/touch-sensor/is-pressed)
* [was pressed](/reference/sensors/touch-sensor/was-pressed)
* [Gyro](/reference/sensors/gyro)
* [angle](/reference/sensors/gyro/angle)
* [rate](/reference/sensors/gyro/rate)
* [reset](/reference/sensors/gyro/reset)
* [Ultrasonic](/reference/sensors/ultrasonic)
* [on event](/reference/sensors/ultrasonic/on-event)
* [distance](/reference/sensors/ultrasonic/distance)
* [pause until](/reference/sensors/ultrasonic/pause-until)
* [Infrared](/reference/sensors/infrared)
* [on event](/reference/sensors/infrared/on-event)
* [distance](/reference/sensors/infrared/proximity)
* [pause until](/reference/sensors/infrared/pause-until)
* [Infrared beacon](/reference/sensors/beacon)
* [on event](/reference/sensors/beacon/on-event)
* [pause until](/reference/sensors/beacon/pause-until)
* [is pressed](/reference/sensors/beacon/is-pressed)
* [was pressed](/reference/sensors/beacon/was-pressed)
* [set remote channel](/reference/sensors/beacon/set-remote-channel)
* [Color](/reference/sensors/color-sensor)
* [on color detected](/reference/sensors/color-sensor/on-color-detected)
* [pause until color detected](/reference/sensors/color-sensor/pause-until-color-detected)
* [on light detected](/reference/sensors/color-sensor/on-light-detected)
* [pause until light condition detected](/reference/sensors/color-sensor/pause-until-light-detected)
* [color](/reference/sensors/color-sensor/color)
* [light](/reference/sensors/color-sensor/ambient-light)
* [Music](/reference/music)
* [play sound effect](/reference/music/play-sound-effect)
* [play sound effect until done](/reference/music/play-sound-effect-until-done)
* [play tone](/reference/music/play-tone)
* [ring tone](/reference/music/ring-tone)
* [stop all sounds](/reference/music/stop-all-sounds)
* [rest](/reference/music/rest)
* [change tempo by](/reference/music/change-tempo-by)
* [set tempo](/reference/music/set-tempo)
* [note frequency](/reference/music/note-frequency)
* [beat](/reference/music/beat)
* [set volume](/reference/music/set-volume)
* [Control](/reference/control)
* [Timer](/reference/control/timer)
* [seconds](/reference/control/timer/seconds)
* [millis](/reference/control/timer/millis)
* [reset](/reference/control/timer/reset)
* [pause until](/reference/control/timer/pause-until)
* [Console](/reference/console)
* [log](/reference/console/log)
* [log value](/reference/console/log-value)
* [send to screen](/reference/console/send-to-screen)
## #misc
## devs

View File

@ -6,38 +6,42 @@ Welcome to the **Microsoft MakeCode** editor for the **@boardname@**!
You can program the @boardname@ using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser:
```block
input.buttonA.onEvent(ButtonEvent.Click, () => {
light.showRing(`blue blue blue blue blue blue blue blue blue blue`)
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
motors.largeA.run(50)
})
```
```typescript
input.buttonA.onEvent(ButtonEvent.Click, () => {
light.showRing(`blue blue blue blue blue blue blue blue blue blue`)
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
motors.largeA.run(50)
})
```
The editor work in [most modern browsers](/browsers), work [offline](/offline) once loaded and do not require any installation.
The editor works in [most modern browsers](/browsers). It works [offline](/offline) once loaded and doesn't require any installation. Take a look at some of the [features](/about/editor-features) of the editor.
## [Compile and Flash: Your Program!](/device/usb)
## Compile and Flash: Your Program!
When you have your code ready, you connect your @boardname@ to a computer via a USB cable
**then press the reset button** so it appears as a mounted drive (named **CPLAYBOOT**).
When you have your code ready, you connect your EV3 Brick to a computer with a USB cable so it appears as an attached drive (named **@drivename@**).
Compilation to machine code from [Blocks](/blocks) or [JavaScript](/javascript) happens in the browser. You save the binary
program to a **.uf2** file, which you then copy to the **CPLAYBOOT** drive, which flashes the device with the new program.
program to a **.uf2** file, which you then copy to the **@drivename@** drive. The process of copying will flash the device with the new program.
### ~ hint
**Experimental support** for Bluetooth download is now available. Please read the [Bluetooth](/bluetooth) page for more information.
### ~
## Simulator: Test Your Code
You can run your code using the micro:bit simulator, all within the confines of a web browser.
The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.
You can run your code using the @boardname@ simulator, all inside the same browser window.
The simulator has support for the EV3 Brick screen, buttons, sensors, and motors.
```sim
loops.forever(() => {
light.pixels.showAnimation(light.animation(LightAnimation.Rainbow), 1000)
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
motors.largeA.run(50)
motors.mediumD.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectDetected)
})
```
```package
light
```
```

View File

@ -0,0 +1,81 @@
# @extends
#### #blocks-images
| |
|-|
| ![Blocks Toolbox with Loops shelf open](/static/about/blocks-toolbox.png) |
| Blocks Toolbox |
#### #home-images
| |
|-|
| ![Home button](/static/about/home-button.png) |
| Home Button |
#### #share-images
| |
|-|
| ![Share button](/static/about/share-button.png) |
| Share Button |
#### #blocksjs-images
| |
|-|
| ![Switch from Blocks to JavaScript](/static/about/blocks-to-js.gif) |
| Switch from Blocks to JavaScript |
#### #help-images
| |
|-|
| ![Help button](/static/about/help-button.png) |
| Help Button |
#### #moresettings-images
| |
|-|
| ![More settings button](/static/about/more-settings.png) |
| More Button |
#### #undoredo-images
| | | |
|-|-|-|
| ![Undo button](/static/about/undo-button.png) | | ![Redo button](/static/about/redo-button.png) |
| Undo Button | | Redo Button |
#### #zoom-images
| | | |
|-|-|-|
| ![Zoom in button](/static/about/zoom-in.png) | | ![Zoom out button](/static/about/zoom-out.png) |
| Zoom In | | Zoom Out |
#### #saveproject-images
| |
|-|
| ![Save project field](/static/about/save-project.png) |
| Save Project |
#### #download-images
| |
|-|
| ![Download button](/static/about/download-button.png) |
| Download Button |
#### #explorer-images
| |
|-|
| ![Explorer button](/static/about/explorer-button.png) |
| Explorer Button |
| &nbsp; |
| ![Explorer File View](/static/about/explorer-view.png) |
| Explorer File View |

View File

@ -3,6 +3,6 @@
### #specific
```cards
loops.forever(() => {});
loops.pause(0)
forever(() => {});
pause(0)
```

62
docs/bluetooth.md Normal file
View File

@ -0,0 +1,62 @@
# Bluetooth
This page describes the procedure to download MakeCode program to the EV3 brick
over Bluetooth.
## ~ hint
### WARNING: EXPERIMENTAL FEATURES AHEAD!
Support for Bluetooth download relies on [Web Serial](https://wicg.github.io/serial/),
an experimental browser feature. Web Serial is a work [in progress](https://www.chromestatus.com/feature/6577673212002304);
it may change or be removed in future versions without notice.
By enabling these experimental browser features, you could lose browser data or compromise your device security
or privacy.
## ~
https://youtu.be/VIq8-6Egtqs
## Supported browsers
* Chrome desktop, version 77 and higher, Windows 10 or Mac OS.
* [Edge Insider desktop](https://www.microsoftedgeinsider.com), version 77 and higher, Windows 10 or Mac OS.
To make sure your browser is up to date, go to the '...' menu, click "Help" then "About".
Next you need to enable the experimental features (this may change in the future)
* go to **chrome://flags/#enable-experimental-web-platform-features** and **enable**
**Experimental Web Platform features**
![A screenshot of the flags page in chrome](/static/bluetooth/experimental.png)
## Machine Setup
* pair your EV3 brick with your computer over Bluetooth. This is the usual pairing procedure.
## Download over Bluetooth
* go to https://makecode.mindstorms.com/
* click on **Download** to start a file download as usual
* on the download dialog, you should see a **Bluetooth** button. Click on the
**Bluetooth** button to enable the mode.
* **make sure the EV3 brick is not running a program**
* click on **Download** again to download over bluetooth.
## Choosing the correct serial port
Unfortunately, the browser dialog does not make it easy to select which serial port is the brick.
* On Windows, choose ``Standard Serial over Bluetooth``. There might be multiple of those but only one works. Try your luck! Once you know the COM port number, remember it for the next time around.
* On Mac OS, choose ``cu.BRICKNAME-SerialPort``
## Known issues
* We do not detect properly that the program is running on the brick. Make sure to stop the program before starting the download procedure.
* The list of programs on the brick screen is not updated when uploading via bluetooth.
## Feedback
Please send us your feedback through https://forum.makecode.com.

27
docs/coding.md Normal file
View File

@ -0,0 +1,27 @@
# Coding Activites
## Projects
```codecard
[
{
"name": "Autonomous Parking",
"description": "Design cars that can park themselves safely without driver intervention.",
"url":"/coding/autonomous-parking",
"imageUrl": "/static/lessons/autonomous-parking.png",
"cardType": "side"
}, {
"name": "Object Detection",
"description": "Design ways to avoid accidents between vehicles and objects in the road.",
"url":"/coding/object-detection",
"imageUrl": "/static/lessons/object-detection.jpg",
"cardType": "side"
}, {
"name": "Line Detection",
"description": "Design ways to improve driving safety by helping to prevent drivers from falling asleep and causing an accident.",
"url":"/coding/line-detection",
"imageUrl": "/static/lessons/line-detection.jpg",
"cardType": "side"
}]
```

View File

@ -0,0 +1,177 @@
# Autonomous Parking
Design cars that can park themselves safely without driver intervention.
![Autonomous parking graphic](/static/coding/autonomous-parking/auto-parking-connect.jpg)
## Connect
**Think about:**
* How do autonomous cars work?
* What would it take to ensure that autonomous cars are safe?
* What types of movements do autonomous cars need to perform?
## Construct
### Build
Build a @boardname@ vehicle that can park itself safely without driver intervention. Start by constructing this model:
[![EV3- Robot Driving Base](/static/coding/autonomous-parking/ev3-robot-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Check
Before you program, check:
* Are all the wires correctly connected from the motors to ports B and C?
* Are the wheels correctly installed?
* Are the wheels rotating freely?
### Program
Write a program that will make the robot turn three times in various ways.
**Think about:**
* How will you make the robot turn in different ways?
* How can the robot make a three point turn?
### ~hint
Consider using these blocks in your solution:
```block
motors.largeBC.tank(50, 50)
pause(500)
```
### ~
### Sample Solution - Three Point Turn
1. When the brick button is pressed, turn the driving base right and stop after 1.5 seconds.
2. Turn the driving base left and stop after 1 second.
3. Move the driving base forward for 3 seconds.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.tank(75, 30)
loops.pause(1500)
motors.largeBC.tank(-30, -75)
loops.pause(1000)
motors.largeBC.tank(50, 50)
loops.pause(3000)
})
```
### Download and test
Click Download and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
Choose one of the following autonomous driving scenarios and create a program for it:
* Parallel parking
* Angle parking
* Perpendicular parking
### ~hint
Document pseudocode for your program before choosing programming blocks.
### ~
### Sample Solution - Parallel Parking
1. When the brick button is pressed, drive forward in a straight line for 3 rotations.
2. Wait for 1 second.
3. Reverse motor rotation while turning for 1.5 rotations.
4. Reverse motor rotation while turning the other way for 1.5 rotations.
5. Drive backward in a straight line for 0.5 rotations.
6. Drive forward in a straight line for 0.5 rotations.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.steer(0, 50, 3, MoveUnit.Rotations)
pause(1000)
motors.largeBC.steer(-50, -50, 1.5, MoveUnit.Rotations)
motors.largeBC.steer(50, -50, 1.5, MoveUnit.Rotations)
motors.largeBC.steer(0, -50, 0.5, MoveUnit.Rotations)
motors.largeBC.steer(0, 50, 0.5, MoveUnit.Rotations)
})
```
### Download and test
Click Download and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
### Differentiation
Create a program that simulates displaying appropriate warning lights while parking.
### ~hint
Consider using this block in your solution:
```block
brick.setStatusLight(StatusLight.OrangeFlash)
```
### ~
### Sample Solution - Simulating Reverse Gear and Reverse Warning Lights
1. When the brick button is pressed, drive forward in a straight line for 3 rotations.
2. Wait for 1 second.
3. Set brick status light to orange flash.
4. Reverse motor rotation while turning for 1.5 rotations.
5. Reverse motor rotation while turning the other way for 1.5 rotations.
6. Drive backward in a straight line for 0.5 rotations.
7. Set brick status light to off.
8. Drive forward in a straight line for 0.5 rotations.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.steer(0, 50, 3, MoveUnit.Rotations)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
motors.largeBC.steer(-50, -50, 1.5, MoveUnit.Rotations)
motors.largeBC.steer(50, -50, 1.5, MoveUnit.Rotations)
motors.largeBC.steer(0, -50, 0.5, MoveUnit.Rotations)
brick.setStatusLight(StatusLight.Off)
motors.largeBC.steer(0, 50, 0.5, MoveUnit.Rotations)
})
```
### Download and test
Click Download and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
### Share
**Think about:**
* What challenged you?
* Were there any surprises?
* How can you improve your program?
* Can your program be more streamlined? Have you used too many blocks?
* Is there a more efficient way to build your program?
* How can your program be used in real-world scenarios?
## Continue
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds from the Brick or Music menus.
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -0,0 +1,65 @@
# Cruise Control
Learn how to set and adjust motor speeds.
## Activity 1
Increase motor speed when touch sensor `1` is pressed.
```blocks
let speed = 0;
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
if (speed < 100)
speed = speed + 10;
motors.largeBC.run(speed);
})
```
## Activity 2
Add a "reduce" motor speed action when touch sensor `2` is pressed.
```blocks
let speed = 0;
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
if (speed < 100)
speed = speed + 10;
motors.largeBC.run(speed);
})
sensors.touch2.onEvent(ButtonEvent.Pressed, function () {
if (speed > -100)
speed = speed - 10;
motors.largeBC.run(speed);
})
```
## Activity 3
Refactor your code by moving the speed increase and speed decrease code into ``||functions:accelerate||`` and ``||functions:decelerate||`` functions. Run the motors at the new speed in an ``||functions:update||`` function.
```blocks
let speed = 0
function decelerate() {
if (speed > -100) {
speed = speed - 10
}
}
function accelerate() {
if (speed < 100) {
speed = speed + 10
}
}
function update() {
brick.clearScreen()
brick.showString("speed: " + speed, 1)
motors.largeBC.run(speed)
}
sensors.touch2.onEvent(ButtonEvent.Pressed, function () {
accelerate()
update()
})
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
decelerate()
update()
})
```

48
docs/coding/ignition.md Normal file
View File

@ -0,0 +1,48 @@
# Ignition
Explore sensor events and sensor status.
## Activity 1
Wait for a touch sensor press or ultrasonic object detection. Show an expression on the screen when they happen.
```blocks
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
brick.showImage(images.eyesDizzy)
})
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () {
brick.showImage(images.eyesTiredMiddle)
})
brick.showImage(images.eyesSleeping)
```
## Activity 2
Play some motor sounds if touch sensor `1` is pressed at the same moment when and object comes close.
```blocks
while (true) {
if (sensors.touch1.isPressed() &&
sensors.ultrasonic4.distance() < 10) {
music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
}
pause(1);
}
```
## Activity 3
Play some motor sounds if touch sensor `1` is pressed when both the `enter` button is pressed on the brick and an object comes close.
```blocks
while (true) {
if (sensors.ultrasonic4.distance() < 10 &&
sensors.touch1.isPressed() &&
brick.buttonEnter.isPressed()) {
music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
}
pause(1);
}
```

View File

@ -0,0 +1,9 @@
# Light the way Activity 1
```blocks
sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function () {
brick.showImage(images.objectsLightOn)
pause(5000)
brick.clearScreen()
})
```

View File

@ -0,0 +1,10 @@
# Light the way Activity 2
```blocks
sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Bright, function () {
brick.clearScreen()
})
sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function () {
brick.showImage(images.objectsLightOn)
})
```

View File

@ -0,0 +1,13 @@
# Light the way Activity 3
```blocks
sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Bright, function () {
brick.clearScreen()
})
sensors.color3.onLightDetected(LightIntensityMode.Ambient, Light.Dark, function () {
brick.showImage(images.objectsLightOn)
})
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
brick.showImage(images.objectsLightOn);
})
```

View File

@ -0,0 +1,241 @@
# Line Detection
Design ways to improve driving safety by helping to prevent drivers from falling asleep and causing an accident.
![Car following the line on the road](/static/coding/line-detection/car-road-line.jpg)
## Connect
Think about:
* How can autonomous cars react to different traffic light signals?
* What can happen if a driver falls asleep while driving?
* How can we detect when a driver is falling asleep?
## Construct
### Build
Build a @boardname@ vehicle that can help prevent drivers from falling asleep and causing an accident. Start by constructing this model:
[![EV3 robot with color sensor](/static/coding/line-detection/ev3-robot-color-sensor-down.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-color-sensor-down-driving-base-d30ed30610c3d6647d56e17bc64cf6e2.pdf)
Build red and green “lights” for your robot to detect. You can use LEGO bricks, colored tape, or marker on white paper. Building instructions:
[![IMAGE: Color Squares](/static/coding/line-detection/ev3-color-squares.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/color%20squares-0a88dfd98bb2e64b5b8151fc422bae36.pdf)
### ~hint
If clicking the above images doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Check
Before you program, check:
* Are all the wires correctly connected from the motors to ports B and C?
* Are the wheels correctly installed?
* Are the wheels rotating freely?
* Are the wires connected from the Color Sensor to port 3?
![EV3 Driving Base](/static/coding/line-detection/ev3-robot-driving-base.jpg)
### Program
Autonomous cars need to recognize and respond to traffic lights automatically. Create a program that will make your robot stop at red lights. Make sure your robot is only responding to the color red. Once you have succeeded, program your robot to drive forward again when the light changes from red to green.
Before you program, think about:
* How will you program the robot to detect a color?
* How will you program the robot to stop at a color?
* Which programming blocks will you use?
### ~ hint
Consider using these blocks in your solution:
```block
loops.forever(function () {
})
motors.largeBC.steer(0, 50)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
```
### ~
### Sample Solution - Red light detection
1. Loop forever.
2. Start motors ``B`` and ``C`` (drive forward).
3. Wait for the color sensor to detect the color red.
4. Stop all motors.
```blocks
loops.forever(function () {
motors.largeBC.steer(0, 50)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
Congratulations! Your robot can stop at a red light.
Now add to your program and have your robot to drive forward again when the light changes from red to green.
### Sample Solution - Red and green light detection in a loop
1. Start motors ``B`` and ``C`` (drive forward).
2. Wait for the color sensor to detect the color red.
3. Stop all motors.
4. Wait for the color sensor to detect the color green.
5. Loop forever.
```blocks
loops.forever(function () {
motors.largeBC.steer(0, 50)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Green)
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
## Contemplate
To simulate what could happen if a driver falls asleep while driving, your robot could sound an alarm signal when it crosses the line. This feature is often available in new cars.
Program your robot to perform this function.
Draw a dark line with tape or marker for your robot to cross.
### ~hint
Consider using these blocks in your solution:
```block
motors.largeBC.steer(0, 50)
music.playSoundEffect(sounds.systemGeneralAlert)
```
### ~
### Sample Solution - Line detection in a loop
1. Start motors ``B`` and ``C`` (drive forward with a curve toward the line).
2. Wait for the color sensor to detect the color black.
3. Play sound effect ``system general alert``.
4. Start motors ``B`` and ``C`` (drive forward with a curve away from the line).
5. Wait for the color sensor to detect the color white.
6. Loop forever.
```blocks
loops.forever(function () {
motors.largeBC.steer(-30, 20)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Black)
music.playSoundEffect(sounds.systemGeneralAlert)
motors.largeBC.steer(30, 20)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.White)
})
```
#### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
#### Differentiation
Program your robot to drive on “autopilot” along a given route. You will need to create a program that recognizes and responds to a dark line (or white line). You will create a line-following program and your robot will need to travel along the line without losing contact with it.
You will need to constantly debug your program in order to make your robot travel as smoothly as possible along the line.
### ~hint
Consider using these blocks in your solution:
```block
while (true) {
}
motors.largeBC.steer(0, 50)
```
> **- OR -**
```block
if (true) {
} else {
}
```
### ~
### Sample Solutions - Line Following in Loop
#### Method 1
1. While the Color Sensor detects the color black, start motors ``B`` and ``C`` (drive forward with a curve toward the line).
2. While the Color Sensor detects the color white, start motors ``B`` and ``C`` (drive forward with a curve away from the line).
3. Loop forever.
```blocks
forever(function () {
while (sensors.color3.color() == ColorSensorColor.Black) {
motors.largeBC.steer(-30, 50)
}
while (sensors.color3.color() == ColorSensorColor.White) {
motors.largeBC.steer(30, 50)
}
})
```
#### Method 2
1. If the Color Sensor detects the color black, start motors ``B`` and ``C`` (drive forward with a curve toward the line).
Else the Color Sensor detects the color white, start motors ``B`` and ``C`` (drive forward with a curve away from the line).
2. Loop forever.
```blocks
forever(function () {
if (sensors.color3.color() == ColorSensorColor.Black) {
motors.largeBC.steer(-30, 50)
} else {
motors.largeBC.steer(30, 50)
}
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
### Share
Think about:
* What challenged you?
* Were there any surprises?
* How can you improve your program?
* Can your program be more streamlined? Have you used too many blocks?
* Is there a more efficient way to build your program?
* How can your program be used in real-world scenarios?
Personalize:
* Click on the **JavaScript** tab and experiment with changing the values in the code.
* Add a custom image or sounds from the ``||brick:Brick||`` or ``||music:Music||`` menus.
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -0,0 +1,143 @@
# Object Detection
Design ways to avoid accidents between vehicles and objects in the road.
![Deer in the road](/static/coding/object-detection/road-deer.jpg)
## Connect
Think about:
* In what driving situations can a car hit an obstacle?
* What do you need to be aware of to avoid collisions with obstacles?
* What causes traffic jams in high density areas?
## Construct
### Build
Build a @boardname@ vehicle that can avoid accidents between vehicles and objects in the road. Start by constructing this model:
[![EV3 Robot Driving Base](/static/coding/object-detection/ev3-robot-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-ultrasonic-sensor-driving-base-61ffdfa461aee2470b8ddbeab16e2070.pdf)
Build an obstacle for your robot to detect. You can build the **cuboid model** out of LEGO bricks or an obstacle of your choice.
[![Cubiod block](/static/coding/object-detection/ev3-cuboid.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-cuboid-dc93b2e60bed2981e76b3bac9ea04558.pdf)
### ~hint
If clicking the above images doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Check
Before you program, check:
* Are all the wires correctly connected from the motors to ports B and C?
* Are the wheels correctly installed?
* Are the wheels rotating freely?
* Are the wires connected from the Ultrasonic Sensor to port 4?
### Program
* Program your robot to detect any obstacles that might appear while the robot is moving forward (or backward).
* Make the robot stop when it detects an object that is less than 20 cm away.
Before you program, think about:
* How will you program the robot to detect obstacles?
* How will you program the robot to stop at obstacles?
* Which programming blocks will you use?
### ~hint
Consider using these blocks in your solution:
```block
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
})
motors.largeBC.steer(0, 50)
pauseUntil(() => true)
let near = sensors.ultrasonic4.distance() < 20
motors.stopAll()
```
### ~
### Sample Solution
1. Start the program when EV3 ``enter`` button is pressed.
2. Turn motors ``B`` and ``C`` on at speed ``50``.
3. Wait until Ultrasonic Sensor detects an obstacle at a distance of less than ``20`` cm.
4. Stops all motors.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.steer(0, 50)
pauseUntil(() => sensors.ultrasonic4.distance() < 20)
motors.stopAll()
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the ``center`` button on the EV3 Brick to run the program.
## Contemplate
On the road, when a driver sees and object, they slow their car down before coming to a full stop.
Program your EV3 Driving Base to do the same.
If the Ultrasonic Sensor:
* Detects an object less than `10` cm away, make the robot stop.
* Detects an object between `10` and `20` cm away, make the robot slow down.
* Does not detect any object, continue to move at full speed.
### ~hint
Consider using this block in your solution:
```block
if (true) {
}
```
### ~
### Sample Solution
```blocks
loops.forever(function () {
motors.largeBC.steer(0, 50)
if (sensors.ultrasonic4.distance() < 10) {
motors.stopAll()
} else if (sensors.ultrasonic4.distance() < 20) {
motors.largeBC.steer(0, 10)
}
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the ``center`` button on the EV3 Brick to run the program.
## Continue
* Get together with other building teams and make a traffic jam by placing all of your robots in a line with varying amounts of space between them.
* Have everyone start their robots at the same time and see what happens.
* Refine your programs so that all of the robots continue driving at the same speed with equal distances between them.
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds from the Brick or Music menus.
### Share
* Share what you think “efficiency in programming” means.
* Explore the different solutions other programmers came up with.
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -0,0 +1,11 @@
# Reverse Beeper Activity 1
```blocks
forever(function () {
music.playTone(440, sensors.ultrasonic4.distance());
pause(50)
})
motors.largeBC.run(-20);
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.stop();
```

View File

@ -0,0 +1,13 @@
# Reverse Beeper Activity 2
```blocks
forever(function () {
if (motors.largeB.speed() != 0 && sensors.ultrasonic4.distance() < 20) {
music.playTone(440, sensors.ultrasonic4.distance());
pause(50)
}
})
motors.largeBC.run(-20);
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.stop();
```

View File

@ -0,0 +1,20 @@
# Reverse Beeper Activity 2
```blocks
let beep = false
beep = true
control.runInParallel(function () {
motors.largeBC.run(-20)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear)
motors.largeBC.stop()
beep = false
})
control.runInParallel(function () {
while (beep) {
if (sensors.ultrasonic4.distance() < 20) {
music.playTone(440, sensors.ultrasonic4.distance())
pause(50)
}
}
})
```

View File

@ -0,0 +1,14 @@
# Reversing the robot Activity 1
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
motors.largeBC.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeBC.run(0)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
motors.largeBC.run(-50)
pause(2000)
motors.largeBC.run(0)
})
```

View File

@ -0,0 +1,15 @@
# Reversing the robot Activity 2
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeBC.run(50)
sensors.touch2.pauseUntil(ButtonEvent.Pressed)
motors.largeBC.run(0)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
motors.largeBC.run(-50)
pause(2000)
motors.largeBC.run(0)
})
```

View File

@ -0,0 +1,19 @@
# Reversing the robot Activity 3
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
brick.showImage(images.eyesSleeping)
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
brick.showImage(images.eyesNeutral)
motors.largeBC.run(50)
sensors.touch2.pauseUntil(ButtonEvent.Pressed)
brick.showImage(images.eyesTiredMiddle)
motors.largeBC.run(0)
pause(1000)
brick.setStatusLight(StatusLight.OrangeFlash)
brick.showImage(images.eyesDizzy)
motors.largeBC.run(-50)
pause(2000)
motors.largeBC.run(0)
})
```

32
docs/coding/roaming-1.md Normal file
View File

@ -0,0 +1,32 @@
# Roaming Activity 1
```blocks
let drive: number[] = []
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function () {
drive.push(1)
})
brick.buttonRight.onEvent(ButtonEvent.Bumped, function () {
drive.push(3)
})
brick.buttonUp.onEvent(ButtonEvent.Bumped, function () {
drive.push(4)
})
brick.buttonDown.onEvent(ButtonEvent.Bumped, function () {
drive.push(5)
})
pauseUntil(() => drive.length >= 5)
pause(1000)
music.playSoundEffectUntilDone(sounds.communicationGo)
for (let d of drive) {
if (d == 1) {
motors.largeC.run(50, 360, MoveUnit.Degrees)
} else if (d == 3) {
motors.largeB.run(50, 360, MoveUnit.Degrees)
} else if (d == 4) {
motors.largeBC.run(50, 360, MoveUnit.Degrees)
} else {
motors.largeBC.run(-50, 360, MoveUnit.Degrees)
}
}
music.playSoundEffectUntilDone(sounds.communicationGameOver)
```

36
docs/coding/roaming-2.md Normal file
View File

@ -0,0 +1,36 @@
# Roaming Activity 2
```blocks
let drive: number[] = []
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function () {
drive.push(1)
music.playSoundEffectUntilDone(sounds.systemClick)
})
brick.buttonRight.onEvent(ButtonEvent.Bumped, function () {
drive.push(3)
music.playSoundEffectUntilDone(sounds.systemClick)
})
brick.buttonUp.onEvent(ButtonEvent.Bumped, function () {
drive.push(4)
music.playSoundEffectUntilDone(sounds.systemClick)
})
brick.buttonDown.onEvent(ButtonEvent.Bumped, function () {
drive.push(5)
music.playSoundEffectUntilDone(sounds.systemClick)
})
brick.buttonEnter.pauseUntil(ButtonEvent.Bumped);
pause(1000)
music.playSoundEffectUntilDone(sounds.communicationGo)
for (let d of drive) {
if (d == 1) {
motors.largeC.run(50, 360, MoveUnit.Degrees)
} else if (d == 3) {
motors.largeB.run(50, 360, MoveUnit.Degrees)
} else if (d == 4) {
motors.largeBC.run(50, 360, MoveUnit.Degrees)
} else {
motors.largeBC.run(-50, 360, MoveUnit.Degrees)
}
}
music.playSoundEffectUntilDone(sounds.communicationGameOver)
```

View File

@ -0,0 +1,12 @@
# Three Point Turn Activity 1
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
motors.largeBC.tank(75, 30)
pause(1500)
motors.largeBC.tank(-30, -75)
pause(1000)
motors.largeBC.tank(50, 50)
pause(3000)
})
```

View File

@ -0,0 +1,14 @@
# Three Point Turn Activity 2
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
motors.largeBC.tank(75, 30)
pause(1500)
motors.largeBC.tank(-30, -75)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.tank(0, 0)
pause(1000)
motors.largeBC.tank(50, 50)
pause(3000)
})
```

View File

@ -0,0 +1,15 @@
# Three Point Turn Activity 3
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
motors.largeBC.tank(75, 30)
pause(1500)
motors.largeBC.tank(-30, -75)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
motors.largeBC.tank(0, 0)
music.playSoundEffect(sounds.animalsDogBark1)
pause(1000)
motors.largeBC.tank(50, 50)
pause(3000)
})
```

View File

@ -0,0 +1,9 @@
# Traffic Lights Activity 1
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
motors.largeBC.tank(20, 20)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.largeBC.tank(0, 0)
})
```

View File

@ -0,0 +1,10 @@
# Traffic Lights Activity 2
```blocks
sensors.color3.onColorDetected(ColorSensorColor.Red, function () {
motors.largeBC.tank(0, 0)
})
sensors.color3.onColorDetected(ColorSensorColor.Green, function () {
motors.largeBC.tank(20, 20)
})
```

View File

@ -0,0 +1,11 @@
# Traffic Lights Activity 3
```blocks
forever(function () {
if (sensors.color3.light(LightIntensityMode.Reflected) < 15) {
motors.largeBC.tank(30, 12)
} else {
motors.largeBC.tank(12, 30)
}
})
```

View File

@ -0,0 +1,29 @@
# Design Engineering Projects
## Projects
```codecard
[
{
"name": "Make It Move Without Wheels",
"description": "Design, build and program a robot that can move itself using no wheels for locomotion.",
"imageUrl": "/static/lessons/make-it-move-without-wheels.png",
"url": "/design-engineering/make-it-move",
"cardType": "side"
},
{
"name": "Make It Smarter and Faster",
"description": "Design, build and program a robotic creature that can sense its environment and respond by moving.",
"imageUrl": "/static/lessons/make-it-smarter-and-faster.png",
"url": "/design-engineering/make-it-smarter",
"cardType": "side"
},
{
"name": "Make a System that Communicates",
"description": "Design, build and program a robotic system that follows a path and communicates its position at least twice along the way.",
"imageUrl": "/static/lessons/make-a-system-that-communicates.png",
"url": "/design-engineering/make-it-communicate",
"cardType": "side"
}
]
```

View File

@ -0,0 +1,163 @@
# Make A System That Communicates
## Connect
### Design Brief
Design, build and program a robotic system that follows a path and communicates its position at least twice along the way.
https://www.youtube.com/watch?v=6piMI1JPDQc
* Robotic systems are built from smaller, related subsystems. Look at the automobile system shown in the video. What subsystems can you see?
* What kinds of robots follow a path?
* What kind of system do you want to make?
### Brainstorm
Discuss different solutions to the design brief.
Think about:
* What kind of motorized mechanism can be used to control the movements of a robot?
* How can the robot sense where it is along the path?
* How can the robot communicate its position?
![EV3 + LEGO Bricks](/static/lessons/make-it-communicate/ev3-plus-parts.jpg)
## Construct
### Build
You can start by tinkering with the LEGO elements in the picture and then build on.
More building ideas:
[![EV3 Frames](/static/lessons/make-it-communicate/ev3-frames.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/ev3%20frames-5054ee378e624fb4cb31158d2fc8e5cf.pdf)
[![Tracks](/static/lessons/make-it-communicate/ev3-tracks.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/tracks-32d7554813af3f25cf5012d54a4bad2b.pdf)
[![Color Sensor 2](/static/lessons/make-it-communicate/ev3-color-sensor2.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/color%20sensor_v2-e7fd54b6fa3cdfe36f414c1d2510f9cb.pdf)
### ~hint
If clicking the above images doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
Build a path for your robot to follow. You can use electrical tape on a floor, or marker on paper. You can use objects as milestones to indicate a path that can be detected by either the Touch Sensor, Color Sensor, or Ultrasonic Sensor.
### Program
Before you program, think about:
* How will you program the robot to follow a path?
* How will you program the robot to communicate its position?
* Which programming blocks will you use?
### ~hint
Explore the different Motor and Sensor blocks in the programming menu.
### ~
### Sample Solution
[![Video: EV3 Track Rover](/static/lessons/make-it-communicate/ev3-track-rover.jpg)](https://legoeducation.23video.com/v.ihtml/player.html?token=79c99735f906403a4dd7f2909935983d&source=embed&photo%5fid=19857954)
The Track Rover follows a path using the color sensor. It identifies two locations by color.
Track Rover solution combines these building ideas:
* EV3 frames
* Tracks
* Color sensor 2
Two copies of the tracks are built: one for the right side and a mirror image for the left side.
[![Track rover assembled](/static/lessons/make-it-communicate/ev3-track-rover2.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/ev3-dep/building%20instructions/track-rover-bi-6aadb1b053df0c58a0dea108b5ce0eea.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Sample Program Solution
This program works with the Track Rover. If you create a different robot, adjust the program to fit your solution.
Program summary:
* If the Color Sensor sees black, Motor B runs at -50 power and Motor C turns off.
* If the Color Sensor sees white, Motor B turns off and Motor C runs at -50 power.
* If the Color Sensor sees green, all motors stop and the green sound plays.
* The robot waits one second, then motors move forward.
* If the Color Sensor sees red, all motors stop, and the red sound plays.
* The robot waits one second, then motors move forward.
* Loops unlimited.
```blocks
forever(function () {
if (sensors.color3.color() == ColorSensorColor.Black) {
motors.largeB.run(-50)
motors.largeC.run(0)
} else if (sensors.color3.color() == ColorSensorColor.White) {
motors.largeC.run(-50)
motors.largeB.run(0)
} else if (sensors.color3.color() == ColorSensorColor.Green) {
motors.stopAll()
music.playSoundEffectUntilDone(sounds.colorsGreen)
motors.largeBC.run(-50)
} else if (sensors.color3.color() == ColorSensorColor.Red) {
motors.stopAll()
music.playSoundEffectUntilDone(sounds.colorsRed)
motors.largeBC.run(-50)
}
})
```
### Download and test
Click Download and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
### Test and Analyze
As you work on your solution:
1. Describe one part of your design that worked especially well.
2. Describe one design change that you had to make.
3. What will you try next?
### Review and Revise
Take a moment to reflect on your robot solution.
Think about:
* Can the robots movement be more accurate?
* What are some ways that others have solved the problem?
Describe two ways you could improve your robot.
## Continue
### Personalize your project
* Add/remove LEGO elements to improve the way your robot moves.
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds by adding blocks from the Brick or Music menus.
## Communicate
Here are some ideas:
* Create a video of your project, especially your final presentation and your robots performance.
* Explain some important features of your software program.
* Produce a building guide for your model by taking a series of photographs as you deconstruct it.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -0,0 +1,105 @@
# Make It Move Without Wheels
## Connect
### Design Brief
Design, build and program a robot that can move itself using no wheels for locomotion.
![Make it move banner](/static/lessons/make-it-move/make-it-move-without-wheels.png)
Your robot will:
* Go a distance of at least 30cm
* Use at least one motor
* Use NO wheels for locomotion
### Brainstorm
In nature, creatures use many methods to get around. None of them, however, use wheels to move. Can we copy the method of animal locomotion with our robot? Using motors and legs, make a robot that can move without using any wheels.
## Construct
### Build
Think about a creatures movement for inspiration. Will you make the robot walk, crawl, hop, or wiggle? Your mechanism can be attached or unattached to the EV3 Brick. You can start by tinkering with the LEGO elements in the picture above and then build on.
### Building Hint
If you want some building help you can follow these instructions.
[![Toddle Bot](/static/lessons/make-it-move/toddle-bot.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/toddle%20bot-3dcad146d7f5deac4753f93e9dcc0739.pdf)
Click [here](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/toddle%20bot-3dcad146d7f5deac4753f93e9dcc0739.pdf)
### ~hint
If clicking the above image or link doesn't open the instructions, right-click on the link and choose "Save link as..." to download the PDF.
### ~
### Program
Before you program, think about:
* How will you program the robot to move?
* How will you program the robot to stop?
* How will you program the robot to display the distance moved?
Which programming blocks will you use:
* To turn on and turn off the motor or motors?
* To display the distance moved?
### Sample Code
Example code of a robot that moves without wheels using one motor:
* The robot moves with ``large motor D`` rotating at ``-100`` speed
* The robot moves for ``30000`` milliseconds (30 seconds)
* The robot stops
* The robot displays the text ``"30cm"``
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeD.run(-100)
loops.pause(30000)
motors.stopAll()
brick.showString("30cm", 1)
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
### Test and Analyze
Think about:
* Is the robot using something other than wheels to move? Trace the movement from the motor axle to the mechanism(s) that drives the robot forward, backward or sideways. Wheels can be used to stabilize the robot but not to drive it.
* Does the robot display the distance moved? Is it accurate? How do you know?
* What is one part of your design that worked well?
* What is a change that you need to make?
* What will you try next?
## Continue
### Personalize your project
* Add/remove LEGO elements to improve the way your robot moves. Will your robot walk, wiggle, hop, or slither? Will it move slower, faster or farther?
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds by adding blocks from the Brick or Music menus.
* Does your robot resemble a creature? Add arts and crafts materials to your project.
## Communicate
* Create a video of your project, especially your final presentation and your robots performance.
* Explain some important features of your software program.
* Produce a building guide for your model by taking a series of photographs as you deconstruct it.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -0,0 +1,178 @@
# Make It Smarter and Faster
## Connect
### Design Brief
Design, build and program a robotic creature that can sense its environment and respond by moving.
https://www.youtube.com/watch?v=y9-A_C_08KY
* What do the robots in the video need to be able to sense, plan, and act?
* What senses do humans have and why are they important to us?
* How many human-like senses do you see the robots demonstrating?
### Brainstorm
Discuss different solutions to the design brief.
Think about:
* What kind of creature can it be?
* How can it move?
* What does it need to be aware so that it stays safe, well fed and warm (or cool)?
* Is it looking for food, a safe place to hide or a warm place to soak up the sun?
* Will the creature need to move fast or slow?
* Will it need to turn?
* Will it need to go backward?
![EV3 and bricks](/static/lessons/make-it-smarter/bricks.png)
## Construct
### Build
Think about a creatures movement for inspiration. Your mechanism can be attached or unattached to the EV3 Brick. You can start by tinkering with the LEGO elements in the picture add then build on.
More building ideas:
* [EV3 Frames]
* [Color Sensor 1]
* [Gyro Sensor]
* [Ultrasonic Sensor]
* [Touch Sensor]
* [Jaw]
* [Leg 1]
* [Leg 2]
* [Leg 3]
### ~hint
If clicking the above links doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Program
Before you program, think about:
* How will you program the robot to sense?
* How will you program the robot to respond?
* Which programming blocks will you use?
### ~hint
**Hint:** Explore the different Sensor blocks in the Sensors Menu
### ~
### Sample Solution
The Insect uses its Ultrasonic Sensor to sense danger and move away from a threat.
https://www.youtube.com/watch?v=PoeYoiXHHE4
<br/>
The Insect solution combines these building ideas:
* [EV3 Frames]
* [Leg 2]
* [Leg 3]
* [Ultrasonic Sensor]
Four copies of Leg 3 are built: one for the front left, one for the back right, and two mirror copies for the front right and back left.
Building Instructions:
[![Insect robot](/static/lessons/make-it-smarter/insect-bot.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/insect-94b8a46f0dc5082c9d78ddb734626dc9.pdf)
### ~hint
If clicking the above images or links doesn't open the instructions, right-click on the link and choose "Save link as..." to download the PDF.
### ~
### Sample Solution
This program checks if the Ultrasonic Sensor senses something near.
The blocks inside the ``||loops:forever||`` loop have these actions:
1. Turn on the ``green`` EV3 Brick Status Light.
2. Wait for Ultrasonic Sensor to detect an object.
3. Turn on Motors ``A`` and ``D`` in opposite directions.
4. Wait for one and a half seconds (``1500`` milli seconds).
5. Reverse the direction of Motors ``A`` and ``D``.
6. Wait for one and a half seconds.
7. Stop all motors.
8. Make an insect chirping sound.
9. Loop continuously so that the insect wanders around when the Ultrasonic Sensor is detects something.
```blocks
forever(function () {
brick.setStatusLight(StatusLight.Green)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectDetected)
motors.largeAD.tank(50, -50)
pause(1500)
motors.largeAD.tank(-50, 50)
pause(1500)
motors.stopAll()
music.playSoundEffectUntilDone(sounds.animalsInsectChirp)
})
```
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
### Test and Analyze
As you work on your solution:
1. Describe one part of your design that worked especially well.
2. Describe one design change that you had to make.
3. What will you try next?
### Review and Revise
Take a moment to reflect on your robot solution.
Think about:
* Does your robot move when the sensor is activated?
* If not, what will you change to make the robots ability to sense and respond more obvious?
* What other behaviors can you add to the robot to make it more realistic?
Describe two ways you could improve your robot.
## Continue
Personalize your project:
* Add/remove LEGO elements to improve the way your robot moves.
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds by adding blocks from the Brick or Music menus.
* Does your robot resemble a creature? Maybe add more craft materials to your project.
## Communicate
Here are some ideas:
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Produce a building guide for your model by taking a series of photographs as you deconstruct it.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?
[EV3 Frames]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/ev3%20frames-5054ee378e624fb4cb31158d2fc8e5cf.pdf
[Color Sensor 1]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/color%20sensor_v1-16a7231bdc187cd88a8da120c68f58d5.pdf
[Gyro Sensor]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/gyro%20sensor-6f0fdbd82ae45fe0effa0ebf3f460f3d.pdf
[Ultrasonic Sensor]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/ultrasonic%20sensor-a56156c72e8946ed4c58c5e69f3520d3.pdf
[Touch Sensor]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/touch%20sensor-868fda1b9d6070a0a034fb22456a7fc9.pdf
[Jaw]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/jaw-ee93e8f3243e4d30cd34b0c337c33653.pdf
[Leg 1]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/leg%201-c14624046ea3a95148820ed404f5ac65.pdf
[Leg 2]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/leg%202-8855c35b990205f6b9d7130687a3d4db.pdf
[Leg 3]: https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/leg%203-575d52ef15fb79f1e4d3350d36607160.pdf

View File

@ -2,7 +2,226 @@
Here are some fun programs for your @boardname@!
## Maker
```codecard
[
{
"name": "Sound Of Color",
"description": "Play different sounds based on the color",
"url":"/maker/sound-of-color",
"cardType": "example",
"imageUrl": "/static/maker/sound-of-color.png"
},
{
"name": "Security Gadget",
"description": "Raise the alarm when your brick is lifted!",
"url":"/maker/security-gadget",
"cardType": "example",
"imageUrl": "/static/maker/security-gadget.png"
},
{
"name": "Movement Detector",
"description": "Raise the alarm when an movement sneaks in",
"url":"/maker/movement-detector",
"cardType": "example",
"imageUrl": "/static/maker/movement-detector.png"
},
{
"name": "Puppet",
"description": "Build an automated puppet",
"url":"/maker/puppet",
"cardType": "example",
"imageUrl": "/static/maker/puppet.png"
}
]
```
## Three Point Turn
```codecard
[
{
"name": "Three Point Turn 1",
"description": "Activity 1",
"url":"/coding/three-point-turn-1",
"cardType": "example"
}, {
"name": "Three Point Turn 2",
"description": "Activity 2",
"url":"/coding/three-point-turn-2",
"cardType": "example"
}, {
"name": "Three Point Turn 3",
"description": "Activity 3",
"url":"/coding/three-point-turn-3",
"cardType": "example"
}]
```
## Reversing the robot
```codecard
[{
"name": "Reversing the robot 1",
"description": "Activity 1",
"url":"/coding/reversing-the-robot-1",
"cardType": "example"
}, {
"name": "Reversing the robot 2",
"description": "Activity 2",
"url":"/coding/reversing-the-robot-2",
"cardType": "example"
}, {
"name": "Reversing the robot 3",
"description": "Activity 3",
"url":"/coding/reversing-the-robot-3",
"cardType": "example"
}]
```
## Light the way
```codecard
[{
"name": "Light the way 1",
"description": "Activity 1",
"url":"/coding/light-the-way-1",
"cardType": "example"
}, {
"name": "Light the way 2",
"description": "Activity 2",
"url":"/coding/light-the-way-2",
"cardType": "example"
}, {
"name": "Light the way 3",
"description": "Activity 3",
"url":"/coding/light-the-way-3",
"cardType": "example"
}
]
```
## Traffic Lights
```codecard
[{
"name": "Traffic Lights 1",
"description": "Activity 1",
"url":"/coding/traffic-lights-1",
"cardType": "example"
}, {
"name": "Traffic Lights 2",
"description": "Activity 2",
"url":"/coding/traffic-lights-2",
"cardType": "example"
}, {
"name": "Traffic Lights 3",
"description": "Activity 3",
"url":"/coding/traffic-lights-3",
"cardType": "example"
}
]
```
## Reverse Bepper
```codecard
[{
"name": "Reverse Beeper 1",
"description": "Activity 1",
"url":"/coding/reverse-beeper-1",
"cardType": "example"
}, {
"name": "Reverse Beeper 2",
"description": "Activity 2",
"url":"/coding/reverse-beeper-2",
"cardType": "example"
}, {
"name": "Reverse Beeper 3",
"description": "Activity 3",
"url":"/coding/reverse-beeper-3",
"cardType": "example"
}]
```
## Ignition
```codecard
[{
"name": "Ignition 1",
"description": "Activity 1",
"url":"/coding/ingition-1",
"cardType": "example"
}, {
"name": "Ignition 2",
"description": "Activity 2",
"url":"/coding/ignition-2",
"cardType": "example"
}, {
"name": "Ignition 3",
"description": "Activity 3",
"url":"/coding/ignition-3",
"cardType": "example"
}]
```
## Cruise Control
```codecard
[{
"name": "Cruise Control 1",
"description": "Activity 1",
"url":"/coding/cruise-control-1",
"cardType": "example"
}, {
"name": "Cruise Control 2",
"description": "Activity 2",
"url":"/coding/cruise-control-2",
"cardType": "example"
}, {
"name": "Cruise Control 3",
"description": "Activity 3",
"url":"/coding/cruise-control-3",
"cardType": "example"
}]
```
## Roaming
```codecard
[{
"name": "Roaming 1",
"description": "Activity 1",
"url":"/coding/roaming-1",
"cardType": "example"
}, {
"name": "Roaming 2",
"description": "Activity 2",
"url":"/coding/roaming-2",
"cardType": "example"
}]
```
## Fun stuff
Coming soon.
```codecard
[
{
"name": "Happy unhappy",
"description": "Keep your brick entertained and happy",
"url":"/examples/happy-unhappy",
"cardType": "example"
}, {
{
"name": "Turtle",
"description": "Encode moves and run them on a driving base",
"url":"/examples/turtle",
"cardType": "example"
}, {
"name": "Distance Measurer",
"description": "Use a motor to measure angle and distance",
"url": "/examples/distance-measurer",
"cardType": "example"
}]
```

View File

@ -0,0 +1,178 @@
# Gyroboy
Work in progress
```blocks
let motorSpeed1 = 0
let motorSpeed2 = 0
let motorSpeed3 = 0
let motorSpeed = 0
let fallen = false
let motorSpeed0 = 0
let oldControlDrive = 0
let controlDrive = 0
let power = 0
let motorAngle = 0
let gyroAngle = 0
let controlSteering = 0
let state = 0
let motorPosition = 0
let temp = 0
let gyroRate = 0
let timestep = 0
sensors.color1.onColorDetected(ColorSensorColor.Red, function () {
music.playTone(2000, 100)
controlDrive = 0
controlSteering = 0
})
// reads the motor angle and computes the motor speed,
// position
function computeMotors() {
temp = motorAngle
// read angle on both motors
motorAngle = motors.largeD.angle() + motors.largeA.angle()
// and estimate speed as angle difference
motorSpeed0 = motorAngle - temp
// average last 4 speed readings
motorSpeed = (motorSpeed0 + motorSpeed1 + motorSpeed2 + motorSpeed3) / 4 / timestep
// shift all previous recorded speeds by one
motorSpeed3 = motorSpeed2
motorSpeed2 = motorSpeed1
motorSpeed1 = motorSpeed0
// compute position from speed
motorPosition = motorPosition + timestep * motorSpeed
}
// read the gyro rate and computes the angle
function computeGyro() {
gyroRate = sensors.gyro2.rate()
gyroAngle = gyroAngle + timestep * gyroRate
}
function reset() {
state = 0
// sleeping
moods.sleeping.show();
// reset counters
motors.largeA.reset()
motors.largeD.reset()
// motors are unregulated
motors.largeA.setRegulated(false)
motors.largeD.setRegulated(false)
// clear the gyro sensor to remove drift
sensors.gyro2.reset()
// fall detection timer
control.timer2.reset()
// timestep computation timer
control.timer3.reset()
motorAngle = 0
motorPosition = 0
motorSpeed = 0
motorSpeed0 = 0
motorSpeed1 = 0
motorSpeed2 = 0
motorSpeed3 = 0
gyroRate = 0
gyroAngle = 0
fallen = false
power = 0
controlSteering = 0
controlDrive = 0
// awake
moods.awake.show();
gyroAngle = -0.25
state = 1;
}
// compute set point for motor position and required
// motor power
function computePower() {
// apply control and compute desired motor position
motorPosition -= timestep * controlDrive;
// estimate power based on sensor readings and control
// values
power = 0.8 * gyroRate + 15 * gyroAngle + (0.08 * motorSpeed + 0.12 * motorPosition) - 0.01 * controlDrive
// ensure that power stays within -100, 100
if (power > 100) {
power = 100
} else if (power < -100) {
power = -100
}
}
// test if the robot has fallen off
function checkFallen() {
if (Math.abs(power) < 100) {
control.timer2.reset()
}
if (control.timer2.seconds() > 2) {
fallen = true
}
}
// stop all motors and wait for touch button to be
// pressed
function stop() {
motors.stopAll()
state = 0
moods.knockedOut.show();
sensors.touch3.pauseUntil(ButtonEvent.Pressed)
moods.neutral.show();
}
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectNear, function () {
moods.dizzy.show()
controlSteering = 0
oldControlDrive = controlDrive
controlDrive = -10
motors.mediumC.run(30, 30, MoveUnit.Degrees);
motors.mediumC.run(-30, 60, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
if (Math.randomRange(-1, 1) >= 1) {
controlSteering = 70
} else {
controlSteering = -70
}
pause(4000)
music.playTone(2000, 100)
controlSteering = 0
controlDrive = oldControlDrive
moods.neutral.show()
})
// compute the elapsed time since the last iteration
function computeTimestep() {
timestep = control.timer3.seconds()
control.timer3.reset()
}
sensors.color1.onColorDetected(ColorSensorColor.Green, function () {
moods.winking.show()
controlDrive = 150
controlSteering = 0
})
sensors.color1.onColorDetected(ColorSensorColor.Blue, function () {
moods.middleRight.show()
controlSteering = 70
})
// apply power to motors
function controlMotors() {
motors.largeA.run(power + controlSteering * 0.1)
motors.largeD.run(power - controlSteering * 0.1)
}
sensors.color1.onColorDetected(ColorSensorColor.Yellow, function () {
moods.middleLeft.show()
controlSteering = -70
})
sensors.color1.onColorDetected(ColorSensorColor.White, function () {
moods.sad.show();
controlDrive = -75
})
timestep = 0.014
// main loop
forever(function () {
reset()
while (!fallen) {
control.timer3.pauseUntil(5)
computeTimestep()
computeGyro()
computeMotors()
computePower()
controlMotors()
checkFallen()
}
stop()
})
```

View File

@ -0,0 +1,215 @@
# Gyroboy LabView
```typescript
let mSum = 0;
let mPos = 0;
let mSpd = 0;
let mD = 0;
let mDP1 = 0;
let mDP2 = 0;
let mDP3 = 0;
let Crdv = 0;
let cLo = 0;
let gAng = 0;
let ok = false;
let pwr = 0;
let Cstr = 0;
let Cdrv = 0;
let gMn = 0;
let gMx = 0;
let gSum = 0;
let gyro = 0;
let gOS = 0;
let gSpd = 0;
let tInt = 0.014;
let lpwr = 0
let rpwr = 0
let tStart = 0
let st = 0
let oldDr = 0
function RST() {
motors.largeA.reset()
motors.largeD.reset()
motors.largeA.setRegulated(false)
motors.largeD.setRegulated(false)
sensors.gyro2.reset()
sensors.gyro2.rate()
control.timer2.reset()
pause(5000)
mSum = 0;
mPos = 0;
mD = 0;
mDP1 = 0;
mDP2 = 0;
mDP3 = 0;
Crdv = 0;
cLo = 0;
gAng = 0;
ok = false;
pwr = 0;
st = 0;
Cstr = 0;
Cdrv = 0;
}
function OS() {
// OSL
do {
gMn = 1000;
gMx = -100;
gSum = 0;
// gChk
for (let i = 0; i < 200; i++) {
gyro = sensors.gyro2.rate()
gSum = gyro;
gMx = Math.max(gMx, gyro)
gMn = Math.min(gMn, gyro)
pause(4);
}
} while (gMx - gMn > 2);
gOS = gSum / 200;
}
function GT() {
if (cLo == 0) {
tInt = 0.014;
control.timer1.reset();
} else {
tInt = control.timer1.seconds() / cLo;
}
cLo++;
}
function GG() {
gyro = sensors.gyro2.rate();
gOS = 0.0005 * gyro + (1 - 0.0005) * gOS
gSpd = gyro - gOS;
gAng = gAng + tInt * gSpd;
}
function GM() {
let temp = mSum
mSum = motors.largeD.angle() + motors.largeA.angle();
mD = mSum - temp;
mPos = mPos + mD;
mSpd = ((mDP1 + mDP2 + mDP3 + mD) / 4) / tInt;
mDP3 = mDP2;
mDP2 = mDP1;
mDP1 = mD;
}
function EQ() {
mPos = mPos - Cdrv * tInt;
pwr = (0.8 * gSpd + 15 * gAng) + (0.08 * mSpd + 0.12 * mPos) - 0.01 * Cdrv
if (pwr > 100) pwr = 100
else if (pwr < -100) pwr = -100
}
function cntrl() {
mPos = mPos - tInt * Cdrv
lpwr = (pwr + Cstr * 0.1)
rpwr = (pwr - Cstr * 0.1)
}
function CHK() {
if (Math.abs(pwr) < 100)
control.timer2.reset();
if (control.timer2.seconds() > 2) {
ok = true;
}
}
// M
forever(function () {
RST();
brick.showImage(images.eyesSleeping)
OS()
gAng = -0.25;
music.playSoundEffect(sounds.movementsSpeedUp)
brick.showImage(images.eyesAwake)
st = 1;
// BALANCE
while (!ok) {
GT();
let t1 = control.timer1.millis()
GG();
GM();
EQ();
cntrl();
motors.largeA.run(lpwr)
motors.largeD.run(rpwr)
CHK()
let t2 = control.timer1.millis();
let p = 5 - (t2 - t1);
pause(Math.max(1, p))
}
motors.stopAll()
st = 0;
brick.setStatusLight(StatusLight.RedPulse);
brick.showImage(images.eyesKnockedOut)
music.playSoundEffect(sounds.movementsSpeedDown)
sensors.touch3.pauseUntil(ButtonEvent.Pressed)
brick.setStatusLight(StatusLight.Off);
})
// BHV
forever(function () {
switch (st) {
case 0:
Cdrv = 0;
Cstr = 0;
break;
case 1:
Cdrv = 40;
pause(4000);
Cdrv = 0;
music.playTone(1000, 100);
st = 2;
break;
case 2:
switch (sensors.color1.color()) {
case ColorSensorColor.Red:
music.playTone(2000, 100);
Cdrv = 0;
Cstr = 0;
break;
case ColorSensorColor.Green:
music.playTone(2000, 100);
Cdrv = 150;
Cstr = 0;
break;
case ColorSensorColor.Blue:
music.playTone(2000, 100);
Cstr = 70;
break;
case ColorSensorColor.Yellow:
music.playTone(2000, 100);
Cstr = -70;
break;
case ColorSensorColor.White:
music.playTone(2000, 100);
Cdrv = -75;
break;
}
if (sensors.ultrasonic4.distance() < 25) {
Cstr = 0;
oldDr = Cdrv;
Cdrv = -10;
motors.mediumC.run(30, 30, MoveUnit.Degrees);
motors.mediumC.run(-30, 60, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
if (Math.randomRange(-1, 1) >= 1)
Cstr = 70;
else
Cstr = -70;
pause(4000);
music.playTone(2000, 100)
Cstr = 0;
Cdrv = oldDr;
}
break;
}
pause(80);
})
```

View File

@ -0,0 +1,390 @@
# Puppy
```typescript
let P_T = 0;
let ISS = 0;
let F_T = 0;
let P_C = 0;
let F_C = 0;
let DB_S = 0;
let NS = false;
let IBP = 0;
let IAP = 0;
let C = false;
let TC = false;
let OTC = false;
let COL = 0;
let OCOL = 0;
let _C = false;
let GTO = 0;
function DN() {
motors.largeAD.setBrake(true);
motors.largeAD.tank(50, 50, 1, MoveUnit.Seconds);
pause(100);
motors.largeA.clearCounts()
motors.largeD.clearCounts()
}
function MNRH() {
motors.mediumC.setBrake(true)
brick.showImage(images.legoEv3icon)
brick.setStatusLight(StatusLight.OrangePulse)
while (!brick.buttonEnter.wasPressed()) {
if (brick.buttonUp.wasPressed()) {
motors.mediumC.run(-100);
} else if (brick.buttonDown.wasPressed()) {
motors.mediumC.run(100);
} else {
motors.mediumC.stop();
}
}
motors.mediumC.stop();
motors.mediumC.clearCounts();
brick.setStatusLight(StatusLight.Green);
}
function IS(t: number) {
ISS = t;
switch (t) {
case 0:
brick.showImage(images.eyesNeutral);
break;
case 1:
brick.showImage(images.eyesSleeping);
break;
case 2:
brick.showImage(images.eyesTear);
// draw rect...
break;
case 3:
brick.showImage(images.eyesHurt);
break;
case 4:
brick.showImage(images.eyesAngry);
break;
case 5:
brick.showImage(images.eyesTiredMiddle);
break;
case 6:
brick.showImage(images.eyesTiredRight);
break;
case 7:
brick.showImage(images.eyesTiredLeft);
break;
case 8:
brick.showImage(images.eyesLove);
break;
}
}
function UP() {
if (motors.largeA.angle() > -50) {
control.runInParallel(function () {
motors.largeD.clearCounts()
motors.largeD.run(-35);
pauseUntil(() => motors.largeD.angle() < -25);
motors.largeD.stop();
motors.largeD.setRegulated(false)
motors.largeD.run(-15)
pauseUntil(() => motors.largeD.angle() < -65);
motors.largeD.stop();
})
motors.largeA.clearCounts()
motors.largeA.run(-35);
pauseUntil(() => motors.largeA.angle() < -25);
motors.largeA.stop();
motors.largeA.setRegulated(false)
motors.largeA.run(-15)
pauseUntil(() => motors.largeA.angle() < -65);
motors.largeA.stop();
pause(500);
}
}
function RST() {
P_T = Math.randomRange(3, 6);
F_T = Math.randomRange(2, 4);
P_C = 1;
F_C = 1;
control.timer1.reset();
control.timer2.reset();
control.timer3.reset();
CS(0);
}
function CS(db: number) {
if (DB_S != db) {
DB_S = db;
NS = true;
}
}
function MON() {
if (control.timer2.seconds() > 10) {
control.timer2.reset();
P_C--;
if (P_C < 0) {
P_C = 0;
}
}
if (control.timer1.seconds() > 20) {
control.timer1.reset()
F_C--;
if (F_C < 0) {
F_C = 0;
}
}
if (control.timer3.seconds() > 30) {
control.timer3.reset();
CS(1);
}
}
function UIS() {
if (control.timer5.seconds() > IBP) {
control.timer5.reset();
if (ISS == 1) {
ISS = 6;
IBP = Math.randomRange(1, 5);
} else {
ISS = 1;
IBP = 0.25;
}
IS(ISS);
}
if (control.timer6.seconds() > IAP) {
if (ISS != 1) {
control.timer6.reset();
IAP = Math.randomRange(1, 10)
if (ISS != 7) {
ISS = 7
} else {
ISS = 6;
}
IS(ISS);
}
}
}
function UPDB() {
if ((P_T == P_C) && (F_T == F_C)) {
CS(6);
}
if ((P_T > P_C) && (F_T < F_C)) {
CS(3);
}
if ((P_T < P_C) && (F_T > F_C)) {
CS(5);
}
if ((P_C == 0) && (F_C > 0)) {
CS(2)
}
if (F_C == 0) {
CS(4)
}
}
function PTC() {
C = false;
OTC = TC;
TC = sensors.touch1.isPressed()
if (TC != OTC && TC) {
P_C++;
control.timer3.reset();
if (DB_S != 4) {
IS(2);
music.playSoundEffect(sounds.animalsDogSniff);
C = true;
}
}
return C;
}
function FDC() {
OCOL = COL;
COL = sensors.color4.color();
_C = false;
if ((COL != 0) && (OCOL != COL)) {
F_C++;
_C = true;
control.timer3.reset();
IS(2);
music.playSoundEffect(sounds.expressionsCrunching)
}
return _C;
}
function IDL() {
if (NS) {
NS = false;
UP();
}
UIS();
UPDB();
PTC();
FDC();
}
function MHT(Pos: number) {
let _R = Pos - motors.mediumC.angle();
if (_R >= 0) {
motors.mediumC.run(100, _R, MoveUnit.Degrees);
} else {
motors.mediumC.run(-100, Math.abs(_R), MoveUnit.Degrees);
}
}
function SLP() {
if (NS) {
NS = false;
IS(5)
DN()
MHT(3000)
IS(1)
music.playSoundEffect(sounds.expressionsSnoring)
}
if (sensors.touch1.isPressed() || brick.buttonEnter.isPressed()) {
music.stopAllSounds();
control.timer3.reset();
CS(7);
}
}
function PLF() {
if (NS) {
NS = false
IS(0)
UP()
music.playSoundEffect(sounds.animalsDogBark2)
control.timer4.reset()
GTO = Math.randomRange(4, 8);
}
if(PTC()) {
CS(0);
}
if (control.timer4.seconds() > GTO) {
music.playSoundEffect(sounds.animalsDogBark2)
control.timer4.reset();
GTO = Math.randomRange(4, 8);
}
}
function NGR() {
NS = false
IS(4)
music.playSoundEffect(sounds.animalsDogGrowl);
UP();
pause(1500);
music.stopAllSounds()
music.playSoundEffect(sounds.animalsDogBark1)
P_C--;
CS(0);
}
function HNG() {
if (NS) {
NS = false;
IS(3)
DN();
music.playSoundEffect(sounds.animalsDogWhine);
}
if(FDC()) {
CS(0)
}
if (PTC()) {
CS(3);
}
}
function PPP() {
NS = false;
IS(2);
UP();
pause(100)
motors.largeA.run(-30, 70, MoveUnit.Degrees);
pause(800);
music.playSoundEffect(sounds.mechanicalHorn1);
pause(1000);
for(let i = 0; i < 3; ++i) {
motors.largeA.run(-30, 20, MoveUnit.Degrees);
motors.largeA.run(30, 20, MoveUnit.Degrees);
}
motors.largeA.run(30, 70, MoveUnit.Degrees);
F_C = 1;
CS(0);
}
function HPY() {
IS(8)
MHT(0);
motors.largeAD.run(10, 0.8, MoveUnit.Seconds);
for(let i = 0; i < 3; ++i) {
music.playSoundEffect(sounds.animalsDogBark1);
motors.largeAD.run(-100, 0.2, MoveUnit.Seconds);
pause(300)
motors.largeAD.run(10, 0.3, MoveUnit.Seconds)
}
pause(500);
music.stopAllSounds();
DN();
RST();
}
function STL() {
UP();
motors.largeAD.run(-20, 60, MoveUnit.Degrees);
music.playSoundEffect(sounds.animalsDogWhine);
motors.largeAD.run(20, 60, MoveUnit.Degrees);
}
function WKU() {
let stateC = false;
IS(5);
music.playSoundEffect(sounds.animalsDogWhine)
MHT(0)
DN()
STL()
pause(1000);
UP()
CS(0;)
}
DN();
MNRH();
// compare button state???
IS(1);
UP();
RST();
forever(function () {
MON();
switch (DB_S) {
case 0:
IDL();
break;
case 1:
SLP();
break;
case 2:
PLF();
break;
case 3:
NGR();
break;
case 4:
HNG();
break;
case 5:
PPP();
break;
case 6:
HPY();
break;
case 7:
WKU();
break;
}
})
```

View File

@ -0,0 +1,51 @@
# Robot Arm
```typescript
function INI() {
motors.largeB.setBrake(true)
motors.largeC.setBrake(true)
motors.mediumA.setBrake(true)
motors.largeB.run(-50)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop();
motors.mediumA.run(30, 1, MoveUnit.Seconds);
motors.mediumA.run(-50, 90, MoveUnit.Degrees);
motors.largeC.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed);
motors.largeC.run(-50, 0.86, MoveUnit.Rotations);
}
INI()
let down = false;
forever(function () {
brick.showImage(images.informationQuestionMark)
brick.setStatusLight(StatusLight.OrangePulse);
pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed())
brick.setStatusLight(StatusLight.Off)
music.playSoundEffect(sounds.mechanicalAirRelease)
brick.showImage(images.informationAccept)
if (down) {
brick.showImage(images.informationForward)
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
} else {
brick.showImage(images.informationBackward)
motors.largeC.run(-65, 0.85, MoveUnit.Rotations);
}
motors.largeB.run(20, 275, MoveUnit.Degrees)
motors.mediumA.run(30, 1, MoveUnit.Seconds)
motors.largeB.run(-55)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop();
if (down) {
motors.largeC.run(-65, 0.86, MoveUnit.Rotations);
} else {
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
}
motors.largeB.run(20, 275, MoveUnit.Degrees);
motors.mediumA.run(-30, 90, MoveUnit.Degrees);
motors.largeB.run(-55)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop()
})
```

View File

@ -0,0 +1,51 @@
# Crane LabView
```blocks
function INI() {
motors.largeB.setBrake(true)
motors.largeC.setBrake(true)
motors.mediumA.setBrake(true)
motors.largeB.run(-50)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop();
motors.mediumA.run(30, 1, MoveUnit.Seconds);
motors.mediumA.run(-50, 90, MoveUnit.Degrees);
motors.largeC.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed);
motors.largeC.run(-50, 0.86, MoveUnit.Rotations);
}
INI()
let down = false;
forever(function () {
brick.showImage(images.informationQuestionMark)
brick.setStatusLight(StatusLight.OrangePulse);
pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed())
brick.setStatusLight(StatusLight.Off)
music.playSoundEffect(sounds.mechanicalAirRelease)
brick.showImage(images.informationAccept)
if (down) {
brick.showImage(images.informationForward)
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
} else {
brick.showImage(images.informationBackward)
motors.largeC.run(-65, 0.85, MoveUnit.Rotations);
}
motors.largeB.run(20, 275, MoveUnit.Degrees)
motors.mediumA.run(30, 1, MoveUnit.Seconds)
motors.largeB.run(-55)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop();
if (down) {
motors.largeC.run(-65, 0.86, MoveUnit.Rotations);
} else {
motors.largeC.run(65, 0.85, MoveUnit.Rotations);
}
motors.largeB.run(20, 275, MoveUnit.Degrees);
motors.mediumA.run(-30, 90, MoveUnit.Degrees);
motors.largeB.run(-55)
pauseUntil(() => sensors.color3.light(LightIntensityMode.Reflected) > 25);
motors.largeB.stop()
})
```

View File

@ -0,0 +1,34 @@
# Distance Measurer
```blocks
let distance = 0
let angle = 0
let measuring = false
let radius = 0
// Start and stop measuring with the enter button
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
if (measuring) {
// turn off the measuring
measuring = false
brick.setStatusLight(StatusLight.Off)
} else {
// turn on the measuring clear the counters so that
// the motor tracks the angle
measuring = true
motors.largeB.clearCounts()
brick.setStatusLight(StatusLight.GreenPulse)
}
})
radius = 2.5
brick.showString("Press ENTER to measure", 4)
forever(function () {
if (measuring) {
angle = motors.largeB.angle()
distance = angle / 180 * Math.PI * radius
brick.clearScreen()
brick.showValue("angle", angle, 2)
brick.showValue("distance", distance, 3)
}
pause(100)
})
```

View File

@ -0,0 +1,215 @@
# Gyro Boy LabView
```blocks
let mSum = 0;
let mPos = 0;
let mSpd = 0;
let mD = 0;
let mDP1 = 0;
let mDP2 = 0;
let mDP3 = 0;
let Crdv = 0;
let cLo = 0;
let gAng = 0;
let ok = false;
let pwr = 0;
let Cstr = 0;
let Cdrv = 0;
let gMn = 0;
let gMx = 0;
let gSum = 0;
let gyro = 0;
let gOS = 0;
let gSpd = 0;
let tInt = 0.014;
let lpwr = 0
let rpwr = 0
let tStart = 0
let st = 0
let oldDr = 0
function RST() {
motors.largeA.reset()
motors.largeD.reset()
motors.largeA.setRegulated(false)
motors.largeD.setRegulated(false)
sensors.gyro2.reset()
sensors.gyro2.rate()
control.timer2.reset()
pause(5000)
mSum = 0;
mPos = 0;
mD = 0;
mDP1 = 0;
mDP2 = 0;
mDP3 = 0;
Crdv = 0;
cLo = 0;
gAng = 0;
ok = false;
pwr = 0;
st = 0;
Cstr = 0;
Cdrv = 0;
}
function OS() {
// OSL
do {
gMn = 1000;
gMx = -100;
gSum = 0;
// gChk
for (let i = 0; i < 200; i++) {
gyro = sensors.gyro2.rate()
gSum = gyro;
gMx = Math.max(gMx, gyro)
gMn = Math.min(gMn, gyro)
pause(4);
}
} while (gMx - gMn > 2);
gOS = gSum / 200;
}
function GT() {
if (cLo == 0) {
tInt = 0.014;
control.timer1.reset();
} else {
tInt = control.timer1.seconds() / cLo;
}
cLo++;
}
function GG() {
gyro = sensors.gyro2.rate();
gOS = 0.0005 * gyro + (1 - 0.0005) * gOS
gSpd = gyro - gOS;
gAng = gAng + tInt * gSpd;
}
function GM() {
let temp = mSum
mSum = motors.largeD.angle() + motors.largeA.angle();
mD = mSum - temp;
mPos = mPos + mD;
mSpd = ((mDP1 + mDP2 + mDP3 + mD) / 4) / tInt;
mDP3 = mDP2;
mDP2 = mDP1;
mDP1 = mD;
}
function EQ() {
mPos = mPos - Cdrv * tInt;
pwr = (0.8 * gSpd + 15 * gAng) + (0.095 * mSpd + 0.13 * mPos) - 0.01 * Cdrv
if (pwr > 100) pwr = 100
else if (pwr < -100) pwr = -100
}
function cntrl() {
mPos = mPos - tInt * Cdrv
lpwr = (pwr + Cstr * 0.1)
rpwr = (pwr - Cstr * 0.1)
}
function CHK() {
if (Math.abs(pwr) < 100)
control.timer2.reset();
if (control.timer2.seconds() > 2) {
ok = true;
}
}
// M
forever(function () {
RST();
brick.showImage(images.eyesSleeping)
OS()
gAng = -0.25;
music.playSoundEffect(sounds.movementsSpeedUp)
brick.showImage(images.eyesAwake)
st = 1;
// BALANCE
while (!ok) {
GT();
let t1 = control.timer1.millis()
GG();
GM();
EQ();
cntrl();
motors.largeA.run(lpwr)
motors.largeD.run(rpwr)
CHK()
let t2 = control.timer1.millis();
let p = 5 - (t2 - t1);
pause(Math.max(1, p))
}
motors.stopAll()
st = 0;
brick.setStatusLight(StatusLight.RedPulse);
brick.showImage(images.eyesKnockedOut)
music.playSoundEffect(sounds.movementsSpeedDown)
sensors.touch3.pauseUntil(ButtonEvent.Pressed)
brick.setStatusLight(StatusLight.Off);
})
// BHV
forever(function () {
switch (st) {
case 0:
Cdrv = 0;
Cstr = 0;
break;
case 1:
Cdrv = 40;
pause(4000);
Cdrv = 0;
music.playTone(1000, 100);
st = 2;
break;
case 2:
switch (sensors.color1.color()) {
case ColorSensorColor.Red:
music.playTone(2000, 100);
Cdrv = 0;
Cstr = 0;
break;
case ColorSensorColor.Green:
music.playTone(2000, 100);
Cdrv = 150;
Cstr = 0;
break;
case ColorSensorColor.Blue:
music.playTone(2000, 100);
Cstr = 70;
break;
case ColorSensorColor.Yellow:
music.playTone(2000, 100);
Cstr = -70;
break;
case ColorSensorColor.White:
music.playTone(2000, 100);
Cdrv = -75;
break;
}
if (sensors.ultrasonic4.distance() < 25) {
Cstr = 0;
oldDr = Cdrv;
Cdrv = -10;
motors.mediumC.run(30, 30, MoveUnit.Degrees);
motors.mediumC.run(-30, 60, MoveUnit.Degrees);
motors.mediumC.run(30, 30, MoveUnit.Degrees);
if (Math.randomRange(-1, 1) >= 1)
Cstr = 70;
else
Cstr = -70;
pause(4000);
music.playTone(2000, 100)
Cstr = 0;
Cdrv = oldDr;
}
break;
}
pause(80);
})
```

View File

@ -0,0 +1,12 @@
# Happy unhappy
Use a touch sensor to make the brick happy.
```blocks
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
brick.showImage(images.expressionsBigSmile)
})
sensors.touch1.onEvent(ButtonEvent.Released, function () {
brick.showImage(images.expressionsSick)
})
```

View File

@ -0,0 +1,50 @@
# Gradien follower PID + calibration
```blocks
let lasterror = 0
let D = 0
let I = 0
let P = 0
let error = 0
let setpoint = 0
let max = 0
let min = 0
let v = 0
v = sensors.color3.light(LightIntensityMode.Reflected)
min = v
max = v
setpoint = v
while (!(brick.buttonEnter.isPressed())) {
brick.clearScreen()
brick.showString("Move robot on terrain", 1)
brick.showString("Press ENTER when done", 2)
v = sensors.color3.light(LightIntensityMode.Reflected)
min = Math.min(min, v)
max = Math.max(max, v)
setpoint = (max + min) / 2
brick.showValue("v", v, 3)
brick.showValue("min", min, 4)
brick.showValue("max", v, 5)
brick.showValue("setpoint", setpoint, 6)
pause(100)
}
forever(function () {
brick.clearScreen()
v = sensors.color3.light(LightIntensityMode.Reflected)
brick.showValue("light", v, 1)
error = v - setpoint
brick.showValue("error", error, 2)
P = error * 5
brick.showValue("P", P, 3)
I = I + error * 0.01
brick.showValue("I", I, 4)
D = (error - lasterror) * 0.2
brick.showValue("D", D, 5)
motors.largeBC.steer(P + (I + D), 100)
lasterror = error
if (brick.buttonEnter.wasPressed()) {
motors.largeBC.run(0)
brick.buttonDown.pauseUntil(ButtonEvent.Bumped)
}
})
```

18
docs/extensions.md Normal file
View File

@ -0,0 +1,18 @@
# Extensions
## #gallery
## Using Extensions
In the web editor, click on ``Settings`` then ``Extensions`` to search and add extensions to the project.
The Blocks and JavaScript definitions will be automatically loaded in the editor.
## Custom extensions
The [Build Your Own Extension](https://makecode.com/extensions/getting-started) manual is for advanced users who want to publish their own extension.
## ~ hint
**Extensions** were previously called **Packages** in MakeCode.
## ~

BIN
docs/file-manager.pdf Normal file

Binary file not shown.

129
docs/fll.md Normal file
View File

@ -0,0 +1,129 @@
# MakeCode for _FIRST_ LEGO League
![FIRST LEGO League logo](/static/fll/fll-logo.png)
**For teams participating in City Shaper challenge**, you can use MakeCode for your challenge (see [City Shaper Challenge, page 7 bottom](https://firstinspiresst01.blob.core.windows.net/fll/2020/city-shaper-game-guide-pdf.pdf)!
Weve compiled a list of resources and information that we hope will be helpful for you.
* **Got a question? Post it on the forums** at https://forum.makecode.com/
## FAQ
### I found a bug what do I do?
If you found a bug, please try if it hasn't been fixed yet! Go to https://makecode.mindstorms.com/beta and try if the bug is corrected. Otherwise, please tell us at https://forum.makecode.com/.
### How do I use MakeCode with my EV3?
* You will need to install the latest EV3 firmware on your brick. Instructions on how to do that are located here: https://makecode.mindstorms.com/troubleshoot.
* You will need a computer with a USB port to connect to the EV3 in order to download your programs.
* You will need internet access and a browser on your computer to get to https://makecode.mindstorms.com.
* You can [install the app](/offline-app) to use the editor offline.
### I know LabView, how is MakeCode different?
We have compiled a guide for EV3 LabView users at https://makecode.mindstorms.com/labview.
### Whats the best way to get started with MakeCode?
Go to https://makecode.mindstorms.com. The home screen is filled with videos, tutorials and examples that might be relevant for your missions.
On the home page, scroll down to the **FLL / City Shaper** section for specific lessons related to Mission 2.
### Can I load both LEGO MINDSTORMS EV3 Software and MakeCode programs onto my EV3?
Yes.
### Can I run the program again on the brick?
![EV3 Brick with Try in BrkProg_Save Folder in File Manager](/static/getting-started/try-in-file-manager.png)
Use the Brick Buttons and navigate to the File Manager tab. Open the **BrkProg_SAVE** folder,
select your program and click the center button to run it again.
### Does it work without internet?
No, the editor is cached in your browser cache. However, you can also download the [offline app](/offline-app) in case you need to install it on a computer.
### How do I figure out what a block does?
You can right-click on any block and select “Help” in the context menu to open the documentation page describing what that block does.
![Select help in context menu for block](/static/fll/context-help.jpg)
### How do I program in JavaScript?
Click the **JavaScript** button at the top of the page to get to the JavaScript editor. Students can drag and drop code snippets from the Toolbox on the left, or type directly in the editor. You can switch back and forth between **Blocks** and **JavaScript** as you program.
![Coding in JavaScript](/static/fll/code-js.gif)
Also, watch the [Text-based Coding](https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=3513a83b87fe536b2dc512237465fd1b&source=embed&photo%5fid=35719471) video for more about coding using the JavaScript editor.
### How do I use the Simulator?
The Simulator will show the physical representation of your code blocks. For example, based on this code snippet, the Simulator will show the touch sensor on Port 1, and a large motor on Port D.
```blocks
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
motors.largeD.run(50)
})
```
![Simulator demonstration](/static/fll/simulator.gif)
Note that the Simulator is also interactive, so you can simulate inputs with any of the sensors.
See the video [Block-based Coding and Simulation](https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=629730c938e452f0fd7653fbc4708166&source=embed&photo%5fid=35719470) for more about using the simulator.
### How do I save my programs?
MakeCode will automatically save your recent projects in the browser. However, you can also save a copy of your project as a file on your computer:
* From the **Settings** menu, select **Save Project**
* This will download your program from the browser as a _lego-myproject.uf2_ file
![Save project menu selection](/static/fll/save-project.jpg)
* You can import your saved projects by clicking the Import button on the Home Page
![Import button on home screen](/static/fll/import-button.jpg)
### How do I share my programs?
You can share your projects by clicking on the **share** button in the top left of the screen. This will create a URL which you can send others to open and view your project.
![Share button in editor](/static/fll/share-button.jpg)
![Share button and dialogs demo](/static/fll/share-program.gif)
Sharing programs is also shown in the [Tips and Tricks](https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=5c594c2373367f7870196f519f3bfc7a&source=embed&photo%5fid=35719472) video.
### Can I use Bluetooth to transfer my program?
The official answer is currently no. That being said, we have **Experimental support** for Bluetooth download. Please read the [Bluetooth](/bluetooth) page for more information.
https://youtu.be/VIq8-6Egtqs
## Are there YouTube videos on MakeCode for EV3?
The MakeCode has a [FLL / City Shaper YouTube Channel](https://www.youtube.com/watch?v=IqL0Pyeu5Ng&list=PLMMBk9hE-SeqkOObethhlZtBTEK6FYx3n) with useful videos.
https://youtu.be/-AirqwC9DL4
### Why can't I delete my program (*.uf2) files from the Brick?
There's a bug in the firmware which prevents you from deleting the programs (``*.uf2`` files) from your EV3 Brick. There isn't a firmware update to fix this yet.
We have prepared a special program that lets you delete UF2 files from the brick.
Download [these PDF instructions](/file-manager.pdf) and drop the PDF on the brick drive.
This will present you with an menu for deleting files.
For other common questions, try the FAQ page https://makecode.mindstorms.com/faq.
## Workarounds
1. Deleting Programs from the EV3 brick
>* Description: Unable to delete program files from the EV3 brick after downloading them
>* Status: LEGO Education team is working on a fix, no estimated date yet

36
docs/getting-started.md Normal file
View File

@ -0,0 +1,36 @@
# Getting Started
## Projects
```codecard
[
{
"name": "Prepare",
"imageUrl": "/static/lessons/firmware.png",
"description": "To use Microsoft MakeCode with your EV3 Brick, you will need to install the latest LEGO® MINDSTORMS® Education EV3 firmware.",
"label": "New? Start Here!",
"labelClass": "red ribbon large",
"url": "https://makecode.mindstorms.com/troubleshoot"
},
{
"name": "Try",
"imageUrl": "/static/lessons/try.png",
"description": "Get a quick introduction to programming.",
"url": "/getting-started/try",
"cardType": "side"
},
{
"name": "Use",
"imageUrl": "/static/lessons/use.png",
"description": "Build a robot and drive into the world of robotics!",
"url": "/getting-started/use",
"cardType": "side"
},
{
"name": "First LEGO League",
"imageUrl": "/static/fll/fll-big.png",
"description": "Information about using MakeCode in FLL competitions",
"url": "/fll"
}
]
```

View File

@ -0,0 +1,200 @@
# Try
## Introduction @unplugged
Get a quick introduction to programming with EV3.
![Display on EV3 Brick with Music Notes](/static/getting-started/01_EyesOn_Intro.png)
We are excited to help you get started with @boardname@. In this project we will guide you through connecting your EV3 Brick, creating your first program, controlling a Large Motor, a Touch Sensor and a Color Sensor. These steps can take up to 45 minutes.
## Turn on your EV3 Brick @unplugged
Power on your EV3 Brick by pressing the Center Button.
![Hand pressing power button](/static/getting-started/02_PowerOn.png)
## Connect Your EV3 Brick to Your Device @unplugged
Use the USB cable to connect your EV3 Brick to your device.
![Computer and cable connected to EV3 Brick](/static/getting-started/03_insert-usb-02.png)
## Handle a button press @fullscreen
Drag out a ``||brick:on button||`` block from Buttons section in the ``||brick:Brick||`` Toolbox drawer.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
})
```
## Change of mood @fullscreen
Drag a Brick Screen ``||brick:show mood||`` block inside the ``||brick:on button||`` block.
Change mood to ``neutral``.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
brick.showMood(moods.neutral)
})
```
## Simulate @fullscreen
**Try out your code in the simulator!**
Click the center button on the EV3 Brick in the web page. It should display the mood you selected on the screen. Don't hesitate to use the simulator to try out your code during this tutorial!
![EV3 Brick simulator](/static/getting-started/simulate.png)
## Play some tunes @fullscreen
Drag a Music ``||music:play sound effect||`` block below the ``||brick:show mood||`` block.
Change sound effect to ``communication hello``.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
brick.showMood(moods.neutral)
music.playSoundEffect(sounds.communicationHello)
})
```
## Download to your brick @unplugged
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
### Did It Work?
Verify that the program you just created shows eyes on the Brick Display, and that the EV3 Brick played the sound “Hello!”
![EV3 Brick with eyes on the display](/static/getting-started/05_EyesOn.png)
**Well done!**
## Run it Again
![EV3 Brick with Try in BrkProg_Save Folder in File Manager](/static/getting-started/try-in-file-manager.png)
Use the Brick Buttons and navigate to the File Manager tab. Open the **BrkProg_SAVE** folder, select **Try** and click the center button to run it again.
## Connect a Large Motor @unplugged
Now you will learn to control the Large Motor.
![EV3 Brick with hands connecting Large Motor to Port D](/static/getting-started/06_PlugInLargeMotor.png)
Connect a Large Motor to **Port D** of your EV3 Brick using any of the connector cables.
## Run a motor @fullscreen
Drag a ``||motors:run large A motor||`` block inside the ``||brick:on button||`` block.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeA.run(50)
})
```
## Tune your motor @fullscreen
Change ``large motor A`` to ``large motor D``.
Click on the **(+)** sign and change to ``1`` rotation.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
## Download @unplugged
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
### Did It Rotate?
Confirm that your motor has turned one rotation at power level 50 before stopping.
Download and run the program as many times as you want in order to verify this, or tinker with different power levels and different rotations.
![Large Motor D w/Rotating “WHRRR,” Hand, EV3 Brick](/static/getting-started/08_WorkingLargeMotor.png)
## Connect a Touch Sensor @unplugged
We will now control the Large Motor using a Touch Sensor.
Keeping the Large Motor connected to **Port D**, connect a Touch Sensor to **Port 1** of your EV3 Brick.
![Hands connecting Touch Sensor to Port 1 on EV3 Brick](/static/getting-started/09_Connect_Touch.png)
## Modify Your Program @fullscreen
* Add a ``||sensors:pause until touch 1 pressed||`` Sensor block on top of the ``||motors:run large motor D||`` block.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
## Download @unplugged
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
### Press the Touch Sensor
Confirm that the Large Motor has turned one rotation AFTER you press the Touch Sensor.
Download and run the program as many times as you want in order to verify this, or tinker with different Touch Sensor and Large Motor values.
![Hand Touch Sensor Pressed & EV3 Brick & Large Motor](/static/getting-started/11_TouchMotorWorking.png)
## Connect a Color Sensor @unplugged
Now we will try to control the Large Motor using another sensor.
![Hand connecting Color Sensor to Port 4, Large Motor D, EV3 Brick](/static/getting-started/12_ConnectColor.png)
Keeping the Large Motor connected to **Port D**, connect the Color Sensor to **Port 4**.
## Update your code @fullscreen
Using the same program, replace the ``||sensors:pause until touch 1||`` block with a ``||sensors:pause color sensor 3||`` for color block.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Green)
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
Don't forget to select the color you want to detect (e.g., green)!
## Download @unplugged
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
### Place a Colored Brick in Front of the Color Sensor
Confirm that the Large Motor has turned one rotation AFTER the Color Sensor has detected the colored brick.
Download and run the program as many times as you want in order to verify this, or tinker with different Color Sensor and Large Motor values.
![IMG: Colored bricks in front of Color Sensor, hands, EV3 Brick](/static/getting-started/14_ColorSensorWorking.png)
## JavaScript @fullscreen
Click on the **JavaScript** tab and change the color the Color Sensor detects to Black, Blue, Green, Yellow, Red, White, or Brown. Use Title Case for the color names.
```typescript
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Blue)
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
## Well Done! @unplugged
You have now learned how to control some of the inputs and outputs of the EV3.

171
docs/getting-started/try.md Normal file
View File

@ -0,0 +1,171 @@
# Try
Get a quick introduction to programming with EV3.
![Display on EV3 Brick with Music Notes](/static/getting-started/01_EyesOn_Intro.png)
We are excited to help you get started with @boardname@. In this project we will guide you through connecting your EV3 Brick, creating your first program, controlling a Large Motor, a Touch Sensor and a Color Sensor. These steps can take up to 45 minutes.
## Turn on your EV3 Brick
Power on your EV3 Brick by pressing the Center Button.
![Hand pressing power button](/static/getting-started/02_PowerOn.png)
## Connect Your EV3 Brick to Your Device
Use the USB cable to connect your EV3 Brick to your device.
![Computer and cable connected to EV3 Brick](/static/getting-started/03_insert-usb-02.png)
## Create and Run your First Program
**Code it:** Create the program shown here.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
brick.showMood(moods.neutral)
music.playSoundEffect(sounds.communicationHello)
})
```
* Drag out a ``||brick:on button||`` block from Buttons section in the ``||brick:Brick||`` Toolbox drawer.
* Drag a Brick Screen ``||brick:show mood||`` block inside the ``||brick:on button||`` block.
* Change mood to ``neutral``.
```block
brick.showMood(moods.neutral)
```
* Drag a Music ``||music:play sound effect||`` block below the ``||brick:show mood||`` block.
* Change sound effect to ``communication hello``.
```block
music.playSoundEffect(sounds.communicationHello)
```
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Did It Work?
![EV3 Brick with eyes on the display](/static/getting-started/05_EyesOn.png)
Verify that the program you just created shows eyes on the Brick Display, and that the EV3 Brick played the sound “Hello!”
**Well done!**
## Run it Again
![EV3 Brick with Try in BrkProg_Save Folder in File Manager](/static/getting-started/try-in-file-manager.png)
Use the Brick Buttons and navigate to the File Manager tab. Open the **BrkProg_SAVE** folder, select **Try** and click the center button to run it again.
## Connect a Large Motor
Now you will learn to control the Large Motor.
![EV3 Brick with hands connecting Large Motor to Port D](/static/getting-started/06_PlugInLargeMotor.png)
Connect a Large Motor to **Port D** of your EV3 Brick using any of the connector cables.
## Create and Run This Program
**Code it:** Create the program shown here.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
* Start a new program.
* Drag a ``||motors:run large A motor||`` block inside the ``||brick:on button||`` block.
* Change ``large motor A`` to ``large motor D``.
* Click on the **(+)** sign.
* Change to ``1`` rotation.
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Did It Rotate?
Confirm that your motor has turned one rotation at power level 50 before stopping.
![Large Motor D w/Rotating “WHRRR,” Hand, EV3 Brick](/static/getting-started/08_WorkingLargeMotor.png)
Download and run the program as many times as you want in order to verify this, or tinker with different power levels and different rotations.
## Connect a Touch Sensor
We will now control the Large Motor using a Touch Sensor.
![Hands connecting Touch Sensor to Port 1 on EV3 Brick](/static/getting-started/09_Connect_Touch.png)
Keeping the Large Motor connected to **Port D**, connect a Touch Sensor to **Port 1** of your EV3 Brick.
## Modify Your Program
**Code it:** Add code to the program for the Touch Sensor.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
* Add a ``||sensors:pause until touch 1 pressed||`` Sensor block on top of the ``||motors:run large motor D||`` block.
```block
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
```
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Press the Touch Sensor
Confirm that the Large Motor has turned one rotation AFTER you press the Touch Sensor.
![Hand Touch Sensor Pressed & EV3 Brick & Large Motor](/static/getting-started/11_TouchMotorWorking.png)
Download and run the program as many times as you want in order to verify this, or tinker with different Touch Sensor and Large Motor values.
## Connect a Color Sensor
Now we will try to control the Large Motor using another sensor.
![Hand connecting Color Sensor to Port 4, Large Motor D, EV3 Brick](/static/getting-started/12_ConnectColor.png)
Keeping the Large Motor connected to **Port D**, connect the Color Sensor to **Port 4**.
**Code it:** Modify Your Program to use the Color Sensor.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.color4.pauseUntilColorDetected(ColorSensorColor.Green)
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
* Using the same program, replace the ``||sensors:pause until touch 1||`` block with a ``||sensors:pause color sensor 4||`` for color block.
```block
sensors.color4.pauseUntilColorDetected(ColorSensorColor.Green)
```
* Select the color you want to detect (e.g., green).
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Place a Colored Brick in Front of the Color Sensor
![IMG: Colored bricks in front of Color Sensor, hands, EV3 Brick](/static/getting-started/14_ColorSensorWorking.png)
Confirm that the Large Motor has turned one rotation AFTER the Color Sensor has detected the colored brick.
Download and run the program as many times as you want in order to verify this, or tinker with different Color Sensor and Large Motor values.
Click on the **JavaScript** tab and change the color the Color Sensor detects to Black, Blue, Green, Yellow, Red, White, or Brown. Use Title Case for the color names.
## Well Done!
You have now learned how to control some of the inputs and outputs of the EV3.

121
docs/getting-started/use.md Normal file
View File

@ -0,0 +1,121 @@
# Use
Build a robot and drive into the world of robotics!
![EV3 Driving Base full w/cuboid](/static/getting-started/EV3_GettingStarted_13.jpg)
In this project we will guide you through building a Driving Base Robot and programming it to move straight and turn. You will also build and Object Detector Module, and program it to detect an object. Its a good idea to have done the [Try](/getting-started/try) sequence first.
## Connect
What if your school had a multipurpose robot? How would you use it?
![Apple Picker Robot](/static/getting-started/02_ApplePickerRobot.jpg)
Would you use it to clean the school or plant trees?
## Build Your Driving Base Robot
Build the robot driving base:
[![EV3 Driving Base](/static/lessons/common/ev3-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
## Make It Move
**Code it:** Create a program that makes the Driving Base move forward and stop at the finish line, which is ``1`` meter away.
Start by building this program:
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations)
})
```
* Drag a ``||motors:steer large motors B+C||`` block inside an ``||brick:on button||`` block.
* Click on the **(+)** sign.
* Change to ``1`` rotation.
### ~hint
**Hint:** You will have to modify the number of rotations until you find the number that matches the robot moving forward 1 meter and stopping.
### ~
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Make It Turn
**Code it:** Create a new program that turns the Driving Base 180 degrees.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.steer(-50, 50, 1, MoveUnit.Rotations)
})
```
### ~hint
**Hint:** You will have to modify the turn ratio and the number of rotations until the robot reaches 180 degrees.
### ~
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Add an Ultrasonic Sensor to Your Driving Base
Build and attach an Ultrasonic Sensor to your driving base:
[![EV3 Ultrasonic Sensor Driving Base Building Instructions Main Image](/static/lessons/common/ev3-ultrasonic-sensor-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-ultrasonic-sensor-driving-base-61ffdfa461aee2470b8ddbeab16e2070.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
## Detect an Object
**Code it:** Create a program that moves the Driving Base and makes it stop ``6`` cm from the Cuboid.
Create a new program:
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.tank(50, 50)
sensors.ultrasonic4.setThreshold(UltrasonicSensorEvent.ObjectDetected, 6)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
motors.stopAll()
})
```
* Drag a ``||motors:tank large motors B+C||`` motor block inside the ``||brick:on button||`` block.
* Drag the Ultrasonic Sensor threshold ``||sensors:set ultrasonic 4||`` block and place it below the motor block.
* Drag a ``|sensors:pause until ultrasonic 4||`` block and place it under the threshold block.
* Drag a ``||motors:stop all motors||`` block and place it below the sensor block.
### ~hint
**Hint:** You will have to modify the values of the Ultrasonic Sensor block until the robot reaches the desired position.
### ~
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
Click on the **JavaScript** tab. Change and test the number value of the Ultrasonic
Sensor.
```typescript
sensors.ultrasonic4.setThreshold(UltrasonicSensorEvent.ObjectDetected, 10)
```
**Congratulations!**
You are ready to move on to the next steps.
Try a [Design Engineering](/design-engineering), [Coding](/coding), or [Maker](/maker) activity.

View File

@ -1,3 +1,3 @@
{
"appref": "v"
"appref": "v1.2.26"
}

254
docs/labview.md Normal file
View File

@ -0,0 +1,254 @@
# Coding in MakeCode
This guide helps users who are used to work with @boardname@ to get familiar with using blocks in MakeCode.
## Snap together the blocks
Just like with LabView, blocks in the MakeCode editor can be dragged from the cabinet and snapped together
to create a sequence of program instructions.
Take a look a the LabView program below: it **starts**, turns on motor A, waits a second, and finally stops motor A.
![sequence of block](/static/labview/sequencing.png)
The blocks in MakeCode have similar functions and go together in the same way: they snap into the ``||loops:on start||`` block and then connect to each other vertically.
```blocks
motors.largeA.run(50)
pause(1000)
motors.largeA.stop()
```
Any block program can be converted to JavaScript and you can edit it as lines of code too.
```typescript
motors.largeA.run(50)
pause(1000)
motors.largeA.stop()
```
## Download to the EV3
Before you actually run your program on the EV3 Brick, you can first try it in the simulator. The MakeCode editor includes a simulator in the browser for you to test your code. You can make changes to your program and check them out it the simulator to make sure your code works the way want. The similator knows when you modify your code and it restarts automatically to run the new code.
Once you're ready to transfer your program to the EV3 Brick, click the ``|Download|`` button and follow the instructions.
## Single motors
This program controls a large motor on port A in several different ways. It sets just the speed and then sets speed for: an amount of time, angle of movement, and a number of rotations.
![Single motor blocks](/static/labview/motors.png)
```blocks
motors.largeA.run(50);
motors.largeA.run(50, 1000, MoveUnit.MilliSeconds);
motors.largeA.run(50, 360, MoveUnit.Degrees);
motors.largeA.run(50, 1, MoveUnit.Rotations);
motors.largeA.stop();
```
## Steering
The **steering** blocks let you to synchronize two motors at a precise rate. They can also specify the duration, angle, or number of rotations for the motors to turn.
![Steering blocks](/static/labview/steer.png)
```blocks
motors.largeBC.steer(0, 50);
motors.largeBC.steer(0, 50, 1000, MoveUnit.MilliSeconds);
motors.largeBC.steer(0, 50, 360, MoveUnit.Degrees);
motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations);
motors.largeBC.stop();
```
### ~ hint
The **turn ratio range is -200, 200** unlike LabView who used -100,100.
### ~
## Tank
The **tank** blocks control the speed of two motors. These are commonly used for a differential drive robot. The blocks can also specify the duration, angle, or number of rotations.
![Tank block](/static/labview/tank.png)
```blocks
motors.largeBC.tank(50, 50);
motors.largeBC.tank(50, 50, 1000, MoveUnit.MilliSeconds);
motors.largeBC.tank(50, 50, 360, MoveUnit.Degrees);
motors.largeBC.tank(50, 50, 1, MoveUnit.Rotations);
motors.largeBC.stop();
```
## Coasting and braking
By default, all motors coast when any command used to move finishes. You can keep them from coasting with the ``||motors:set brake||`` block.
![Brake block](/static/labview/brake.png)
```blocks
motors.largeD.setBrake(true);
motors.largeD.run(50, 1, MoveUnit.Rotations)
```
## Inverting and regulating motors
If you wan to change the direction that a motor turns, use the ``||motors:set inverted||`` block.
![Brake block](/static/labview/invertmotor.png)
```blocks
motors.largeA.setInverted(true);
```
By default, the speed of motors is regulated. This means that if your robot goes up a hill,
the regulator will adjust the power to match the desired speed. You can disable this feature
using ``||motors:set regulated||``.
![Brake block](/static/labview/unregulatedmotor.png)
```blocks
motors.largeA.setRegulated(false);
```
## Brick
The **Brick** category has a number of blocks to display graphics on the brick screen.
![brick image](/static/labview/brickimage.png)
```blocks
brick.clearScreen()
brick.showImage(images.expressionsWink)
```
![brick status light](/static/labview/brickstatuslight.png)
```blocks
brick.setStatusLight(StatusLight.Off);
brick.setStatusLight(StatusLight.Red);
brick.setStatusLight(StatusLight.OrangePulse);
```
## Waiting (pausing)
It is quite common to have to wait for a task to finish or for a sensor state to change, such as a touch button pressed. The ``||loops:pause||`` and ``||sensors:pause until||`` blocks provide a way for your program to wait for a period of time.
![pause for time](/static/labview/pausefortime.png)
```blocks
motors.largeD.run(50)
pause(1000)
motors.largeD.stop();
```
![pause for touch](/static/labview/pausefortouch.png)
```blocks
motors.largeD.run(50)
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeD.stop();
```
![pause for distance](/static/labview/pausefordistance.png)
```blocks
motors.largeD.run(50)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear)
motors.largeD.stop();
```
You can also use the ``||loops:pause until||`` block to wait on any [boolean](/types/boolean) expression. As your program runs, it waits until the condition (expression) inside becomes true.
```blocks
motors.largeD.run(50)
pauseUntil(() => sensors.touch1.isPressed())
motors.largeD.stop()
```
## Loops
![Single loop](/static/labview/loopinfinite.png)
```blocks
forever(() => {
motors.largeD.run(50, 1, MoveUnit.Rotations);
motors.largeD.run(-50, 1, MoveUnit.Rotations);
})
```
![While loop](/static/labview/while.png)
```blocks
for(let i = 0; i < 10; i++) {
motors.largeD.run(50, 1, MoveUnit.Rotations);
motors.largeD.run(-50, 1, MoveUnit.Rotations);
}
let k = 0;
while(k < 10) {
motors.largeD.run(50, 1, MoveUnit.Rotations);
motors.largeD.run(-50, 1, MoveUnit.Rotations);
k++;
}
```
## Variables
![Variable block](/static/labview/speedoflightvar.png)
```blocks
let light = 0;
forever(function () {
light = sensors.color3.light(LightIntensityMode.Reflected);
motors.largeD.run(light)
})
```
## Concurrent loops
You can start up multiple ``||loops:forever||`` loops that will run at the same time. Actually, only the code in just one of the loops is really running at any exact moment in time. Each loop, though, gets a turn to run all of its code and this makes them run [_concurrently_](https://en.wikipedia.org/wiki/Concurrent_computing).
![Multiple loops running at the same time](/static/labview/multipleloops.png)
```blocks
forever(() => {
motors.largeD.run(50, 1, MoveUnit.Rotations);
motors.largeD.run(-50, 1, MoveUnit.Rotations);
})
forever(() => {
brick.showImage(images.eyesMiddleRight)
pause(1000)
brick.showImage(images.eyesMiddleLeft)
pause(1000)
})
```
## Conditional
The ``||logic:if||`` block allows you to run different code depending on whether some condition ([boolean](/types/boolean) expression) is `true` or `false`. Also, this is similar to the ``||loops:switch||`` block.
![Brake block](/static/labview/ife.png)
```blocks
forever(function() {
if(sensors.touch1.isPressed()) {
motors.largeD.run(50)
} else {
motors.largeD.stop()
}
})
```
## Random
The ``||math:pick random||`` block returns a random number selected from a range of numbers.
![Brake block](/static/labview/random.png)
```blocks
forever(function () {
motors.largeBC.steer(Math.randomRange(-5, 5), 50)
pause(100)
})
```

27
docs/lessons.md Normal file
View File

@ -0,0 +1,27 @@
# Lessons
Learning activities for @boardname@ with MakeCode.
## Motors and motion
```codecard
[{
"name": "Make it Move",
"imageUrl":"/static/lessons/make-it-move.jpg",
"url": "/lessons/make-it-move",
"cardType": "project",
"description": "Make a robot that moves itself without wheels."
}, {
"name": "Make it Move TUTORIAL",
"imageUrl":"/static/lessons/make-it-move.jpg",
"url": "/lessons/make-it-move-tutorial",
"cardType": "tutorial",
"description": "Make a robot that moves itself without wheels."
}, {
"name": "Line Detection",
"imageUrl":"/static/lessons/line-detection.jpg",
"url": "/lessons/line-detection",
"cardType": "project",
"description": "Make your robot drive itself by following lines."
}]
```

View File

@ -0,0 +1,274 @@
# Line Detection
## Objective
Design ways to improve driving safety by helping to prevent drivers from falling asleep and causing an accident.
![Car driving on highway](/static/lessons/line-detection/car-driving.jpg)
## Connect
Make sure that you can answer the following questions:
* Can autonomous cars react to different traffic light signals?
* What can happen if a driver falls asleep while driving?
* How can we detect when a driver is falling asleep?
Think about what you have learned, then document it. Describe the problem in your own words. Creatively record your ideas and findings.
## Construct
Start by constructing this model. Read the building instructions [here](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-color-sensor-down-driving-base-d30ed30610c3d6647d56e17bc64cf6e2.pdf) first.
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
![Color sensor on the driving base](/static/lessons/line-detection/color-sensor-driving.jpg)
## Program
Autonomous cars need to recognize and respond to traffic lights automatically.
First, create a program that will make your robot stop at red lights.
Make sure your robot is only responding to the color red.
Once you have succeeded, program your robot to drive forward again when the light changes from red to green.
There are two coding tasks for this lesson:
1. Create a program that will make your robot stop at red lights.
2. Create a program that drives the robot forward until the Color Sensor sees red. The robot then stops.
## Coding task 1 - Stop at red lights
**Goal:** Create a program that will make your robot stop at red lights.
### Step 1
Create a program that drives the robot forward until the Color Sensor sees red. The robot then stops.
Place a ``||motors:steer large B+C||`` block from ``||motors:Motors||`` under ``||loops:on start||``. Change the speed to 20%.
```blocks
motors.largeBC.steer(0, 20)
```
### Step 2
Place a ``||loops:while||`` loop block under ``||motors:steer large B+C||``.
```blocks
motors.largeBC.steer(0, 20)
while (true) {
}
```
### Step 3
Place a ``||sensors:pause until color detected||`` from ``||sensors:Sensors||`` inside the ``||loops:while||`` loop block. Change the color to red.
```blocks
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
}
```
### Step 4
Place a ``||motors:stop all motors||`` block under the ``||sensors:pause until color detected||`` block.
Study the program...what do you think the program will do?
**Hint:** The motors will run until the Color Sensor senses the color red, then all motors will stop. The motors will run until the sensor reading in the while block is true.
```blocks
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
}
```
### Step 5
Click `|Download|` and follow the instructions to get your code onto your EV3 Brick. Press the **center** button on the EV3 Brick to run the program.
## Coding task 2 - Detect light changes
**Goal:** Program your robot to drive forward again when the light changes from red to green.
### Step 1
Place a ``||loops:while||`` loop block under ``||loops:on start||``.
```blocks
while (true) {
}
```
### Step 2
Place a ``||motors:steer large B+C||`` block from ``||motors:Motors||`` inside the ``||loops:while||`` loop block. Change the speed to 20%.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
}
```
### Step 4
Place a ``||loops:while||`` loop block under the ``||motors:steer large B+C||`` block.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
while (true) {
}
}
```
### Step 5
Place a ``||sensors:pause until color detected||`` block from ``||sensors:Sensors||`` inside the ``||loops:while||`` loop block. Change the color to red.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
}
}
```
### Step 6
Place a ``||motors:stop all motors||`` block under the ``||sensors:pause until color detected||`` block.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
}
}
```
### Step 7
Place a ``||loops:while||`` loop block under the second ``||loops:while||`` loop block.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
}
while (true) {
}
}
```
### Step 8
Place a ``||sensors:pause unril color detected||`` block inside the new ``||loops:while||`` loop block. Change the color to red.
What do you think the program will do?
**Hint:** The motors will run until the Color Sensor detects the color red, then it will stop all motors. The motors will also run and not stop when the color sensor detects the color green.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
motors.stopAll()
}
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
}
}
```
### Step 9
Click `|Download|` and follow the instructions to get your code onto your EV3 Brick. Press the **center** button on the EV3 Brick to run the program.
## Contemplate
To simulate what could happen if a driver falls asleep while driving, your robot could sound an alarm signal when it crosses the line. This feature is often available in new cars.
Program your robot to perform this function.
Think about what you have learned, then document it. Describe your pseudocode for this task. Creatively record your ideas, and findings.
### Programming hint
```blocks
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Yellow)
music.playSoundEffect(sounds.systemGeneralAlert)
}
while (true) {
while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(10)
motors.largeC.run(-10)
}
while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeA.run(-10)
motors.largeA.run(10)
}
}
```
## Continue
Program your robot to drive on “autopilot” along a given route. You will need to create a program that recognizes and responds to a dark line (or white line). You will create a line-following program and your robot will need to travel along the line without losing contact with it.
You will need to constantly debug your program in order to make your robot travel as smoothly as possible along the line.
### Programming hint
```blocks
while (true) {
while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(10)
motors.largeC.run(-10)
}
while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(-10)
motors.largeC.run(10)
}
}
```
## Share
Consider the following questions:
1. What challenged you?
2. Where there any surprises?
3. How could you improve your program?
4. Could your program have been more streamlined?
5. Have you used too many blocks?
6. Is there a more efficient way of building your program?
7. How could your program be used in real-world scenarios?
Think about what you have learned, then document it. Creatively record and present your ideas, creations, and findings.

View File

@ -0,0 +1,78 @@
# Make It Move Without Wheels
## Objective @unplugged
Design, build and program a robot that can move itself:
Your robot will:
* Go a distance of at least 30cm
* Use at least one motor
* Use NO wheels for locomotion
![@boardname@ with parts](/static/lessons/make-it-move/locomotion-no-wheels.jpg)
## Construct @unplugged
Build a Walker Bot!
The Walker Bot is one example of many possible solutions for making a robot move without wheels.
The Walker Bot combines an EV3 Frame and two legs that are mirror-images to create left and right legs.
The legs in the Walker Bot are designed to show how to change the rotary motion of a motor to reciprocating motion.
Start by reading [these](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/ev3-dep/building%20instructions/walker-bot-bi-180fc24f9298e1dd6201099627d43903.pdf) instructions first.
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
![@boardname@ Walker Bot](/static/lessons/make-it-move/walker-bot.jpg)
## Program 1 @fullscreen
In nature, creatures use many methods to get around. None of them, however, use wheels to move. Can we copy the method of animal locomotion with our robot? Using motors and legs, make the robot move without using any wheels.
Place a ``||motors:tank large B+C||`` block from ``||motors:Motors||`` under ``||loops:on start||``.
Change the speed to `-60%` (for motor B) and `+60%` (for motor C).
Change the rotations to `9`.
The ``||motors:tank large B+C||`` block will run for `9` rotations when the **center** button is pressed on the EV3 Brick. The motors are set for the reverse direction because they are mounted upside down in this model.
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
```
## Program 2 @fullscreen
Place a ``||motors:stop all motors||`` block under ``||motors:tank large B+C||``.
The ``||motors:tank large B+C||`` block will run for `9` rotations when the **center** button is pressed on the EV3 Brick then stop.
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
motors.stopAll()
```
## Program 3 @fullscreen
Place a ``||brick:show string||`` block under ``||motors:stop all motors||``.
Change the `"Hello World"` text to `"30 cm"`.
The ``||motors:tank large B+C||`` will run for `9` rotations when the **center** button is pressed on the EV3 Brick then stop and display "30 cm" on the EV3 Bricks screen.
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
motors.stopAll()
brick.showString("30 cm", 1)
```
## Download @fullscreen
Click `|Download|` and follow the instructions to get your code onto your EV3 Brick. Press the **center** button on the EV3 Brick to run the program.

View File

@ -0,0 +1,79 @@
# Make It Move Without Wheels
## Objective
Design, build and program a robot that can move itself:
Your robot will:
* Go a distance of at least 30cm
* Use at least one motor
* Use NO wheels for locomotion
![@boardname@ with parts](/static/lessons/make-it-move/locomotion-no-wheels.jpg)
## Construct
Build a Walker Bot!
The Walker Bot is one example of many possible solutions for making a robot move without wheels.
The Walker Bot combines an EV3 Frame and two legs that are mirror-images to create left and right legs.
The legs in the Walker Bot are designed to show how to change the rotary motion of a motor to reciprocating motion.
Start by reading [these](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/ev3-dep/building%20instructions/walker-bot-bi-180fc24f9298e1dd6201099627d43903.pdf) instructions first.
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
![@boardname@ Walker Bot](/static/lessons/make-it-move/walker-bot.jpg)
## Program
In nature, creatures use many methods to get around. None of them, however, use wheels to move. Can we copy the method of animal locomotion with our robot? Using motors and legs, make the robot move without using any wheels.
### Step 1
Place a ``||motors:tank large B+C||`` block from ``||motors:Motors||`` under ``||loops:on start||``.
Change the speed to `-60%` (for motor B) and `+60%` (for motor C).
Change the rotations to `9`.
The ``||motors:tank large B+C||`` block will run for `9` rotations when the **center** button is pressed on the EV3 Brick. The motors are set for the reverse direction because they are mounted upside down in this model.
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
```
### Step 2
Place a ``||motors:stop all motors||`` block under ``||motors:tank large B+C||``.
The ``||motors:tank large B+C||`` block will run for `9` rotations when the **center** button is pressed on the EV3 Brick then stop.
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
motors.largeBC.stop()
```
### Step 3
Place a ``||brick:show string||`` block under ``||motors:stop all motors||``.
Change the `"Hello World"` text to `"30 cm"`.
The ``||motors:tank large B+C||`` will run for `9` rotations when the **center** button is pressed on the EV3 Brick then stop and display "30 cm" on the EV3 Bricks screen.
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
motors.largeBC.stop()
brick.showString("30 cm", 1)
```
### Step 4
Click `|Download|` and follow the instructions to get your code onto your EV3 Brick. Press the **center** button on the EV3 Brick to run the program.

24
docs/maker.md Normal file
View File

@ -0,0 +1,24 @@
# Maker Activites
## Activites
```codecard
[
{
"name": "Make A Sound Machine",
"description": "Make a Sound Machine that can play a rhythm, music or just noise!",
"url":"/maker/sound-machine",
"cardType": "example",
"imageUrl": "/static/lessons/make-a-sound-machine.png",
"cardType": "side"
},
{
"name": "Make A Security Gadget",
"description": "Invent a Security Gadget that will protect your belongings by warning you!",
"url":"/maker/security-gadget",
"cardType": "example",
"imageUrl": "/static/lessons/make-a-security-device.png",
"cardType": "side"
}
]
```

View File

@ -0,0 +1,9 @@
# Movement Detector
This program will activate an alarm when an object moves in front of the Ultrasonic Sensor.
```blocks
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectNear, function () {
music.playSoundEffectUntilDone(sounds.informationActivate)
})
```

Some files were not shown because too many files have changed in this diff Show More