Add a few comments
This commit is contained in:
		@@ -484,7 +484,7 @@ static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t han
 | 
				
			|||||||
	char *buff;
 | 
						char *buff;
 | 
				
			||||||
	uint8_t row;
 | 
						uint8_t row;
 | 
				
			||||||
	uint8_t col;
 | 
						uint8_t col;
 | 
				
			||||||
	bool differs = false;
 | 
						bool disp_content_differs = false;
 | 
				
			||||||
	static char IN_SECTION(.ccm.bss) display_buffer[4][21] = {0};
 | 
						static char IN_SECTION(.ccm.bss) display_buffer[4][21] = {0};
 | 
				
			||||||
	const char (*current_display)[21];
 | 
						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);
 | 
								button_override_event(BUTTON_LONG_RELEASED);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '\x03':
 | 
							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[0][0] = 0;
 | 
				
			||||||
			display_buffer[1][0] = 0;
 | 
								display_buffer[1][0] = 0;
 | 
				
			||||||
			display_buffer[2][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++) {
 | 
							for (col = 0; col < 21; col++) {
 | 
				
			||||||
			if (current_display[row][col] != display_buffer[row][col]) {
 | 
								if (current_display[row][col] != display_buffer[row][col]) {
 | 
				
			||||||
				display_buffer[row][col] = current_display[row][col];
 | 
									display_buffer[row][col] = current_display[row][col];
 | 
				
			||||||
				differs = true;
 | 
									disp_content_differs = true;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		display_buffer[row][20] = 0;
 | 
							display_buffer[row][20] = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (disp_content_differs) {
 | 
				
			||||||
	if (differs) {
 | 
					 | 
				
			||||||
		/* Clear the display */
 | 
							/* Clear the display */
 | 
				
			||||||
		shellmatta_printf(handle, "\e[2J\e[H");
 | 
							shellmatta_printf(handle, "\e[2J\e[H");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Print out the rows of the LCD to console */
 | 
				
			||||||
		for (row = 0; row < 4; row++) {
 | 
							for (row = 0; row < 4; row++) {
 | 
				
			||||||
			shellmatta_printf(handle, "%s\r\n", &display_buffer[row][0]);
 | 
								shellmatta_printf(handle, "%s\r\n", &display_buffer[row][0]);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user