From 6cf55da3755d86784aa79998e2e2ed90b6489611 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Fri, 6 Jul 2018 13:12:53 +0300 Subject: [PATCH 1/6] Don't show alert on already set hostname --- code/html/custom.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/html/custom.js b/code/html/custom.js index 71e1e04e..7d4a3586 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -176,8 +176,13 @@ function validateForm(form) { var re_hostname = new RegExp('^(?!-)[A-Za-z0-9-]{0,31}[A-Za-z0-9]$'); - var hostname = $("input[name='hostname']", form).val(); - if (!re_hostname.test(hostname)) { + var hostname = $("input[name='hostname']", form); + var hasChanged = hostname.attr("hasChanged") || 0; + if (0 === hasChanged) { + return true; + } + + if (!re_hostname.test(hostname.val())) { alert("Hostname cannot be empty and may only contain the ASCII letters ('A' through 'Z' and 'a' through 'z'), the digits '0' through '9', and the hyphen ('-')! They can neither start or end with an hyphen."); return false; } From 9fdf2172038566df1447e044f7ed1beab8be89a8 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Tue, 10 Jul 2018 17:58:00 +0300 Subject: [PATCH 2/6] Fix travis release condition Travis pulls tag as branch, so 'branch = master' is never true. Use same regexp as earlier build.sh did --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a38f507..1add3524 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: python python: - '2.7' sudo: false +conditions: v1 cache: directories: - "~/.npm" @@ -19,7 +20,7 @@ script: stages: - name: Test - name: Release - if: tag IS present AND branch = master + if: tag IS present AND tag =~ ^\d+\.\d+\.\d+$ jobs: include: - stage: Test @@ -42,7 +43,6 @@ deploy: skip_cleanup: true on: tags: true - branch: master repo: xoseperez/espurna condition: $TRAVIS_BUILD_STAGE_NAME = Release notifications: From 380eee72cbd65bdb1f55149aef8ade78bafa9660 Mon Sep 17 00:00:00 2001 From: Indu Prakash Date: Wed, 11 Jul 2018 17:29:26 -0500 Subject: [PATCH 3/6] Using correct separator --- code/gulpfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/gulpfile.js b/code/gulpfile.js index d9edbdbd..0f4bceaf 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -42,6 +42,7 @@ const remover = require('gulp-remove-code'); const map = require('map-stream'); const rename = require('gulp-rename'); const runSequence = require('run-sequence'); +const path = require('path'); // ----------------------------------------------------------------------------- // Configuration @@ -63,7 +64,7 @@ var buildHeaderFile = function() { return map(function(file, cb) { - var parts = file.path.split("/"); + var parts = file.path.split(path.sep); var filename = parts[parts.length - 1]; var destination = staticFolder + filename + ".h"; var safename = "webui_image"; From 482dc31f65235559cc5d7c34f873a6b06bbd04ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 12 Jul 2018 08:53:40 +0200 Subject: [PATCH 4/6] Explicitly disable ATC on RFM69 gateway (#938) --- code/espurna/rfm69.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/espurna/rfm69.ino b/code/espurna/rfm69.ino index 7c84092b..5ab362a2 100644 --- a/code/espurna/rfm69.ino +++ b/code/espurna/rfm69.ino @@ -257,13 +257,13 @@ void rfm69Setup() { _rfm69_radio->initialize(RFM69_FREQUENCY, RFM69_NODE_ID, RFM69_NETWORK_ID); _rfm69_radio->encrypt(RFM69_ENCRYPTKEY); _rfm69_radio->promiscuous(RFM69_PROMISCUOUS); + _rfm69_radio->enableAutoPower(0); if (RFM69_IS_RFM69HW) _rfm69_radio->setHighPower(); DEBUG_MSG_P(PSTR("[RFM69] Worning at %u MHz\n"), RFM69_FREQUENCY == RF69_433MHZ ? 433 : RFM69_FREQUENCY == RF69_868MHZ ? 868 : 915); DEBUG_MSG_P(PSTR("[RFM69] Node %u\n"), RFM69_NODE_ID); DEBUG_MSG_P(PSTR("[RFM69] Network %u\n"), RFM69_NETWORK_ID); DEBUG_MSG_P(PSTR("[RFM69] Promiscuous mode %s\n"), RFM69_PROMISCUOUS ? "ON" : "OFF"); - DEBUG_MSG_P(PSTR("[RFM69] Auto Transmission Control (ATC) enabled\n")); #if WEB_SUPPORT wsOnSendRegister(_rfm69WebSocketOnSend); From ff252fc06804b2eac351550b4c0a7b8376d36dac Mon Sep 17 00:00:00 2001 From: Jens J Date: Thu, 12 Jul 2018 17:22:18 -0500 Subject: [PATCH 5/6] add support for AG-L4 color desk lamp --- code/espurna/config/hardware.h | 44 ++++++++++++++++++++++++++++++++++ code/platformio.ini | 24 +++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 00e1f6c4..6215b33f 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2595,6 +2595,50 @@ #define NETBIOS_SUPPORT 1 #define SSDP_SUPPORT 1 +#elif defined(AG_L4) + + // Info + #define MANUFACTURER "GENERIC" + #define DEVICE "AG_L4" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // button 1: "power" button + #define BUTTON1_PIN 4 + #define BUTTON1_RELAY 1 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH + #define BUTTON1_PRESS BUTTON_MODE_TOGGLE + #define BUTTON1_CLICK BUTTON_MODE_NONE + #define BUTTON1_DBLCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET + + // button 2: "wifi" button + #define BUTTON2_PIN 2 + #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON2_PRESS BUTTON_MODE_TOGGLE + #define BUTTON2_CLICK BUTTON_MODE_NONE + #define BUTTON2_DBLCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE + + // LEDs + #define LED1_PIN 5 // red status led + #define LED1_PIN_INVERSE 0 + + #define LED2_PIN 16 // master light power + #define LED2_PIN_INVERSE 1 + #define LED2_MODE LED_MODE_RELAY + + // Light + #define LIGHT_CHANNELS 3 + #define LIGHT_CH1_PIN 14 // RED + #define LIGHT_CH2_PIN 13 // GREEN + #define LIGHT_CH3_PIN 12 // BLUE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 #endif // ----------------------------------------------------------------------------- diff --git a/code/platformio.ini b/code/platformio.ini index b6aafd34..80fb12ce 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2383,3 +2383,27 @@ monitor_speed = ${common.monitor_speed} upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} + +[env:ag-l4] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DAG_L4 +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:ag-l4-ota] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DAG_L4 +upload_speed = ${common.upload_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +extra_scripts = ${common.extra_scripts} From 7f4e0ae2bd19a1b6694b6a498c88cc405dd4ad3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sat, 14 Jul 2018 14:30:21 +0200 Subject: [PATCH 6/6] Clean up AG-L4 code --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 87 +++++++++++++++++----------------- code/espurna/migrate.ino | 23 +++++++++ code/platformio.ini | 8 ++-- 4 files changed, 71 insertions(+), 48 deletions(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 0f2cb40d..df8214c0 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -89,6 +89,7 @@ //#define BLITZWOLF_BWSHP2 //#define BH_ONOFRE //#define ITEAD_SONOFF_IFAN02 +//#define GENERIC_AG_L4 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 6215b33f..7b78eea2 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2423,7 +2423,50 @@ #define HLW8012_POWER_RATIO 3414290 #define HLW8012_INTERRUPT_ON FALLING +#elif defined(GENERIC_AG_L4) + // Info + #define MANUFACTURER "GENERIC" + #define DEVICE "AG_L4" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // button 1: "power" button + #define BUTTON1_PIN 4 + #define BUTTON1_RELAY 1 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH + #define BUTTON1_PRESS BUTTON_MODE_TOGGLE + #define BUTTON1_CLICK BUTTON_MODE_NONE + #define BUTTON1_DBLCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET + + // button 2: "wifi" button + #define BUTTON2_PIN 2 + #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON2_PRESS BUTTON_MODE_TOGGLE + #define BUTTON2_CLICK BUTTON_MODE_NONE + #define BUTTON2_DBLCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE + + // LEDs + #define LED1_PIN 5 // red status led + #define LED1_PIN_INVERSE 0 + + #define LED2_PIN 16 // master light power + #define LED2_PIN_INVERSE 1 + #define LED2_MODE LED_MODE_RELAY + + // Light + #define LIGHT_CHANNELS 3 + #define LIGHT_CH1_PIN 14 // RED + #define LIGHT_CH2_PIN 13 // GREEN + #define LIGHT_CH3_PIN 12 // BLUE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- @@ -2595,50 +2638,6 @@ #define NETBIOS_SUPPORT 1 #define SSDP_SUPPORT 1 -#elif defined(AG_L4) - - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "AG_L4" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // button 1: "power" button - #define BUTTON1_PIN 4 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - - // button 2: "wifi" button - #define BUTTON2_PIN 2 - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_PRESS BUTTON_MODE_TOGGLE - #define BUTTON2_CLICK BUTTON_MODE_NONE - #define BUTTON2_DBLCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE - - // LEDs - #define LED1_PIN 5 // red status led - #define LED1_PIN_INVERSE 0 - - #define LED2_PIN 16 // master light power - #define LED2_PIN_INVERSE 1 - #define LED2_MODE LED_MODE_RELAY - - // Light - #define LIGHT_CHANNELS 3 - #define LIGHT_CH1_PIN 14 // RED - #define LIGHT_CH2_PIN 13 // GREEN - #define LIGHT_CH3_PIN 12 // BLUE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 #endif // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 1ace21f4..005c7a19 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1064,6 +1064,29 @@ void migrate() { setSetting("relayType", 2, RELAY_TYPE_NORMAL); setSetting("relayType", 3, RELAY_TYPE_NORMAL); + #elif defined(GENERIC_AG_L4) + + setSetting("board", 82); + + setSetting("btnGPIO", 0, 4); + setSetting("btnGPIO", 1, 2); + setSetting("btnRelay", 0, 0); + + setSetting("ledGPIO", 0, 5); + setSetting("ledGPIO", 1, 16); + setSetting("ledLogic", 0, 0); + setSetting("ledLogic", 1, 1); + + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("chGPIO", 0, 14); + setSetting("chGPIO", 1, 13); + setSetting("chGPIO", 2, 12); + setSetting("chLogic", 0, 0); + setSetting("chLogic", 1, 0); + setSetting("chLogic", 2, 0); + setSetting("relays", 1); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 80fb12ce..a9c281e5 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2384,25 +2384,25 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} -[env:ag-l4] +[env:generic-ag-l4] platform = ${common.platform} framework = ${common.framework} board = ${common.board_1m} board_build.flash_mode = ${common.flash_mode} lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m0m} -DAG_L4 +build_flags = ${common.build_flags_1m0m} -DGENERIC_AG_L4 monitor_speed = ${common.monitor_speed} extra_scripts = ${common.extra_scripts} -[env:ag-l4-ota] +[env:generic-ag-l4-ota] platform = ${common.platform} framework = ${common.framework} board = ${common.board_1m} board_build.flash_mode = ${common.flash_mode} lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m0m} -DAG_L4 +build_flags = ${common.build_flags_1m0m} -DGENERIC_AG_L4 upload_speed = ${common.upload_speed} upload_port = ${common.upload_port} upload_flags = ${common.upload_flags}