Skip to content

Commit

Permalink
Merged in mactijn/espurna/dev (pull request #28)
Browse files Browse the repository at this point in the history
Add Huacanxing H802 support

Approved-by: Xose Pérez <[email protected]>
  • Loading branch information
mactijn authored and xoseperez committed Sep 5, 2017
2 parents 40155e7 + 3e84c83 commit 9640d34
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/espurna/config/arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
//#define JANGOE_WIFI_RELAY_NO
//#define JORGEGARCIA_WIFI_RELAYS
//#define OPENENERGYMONITOR_MQTT_RELAY
//#define HUACANXING_H802

//--------------------------------------------------------------------------------
// Features (values below are non-default values)
Expand Down
24 changes: 24 additions & 0 deletions code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,30 @@
#define RELAY1_TYPE RELAY_TYPE_LATCHED
#define RELAY1_RESET_PIN 12

// -----------------------------------------------------------------------------
// HUACANXING H802
// -----------------------------------------------------------------------------

#elif defined(HUACANXING_H802)

// Info
#define MANUFACTURER "HUACANXING"
#define DEVICE "H802"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1

// Channels
#define LIGHT_CH1_PIN 12 // RED
#define LIGHT_CH2_PIN 14 // GREEN
#define LIGHT_CH3_PIN 13 // BLUE
#define LIGHT_CH4_PIN 15 // WHITE

#define LIGHT_CH1_INVERSE 0
#define LIGHT_CH2_INVERSE 0
#define LIGHT_CH3_INVERSE 0
#define LIGHT_CH4_INVERSE 0

// -----------------------------------------------------------------------------
// Unknown hardware
// -----------------------------------------------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions code/espurna/hardware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,21 @@ void hwUpwardsCompatibility() {
setSetting("relayResetGPIO", 1, 12);
setSetting("relayType", 1, RELAY_TYPE_NORMAL);

#elif defined(HUACANXING_H802)

setSetting("board", 36);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("chGPIO", 1, 12);
setSetting("chGPIO", 2, 14);
setSetting("chGPIO", 3, 13);
setSetting("chGPIO", 4, 15);
setSetting("chLogic", 1, 0);
setSetting("chLogic", 2, 0);
setSetting("chLogic", 3, 0);
setSetting("chLogic", 4, 0);
setSetting("relays", 1);

#else

#error "UNSUPPORTED HARDWARE!"
Expand Down
23 changes: 23 additions & 0 deletions code/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,26 @@ build_flags = ${common.build_flags} -D${env.BOARD}
upload_speed = 115200
upload_port = "${env.IP}"
upload_flags = --auth=${env.AUTH} --port 8266

[env:huacanxing-h802]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H802 -DDEBUG_PORT=Serial1
monitor_baud = 115200

[env:huacanxing-h802-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H802 -DDEBUG_PORT=Serial1
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200

0 comments on commit 9640d34

Please sign in to comment.