Clear command log after saving.

This commit is contained in:
chriz
2026-01-26 23:29:23 +01:00
parent b5c249995f
commit 5662285a3e
4 changed files with 22 additions and 1 deletions
+7 -1
View File
@@ -993,7 +993,13 @@ void execute_config(void) __banked
config_done: config_done:
// Start saving commands to cmd_history // Start saving commands to cmd_history
save_cmd = 1; save_cmd = 1;
clear_command_history();
}
void clear_command_history(void) __banked
{
for (cmd_history_ptr = 0; cmd_history_ptr < CMD_HISTORY_SIZE; cmd_history_ptr++) for (cmd_history_ptr = 0; cmd_history_ptr < CMD_HISTORY_SIZE; cmd_history_ptr++)
cmd_history[cmd_history_ptr] = 0; cmd_history[cmd_history_ptr] = 0;
cmd_history_ptr = 0; cmd_history_ptr = 0;
} return;
}
+1
View File
@@ -12,4 +12,5 @@ uint8_t cmd_tokenize(void) __banked;
void cmd_parser(void) __banked; void cmd_parser(void) __banked;
void execute_config(void) __banked; void execute_config(void) __banked;
void print_sw_version(void) __banked; void print_sw_version(void) __banked;
void clear_command_history(void) __banked;
#endif #endif
+6
View File
@@ -46,6 +46,12 @@ async function flashSave() {
var configContent = document.getElementById("config_display").value; var configContent = document.getElementById("config_display").value;
console.log("CONFIGURATION to save: ", configContent); console.log("CONFIGURATION to save: ", configContent);
sendConfig(configContent); sendConfig(configContent);
// Clear the command log 1 second after initiating the config save
setTimeout(() => {
fetch('/cmd_log_clear', { method: 'GET' })
.then(response => console.log('Command log cleared', response))
.catch(err => console.error('Error clearing command log:', err));
}, 1000);
} }
function clearConfig() { function clearConfig() {
+8
View File
@@ -301,6 +301,8 @@ uint8_t stream_upload(uint16_t bptr)
print_string("Checksum incorrect!"); print_string("Checksum incorrect!");
} }
print_string("\nUpload to flash done, will reset!\n"); print_string("\nUpload to flash done, will reset!\n");
// close connection to avoid retries by browser
uip_close();
reset_chip(); reset_chip();
} }
// Make sure there is a 0 at the end of the uploaded data // Make sure there is a 0 at the end of the uploaded data
@@ -310,6 +312,9 @@ uint8_t stream_upload(uint16_t bptr)
flash_write_bytes(flash_buf); flash_write_bytes(flash_buf);
if (bptr >= uip_len) if (bptr >= uip_len)
return 0; return 0;
if(!verify_crc)
//ugly hack to signal connection finished after config upload.
uip_close();
return 1; return 1;
} }
if (p[bptr] == boundary[bindex]) { if (p[bptr] == boundary[bindex]) {
@@ -593,6 +598,9 @@ void httpd_appcall(void)
send_config(); send_config();
} else if (is_word(q, "/cmd_log")) { } else if (is_word(q, "/cmd_log")) {
send_cmd_log(); send_cmd_log();
} else if (is_word(q, "/cmd_log_clear")) {
clear_command_history();
send_mtu(); // dummy response
} else { } else {
send_not_found(); send_not_found();
} }