arduino-libs-manchester
arduino-libs-manchester copied to clipboard
Receive may not change data
Hello, thank you for your code. It was very useful for some experiments with Conrad TX-01 temperature sensor although i had to make some changes)
I found that the receive code can sometimes not change the output data.
The bug is that the variable rx_curByte is incrementend correctly in the AddManBit function but only initialized on the program start.
It must be reseted when a complete receive is completed.
the following code resolves the problem (in the ISR):
... if ((rx_sample == 1) && (rx_curByte >= rx_maxBytes)) { rx_mode = RX_MODE_MSG;
//get ready for next receive !
rx_curByte = 0;
rx_manBits=0;
}
else
...
Hello! Which lines did you changed?
Hello! Which lines did you changed?
Hello, in my last experiments I changed this function(initialize lines):
MANRX_BeginReceiveBytes(uint8_t maxBytes, uint8_t *data) { rx_curByte = 0;//initialize rx_numMB=0;//initialize rx_manBits=0;
rx_maxBytes = maxBytes; rx_data = data; rx_mode = RX_MODE_PRE; }