improved sanity-check of config-values
This commit is contained in:
parent
cc93236b8e
commit
e85eef271b
@ -295,41 +295,44 @@ uint32_t ConfigSanityCheck(bool autocorrect)
|
|||||||
LubeConfig.TankRemindAtPercentage = LubeConfig_defaults.TankRemindAtPercentage;
|
LubeConfig.TankRemindAtPercentage = LubeConfig_defaults.TankRemindAtPercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(LubeConfig.PulsePerRevolution > 0) || !(LubeConfig.PulsePerRevolution < 1000))
|
if (LubeConfig.SpeedSource == SOURCE_IMPULSE)
|
||||||
{
|
{
|
||||||
SET_BIT(setting_reset_bits, 5);
|
if (!(LubeConfig.PulsePerRevolution > 0) || !(LubeConfig.PulsePerRevolution < 1000))
|
||||||
if (autocorrect)
|
{
|
||||||
LubeConfig.PulsePerRevolution = LubeConfig_defaults.PulsePerRevolution;
|
SET_BIT(setting_reset_bits, 5);
|
||||||
}
|
if (autocorrect)
|
||||||
|
LubeConfig.PulsePerRevolution = LubeConfig_defaults.PulsePerRevolution;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(LubeConfig.TireWidth_mm > 0) || !(LubeConfig.TireWidth_mm < 500))
|
if (!(LubeConfig.TireWidth_mm > 0) || !(LubeConfig.TireWidth_mm < 500))
|
||||||
{
|
{
|
||||||
SET_BIT(setting_reset_bits, 6);
|
SET_BIT(setting_reset_bits, 6);
|
||||||
if (autocorrect)
|
if (autocorrect)
|
||||||
LubeConfig.TireWidth_mm = LubeConfig_defaults.TireWidth_mm;
|
LubeConfig.TireWidth_mm = LubeConfig_defaults.TireWidth_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(LubeConfig.TireWidthHeight_Ratio > 0) || !(LubeConfig.TireWidthHeight_Ratio < 150))
|
if (!(LubeConfig.TireWidthHeight_Ratio > 0) || !(LubeConfig.TireWidthHeight_Ratio < 150))
|
||||||
{
|
{
|
||||||
SET_BIT(setting_reset_bits, 7);
|
SET_BIT(setting_reset_bits, 7);
|
||||||
if (autocorrect)
|
if (autocorrect)
|
||||||
LubeConfig.TireWidthHeight_Ratio = LubeConfig_defaults.TireWidthHeight_Ratio;
|
LubeConfig.TireWidthHeight_Ratio = LubeConfig_defaults.TireWidthHeight_Ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(LubeConfig.RimDiameter_Inch > 0) || !(LubeConfig.RimDiameter_Inch < 30))
|
if (!(LubeConfig.RimDiameter_Inch > 0) || !(LubeConfig.RimDiameter_Inch < 30))
|
||||||
{
|
{
|
||||||
SET_BIT(setting_reset_bits, 8);
|
SET_BIT(setting_reset_bits, 8);
|
||||||
if (autocorrect)
|
if (autocorrect)
|
||||||
LubeConfig.RimDiameter_Inch = LubeConfig_defaults.RimDiameter_Inch;
|
LubeConfig.RimDiameter_Inch = LubeConfig_defaults.RimDiameter_Inch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(LubeConfig.DistancePerRevolution_mm > 0) || !(LubeConfig.DistancePerRevolution_mm < 10000))
|
if (!(LubeConfig.DistancePerRevolution_mm > 0) || !(LubeConfig.DistancePerRevolution_mm < 10000))
|
||||||
{
|
{
|
||||||
SET_BIT(setting_reset_bits, 9);
|
SET_BIT(setting_reset_bits, 9);
|
||||||
if (autocorrect)
|
if (autocorrect)
|
||||||
LubeConfig.DistancePerRevolution_mm = LubeConfig_defaults.DistancePerRevolution_mm;
|
LubeConfig.DistancePerRevolution_mm = LubeConfig_defaults.DistancePerRevolution_mm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(LubeConfig.BleedingPulses > 0) || !(LubeConfig.BleedingPulses < 1001))
|
if (!(LubeConfig.BleedingPulses > 0) || !(LubeConfig.BleedingPulses < 1001))
|
||||||
{
|
{
|
||||||
SET_BIT(setting_reset_bits, 10);
|
SET_BIT(setting_reset_bits, 10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user