jyberg / Enhanced-Nextion-Library

Enhanced Nextion library for Arduino, NodeMcu, Esp8266,...
MIT License
47 stars 23 forks source link

setValue 2 or 4 bytes? - mega2560 #2

Closed shvarevbear closed 4 years ago

shvarevbear commented 4 years ago

Thank you very much for quick response. I had to modify NexVariable in order to send int32_t or uinit32_t to Nextion as follows. This worked for ITEAD library as well. Otherwise only two bytes were sent. Is it correct? As far as I know itoa on Arduino works only for 16-bits numbers

bool NexVariable::setValue(int32_t number) { //buffer size of 10 gets Mega2560 to hang up char buf[20] = {0}; String cmd; //change itoa to ltoa ltoa(number, buf, 10);

jyberg commented 4 years ago

hi, yes I need to go thru itoa function call, I use primary NodeMCU as my dev baoad and there int data type is 32bit but in arduino it is 16bit number, so looks like ltoa is correct function in general as long seems to be 32bit value and for unsigned 32bit integer ultoa function also buffer size 10 is too small for max / min values it needs to be 12 chars. I will do corrections in some point.

shvarevbear commented 4 years ago

Sorry, I submitted a second issue which turns out to be just a serial traffic problem. Without admin rights I cannot delete it. Could you remove it, please?

вт, 19 нояб. 2019 г., 13:22 Jyrki Berg notifications@github.com:

hi, yes I need to go thru itoa function call, I use primary NodeMCU as my dev baoad and there int data type is 32bit but in arduino it is 16bit number, so looks like ltoa is correct function in general as long seems to be 32bit value and for unsigned 32bit integer ultoa function also buffer size 10 is too small for max / min values it needs to be 12 chars. I will do corrections in some point.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jyberg/Enhanced-Nextion-Library/issues/2?email_source=notifications&email_token=AMW4V7IV72AASMAKCVKW2KDQUO47HA5CNFSM4JPASFQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEENVBMA#issuecomment-555438256, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMW4V7L4WTVW3EFMED52GKTQUO47HANCNFSM4JPASFQA .

jyberg commented 4 years ago

Corrected on version: 0.11.1