mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Clear command log after saving.
This commit is contained in:
@@ -993,7 +993,13 @@ void execute_config(void) __banked
|
||||
config_done:
|
||||
// Start saving commands to cmd_history
|
||||
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++)
|
||||
cmd_history[cmd_history_ptr] = 0;
|
||||
cmd_history_ptr = 0;
|
||||
return;
|
||||
}
|
||||
@@ -12,4 +12,5 @@ uint8_t cmd_tokenize(void) __banked;
|
||||
void cmd_parser(void) __banked;
|
||||
void execute_config(void) __banked;
|
||||
void print_sw_version(void) __banked;
|
||||
void clear_command_history(void) __banked;
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,12 @@ async function flashSave() {
|
||||
var configContent = document.getElementById("config_display").value;
|
||||
console.log("CONFIGURATION to save: ", 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() {
|
||||
|
||||
@@ -301,6 +301,8 @@ uint8_t stream_upload(uint16_t bptr)
|
||||
print_string("Checksum incorrect!");
|
||||
}
|
||||
print_string("\nUpload to flash done, will reset!\n");
|
||||
// close connection to avoid retries by browser
|
||||
uip_close();
|
||||
reset_chip();
|
||||
}
|
||||
// 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);
|
||||
if (bptr >= uip_len)
|
||||
return 0;
|
||||
if(!verify_crc)
|
||||
//ugly hack to signal connection finished after config upload.
|
||||
uip_close();
|
||||
return 1;
|
||||
}
|
||||
if (p[bptr] == boundary[bindex]) {
|
||||
@@ -593,6 +598,9 @@ void httpd_appcall(void)
|
||||
send_config();
|
||||
} else if (is_word(q, "/cmd_log")) {
|
||||
send_cmd_log();
|
||||
} else if (is_word(q, "/cmd_log_clear")) {
|
||||
clear_command_history();
|
||||
send_mtu(); // dummy response
|
||||
} else {
|
||||
send_not_found();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user