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

Commit

Permalink
Major Change & WiP: Needed to temporarily disable all references to t…
Browse files Browse the repository at this point in the history
…he distributedLoggingProtocol, on account of lack of memory & neccessary testing for merge with microbit-apps. The disabled lines are commented out & marked with a comment. This commit will likely become a new release for a version that does not include any 'unplugged' nor 'distributed logging' functionality.
  • Loading branch information
KierPalin committed Nov 13, 2024
1 parent b93a2e5 commit 901dcd0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
7 changes: 5 additions & 2 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ namespace microcode {
const arcadeShieldConnected = shieldhelpers.shieldPresent();
if (arcadeShieldConnected)
this.pushScene(new microcode.Home(this))
else
new DistributedLoggingProtocol(this, false);

// Temp disabled elements relating to callbackObj (no mem)
// else
// new DistributedLoggingProtocol(this, false);
// new NoArcadeShieldMode(this);
}

public pushScene(scene: Scene) {
Expand Down
2 changes: 1 addition & 1 deletion home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace microcode {
y,
onClick: () => {
this.app.popScene()
this.app.pushScene(new DistributedLoggingScreen(this.app))
// this.app.pushScene(new DistributedLoggingScreen(this.app)) // Temp disabled elements relating to callbackObj (no mem)
},
})

Expand Down
2 changes: 1 addition & 1 deletion loggingConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace microcode {
this.app.popScene()

if (this.nextSceneEnum == CursorSceneEnum.DistributedLogging) {
this.app.pushScene(new DistributedLoggingScreen(this.app, this.sensors, this.sensorConfigs));
// this.app.pushScene(new DistributedLoggingScreen(this.app, this.sensors, this.sensorConfigs)); // Temp disabled with Distributedlogging (no mem)
}
else {
// All sensors are configured, pass them their config and move to the DataRecording screen:
Expand Down
4 changes: 2 additions & 2 deletions noArcadeShieldMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ namespace microcode {
case UI_SENSOR_SELECT_STATE.MAGNET:
return [new MagnetSensor()]

case UI_SENSOR_SELECT_STATE.RADIO:
new DistributedLoggingProtocol(this.app, false);
// case UI_SENSOR_SELECT_STATE.RADIO:
// new DistributedLoggingProtocol(this.app, false);
return []

default:
Expand Down
3 changes: 1 addition & 2 deletions pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"sensorSelect.ts",
"dataRecorder.ts",
"tabularDataViewer.ts",
"generateGraph.ts",
"distributedLogging.ts"
"generateGraph.ts"
],
"testFiles": [],
"targetVersions": {
Expand Down
22 changes: 12 additions & 10 deletions sensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ namespace microcode {
* Time it takes for this algorithm to run is accounted for when calculating how long to wait inbetween logs
* Mutates this.schedule
*
* Temp disabled elements relating to callbackObj (no mem)
* @param callbackObj is used by the DistributedLoggingProtocol; after each log & after the algorithm finishes a callback will be made
*/
start(callbackObj?: ITargetDataLoggedCallback) {
const callbackAfterLog: boolean = (callbackObj == null) ? false : true
start() {//callbackObj?: ITargetDataLoggedCallback) {
// const callbackAfterLog: boolean = (callbackObj == null) ? false : true

control.inBackground(() => {
let currentTime = 0;
Expand All @@ -272,8 +273,8 @@ namespace microcode {
const logAsCSV = this.schedule[i].sensor.log(0)

// Optionally inform the caller of the log (In the case of the DistributedLoggingProtocol this information can be forwarded to the Commander over radio)
if (callbackAfterLog)
callbackObj.callback(logAsCSV)
// if (callbackAfterLog)
// callbackObj.callback(logAsCSV)

// Clear from schedule (A sensor may only have 1 reading):
if (!this.schedule[i].sensor.hasMeasurements())
Expand Down Expand Up @@ -321,8 +322,8 @@ namespace microcode {
const logAsCSV = this.schedule[i].sensor.log(currentTime)

// Optionally inform the caller of the log (In the case of the DistributedLoggingProtocol this information can be forwarded to the Commander over radio)
if (callbackAfterLog)
callbackObj.callback(logAsCSV)
// if (callbackAfterLog)
// callbackObj.callback(logAsCSV)

// Update schedule with when they should next be logged:
if (this.schedule[i].sensor.hasMeasurements()) {
Expand All @@ -349,10 +350,11 @@ namespace microcode {
. # # # .
`)
}
if (callbackAfterLog) {
DistributedLoggingProtocol.finishedLogging = true
callbackObj.callback("")
}

// if (callbackAfterLog) {
// DistributedLoggingProtocol.finishedLogging = true
// callbackObj.callback("")
// }
})
}
}
Expand Down

0 comments on commit 901dcd0

Please sign in to comment.