Skip to content

Commit

Permalink
Clean up new devices
Browse files Browse the repository at this point in the history
  • Loading branch information
xoseperez committed Aug 25, 2018
1 parent cfd5368 commit f840a54
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 60 deletions.
3 changes: 2 additions & 1 deletion code/espurna/config/arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
//#define BH_ONOFRE
//#define ITEAD_SONOFF_IFAN02
//#define GENERIC_AG_L4
#define ALLTERCO_SHELLY1
//#define ALLTERCO_SHELLY1
//#define LOHAS_9W

//--------------------------------------------------------------------------------
// Features (values below are non-default values)
Expand Down
75 changes: 41 additions & 34 deletions code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,25 +743,6 @@
#define MY92XX_MAPPING 4, 3, 5, 0, 1
#define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1

#elif defined(LOHAS_9W)

// Info
#define MANUFACTURER "LOHAS"
#define DEVICE "E27_9W"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
#define DUMMY_RELAY_COUNT 1

// Light
#define LIGHT_CHANNELS 5
#define MY92XX_MODEL MY92XX_MODEL_MY9231
#define MY92XX_CHIPS 2
#define MY92XX_DI_PIN 13
#define MY92XX_DCKI_PIN 15
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 0, 1, 2, 3, 4
#define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1

#elif defined(ITEAD_SONOFF_LED)

// Info
Expand Down Expand Up @@ -2476,7 +2457,6 @@
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING


// -----------------------------------------------------------------------------
// VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01)
// https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5
Expand Down Expand Up @@ -2522,6 +2502,8 @@
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING

// -----------------------------------------------------------------------------

#elif defined(GENERIC_AG_L4)

// Info
Expand Down Expand Up @@ -2566,6 +2548,45 @@
#define LIGHT_CH1_INVERSE 0
#define LIGHT_CH2_INVERSE 0
#define LIGHT_CH3_INVERSE 0

// -----------------------------------------------------------------------------

#elif defined(ALLTERCO_SHELLY1)

// Info
#define MANUFACTURER "ALLTERCO"
#define DEVICE "SHELLY1"

// Buttons
#define BUTTON1_PIN 5
#define BUTTON1_MODE BUTTON_SWITCH
#define BUTTON1_RELAY 1

// Relays
#define RELAY1_PIN 4
#define RELAY1_TYPE RELAY_TYPE_NORMAL

// -----------------------------------------------------------------------------

#elif defined(LOHAS_9W)

// Info
#define MANUFACTURER "LOHAS"
#define DEVICE "E27_9W"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX
#define DUMMY_RELAY_COUNT 1

// Light
#define LIGHT_CHANNELS 5
#define MY92XX_MODEL MY92XX_MODEL_MY9231
#define MY92XX_CHIPS 2
#define MY92XX_DI_PIN 13
#define MY92XX_DCKI_PIN 15
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 0, 1, 2, 3, 4
#define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1

// -----------------------------------------------------------------------------
// TEST boards (do not use!!)
// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -2747,20 +2768,6 @@
#define NETBIOS_SUPPORT 1
#define SSDP_SUPPORT 1

#elif defined(ALLTERCO_SHELLY1)

// Info
#define MANUFACTURER "ALLTERCO"
#define DEVICE "SHELLY1"

// Buttons
#define BUTTON1_PIN 5
#define BUTTON1_MODE BUTTON_SWITCH
#define BUTTON1_RELAY 1

// Relays
#define RELAY1_PIN 4
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#endif

// -----------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions code/espurna/migrate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,16 @@ void migrate() {
setSetting("relayGPIO", 0, 4);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);

#elif defined(LOHAS_9W)

setSetting("board", 84);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
setSetting("myModel", MY92XX_MODEL_MY9231);
setSetting("myChips", 2);
setSetting("myDIGPIO", 13);
setSetting("myDCKIGPIO", 15);
setSetting("relays", 1);

#else

Expand Down
75 changes: 50 additions & 25 deletions code/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -671,31 +671,6 @@ upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:lohas-e27-9w]
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} -DLOHAS_9W
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:lohas-e27-9w-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} -DLOHAS_9W
upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:itead-sonoff-t1-1ch]
platform = ${common.platform}
framework = ${common.framework}
Expand Down Expand Up @@ -2471,3 +2446,53 @@ upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts}

[env:lohas-e27-9w]
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} -DLOHAS_9W
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:lohas-e27-9w-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} -DLOHAS_9W
upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:allterco-sheely1]
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} -DALLTERCO_SHELLY1
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

[env:allterco-sheely1-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} -DALLTERCO_SHELLY1
upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

0 comments on commit f840a54

Please sign in to comment.