Add LCD output to shell function 'Emulate UI'
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <reflow-controller/updater/updater.h>
|
||||
#include <reflow-controller/main-cycle-counter.h>
|
||||
#include <stm-periph/option-bytes.h>
|
||||
#include <reflow-controller/ui/gui.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -481,6 +482,11 @@ static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t han
|
||||
uint32_t i;
|
||||
uint32_t len;
|
||||
char *buff;
|
||||
uint8_t row;
|
||||
uint8_t col;
|
||||
bool differs = false;
|
||||
static char IN_SECTION(.ccm.bss) display_buffer[4][21] = {0};
|
||||
const char (*current_display)[21];
|
||||
|
||||
shellmatta_read(handle, &buff, &len);
|
||||
|
||||
@@ -509,6 +515,34 @@ static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t han
|
||||
case 'R':
|
||||
button_override_event(BUTTON_LONG_RELEASED);
|
||||
break;
|
||||
case '\x03':
|
||||
display_buffer[0][0] = 0;
|
||||
display_buffer[1][0] = 0;
|
||||
display_buffer[2][0] = 0;
|
||||
display_buffer[3][0] = 0;
|
||||
return SHELLMATTA_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
current_display = gui_get_current_display_content();
|
||||
|
||||
for (row = 0; row < 4; row++) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
display_buffer[row][20] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (differs) {
|
||||
/* Clear the display */
|
||||
shellmatta_printf(handle, "\e[2J\e[H");
|
||||
for (row = 0; row < 4; row++) {
|
||||
shellmatta_printf(handle, "%s\r\n", &display_buffer[row][0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user