Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Renamed MagnetXSensor() to MagnetSensor. Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
KierPalin committed Sep 10, 2024
1 parent dcf3241 commit b029dcd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
5 changes: 1 addition & 4 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace microcode {
version?: string
}


/**
* If an Arcade Shield is not present when starting MicroData that Microbit will enter DistributedLoggingProtocol.
* It will show a :) on its LEDs and try to become a Target - where it will receive radio commands from a Commander Microbit (one with an Arcade Shield)
Expand All @@ -21,11 +20,9 @@ namespace microcode {
reportEvent("app.start")

this.sceneManager = new SceneManager()

datalogger.includeTimestamp(FlashLogTimeStampFormat.None)

const arcadeShieldConnected = screenhelpers.displayPresent();
if (arcadeShieldConnected)
if (screenhelpers.displayPresent())
this.pushScene(new Home(this))
else
new DistributedLoggingProtocol(this, false);
Expand Down
8 changes: 2 additions & 6 deletions sensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ namespace microcode {
this.normalisedDataBuffer = []
}



//------------------
// Factory Function:
//------------------
Expand All @@ -412,7 +410,7 @@ namespace microcode {
else if (name == "A. Pin 2" || name == "Analog Pin 2" || name == "AP2") return new AnalogPinP2Sensor();
else if (name == "Light" || name == "L") return new LightSensor();
else if (name == "Temp." || name == "Temperature" || name == "T") return new TemperatureSensor();
else if (name == "Magnet" || name == "M") return new MagnetXSensor();
else if (name == "Magnet" || name == "M") return new MagnetSensor();
else if (name == "Logo Pressed" || name == "Logo Press" || name == "LP") return new LogoPressSensor();
else if (name == "Volume" || name == "Microphone" || name == "V") return new VolumeSensor();
else if (name == "Compass" || name == "C") return new CompassHeadingSensor();
Expand Down Expand Up @@ -813,18 +811,16 @@ namespace microcode {
/**
* Micro-tesla reading of the magnet sensor on Dimension.Strength
*/
export class MagnetXSensor extends Sensor {
export class MagnetSensor extends Sensor {
constructor() {super()}

public static getName(): string {return "Magnet"}
public static getRadioName(): string {return "M"}
public static getReading(): number {return input.magneticForce(Dimension.Strength)}
}


/**
* Onboard Pitch or Roll sensor
*
*/
export class PitchSensor extends Sensor {
constructor() {super()}
Expand Down

0 comments on commit b029dcd

Please sign in to comment.