fixup Mikeller and levinap
This commit is contained in:
parent
7b196b2ed7
commit
bc596e1f8b
|
@ -654,7 +654,6 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
|
|||
sbufWriteU16(dst, batteryConfig()->batteryCapacity);
|
||||
sbufWriteU8(dst, batteryConfig()->voltageMeterSource);
|
||||
sbufWriteU8(dst, batteryConfig()->currentMeterSource);
|
||||
sbufWriteU8(dst, batteryConfig()->forceBatteryCellCount);
|
||||
break;
|
||||
|
||||
case MSP_TRANSPONDER_CONFIG: {
|
||||
|
@ -2419,7 +2418,6 @@ static mspResult_e mspCommonProcessInCommand(uint8_t cmdMSP, sbuf_t *src, mspPos
|
|||
batteryConfigMutable()->batteryCapacity = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltageMeterSource = sbufReadU8(src);
|
||||
batteryConfigMutable()->currentMeterSource = sbufReadU8(src);
|
||||
batteryConfigMutable()->forceBatteryCellCount = sbufReadU8(src);
|
||||
break;
|
||||
|
||||
#if defined(USE_OSD)
|
||||
|
|
|
@ -682,7 +682,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "use_cbat_alerts", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, useConsumptionAlerts) },
|
||||
{ "cbat_alert_percent", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 100 }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, consumptionWarningPercentage) },
|
||||
{ "vbat_cutoff_percent", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 100 }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, lvcPercentage) },
|
||||
{ "force_battery_cell_count", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 80 }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, forceBatteryCellCount) },
|
||||
{ "force_battery_cell_count", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 24 }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, forceBatteryCellCount) },
|
||||
|
||||
// PG_VOLTAGE_SENSOR_ADC_CONFIG
|
||||
{ "vbat_scale", VAR_UINT8 | MASTER_VALUE, .config.minmax = { VBAT_SCALE_MIN, VBAT_SCALE_MAX }, PG_VOLTAGE_SENSOR_ADC_CONFIG, offsetof(voltageSensorADCConfig_t, vbatscale) },
|
||||
|
|
|
@ -183,17 +183,20 @@ void batteryUpdatePresence(void)
|
|||
/* battery has just been connected - calculate cells, warning voltages and reset state */
|
||||
|
||||
|
||||
unsigned cells = (voltageMeter.filtered / batteryConfig()->vbatmaxcellvoltage) + 1;
|
||||
if (cells > 8) {
|
||||
// something is wrong, we expect 8 cells maximum (and autodetection will be problematic at 6+ cells)
|
||||
cells = 8;
|
||||
}
|
||||
|
||||
consumptionState = voltageState = BATTERY_OK;
|
||||
if (batteryConfig()->forceBatteryCellCount != 0) {
|
||||
batteryCellCount = batteryConfig()->forceBatteryCellCount;
|
||||
} else {
|
||||
batteryCellCount = cells;
|
||||
unsigned cells = (voltageMeter.filtered / batteryConfig()->vbatmaxcellvoltage) + 1;
|
||||
if (cells > 8) {
|
||||
// something is wrong, we expect 8 cells maximum (and autodetection will be problematic at 6+ cells)
|
||||
cells = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
batteryCellCount = cells;
|
||||
}
|
||||
}
|
||||
batteryWarningVoltage = batteryCellCount * batteryConfig()->vbatwarningcellvoltage;
|
||||
batteryCriticalVoltage = batteryCellCount * batteryConfig()->vbatmincellvoltage;
|
||||
|
|
|
@ -48,7 +48,6 @@ typedef struct batteryConfig_s {
|
|||
|
||||
uint8_t vbatfullcellvoltage; // Cell voltage at which the battery is deemed to be "full" 0.1V units, default is 41 (4.1V)
|
||||
|
||||
// cells
|
||||
uint8_t forceBatteryCellCount; // number of cells in battery, used for overwriting auto-detected cell count if someone has issues with it.
|
||||
|
||||
} batteryConfig_t;
|
||||
|
|
|
@ -381,7 +381,6 @@ static bool bstSlaveProcessFeedbackCommand(uint8_t bstRequest)
|
|||
bstWrite8(batteryConfig()->vbatmincellvoltage);
|
||||
bstWrite8(batteryConfig()->vbatmaxcellvoltage);
|
||||
bstWrite8(batteryConfig()->vbatwarningcellvoltage);
|
||||
bstWrite8(batteryConfig()->forceBatteryCellCount);
|
||||
break;
|
||||
|
||||
case BST_FEATURE:
|
||||
|
@ -539,7 +538,6 @@ static bool bstSlaveProcessWriteCommand(uint8_t bstWriteCommand)
|
|||
batteryConfigMutable()->vbatmincellvoltage = bstRead8(); // vbatlevel_warn1 in MWC2.3 GUI
|
||||
batteryConfigMutable()->vbatmaxcellvoltage = bstRead8(); // vbatlevel_warn2 in MWC2.3 GUI
|
||||
batteryConfigMutable()->vbatwarningcellvoltage = bstRead8(); // vbatlevel when buzzer starts to alert
|
||||
batteryConfigMutable()->forceBatteryCellCount = bstRead8();
|
||||
break;
|
||||
|
||||
case BST_ACC_CALIBRATION:
|
||||
|
|
Loading…
Reference in New Issue