Browse Source

Merge branch 'dev' of github.com:xoseperez/espurna into dev

softuart
Xose Pérez 6 years ago
parent
commit
4326c5007c
4 changed files with 54 additions and 1 deletions
  1. +1
    -0
      code/espurna/config/general.h
  2. +14
    -0
      code/espurna/config/hardware.h
  3. +14
    -1
      code/espurna/relay.ino
  4. +25
    -0
      code/platformio.ini

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

@ -277,6 +277,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define RELAY_PROVIDER_DUAL 1
#define RELAY_PROVIDER_LIGHT 2
#define RELAY_PROVIDER_RFBRIDGE 3
#define RELAY_PROVIDER_STM 4
// Default boot mode: 0 means OFF, 1 ON and 2 whatever was before
#define RELAY_BOOT_MODE RELAY_BOOT_OFF


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

@ -1394,6 +1394,20 @@
// -----------------------------------------------------------------------------
#elif defined(STM_RELAY)
// Info
#define MANUFACTURER "STM_RELAY"
#define DEVICE "2CH"
// Relays
#define DUMMY_RELAY_COUNT 2
#define RELAY_PROVIDER RELAY_PROVIDER_STM
// Remove UART noise on serial line
#define TERMINAL_SUPPORT 0
#define DEBUG_SERIAL_SUPPORT 0
#endif
// -----------------------------------------------------------------------------


+ 14
- 1
code/espurna/relay.ino View File

@ -77,6 +77,15 @@ void _relayProviderStatus(unsigned char id, bool status) {
#endif
#if RELAY_PROVIDER == RELAY_PROVIDER_STM
Serial.flush();
Serial.write(0xA0);
Serial.write(id + 1);
Serial.write(status);
Serial.write(0xA1 + status + id);
Serial.flush();
#endif
#if RELAY_PROVIDER == RELAY_PROVIDER_LIGHT
// If the number of relays matches the number of light channels
@ -453,7 +462,11 @@ void _relayBoot() {
}
_relays[i].current_status = !status;
_relays[i].target_status = status;
_relays[i].change_time = millis();
#ifdef RELAY_PROVIDER_STM
_relays[i].change_time = millis() + 3000 + 1000 * i;
#else
_relays[i].change_time = millis();
#endif
bit <<= 1;
}


+ 25
- 0
code/platformio.ini View File

@ -1399,6 +1399,31 @@ upload_speed = 460800
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:stm-relay-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} -DSTM_RELAY
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:stm-relay-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} -DSTM_RELAY
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
# ------------------------------------------------------------------------------
# GENERIC OTA ENVIRONMENTS
# ------------------------------------------------------------------------------


Loading…
Cancel
Save