mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Added offset parameter to ESC sensor current calculation to compensate for non-ESC consumption.
This commit is contained in:
parent
b2f7aa3c36
commit
670cd49bd6
3 changed files with 6 additions and 3 deletions
|
@ -222,8 +222,8 @@ void currentMeterESCRefresh(int32_t lastUpdateAt)
|
|||
|
||||
escSensorData_t *escData = getEscSensorData(ESC_SENSOR_COMBINED);
|
||||
if (escData && escData->dataAge <= ESC_BATTERY_AGE_MAX) {
|
||||
currentMeterESCState.amperage = escData->current;
|
||||
currentMeterESCState.mAhDrawn = escData->consumption;
|
||||
currentMeterESCState.amperage = escData->current + escSensorConfig()->offset / 10;
|
||||
currentMeterESCState.mAhDrawn = escData->consumption + escSensorConfig()->offset * millis() / (1000.0f * 3600);
|
||||
} else {
|
||||
currentMeterESCState.amperage = 0;
|
||||
currentMeterESCState.mAhDrawn = 0;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
typedef struct escSensorConfig_s {
|
||||
uint8_t halfDuplex; // Set to false to listen on the TX pin for telemetry data
|
||||
uint16_t offset; // offset consumed by the flight controller / VTX / cam / ... in milliampere
|
||||
|
||||
} escSensorConfig_t;
|
||||
|
||||
PG_DECLARE(escSensorConfig_t, escSensorConfig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue