mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
reset_tx() takes tx_mode from settings file
This commit is contained in:
@@ -110,8 +110,6 @@ void EMSESPShell::add_console_commands() {
|
|||||||
flash_string_vector{F_(fetch)},
|
flash_string_vector{F_(fetch)},
|
||||||
[&](Shell & shell, const std::vector<std::string> & arguments __attribute__((unused))) {
|
[&](Shell & shell, const std::vector<std::string> & arguments __attribute__((unused))) {
|
||||||
shell.printfln(F("Requesting data from EMS devices"));
|
shell.printfln(F("Requesting data from EMS devices"));
|
||||||
console_commands_loaded_ = false;
|
|
||||||
add_console_commands();
|
|
||||||
EMSESP::fetch_device_values();
|
EMSESP::fetch_device_values();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,7 +182,7 @@ void EMSESPShell::add_console_commands() {
|
|||||||
return StateUpdateResult::CHANGED;
|
return StateUpdateResult::CHANGED;
|
||||||
},
|
},
|
||||||
"local");
|
"local");
|
||||||
EMSESP::reset_tx(tx_mode); // reset counters and set tx_mode
|
EMSESP::reset_tx(); // reset counters and set tx_mode
|
||||||
});
|
});
|
||||||
|
|
||||||
commands->add_command(ShellContext::MAIN,
|
commands->add_command(ShellContext::MAIN,
|
||||||
@@ -515,7 +513,6 @@ void Console::start() {
|
|||||||
shell = std::make_shared<EMSESPStreamConsole>(serial_console_, true);
|
shell = std::make_shared<EMSESPStreamConsole>(serial_console_, true);
|
||||||
shell->maximum_log_messages(100); // default is 50
|
shell->maximum_log_messages(100); // default is 50
|
||||||
shell->start();
|
shell->start();
|
||||||
// shell->log_level(uuid::log::Level::DEBUG); // order is: err, warning, notice, info, debug, trace, all
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
|
|||||||
@@ -110,13 +110,16 @@ void EMSESP::watch_id(uint16_t watch_id) {
|
|||||||
|
|
||||||
// change the tx_mode
|
// change the tx_mode
|
||||||
// resets all counters and bumps the UART
|
// resets all counters and bumps the UART
|
||||||
void EMSESP::reset_tx(uint8_t const tx_mode) {
|
void EMSESP::reset_tx() {
|
||||||
EMSuart::stop();
|
// get the tx_mode
|
||||||
|
uint8_t tx_mode;
|
||||||
|
EMSESP::emsespSettingsService.read([&](EMSESPSettings & settings) { tx_mode = settings.tx_mode; });
|
||||||
|
|
||||||
|
EMSuart::stop();
|
||||||
|
EMSuart::start(tx_mode);
|
||||||
txservice_.start();
|
txservice_.start();
|
||||||
|
|
||||||
EMSuart::start(tx_mode);
|
// force a fetch for all new values, unless Tx is set to off
|
||||||
|
|
||||||
if (tx_mode != 0) {
|
if (tx_mode != 0) {
|
||||||
EMSESP::fetch_device_values();
|
EMSESP::fetch_device_values();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class EMSESP {
|
|||||||
|
|
||||||
static void add_context_menus();
|
static void add_context_menus();
|
||||||
|
|
||||||
static void reset_tx(uint8_t const tx_mode);
|
static void reset_tx();
|
||||||
|
|
||||||
static void incoming_telegram(uint8_t * data, const uint8_t length);
|
static void incoming_telegram(uint8_t * data, const uint8_t length);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user