Update the latest value in ITEM_INPUT #144
-
Hello, I am new to this library and I am working on a project that involves calculating the area of either a rectangle or a circle. I have three variables: Length, Breadth, and Diameter. To facilitate the calculation, I've set up a system where I can input values for these dimensions. However, I've encountered a problem where entering a value for Length works fine, but when I input a value for Breadth, it seems to overwrite the Length value. The same issue occurs with Diameter. I debugged it a bit and found out that it is successfully storing the inputs in the variable but not updating it on the Lcd Screen rather the value that is being inputted globally is updated. Heres the snippet of my code:
Above is the definition for my menu.
Converting the string to an integer and storing it in a variable:
I have referred to the ItemInput example for character sets and managed to input values accordingly. However, the issue with values overwriting each other remains unresolved. Note that I have checked that all my connections are correct and the buttons are pressed correctly. The code also runs without any errors. Any guidance or suggestions to correct this behavior would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I added a few helpers in v3.5.0, they should help you. Your code could become something like this processMenuCommand(
menu,
command,
debounce(BUTTON_UP),
debounce(BUTTON_DOWN),
debounce(BUTTON_ENTER),
debounce(BUTTON_BACK)
); I don't know what your debounce function does/returns but in theory, it should work. I'd prefer to use a function that reads the button and returns the current state/action to perform. e.g. https://forum.arduino.cc/t/debounced-button-reading-help/599533/6 |
Beta Was this translation helpful? Give feedback.
-
I ran into the same issue. I don't think it has anything to do with debounce or using processMenuCommand.
I managed to find a workaround, but to be honest have no idea why it works. I use two different arrays as initial values for the two ITEM_INPUT objects:
|
Beta Was this translation helpful? Give feedback.
-
I don't think so. I probably wasn't clear enough with my workaround. The two arrays are different in content, not only names (instances).
This also DOES NOT work:
Notice that the contents of the two arrays are different in the example that does work (one is filled with '\0', the other with ''). |
Beta Was this translation helpful? Give feedback.
-
Fixed in v3.5.2 🚀Issue #158 |
Beta Was this translation helpful? Give feedback.
Fixed in v3.5.2 🚀
Issue #158