s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with tabbed.

Atorcha opened this issue · comments

Hello, I am making my project using this library but when I try to write like tabbedgui I found an error.

auto maintab = ESPUI.addControl(Tab, "", "Estado"); ESPUI.addControl(Separator, "General controls", "", None, maintab); tempHBLabelId = ESPUI.addControl(Label,"Temperatura habitacion", ControlColor::Turquoise, maintab, String (tempHB)); humedadLabelId = ESPUI.addControl(Label,"Humedad habitacion", ControlColor::Turquoise, maintab, String (humedad)); realtime_LabelId= ESPUI.addControl(Label,"HORA:", ControlColor::Emerald, maintab, realtime);

cap

If you look at the prototypes for addControl you'll see that the options are:

    uint16_t addControl(ControlType type, const char* label);
    uint16_t addControl(ControlType type, const char* label, const String& value);
    uint16_t addControl(ControlType type, const char* label, const String& value, ControlColor color);
    uint16_t addControl(ControlType type, const char* label, const String& value, ControlColor color, uint16_t parentControl);
    uint16_t addControl(ControlType type, const char* label, const String& value, ControlColor color, uint16_t parentControl, void (*callback)(Control*, int));
    uint16_t addControl(ControlType type, const char* label, const String& value, ControlColor color, uint16_t parentControl, void (*callback)(Control*, int, void *), void* UserData);

None of those match with what you're trying to do on line 89, hence the error that there is no matching function for the call.

Thanks for your answer but It´s hard to me understand the library.

I am trying to make a project to control an aquarium, so I need that some label will be updated and that I can enter some parameters for example to enter the temperature of water.

So there will be some cards in the main tab, like temperatures and other cards in other tab to enter the temperature of the water that I want or the time that i want lights ON or OFF.

humedadLabelId = ESPUI.label("Humedad habitacion", ControlColor::Turquoise, String (humedad));
realtime_LabelId= ESPUI.label("HORA:", ControlColor::Emerald, realtime);

in main tab

So, I am trying to unterstand you .... regards

I am trying to understand the meaning of callbacks, for example. i need a different void callback for every data that I want to pass to web?

A callback is a function that is executed every time that the attached control is interacted with. So a button callback runs when the button is clicked.

If you attach the same callback to 2 different buttons, then those buttons will call the same function on the ESP, so you probably want to use different callbacks for each feature.

(There is actually a way to avoid this but don't worry about that for now.)

So, then what is the best way to show the temperature in the main tab?

tempHB = dht.readTemperature(); // Read temperature as Celsius
tempHBLabelId = ESPUI.addControl(Label,"Temperatura habitacion","", ControlColor::Turquoise, maintab);

inside loop:

ESPUI.print(tempHBLabelId, String (tempHB));

???

Now it works good…

OK glad to hear it!