diff --git a/code/espurna/config/webui.h b/code/espurna/config/webui.h index e7ce37ef..f16cd243 100644 --- a/code/espurna/config/webui.h +++ b/code/espurna/config/webui.h @@ -7,6 +7,7 @@ #define WEBUI_IMAGE_SENSOR 2 #define WEBUI_IMAGE_RFBRIDGE 4 #define WEBUI_IMAGE_RFM69 8 +#define WEBUI_IMAGE_LIGHTFOX 16 #define WEBUI_IMAGE_FULL 15 #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE @@ -45,6 +46,13 @@ #endif #endif +#if defined(FOXEL_LIGHTFOX_DUAL) + #ifdef WEBUI_IMAGE + #undef WEBUI_IMAGE + #endif + #define WEBUI_IMAGE WEBUI_IMAGE_LIGHTFOX +#endif + #ifndef WEBUI_IMAGE #define WEBUI_IMAGE WEBUI_IMAGE_SMALL #endif @@ -67,6 +75,9 @@ PROGMEM const char espurna_webui[] = #if WEBUI_IMAGE == WEBUI_IMAGE_RFM69 "RFM69" #endif + #if WEBUI_IMAGE == WEBUI_IMAGE_LIGHTFOX + "LIGHTFOX" + #endif #if WEBUI_IMAGE == WEBUI_IMAGE_FULL "FULL" #endif diff --git a/code/espurna/data/index.all.html.gz b/code/espurna/data/index.all.html.gz index 04076210..8c394f9d 100644 Binary files a/code/espurna/data/index.all.html.gz and b/code/espurna/data/index.all.html.gz differ diff --git a/code/espurna/data/index.light.html.gz b/code/espurna/data/index.light.html.gz index 6066b94b..c4c1a19b 100644 Binary files a/code/espurna/data/index.light.html.gz and b/code/espurna/data/index.light.html.gz differ diff --git a/code/espurna/data/index.lightfox.html.gz b/code/espurna/data/index.lightfox.html.gz new file mode 100644 index 00000000..4fe2fd40 Binary files /dev/null and b/code/espurna/data/index.lightfox.html.gz differ diff --git a/code/espurna/data/index.rfbridge.html.gz b/code/espurna/data/index.rfbridge.html.gz index d4a5d0e5..6a682f67 100644 Binary files a/code/espurna/data/index.rfbridge.html.gz and b/code/espurna/data/index.rfbridge.html.gz differ diff --git a/code/espurna/data/index.rfm69.html.gz b/code/espurna/data/index.rfm69.html.gz index 93267bec..ad3a1ad9 100644 Binary files a/code/espurna/data/index.rfm69.html.gz and b/code/espurna/data/index.rfm69.html.gz differ diff --git a/code/espurna/data/index.sensor.html.gz b/code/espurna/data/index.sensor.html.gz index 6ac9bcb7..31134e80 100644 Binary files a/code/espurna/data/index.sensor.html.gz and b/code/espurna/data/index.sensor.html.gz differ diff --git a/code/espurna/data/index.small.html.gz b/code/espurna/data/index.small.html.gz index 240350ed..4fe2fd40 100644 Binary files a/code/espurna/data/index.small.html.gz and b/code/espurna/data/index.small.html.gz differ diff --git a/code/espurna/lightfox.ino b/code/espurna/lightfox.ino index e13220ec..c74a7c5c 100644 --- a/code/espurna/lightfox.ino +++ b/code/espurna/lightfox.ino @@ -49,6 +49,14 @@ void lightfoxClear() { void _lightfoxWebSocketOnSend(JsonObject& root) { root["lightfoxVisible"] = 1; + uint8_t buttonsCount = _buttons.size(); + root["lightfoxRelayCount"] = relayCount(); + JsonArray& rfb = root.createNestedArray("lightfoxButtons"); + for (byte id=0; id #include "static/index.rfbridge.html.gz.h" #elif WEBUI_IMAGE == WEBUI_IMAGE_RFM69 #include "static/index.rfm69.html.gz.h" +#elif WEBUI_IMAGE == WEBUI_IMAGE_LIGHTFOX + #include "static/index.lightfox.html.gz.h" #elif WEBUI_IMAGE == WEBUI_IMAGE_FULL #include "static/index.all.html.gz.h" #endif diff --git a/code/gulpfile.js b/code/gulpfile.js index 145b4fa9..a416958e 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -116,6 +116,7 @@ var buildWebUI = function(module) { modules['sensor'] = true; modules['rfbridge'] = true; modules['rfm69'] = false; // we will never be adding this except when building RFM69GW + modules['lightfox'] = false; // we will never be adding this except when building lightfox } else if ('small' !== module) { modules[module] = true; } @@ -187,6 +188,10 @@ gulp.task('webui_rfm69', function() { return buildWebUI('rfm69'); }); +gulp.task('webui_lightfox', function() { + return buildWebUI('lightfox'); +}); + gulp.task('webui_all', function() { return buildWebUI('all'); }); @@ -198,6 +203,7 @@ gulp.task('webui', function(cb) { 'webui_light', 'webui_rfbridge', 'webui_rfm69', + 'webui_lightfox', 'webui_all' ], cb); }); diff --git a/code/html/custom.css b/code/html/custom.css index 97d88f5e..49023221 100644 --- a/code/html/custom.css +++ b/code/html/custom.css @@ -158,6 +158,7 @@ div.state { .button-reconnect, .button-ha-del, .button-rfb-forget, +.button-lightfox-clear, .button-del-network, .button-del-mapping, .button-del-schedule, @@ -176,6 +177,7 @@ div.state { .button-add-mapping, .button-upgrade-browse, .button-rfb-learn, +.button-lightfox-learn, .button-ha-add, .button-ha-config, .button-settings-backup, diff --git a/code/html/custom.js b/code/html/custom.js index f10f4d2c..9c34c8b4 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -1140,6 +1140,48 @@ function addRfbNode() { } +// ----------------------------------------------------------------------------- +// LightFox +// ----------------------------------------------------------------------------- + + + +function lightfoxLearn() { + sendAction("lightfoxLearn", {}); +} + +function lightfoxClear() { + sendAction("lightfoxClear", {}); +} + +function initLightfox(data, relayCount) { + + var numNodes = data.length; + + var template = $("#lightfoxNodeTemplate").children(); + + var i, j; + for (i=0; i span").text(data[i]["id"]); + $line.find("select").each(function() { + $(this).attr("name", "btnRelay" + data[i]["id"]); + for (j=0; j < relayCount; j++) { + $(this).append($("