poll from milli to micro secs for better accuracy

This commit is contained in:
proddy
2019-05-25 11:21:13 +02:00
parent 6995516ce0
commit 9ce1a5b488
2 changed files with 6 additions and 5 deletions

View File

@@ -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);

View File

@@ -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;