mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
poll from milli to micro secs for better accuracy
This commit is contained in:
@@ -339,7 +339,7 @@ void showInfo() {
|
||||
if (ems_getBusConnected()) {
|
||||
myDebug_P(PSTR(" Bus is connected"));
|
||||
|
||||
myDebug_P(PSTR(" Rx: Poll=%d ms, # Rx telegrams read=%d, # CRC errors=%d"), ems_getPollFrequency(), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr);
|
||||
myDebug_P(PSTR(" Rx: Poll=%d microsecs, # Rx telegrams read=%d, # CRC errors=%d"), ems_getPollFrequency(), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr);
|
||||
|
||||
if (ems_getTxCapable()) {
|
||||
myDebug_P(PSTR(" Tx: available, Tx delay is %d, # Tx telegrams sent=%d"), ems_getTxDelay(), EMS_Sys_Status.emsTxPkgs);
|
||||
|
||||
@@ -680,12 +680,13 @@ void _ems_readTelegram(uint8_t * telegram, uint8_t length) {
|
||||
// it could well be a Poll request from the boiler for us, which will have a value of 0x8B (0x0B | 0x80)
|
||||
// or either a return code like 0x01 or 0x04 from the last Write command
|
||||
if (length == 1) {
|
||||
uint8_t value = telegram[0]; // 1st byte of data package
|
||||
|
||||
EMS_Sys_Status.emsPollFrequency = (EMS_RxTelegram.timestamp - _last_emsPollFrequency);
|
||||
_last_emsPollFrequency = EMS_RxTelegram.timestamp;
|
||||
uint32_t timenow_microsecs = micros();
|
||||
EMS_Sys_Status.emsPollFrequency = (timenow_microsecs - _last_emsPollFrequency);
|
||||
_last_emsPollFrequency = timenow_microsecs;
|
||||
|
||||
// check first for a Poll for us
|
||||
uint8_t value = telegram[0]; // 1st byte of data package
|
||||
|
||||
if ((value & 0x7F) == EMS_ID_ME) {
|
||||
EMS_Sys_Status.emsTxCapable = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user