Skip to content

Commit

Permalink
replace
Browse files Browse the repository at this point in the history
  • Loading branch information
tballmsft committed Aug 27, 2024
1 parent a6da75c commit 97f0834
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 114 deletions.
20 changes: 10 additions & 10 deletions clearDataloggerScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ namespace microcode {
0xc
)

screen.printCenter("Sensor Selection", 4)
screen().printCenter("Sensor Selection", 4)
const headerX = Screen.HALF_WIDTH // Log has data in it

// Outline:
screen.fillRect(
screen().fillRect(
Screen.HALF_WIDTH - 70,
Screen.HALF_HEIGHT - 40,
140,
90,
15 // Black
)

screen.fillRect(
screen().fillRect(
Screen.HALF_WIDTH - 70 + 3,
Screen.HALF_HEIGHT - 40 + 3,
140 - 6,
Expand All @@ -108,15 +108,15 @@ namespace microcode {
)

const tutorialTextLength = ("Clear the data log?".length * font.charWidth)
screen.print(
screen().print(
"Clear the data log?",
headerX - (tutorialTextLength / 2),
Screen.HALF_HEIGHT - 40 + 7,
15 // Black
)

// Underline the title:
screen.fillRect(
screen().fillRect(
headerX - (tutorialTextLength / 2) + 2,
Screen.HALF_HEIGHT - 40 + 25,
tutorialTextLength - (1 * font.charWidth),
Expand All @@ -125,33 +125,33 @@ namespace microcode {
)

if (this.currentlyDeleting)
screen.printCenter("Deleting data...", Screen.HALF_HEIGHT - 9, 15)
screen().printCenter("Deleting data...", Screen.HALF_HEIGHT - 9, 15)

// Draw button prompts:
screen.print(
screen().print(
"Yes",
Screen.HALF_WIDTH - 48,
Screen.HALF_HEIGHT + 28,
15
)

screen.print(
screen().print(
"No",
Screen.HALF_WIDTH + 33,
Screen.HALF_HEIGHT + 28,
15
)

// White boxes behind yes & no btns:
screen.fillRect(
screen().fillRect(
Screen.HALF_WIDTH - 47,
Screen.HALF_HEIGHT + 14,
12,
12,
1
)

screen.fillRect(
screen().fillRect(
Screen.HALF_WIDTH + 34,
Screen.HALF_HEIGHT + 14,
12,
Expand Down
20 changes: 10 additions & 10 deletions dataRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ namespace microcode {

// Check if all sensors have finished their work:
if (this.scheduler.loggingComplete()) {
screen.printCenter("Data Logging Complete.", (screen.height / 2) - 10);
screen.printCenter("Press B to back out.", screen.height / 2);
screen().printCenter("Data Logging Complete.", (screen().height / 2) - 10);
screen().printCenter("Press B to back out.", screen().height / 2);
}

else {
screen.printCenter("Recording data...", 4);
screen().printCenter("Recording data...", 4);
let y = 16

for (let i = this.sensorIndexOffset; i < this.numberOfSensors; i++) {
Expand All @@ -121,23 +121,23 @@ namespace microcode {

// Draw box as collapsed:
if (i != this.currentSensorIndex) {
screen.fillRect(
screen().fillRect(
5,
y,
boxWidth,
16,
16
)

screen.fillRect(
screen().fillRect(
7,
y,
boxWidth + 3,
14,
this.sensorBoxColor
)

screen.print(
screen().print(
this.sensors[i].getName(),
12,
y + 2,
Expand All @@ -147,15 +147,15 @@ namespace microcode {

// Box is selected: Draw all information:
else {
screen.fillRect(
screen().fillRect(
5,
y,
boxWidth,
62,
15
)

screen.fillRect(
screen().fillRect(
7,
y,
boxWidth + 3,
Expand All @@ -168,7 +168,7 @@ namespace microcode {
//-------------------------------

const sensor = this.sensors[i]
screen.print(
screen().print(
sensor.getName(),
12,
y + 2,
Expand All @@ -181,7 +181,7 @@ namespace microcode {
const sensorInfo: string[] = (sensor.isInEventMode) ? sensor.getEventInformation() : sensor.getRecordingInformation();
sensorInfo.forEach((info) => {
y += 12
screen.print(
screen().print(
info,
24,
y,
Expand Down
6 changes: 3 additions & 3 deletions dataViewSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ namespace microcode {
)

if (this.dataloggerEmpty) {
screen.printCenter("No data has been recorded", 5)
screen.printCenter("Press A to Record some!", Screen.HALF_HEIGHT)
screen().printCenter("No data has been recorded", 5)
screen().printCenter("Press A to Record some!", Screen.HALF_HEIGHT)
return;
}

else {
screen.printCenter("Recorded Data Options", 5)
screen().printCenter("Recorded Data Options", 5)
this.resetDataLoggerBtn.draw()
this.dataViewBtn.draw()
this.graphViewBtn.draw()
Expand Down
8 changes: 4 additions & 4 deletions distributedLoggingScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ namespace microcode {
case UI_STATE.SHOWING_OPTIONS: {
switch (this.distributedLogger.radioMode) {
case RADIO_LOGGING_MODE.UNCONFIGURED: {
screen.printCenter(
screen().printCenter(
"Searching for Microbits...",
2
)
break;
}

case RADIO_LOGGING_MODE.COMMANDER: {
screen.printCenter(
screen().printCenter(
"Commander Mode",
2
)
Expand All @@ -184,14 +184,14 @@ namespace microcode {
const connectedText = "Connected to Commander,"
const asMicrobit = "as Microbit " + this.distributedLogger.id + "."

screen.print(
screen().print(
connectedText,
Screen.HALF_WIDTH - ((connectedText.length * font.charWidth) / 2),
2
)

// Left-aligned with above text
screen.print(
screen().print(
asMicrobit,
Screen.HALF_WIDTH - ((connectedText.length * font.charWidth) / 2),
12
Expand Down
34 changes: 17 additions & 17 deletions generateGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ namespace microcode {
}

/**
* Normalise the readings in this.dataRows relative to the screen.
* Normalise the readings in this.dataRows relative to the screen().
* Invoked upon UP, DOWN, LEFT, RIGHT.
* Fills this.readings, then invokes this.normaliseReadings() to setup this.normalisedReadings
*/
Expand Down Expand Up @@ -471,10 +471,10 @@ namespace microcode {
}

update() {
screen.fill(this.backgroundColor);
screen().fill(this.backgroundColor);

// Make graph region black:
screen.fillRect(
screen().fillRect(
this.windowLeftBuffer,
this.windowTopBuffer + this.yScrollOffset + this.yScrollOffset,
Screen.WIDTH - this.windowLeftBuffer - this.windowRightBuffer,
Expand All @@ -497,7 +497,7 @@ namespace microcode {
if (this.drawSensorStates[this.sensors[sensor].getName()]) {
// Duplicate the line along the y axis to smooth out aliasing:
for (let j = -(PLOT_SMOOTHING_CONSTANT / 2); j < PLOT_SMOOTHING_CONSTANT / 2; j++) {
screen.drawLine(
screen().drawLine(
this.processedCoordinates[sensor][i] + 1,
this.processedCoordinates[sensor][i+1] + j,
this.processedCoordinates[sensor][i+2] + 1,
Expand All @@ -517,7 +517,7 @@ namespace microcode {
let y = this.windowHeight - 2 + (2 * this.yScrollOffset)
for (let i = 0; i < this.sensors.length; i++) {
// Black edges:
screen.fillRect(
screen().fillRect(
5,
y,
142,
Expand All @@ -535,7 +535,7 @@ namespace microcode {
}

// Coloured block:
screen.fillRect(
screen().fillRect(
7,
y,
145,
Expand All @@ -547,7 +547,7 @@ namespace microcode {
if (this.uiState == UI_STATE.SENSOR_SELECTION && i == this.currentlySelectedSensorIndex) {
// Blue edges:
for (let thickness = 0; thickness < 3; thickness++) {
screen.drawRect(
screen().drawRect(
7 - thickness,
y - thickness,
145 + thickness,
Expand All @@ -561,21 +561,21 @@ namespace microcode {
// Sensor information:
//--------------------

screen.print(
screen().print(
this.sensors[i].getName(),
12,
y + 2,
textColor
)

screen.print(
screen().print(
"Minimum: " + this.sensorMinsAndMaxs[i][MIN_MAX_COLUMNS.MIN],
12,
y + 16,
textColor
)

screen.print(
screen().print(
"Maximum: " + this.sensorMinsAndMaxs[i][MIN_MAX_COLUMNS.MAX],
12,
y + 32,
Expand All @@ -592,14 +592,14 @@ namespace microcode {
*/
draw_axes() {
for (let i = 0; i < 2; i++) {
screen.drawLine(
screen().drawLine(
this.windowLeftBuffer,
this.windowHeight - this.windowBotBuffer + i + this.yScrollOffset + this.yScrollOffset,
this.windowWidth - this.windowRightBuffer,
this.windowHeight - this.windowBotBuffer + i + this.yScrollOffset + this.yScrollOffset,
5
);
screen.drawLine(
screen().drawLine(
this.windowLeftBuffer + i,
this.windowTopBuffer + this.yScrollOffset + this.yScrollOffset,
this.windowLeftBuffer + i,
Expand All @@ -617,7 +617,7 @@ namespace microcode {
const globalSensorMaximumDraw: number = Screen.HEIGHT - this.windowHeight + this.windowTopBuffer - Math.floor(0.1 * this.yScrollOffset)

// Bot:
screen.print(
screen().print(
globalSensorMinimum,
(6 * font.charWidth) - (globalSensorMinimum.length * font.charWidth),
globalSensorMinimumDraw,
Expand All @@ -630,7 +630,7 @@ namespace microcode {
if (this.drawSensorStates[this.sensors[index].getName()]) {
const yWrite: string = this.rawCoordinates[this.sensors[index].getName()][1].toString().slice(0, 5);
const yDraw = this.processedCoordinates[index][1] - Math.floor(0.1 * this.yScrollOffset) - 1;
screen.print(
screen().print(
yWrite,
(6 * font.charWidth) - (yWrite.length * font.charWidth),
yDraw,
Expand All @@ -640,7 +640,7 @@ namespace microcode {
}

// Top:
screen.print(
screen().print(
globalSensorMaximum,
(6 * font.charWidth) - (globalSensorMaximum.length * font.charWidth),
globalSensorMaximumDraw,
Expand All @@ -651,7 +651,7 @@ namespace microcode {

// X axis:
// Start
screen.print(
screen().print(
this.lowestPeriod / 1000 + "s",
this.windowLeftBuffer - 2,
this.windowHeight - this.windowBotBuffer + this.yScrollOffset + this.yScrollOffset + 4,
Expand All @@ -660,7 +660,7 @@ namespace microcode {

// End:
const end: string = this.greatestPeriod / 1000 + "s";
screen.print(
screen().print(
end,
Screen.WIDTH - this.windowRightBuffer - (end.length * font.charWidth),
this.windowHeight - this.windowBotBuffer + this.yScrollOffset + this.yScrollOffset + 4,
Expand Down
Loading

0 comments on commit 97f0834

Please sign in to comment.