ninjablocks / 433Utils

433Kit is a collection of code and documentation designed to assist you in the connection and usage of RF 433MHz transmit and receive modules to/with your Arduino and Rapberry Pi.
ninjablocks.com
MIT License
899 stars 335 forks source link

Issue sending negative code #66

Open kiki51 opened 4 years ago

kiki51 commented 4 years ago

Hi

I use rpiutils tools to send and receive code over 433mhz with my remote/plug.

I use it under home assistant to power on /off my plug. It replace my remote.

I have buy another set of remote and plug ( otio model. Ref 09ha2) which works fine. But when I use rfsniffer command to find the remote code sent by the remote, the result is a negative code like : -1094193664.

After that I use codesend with this code and the sniffer return : Received 13102592.

So I can’t send a negative code, it’s translate like a positive code. And it doesn’t work.

Can you help me to solve this trouble? Thanks. Sorry for my bad English. Eric

Henykau94 commented 4 years ago

I have the same problem can someone please help

SiberaIndustries commented 1 year ago

The reason for the negative values is called "integer overflow". Your transmitter sends a code higher than the current data type (signed integer) can store, its like you want to count to 6 with 1 hand. You can count to 5 and then you have to start again for 5 to 6. Here its a signed int [-2147483648, +2147483647], just a bigger number.

Fixed it in #81 or check it out here