Triangle trend indicator for voltage page

This commit is contained in:
norbert-walter 2022-03-27 17:14:46 +02:00
parent 526806cfcb
commit dd76586ebe
3 changed files with 20 additions and 10 deletions

View File

@ -111,6 +111,16 @@ void setBuzzerPower(uint power){
buzzerpower = 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){ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatValue *date, GwApi::BoatValue *time){
static bool heartbeat = false; static bool heartbeat = false;

View File

@ -37,6 +37,9 @@ void setBlinkingLED(bool on); // Set blinking LED active
void buzzer(uint frequency, uint duration); // Buzzer function void buzzer(uint frequency, uint duration); // Buzzer function
void setBuzzerPower(uint power); // Set buzzer power 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 void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatValue *date, GwApi::BoatValue *time); // Draw display header
#endif #endif

View File

@ -223,23 +223,20 @@ public:
} }
// Trend indicator // Trend indicator
display.setTextColor(textcolor); // Show trend indicator
display.setFont(&Ubuntu_Bold32pt7b);
if(trend == true){ if(trend == true){
display.setCursor(310, 240); display.fillRect(310, 240, 40, 120, bgcolor); // Clear area
display.print(" "); display.fillRect(315, 183, 35, 4, textcolor); // Draw separator
if(int(raw * 10) > int(valueTrend * 10)){ if(int(raw * 10) > int(valueTrend * 10)){
display.setCursor(310, 240); displayTrendHigh(320, 174, 11, textcolor); // Show high indicator
display.print("+ ");
} }
if(int(raw * 10) < int(valueTrend * 10)){ if(int(raw * 10) < int(valueTrend * 10)){
display.setCursor(310, 240); displayTrendLow(320, 195, 11, textcolor); // Show low indicator
display.print("- ");
} }
} }
// No trend indicator
else{ else{
display.setCursor(310, 240); display.fillRect(310, 240, 40, 120, bgcolor); // Clear area
display.print(" ");
} }