I want to show float values on Menu but how? #162
-
Hey guys, I have 3 each max31865 module to measure temperatures.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
Try this LcdMenu menu(LCD_ROWS, LCD_COLS);
MAIN_MENU(
ITEM_SUBMENU("Relay Test", relayTest),
ITEM_SUBMENU("Temp. Observing", tempObs)
);
// Sub Menu 1: Relays
SUB_MENU(relayTest, mainMenu,
ITEM_TOGGLE("Trig Relay 1", toggleRelay1),
ITEM_TOGGLE("Trig Relay 2", toggleRelay2),
ITEM_TOGGLE("Trig Relay 3", toggleRelay3)
);
SUB_MENU(tempObs, mainMenu,
ITEM_BASIC(""),
ITEM_BASIC(""),
ITEM_BASIC("")
);
static void tempMeas(void* pvParameters) {
(void)pvParameters;
char buffer[8]; // Buffer big enough for 7-character float
for (;;) {
temperature1 = thermo1.temperature(RNOMINAL, RREF);
temperature2 = thermo2.temperature(RNOMINAL, RREF);
temperature3 = thermo3.temperature(RNOMINAL, RREF);
menu[2]->getSubMenu()[1]->setText(dtostrf(temperature1, 6, 2, buffer)); // value, width, precision, buffer
menu[2]->getSubMenu()[2]->setText(dtostrf(temperature2, 6, 2, buffer)); // value, width, precision, buffer
menu[2]->getSubMenu()[3]->setText(dtostrf(temperature3, 6, 2, buffer)); // value, width, precision, buffer
vTaskDelay(1000);
}
} |
Beta Was this translation helpful? Give feedback.
-
Have a look at this gist https://gist.github.com/forntoh/25044b0bfb3271321a718bdac84654c5 and adapt your code accordingly. Here's a video of it working Screen.Recording.2024-02-21.at.00.32.42.mov |
Beta Was this translation helpful? Give feedback.
Have a look at this gist https://gist.github.com/forntoh/25044b0bfb3271321a718bdac84654c5 and adapt your code accordingly.
I used random float numbers to illustrate how it works since I don't know your circuit and don't have all the electronics you used.
Here's a video of it working
Screen.Recording.2024-02-21.at.00.32.42.mov