Skip to content

Commit

Permalink
Merge branch 'oled_animations' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
4m1g0 committed Dec 16, 2019
2 parents 330b1f6 + 4fc46b0 commit 9d01aec
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions src/Fossa_GroundStation/Fossa_GroundStation.ino
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ int mcuTemperature = 0;
int resetCounter = 0;
byte powerConfig = 0b11111111;

// on frame animation
int graphVal = 1;
int delta = 1;
unsigned long tick_interval;
int tick_timing = 100;


void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
// Demo for drawStringMaxWidth:
Expand All @@ -271,8 +277,21 @@ void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
display->drawString( x+13, 22+y, String(batteryChargingVoltage));
display->drawString( x+13, 35+y, String(batteryChargingCurrent));
display->drawString( x+80, 32+y, String(batteryTemperature) + "ºC" );


if ((millis()-tick_interval)>200) {
// Change the value to plot
graphVal-=1;
tick_interval=millis();
if (graphVal <= 1) {graphVal = 8; } // ramp up value
}


display->fillRect(x+48, y+32+graphVal, 25 , 13-graphVal);

}


void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->setFont(ArialMT_Plain_10);
Expand Down Expand Up @@ -324,7 +343,6 @@ void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1

}


void drawFrame6(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
display->drawXbm(x , y , earth_width, earth_height, earth_bits);
display->setColor(BLACK);
Expand All @@ -339,13 +357,21 @@ void drawFrame6(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int1
display->drawString( 64+x, 50+y+(x/2), "Waiting for FossaSat Pos" );
}
else {
display->fillCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 6);
if ((millis()-tick_interval)>tick_timing) {
// Change the value to plot
graphVal+=delta;
tick_interval=millis();
// If the value reaches a limit, then change delta of value
if (graphVal >= 6) {delta = -1; tick_timing=50; }// ramp down value
else if (graphVal <= 1) {delta = +1; tick_timing=100;} // ramp up value
}
display->fillCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal+1);
display->setColor(WHITE);
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 5);
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal);
display->setColor(BLACK);
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 2);
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, (graphVal/3)+1);
display->setColor(WHITE);
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, 1);
display->drawCircle(sat_pos_oled[0]+x, sat_pos_oled[1]+y, graphVal/3);
}

}
Expand Down

0 comments on commit 9d01aec

Please sign in to comment.