Fix setting last module

This commit is contained in:
Theo Arends 2020-10-31 12:04:28 +01:00
parent 2c1c7c50d6
commit 432051a7ef
4 changed files with 8 additions and 3 deletions

View File

@ -791,6 +791,10 @@ void PerformEverySecond(void)
{
TasmotaGlobal.uptime++;
if (LAST_MODULE_SET_TIME == TasmotaGlobal.uptime) {
Settings.last_module = Settings.module; // Needs to be done after AriluxRfInit() and PWMModulePreInit()
}
if (POWER_CYCLE_TIME == TasmotaGlobal.uptime) {
UpdateQuickPowerCycle(false);
}

View File

@ -124,6 +124,7 @@ const uint8_t MAX_POWER_RETRY = 5; // Retry count allowing agreed power
const uint8_t STATES = 20; // Number of states per second using 50 mSec interval
const uint8_t IMMINENT_RESET_FACTOR = 10; // Factor to extent button hold time for imminent Reset to default 40 seconds using KEY_HOLD_TIME of 40
const uint32_t LAST_MODULE_SET_TIME = 12; // Number of seconds to set last module to current module
const uint32_t BOOT_LOOP_TIME = 10; // Number of seconds to stop detecting boot loops
const uint32_t POWER_CYCLE_TIME = 8; // Number of seconds to reset power cycle boot loops
const uint16_t SYSLOG_TIMER = 600; // Seconds to restore syslog_level

View File

@ -149,7 +149,7 @@ void AriluxRfInit(void)
if (Settings.last_module != Settings.module) {
Settings.rf_code[1][6] = 0;
Settings.rf_code[1][7] = 0;
Settings.last_module = Settings.module;
// Settings.last_module = Settings.module; // Will be done at LAST_MODULE_SET_TIME after restart as other drivers also test for module change
}
Arilux.rf_received_value = 0;
@ -179,7 +179,7 @@ bool Xdrv26(uint8_t function)
if (PinUsed(GPIO_ARIRFRCV)) { AriluxRfHandler(); }
break;
case FUNC_EVERY_SECOND:
if (10 == TasmotaGlobal.uptime) { AriluxRfInit(); } // Needs rest before enabling RF interrupts
if (LAST_MODULE_SET_TIME -2 == TasmotaGlobal.uptime) { AriluxRfInit(); } // Needs rest before enabling RF interrupts
break;
}
return result;

View File

@ -91,7 +91,7 @@ void PWMModulePreInit(void)
if (Settings.last_module != Settings.module) {
Settings.flag.pwm_control = true; // SetOption15 - Switch between commands PWM or COLOR/DIMMER/CT/CHANNEL
Settings.bri_power_on = Settings.bri_preset_low = Settings.bri_preset_high = 0;
Settings.last_module = Settings.module;
// Settings.last_module = Settings.module; // Will be done at LAST_MODULE_SET_TIME after restart as other drivers also test for module change
// Previous versions of PWM Dimmer used SetOption32 - Button held for factor times longer as the
// hold time. The hold time is now fixed and SetOption32 is used as normal including to