diff --git a/src/modules/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c index dc081f0644..d2faa1a4f5 100644 --- a/src/modules/sensors/sensor_params.c +++ b/src/modules/sensors/sensor_params.c @@ -1842,7 +1842,7 @@ PARAM_DEFINE_FLOAT(BAT_V_SCALING, -1.0f); * * @group Battery Calibration */ -PARAM_DEFINE_FLOAT(BAT_C_SCALING, 0.0124); /* scaling for 3DR power brick */ +PARAM_DEFINE_FLOAT(BAT_C_SCALING, -1.0); /** diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index f41c9dcf4b..79a2b54a63 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -883,6 +883,22 @@ Sensors::parameters_update() /* scaling of ADC ticks to battery current */ if (param_get(_parameter_handles.battery_current_scaling, &(_parameters.battery_current_scaling)) != OK) { warnx("%s", paramerr); + } else if (_parameters.battery_current_scaling < 0.0f) { + /* apply scaling according to defaults if set to default */ +#if defined (CONFIG_ARCH_BOARD_PX4FMU_V4) + /* current scaling for ACSP4 */ + _parameters.battery_current_scaling = 0.029296875f; +#elif defined (CONFIG_ARCH_BOARD_PX4FMU_V2) + /* current scaling for 3DR power brick */ + _parameters.battery_current_scaling = 0.0124f; +#elif defined (CONFIG_ARCH_BOARD_AEROCORE) + _parameters.battery_current_scaling = 0.0124f; +#elif defined (CONFIG_ARCH_BOARD_PX4FMU_V1) + _parameters.battery_current_scaling = 0.0124f; +#else + /* ensure a missing default leads to an unrealistic current value */ + _parameters.battery_voltage_scaling = 0.00001f; +#endif } param_get(_parameter_handles.board_rotation, &(_parameters.board_rotation));