Closed streber42 closed 1 year ago
I was just going to merge this, but there is one issue: For example in stm32-sine there is a line that reads
if (Param::Get(Param::offthrotregen) > 0)
Param::Set(Param::offthrotregen, -Param::Get(Param::offthrotregen));
So the old, positive value is loaded, then we check if the loaded value is > 0 and if so just change the sign. With the boundary check we would have lost the users previous setting.
Wouldn't this be fixed by setting the bounds on the param to reflect this kind of logic? If you can handle it being negative set the bounds to match?
Add bounds checking when loading params from flash. If a PARAM_NUM gets reused it can cause really hard to debug behavior/crashes.