Compare commits

..

26 Commits

Author SHA1 Message Date
4bea8e8712 1.2.31 2020-10-02 23:14:18 +02:00
0af6182f23 enable french (stable1.2) 2020-10-02 23:14:07 +02:00
398e53bae4 updated released version to 1.2.30 2020-09-20 23:45:56 -07:00
33e6372bf0 1.2.30 2020-09-10 23:42:19 -07:00
83bba14a4d Change timeout 1s -> 5s to reduce Timeout errors (#988) 2020-09-10 23:42:10 -07:00
0d7c1f0d50 Read default volume from device settings at start (#987) 2020-09-09 12:07:45 -07:00
623e57a30e 1.2.29 2020-09-08 23:56:34 -07:00
91235fb6d3 Change sound volume to level (#986) 2020-09-08 23:55:35 -07:00
4a73c5d700 1.2.28 2020-08-21 06:07:32 +02:00
a47a06ac19 Cooperate (#985)
* cooperate pause

* fix math

* update lastPause before pausing

* faster cooperation

Co-authored-by: Peli de Halleux <peli@DESKTOP-5B7QRAM.corp.microsoft.com>
2020-08-21 06:06:59 +02:00
3f598a3eee 1.2.27 2020-01-19 21:49:57 -08:00
ded2e9d82c don't close bt connection 2020-01-19 21:41:43 -08: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
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
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
35 changed files with 5524 additions and 366 deletions

View File

@ -6,13 +6,13 @@
<a class="item" href="https://makecode.com/privacy" target="_blank" rel="noopener">Privacy &amp; Cookies</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/termsofuse" target="_blank" rel="noopener"> Terms Of Use</a>
<a class="item" href="https://makecode.com/trademarks" target="_blank" rel="noopener">Trademarks</a> <a class="item" href="https://makecode.com/trademarks" target="_blank" rel="noopener">Trademarks</a>
<div class="item">©2019 Microsoft</div> <div class="item">© 2018 Microsoft</div>
</div> </div>
<div class="ui container horizontal small divided link list"> <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> <a class="ui centered item" href="https://makecode.com/" title="Microsoft MakeCode" target="_blank" rel="noopener">Powered by Microsoft MakeCode</a>
</div> </div>
<div class="ui centered container small list"> <div class="ui centered container small list">
<p class="item">@copyrightText@</p> <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>
</div> </div>
</footer> </footer>

View File

@ -27,7 +27,6 @@ while (true) {
music.playSoundEffectUntilDone(sounds.mechanicalMotorStart) music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle); music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
} }
pause(1);
} }
``` ```
@ -43,6 +42,5 @@ while (true) {
music.playSoundEffectUntilDone(sounds.mechanicalMotorStart) music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle); music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
} }
pause(1);
} }
``` ```

View File

@ -35,6 +35,13 @@ On the home page, scroll down to the **FLL / City Shaper** section for specific
Yes. 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? ### 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. 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.
@ -98,6 +105,12 @@ The official answer is currently no. That being said, we have **Experimental sup
https://youtu.be/VIq8-6Egtqs 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? ### 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. 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.

View File

@ -54,6 +54,12 @@ Verify that the program you just created shows eyes on the Brick Display, and th
**Well done!** **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 ## Connect a Large Motor
Now you will learn to control the Large Motor. Now you will learn to control the Large Motor.

View File

@ -1,3 +1,3 @@
{ {
"appref": "v1.2.22" "appref": "v1.2.30"
} }

View File

