display code sanitization

This commit is contained in:
cyberman54 2022-08-15 14:41:39 +02:00
parent 6bfcf4d367
commit fc1c460769
2 changed files with 9 additions and 18 deletions

View File

@ -105,7 +105,6 @@ void dp_refresh(bool nextPage = false);
void dp_init(bool verbose = false); void dp_init(bool verbose = false);
void dp_shutdown(void); void dp_shutdown(void);
void dp_message(const char *msg, int line, bool invers); void dp_message(const char *msg, int line, bool invers);
void dp_drawPage(bool nextpage);
void dp_setFont(int font, int inv = 0); void dp_setFont(int font, int inv = 0);
void dp_dump(uint8_t *pBuffer = NULL); void dp_dump(uint8_t *pBuffer = NULL);
void dp_contrast(uint8_t contrast); void dp_contrast(uint8_t contrast);

View File

@ -149,8 +149,15 @@ void dp_init(bool verbose) {
} // dp_init } // dp_init
// write display content to display buffer
// nextpage = true -> flip 1 page
void dp_refresh(bool nextPage) { void dp_refresh(bool nextPage) {
struct count_payload_t count; // libpax count storage
static uint8_t DisplayPage = 0;
char timeState, strftime_buf[64];
time_t now;
struct tm timeinfo = {0};
#ifndef HAS_BUTTON #ifndef HAS_BUTTON
static uint32_t framecounter = 0; static uint32_t framecounter = 0;
const uint32_t flip_threshold = DISPLAYCYCLE * 1000 / DISPLAYREFRESH_MS; const uint32_t flip_threshold = DISPLAYCYCLE * 1000 / DISPLAYREFRESH_MS;
@ -174,22 +181,7 @@ void dp_refresh(bool nextPage) {
} }
#endif #endif
dp_drawPage(nextPage); if (nextPage) {
} // refreshDisplay()
void dp_drawPage(bool nextpage) {
// write display content to display buffer
// nextpage = true -> flip 1 page
struct count_payload_t count; // libpax count storage
static uint8_t DisplayPage = 0;
char timeState, strftime_buf[64];
time_t now;
struct tm timeinfo = {0};
if (nextpage) {
DisplayPage = (DisplayPage >= DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1); DisplayPage = (DisplayPage >= DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1);
dp_clear(); dp_clear();
} else } else
@ -414,7 +406,7 @@ void dp_drawPage(bool nextpage) {
#endif #endif
} // switch (page) } // switch (page)
} // dp_drawPage } // dp_refresh
// ------------- display helper functions ----------------- // ------------- display helper functions -----------------