arduino-libs-manchester icon indicating copy to clipboard operation
arduino-libs-manchester copied to clipboard

Receive may not change data

Open cosmicfrogpt opened this issue 4 years ago • 2 comments

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

...

cosmicfrogpt avatar Oct 04 '20 12:10 cosmicfrogpt

Hello! Which lines did you changed?

darkmetalman avatar Apr 14 '21 06:04 darkmetalman

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

cosmicfrogpt avatar Apr 16 '21 15:04 cosmicfrogpt