Achronite / energenie-ener314rt

Node module for RaspberryPi energenie ener314-rt board, used by node-red-contrib-energenie-ener314rt
MIT License
4 stars 2 forks source link

ookSwitch returns number of messages in buffer #32

Closed Achronite closed 6 months ago

Achronite commented 1 year ago

The ookSwitch function sometimes returns a non-zero value when there were messages in the Rx buffer when called. This is not documented very well. For example mqtt-energenie-ener314rt (before v0.5) checked for non-zero return code, and logs an error if non-zero. This is believed to be the dodgy code:

/*
** flush Rx buffer if required
*/
ret = empty_radio_Rx_buffer(DT_CONTROL);
Achronite commented 8 months ago

The record count is used in openthings_scan() to return messages before timeout reached. So the solution should be to change ookSwitch to ignore record count