Skip to content

Commit 9d01aec

Browse files
committed
Merge branch 'oled_animations' into dev
2 parents 330b1f6 + 4fc46b0 commit 9d01aec

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
@@ -252,6 +252,12 @@ int mcuTemperature = 0;
252252
int resetCounter = 0;
253253
byte powerConfig = 0b11111111;
254254

255+
// on frame animation
256+
int graphVal = 1;
257+
int delta = 1;
258+
unsigned long tick_interval;
259+
int tick_timing = 100;
260+
255261

256262
void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
257263
// Demo for drawStringMaxWidth:
@@ -271,8 +277,21 @@ void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
271277
display->drawString( x+13, 22+y, String(batteryChargingVoltage));
272278
display->drawString( x+13, 35+y, String(batteryChargingCurrent));
273279
display->drawString( x+80, 32+y, String(batteryTemperature) + "ºC" );
280+
281+
282+
if ((millis()-tick_interval)>200) {
283+
// Change the value to plot
284+
graphVal-=1;
285+
tick_interval=millis();
286+
if (graphVal <= 1) {graphVal = 8; } // ramp up value
287+
}
288+
289+
290+
display->fillRect(x+48, y+32+graphVal, 25 , 13-graphVal);
291+
274292
}
275293

294+
276295
void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
277296
display->setTextAlignment(TEXT_ALIGN_LEFT);
278297
display->setFont(ArialMT_Plain_10);
@@ -324,7 +343,6 @@ void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
324343

325344
}
326345

327-
328346
void drawFrame6(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
329347
display->drawXbm(x , y , earth_width, earth_height, earth_bits);
330348
display->setColor(BLACK);
@@ -339,13 +357,21 @@ void drawFrame6(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
339357
display->drawString( 64+x, 50+y+(x/2), "Waiting for FossaSat Pos" );
340358
}
341359
else {
342-
display->fillCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 6);
360+
if ((millis()-tick_interval)>tick_timing) {
361+
// Change the value to plot
362+
graphVal+=delta;
363+
tick_interval=millis();
364+
// If the value reaches a limit, then change delta of value
365+
if (graphVal >= 6) {delta = -1; tick_timing=50; }// ramp down value
366+
else if (graphVal <= 1) {delta = +1; tick_timing=100;} // ramp up value
367+
}
368+
display->fillCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal+1);
343369
display->setColor(WHITE);
344-
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 5);
370+
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal);
345371
display->setColor(BLACK);
346-
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 2);
372+
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, (graphVal/3)+1);
347373
display->setColor(WHITE);
348-
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 1);
374+
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal/3);
349375
}
350376

351377
}

0 commit comments

Comments
 (0)