mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
show tx fails in ems sub-menu
This commit is contained in:
@@ -110,22 +110,22 @@ void EMSESP::trace_watch_id(uint16_t trace_watch_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the Rx and Tx queues
|
// show the EMS bus status plus both Rx and Tx queues
|
||||||
void EMSESP::show_emsbus(uuid::console::Shell & shell) {
|
void EMSESP::show_emsbus(uuid::console::Shell & shell) {
|
||||||
// EMS bus specific
|
// EMS bus information
|
||||||
if (rxservice_.bus_connected()) {
|
if (rxservice_.bus_connected()) {
|
||||||
uint8_t success_rate = 0;
|
uint8_t success_rate = 0;
|
||||||
if (rxservice_.telegram_error_count()) {
|
if (rxservice_.telegram_error_count()) {
|
||||||
success_rate = ((float)rxservice_.telegram_error_count() / (float)rxservice_.telegram_count()) * 100;
|
success_rate = ((float)rxservice_.telegram_error_count() / (float)rxservice_.telegram_count()) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.printfln(F("EMS Bus protocol: %s, #telegrams received: %d, #Read requests sent: %d, #Write requests sent: %d, #CRC errors: %d (%d%%)"),
|
shell.printfln(F("EMS Bus info:"));
|
||||||
EMSbus::is_ht3() ? F("HT3") : F("Buderus"),
|
shell.printfln(F(" Bus protocol: %s"), EMSbus::is_ht3() ? F("HT3") : F("Buderus"));
|
||||||
rxservice_.telegram_count(),
|
shell.printfln(F(" #telegrams received: %d"), rxservice_.telegram_count());
|
||||||
txservice_.telegram_read_count(),
|
shell.printfln(F(" #read requests sent: %d"), txservice_.telegram_read_count());
|
||||||
txservice_.telegram_write_count(),
|
shell.printfln(F(" #write requests sent: %d"), txservice_.telegram_write_count());
|
||||||
rxservice_.telegram_error_count(),
|
shell.printfln(F(" #CRC errors: %d (%d%%)"), rxservice_.telegram_error_count(), success_rate);
|
||||||
success_rate);
|
shell.printfln(F(" #Tx fails: %d"), txservice_.telegram_fail_count());
|
||||||
} else {
|
} else {
|
||||||
shell.printfln(F("EMS Bus is disconnected"));
|
shell.printfln(F("EMS Bus is disconnected"));
|
||||||
}
|
}
|
||||||
@@ -603,9 +603,9 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
|||||||
// So re-send the last Tx and increment retry count
|
// So re-send the last Tx and increment retry count
|
||||||
uint8_t retries = txservice_.retry_tx(); // returns 0 if exceeded count
|
uint8_t retries = txservice_.retry_tx(); // returns 0 if exceeded count
|
||||||
if (retries) {
|
if (retries) {
|
||||||
LOG_ERROR(F("Last Tx read failed. Retrying #%d..."), retries);
|
LOG_ERROR(F("Last Tx operation failed. Retrying #%d..."), retries);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(F("Last Tx read failed after %d retries. Abandoning Tx operation."), txservice_.MAXIMUM_TX_RETRIES);
|
LOG_ERROR(F("Last Tx operation failed after %d retries. Ignoring request."), txservice_.MAXIMUM_TX_RETRIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -611,10 +611,13 @@ void TxService::remember_tx(const uint8_t * data, const uint8_t length) {
|
|||||||
// returns retry count, or 0 if all done
|
// returns retry count, or 0 if all done
|
||||||
uint8_t TxService::retry_tx() {
|
uint8_t TxService::retry_tx() {
|
||||||
if (++retry_count_ == MAXIMUM_TX_RETRIES) {
|
if (++retry_count_ == MAXIMUM_TX_RETRIES) {
|
||||||
reset_retry_count(); // give up
|
reset_retry_count(); // give up
|
||||||
} else {
|
increment_telegram_fail_count(); // another Tx fail
|
||||||
add(telegram_last_, telegram_last_length_); // add the last Tx telegram to the tx queue, at the top
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add(telegram_last_, telegram_last_length_); // add the last Tx telegram to the tx queue, at the top
|
||||||
|
|
||||||
return retry_count_;
|
return retry_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -270,6 +270,14 @@ class TxService : public EMSbus {
|
|||||||
telegram_read_count_++;
|
telegram_read_count_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t telegram_fail_count() const {
|
||||||
|
return telegram_fail_count_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void increment_telegram_fail_count() {
|
||||||
|
telegram_fail_count_++;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t telegram_write_count() const {
|
uint16_t telegram_write_count() const {
|
||||||
return telegram_write_count_;
|
return telegram_write_count_;
|
||||||
}
|
}
|
||||||
@@ -312,6 +320,7 @@ class TxService : public EMSbus {
|
|||||||
const std::shared_ptr<const Telegram> telegram_last; // copy of last telegram
|
const std::shared_ptr<const Telegram> telegram_last; // copy of last telegram
|
||||||
uint16_t telegram_read_count_ = 0; // # Tx successful reads
|
uint16_t telegram_read_count_ = 0; // # Tx successful reads
|
||||||
uint16_t telegram_write_count_ = 0; // # Tx successful writes
|
uint16_t telegram_write_count_ = 0; // # Tx successful writes
|
||||||
|
uint16_t telegram_fail_count_ = 0; // # Tx unsuccessful transmits
|
||||||
|
|
||||||
uint8_t retry_count_ = 0; // count for # Tx retries
|
uint8_t retry_count_ = 0; // count for # Tx retries
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user