gslc_ElemSetTxtStr not updating the text #386
-
Hi Properties of the text from GUISlice Builder: The code from Arduino IDE (snipped):
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@PrattTechnologies While acTxt will hold MAX_STR, pElemDol1 will only hold 6 characters plus the null so that's a dangerous way to code. No point in using snprintf if using MAX_STR as the gate value. Try,
Note the missing quotes around acTxt. Now all that said you still should have gotten "acTxt" as a string output on your display. You also might want to read the Builder's faq to see how to place numbers into a dynamic text field since snprintf won't do that with an Arduino. |
Beta Was this translation helpful? Give feedback.
-
@elmosolutions Yes, its still the same mistake.
You are trying to replace flash storage "99.9" length "0" which is READ-ONLY. If you are using the Builder then for this field's property values set:
This should create lines in your *_GSLC.h file something like:
Note static char m_sDisplayText9[8] is now created in SRAM writeable memory and GUIslice's gslc_ElemCreateTxt(() storage length is changed from 0 to 8! now in your loop() not in the InitGUIslice_gen() you can use
Good luck! |
Beta Was this translation helpful? Give feedback.
-
@elmosolutions No. if a an object is declared const than its in flash, like const int, const char, or in your case (char*)"99.9" etc... |
Beta Was this translation helpful? Give feedback.
@PrattTechnologies While acTxt will hold MAX_STR, pElemDol1 will only hold 6 characters plus the null so that's a dangerous way to code. No point in using snprintf if using MAX_STR as the gate value. Try,
Note the missing quotes around acTxt.
Now all that said you still should have gotten "acTxt" as a string output on your display.
If not, zip the entire project folder and post it so we can see what is going on.
You also might want to read the Builder's faq to see how to place numbers into a dynamic text field since snprintf won't do that with an Arduino.
Paul--