Skip to content

Commit 4fc46b0

Browse files
committed
New animations for battery and worldmap frames
1 parent 1e3a930 commit 4fc46b0

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

src/Fossa_GroundStation/Fossa_GroundStation.ino

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ int mcuTemperature = 42;
235235
int resetCounter = 0;
236236
byte powerConfig = 0b11111111;
237237

238+
// on frame animation
239+
int graphVal = 1;
240+
int delta = 1;
241+
unsigned long tick_interval;
242+
int tick_timing = 100;
243+
238244

239245
void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
240246
// Demo for drawStringMaxWidth:
@@ -254,8 +260,21 @@ void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
254260
display->drawString( x+13, 22+y, String(batteryChargingVoltage));
255261
display->drawString( x+13, 35+y, String(batteryChargingCurrent));
256262
display->drawString( x+80, 32+y, String(batteryTemperature) + "ºC" );
263+
264+
265+
if ((millis()-tick_interval)>200) {
266+
// Change the value to plot
267+
graphVal-=1;
268+
tick_interval=millis();
269+
if (graphVal <= 1) {graphVal = 8; } // ramp up value
270+
}
271+
272+
273+
display->fillRect(x+48, y+32+graphVal, 25 , 13-graphVal);
274+
257275
}
258276

277+
259278
void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
260279
display->setTextAlignment(TEXT_ALIGN_LEFT);
261280
display->setFont(ArialMT_Plain_10);
@@ -307,7 +326,6 @@ void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
307326

308327
}
309328

310-
311329
void drawFrame6(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
312330
display->drawXbm(x , y , earth_width, earth_height, earth_bits);
313331
display->setColor(BLACK);
@@ -322,13 +340,21 @@ void drawFrame6(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
322340
display->drawString( 64+x, 50+y+(x/2), "Waiting for FossaSat Pos" );
323341
}
324342
else {
325-
display->fillCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 6);
343+
if ((millis()-tick_interval)>tick_timing) {
344+
// Change the value to plot
345+
graphVal+=delta;
346+
tick_interval=millis();
347+
// If the value reaches a limit, then change delta of value
348+
if (graphVal >= 6) {delta = -1; tick_timing=50; }// ramp down value
349+
else if (graphVal <= 1) {delta = +1; tick_timing=100;} // ramp up value
350+
}
351+
display->fillCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal+1);
326352
display->setColor(WHITE);
327-
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 5);
353+
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal);
328354
display->setColor(BLACK);
329-
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 2);
355+
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, (graphVal/3)+1);
330356
display->setColor(WHITE);
331-
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 1);
357+
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal/3);
332358
}
333359

334360
}

0 commit comments

Comments
 (0)