s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266
https://valencia.lbsfilm.at/midterm-presentation/
Other
898 stars 166 forks source link

Complete Example-Time Control is not working #248

Open garudaonekh opened 1 year ago

garudaonekh commented 1 year ago

Hi CompleteExample line 129: mainTime = ESPUI.addControl(Time, "", "", None, 0, generalCallback);

In controls.js, it'll fire error unknown Event because Time is not recognized.

thanks

iangray001 commented 1 year ago

Well it shouldn't do because it is in controls.js.

What, specifically, is the error?

garudaonekh commented 1 year ago

In handlEvent function, there is no case for UI_TIME, so Line 605 is fired

iangray001 commented 1 year ago

Ah right, unless something has change in the meantime, you should notice that it still actually works though - it is just outputting an error incorrectly. I guess we never noticed it was outputting the message on the console log.

The TIME control doesn't actually need anything adding to the DOM, as you will see from looking in addToHTML(). The message can be silenced by adding another case here.

            case UI_GAUGE:
            case UI_SEPARATOR:
            case UI_TIME: 
                if (data.visible) addToHTML(data);
                break;

and then addToHTML will do nothing but there will also be no output on the console.

iangray001 commented 1 year ago

Note: Minor fix to merge in when someone gets a chance