diff options
author | 2019-06-08 12:51:42 +0300 | |
---|---|---|
committer | 2019-06-08 12:51:42 +0300 | |
commit | 2447d279bd86a24524552a3c56410a39e7780d1d (patch) | |
tree | db008a20003e3ce6b4f930788b5d96af33874fd7 /src/device/screen.cpp | |
parent | 30513e7a89cc2f9283458100dea298770c7d18de (diff) | |
download | usurpation-2447d279bd86a24524552a3c56410a39e7780d1d.tar.gz usurpation-2447d279bd86a24524552a3c56410a39e7780d1d.tar.bz2 usurpation-2447d279bd86a24524552a3c56410a39e7780d1d.zip |
device: random screen-related fixes.
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src/device/screen.cpp')
-rw-r--r-- | src/device/screen.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
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; } |