Add a few comments

This commit is contained in:
Mario Hüttel 2021-10-24 14:50:07 +02:00
parent 78f24f7338
commit 22bb227bc7
1 changed files with 9 additions and 4 deletions

View File

@ -484,7 +484,7 @@ static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t han
char *buff;
uint8_t row;
uint8_t col;
bool differs = false;
bool disp_content_differs = false;
static char IN_SECTION(.ccm.bss) display_buffer[4][21] = {0};
const char (*current_display)[21];
@ -516,6 +516,10 @@ static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t han
button_override_event(BUTTON_LONG_RELEASED);
break;
case '\x03':
/* CTRL-C received. Delete the display buffer so it will be updated the next time
* This function is called.
* Otherwise the diplay might not be printed to the console if nothing has changed
*/
display_buffer[0][0] = 0;
display_buffer[1][0] = 0;
display_buffer[2][0] = 0;
@ -531,16 +535,17 @@ static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t han
for (col = 0; col < 21; col++) {
if (current_display[row][col] != display_buffer[row][col]) {
display_buffer[row][col] = current_display[row][col];
differs = true;
disp_content_differs = true;
}
}
display_buffer[row][20] = 0;
}
if (differs) {
if (disp_content_differs) {
/* Clear the display */
shellmatta_printf(handle, "\e[2J\e[H");
/* Print out the rows of the LCD to console */
for (row = 0; row < 4; row++) {
shellmatta_printf(handle, "%s\r\n", &display_buffer[row][0]);
}