Fixed changed requested

This commit is contained in:
Bas Delfos 2016-12-05 22:51:21 +01:00
parent c1d442279f
commit 8bd4991823
1 changed files with 14 additions and 6 deletions

View File

@ -269,9 +269,11 @@ void updateCurrentMeter(int32_t lastUpdateAt, rxConfig_t *rxConfig, uint16_t dea
updateCurrentDrawn(lastUpdateAt); updateCurrentDrawn(lastUpdateAt);
updateConsumptionWarning();
break; break;
case CURRENT_SENSOR_VIRTUAL: case CURRENT_SENSOR_VIRTUAL:
amperage = (int32_t)batteryConfig->currentMeterOffset; amperageLatest = (int32_t)batteryConfig->currentMeterOffset;
if (ARMING_FLAG(ARMED)) { if (ARMING_FLAG(ARMED)) {
throttleStatus_e throttleStatus = calculateThrottleStatus(rxConfig, deadband3d_throttle); throttleStatus_e throttleStatus = calculateThrottleStatus(rxConfig, deadband3d_throttle);
int throttleOffset = (int32_t)rcCommand[THROTTLE] - 1000; int throttleOffset = (int32_t)rcCommand[THROTTLE] - 1000;
@ -279,24 +281,30 @@ void updateCurrentMeter(int32_t lastUpdateAt, rxConfig_t *rxConfig, uint16_t dea
throttleOffset = 0; throttleOffset = 0;
} }
int throttleFactor = throttleOffset + (throttleOffset * throttleOffset / 50); int throttleFactor = throttleOffset + (throttleOffset * throttleOffset / 50);
amperage += throttleFactor * (int32_t)batteryConfig->currentMeterScale / 1000; amperageLatest += throttleFactor * (int32_t)batteryConfig->currentMeterScale / 1000;
} }
amperage = amperageLatest;
updateCurrentDrawn(lastUpdateAt); updateCurrentDrawn(lastUpdateAt);
updateConsumptionWarning();
break; break;
case CURRENT_SENSOR_ESC: case CURRENT_SENSOR_ESC:
#ifdef USE_ESC_SENSOR #ifdef USE_ESC_SENSOR
if (feature(FEATURE_ESC_SENSOR)) if (feature(FEATURE_ESC_SENSOR)) {
{ amperageLatest = getEscSensorCurrent();
amperage = getEscSensorCurrent(); amperage = amperageLatest;
mAhDrawn = getEscSensorConsumption(); mAhDrawn = getEscSensorConsumption();
updateConsumptionWarning();
} }
#endif
break; break;
#endif
case CURRENT_SENSOR_NONE: case CURRENT_SENSOR_NONE:
amperage = 0; amperage = 0;
amperageLatest = 0;
break; break;
} }