mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-13 11:47:29 +01:00
Merge pull request #536 from maciekczwa/feature/stm_relay_support
support board with 2 relays and stm8s103
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user