Commit eb1755aa1be4ffd24a085a907a2023cb823e31bd

Authored by Imanol-Mikel Barba Sabariego
1 parent 547c16ac

Showing white text when stock did not change in value

Showing 1 changed file with 4 additions and 4 deletions
src/stock.cpp
@@ -126,20 +126,20 @@ void display_stock_task(void* arg) { @@ -126,20 +126,20 @@ void display_stock_task(void* arg) {
126 sprintf(delta_perc, "%+0.04f%%", -100* (1 - (c / (c-d)))); 126 sprintf(delta_perc, "%+0.04f%%", -100* (1 - (c / (c-d))));
127 127
128 // META 128 // META
129 - drawText((PANEL_RES_X - strlen(stock))/4, 8, stock, strlen(stock), d < 0 ? 0xFF : 0x00, d < 0 ? 0x00 : 0xFF, 0x00); 129 + drawText((PANEL_RES_X - strlen(stock))/4, 8, stock, strlen(stock), d <= 0 ? 0xFF : 0x00, d < 0 ? 0x00 : 0xFF, d ? 0x00 : 0xFF);
130 130
131 // Arrow 131 // Arrow
132 if(d < 0) { 132 if(d < 0) {
133 dma_display->drawIcon(arrow_down_icon, 1, 8, 6, 8); 133 dma_display->drawIcon(arrow_down_icon, 1, 8, 6, 8);
134 - } else { 134 + } else if (d > 0) {
135 dma_display->drawIcon(arrow_up_icon, 1, 8, 6, 8); 135 dma_display->drawIcon(arrow_up_icon, 1, 8, 6, 8);
136 } 136 }
137 137
138 // Delta 138 // Delta
139 if(display_percentage) { 139 if(display_percentage) {
140 - drawText((PANEL_RES_X - strlen(delta_perc))/4, 16, delta_perc, strlen(delta_perc), d < 0 ? 0xFF : 0x00, d < 0 ? 0x00 : 0xFF, 0x00); 140 + drawText((PANEL_RES_X - strlen(delta_perc))/4, 16, delta_perc, strlen(delta_perc), d <= 0 ? 0xFF : 0x00, d < 0 ? 0x00 : 0xFF, d ? 0x00 : 0xFF);
141 } else { 141 } else {
142 - drawText((PANEL_RES_X - strlen(delta))/4, 16, delta, strlen(delta), d < 0 ? 0xFF : 0x00, d < 0 ? 0x00 : 0xFF, 0x00); 142 + drawText((PANEL_RES_X - strlen(delta))/4, 16, delta, strlen(delta), d <= 0 ? 0xFF : 0x00, d < 0 ? 0x00 : 0xFF, d ? 0x00 : 0xFF);
143 } 143 }
144 vTaskDelay(ALTERNATE_TIME * 1000 / portTICK_PERIOD_MS); 144 vTaskDelay(ALTERNATE_TIME * 1000 / portTICK_PERIOD_MS);
145 display_percentage ^= 1; 145 display_percentage ^= 1;