Triangle trend indicator for voltage page
This commit is contained in:
parent
526806cfcb
commit
dd76586ebe
|
@ -111,6 +111,16 @@ void setBuzzerPower(uint power){
|
|||
buzzerpower = power;
|
||||
}
|
||||
|
||||
// Show a triangle for trend direction high (x, y is the left edge)
|
||||
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color){
|
||||
display.fillTriangle(x, y, x+size*2, y, x+size, y-size*2, color);
|
||||
}
|
||||
|
||||
// Show a triangle for trend direction low (x, y is the left edge)
|
||||
void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){
|
||||
display.fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color);
|
||||
}
|
||||
|
||||
void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatValue *date, GwApi::BoatValue *time){
|
||||
|
||||
static bool heartbeat = false;
|
||||
|
|
|
@ -37,6 +37,9 @@ void setBlinkingLED(bool on); // Set blinking LED active
|
|||
void buzzer(uint frequency, uint duration); // Buzzer function
|
||||
void setBuzzerPower(uint power); // Set buzzer power
|
||||
|
||||
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color);
|
||||
void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color);
|
||||
|
||||
void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatValue *date, GwApi::BoatValue *time); // Draw display header
|
||||
|
||||
#endif
|
|
@ -223,23 +223,20 @@ public:
|
|||
}
|
||||
|
||||
// Trend indicator
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold32pt7b);
|
||||
// Show trend indicator
|
||||
if(trend == true){
|
||||
display.setCursor(310, 240);
|
||||
display.print(" ");
|
||||
display.fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
display.fillRect(315, 183, 35, 4, textcolor); // Draw separator
|
||||
if(int(raw * 10) > int(valueTrend * 10)){
|
||||
display.setCursor(310, 240);
|
||||
display.print("+ ");
|
||||
displayTrendHigh(320, 174, 11, textcolor); // Show high indicator
|
||||
}
|
||||
if(int(raw * 10) < int(valueTrend * 10)){
|
||||
display.setCursor(310, 240);
|
||||
display.print("- ");
|
||||
displayTrendLow(320, 195, 11, textcolor); // Show low indicator
|
||||
}
|
||||
}
|
||||
// No trend indicator
|
||||
else{
|
||||
display.setCursor(310, 240);
|
||||
display.print(" ");
|
||||
display.fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue