Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
312729142f | |||
5bd4aed0e1 | |||
cfaa4ae3ef | |||
faa839d59f | |||
630687bfce | |||
2b300a4094 | |||
5fb8c0de6e | |||
1f65cd59a8 |
9
.travis.yml
Normal file
9
.travis.yml
Normal 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
|
@ -190,12 +190,10 @@ if (true) {
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
forever(function () {
|
forever(function () {
|
||||||
while (true) {
|
while (sensors.color3.color() == ColorSensorColor.Black) {
|
||||||
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Black)
|
|
||||||
motors.largeBC.steer(-30, 50)
|
motors.largeBC.steer(-30, 50)
|
||||||
}
|
}
|
||||||
while (true) {
|
while (sensors.color3.color() == ColorSensorColor.White) {
|
||||||
sensors.color3.pauseUntilColorDetected(ColorSensorColor.White)
|
|
||||||
motors.largeBC.steer(30, 50)
|
motors.largeBC.steer(30, 50)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -209,11 +207,9 @@ Else the Color Sensor detects the color white, start motors ``B`` and ``C`` (dri
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
forever(function () {
|
forever(function () {
|
||||||
if (true) {
|
if (sensors.color3.color() == ColorSensorColor.Black) {
|
||||||
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Black)
|
|
||||||
motors.largeBC.steer(-30, 50)
|
motors.largeBC.steer(-30, 50)
|
||||||
} else {
|
} else {
|
||||||
sensors.color3.pauseUntilColorDetected(ColorSensorColor.White)
|
|
||||||
motors.largeBC.steer(30, 50)
|
motors.largeBC.steer(30, 50)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
import jobs.generation.Utilities;
|
|
||||||
import jobs.generation.InternalUtilities;
|
|
||||||
|
|
||||||
def project = GithubProject
|
|
||||||
def projectName = "pxt-ev3"
|
|
||||||
|
|
||||||
[true, false].each { isPR ->
|
|
||||||
def newJobName = projectName
|
|
||||||
|
|
||||||
if (isPR) {
|
|
||||||
newJobName += "_PR"
|
|
||||||
} else {
|
|
||||||
newJobName += "_Push"
|
|
||||||
}
|
|
||||||
|
|
||||||
def newJob = job(newJobName) {
|
|
||||||
steps {
|
|
||||||
shell("chmod +x ./jenkins.sh")
|
|
||||||
shell("./jenkins.sh ${isPR}")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isPR) {
|
|
||||||
wrappers {
|
|
||||||
credentialsBinding {
|
|
||||||
string("PXT_ACCESS_TOKEN", "pxt_access_token")
|
|
||||||
string("PXT_RELEASE_REPO", "pxt_release_repo_ev3")
|
|
||||||
string("CROWDIN_KEY", "pxt_crowdin_key")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Utilities.setMachineAffinity(newJob, "Ubuntu", "20161020")
|
|
||||||
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
|
|
||||||
|
|
||||||
if (isPR) {
|
|
||||||
Utilities.addGithubPRTrigger(newJob, "Default Testing")
|
|
||||||
} else {
|
|
||||||
Utilities.addGithubPushTrigger(newJob)
|
|
||||||
}
|
|
||||||
}
|
|
56
jenkins.sh
56
jenkins.sh
@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Set up NVM
|
|
||||||
export NVM_DIR="/home/dotnet-bot/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
||||||
|
|
||||||
nvm install 8
|
|
||||||
|
|
||||||
# Set up build environment variables
|
|
||||||
echo ---------- Setting build environment variables
|
|
||||||
echo Git branch: $GIT_BRANCH
|
|
||||||
echo isPR: $1
|
|
||||||
|
|
||||||
originRegex="^origin/.*"
|
|
||||||
branchRegex="^origin/\K.*(?=$)"
|
|
||||||
releaseBranchRegex="^(master|v\d+)$"
|
|
||||||
|
|
||||||
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
|
||||||
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
|
||||||
echo Setting TRAVIS_BRANCH to ${branchName}
|
|
||||||
export TRAVIS_BRANCH=${branchName}
|
|
||||||
else
|
|
||||||
echo Setting TRAVIS_BRANCH to $GIT_BRANCH
|
|
||||||
export TRAVIS_BRANCH=$GIT_BRANCH
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" == "false" ]; then
|
|
||||||
echo Setting TRAVIS_PULL_REQUEST to false
|
|
||||||
export TRAVIS_PULL_REQUEST=false
|
|
||||||
|
|
||||||
if [[ "$TRAVIS_BRANCH" =~ $releaseBranchRegex ]]; then
|
|
||||||
if [[ -z $PXT_RELEASE_REPO ]]; then
|
|
||||||
echo Cannot find release repo\; skipping tag checks
|
|
||||||
else
|
|
||||||
gitTag=$(git describe --tags --exact-match 2> /dev/null)
|
|
||||||
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
|
|
||||||
|
|
||||||
echo Current tag: $gitTag
|
|
||||||
echo Built tag: $builtTag
|
|
||||||
|
|
||||||
if [[ ! -z $gitTag && -z $builtTag ]]; then
|
|
||||||
echo Built tag not found\; building tag
|
|
||||||
echo Setting TRAVIS_BRANCH to $gitTag
|
|
||||||
export TRAVIS_BRANCH=$gitTag
|
|
||||||
echo Setting TRAVIS_TAG to $gitTag
|
|
||||||
export TRAVIS_TAG=$gitTag
|
|
||||||
else
|
|
||||||
echo Not a tag build
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Perform build
|
|
||||||
npm install
|
|
||||||
npm test
|
|
@ -1,5 +1,5 @@
|
|||||||
const enum ColorSensorMode {
|
const enum ColorSensorMode {
|
||||||
None = -1,
|
None = 0,
|
||||||
//% block="reflected light intensity"
|
//% block="reflected light intensity"
|
||||||
ReflectedLightIntensity = 0,
|
ReflectedLightIntensity = 0,
|
||||||
//% block="ambient light intensity"
|
//% block="ambient light intensity"
|
||||||
|
@ -212,7 +212,6 @@ namespace sensors.internal {
|
|||||||
|
|
||||||
_activated() {
|
_activated() {
|
||||||
this.realmode = 0
|
this.realmode = 0
|
||||||
// uartReset(this.port) // TODO is it ever needed?
|
|
||||||
this._setMode(this.mode)
|
this._setMode(this.mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@ namespace motors {
|
|||||||
protected _brake: boolean;
|
protected _brake: boolean;
|
||||||
private _pauseOnRun: boolean;
|
private _pauseOnRun: boolean;
|
||||||
private _initialized: boolean;
|
private _initialized: boolean;
|
||||||
|
private _brakeSettleTime: number;
|
||||||
private _init: () => void;
|
private _init: () => void;
|
||||||
private _run: (speed: number) => void;
|
private _run: (speed: number) => void;
|
||||||
private _move: (steps: boolean, stepsOrTime: number, speed: number) => void;
|
private _move: (steps: boolean, stepsOrTime: number, speed: number) => void;
|
||||||
@ -147,6 +148,7 @@ namespace motors {
|
|||||||
this._brake = false;
|
this._brake = false;
|
||||||
this._pauseOnRun = true;
|
this._pauseOnRun = true;
|
||||||
this._initialized = false;
|
this._initialized = false;
|
||||||
|
this._brakeSettleTime = 10;
|
||||||
this._init = init;
|
this._init = init;
|
||||||
this._run = run;
|
this._run = run;
|
||||||
this._move = move;
|
this._move = move;
|
||||||
@ -204,6 +206,20 @@ namespace motors {
|
|||||||
writePWM(b)
|
writePWM(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the settle time after braking in milliseconds (default is 10ms).
|
||||||
|
*/
|
||||||
|
//% blockId=motorSetBrakeSettleTime block="set %motor|brake settle time %millis|ms"
|
||||||
|
//% motor.fieldEditor="motors"
|
||||||
|
//% weight=1 blockGap=8
|
||||||
|
//% group="Properties"
|
||||||
|
//% millis.defl=200 millis.min=0 millis.max=500
|
||||||
|
setBrakeSettleTime(millis: number) {
|
||||||
|
this.init();
|
||||||
|
// ensure in [0,500]
|
||||||
|
this._brakeSettleTime = Math.max(0, Math.min(500, millis | 0))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the motor(s).
|
* Stops the motor(s).
|
||||||
*/
|
*/
|
||||||
@ -221,8 +237,8 @@ namespace motors {
|
|||||||
protected settle() {
|
protected settle() {
|
||||||
// if we've recently completed a motor command with brake
|
// if we've recently completed a motor command with brake
|
||||||
// allow 500ms for robot to settle
|
// allow 500ms for robot to settle
|
||||||
if (this._brake)
|
if (this._brake && this._brakeSettleTime > 0)
|
||||||
pause(500);
|
pause(this._brakeSettleTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected pauseOnRun(stepsOrTime: number) {
|
protected pauseOnRun(stepsOrTime: number) {
|
||||||
@ -396,7 +412,7 @@ namespace motors {
|
|||||||
*/
|
*/
|
||||||
//% blockId=outputMotorSetRegulated block="set %motor|regulated %value=toggleOnOff"
|
//% blockId=outputMotorSetRegulated block="set %motor|regulated %value=toggleOnOff"
|
||||||
//% motor.fieldEditor="motors"
|
//% motor.fieldEditor="motors"
|
||||||
//% weight=58
|
//% weight=58 blockGap=8
|
||||||
//% group="Properties"
|
//% group="Properties"
|
||||||
//% help=motors/motor/set-regulated
|
//% help=motors/motor/set-regulated
|
||||||
setRegulated(value: boolean) {
|
setRegulated(value: boolean) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const enum GyroSensorMode {
|
const enum GyroSensorMode {
|
||||||
None = -1,
|
None = 0,
|
||||||
Angle = 0,
|
Angle = 0,
|
||||||
Rate = 1,
|
Rate = 1,
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const enum InfraredSensorMode {
|
const enum InfraredSensorMode {
|
||||||
None = -1,
|
None = 0,
|
||||||
Proximity = 0,
|
Proximity = 0,
|
||||||
Seek = 1,
|
Seek = 1,
|
||||||
RemoteControl = 2,
|
RemoteControl = 2,
|
||||||
|
4670
package-lock.json
generated
4670
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-ev3",
|
"name": "pxt-ev3",
|
||||||
"version": "1.0.11",
|
"version": "1.1.2",
|
||||||
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
|
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
|
||||||
"private": true,
|
"private": true,
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
Reference in New Issue
Block a user