Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
NexNumber setValue, getValue not working correctly #36
MCU: Arduino ATMEGA 2560
See attached test case: setValue and getValue do not work correctly for values bigger than 32767 on 8 bit systems.
To make at least setValue work correctly, I had to change NexNumber.cpp line 36 from 'utoa' to 'ultoa'. All in all, I am wondering if in setValue the size of the variable 'buffer' is big enough. The max value of uint32_t is supposed to be 4294967296. These are already 10 digits, and the string previx "obj.val=" is still missing. So 'buffer' seems to be far too small and we are risiking a buffer overflow, aren't we?
With the above changes, I could make at least setValue work. But getValue still does not work although the code in NexHardware.cpp recvRetNumber, line 45 seems to be correct and ready for 4 byte uint32_t's. What's going on on the Nextion display side?