mirror of https://github.com/arendst/Tasmota.git
* fix ESP32_shutter wrong discovery * fix wrong discovers on ESP32 shutter * fix wrong discovers on ESP32_shutter * Update xdrv_12_discovery.ino
This commit is contained in:
parent
b287d05098
commit
afd22b5b42
|
@ -114,11 +114,11 @@ void TasDiscoverMessage(void) {
|
||||||
|
|
||||||
#ifdef USE_SHUTTER
|
#ifdef USE_SHUTTER
|
||||||
if (Settings->flag3.shutter_mode) {
|
if (Settings->flag3.shutter_mode) {
|
||||||
for (uint32_t k = 0; k < MAX_SHUTTERS; k++) {
|
for (uint32_t k = 0; k < TasmotaGlobal.shutters_present; k++) {
|
||||||
if (Settings->shutter_startrelay[k] > 0) {
|
if (ShutterGetStartRelay(k) > 0) {
|
||||||
Shutter[Settings->shutter_startrelay[k]-1] = Shutter[Settings->shutter_startrelay[k]] = 1;
|
Shutter[ShutterGetStartRelay(k)-1] = Shutter[ShutterGetStartRelay(k)] = 1;
|
||||||
} else {
|
} else {
|
||||||
// terminate loop at first INVALID Settings->shutter_startrelay[i].
|
// terminate loop at first INVALID ShutterGetStartRelay(k).
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ void TasDiscoverMessage(void) {
|
||||||
light_controller_isCTRGBLinked,
|
light_controller_isCTRGBLinked,
|
||||||
light_subtype);
|
light_subtype);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MAX_SHUTTERS; i++) {
|
for (uint32_t i = 0; i < tmax(TasmotaGlobal.shutters_present,MAX_SHUTTERS); i++) {
|
||||||
#ifdef USE_SHUTTER
|
#ifdef USE_SHUTTER
|
||||||
ResponseAppend_P(PSTR("%s%d"), (i > 0 ? "," : ""), Settings->shutter_options[i]);
|
ResponseAppend_P(PSTR("%s%d"), (i > 0 ? "," : ""), Settings->shutter_options[i]);
|
||||||
#else
|
#else
|
||||||
|
@ -209,12 +209,12 @@ void TasDiscoverMessage(void) {
|
||||||
|
|
||||||
ResponseAppend_P(PSTR("]," // Shutter Options (end)
|
ResponseAppend_P(PSTR("]," // Shutter Options (end)
|
||||||
"\"sht\":[")); // Shutter Tilt (start)
|
"\"sht\":[")); // Shutter Tilt (start)
|
||||||
for (uint32_t i = 0; i < MAX_SHUTTERS; i++) {
|
for (uint32_t i = 0; i < tmax(TasmotaGlobal.shutters_present,MAX_SHUTTERS); i++) {
|
||||||
#ifdef USE_SHUTTER
|
#ifdef USE_SHUTTER
|
||||||
ResponseAppend_P(PSTR("%s[%d,%d,%d]"), (i > 0 ? "," : ""),
|
ResponseAppend_P(PSTR("%s[%d,%d,%d]"), (i > 0 ? "," : ""),
|
||||||
Settings->shutter_tilt_config[0][i],
|
ShutterGetTiltConfig(0,i),
|
||||||
Settings->shutter_tilt_config[1][i],
|
ShutterGetTiltConfig(1,i),
|
||||||
Settings->shutter_tilt_config[2][i]);
|
ShutterGetTiltConfig(2,i));
|
||||||
#else
|
#else
|
||||||
ResponseAppend_P(PSTR("%s[0,0,0]"), (i > 0 ? "," : ""));
|
ResponseAppend_P(PSTR("%s[0,0,0]"), (i > 0 ? "," : ""));
|
||||||
#endif // USE_SHUTTER
|
#endif // USE_SHUTTER
|
||||||
|
|
|
@ -351,6 +351,10 @@ uint8_t ShutterGetStartRelay(uint8_t index) {
|
||||||
return ShutterSettings.shutter_startrelay[index];
|
return ShutterSettings.shutter_startrelay[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t ShutterGetTiltConfig(uint8_t config_idx,uint8_t index) {
|
||||||
|
return Shutter[index].tilt_config[config_idx];
|
||||||
|
}
|
||||||
|
|
||||||
void ExecuteCommandPowerShutter(uint32_t device, uint32_t state, uint32_t source)
|
void ExecuteCommandPowerShutter(uint32_t device, uint32_t state, uint32_t source)
|
||||||
{
|
{
|
||||||
// first implementation for virtual relays. Avoid switching relay numbers that do not exist.
|
// first implementation for virtual relays. Avoid switching relay numbers that do not exist.
|
||||||
|
|
|
@ -189,6 +189,10 @@ uint8_t ShutterGetStartRelay(uint8_t index) {
|
||||||
return Settings->shutter_startrelay[index];
|
return Settings->shutter_startrelay[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t ShutterGetTiltConfig(uint8_t config_idx,uint8_t index) {
|
||||||
|
return Shutter[index].tilt_config[config_idx];
|
||||||
|
}
|
||||||
|
|
||||||
void ExecuteCommandPowerShutter(uint32_t device, uint32_t state, uint32_t source)
|
void ExecuteCommandPowerShutter(uint32_t device, uint32_t state, uint32_t source)
|
||||||
{
|
{
|
||||||
// first implementation for virtual relays. Avoid switching relay numbers that do not exist.
|
// first implementation for virtual relays. Avoid switching relay numbers that do not exist.
|
||||||
|
|
Loading…
Reference in New Issue