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