mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
F-commands to flash and display them
This commit is contained in:
@@ -133,6 +133,14 @@ void Shell::loop_one() {
|
||||
}
|
||||
}
|
||||
|
||||
void Shell::set_command_str(const __FlashStringHelper * str) {
|
||||
line_buffer_ = read_flash_string(str);
|
||||
erase_current_line();
|
||||
prompt_displayed_ = false;
|
||||
display_prompt();
|
||||
process_command();
|
||||
}
|
||||
|
||||
void Shell::loop_normal() {
|
||||
const int input = read_one_char();
|
||||
|
||||
@@ -246,20 +254,17 @@ void Shell::loop_normal() {
|
||||
cursor_ = line_buffer_.length();
|
||||
} else if (esc_ == 11) {
|
||||
// F1 and F10
|
||||
line_buffer_ = "help";
|
||||
process_command();
|
||||
set_command_str(F("help"));
|
||||
} else if (esc_ == 12) {
|
||||
// F2
|
||||
line_buffer_ = "show";
|
||||
process_command();
|
||||
set_command_str(F("show"));
|
||||
} else if (esc_ == 20) {
|
||||
// F9
|
||||
line_buffer_ = "send telegram \"0B \"";
|
||||
line_buffer_ = read_flash_string(F("send telegram \"0B \""));
|
||||
cursor_ = 1;
|
||||
} else if (esc_ == 21) {
|
||||
// F10
|
||||
line_buffer_ = "call system report";
|
||||
process_command();
|
||||
set_command_str(F("call system report"));
|
||||
}
|
||||
esc_ = 0;
|
||||
} else {
|
||||
|
||||
@@ -892,6 +892,7 @@ class Shell : public std::enable_shared_from_this<Shell>, public uuid::log::Hand
|
||||
* @since 0.1.0
|
||||
*/
|
||||
size_t vprintf(const __FlashStringHelper * format, va_list ap);
|
||||
void set_command_str(const __FlashStringHelper * str);
|
||||
|
||||
static const uuid::log::Logger logger_; /*!< uuid::log::Logger instance for shells. @since 0.1.0 */
|
||||
static std::set<std::shared_ptr<Shell>> shells_; /*!< Registered running shells to be executed. @since 0.1.0 */
|
||||
|
||||
@@ -917,7 +917,7 @@ void EMSESP::start() {
|
||||
|
||||
emsdevices.reserve(5); // reserve space for initially 5 devices to avoid mem
|
||||
|
||||
LOG_INFO("EMS Device library loaded with %d records", device_library_.size());
|
||||
LOG_INFO(F("EMS Device library loaded with %d records"), device_library_.size());
|
||||
|
||||
#if defined(EMSESP_STANDALONE)
|
||||
mqtt_.on_connect(); // simulate an MQTT connection
|
||||
|
||||
@@ -61,7 +61,7 @@ bool System::command_send(const char * value, const int8_t id) {
|
||||
|
||||
// restart EMS-ESP
|
||||
void System::restart() {
|
||||
LOG_NOTICE("Restarting system...");
|
||||
LOG_NOTICE(F("Restarting system..."));
|
||||
Shell::loop_all();
|
||||
delay(1000); // wait a second
|
||||
#if defined(ESP8266)
|
||||
@@ -73,7 +73,7 @@ void System::restart() {
|
||||
|
||||
// saves all settings
|
||||
void System::wifi_reconnect() {
|
||||
LOG_NOTICE("The wifi will reconnect...");
|
||||
LOG_NOTICE(F("The wifi will reconnect..."));
|
||||
Shell::loop_all();
|
||||
delay(1000); // wait a second
|
||||
EMSESP::webSettingsService.save(); // local settings
|
||||
|
||||
Reference in New Issue
Block a user