Possible division per 0
This commit is contained in:
+6
-5
@@ -791,11 +791,12 @@ void FrskyValueWithMinMax::set(uint8_t value, uint8_t unit)
|
||||
|
||||
void frskyEvalCurrentConsumptionBoundary()
|
||||
{
|
||||
if (g_model.frsky.currentSource == CURRENT_SOURCE_HUB) {
|
||||
currentConsumptionBoundary = 3600;
|
||||
}
|
||||
else {
|
||||
currentConsumptionBoundary = 360000L / (g_model.frsky.channels[g_model.frsky.currentSource-1].ratio << g_model.frsky.channels[g_model.frsky.currentSource-1].multiplier);
|
||||
currentConsumptionBoundary = 3600;
|
||||
if (g_model.frsky.currentSource > CURRENT_SOURCE_HUB) {
|
||||
uint16_t divider = (g_model.frsky.channels[g_model.frsky.currentSource-1].ratio << g_model.frsky.channels[g_model.frsky.currentSource-1].multiplier);
|
||||
if (divider > 5) {
|
||||
currentConsumptionBoundary = 360000L / divider;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user