Fixes #4136 - Reset all logical switch fields on change of function type - By @elecpower
This commit is contained in:
@@ -445,7 +445,17 @@ void menuModelLogicalSwitches(event_t event)
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, LS_FUNC_MAX);
|
||||
uint8_t new_cstate = lswFamily(cs->func);
|
||||
if (cstate != new_cstate) {
|
||||
cs->v1 = cs->v2 = (new_cstate==LS_FAMILY_TIMER ? -119/*1.0*/ : 0);
|
||||
#if defined(CPUARM)
|
||||
unsigned int save_func = cs->func;
|
||||
memset(cs, 0, sizeof(LogicalSwitchData));
|
||||
cs->func = save_func;
|
||||
#else
|
||||
cs->v1 = cs->v2 = 0;
|
||||
cs->andsw = 0;
|
||||
#endif
|
||||
if (new_cstate == LS_FAMILY_TIMER) {
|
||||
cs->v1 = cs->v2 = -119; // 1.0
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user