skip display pages with no content (issue #523)
This commit is contained in:
parent
3be62fa21d
commit
e8abe8567b
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
extern uint8_t DisplayIsOn, displaybuf[];
|
extern uint8_t DisplayIsOn, displaybuf[];
|
||||||
|
|
||||||
void refreshTheDisplay(bool nextPage = false);
|
void refreshTheDisplay(bool nextPage = false, bool toggle_screencycle = false);
|
||||||
void init_display(bool verbose = false);
|
void init_display(bool verbose = false);
|
||||||
void shutdown_display(void);
|
void shutdown_display(void);
|
||||||
void draw_page(time_t t, uint8_t page);
|
void draw_page(time_t t, bool nextpage, bool cyclescreen);
|
||||||
void dp_printf(uint16_t x, uint16_t y, uint8_t font, uint8_t inv,
|
void dp_printf(uint16_t x, uint16_t y, uint8_t font, uint8_t inv,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
void dp_printqr(uint16_t offset_x, uint16_t offset_y, const char *Message);
|
void dp_printqr(uint16_t offset_x, uint16_t offset_y, const char *Message);
|
||||||
|
@ -149,11 +149,14 @@ void init_display(bool verbose) {
|
|||||||
} // mutex
|
} // mutex
|
||||||
} // init_display
|
} // init_display
|
||||||
|
|
||||||
void refreshTheDisplay(bool nextPage) {
|
void refreshTheDisplay(bool nextPage, bool toggle_screencycle) {
|
||||||
|
|
||||||
static uint8_t DisplayPage = 0;
|
static bool screencycle = false;
|
||||||
|
|
||||||
// update histogram if we have a display
|
if (toggle_screencycle)
|
||||||
|
screencycle = !screencycle;
|
||||||
|
|
||||||
|
// update histogram
|
||||||
oledPlotCurve(macs.size(), false);
|
oledPlotCurve(macs.size(), false);
|
||||||
|
|
||||||
// if display is switched off we don't refresh it to relax cpu
|
// if display is switched off we don't refresh it to relax cpu
|
||||||
@ -173,12 +176,7 @@ void refreshTheDisplay(bool nextPage) {
|
|||||||
oledPower(cfg.screenon);
|
oledPower(cfg.screenon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextPage) {
|
draw_page(t, nextPage, screencycle);
|
||||||
DisplayPage = (DisplayPage >= DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1);
|
|
||||||
oledFill(0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_page(t, DisplayPage);
|
|
||||||
oledDumpBuffer(displaybuf);
|
oledDumpBuffer(displaybuf);
|
||||||
|
|
||||||
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
I2C_MUTEX_UNLOCK(); // release i2c bus access
|
||||||
@ -198,18 +196,24 @@ void shutdown_display(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_page(time_t t, uint8_t page) {
|
void draw_page(time_t t, bool nextpage, bool cyclescreen) {
|
||||||
|
|
||||||
|
static uint8_t DisplayPage = 0;
|
||||||
char timeState;
|
char timeState;
|
||||||
#if (HAS_GPS)
|
#if (HAS_GPS)
|
||||||
static bool wasnofix = true;
|
static bool wasnofix = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (nextpage) {
|
||||||
|
DisplayPage = (DisplayPage >= DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1);
|
||||||
|
oledFill(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// line 1/2: pax counter
|
// line 1/2: pax counter
|
||||||
dp_printf(0, 0, FONT_STRETCHED, 0, "PAX:%-4d",
|
dp_printf(0, 0, FONT_STRETCHED, 0, "PAX:%-4d",
|
||||||
macs.size()); // display number of unique macs total Wifi + BLE
|
macs.size()); // display number of unique macs total Wifi + BLE
|
||||||
|
|
||||||
switch (page % DISPLAY_PAGES) {
|
switch (DisplayPage) {
|
||||||
|
|
||||||
// page 0: parameters overview
|
// page 0: parameters overview
|
||||||
// page 1: pax graph
|
// page 1: pax graph
|
||||||
@ -323,12 +327,10 @@ void draw_page(time_t t, uint8_t page) {
|
|||||||
dp_printf(16, 5, FONT_STRETCHED, 1, "No fix");
|
dp_printf(16, 5, FONT_STRETCHED, 1, "No fix");
|
||||||
wasnofix = true;
|
wasnofix = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
dp_printf(16, 5, FONT_STRETCHED, 1, "No GPS");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break; // page2
|
break; // page2
|
||||||
|
#else
|
||||||
|
DisplayPage++; // next page
|
||||||
|
#endif
|
||||||
|
|
||||||
// page 3: BME280/680
|
// page 3: BME280/680
|
||||||
case 3:
|
case 3:
|
||||||
@ -346,13 +348,11 @@ void draw_page(time_t t, uint8_t page) {
|
|||||||
#else // is BME280 or BMP180
|
#else // is BME280 or BMP180
|
||||||
// line 6-7: Pre
|
// line 6-7: Pre
|
||||||
dp_printf(0, 6, FONT_STRETCHED, 0, "PRE:%-2.1f", bme_status.pressure);
|
dp_printf(0, 6, FONT_STRETCHED, 0, "PRE:%-2.1f", bme_status.pressure);
|
||||||
#endif // HAS_BME
|
#endif // HAS_BME680
|
||||||
|
break; // page 3
|
||||||
#else
|
#else
|
||||||
dp_printf(16, 5, FONT_STRETCHED, 1, "No BME");
|
DisplayPage++; // next page
|
||||||
#endif
|
#endif // HAS_BME
|
||||||
|
|
||||||
break; // page3
|
|
||||||
|
|
||||||
// page 4: time
|
// page 4: time
|
||||||
case 4:
|
case 4:
|
||||||
@ -364,8 +364,13 @@ void draw_page(time_t t, uint8_t page) {
|
|||||||
// page 5: blank screen
|
// page 5: blank screen
|
||||||
case 5:
|
case 5:
|
||||||
|
|
||||||
|
if (cyclescreen)
|
||||||
|
DisplayPage++;
|
||||||
|
else // show blank page only if we are not in screencycle mode
|
||||||
|
{
|
||||||
oledFill(0, 1);
|
oledFill(0, 1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break; // default
|
break; // default
|
||||||
|
Loading…
Reference in New Issue
Block a user