forked from KierPalin/MicroData
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from microbit-apps/hardware-tested
Re-enabled noArcadeShieldMode, reworked sensors to reduce memory, optimisations + documentation.
- Loading branch information
Showing
16 changed files
with
275 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ crowdinstats.csv | |
.vscode/.BROWSE.VC.DB-wal | ||
package-lock.json | ||
.DS_Store | ||
build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,91 @@ | ||
namespace microdata { | ||
/** | ||
/** | ||
* See modules.lightLevel1.lightLevel sensor from pxt-jacdac/jacdac-light-level. | ||
* Overrides .isJacdac() | ||
*/ | ||
export class JacdacLightSensor extends Sensor { | ||
constructor() {super(); modules.lightLevel1.start()} | ||
|
||
public static getName(): string {return "Jac Light"} | ||
public static getRadioName(): string {return "JL"} | ||
public static getReading(): number {return modules.lightLevel1.isConnected() ? modules.lightLevel1.lightLevel() : undefined} | ||
public static isJacdac(): boolean {return true;} | ||
constructor() { | ||
super({ | ||
name: "Jac Light", | ||
rName: "JL", | ||
f: () => modules.lightLevel1.isConnected() ? modules.lightLevel1.lightLevel() : undefined, | ||
min: 0, | ||
max: 100, | ||
isJacdacSensor: true | ||
}); | ||
modules.lightLevel1.start(); | ||
} | ||
} | ||
|
||
/** | ||
* See modules.distance1.distance sensor from pxt-jacdac/jacdac-distance. | ||
* Overrides .isJacdac() | ||
*/ | ||
export class JacdacDistanceSensor extends Sensor { | ||
constructor() {super(); modules.distance1.start()} | ||
|
||
public static getName(): string {return "Jac Dist"} | ||
public static getRadioName(): string {return "JD"} | ||
public static getReading(): number {return modules.distance1.isConnected() ? modules.distance1.distance() : undefined} | ||
public static isJacdac(): boolean {return true;} | ||
constructor() { | ||
super({ | ||
name: "Jac Dist", | ||
rName: "JD", | ||
f: () => modules.distance1.isConnected() ? modules.distance1.distance() : undefined, | ||
min: 0, | ||
max: 100, | ||
isJacdacSensor: true | ||
}); | ||
modules.distance1.start(); | ||
} | ||
} | ||
|
||
/** | ||
* See modules.soilMoisture1.moisture sensor from pxt-jacdac/jacdac-soil-moisture. | ||
* Overrides .isJacdac() | ||
*/ | ||
export class JacdacSoilMoistureSensor extends Sensor { | ||
constructor() {super(); modules.soilMoisture1.start() | ||
constructor() { | ||
super({ | ||
name: "Jac Moist", | ||
rName: "JM", | ||
f: () => modules.soilMoisture1.isConnected() ? modules.soilMoisture1.moisture() : undefined, | ||
min: 0, | ||
max: 100, | ||
isJacdacSensor: true | ||
}); | ||
modules.soilMoisture1.start(); | ||
} | ||
|
||
public static getName(): string {return "Jac Moist"} | ||
public static getRadioName(): string {return "JM"} | ||
public static getReading(): number {return modules.soilMoisture1.isConnected() ? modules.soilMoisture1.moisture() : undefined} | ||
public static isJacdac(): boolean {return true;} | ||
} | ||
|
||
/** | ||
* See modules.flex1.bending sensor from pxt-jacdac/flex. | ||
* Overrides .isJacdac() | ||
*/ | ||
export class JacdacFlexSensor extends Sensor { | ||
constructor() {super(); modules.flex1.start()} | ||
|
||
public static getName(): string {return "Jac Flex"} | ||
public static getRadioName(): string {return "JF"} | ||
public static getReading(): number {return modules.flex1.isConnected() ? modules.flex1.bending() : undefined} | ||
public static isJacdac(): boolean {return true;} | ||
constructor() { | ||
super({ | ||
name: "Jac Flex", | ||
rName: "JF", | ||
f: () => modules.flex1.isConnected() ? modules.flex1.bending() : undefined, | ||
min: 0, | ||
max: 100, // Assuming bending level ranges from 0 to 100 (adjust as needed) | ||
isJacdacSensor: true | ||
}); | ||
modules.flex1.start(); | ||
} | ||
} | ||
|
||
/** | ||
* See modules.temperature1.temperature sensor from pxt-jacdac/temperature. | ||
* Overrides .isJacdac() | ||
*/ | ||
export class JacdacTemperatureSensor extends Sensor { | ||
constructor() {super(); modules.temperature1.start()} | ||
|
||
public static getName(): string {return "Jac Temp"} | ||
public static getRadioName(): string {return "JT"} | ||
public static getReading(): number {return modules.temperature1.isConnected() ? modules.temperature1.temperature() : undefined} | ||
public static isJacdac(): boolean {return true;} | ||
constructor() { | ||
super({ | ||
name: "Jac Temp", | ||
rName: "JT", | ||
f: () => modules.temperature1.isConnected() ? modules.temperature1.temperature() : undefined, | ||
min: 0, | ||
max: 100, | ||
isJacdacSensor: true | ||
}); | ||
modules.temperature1.start(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.