Skip to content

Commit 5963350

Browse files
Headings are flash state.
1 parent b6f1c60 commit 5963350

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/board/data-logging.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,6 @@ export class DataLogging {
3434
private onChange: (state: Partial<State>) => void
3535
) {}
3636

37-
delete() {
38-
this.resetNonFlashStateExceptTimestamp();
39-
this.size = 0;
40-
if (this.logFull) {
41-
this.logFull = false;
42-
this.onChange({
43-
dataLogging: {
44-
type: "dataLogging",
45-
logFull: false,
46-
},
47-
});
48-
}
49-
50-
this.onLogDelete();
51-
}
52-
5337
setMirroring(mirroring: boolean) {
5438
this.mirroring = mirroring;
5539
}
@@ -151,9 +135,26 @@ export class DataLogging {
151135
this.timestamp = MICROBIT_HAL_LOG_TIMESTAMP_NONE;
152136
}
153137

138+
delete() {
139+
this.resetNonFlashStateExceptTimestamp();
140+
this.headings = [];
141+
this.size = 0;
142+
if (this.logFull) {
143+
this.logFull = false;
144+
this.onChange({
145+
dataLogging: {
146+
type: "dataLogging",
147+
logFull: false,
148+
},
149+
});
150+
}
151+
152+
this.onLogDelete();
153+
}
154+
154155
private resetNonFlashStateExceptTimestamp() {
156+
// headings are considered flash state as MicroBitLog reparses them from flash
155157
this.mirroring = false;
156-
this.headings = [];
157158
this.headingsChanged = false;
158159
this.timestampOnLastEndRow = undefined;
159160
this.row = undefined;

0 commit comments

Comments
 (0)