From 9c5dc673208891a3d5241481a84197e8d2bf3c59 Mon Sep 17 00:00:00 2001 From: mpcusack Date: Mon, 16 Dec 2019 03:04:25 -0800 Subject: [PATCH] Add support for LinkSprite R4 (#2042) * Add LinkSprite R4 def * Platformio.ini def for linksprite r4 * LINKSPRITE_LINKNODE_R4 --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 21 +++++++++++++++++++++ code/espurna/migrate.ino | 14 +++++++++++++- code/platformio.ini | 10 ++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index fddc2418..16c0a58a 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -95,6 +95,7 @@ //#define JORGEGARCIA_WIFI_RELAYS //#define KMC_70011 //#define LINGAN_SWA1 +//#define LINKSPRITE_LINKNODE_R4 //#define LITESUN_LA_WF3 //#define LOHAS_9W //#define LOMBEX_LUX_NOVA2_TUNABLE_WHITE diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index d0e1519c..bd878f4d 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -4167,6 +4167,27 @@ #define SENSOR_ENERGY_UNITS ENERGY_KWH #define SENSOR_POWER_UNITS POWER_WATTS // ----------------------------------------------------------------------------- +// Linksprite R4 +// http://linksprite.com/wiki/index.php?title=LinkNode_R4:_Arduino-compatible_WiFi_relay_controller +// ----------------------------------------------------------------------------- + +#elif defined(LINKSPRITE_LINKNODE_R4) + + // Info + #define MANUFACTURER "LINKSPRITE" + #define DEVICE "LINKNODE_R4" + + // Relays + #define RELAY1_PIN 12 + #define RELAY2_PIN 13 + #define RELAY3_PIN 14 + #define RELAY4_PIN 16 + + #define RELAY1_TYPE RELAY_TYPE_NORMAL + #define RELAY2_TYPE RELAY_TYPE_NORMAL + #define RELAY3_TYPE RELAY_TYPE_NORMAL + #define RELAY4_TYPE RELAY_TYPE_NORMAL +// ----------------------------------------------------------------------------- #else diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index bc0bb718..91cc3ebd 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1387,9 +1387,21 @@ void migrate() { setSetting("chLogic", 3, 0); setSetting("relays", 1); + #elif defined(LINKSPRITE_LINKNODE_R4) + + setSetting("board", 104); + setSetting("relayGPIO", 0, 12); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("relayGPIO", 1, 13); + setSetting("relayType", 1, RELAY_TYPE_NORMAL); + setSetting("relayGPIO", 2, 14); + setSetting("relayType", 2, RELAY_TYPE_NORMAL); + setSetting("relayGPIO", 3, 16); + setSetting("relayType", 4, RELAY_TYPE_NORMAL); + #elif defined(GENERIC_E14) - setSetting("board", 103); + setSetting("board", 104); setSetting("relayProvider", RELAY_PROVIDER_LIGHT); setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); setSetting("chGPIO", 0, 4); diff --git a/code/platformio.ini b/code/platformio.ini index 10214ae7..4599b33d 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1692,3 +1692,13 @@ board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DHYKKER_SMART_HOME_POWER_PLUG upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} + +[env:linksprite-linknode-r4] +board = ${common.board_4m} +build_flags = ${common.build_flags_4m1m} -DLINKSPRITE_LINKNODE_R4 + +[env:linksprite-linknode-r4-ota] +board = ${common.board_4m} +build_flags = ${common.build_flags_4m1m} -DLINKSPRITE_LINKNODE_R4 +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags}