1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 11:20:19 +00:00

Added the dropdown-Control

* added the Control
* added the frontend-code
* added the control to the examples "gui-newAPI.ino" and "tabbedGui.ino"
This commit is contained in:
Christian Riggenbach
2019-03-04 21:07:39 +01:00
parent 3c42b43fe6
commit 6178e4fc22
15 changed files with 156 additions and 17 deletions

View File

@ -370,6 +370,10 @@ void onWsEvent( AsyncWebSocket* server, AsyncWebSocketClient* client,
String value = msg.substring( msg.indexOf( ':' ) + 1, msg.lastIndexOf( ':' ) );
ESPUI.updateText( c->id, value, client->id() );
c->callback( c, T_VALUE );
} else if ( msg.startsWith( "svalue:" ) ) {
String value = msg.substring( msg.indexOf( ':' ) + 1, msg.lastIndexOf( ':' ) );
ESPUI.updateSelect( c->id, value, client->id() );
c->callback( c, S_VALUE );
} else {
if ( ESPUI.verbosity ) {
Serial.println( "Malformated message from the websocket" );
@ -601,6 +605,14 @@ void ESPUIClass::updateText( String label, String text, int clientId ) {
updateControl( label, text, clientId );
}
void ESPUIClass::updateSelect( uint16_t id, String text, int clientId ) {
updateControl( id, text, clientId );
}
void ESPUIClass::updateSelect( String label, String text, int clientId ) {
updateControl( label, text, clientId );
}
/*
Convert & Transfer Arduino elements to JSON elements
Initially this function used to send the control element data individually.