From 1583a5810ff7eb9b4e0ee12edfd8dc57a91ed2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 18 Jun 2018 14:44:42 +0200 Subject: [PATCH] Configure what HTML modules has each image --- code/extra_scripts.py | 10 +++++++ code/gulpfile.js | 14 +++++++++ code/platformio.ini | 70 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/code/extra_scripts.py b/code/extra_scripts.py index 1cb1ed4c..31baf56a 100644 --- a/code/extra_scripts.py +++ b/code/extra_scripts.py @@ -1,5 +1,6 @@ #!/usr/bin/env python from subprocess import call +from platformio import util import os import time @@ -58,6 +59,14 @@ def check_size(source, target, env): # print clr(Color.LIGHT_RED, "File too large for OTA!") # Exit(1) +def build_webui(source, target, env): + config = util.load_project_config() + try: + os.environ['MODULES'] = config.get("env:" + env.get('PIOENV'), "modules") + except: + None + call(["gulp"]) + # ------------------------------------------------------------------------------ # Hooks # ------------------------------------------------------------------------------ @@ -65,4 +74,5 @@ def check_size(source, target, env): remove_float_support() #env.AddPreAction("buildprog", cpp_check) +env.AddPreAction("$BUILD_DIR/src/espurna.ino.cpp.o", build_webui) env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size) diff --git a/code/gulpfile.js b/code/gulpfile.js index dd2c4ca2..49dd69a4 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -113,6 +113,20 @@ gulp.task('buildfs_inline', function() { light: false, rfbridge: false }; + var modules = process.env.MODULES || false; + if (modules) { + var list = modules.split(' '); + for (var i in list) { + if (list[i] != "") { + remover_config[list[i]] = true; + } + } + } else { + for (var i in remover_config) { + remover_config[i] = true; + } + } + log.info("[WEBUI] " + JSON.stringify(remover_config)); return gulp.src('html/*.html'). pipe(htmllint({ diff --git a/code/platformio.ini b/code/platformio.ini index 26f19492..139ac54f 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -79,6 +79,7 @@ lib_deps = https://github.com/xoseperez/Time lib_ignore = extra_scripts = extra_scripts.py +modules = # ------------------------------------------------------------------------------ # ESPURNA CORE BUILDS @@ -183,6 +184,7 @@ build_flags = ${common.build_flags_4m1m} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAU upload_speed = 460800 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = ${common.modules} [env:wemos-d1mini-relayshield-ssl] platform = espressif8266@1.6.0 @@ -240,7 +242,7 @@ upload_speed = 115200 upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 -extra_scripts = ${common.extra_scripts} +extra_scripts = ${common.extra_scripts # ------------------------------------------------------------------------------ # SPECIFIC BOARDS @@ -255,6 +257,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_4m1m} -DTINKERMAN_ESPURNA_H06 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:tinkerman-espurna-h06-ota] platform = ${common.platform} @@ -268,6 +271,8 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +extra_scripts = ${common.extra_scripts +modules = sensor [env:tinkerman-espurna-h08] platform = ${common.platform} @@ -278,6 +283,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_4m1m} -DTINKERMAN_ESPURNA_H08 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:tinkerman-espurna-h08-ota] platform = ${common.platform} @@ -291,6 +297,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:tinkerman-espurna-switch] platform = ${common.platform} @@ -311,6 +318,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_4m1m} -DWEMOS_D1_TARPUNA_SHIELD monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor # ------------------------------------------------------------------------------ @@ -349,6 +357,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_BASIC -DDHT_SUPPORT=1 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-basic-dht-ota] platform = ${common.platform} @@ -363,6 +372,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-basic-dallas] platform = ${common.platform} @@ -374,6 +384,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_BASIC -DDALLAS_SUPPORT=1 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-rf] platform = ${common.platform} @@ -435,6 +446,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_POW monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-pow-ota] platform = ${common.platform} @@ -449,6 +461,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-pow-r2] platform = ${common.platform} @@ -460,6 +473,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_POW_R2 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-pow-r2-ota] platform = ${common.platform} @@ -474,6 +488,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:itead-sonoff-dual] platform = ${common.platform} @@ -606,6 +621,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_B1 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:itead-sonoff-b1-ota] platform = ${common.platform} @@ -620,6 +636,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:itead-sonoff-t1-1ch] platform = ${common.platform} @@ -706,6 +723,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_LED monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:itead-sonoff-led-ota] platform = ${common.platform} @@ -720,6 +738,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:itead-sonoff-rfbridge] platform = ${common.platform} @@ -731,6 +750,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_RFBRIDGE monitor_speed = 19200 extra_scripts = ${common.extra_scripts} +modules = rfbridge [env:itead-sonoff-rfbridge-ota] platform = ${common.platform} @@ -745,6 +765,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 19200 extra_scripts = ${common.extra_scripts} +modules = rfbridge [env:itead-sonoff-rfbridge-direct] platform = ${common.platform} @@ -756,6 +777,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_RFBRIDGE -DRFB_DIRECT monitor_speed = 19200 extra_scripts = ${common.extra_scripts} +modules = rfbridge [env:itead-sonoff-rfbridge-direct-ota] platform = ${common.platform} @@ -770,6 +792,7 @@ upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 monitor_speed = 19200 extra_scripts = ${common.extra_scripts} +modules = rfbridge # ------------------------------------------------------------------------------ @@ -1073,6 +1096,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DAITHINKER_AI_LIGHT monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:aithinker-ai-light-ota] platform = ${common.platform} @@ -1087,6 +1111,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:magichome-led-controller] platform = ${common.platform} @@ -1098,6 +1123,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DMAGICHOME_LED_CONTROLLER monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:magichome-led-controller-ota] platform = ${common.platform} @@ -1112,6 +1138,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:magichome-led-controller-20] platform = ${common.platform} @@ -1123,6 +1150,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DMAGICHOME_LED_CONTROLLER_20 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:magichome-led-controller-20-ota] platform = ${common.platform} @@ -1136,6 +1164,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:huacanxing-h801] platform = ${common.platform} @@ -1147,6 +1176,7 @@ lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H801 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:huacanxing-h801-ota] platform = ${common.platform} @@ -1161,6 +1191,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:huacanxing-h802] platform = ${common.platform} @@ -1172,6 +1203,7 @@ lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H802 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:huacanxing-h802-ota] platform = ${common.platform} @@ -1186,6 +1218,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc01] platform = ${common.platform} @@ -1197,6 +1230,7 @@ lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC01 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc01-ota] platform = ${common.platform} @@ -1211,6 +1245,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc02] platform = ${common.platform} @@ -1222,6 +1257,7 @@ lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC02 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc02-ota] platform = ${common.platform} @@ -1236,6 +1272,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc06] platform = ${common.platform} @@ -1247,6 +1284,7 @@ lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC06 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc06-ota] platform = ${common.platform} @@ -1261,6 +1299,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc11] platform = ${common.platform} @@ -1272,6 +1311,7 @@ lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC11 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-al-lc11-ota] platform = ${common.platform} @@ -1286,6 +1326,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:arilux-e27] platform = ${common.platform} @@ -1322,6 +1363,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DITEAD_BNSZ01 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:itead-bnsz01-ota] platform = ${common.platform} @@ -1336,6 +1378,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:wion-50055] platform = ${common.platform} @@ -1347,6 +1390,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DWION_50055 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:wion-50055-ota] platform = ${common.platform} @@ -1361,6 +1405,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:exs-wifi-relay-v31] platform = ${common.platform} @@ -1397,6 +1442,7 @@ build_flags = ${common.build_flags_4m1m} -DGENERIC_V9261F upload_speed = 460800 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:wemos-v9261f-ota] platform = ${common.platform} @@ -1410,6 +1456,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:esp01-v9261f] platform = ${common.platform} @@ -1421,6 +1468,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DGENERIC_V9261F monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:esp01-v9261f-ota] platform = ${common.platform} @@ -1435,6 +1483,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:wemos-ech1560] platform = ${common.platform} @@ -1446,6 +1495,7 @@ build_flags = ${common.build_flags_4m1m} -DGENERIC_ECH1560 upload_speed = 460800 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:wemos-ech1560-ota] platform = ${common.platform} @@ -1459,6 +1509,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:esp01-ech1560] platform = ${common.platform} @@ -1470,6 +1521,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DGENERIC_ECH1560 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:esp01-ech1560-ota] platform = ${common.platform} @@ -1484,6 +1536,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:mancavemade-esplive] platform = ${common.platform} @@ -1519,6 +1572,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DINTERMITTECH_QUINLED monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:intermittech-quinled-ota] platform = ${common.platform} @@ -1533,6 +1587,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:xenon-sm-pw702u] platform = ${common.platform} @@ -1569,6 +1624,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DAUTHOMETION_LYT8266 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:authometion-lyt8266-ota] platform = ${common.platform} @@ -1583,6 +1639,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = light [env:kmc-70011] platform = ${common.platform} @@ -1594,6 +1651,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DKMC_70011 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:kmc-70011-ota] platform = ${common.platform} @@ -1608,6 +1666,7 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:yjzk-switch-2ch] platform = ${common.platform} @@ -1824,6 +1883,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DYIDIAN_XSSSA05 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:yidian-xsssa05-ota] platform = ${common.platform} @@ -1837,6 +1897,7 @@ upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +modules = sensor [env:tonbux-xsssa06] platform = ${common.platform} @@ -2094,6 +2155,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DGENERIC_ESP01S_DHT11_V10 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:generic-esp01s-dht11-10-ota] platform = ${common.platform} @@ -2107,6 +2169,7 @@ upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +modules = sensor [env:generic-esp01s-ds18b20-10] platform = ${common.platform} @@ -2118,6 +2181,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m0m} -DGENERIC_ESP01S_DS18B20_V10 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:generic-esp01s-ds18b20-10-ota] platform = ${common.platform} @@ -2131,6 +2195,7 @@ upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +modules = sensor [env:heltec-touch-relay] platform = ${common.platform} @@ -2214,6 +2279,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DPILOTAK_ESP_DIN_V1 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor [env:pilotak-esp-din-v1-ota] platform = ${common.platform} @@ -2227,6 +2293,7 @@ upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +modules = sensor [env:nodemcu-geiger] platform = ${common.platform} @@ -2238,3 +2305,4 @@ build_flags = ${common.build_flags} -DNODEMCU_BASIC -DNOWSAUTH -DGEIGER_SUPPORT= upload_speed = 460800 monitor_speed = 115200 extra_scripts = ${common.extra_scripts} +modules = sensor