Browse Source

Support for YJZK 2-gang switch

fastled
Xose Pérez 7 years ago
parent
commit
4b87ce223f
4 changed files with 73 additions and 1 deletions
  1. +1
    -1
      code/espurna/config/general.h
  2. +34
    -0
      code/espurna/config/hardware.h
  3. +15
    -0
      code/espurna/hardware.ino
  4. +23
    -0
      code/platformio.ini

+ 1
- 1
code/espurna/config/general.h View File

@ -246,7 +246,7 @@ PROGMEM const char* const custom_reset_string[] = {
// All defined LEDs in the board can be managed through MQTT // All defined LEDs in the board can be managed through MQTT
// except the first one when LED_AUTO is set to 1. // except the first one when LED_AUTO is set to 1.
// If LED_AUTO is set to 1 the board will a defined LED to show wifi status.
// If LED_AUTO is set to 1 the board will use a defined LED to show wifi status.
#define LED_AUTO 1 #define LED_AUTO 1
// LED # to use as WIFI status indicator // LED # to use as WIFI status indicator


+ 34
- 0
code/espurna/config/hardware.h View File

@ -602,6 +602,40 @@
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// YJZK
// -----------------------------------------------------------------------------
#elif defined(YJZK_SWITCH_2CH)
// Info
#define MANUFACTURER "YJZK"
#define DEVICE "SWITCH_2CH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON2_PIN 9
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 12
#define RELAY2_PIN 5
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 0
#define LED_WIFI 0
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Electrodragon boards // Electrodragon boards
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 15
- 0
code/espurna/hardware.ino View File

@ -566,6 +566,21 @@ void hwUpwardsCompatibility() {
setSetting("myDCKIGPIO", 15); setSetting("myDCKIGPIO", 15);
setSetting("relays", 1); setSetting("relays", 1);
#elif defined(YJZK_SWITCH_2CH)
setSetting("board", 47);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 0);
setSetting("ledWifi", 0);
setSetting("btnGPIO", 1, 0);
setSetting("btnGPIO", 2, 9);
setSetting("btnRelay", 1, 1);
setSetting("btnRelay", 2, 2);
setSetting("relayGPIO", 1, 12);
setSetting("relayGPIO", 2, 5);
setSetting("relayType", 1, RELAY_TYPE_NORMAL);
setSetting("relayType", 2, RELAY_TYPE_NORMAL);
#else #else
#error "UNSUPPORTED HARDWARE!" #error "UNSUPPORTED HARDWARE!"


+ 23
- 0
code/platformio.ini View File

@ -1093,6 +1093,29 @@ upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200 monitor_baud = 115200
[env:yjzk-switch-2ch]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DYJZK_SWITCH_2CH
monitor_baud = 115200
[env:yjzk-switch-2ch-ota]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DYJZK_SWITCH_2CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# GENERIC OTA ENVIRONMENTS # GENERIC OTA ENVIRONMENTS
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------


Loading…
Cancel
Save