DanNixon / NeoNextion

Arduino library for the Nextion displays
https://dannixon.github.io/NeoNextion
GNU General Public License v2.0
48 stars 34 forks source link

Nextion.refresh(objectName) Command Buffer too small #12

Closed pbeyl closed 8 years ago

pbeyl commented 8 years ago

Hi Dan

Thanks for the awesome library! Picked up a small issue with the bool Nextion::refresh(const char *objectName) function in Nextion.cpp

size_t commandLen = 4 + strlen(objectName);

Should be changed to size_t commandLen = 5 + strlen(objectName);

4 does not leave enough room in the buffer for ("ref ") plus NULL character in array and so the command is truncated. Call this function after changing the background colour of a text object to ensure the colour change is displayed.

P

DanNixon commented 8 years ago

Good catch.

Could you give the proposed change a test as I haven't got any hardware to test with to hand right now.

pbeyl commented 8 years ago

Thanks Dan

Took me a little while to track this issue down... Works perfectly, I downloaded the updated file and tested on my current project using Arduino Uno + Nextion 2.8.

Serial monitor confirms it's working as expected. d5.bco=1024���ref d5���d6.bco=1024���ref d6���d7.bco=1024���ref d7���

/P

DanNixon commented 8 years ago

Cool. thanks for reporting this!