mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-13 03:09:51 +03:00
tx_mode resets counts
This commit is contained in:
@@ -405,7 +405,8 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only process broadcast telegrams or ones sent to us on request or ones sent to a modem device (like the KM200)
|
// only process broadcast telegrams or ones sent to us on request or ones sent to a modem device (like the KM200)
|
||||||
if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id()) && (telegram->dest != EMSdevice::EMS_DEVICE_ID_MODEM)) {
|
// if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id()) && (telegram->dest != EMSdevice::EMS_DEVICE_ID_MODEM)) {
|
||||||
|
if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,18 +727,18 @@ void EMSESP::console_commands(Shell & shell, unsigned int context) {
|
|||||||
flash_string_vector{F_(set), F_(tx_mode)},
|
flash_string_vector{F_(set), F_(tx_mode)},
|
||||||
flash_string_vector{F_(n_mandatory)},
|
flash_string_vector{F_(n_mandatory)},
|
||||||
[](Shell & shell, const std::vector<std::string> & arguments) {
|
[](Shell & shell, const std::vector<std::string> & arguments) {
|
||||||
uint8_t tx_mode = std::strtol(arguments[0].c_str(), nullptr, 10);
|
uint8_t tx_mode = std::strtol(arguments[0].c_str(), nullptr, 10);
|
||||||
if ((tx_mode > 0) && (tx_mode <= 50)) {
|
Settings settings;
|
||||||
Settings settings;
|
settings.ems_tx_mode(tx_mode);
|
||||||
settings.ems_tx_mode(tx_mode);
|
settings.commit();
|
||||||
settings.commit();
|
shell.printfln(F_(tx_mode_fmt), settings.ems_tx_mode());
|
||||||
shell.printfln(F_(tx_mode_fmt), settings.ems_tx_mode());
|
// reset counters
|
||||||
// reset the UART
|
txservice_.telegram_read_count(0);
|
||||||
EMSuart::stop();
|
txservice_.telegram_write_count(0);
|
||||||
EMSuart::start(tx_mode);
|
txservice_.telegram_fail_count(0);
|
||||||
} else {
|
// reset the UART
|
||||||
shell.println(F("Must be 1 for EMS generic, 2 for EMS+, 3 for HT3, 4 for experimental"));
|
EMSuart::stop();
|
||||||
}
|
EMSuart::start(tx_mode);
|
||||||
});
|
});
|
||||||
|
|
||||||
EMSESPShell::commands->add_command(
|
EMSESPShell::commands->add_command(
|
||||||
|
|||||||
@@ -294,6 +294,10 @@ class TxService : public EMSbus {
|
|||||||
return telegram_read_count_;
|
return telegram_read_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void telegram_read_count(uint8_t telegram_read_count) {
|
||||||
|
telegram_read_count_ = telegram_read_count;
|
||||||
|
}
|
||||||
|
|
||||||
void increment_telegram_read_count() {
|
void increment_telegram_read_count() {
|
||||||
telegram_read_count_++;
|
telegram_read_count_++;
|
||||||
}
|
}
|
||||||
@@ -302,6 +306,10 @@ class TxService : public EMSbus {
|
|||||||
return telegram_fail_count_;
|
return telegram_fail_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void telegram_fail_count(uint8_t telegram_fail_count) {
|
||||||
|
telegram_fail_count_ = telegram_fail_count;
|
||||||
|
}
|
||||||
|
|
||||||
void increment_telegram_fail_count() {
|
void increment_telegram_fail_count() {
|
||||||
telegram_fail_count_++;
|
telegram_fail_count_++;
|
||||||
}
|
}
|
||||||
@@ -310,6 +318,10 @@ class TxService : public EMSbus {
|
|||||||
return telegram_write_count_;
|
return telegram_write_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void telegram_write_count(uint8_t telegram_write_count) {
|
||||||
|
telegram_write_count_ = telegram_write_count;
|
||||||
|
}
|
||||||
|
|
||||||
void increment_telegram_write_count() {
|
void increment_telegram_write_count() {
|
||||||
telegram_write_count_++;
|
telegram_write_count_++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "2.0.0a25"
|
#define EMSESP_APP_VERSION "2.0.0a26"
|
||||||
|
|||||||
Reference in New Issue
Block a user