Browse Source

support board with 2 relays and stm8s103

softuart
Maciej Czerniak 6 years ago
parent
commit
f1d33ca121
4 changed files with 49 additions and 0 deletions
  1. +1
    -0
      code/espurna/config/general.h
  2. +14
    -0
      code/espurna/config/hardware.h
  3. +9
    -0
      code/espurna/relay.ino
  4. +25
    -0
      code/platformio.ini

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

@ -275,6 +275,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

@ -1423,6 +1423,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
// -----------------------------------------------------------------------------


+ 9
- 0
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


+ 25
- 0
code/platformio.ini View File

@ -1388,6 +1388,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