From 2447d279bd86a24524552a3c56410a39e7780d1d Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Sat, 8 Jun 2019 12:51:42 +0300 Subject: device: random screen-related fixes. Signed-off-by: Gediminas Jakutis --- src/device/screen.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/device/screen.cpp') diff --git a/src/device/screen.cpp b/src/device/screen.cpp index 2857161..3f1d215 100644 --- a/src/device/screen.cpp +++ b/src/device/screen.cpp @@ -9,8 +9,7 @@ void draw_lines(OLEDDisplay *screen, struct display_status *status); void update_lines(struct display_status *status); void init_msg(char *msg, size_t size); -/* Effectively const. For type safety reasons. */ -static char NOTHING[] = {'\0'}; +static char empty_string[] = ""; void display_status_init(OLEDDisplay *screen, struct display_status *status, char *msg) { @@ -58,7 +57,7 @@ int display_update_scroll(struct display_status *status) update_lines(status); draw_lines(status->screen, status); } - if (status->first_line == NOTHING && status->second_line == NOTHING) { + if (!(*status->first_line) && !(*(status->second_line))) { return END_OF_MESSAGE; } else { return 0; @@ -76,8 +75,8 @@ void update_lines(struct display_status *status) { status->first_line = (status->line_cursor * SCREEN_MAX_CHARS < status->message_len) ? status->message + status->line_cursor * SCREEN_MAX_CHARS - : NOTHING; + : empty_string; status->second_line = (status->line_cursor * SCREEN_MAX_CHARS < status->message_len) ? status->message + (status->line_cursor + 1) * SCREEN_MAX_CHARS - : NOTHING; + : empty_string; } -- cgit v1.2.3