mirror of https://github.com/arendst/Tasmota.git
Fix emulation regression from ArtNet implementation
This commit is contained in:
parent
9e65dd51e9
commit
16b796ccd5
|
@ -1554,11 +1554,6 @@ void Every250mSeconds(void)
|
|||
break;
|
||||
case 3:
|
||||
{
|
||||
// is there a network state change since last time, if so send events to modules
|
||||
static bool network_was_down = true; // keep track of the previous state of network
|
||||
bool network_state_changed = (network_was_down != (bool)TasmotaGlobal.global_state.network_down); // network state changed from last tick
|
||||
network_was_down = TasmotaGlobal.global_state.network_down;
|
||||
|
||||
if (!TasmotaGlobal.global_state.network_down) {
|
||||
#ifdef FIRMWARE_MINIMAL
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||
|
@ -1607,23 +1602,19 @@ void Every250mSeconds(void)
|
|||
#endif // USE_DEVICE_GROUPS
|
||||
|
||||
// send FUNC_NETWORK_UP to all modules
|
||||
if (network_state_changed) {
|
||||
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("WIF: Sending FUNC_NETWORK_UP"));
|
||||
XdrvXsnsCall(FUNC_NETWORK_UP);
|
||||
}
|
||||
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("WIF: Sending FUNC_NETWORK_UP"));
|
||||
XdrvXsnsCall(FUNC_NETWORK_UP);
|
||||
|
||||
MqttCheck();
|
||||
} else {
|
||||
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
DeviceGroupsStop();
|
||||
DeviceGroupsStop();
|
||||
#endif // USE_DEVICE_GROUPS
|
||||
|
||||
// send FUNC_NETWORK_UP to all modules
|
||||
if (network_state_changed) {
|
||||
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("WIF: Sending FUNC_NETWORK_DOWN"));
|
||||
XdrvXsnsCall(FUNC_NETWORK_DOWN);
|
||||
}
|
||||
// send FUNC_NETWORK_DOWN to all modules
|
||||
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("WIF: Sending FUNC_NETWORK_DOWN"));
|
||||
XdrvXsnsCall(FUNC_NETWORK_DOWN);
|
||||
} // Every x.75 second
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -3463,14 +3463,10 @@ bool Xdrv04(uint32_t function)
|
|||
ArtNetJSONAppend();
|
||||
break;
|
||||
case FUNC_NETWORK_UP:
|
||||
if (Settings->flag6.artnet_autorun) {
|
||||
if (!ArtNetStart()) {
|
||||
Settings->flag6.artnet_autorun = false; // disable autorun if it failed, avoid nasty loop errors
|
||||
}
|
||||
}
|
||||
ArtNetFuncNetworkUp();
|
||||
break;
|
||||
case FUNC_NETWORK_DOWN:
|
||||
ArtNetStop();
|
||||
ArtNetFuncNetworkDown();
|
||||
break;
|
||||
#endif // USE_LIGHT_ARTNET
|
||||
}
|
||||
|
|
|
@ -426,5 +426,29 @@ void CmndArtNet(void) {
|
|||
ResponseCmndStateText(artnet_udp_connected & Settings->flag6.artnet_autorun);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
bool artnet_network_up = false;
|
||||
|
||||
void ArtNetFuncNetworkUp(void) {
|
||||
if (!artnet_network_up) {
|
||||
artnet_network_up = true;
|
||||
if (Settings->flag6.artnet_autorun) {
|
||||
if (!ArtNetStart()) {
|
||||
Settings->flag6.artnet_autorun = false; // disable autorun if it failed, avoid nasty loop errors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ArtNetFuncNetworkDown(void) {
|
||||
if (artnet_network_up) {
|
||||
artnet_network_up = false;
|
||||
ArtNetStop();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_LIGHT_ARTNET
|
||||
#endif // USE_LIGHT
|
||||
|
|
Loading…
Reference in New Issue