@ -3,20 +3,11 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>@name@ Offline App</title> <title>LEGO® MINDSTORMS® Education EV3 Offline App</title>
<meta name="Description" content="A MakeCode for @name@ offline app" /> <meta name="Description" content="A MakeCode for LEGO® MINDSTORMS® Education EV3 offline app" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" data-rtl="/blb/rtlsemantic.css" href="/doccdn/semantic.css" /> <!-- @include indexhead.html -->
<link rel="stylesheet" href="/docfiles/style.css" />
<link rel="stylesheet" href="/docfiles/target.css" />
<script src="/doccdn/jquery.js" type="text/javascript"></script>
<script src="/doccdn/semantic.js" type="text/javascript"></script>
<script src="/docfiles/target.js" type="text/javascript"></script>
<style>
@targetstyle@
</style>
<style> <style>
p.item { p.item {
color: rgba(0, 0, 0, 0.4); color: rgba(0, 0, 0, 0.4);
@ -64,10 +55,6 @@
background-color: rgb(250, 250, 250); background-color: rgb(250, 250, 250);
} }
#legal-segment {
background:white;
}
@media only screen and (max-width: 800px) { @media only screen and (max-width: 800px) {
.grid .column .image { .grid .column .image {
display: none; display: none;
@ -381,61 +368,34 @@
</style> </style>
<script> <script>
var electronLatestVersion = ""; $(document).ready(function () {
function tickEvent(id, data) { tickEvent = function (id, data) {
if (!pxt.aiTrackEvent) return; if (!pxt.aiTrackEvent) return;
if (!data) pxt.aiTrackEvent(id); if (!data) pxt.aiTrackEvent(id);
else { else {
var props = {}; var props = {};
var measures = {}; var measures = {};
for (var k in data) for (var k in data)
if (typeof data[k] == "string") props[k] = data[k]; if (typeof data[k] == "string") props[k] = data[k];
else measures[k] = data[k]; else measures[k] = data[k];
pxt.aiTrackEvent(id, props, measures); pxt.aiTrackEvent(id, props, measures);
}
} }
} });
function agreeCheckboxChanged() { function agreeCheckboxChanged() {
showDownloads(); var downloadSegment = document.getElementById("download-segment");
} downloadSegment.classList.toggle("hidden");
function showAgree() {
$("#agree-segment").removeClass("hidden");
$("#read-segment").removeClass("hidden");
$("#legal-segment").removeClass("hidden");
}
function showNoDownloads() {
$("#no-download-segment").removeClass("hidden");
$("#read-segment").addClass("hidden");
$("#legal-segment").addClass("hidden");
}
function showDownloads() {
$("#download-win64").attr("href", "https://makecode.com/api/release/@targetid@/" + electronLatestVersion + "/win64");
$("#download-mac64").attr("href", "https://makecode.com/api/release/@targetid@/" + electronLatestVersion + "/mac64");
$("#download-segment").removeClass("hidden");
} }
function downloadWin64() { function downloadWin64() {
tickEvent("offlineapp.download", { "target": "@targetid@", "platform": "win64" }); // TODO: Keep this link up-to-date with the desired release version
window.open("https://makecode.com/api/release/ev3/v1.2.22/win64");
tickEvent("offlineapp.download", { "target": "ev3", "platform": "win64" });
} }
function downloadMac64() { function downloadMac64() {
tickEvent("offlineapp.download", { "target": "@targetid@", "platform": "mac64" }); // TODO: Keep this link up-to-date with the desired release version
window.open("https://makecode.com/api/release/ev3/v1.2.22/mac64");
tickEvent("offlineapp.download", { "target": "ev3", "platform": "mac64" });
} }
$(function () {
$.getJSON("https://makecode.com/api/config/@targetid@/targetconfig")
.then(function (data) {
if (data && data.electronManifest && data.electronManifest.latest) {
electronLatestVersion = data.electronManifest.latest;
showAgree();
} else {
showNoDownloads();
}
})
.catch(function () {
showNoDownloads();
})
});
</script> </script>
</head> </head>
@ -446,39 +406,35 @@
<div class="ui grid topbar"> <div class="ui grid topbar">
<div class="three wide column"> <div class="three wide column">
<img class="ui small image left" src="@cardLogo@" /> <img class="ui small image left" src="/static//lego_education_logo_white.png" />
</div> </div>
<div class="ten wide column"> <div class="ten wide column">
<h1 class="ui inverted welcomeheader">@name@ Offline App</h1> <h1 class="ui inverted welcomeheader">MakeCode Offline App</h1>
</div> </div>
<div class="three wide column"> <div class="three wide column">
<img class="ui small image right" src="/static/Microsoft-logo_rgb_c-white.png" /> <img class="ui small image right" src="/static//Microsoft-logo_rgb_c-white.png" />
</div> </div>
</div> </div>
<div id="segments" class="ui compact segments terms-container"> <div class="ui compact segments terms-container">
<div id="read-segment" class="ui secondary center aligned segment hidden"> <div class="ui secondary center aligned segment">
Please read and accept the following terms to download the app. Please read and accept the following terms to download the app.
</div> </div>
<div id="legal-segment" class="ui left aligned segment terms hidden"> <div class="ui left aligned segment terms">
<div id="loader" class="ui active loader"></div>
<div class="c17"> <div class="c17">
<p class="c11"> <p class="c11">
<span class="c4 c1">MICROSOFT PRE-RELEASE SOFTWARE LICENSE TERMS</span> <span class="c4 c1">MICROSOFT PRE-RELEASE SOFTWARE LICENSE TERMS</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c4 c1">MICROSOFT MAKECODE SOFTWARE FOR @name@</span> <span class="c4 c1">MICROSOFT MAKECODE FOR LEGO MINDSTORMS EDUCATION EV3</span>
</p> </p>
<p class="c7"> <p class="c7">
<span class="c4 c1"></span> <span class="c4 c1"></span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c3 c1">These license terms are an agreement between Microsoft Corporation (or based <span class="c3 c1">These license terms are an agreement between Microsoft Corporation (or based on where you live, one
on where you live, one of its affiliates) and you. They apply to the software named above. The terms also apply to any
of its affiliates) and you. They apply to the software named above. The terms also apply to Microsoft services or updates for the software, except to the extent those have additional terms.</span>
any
Microsoft services or updates for the software, except to the extent those have additional
terms.</span>
</p> </p>
<p class="c7"> <p class="c7">
<span class="c3 c1"></span> <span class="c3 c1"></span>
@ -490,35 +446,27 @@
<span class="c5 c1">1.</span> <span class="c5 c1">1.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">INSTALLATION AND USE RIGHTS. </span> <span class="c5 c1">INSTALLATION AND USE RIGHTS. </span>
<span class="c3 c1">You may install and use any number of copies of the software to evaluate it <span class="c3 c1">You may install and use any number of copies of the software to evaluate it as you develop and test
as you develop and test your software applications for use with Lego Mindstorms Education EV3 hardware.</span>
your software applications for use with @name@ hardware.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">2.</span> <span class="c5 c1">2.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">PRE-RELEASE SOFTWARE. </span> <span class="c5 c1">PRE-RELEASE SOFTWARE. </span>
<span class="c3 c1">The software is a pre-release version. It may not work the way a final <span class="c3 c1">The software is a pre-release version. It may not work the way a final version of the software will.
version of the software will. Microsoft may change it for the final, commercial version. We also may not release a commercial
Microsoft may change it for the final, commercial version. We also may not release a version. Microsoft is not obligated to provide maintenance, technical support or updates to you
commercial
version. Microsoft is not obligated to provide maintenance, technical support or updates to
you
for the software.</span> for the software.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">3.</span> <span class="c5 c1">3.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">ASSOCIATED ONLINE SERVICES.</span> <span class="c5 c1">ASSOCIATED ONLINE SERVICES.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Some features of the software <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Some features of the software provide access
provide access to, or rely on, online services to provide you information about updates to the software or extensions,
to, or rely on, online services to provide you information about updates to the software or or to enable you to retrieve content, collaborate with others, or otherwise supplement your development
extensions, experience. As used throughout these license terms, the term <q>software</q> includes these online
or to enable you to retrieve content, collaborate with others, or otherwise supplement your services and features. By using these online services and features you consent to the to the
development
experience. As used throughout these license terms, the term <q>software</q> includes these
online
services and features. By using these online services and features you consent to the to the
transmission of information as described in Section 5, DATA. transmission of information as described in Section 5, DATA.
</span> </span>
</p> </p>
@ -526,11 +474,9 @@
<span class="c5 c1">4.</span> <span class="c5 c1">4.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">LICENSES FOR OTHER COMPONENTS.</span> <span class="c5 c1">LICENSES FOR OTHER COMPONENTS.</span>
<span class="c3 c1">&nbsp;The software may include third party components with separate legal <span class="c3 c1">&nbsp;The software may include third party components with separate legal notices or governed by
notices or governed by
other agreements, as described in the ThirdPartyNotices file accompanying the software. Even other agreements, as described in the ThirdPartyNotices file accompanying the software. Even
if such components are governed by other agreements, the disclaimers and the limitations on if such components are governed by other agreements, the disclaimers and the limitations on and
and
exclusions of damages below also apply.</span> exclusions of damages below also apply.</span>
</p> </p>
<p class="c2"> <p class="c2">
@ -542,35 +488,26 @@
<span class="c5 c1">a.</span> <span class="c5 c1">a.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c1 c5">Data Collection. </span> <span class="c1 c5">Data Collection. </span>
<span class="c1">The software may collect information about you and your use of the software, <span class="c1">The software may collect information about you and your use of the software, and send that to Microsoft.
and send that to Microsoft. Microsoft may use this information to provide services and improve our products and services.
Microsoft may use this information to provide services and improve our products and You may opt out of many of these scenarios, but not all, as described in the product documentation.
services. In using the software, you must comply with applicable law. You can learn more about data collection
You may opt out of many of these scenarios, but not all, as described in the product
documentation.
In using the software, you must comply with applicable law. You can learn more about data
collection
and use in the help documentation and the privacy statement at </span> and use in the help documentation and the privacy statement at </span>
<span class="c14 c1"> <span class="c14 c1">
<a class="c9" <a class="c9" href="http://go.microsoft.com/fwlink/?LinkId=398505">http://go.microsoft.com/fwlink/?LinkId=398505</a>
href="http://go.microsoft.com/fwlink/?LinkId=398505">http://go.microsoft.com/fwlink/?LinkId=398505</a>
</span> </span>
<span class="c1">.</span> <span class="c1">.</span>
<span class="c3 c1">&nbsp;Your use of the software operates as your consent to these <span class="c3 c1">&nbsp;Your use of the software operates as your consent to these practices.</span>
practices.</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c5 c1">b.</span> <span class="c5 c1">b.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">Processing of Personal Data. </span> <span class="c5 c1">Processing of Personal Data. </span>
<span class="c1">To the extent Microsoft is a processor or subprocessor of personal data in <span class="c1">To the extent Microsoft is a processor or subprocessor of personal data in connection with the software,
connection with the software, Microsoft makes the commitments in the European Union General Data Protection Regulation Terms
Microsoft makes the commitments in the European Union General Data Protection Regulation
Terms
of the Online Services Terms to all customers effective May 25, 2018, at </span> of the Online Services Terms to all customers effective May 25, 2018, at </span>
<span class="c1 c14"> <span class="c1 c14">
<a class="c9" <a class="c9" href="http://go.microsoft.com/?linkid=9840733">http://go.microsoft.com/?linkid=9840733</a>
href="http://go.microsoft.com/?linkid=9840733">http://go.microsoft.com/?linkid=9840733</a>
</span> </span>
<span class="c3 c1">.</span> <span class="c3 c1">.</span>
</p> </p>
@ -578,62 +515,48 @@
<span class="c5 c1">6.</span> <span class="c5 c1">6.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">FEEDBACK. </span> <span class="c5 c1">FEEDBACK. </span>
<span class="c3 c1">If you give feedback about the software to Microsoft, you give to Microsoft, <span class="c3 c1">If you give feedback about the software to Microsoft, you give to Microsoft, without charge, the
without charge, the
right to use, share and commercialize your feedback in any way and for any purpose. You will right to use, share and commercialize your feedback in any way and for any purpose. You will
not give feedback that is subject to a license that requires Microsoft to license its not give feedback that is subject to a license that requires Microsoft to license its software
software or documentation to third parties because we include your feedback in them. These rights survive
or documentation to third parties because we include your feedback in them. These rights
survive
this agreement.</span> this agreement.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">7.</span> <span class="c5 c1">7.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">SCOPE OF LICENSE.</span> <span class="c5 c1">SCOPE OF LICENSE.</span>
<span class="c3 c1">&nbsp;The software is licensed, not sold. This agreement only gives you some <span class="c3 c1">&nbsp;The software is licensed, not sold. This agreement only gives you some rights to use the software.
rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this
Microsoft reserves all other rights. Unless applicable law gives you more rights despite
this
limitation, you may use the software only as expressly permitted in this agreement. &nbsp;In limitation, you may use the software only as expressly permitted in this agreement. &nbsp;In
doing so, you must comply with any technical limitations in the software that only allow you doing so, you must comply with any technical limitations in the software that only allow you
to use it in certain ways. You may not:</span> to use it in certain ways. You may not:</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; work around any technical limitations in the <span class="c3 c1">- &nbsp; &nbsp; work around any technical limitations in the software;</span>
software;</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; reverse engineer, decompile or disassemble the software, or <span class="c3 c1">- &nbsp; &nbsp; reverse engineer, decompile or disassemble the software, or attempt to do so, except
attempt to do so, except
and only to the extent required by third party licensing terms governing use of certain open and only to the extent required by third party licensing terms governing use of certain open
source components that may be included with the software;</span> source components that may be included with the software;</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; remove, minimize, block or modify any notices of Microsoft <span class="c3 c1">- &nbsp; &nbsp; remove, minimize, block or modify any notices of Microsoft or its suppliers in the
or its suppliers in the
software; software;
</span> </span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; use the software in any way that is against the law; <span class="c3 c1">- &nbsp; &nbsp; use the software in any way that is against the law; or</span>
or</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; share, publish, rent or lease the software, or provide the <span class="c3 c1">- &nbsp; &nbsp; share, publish, rent or lease the software, or provide the software as a stand-alone
software as a stand-alone
offering for others to use.</span> offering for others to use.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">8. &nbsp; UPDATES. </span> <span class="c5 c1">8. &nbsp; UPDATES. </span>
<span class="c3 c1">The software may periodically check for updates and download and install <span class="c3 c1">The software may periodically check for updates and download and install them for you. You may obtain
them for you. You may obtain updates only from Microsoft or authorized sources. Microsoft may need to update your system to
updates only from Microsoft or authorized sources. Microsoft may need to update your system provide you with updates. You agree to receive these automatic updates without any additional
to notice. Updates may not include or support all existing software features, services, or peripheral
provide you with updates. You agree to receive these automatic updates without any
additional
notice. Updates may not include or support all existing software features, services, or
peripheral
devices. devices.
</span> </span>
</p> </p>
@ -641,74 +564,57 @@
<span class="c5 c1">9.</span> <span class="c5 c1">9.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">EXPORT RESTRICTIONS.</span> <span class="c5 c1">EXPORT RESTRICTIONS.</span>
<span class="c3 c1">&nbsp;You must comply with all domestic and international export laws and <span class="c3 c1">&nbsp;You must comply with all domestic and international export laws and regulations that apply
regulations that apply to the software, which include restrictions on destinations, end users and end use. For further
to the software, which include restrictions on destinations, end users and end use. For
further
information on export restrictions, visit (aka.ms/exporting).</span> information on export restrictions, visit (aka.ms/exporting).</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">10.</span> <span class="c5 c1">10.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">SUPPORT SERVICES. </span> <span class="c5 c1">SUPPORT SERVICES. </span>
<span class="c3 c1">Because the software is &ldquo;as is,&rdquo; we may not provide support <span class="c3 c1">Because the software is &ldquo;as is,&rdquo; we may not provide support services for it.</span>
services for it.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">11.</span> <span class="c5 c1">11.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">ENTIRE AGREEMENT.</span> <span class="c5 c1">ENTIRE AGREEMENT.</span>
<span class="c3 c1">&nbsp;This agreement, and the terms for supplements, updates, Internet-based <span class="c3 c1">&nbsp;This agreement, and the terms for supplements, updates, Internet-based services and support
services and support services that you use, are the entire agreement for the software and support services.</span>
services that you use, are the entire agreement for the software and support
services.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">12.</span> <span class="c5 c1">12.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">APPLICABLE LAW. </span> <span class="c5 c1">APPLICABLE LAW. </span>
<span class="c3 c1">If you acquired the software in the United States, Washington State law <span class="c3 c1">If you acquired the software in the United States, Washington State law applies to interpretation
applies to interpretation of and claims for breach of this agreement, and the laws of the state where you live apply to
of and claims for breach of this agreement, and the laws of the state where you live apply
to
all other claims. If you acquired the software in any other country, its laws apply.</span> all other claims. If you acquired the software in any other country, its laws apply.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">13.</span> <span class="c5 c1">13.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">CONSUMER RIGHTS; REGIONAL VARIATIONS. </span> <span class="c5 c1">CONSUMER RIGHTS; REGIONAL VARIATIONS. </span>
<span class="c3 c1">This agreement describes certain legal rights. You may have other rights, <span class="c3 c1">This agreement describes certain legal rights. You may have other rights, including consumer rights,
including consumer rights, under the laws of your state or country. Separate and apart from your relationship with Microsoft,
under the laws of your state or country. Separate and apart from your relationship with you may also have rights with respect to the party from which you acquired the software. This
Microsoft, agreement does not change those other rights if the laws of your state or country do not permit
you may also have rights with respect to the party from which you acquired the software. it to do so. For example, if you acquired the software in one of the below regions, or mandatory
This
agreement does not change those other rights if the laws of your state or country do not
permit
it to do so. For example, if you acquired the software in one of the below regions, or
mandatory
country law applies, then the following provisions apply to you:</span> country law applies, then the following provisions apply to you:</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c5 c1">a.</span> <span class="c5 c1">a.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">Australia. </span> <span class="c5 c1">Australia. </span>
<span class="c3 c1">You have statutory guarantees under the Australian Consumer Law and nothing <span class="c3 c1">You have statutory guarantees under the Australian Consumer Law and nothing in this agreement is
in this agreement is
intended to affect those rights.</span> intended to affect those rights.</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c5 c1">b.</span> <span class="c5 c1">b.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">Canada. </span> <span class="c5 c1">Canada. </span>
<span class="c3 c1">If you acquired the software in Canada, you may stop receiving updates by <span class="c3 c1">If you acquired the software in Canada, you may stop receiving updates by turning off the automatic
turning off the automatic update feature, disconnecting your device from the Internet (if and when you re-connect to the
update feature, disconnecting your device from the Internet (if and when you re-connect to Internet, however, the software will resume checking for and installing updates), or uninstalling
the the software. The product documentation, if any, may also specify how to turn off updates for
Internet, however, the software will resume checking for and installing updates), or
uninstalling
the software. The product documentation, if any, may also specify how to turn off updates
for
your specific device or software.</span> your specific device or software.</span>
</p> </p>
<p class="c8"> <p class="c8">
@ -721,10 +627,8 @@
<span class="c5 c1">(i)</span> <span class="c5 c1">(i)</span>
<span class="c1">&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">Warranty</span> <span class="c5 c1">Warranty</span>
<span class="c3 c1">. The properly licensed software will perform substantially as described in <span class="c3 c1">. The properly licensed software will perform substantially as described in any Microsoft materials
any Microsoft materials that accompany the software. However, Microsoft gives no contractual guarantee in relation to
that accompany the software. However, Microsoft gives no contractual guarantee in relation
to
the licensed software.</span> the licensed software.</span>
</p> </p>
<p class="c6"> <p class="c6">
@ -734,103 +638,74 @@
<span class="c5 c1">(ii)</span> <span class="c5 c1">(ii)</span>
<span class="c1">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">Limitation of Liability</span> <span class="c5 c1">Limitation of Liability</span>
<span class="c3 c1">. In case of intentional conduct, gross negligence, claims based on the <span class="c3 c1">. In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as
Product Liability Act, as well as, in case of death or personal or physical injury, Microsoft is liable according to the
well as, in case of death or personal or physical injury, Microsoft is liable according to
the
statutory law.</span> statutory law.</span>
</p> </p>
<p class="c10"> <p class="c10">
<span class="c3 c1">Subject to the foregoing clause (ii), Microsoft will only be liable for <span class="c3 c1">Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft
slight negligence if Microsoft is in breach of such material contractual obligations, the fulfillment of which facilitate the
is in breach of such material contractual obligations, the fulfillment of which facilitate due performance of this agreement, the breach of which would endanger the purpose of this agreement
the and the compliance with which a party may constantly trust in (so-called &quot;cardinal obligations&quot;).
due performance of this agreement, the breach of which would endanger the purpose of this In other cases of slight negligence, Microsoft will not be liable for slight negligence.</span>
agreement
and the compliance with which a party may constantly trust in (so-called &quot;cardinal
obligations&quot;).
In other cases of slight negligence, Microsoft will not be liable for slight
negligence.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">14.</span> <span class="c5 c1">14.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">LEGAL EFFECT.</span> <span class="c5 c1">LEGAL EFFECT.</span>
<span class="c3 c1">&nbsp;This agreement describes certain legal rights. You may have other <span class="c3 c1">&nbsp;This agreement describes certain legal rights. You may have other rights under the laws of
rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software.
your country. You may also have rights with respect to the party from whom you acquired the This agreement does not change your rights under the laws of your country if the laws of your
software.
This agreement does not change your rights under the laws of your country if the laws of
your
country do not permit it to do so.</span> country do not permit it to do so.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">15.</span> <span class="c5 c1">15.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c4 c1">DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED &ldquo;AS-IS.&rdquo; <span class="c4 c1">DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED &ldquo;AS-IS.&rdquo; &nbsp;YOU BEAR THE RISK OF
&nbsp;YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT PERMITTED
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT
PERMITTED
UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.</span> FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">16.</span> <span class="c5 c1">16.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c4 c1">LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND <span class="c4 c1">LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT
ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST
DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL,
LOST
PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.</span> PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.</span>
</p> </p>
<p class="c0"> <p class="c0">
<span class="c3 c1">This limitation applies to (a) anything related to the software, services, <span class="c3 c1">This limitation applies to (a) anything related to the software, services, content (including code)
content (including code) on third party Internet sites, or third party programs; and (b) claims for breach of contract,
on third party Internet sites, or third party programs; and (b) claims for breach of breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the
contract,
breach of warranty, guarantee or condition, strict liability, negligence, or other tort to
the
extent permitted by applicable law.</span> extent permitted by applicable law.</span>
</p> </p>
<p class="c0"> <p class="c0">
<span class="c3 c1">It also applies even if Microsoft knew or should have known about the <span class="c3 c1">It also applies even if Microsoft knew or should have known about the possibility of the damages.
possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the
The above limitation or exclusion may not apply to you because your country may not allow
the
exclusion or limitation of incidental, consequential or other damages.</span> exclusion or limitation of incidental, consequential or other damages.</span>
</p> </p>
<p class="c12"> <p class="c12">
<span class="c4 c1">Please note: As the software is distributed in Quebec, Canada, some of the <span class="c4 c1">Please note: As the software is distributed in Quebec, Canada, some of the clauses in this agreement
clauses in this agreement
are provided below in French.</span> are provided below in French.</span>
</p> </p>
<p class="c12"> <p class="c12">
<span class="c4 c1">Remarque : Ce logiciel &eacute;tant distribu&eacute; au Qu&eacute;bec, <span class="c4 c1">Remarque : Ce logiciel &eacute;tant distribu&eacute; au Qu&eacute;bec, Canada, certaines des clauses
Canada, certaines des clauses
dans ce contrat sont fournies ci-dessous en fran&ccedil;ais.</span> dans ce contrat sont fournies ci-dessous en fran&ccedil;ais.</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c5 c1">EXON&Eacute;RATION DE GARANTIE.</span> <span class="c5 c1">EXON&Eacute;RATION DE GARANTIE.</span>
<span class="c1 c3">&nbsp;Le logiciel vis&eacute; par une licence est offert &laquo; tel quel <span class="c1 c3">&nbsp;Le logiciel vis&eacute; par une licence est offert &laquo; tel quel &raquo;. Toute utilisation
&raquo;. Toute utilisation de ce logiciel est &agrave; votre seule risque et p&eacute;ril. Microsoft n&rsquo;accorde aucune
de ce logiciel est &agrave; votre seule risque et p&eacute;ril. Microsoft n&rsquo;accorde autre garantie expresse. Vous pouvez b&eacute;n&eacute;ficier de droits additionnels en vertu
aucune du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles
autre garantie expresse. Vous pouvez b&eacute;n&eacute;ficier de droits additionnels en sont permises par le droit locale, les garanties implicites de qualit&eacute; marchande, d&rsquo;ad&eacute;quation
vertu
du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou
elles
sont permises par le droit locale, les garanties implicites de qualit&eacute; marchande,
d&rsquo;ad&eacute;quation
&agrave; un usage particulier et d&rsquo;absence de contrefa&ccedil;on sont exclues. &agrave; un usage particulier et d&rsquo;absence de contrefa&ccedil;on sont exclues.
</span> </span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c5 c1">LIMITATION DES DOMMAGES-INT&Eacute;R&Ecirc;TS ET EXCLUSION DE <span class="c5 c1">LIMITATION DES DOMMAGES-INT&Eacute;R&Ecirc;TS ET EXCLUSION DE RESPONSABILIT&Eacute; POUR LES DOMMAGES.</span>
RESPONSABILIT&Eacute; POUR LES DOMMAGES.</span> <span class="c3 c1">&nbsp;Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages
<span class="c3 c1">&nbsp;Vous pouvez obtenir de Microsoft et de ses fournisseurs une directs uniquement &agrave; hauteur de 5,00 $ US. Vous ne pouvez pr&eacute;tendre &agrave; aucune
indemnisation en cas de dommages
directs uniquement &agrave; hauteur de 5,00 $ US. Vous ne pouvez pr&eacute;tendre &agrave;
aucune
indemnisation pour les autres dommages, y compris les dommages sp&eacute;ciaux, indirects ou indemnisation pour les autres dommages, y compris les dommages sp&eacute;ciaux, indirects ou
accessoires et pertes de b&eacute;n&eacute;fices.</span> accessoires et pertes de b&eacute;n&eacute;fices.</span>
</p> </p>
@ -838,36 +713,26 @@
<span class="c3 c1">Cette limitation concerne :</span> <span class="c3 c1">Cette limitation concerne :</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; tout ce qui est reli&eacute; au logiciel, aux <span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; tout ce qui est reli&eacute; au logiciel, aux services ou au contenu
services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et</span>
(y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ;
et</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; les r&eacute;clamations au titre de violation <span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; les r&eacute;clamations au titre de violation de contrat ou de garantie,
de contrat ou de garantie, ou au titre de responsabilit&eacute; stricte, de n&eacute;gligence ou d&rsquo;une autre faute
ou au titre de responsabilit&eacute; stricte, de n&eacute;gligence ou d&rsquo;une autre
faute
dans la limite autoris&eacute;e par la loi en vigueur.</span> dans la limite autoris&eacute;e par la loi en vigueur.</span>
</p> </p>
<p class="c12"> <p class="c12">
<span class="c3 c1">Elle s&rsquo;applique &eacute;galement, m&ecirc;me si Microsoft connaissait <span class="c3 c1">Elle s&rsquo;applique &eacute;galement, m&ecirc;me si Microsoft connaissait ou devrait conna&icirc;tre
ou devrait conna&icirc;tre
l&rsquo;&eacute;ventualit&eacute; d&rsquo;un tel dommage. Si votre pays n&rsquo;autorise pas l&rsquo;&eacute;ventualit&eacute; d&rsquo;un tel dommage. Si votre pays n&rsquo;autorise pas
l&rsquo;exclusion ou la limitation de responsabilit&eacute; pour les dommages indirects, l&rsquo;exclusion ou la limitation de responsabilit&eacute; pour les dommages indirects, accessoires
accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l&rsquo;exclusion ci-dessus
ou de quelque nature que ce soit, il se peut que la limitation ou l&rsquo;exclusion
ci-dessus
ne s&rsquo;appliquera pas &agrave; votre &eacute;gard.</span> ne s&rsquo;appliquera pas &agrave; votre &eacute;gard.</span>
</p> </p>
<p class="c16"> <p class="c16">
<span class="c5 c1">EFFET JURIDIQUE.</span> <span class="c5 c1">EFFET JURIDIQUE.</span>
<span class="c3 c1">&nbsp;Le pr&eacute;sent contrat d&eacute;crit certains droits juridiques. <span class="c3 c1">&nbsp;Le pr&eacute;sent contrat d&eacute;crit certains droits juridiques. Vous pourriez avoir d&rsquo;autres
Vous pourriez avoir d&rsquo;autres droits pr&eacute;vus par les lois de votre pays. Le pr&eacute;sent contrat ne modifie pas les
droits pr&eacute;vus par les lois de votre pays. Le pr&eacute;sent contrat ne modifie pas droits que vous conf&egrave;rent les lois de votre pays si celles-ci ne le permettent pas.</span>
les
droits que vous conf&egrave;rent les lois de votre pays si celles-ci ne le permettent
pas.</span>
</p> </p>
<p class="c15"> <p class="c15">
<span class="c3 c1"></span> <span class="c3 c1"></span>
@ -875,9 +740,9 @@
<p class="c16"> <p class="c16">
<span class="c3 c1">&nbsp;</span> <span class="c3 c1">&nbsp;</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c3 c1">@copyrightText@</span> <span class="c3 c1">LEGO, the LEGO logo, MINDSTORMS and the MINDSTORMS EV3 logo are trademarks and/ or copyrights of
the LEGO Group. &copy;2018 The LEGO Group. All rights reserved.</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c3 c1">&nbsp;</span> <span class="c3 c1">&nbsp;</span>
@ -890,30 +755,27 @@
</p> </p>
</div> </div>
</div> </div>
<div id="agree-segment" class="ui center aligned segment hidden"> <div class="ui center aligned segment">
<input id="agree-checkbox" type="checkbox" autocomplete="off" onchange="agreeCheckboxChanged(this)"> <input id="agree-checkbox" type="checkbox" autocomplete="off" onchange="agreeCheckboxChanged(this)">
<label for="agree-checkbox">I agree to these Microsoft Software License Terms and to the <label for="agree-checkbox">I agree to these Microsoft Software License Terms and to the
<a href="https://privacy.microsoft.com/en-us/privacystatement">Microsoft Privacy Statement.</a> <a href="https://privacy.microsoft.com/en-us/privacystatement">Microsoft Privacy Statement.</a>
</label> </label>
</div> </div>
<div id="no-download-segment" class="ui center aligned segment hidden">
<p>Sorry, there is no Offline App available for this editor.</p>
</div>
<div id="download-segment" class="ui center aligned segment hidden"> <div id="download-segment" class="ui center aligned segment hidden">
<div class="ui grid"> <div class="ui grid">
<div class="eight wide column"> <div class="eight wide column">
<h3 class="ui">Windows</h3> <h3 class="ui">Windows</h3>
<a id="download-win64" class="ui icon button" onclick="downloadWin64()"> <button class="ui icon button" onclick="downloadWin64()">
<i class="download icon"></i> <i class="download icon"></i>
makecode-@targetid@-setup-win64.exe makecode-ev3-setup-win64.exe
</a> </button>
</div> </div>
<div class="eight wide column"> <div class="eight wide column">
<h3 class="ui">Mac OS</h3> <h3 class="ui">Mac OS</h3>
<a id="download-mac64" class="ui icon button" onclick="downloadMac64()"> <button class="ui icon button" onclick="downloadMac64()">
<i class="download icon"></i> <i class="download icon"></i>
makecode-@targetid@-mac64.zip makecode-ev3-mac64.zip
</a> </button>
</div> </div>
</div> </div>
</div> </div>
@ -926,4 +788,4 @@
</body> </body>
</html> </html>

View File

@ -0,0 +1,18 @@
# exit Program
Stops the program and returns to the brick menu
```sig
brick.exitProgram();
```
## Example
Do a sequence of motor commands and stop the program.
```blocks
motors.largeA.run(50)
pause(500)
motors.stopAll()
brick.exitProgram();
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -64,6 +64,7 @@ class WebSerialPackageIO implements pxt.HF2.PacketIO {
private _writer: any; private _writer: any;
constructor(private port: SerialPort, private options: SerialOptions) { constructor(private port: SerialPort, private options: SerialOptions) {
console.log(`serial: new io`)
} }
async readSerialAsync() { async readSerialAsync() {
@ -90,17 +91,24 @@ class WebSerialPackageIO implements pxt.HF2.PacketIO {
return !!(<any>navigator).serial; return !!(<any>navigator).serial;
} }
static portIos: WebSerialPackageIO[] = [];
static async mkPacketIOAsync(): Promise<pxt.HF2.PacketIO> { static async mkPacketIOAsync(): Promise<pxt.HF2.PacketIO> {
const serial = (<any>navigator).serial; const serial = (<any>navigator).serial;
if (serial) { if (serial) {
try { try {
const requestOptions: SerialPortRequestOptions = {}; const requestOptions: SerialPortRequestOptions = {};
const port = await serial.requestPort(requestOptions); const port = await serial.requestPort(requestOptions);
const options: SerialOptions = {
baudrate: 460800, let io = WebSerialPackageIO.portIos.filter(i => i.port == port)[0];
buffersize: 4096 if (!io) {
}; const options: SerialOptions = {
return new WebSerialPackageIO(port, options); baudrate: 460800,
buffersize: 4096
};
io = new WebSerialPackageIO(port, options);
WebSerialPackageIO.portIos.push(io);
}
return io;
} catch (e) { } catch (e) {
console.log(`connection error`, e) console.log(`connection error`, e)
} }
@ -125,11 +133,8 @@ class WebSerialPackageIO implements pxt.HF2.PacketIO {
}); });
} }
private closeAsync() { private async closeAsync() {
console.log(`serial: closing port`); // don't close port
this.port.close();
this._reader = undefined;
this._writer = undefined;
return Promise.delay(500); return Promise.delay(500);
} }

View File

@ -116,7 +116,7 @@ export class Ev3Wrapper {
if (this.dataDump) if (this.dataDump)
log("TALK: " + U.toHex(buf)) log("TALK: " + U.toHex(buf))
return this.io.sendPacketAsync(buf) return this.io.sendPacketAsync(buf)
.then(() => this.msgs.shiftAsync(1000)) .then(() => this.msgs.shiftAsync(5000))
.then(resp => { .then(resp => {
if (resp[2] != buf[2] || resp[3] != buf[3]) if (resp[2] != buf[2] || resp[3] != buf[3])
U.userError("msg count de-sync") U.userError("msg count de-sync")

View File

@ -149,9 +149,9 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
getFirstValueI11n(value: string) { getFirstValueI11n(value: string) {
const firstValue = this.getFirstValue(value); const firstValue = this.getFirstValue(value);
const motorOptions = { const motorOptions = {
'medium motor': lf('medium motor'), 'medium motor': lf("medium motor"),
'large motor': lf('large motor'), 'large motor': lf("large motor"),
'large motors': lf('large motors') 'large motors': lf("large motors")
} }
return motorOptions[firstValue]; return motorOptions[firstValue];
} }

View File

@ -1,5 +1,4 @@
const enum ColorSensorMode { const enum ColorSensorMode {
None = 0,
//% block="reflected light intensity" //% block="reflected light intensity"
ReflectedLightIntensity = 0, ReflectedLightIntensity = 0,
//% block="ambient light intensity" //% block="ambient light intensity"
@ -59,7 +58,6 @@ namespace sensors {
constructor(port: number) { constructor(port: number) {
super(port) super(port)
this._setMode(ColorSensorMode.None);
this.thresholdDetector = new sensors.ThresholdDetector(this.id()); this.thresholdDetector = new sensors.ThresholdDetector(this.id());
this.calibrating = false; this.calibrating = false;
} }
@ -181,6 +179,22 @@ namespace sensors {
return this.getNumber(NumberFormat.UInt8LE, 0) return this.getNumber(NumberFormat.UInt8LE, 0)
} }
/**
* Checks the color is being detected
* @param color the color to detect
*/
//% help=sensors/color-sensor/is-color-detected
//% block="is **color sensor** %this|detected|%color=colorEnumPicker"
//% blockId=colorisColorDetectedDetected
//% parts="colorsensor"
//% blockNamespace=sensors
//% this.fieldEditor="ports"
//% weight=99 blockGap=8
//% group="Color Sensor"
isColorDetected(color: number) {
return this.color() == color;
}
/** /**
* Get the current raw rgb values as an array from the color sensor. * Get the current raw rgb values as an array from the color sensor.
* @param sensor the color sensor to query the request * @param sensor the color sensor to query the request

View File

@ -0,0 +1,30 @@
# Is Color Detected
Checks the color is detected
```sig
let b = sensors.color1.isColorDetected(ColorSensorColor.Blue)
```
The [color](/reference/sensors/color) you choose to look for is one of the colors that the sensor can detect. If you want to use colors for tracking, it's best to use a color that is the same or very close to the ones the sensor detects.
## Parameters
* **color**: the [color](/reference/sensors/color) to watch for.
## Example
Wait for the sensor to see ``blue``. Then, show an expression on the screen.
```blocks
brick.showString("Waiting for blue", 1)
while(!sensors.color1.isColorDetected(ColorSensorColor.Blue)) {
pause(20)
}
brick.clearScreen()
brick.showImage(images.expressionsSick)
```
## See also
[on color detected](/reference/sensors/color-sensor/on-color-detected), [color](/reference/sensors/color)

View File

@ -26,6 +26,7 @@ namespace brick {
*/ */
//% blockId=brickBatteryProperty block="battery %property" //% blockId=brickBatteryProperty block="battery %property"
//% group="Battery" //% group="Battery"
//% blockGap=8
//% help=brick/battery-property //% help=brick/battery-property
export function batteryInfo(property: BatteryProperty): number { export function batteryInfo(property: BatteryProperty): number {
const info = sensors.internal.getBatteryInfo(); const info = sensors.internal.getBatteryInfo();

View File

@ -85,7 +85,7 @@ namespace brick {
//% blockId=buttonIsPressed //% blockId=buttonIsPressed
//% parts="brick" //% parts="brick"
//% blockNamespace=brick //% blockNamespace=brick
//% weight=81 blockGap=8 //% weight=81
//% group="Buttons" //% group="Buttons"
//% button.fieldEditor="brickbuttons" //% button.fieldEditor="brickbuttons"
isPressed() { isPressed() {

11
libs/core/cooperate.ts Normal file
View File

@ -0,0 +1,11 @@
namespace control {
let lastPause = 0;
const COOPERATION_INTERVAL = 20
export function cooperate() {
const now = control.millis()
if (now - lastPause > COOPERATION_INTERVAL) {
lastPause = now
pause(1)
}
}
}

View File

@ -21,8 +21,7 @@ namespace sensors.internal {
const now = control.millis(); const now = control.millis();
if (now - this.lastQuery >= this.interval * 2) if (now - this.lastQuery >= this.interval * 2)
this.queryAndUpdate(); // sensor poller is not allowed to run this.queryAndUpdate(); // sensor poller is not allowed to run
if (now - this.lastPause >= this.interval * 5) control.cooperate(); // allow events to trigger
pause(1); // allow events to trigger
} }
private queryAndUpdate() { private queryAndUpdate() {
@ -104,7 +103,7 @@ namespace sensors.internal {
} }
} }
function init() { export function init() {
if (sensorInfos) return if (sensorInfos) return
sensorInfos = [] sensorInfos = []
for (let i = 0; i < DAL.NUM_INPUTS; ++i) sensorInfos.push(new SensorInfo(i)) for (let i = 0; i < DAL.NUM_INPUTS; ++i) sensorInfos.push(new SensorInfo(i))
@ -137,6 +136,7 @@ namespace sensors.internal {
buf[UartCtlOff.Port] = port buf[UartCtlOff.Port] = port
buf[UartCtlOff.Mode] = mode buf[UartCtlOff.Mode] = mode
uartMM.ioctl(IO.UART_READ_MODE_INFO, buf) uartMM.ioctl(IO.UART_READ_MODE_INFO, buf)
control.dmesg(`UART_READ_MODE_INFO ${buf.toHex()}`)
return buf return buf
//let info = `t:${buf[TypesOff.Type]} c:${buf[TypesOff.Connection]} m:${buf[TypesOff.Mode]} n:${buf.slice(0, 12).toHex()}` //let info = `t:${buf[TypesOff.Type]} c:${buf[TypesOff.Connection]} m:${buf[TypesOff.Mode]} n:${buf.slice(0, 12).toHex()}`
//serial.writeLine("UART " + port + " / " + mode + " - " + info) //serial.writeLine("UART " + port + " / " + mode + " - " + info)
@ -275,21 +275,23 @@ void cUiUpdatePower(void)
const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS) const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
let r = 0; let r = 0;
for (let i = 0; i < conns.length; ++i) { for (let i = 0; i < conns.length; ++i) {
r = (r << 8 | conns[i]); r = conns[i] + (r << 6) + (r << 16) - r;
} }
return r; return r;
} }
let nonActivated = 0; let nonActivated = 0;
function detectDevices() { function detectDevices() {
//control.dmesg(`detect devices (${nonActivated} na)`) control.dmesg(`detect devices (hash ${hashDevices()})`)
const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS) const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
let numChanged = 0; let numChanged = 0;
const uartSensors: SensorInfo[] = []; const uartSensors: SensorInfo[] = [];
for (const sensorInfo of sensorInfos) { for (const sensorInfo of sensorInfos) {
const newConn = conns[sensorInfo.port] const newConn = conns[sensorInfo.port]
if (newConn == sensorInfo.connType) { if (newConn == sensorInfo.connType
&& sensorInfo.sensor
&& sensorInfo.sensor.isActive()) {
// control.dmesg(`connection unchanged ${newConn} at ${sensorInfo.port}`) // control.dmesg(`connection unchanged ${newConn} at ${sensorInfo.port}`)
continue; continue;
} }
@ -425,11 +427,11 @@ void cUiUpdatePower(void)
constructor(port: number) { constructor(port: number) {
super(port) super(port)
this.mode = 0 this.mode = 0
this.realmode = 0 this.realmode = -1
} }
_activated() { _activated() {
this.realmode = 0 this.realmode = -1
this._setMode(this.mode) this._setMode(this.mode)
} }
@ -456,7 +458,7 @@ void cUiUpdatePower(void)
reset() { reset() {
if (this.isActive()) uartReset(this._port); if (this.isActive()) uartReset(this._port);
this.realmode = 0; this.realmode = -1;
} }
} }
@ -556,7 +558,7 @@ void cUiUpdatePower(void)
} }
function setUartModes() { function setUartModes() {
control.dmesg(`UART set modes`) control.dmesg(`UART set modes ${devcon.toHex()}`)
uartMM.ioctl(IO.UART_SET_CONN, devcon) uartMM.ioctl(IO.UART_SET_CONN, devcon)
const ports: number[] = []; const ports: number[] = [];
for (let port = 0; port < DAL.NUM_INPUTS; ++port) { for (let port = 0; port < DAL.NUM_INPUTS; ++port) {
@ -568,7 +570,7 @@ void cUiUpdatePower(void)
while (ports.length) { while (ports.length) {
const port = ports.pop(); const port = ports.pop();
const status = waitNonZeroUartStatus(port) const status = waitNonZeroUartStatus(port)
control.dmesg(`UART set mode ${status} at ${port}`); control.dmesg(`UART status ${status} at ${port}`);
} }
} }
@ -584,6 +586,7 @@ void cUiUpdatePower(void)
while (true) { while (true) {
if (port < 0) return if (port < 0) return
updateUartMode(port, mode); updateUartMode(port, mode);
control.dmesg(`UART_SET_CONN ${devcon.toHex()}`)
uartMM.ioctl(IO.UART_SET_CONN, devcon) uartMM.ioctl(IO.UART_SET_CONN, devcon)
let status = waitNonZeroUartStatus(port) let status = waitNonZeroUartStatus(port)
if (status & UART_PORT_CHANGED) { if (status & UART_PORT_CHANGED) {

View File

@ -55,7 +55,7 @@ namespace motors {
Size = 12 Size = 12
} }
function init() { export function init() {
if (pwmMM) return if (pwmMM) return
pwmMM = control.mmap("/dev/lms_pwm", 0, 0) pwmMM = control.mmap("/dev/lms_pwm", 0, 0)
if (!pwmMM) control.fail("no PWM file") if (!pwmMM) control.fail("no PWM file")
@ -124,7 +124,7 @@ namespace motors {
export function stopAll() { export function stopAll() {
const b = mkCmd(Output.ALL, DAL.opOutputStop, 0) const b = mkCmd(Output.ALL, DAL.opOutputStop, 0)
writePWM(b); writePWM(b);
pause(1); control.cooperate();
} }
/** /**
@ -136,7 +136,7 @@ namespace motors {
//% help=motors/reset-all //% help=motors/reset-all
export function resetAll() { export function resetAll() {
reset(Output.ALL) reset(Output.ALL)
pause(1); control.cooperate();
} }
interface MoveSchedule { interface MoveSchedule {
@ -159,6 +159,7 @@ namespace motors {
private _accelerationTime: number; private _accelerationTime: number;
private _decelerationSteps: number; private _decelerationSteps: number;
private _decelerationTime: number; private _decelerationTime: number;
private _inverted: boolean;
protected static output_types: number[] = [0x7, 0x7, 0x7, 0x7]; protected static output_types: number[] = [0x7, 0x7, 0x7, 0x7];
@ -176,6 +177,7 @@ namespace motors {
this._accelerationTime = 0; this._accelerationTime = 0;
this._decelerationSteps = 0; this._decelerationSteps = 0;
this._decelerationTime = 0; this._decelerationTime = 0;
this._inverted = false;
} }
/** /**
@ -225,9 +227,11 @@ namespace motors {
//% help=motors/motor/set-inverted //% help=motors/motor/set-inverted
setInverted(inverted: boolean) { setInverted(inverted: boolean) {
this.init(); this.init();
const b = mkCmd(this._port, DAL.opOutputPolarity, 1) this._inverted = inverted;
b.setNumber(NumberFormat.Int8LE, 2, inverted ? 0 : 1); }
writePWM(b)
protected invertedFactor(): number {
return this._inverted ? -1 : 1;
} }
/** /**
@ -265,7 +269,7 @@ namespace motors {
if (this._brake && this._brakeSettleTime > 0) if (this._brake && this._brakeSettleTime > 0)
pause(this._brakeSettleTime); pause(this._brakeSettleTime);
else { else {
pause(1); control.cooperate();
} }
} }
@ -276,7 +280,7 @@ namespace motors {
// allow robot to settle // allow robot to settle
this.settle(); this.settle();
} else { } else {
pause(1); control.cooperate();
} }
} }
@ -294,8 +298,9 @@ namespace motors {
} }
private normalizeSchedule(speed: number, step1: number, step2: number, step3: number, unit: MoveUnit): MoveSchedule { private normalizeSchedule(speed: number, step1: number, step2: number, step3: number, unit: MoveUnit): MoveSchedule {
// motor polarity is not supported at the firmware level for sync motor operations
const r: MoveSchedule = { const r: MoveSchedule = {
speed: Math.clamp(-100, 100, speed >> 0), speed: Math.clamp(-100, 100, speed | 0) * this.invertedFactor(),
useSteps: true, useSteps: true,
steps: [step1 || 0, step2 || 0, step3 || 0] steps: [step1 || 0, step2 || 0, step3 || 0]
} }
@ -352,7 +357,7 @@ namespace motors {
// special: 0 is infinity // special: 0 is infinity
if (schedule.steps[0] + schedule.steps[1] + schedule.steps[2] == 0) { if (schedule.steps[0] + schedule.steps[1] + schedule.steps[2] == 0) {
this._run(schedule.speed); this._run(schedule.speed);
pause(1); control.cooperate();
return; return;
} }
@ -562,6 +567,7 @@ namespace motors {
private __init() { private __init() {
this.setOutputType(this._large); this.setOutputType(this._large);
this.setInverted(false);
} }
/** /**
@ -741,7 +747,7 @@ namespace motors {
//% help=motors/synced/steer //% help=motors/synced/steer
steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) { steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
this.init(); this.init();
speed = Math.clamp(-100, 100, speed >> 0); speed = Math.clamp(-100, 100, speed >> 0) * this.invertedFactor();
if (!speed) { if (!speed) {
this.stop(); this.stop();
return; return;

View File

@ -26,7 +26,8 @@
"icons.jres", "icons.jres",
"ns.ts", "ns.ts",
"platform.h", "platform.h",
"integrator.ts" "integrator.ts",
"cooperate.ts"
], ],
"testFiles": [ "testFiles": [
"test.ts" "test.ts"

13
libs/ev3/brick.ts Normal file
View File

@ -0,0 +1,13 @@
namespace brick {
/**
* Exits the program to the main menu. (in the simulator restarts it)
*/
//% blockId=loopstop block="exit program"
//% help=reference/brick/exit-program
//% weight=10
//% blockGap=8
//% group="Buttons"
export function exitProgram() {
control.reset();
}
}

View File

@ -1,6 +1,6 @@
//% color="#68C3E2" weight=100 icon="\uf106" //% color="#68C3E2" weight=100 icon="\uf106"
//% groups='["Buttons", "Screen", "Battery"]' //% groups='["Buttons", "Screen", "Power"]'
//% labelLineWidth=60 //% labelLineWidth=60
namespace brick { namespace brick {
} }

View File

@ -2,8 +2,9 @@
"name": "ev3", "name": "ev3",
"description": "The EV3 library", "description": "The EV3 library",
"files": [ "files": [
"README.md", "README.md",
"ns.ts", "ns.ts",
"brick.ts",
"startup.ts", "startup.ts",
"images.jres", "images.jres",
"images.ts", "images.ts",

View File

@ -2,9 +2,5 @@
console.addListener(function(msg: string) { console.addListener(function(msg: string) {
control.dmesg(msg.substr(0, msg.length - 1)) control.dmesg(msg.substr(0, msg.length - 1))
}) })
// pulse green, play startup sound, turn off light
brick.setStatusLight(StatusLight.GreenPulse); brick.showBoot();
// We pause for 100ms to give time to read sensor values, so they work in on_start block
pause(400)
// and we're ready
brick.setStatusLight(StatusLight.Off);

View File

@ -12,4 +12,5 @@ music.setTempo(120)
music.noteFrequency(Note.C) music.noteFrequency(Note.C)
music.beat() music.beat()
music.setVolume(50) music.setVolume(50)
``` music.volume()
```

View File

@ -13,7 +13,22 @@
namespace music { namespace music {
uint8_t currVolume = 50; int _readSystemVolume() {
char ParBuf[8];
int volume;
int fd = open("../sys/settings/Volume.rtf", O_RDONLY);
read(fd, ParBuf, sizeof(ParBuf));
close(fd);
if (sscanf(ParBuf,"%d",&volume) > 0) {
if ((volume >= 0) && (volume <= 100)) {
return volume;
}
}
return 50;
}
uint8_t currVolume = _readSystemVolume();
uint8_t *lmsSoundMMap; uint8_t *lmsSoundMMap;
int writeDev(void *data, int size) { int writeDev(void *data, int size) {
@ -37,6 +52,18 @@ void setVolume(int volume) {
currVolume = max(0, min(100, volume)); currVolume = max(0, min(100, volume));
} }
/**
* Return the output volume of the sound synthesizer.
*/
//% weight=96
//% blockId=synth_get_volume block="volume"
//% parts="speaker" blockGap=8
//% help=music/volume
//% weight=1
int volume() {
return currVolume;
}
#define SOUND_CMD_BREAK 0 #define SOUND_CMD_BREAK 0
#define SOUND_CMD_TONE 1 #define SOUND_CMD_TONE 1
#define SOUND_CMD_PLAY 2 #define SOUND_CMD_PLAY 2
@ -45,7 +72,7 @@ void setVolume(int volume) {
struct ToneCmd { struct ToneCmd {
uint8_t cmd; uint8_t cmd;
uint8_t vol; uint8_t lvl;
uint16_t freq; uint16_t freq;
uint16_t duration; uint16_t duration;
}; };
@ -55,10 +82,26 @@ static void _stopSound() {
writeDev(&cmd, sizeof(cmd)); writeDev(&cmd, sizeof(cmd));
} }
static uint8_t _getVolumeLevel(uint8_t volume, uint8_t levels) {
uint8_t level;
uint8_t step = (uint8_t) (100 / (levels - 1));
if (volume < step) {
level = 0;
} else if (volume > step * (levels - 1)) {
level = levels;
} else {
level = (uint8_t) (volume / step);
}
return level;
}
static void _playTone(uint16_t frequency, uint16_t duration, uint8_t volume) { static void _playTone(uint16_t frequency, uint16_t duration, uint8_t volume) {
// https://github.com/mindboards/ev3sources/blob/78ebaf5b6f8fe31cc17aa5dce0f8e4916a4fc072/lms2012/c_sound/source/c_sound.c#L471
uint8_t level = _getVolumeLevel(volume, 13);
ToneCmd cmd; ToneCmd cmd;
cmd.cmd = SOUND_CMD_TONE; cmd.cmd = SOUND_CMD_TONE;
cmd.vol = volume; cmd.lvl = level;
cmd.freq = frequency; cmd.freq = frequency;
cmd.duration = duration; cmd.duration = duration;
// (*SoundInstance.pSound).Busy = TRUE; // (*SoundInstance.pSound).Busy = TRUE;
@ -122,7 +165,8 @@ void playSample(Buffer buf) {
stopUser(); stopUser();
pthread_mutex_lock(&pumpMutex); pthread_mutex_lock(&pumpMutex);
*lmsSoundMMap = 1; // BUSY *lmsSoundMMap = 1; // BUSY
uint8_t cmd[] = {SOUND_CMD_PLAY, (uint8_t)((currVolume / 33) + 1)}; // https://github.com/mindboards/ev3sources/blob/78ebaf5b6f8fe31cc17aa5dce0f8e4916a4fc072/lms2012/c_sound/source/c_sound.c#L605
uint8_t cmd[] = {SOUND_CMD_PLAY, _getVolumeLevel(currVolume, 8)};
writeDev(cmd, 2); writeDev(cmd, 2);
decrRC(currentSample); decrRC(currentSample);
currentSample = buf; currentSample = buf;
@ -201,4 +245,4 @@ Buffer buffer(Sound snd) {
void play(Sound snd) { void play(Sound snd) {
music::playSample(snd); music::playSample(snd);
} }
} }

10
libs/music/shims.d.ts vendored
View File

@ -13,6 +13,16 @@ declare namespace music {
//% weight=1 shim=music::setVolume //% weight=1 shim=music::setVolume
function setVolume(volume: int32): void; function setVolume(volume: int32): void;
/**
* Return the output volume of the sound synthesizer.
*/
//% weight=96
//% blockId=synth_get_volume block="volume"
//% parts="speaker" blockGap=8
//% help=music/volume
//% weight=1 shim=music::volume
function volume(): int32;
/** /**
* Play a tone through the speaker for some amount of time. * Play a tone through the speaker for some amount of time.
* @param frequency pitch of the tone to play in Hertz (Hz), eg: Note.C * @param frequency pitch of the tone to play in Hertz (Hz), eg: Note.C

View File

@ -5,3 +5,4 @@ music.playTone(1440, 500)
pause(500) pause(500)
music.playTone(2440, 500) music.playTone(2440, 500)
pause(500) pause(500)
music.volume()

View File

@ -129,8 +129,8 @@ namespace brick {
screenMode = ScreenMode.Ports; screenMode = ScreenMode.Ports;
renderPorts(); renderPorts();
control.runInParallel(function() { control.runInParallel(function () {
while(screenMode == ScreenMode.Ports) { while (screenMode == ScreenMode.Ports) {
renderPorts(); renderPorts();
pause(50); pause(50);
} }
@ -140,8 +140,20 @@ namespace brick {
function renderPorts() { function renderPorts() {
const col = 44; const col = 44;
const lineHeight8 = image.font8.charHeight + 2; const lineHeight8 = image.font8.charHeight + 2;
const h = screen.height;
const w = screen.width;
const blink = (control.millis() >> 5) % (h - 1);
clearScreen(); clearScreen();
for (let i = 0; i < 4; ++i) {
const x = i * col + 2;
screen.print("ABCD"[i], x, 1 * lineHeight8, 1, image.font8)
screen.print((i + 1).toString(), x, h - lineHeight8, 1, image.font8)
}
screen.drawLine(0, 5 * lineHeight8, screen.width, 5 * lineHeight8, 1);
screen.drawLine(0, h - 5 * lineHeight8, screen.width, h - 5 * lineHeight8, 1)
function scale(x: number) { function scale(x: number) {
if (Math.abs(x) >= 5000) { if (Math.abs(x) >= 5000) {
const k = Math.floor(x / 1000); const k = Math.floor(x / 1000);
@ -155,25 +167,38 @@ namespace brick {
const datas = motors.getAllMotorData(); const datas = motors.getAllMotorData();
for (let i = 0; i < datas.length; ++i) { for (let i = 0; i < datas.length; ++i) {
const data = datas[i]; const data = datas[i];
const x = i * col + 2;
if (!data.actualSpeed && !data.count) continue; if (!data.actualSpeed && !data.count) continue;
const x = i * col; screen.print(`${scale(data.actualSpeed)}%`, x, 3 * lineHeight8, 1, image.font8)
screen.print("ABCD"[i], x + 2, 1 * lineHeight8, 1, image.font8) screen.print(`${scale(data.count)}>`, x, 4 * lineHeight8, 1, image.font8)
screen.print(`${scale(data.actualSpeed)}%`, x + 2, 3 * lineHeight8, 1, image.font8)
screen.print(`${scale(data.count)}>`, x + 2, 4 * lineHeight8, 1, image.font8)
} }
screen.drawLine(0, 5 * lineHeight8, screen.width, 5 * lineHeight8, 1);
// sensors // sensors
const sis = sensors.internal.getActiveSensors(); const sis = sensors.internal.getActiveSensors();
const h = screen.height;
screen.drawLine(0, h - 5 * lineHeight8, screen.width, h - 5 * lineHeight8, 1)
for (let i = 0; i < sis.length; ++i) { for (let i = 0; i < sis.length; ++i) {
const si = sis[i]; const si = sis[i];
const x = (si.port() - 1) * col; const x = (si.port() - 1) * col + 2;
const inf = si._info(); const inf = si._info();
screen.print(si.port() + "", x, h - 4 * lineHeight8, 1, image.font8) if (inf)
screen.print(inf, x, h - 2 * lineHeight8, 1, inf.length > 4 ? image.font5 : image.font8); screen.print(inf, x, h - 2 * lineHeight8, 1, inf.length > 4 ? image.font5 : image.font8);
} }
// alive dot
screen.setPixel(w - 1, blink, 1);
screen.setPixel(w - 1, blink - 1, 1);
screen.setPixel(w - 2, blink - 1, 1);
screen.setPixel(w - 2, blink, 1);
}
export function showBoot() {
// pulse green, play startup sound, turn off light
brick.setStatusLight(StatusLight.GreenPulse);
// We pause for 100ms to give time to read sensor values, so they work in on_start block
sensors.internal.init();
motors.init();
pause(800);
// and we're ready
brick.setStatusLight(StatusLight.Off);
} }
/** /**

5105
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "pxt-ev3", "name": "pxt-ev3",
"version": "1.2.22", "version": "1.2.31",
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode", "description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
"private": false, "private": false,
"keywords": [ "keywords": [

View File

@ -108,7 +108,8 @@
"de", "de",
"ja", "ja",
"ru", "ru",
"zh-CN" "zh-CN",
"fr"
], ],
"highContrast": true, "highContrast": true,
"lightToc": true, "lightToc": true,

View File

@ -9,7 +9,6 @@ namespace pxsim {
private angle: number = 0; private angle: number = 0;
private tacho: number = 0; private tacho: number = 0;
private speed: number = 0; private speed: number = 0;
private polarity: number = 1; // -1, 1 or -1
private started: boolean; private started: boolean;
private speedCmd: DAL; private speedCmd: DAL;
@ -31,7 +30,7 @@ namespace pxsim {
} }
getSpeed() { getSpeed() {
return Math.round(this.speed * (!this._synchedMotor && this.polarity == 0 ? -1 : 1)); return Math.round(this.speed);
} }
getAngle() { getAngle() {
@ -82,16 +81,6 @@ namespace pxsim {
return this.id == NodeType.LargeMotor; return this.id == NodeType.LargeMotor;
} }
setPolarity(polarity: number) {
// Either 1 or 255 (reverse)
/*
-1 : Motor will run backward
0 : Motor will run opposite direction
1 : Motor will run forward
*/
this.polarity = polarity;
}
reset() { reset() {
// not sure what reset does... // not sure what reset does...
} }

View File

@ -119,11 +119,7 @@ namespace pxsim {
return 2; return 2;
} }
case DAL.opOutputPolarity: { case DAL.opOutputPolarity: {
// reverse console.error("opOutputPolarity not supported");
const port = buf.data[1];
const polarity = pxsim.BufferMethods.getNumber(buf, BufferMethods.NumberFormat.Int8LE, 2);
const motors = ev3board().getMotor(port);
motors.forEach(motor => motor.setPolarity(polarity));
return 2; return 2;
} }
case DAL.opOutputSetType: { case DAL.opOutputSetType: {

View File

@ -7,6 +7,14 @@ namespace pxsim.music {
export function stopAllSounds() { export function stopAllSounds() {
SoundMethods.stop() SoundMethods.stop()
} }
pxsim.music.setVolume = (volume: number): void => {
pxsim.getAudioState().volume = volume;
};
export function volume() {
return pxsim.getAudioState().volume;
}
} }
namespace pxsim.SoundMethods { namespace pxsim.SoundMethods {

View File

@ -27,6 +27,6 @@
"Videos": "videos" "Videos": "videos"
}, },
"electronManifest": { "electronManifest": {
"latest": "v1.1.22" "latest": "v1.2.22"
} }
} }