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

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