diff --git a/ROMFS/px4fmu_common/init.d-posix/rcS b/ROMFS/px4fmu_common/init.d-posix/rcS index 62d316f754..8ba32d760d 100644 --- a/ROMFS/px4fmu_common/init.d-posix/rcS +++ b/ROMFS/px4fmu_common/init.d-posix/rcS @@ -126,7 +126,7 @@ then param set SYS_RESTART_TYPE 2 fi -param set-default BAT_N_CELLS 4 +param set-default BAT1_N_CELLS 4 param set-default CBRK_AIRSPD_CHK 0 param set-default CBRK_SUPPLY_CHK 894281 diff --git a/ROMFS/px4fmu_common/init.d/airframes/1000_rc_fw_easystar.hil b/ROMFS/px4fmu_common/init.d/airframes/1000_rc_fw_easystar.hil index 9b88201b52..8675c0e647 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/1000_rc_fw_easystar.hil +++ b/ROMFS/px4fmu_common/init.d/airframes/1000_rc_fw_easystar.hil @@ -19,7 +19,7 @@ . ${R}etc/init.d/rc.fw_defaults -param set-default BAT_N_CELLS 3 +param set-default BAT1_N_CELLS 3 param set-default FW_AIRSPD_MAX 20 param set-default FW_AIRSPD_MIN 12 diff --git a/ROMFS/px4fmu_common/init.d/airframes/10016_3dr_iris b/ROMFS/px4fmu_common/init.d/airframes/10016_3dr_iris index ea593e825b..22f5491571 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/10016_3dr_iris +++ b/ROMFS/px4fmu_common/init.d/airframes/10016_3dr_iris @@ -38,8 +38,9 @@ param set-default MC_YAWRATE_P 0.25 param set-default MC_YAWRATE_I 0.25 param set-default MC_YAWRATE_D 0 -param set-default BAT_V_DIV 12.27559 -param set-default BAT_A_PER_V 15.39103 +param set-default BAT1_V_DIV 12.27559 +param set-default BAT1_A_PER_V 15.39103 + set MIXER quad_w set PWM_OUT 1234 diff --git a/ROMFS/px4fmu_common/init.d/airframes/10017_steadidrone_qu4d b/ROMFS/px4fmu_common/init.d/airframes/10017_steadidrone_qu4d index 1d7e3e268c..d84243b610 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/10017_steadidrone_qu4d +++ b/ROMFS/px4fmu_common/init.d/airframes/10017_steadidrone_qu4d @@ -26,7 +26,7 @@ . ${R}etc/init.d/rc.mc_defaults -param set-default BAT_N_CELLS 4 +param set-default BAT1_N_CELLS 4 param set-default MC_ROLL_P 7 param set-default MC_ROLLRATE_P 0.13 diff --git a/ROMFS/px4fmu_common/init.d/airframes/10018_tbs_endurance b/ROMFS/px4fmu_common/init.d/airframes/10018_tbs_endurance index 05b39e571e..12796f4e86 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/10018_tbs_endurance +++ b/ROMFS/px4fmu_common/init.d/airframes/10018_tbs_endurance @@ -26,8 +26,8 @@ . ${R}etc/init.d/rc.mc_defaults -param set-default BAT_N_CELLS 6 -param set-default BAT_V_EMPTY 3.5 +param set-default BAT1_N_CELLS 6 +param set-default BAT1_V_EMPTY 3.5 param set-default MC_ROLL_P 7 param set-default MC_ROLLRATE_P 0.08 @@ -45,6 +45,7 @@ param set-default MC_YAWRATE_D 0 param set-default MPC_XY_VEL_MAX 2 param set-default PWM_MAIN_MIN 1080 + set MIXER quad_w set PWM_OUT 1234 diff --git a/ROMFS/px4fmu_common/init.d/airframes/1002_standard_vtol.hil b/ROMFS/px4fmu_common/init.d/airframes/1002_standard_vtol.hil index 0eb7b40ff2..636a1cd94a 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/1002_standard_vtol.hil +++ b/ROMFS/px4fmu_common/init.d/airframes/1002_standard_vtol.hil @@ -14,7 +14,7 @@ . ${R}etc/init.d/rc.vtol_defaults -param set-default BAT_N_CELLS 3 +param set-default BAT1_N_CELLS 3 param set-default COM_RC_IN_MODE 1 diff --git a/ROMFS/px4fmu_common/init.d/airframes/12002_steadidrone_mavrik b/ROMFS/px4fmu_common/init.d/airframes/12002_steadidrone_mavrik index e91e70e8d6..d2b4d45a83 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/12002_steadidrone_mavrik +++ b/ROMFS/px4fmu_common/init.d/airframes/12002_steadidrone_mavrik @@ -44,7 +44,8 @@ param set-default MPC_HOLD_MAX_XY 0.25 param set-default MPC_THR_MIN 0.15 param set-default MPC_Z_VEL_MAX_DN 2 -param set-default BAT_N_CELLS 4 +param set-default BAT1_N_CELLS 4 + set MIXER octo_cox_w set PWM_OUT 12345678 diff --git a/ROMFS/px4fmu_common/init.d/airframes/13013_deltaquad b/ROMFS/px4fmu_common/init.d/airframes/13013_deltaquad index 056a7681cb..bf0754147b 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/13013_deltaquad +++ b/ROMFS/px4fmu_common/init.d/airframes/13013_deltaquad @@ -23,9 +23,9 @@ . ${R}etc/init.d/rc.vtol_defaults -param set-default BAT_CAPACITY 23000 -param set-default BAT_N_CELLS 4 -param set-default BAT_R_INTERNAL 0.0025 +param set-default BAT1_CAPACITY 23000 +param set-default BAT1_N_CELLS 4 +param set-default BAT1_R_INTERNAL 0.0025 param set-default CBRK_AIRSPD_CHK 162128 param set-default CBRK_IO_SAFETY 22027 diff --git a/ROMFS/px4fmu_common/init.d/airframes/13014_vtol_babyshark b/ROMFS/px4fmu_common/init.d/airframes/13014_vtol_babyshark index 3dce88f318..a76c7c707a 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/13014_vtol_babyshark +++ b/ROMFS/px4fmu_common/init.d/airframes/13014_vtol_babyshark @@ -23,8 +23,7 @@ . ${R}etc/init.d/rc.vtol_defaults - -param set-default BAT_N_CELLS 6 +param set-default BAT1_N_CELLS 6 param set-default FW_AIRSPD_MAX 30 param set-default FW_AIRSPD_MIN 19 diff --git a/ROMFS/px4fmu_common/init.d/airframes/17002_TF-AutoG2 b/ROMFS/px4fmu_common/init.d/airframes/17002_TF-AutoG2 index 048f4bb1be..8c847cbb44 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/17002_TF-AutoG2 +++ b/ROMFS/px4fmu_common/init.d/airframes/17002_TF-AutoG2 @@ -26,8 +26,8 @@ . ${R}etc/init.d/rc.fw_defaults -param set-default BAT_CAPACITY 2500 -param set-default BAT_N_CELLS 3 +param set-default BAT1_CAPACITY 2500 +param set-default BAT1_N_CELLS 3 param set-default PWM_AUX_RATE 50 param set-default PWM_MAIN_RATE 50 @@ -46,5 +46,6 @@ param set-default FW_R_LIM 40 param set-default FW_P_LIM_MAX 25 param set-default FW_P_LIM_MIN -5 param set-default FW_P_RMAX_NEG 20 + set MIXER TF-AutoG2 set MIXER_AUX pass diff --git a/ROMFS/px4fmu_common/init.d/airframes/3033_wingwing b/ROMFS/px4fmu_common/init.d/airframes/3033_wingwing index ddb33dbfd5..1e9f4baea1 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/3033_wingwing +++ b/ROMFS/px4fmu_common/init.d/airframes/3033_wingwing @@ -23,7 +23,7 @@ . ${R}etc/init.d/rc.fw_defaults -param set-default BAT_N_CELLS 2 +param set-default BAT1_N_CELLS 2 param set-default FW_AIRSPD_MAX 15 param set-default FW_AIRSPD_MIN 10 param set-default FW_AIRSPD_TRIM 13 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4016_holybro_px4vision b/ROMFS/px4fmu_common/init.d/airframes/4016_holybro_px4vision index da92a11043..2ea10ead55 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4016_holybro_px4vision +++ b/ROMFS/px4fmu_common/init.d/airframes/4016_holybro_px4vision @@ -127,9 +127,9 @@ param set-default IMU_GYRO_CUTOFF 100 param set-default SENS_EN_PMW3901 1 # Power Parameters -param set-default BAT_N_CELLS 4 -param set-default BAT_A_PER_V 36.364 -param set-default BAT_V_DIV 18.182 +param set-default BAT1_N_CELLS 4 +param set-default BAT1_A_PER_V 36.364 +param set-default BAT1_V_DIV 18.182 # Circuit breakers param set-default CBRK_IO_SAFETY 22027 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4041_beta75x b/ROMFS/px4fmu_common/init.d/airframes/4041_beta75x index beb21c2937..50acc38438 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4041_beta75x +++ b/ROMFS/px4fmu_common/init.d/airframes/4041_beta75x @@ -54,7 +54,7 @@ param set-default DSHOT_CONFIG 600 param set-default SYS_HAS_BARO 0 param set-default SYS_HAS_MAG 0 -param set-default BAT_N_CELLS 2 +param set-default BAT1_N_CELLS 2 # The Whoop uses reversed props set MIXER quad_h set PWM_OUT 1234 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4052_holybro_qav250 b/ROMFS/px4fmu_common/init.d/airframes/4052_holybro_qav250 index df5fa21481..de345b66d9 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4052_holybro_qav250 +++ b/ROMFS/px4fmu_common/init.d/airframes/4052_holybro_qav250 @@ -20,7 +20,7 @@ set PWM_OUT 1234 # The set does not include a battery, but most people will probably use 4S -param set-default BAT_N_CELLS 4 +param set-default BAT1_N_CELLS 4 param set-default IMU_GYRO_CUTOFF 120 param set-default IMU_DGYRO_CUTOFF 45 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4053_holybro_kopis2 b/ROMFS/px4fmu_common/init.d/airframes/4053_holybro_kopis2 index 41a287c4c3..fc5695e401 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4053_holybro_kopis2 +++ b/ROMFS/px4fmu_common/init.d/airframes/4053_holybro_kopis2 @@ -17,7 +17,7 @@ set MIXER quad_x set PWM_OUT 1234 -param set-default BAT_N_CELLS 4 +param set-default BAT1_N_CELLS 4 param set-default GPS_1_CONFIG 0 param set-default RC_PORT_CONFIG 201 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4060_dji_matrice_100 b/ROMFS/px4fmu_common/init.d/airframes/4060_dji_matrice_100 index 7ea158a44a..74d48f45c6 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4060_dji_matrice_100 +++ b/ROMFS/px4fmu_common/init.d/airframes/4060_dji_matrice_100 @@ -17,7 +17,7 @@ set MIXER quad_x set PWM_OUT 1234 -param set-default BAT_N_CELLS 6 +param set-default BAT1_N_CELLS 6 param set-default MC_ROLL_P 6.5 param set-default MC_ROLLRATE_P 0.05 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4071_ifo b/ROMFS/px4fmu_common/init.d/airframes/4071_ifo index eb3e0a680f..534cc9ce69 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4071_ifo +++ b/ROMFS/px4fmu_common/init.d/airframes/4071_ifo @@ -92,10 +92,10 @@ param set-default MPC_TKO_RAMP_T 1 param set-default MPC_TKO_SPEED 1.1 param set-default MPC_VEL_MANUAL 3 -param set-default BAT_SOURCE 0 -param set-default BAT_N_CELLS 4 -param set-default BAT_V_DIV 10.14 -param set-default BAT_A_PER_V 18.18 +param set-default BAT1_SOURCE 0 +param set-default BAT1_N_CELLS 4 +param set-default BAT1_V_DIV 10.14 +param set-default BAT1_A_PER_V 18.18 #param set CBRK_IO_SAFETY 22027 param set-default COM_DISARM_LAND 2 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4072_draco b/ROMFS/px4fmu_common/init.d/airframes/4072_draco index 18afd3735f..0a98a9e251 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4072_draco +++ b/ROMFS/px4fmu_common/init.d/airframes/4072_draco @@ -73,7 +73,7 @@ param set-default PWM_MAIN_RATE 0 param set-default SENS_BOARD_ROT 2 -param set-default BAT_SOURCE 0 +param set-default BAT1_SOURCE 0 param set-default CBRK_IO_SAFETY 22027 #param set COM_DISARM_LAND 3 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4073_ifo-s b/ROMFS/px4fmu_common/init.d/airframes/4073_ifo-s index 3d9a7c34d4..ed3d69b9e1 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4073_ifo-s +++ b/ROMFS/px4fmu_common/init.d/airframes/4073_ifo-s @@ -102,10 +102,10 @@ param set-default MPC_TKO_RAMP_T 1 param set-default MPC_TKO_SPEED 1.1 param set-default MPC_VEL_MANUAL 3 -param set-default BAT_SOURCE 0 -param set-default BAT_N_CELLS 4 -param set-default BAT_V_DIV 10.14 -param set-default BAT_A_PER_V 18.18 +param set-default BAT1_SOURCE 0 +param set-default BAT1_N_CELLS 4 +param set-default BAT1_V_DIV 10.14 +param set-default BAT1_A_PER_V 18.18 #param set CBRK_IO_SAFETY 22027 param set-default COM_DISARM_LAND 2 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4090_nanomind b/ROMFS/px4fmu_common/init.d/airframes/4090_nanomind index a51335b8fa..5159a4b0c9 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4090_nanomind +++ b/ROMFS/px4fmu_common/init.d/airframes/4090_nanomind @@ -21,7 +21,7 @@ set MIXER quad_x set PWM_OUT 1234 -param set-default BAT_N_CELLS 1 +param set-default BAT1_N_CELLS 1 param set-default MC_ROLL_P 8 param set-default MC_ROLLRATE_P 0.19 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4250_teal b/ROMFS/px4fmu_common/init.d/airframes/4250_teal index 117d4037aa..c7ade39b4a 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4250_teal +++ b/ROMFS/px4fmu_common/init.d/airframes/4250_teal @@ -32,17 +32,18 @@ set PWM_OUT 1234 param reset_all SYS_AUTOSTART SYS_AUTOCONFIG RC* COM_FLTMODE* LND_FLIGHT_T_* TC_* CAL_ACC* CAL_GYRO* CAL_MAG* SENS_BOARD* EKF2_MAGBIAS* # battery -param set-default BAT_CAPACITY 2750 param set-default BAT_CRIT_THR 0.15 param set-default BAT_EMERGEN_THR 0.075 param set-default BAT_LOW_THR 0.20 -param set-default BAT_N_CELLS 4 -param set-default BAT_R_INTERNAL 0.06 -param set-default BAT_SOURCE 1 -param set-default BAT_V_CHARGED 4.15 -param set-default BAT_V_DIV 11.1625 -param set-default BAT_V_EMPTY 3.65 -param set-default BAT_V_OFFS_CURR -0.0045 + +param set-default BAT1_CAPACITY 2750 +param set-default BAT1_N_CELLS 4 +param set-default BAT1_R_INTERNAL 0.06 +param set-default BAT1_SOURCE 1 +param set-default BAT1_V_CHARGED 4.15 +param set-default BAT1_V_DIV 11.1625 +param set-default BAT1_V_EMPTY 3.65 +param set-default BAT1_V_OFFS_CURR -0.0045 # sensor calibration param set-default CAL_MAG_SIDES 63 diff --git a/ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie b/ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie index da3c4bfac0..9ce7a49f5a 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie +++ b/ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie @@ -19,9 +19,9 @@ set MIXER quad_x_cw set PWM_OUT 1234 -param set-default BAT_N_CELLS 1 -param set-default BAT_CAPACITY 240 -param set-default BAT_SOURCE 1 +param set-default BAT1_N_CELLS 1 +param set-default BAT1_CAPACITY 240 +param set-default BAT1_SOURCE 1 param set-default CBRK_SUPPLY_CHK 894281 param set-default CBRK_USB_CHK 197848 diff --git a/ROMFS/px4fmu_common/init.d/airframes/50000_generic_ground_vehicle b/ROMFS/px4fmu_common/init.d/airframes/50000_generic_ground_vehicle index 41242a98c5..e00793cd4a 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/50000_generic_ground_vehicle +++ b/ROMFS/px4fmu_common/init.d/airframes/50000_generic_ground_vehicle @@ -16,7 +16,7 @@ . ${R}etc/init.d/rc.rover_defaults -param set-default BAT_N_CELLS 2 +param set-default BAT1_N_CELLS 2 param set-default EKF2_ANGERR_INIT 0.01 param set-default EKF2_GBIAS_INIT 0.01 diff --git a/ROMFS/px4fmu_common/init.d/airframes/50003_aion_robotics_r1_rover b/ROMFS/px4fmu_common/init.d/airframes/50003_aion_robotics_r1_rover index 5652765a67..c6ac9a2f9f 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/50003_aion_robotics_r1_rover +++ b/ROMFS/px4fmu_common/init.d/airframes/50003_aion_robotics_r1_rover @@ -19,7 +19,7 @@ . ${R}etc/init.d/rc.rover_defaults -param set-default BAT_N_CELLS 4 +param set-default BAT1_N_CELLS 4 param set-default EKF2_GBIAS_INIT 0.01 param set-default EKF2_ANGERR_INIT 0.01 diff --git a/ROMFS/px4fmu_common/init.d/airframes/50004_nxpcup_car_dfrobot_gpx b/ROMFS/px4fmu_common/init.d/airframes/50004_nxpcup_car_dfrobot_gpx index fd6f195605..92ea1bea32 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/50004_nxpcup_car_dfrobot_gpx +++ b/ROMFS/px4fmu_common/init.d/airframes/50004_nxpcup_car_dfrobot_gpx @@ -21,7 +21,7 @@ . ${R}etc/init.d/rc.rover_defaults -param set-default BAT_N_CELLS 2 +param set-default BAT1_N_CELLS 2 param set-default EKF2_GBIAS_INIT 0.01 param set-default EKF2_ANGERR_INIT 0.01 diff --git a/ROMFS/px4fmu_common/init.d/airframes/6002_draco_r b/ROMFS/px4fmu_common/init.d/airframes/6002_draco_r index 1eefccbfb1..8be6345a9e 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/6002_draco_r +++ b/ROMFS/px4fmu_common/init.d/airframes/6002_draco_r @@ -116,9 +116,9 @@ param set-default COM_DISARM_LAND 3 param set-default PWM_MAIN_RATE 0 # Battery -param set-default BAT_SOURCE 0 -param set-default BAT_N_CELLS 4 -param set-default BAT_V_DIV 10.133 +param set-default BAT1_SOURCE 0 +param set-default BAT1_N_CELLS 4 +param set-default BAT1_V_DIV 10.133 # TELEM1 ttyS1 param set-default MAV_0_CONFIG 101 diff --git a/boards/cuav/nora/init/rc.board_defaults b/boards/cuav/nora/init/rc.board_defaults index 592f628f5a..bbc9316544 100644 --- a/boards/cuav/nora/init/rc.board_defaults +++ b/boards/cuav/nora/init/rc.board_defaults @@ -6,11 +6,9 @@ # Enables the 2nd bank of mixers set AUX_BANK2 yes -param set-default BAT_V_DIV 18 param set-default BAT1_V_DIV 18 param set-default BAT2_V_DIV 18 -param set-default BAT_A_PER_V 24 param set-default BAT1_A_PER_V 24 param set-default BAT2_A_PER_V 24 diff --git a/boards/cuav/x7pro/init/rc.board_defaults b/boards/cuav/x7pro/init/rc.board_defaults index 801c09e4c0..fcdbef5c48 100644 --- a/boards/cuav/x7pro/init/rc.board_defaults +++ b/boards/cuav/x7pro/init/rc.board_defaults @@ -6,11 +6,9 @@ # Enables the 2nd bank of mixers set AUX_BANK2 yes -param set-default BAT_V_DIV 18 param set-default BAT1_V_DIV 18 param set-default BAT2_V_DIV 18 -param set-default BAT_A_PER_V 24 param set-default BAT1_A_PER_V 24 param set-default BAT2_A_PER_V 24 diff --git a/boards/cubepilot/cubeorange/init/rc.board_defaults b/boards/cubepilot/cubeorange/init/rc.board_defaults index d5e3382247..9840a14497 100644 --- a/boards/cubepilot/cubeorange/init/rc.board_defaults +++ b/boards/cubepilot/cubeorange/init/rc.board_defaults @@ -3,12 +3,9 @@ # board specific defaults #------------------------------------------------------------------------------ - -param set-default BAT_V_DIV 10.1 param set-default BAT1_V_DIV 10.1 param set-default BAT2_V_DIV 10.1 -param set-default BAT_A_PER_V 17 param set-default BAT1_A_PER_V 17 param set-default BAT2_A_PER_V 17 diff --git a/boards/cubepilot/cubeyellow/init/rc.board_defaults b/boards/cubepilot/cubeyellow/init/rc.board_defaults index d5e3382247..6f39beb0c8 100644 --- a/boards/cubepilot/cubeyellow/init/rc.board_defaults +++ b/boards/cubepilot/cubeyellow/init/rc.board_defaults @@ -4,11 +4,9 @@ #------------------------------------------------------------------------------ -param set-default BAT_V_DIV 10.1 param set-default BAT1_V_DIV 10.1 param set-default BAT2_V_DIV 10.1 -param set-default BAT_A_PER_V 17 param set-default BAT1_A_PER_V 17 param set-default BAT2_A_PER_V 17 diff --git a/posix-configs/SITL/init/test/test_shutdown b/posix-configs/SITL/init/test/test_shutdown index 6f5649f9f2..f88e5f376c 100644 --- a/posix-configs/SITL/init/test/test_shutdown +++ b/posix-configs/SITL/init/test/test_shutdown @@ -5,7 +5,7 @@ param load -param set BAT_N_CELLS 3 +param set BAT1_N_CELLS 3 param set CBRK_SUPPLY_CHK 894281 param set MAV_TYPE 22 param set VT_TYPE 2 diff --git a/posix-configs/bbblue/px4.config b/posix-configs/bbblue/px4.config index afe9f4bc57..0e598c3011 100644 --- a/posix-configs/bbblue/px4.config +++ b/posix-configs/bbblue/px4.config @@ -41,7 +41,7 @@ param set MAV_TYPE 2 param set BAT1_V_CHANNEL 5 # Battery voltage scale factor, from BBBlue schematics: (4.7K + 47K) / 4.7K = 11 -param set BAT_V_DIV 11.0 +param set BAT1_V_DIV 11.0 dataman start diff --git a/posix-configs/bbblue/px4_fw.config b/posix-configs/bbblue/px4_fw.config index 15d506d48a..9694e2ebc2 100644 --- a/posix-configs/bbblue/px4_fw.config +++ b/posix-configs/bbblue/px4_fw.config @@ -41,7 +41,7 @@ param set MAV_TYPE 2 param set BAT1_V_CHANNEL 5 # Battery voltage scale factor, from BBBlue schematics: (4.7K + 47K) / 4.7K = 11 -param set BAT_V_DIV 11.0 +param set BAT1_V_DIV 11.0 dataman start diff --git a/src/drivers/batt_smbus/batt_smbus.cpp b/src/drivers/batt_smbus/batt_smbus.cpp index c7b7ab5fe9..313d0ec75d 100644 --- a/src/drivers/batt_smbus/batt_smbus.cpp +++ b/src/drivers/batt_smbus/batt_smbus.cpp @@ -54,8 +54,8 @@ BATT_SMBUS::BATT_SMBUS(const I2CSPIDriverConfig &config, SMBus *interface) : int32_t battsource = 1; int32_t batt_device_type = static_cast(SMBUS_DEVICE_TYPE::UNDEFINED); - param_set(param_find("BAT_SOURCE"), &battsource); - param_get(param_find("BAT_SMBUS_MODEL"), &batt_device_type); + param_set(param_find("BAT1_SOURCE"), &battsource); + param_get(param_find("BAT1_SMBUS_MODEL"), &batt_device_type); //TODO: probe the device and autodetect its type @@ -84,7 +84,7 @@ BATT_SMBUS::~BATT_SMBUS() } int32_t battsource = 0; - param_set(param_find("BAT_SOURCE"), &battsource); + param_set(param_find("BAT1_SOURCE"), &battsource); } void BATT_SMBUS::RunImpl() @@ -359,13 +359,14 @@ int BATT_SMBUS::get_startup_info() int ret = PX4_OK; // Read battery threshold params on startup. + // TODO: support instances param_get(param_find("BAT_CRIT_THR"), &_crit_thr); param_get(param_find("BAT_LOW_THR"), &_low_thr); param_get(param_find("BAT_EMERGEN_THR"), &_emergency_thr); - param_get(param_find("BAT_C_MULT"), &_c_mult); + param_get(param_find("BAT1_C_MULT"), &_c_mult); int32_t cell_count_param = 0; - param_get(param_find("BAT_N_CELLS"), &cell_count_param); + param_get(param_find("BAT1_N_CELLS"), &cell_count_param); _cell_count = math::min((uint8_t)cell_count_param, MAX_NUM_OF_CELLS); ret |= _interface->block_read(BATT_SMBUS_MANUFACTURER_NAME, _manufacturer_name, BATT_SMBUS_MANUFACTURER_NAME_SIZE, diff --git a/src/drivers/batt_smbus/parameters.c b/src/drivers/batt_smbus/parameters.c index dd3c9d22bf..0d256c7577 100644 --- a/src/drivers/batt_smbus/parameters.c +++ b/src/drivers/batt_smbus/parameters.c @@ -48,7 +48,7 @@ PARAM_DEFINE_INT32(SENS_EN_BATT, 0); * @decimal 1 * @group Sensors */ -PARAM_DEFINE_FLOAT(BAT_C_MULT, 1.0f); +PARAM_DEFINE_FLOAT(BAT1_C_MULT, 1.0f); /** * Battery device model @@ -61,4 +61,4 @@ PARAM_DEFINE_FLOAT(BAT_C_MULT, 1.0f); * @value 1 BQ40Z50 based * @value 2 BQ40Z80 based */ -PARAM_DEFINE_INT32(BAT_SMBUS_MODEL, 0); +PARAM_DEFINE_INT32(BAT1_SMBUS_MODEL, 0); diff --git a/src/lib/battery/battery.cpp b/src/lib/battery/battery.cpp index 4f60a470f0..a903e24da2 100644 --- a/src/lib/battery/battery.cpp +++ b/src/lib/battery/battery.cpp @@ -92,14 +92,6 @@ Battery::Battery(int index, ModuleParams *parent, const int sample_interval_us) _param_handles.crit_thr = param_find("BAT_CRIT_THR"); _param_handles.emergen_thr = param_find("BAT_EMERGEN_THR"); - _param_handles.v_empty_old = param_find("BAT_V_EMPTY"); - _param_handles.v_charged_old = param_find("BAT_V_CHARGED"); - _param_handles.n_cells_old = param_find("BAT_N_CELLS"); - _param_handles.capacity_old = param_find("BAT_CAPACITY"); - _param_handles.v_load_drop_old = param_find("BAT_V_LOAD_DROP"); - _param_handles.r_internal_old = param_find("BAT_R_INTERNAL"); - _param_handles.source_old = param_find("BAT_SOURCE"); - updateParams(); } @@ -255,32 +247,13 @@ void Battery::computeScale() void Battery::updateParams() { - if (_index == 1) { - migrateParam(_param_handles.v_empty_old, _param_handles.v_empty, &_params.v_empty_old, &_params.v_empty, - _first_parameter_update); - migrateParam(_param_handles.v_charged_old, _param_handles.v_charged, &_params.v_charged_old, &_params.v_charged, - _first_parameter_update); - migrateParam(_param_handles.n_cells_old, _param_handles.n_cells, &_params.n_cells_old, &_params.n_cells, - _first_parameter_update); - migrateParam(_param_handles.capacity_old, _param_handles.capacity, &_params.capacity_old, &_params.capacity, - _first_parameter_update); - migrateParam(_param_handles.v_load_drop_old, _param_handles.v_load_drop, &_params.v_load_drop_old, - &_params.v_load_drop, _first_parameter_update); - migrateParam(_param_handles.r_internal_old, _param_handles.r_internal, &_params.r_internal_old, - &_params.r_internal, _first_parameter_update); - migrateParam(_param_handles.source_old, _param_handles.source, &_params.source_old, &_params.source, - _first_parameter_update); - - } else { - param_get(_param_handles.v_empty, &_params.v_empty); - param_get(_param_handles.v_charged, &_params.v_charged); - param_get(_param_handles.n_cells, &_params.n_cells); - param_get(_param_handles.capacity, &_params.capacity); - param_get(_param_handles.v_load_drop, &_params.v_load_drop); - param_get(_param_handles.r_internal, &_params.r_internal); - param_get(_param_handles.source, &_params.source); - } - + param_get(_param_handles.v_empty, &_params.v_empty); + param_get(_param_handles.v_charged, &_params.v_charged); + param_get(_param_handles.n_cells, &_params.n_cells); + param_get(_param_handles.capacity, &_params.capacity); + param_get(_param_handles.v_load_drop, &_params.v_load_drop); + param_get(_param_handles.r_internal, &_params.r_internal); + param_get(_param_handles.source, &_params.source); param_get(_param_handles.low_thr, &_params.low_thr); param_get(_param_handles.crit_thr, &_params.crit_thr); param_get(_param_handles.emergen_thr, &_params.emergen_thr); diff --git a/src/lib/battery/battery.h b/src/lib/battery/battery.h index e6169ff40f..42c553b52c 100644 --- a/src/lib/battery/battery.h +++ b/src/lib/battery/battery.h @@ -108,16 +108,6 @@ protected: param_t crit_thr; param_t emergen_thr; param_t source; - - // TODO: These parameters are depracated. They can be removed entirely once the - // new version of Firmware has been around for long enough. - param_t v_empty_old; - param_t v_charged_old; - param_t n_cells_old; - param_t capacity_old; - param_t v_load_drop_old; - param_t r_internal_old; - param_t source_old; } _param_handles{}; struct { @@ -131,16 +121,6 @@ protected: float crit_thr; float emergen_thr; int32_t source; - - // TODO: These parameters are depracated. They can be removed entirely once the - // new version of Firmware has been around for long enough. - float v_empty_old; - float v_charged_old; - int32_t n_cells_old; - float capacity_old; - float v_load_drop_old; - float r_internal_old; - int32_t source_old; } _params{}; const int _index; @@ -148,40 +128,6 @@ protected: bool _first_parameter_update{true}; void updateParams() override; - /** - * This function helps migrating and syncing from/to deprecated parameters. BAT_* BAT1_* - * @tparam T Type of the parameter (int or float) - * @param old_param Handle to the old deprecated parameter (for example, param_find("BAT_N_CELLS")) - * @param new_param Handle to the new replacement parameter (for example, param_find("BAT1_N_CELLS")) - * @param old_val Pointer to the value of the old deprecated parameter - * @param new_val Pointer to the value of the new replacement parameter - * @param firstcall If true, this function prefers migrating old to new - */ - template - void migrateParam(param_t old_param, param_t new_param, T *old_val, T *new_val, bool firstcall) - { - T previous_old_val = *old_val; - T previous_new_val = *new_val; - - // Update both the old and new parameter values - param_get(old_param, old_val); - param_get(new_param, new_val); - - // Check if the parameter values are different - if (!matrix::isEqualF((float)*old_val, (float)*new_val)) { - // If so, copy the new value over to the unchanged parameter - // Note: If they differ from the beginning we migrate old to new - if (firstcall || !matrix::isEqualF((float)*old_val, (float)previous_old_val)) { - param_set_no_notification(new_param, old_val); - param_get(new_param, new_val); - - } else if (!matrix::isEqualF((float)*new_val, (float)previous_new_val)) { - param_set_no_notification(old_param, new_val); - param_get(old_param, old_val); - } - } - } - private: void sumDischarged(const hrt_abstime ×tamp, float current_a); void estimateStateOfCharge(const float voltage_v, const float current_a, const float throttle); diff --git a/src/lib/battery/battery_params_deprecated.c b/src/lib/battery/battery_params_deprecated.c deleted file mode 100644 index a1d4f715c2..0000000000 --- a/src/lib/battery/battery_params_deprecated.c +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012-2019 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file battery_params_deprecated.c - * @author Timothy Scott - * - * Defines the deprcated single battery configuration which are temporarily kept for backwards compatibility with QGC. - * The new parameter set has a number after "BAT" e.g. BAT1_V_EMPTY. - */ - -/** - * This parameter is deprecated. Please use BAT1_V_EMPTY instead. - * - * Defines the voltage where a single cell of battery 1 is considered empty. - * The voltage should be chosen before the steep dropoff to 2.8V. A typical - * lithium battery can only be discharged down to 10% before it drops off - * to a voltage level damaging the cells. - * - * @group Battery Calibration - * @unit V - * @decimal 2 - * @increment 0.01 - * @reboot_required true - */ -PARAM_DEFINE_FLOAT(BAT_V_EMPTY, 3.5f); - -/** - * This parameter is deprecated. Please use BAT1_V_CHARGED instead. - * - * Defines the voltage where a single cell of battery 1 is considered full - * under a mild load. This will never be the nominal voltage of 4.2V - * - * @group Battery Calibration - * @unit V - * @decimal 2 - * @increment 0.01 - * @reboot_required true - */ -PARAM_DEFINE_FLOAT(BAT_V_CHARGED, 4.05f); - -/** - * This parameter is deprecated. Please use BAT1_V_LOAD_DROP instead. - * - * This implicitely defines the internal resistance - * to maximum current ratio for battery 1 and assumes linearity. - * A good value to use is the difference between the - * 5C and 20-25C load. Not used if BAT_R_INTERNAL is - * set. - * - * @group Battery Calibration - * @unit V - * @min 0.07 - * @max 0.5 - * @decimal 2 - * @increment 0.01 - * @reboot_required true - */ -PARAM_DEFINE_FLOAT(BAT_V_LOAD_DROP, 0.3f); - -/** - * This parameter is deprecated. Please use BAT1_R_INTERNAL instead. - * - * If non-negative, then this will be used in place of - * BAT_V_LOAD_DROP for all calculations. - * - * @group Battery Calibration - * @unit Ohm - * @min -1.0 - * @max 0.2 - * @reboot_required true - */ -PARAM_DEFINE_FLOAT(BAT_R_INTERNAL, -1.0f); - - -/** - * This parameter is deprecated. Please use BAT1_N_CELLS instead. - * - * Defines the number of cells the attached battery consists of. - * - * @group Battery Calibration - * @unit S - * @value 0 Unconfigured - * @value 2 2S Battery - * @value 3 3S Battery - * @value 4 4S Battery - * @value 5 5S Battery - * @value 6 6S Battery - * @value 7 7S Battery - * @value 8 8S Battery - * @value 9 9S Battery - * @value 10 10S Battery - * @value 11 11S Battery - * @value 12 12S Battery - * @value 13 13S Battery - * @value 14 14S Battery - * @value 15 15S Battery - * @value 16 16S Battery - * @reboot_required true - */ -PARAM_DEFINE_INT32(BAT_N_CELLS, 0); - -/** - * This parameter is deprecated. Please use BAT1_CAPACITY instead. - * - * Defines the capacity of battery 1. - * - * @group Battery Calibration - * @unit mAh - * @decimal 0 - * @min -1.0 - * @max 100000 - * @increment 50 - * @reboot_required true - */ -PARAM_DEFINE_FLOAT(BAT_CAPACITY, -1.0f); - -/** - * This parameter is deprecated. Please use BAT1_SOURCE instead. - * - * Battery monitoring source. - * - * This parameter controls the source of battery data. The value 'Power Module' - * means that measurements are expected to come from a power module. If the value is set to - * 'External' then the system expects to receive mavlink battery status messages. - * - * @min 0 - * @max 1 - * @value 0 Power Module - * @value 1 External - * @group Battery Calibration - */ -PARAM_DEFINE_INT32(BAT_SOURCE, 0); diff --git a/src/modules/battery_status/analog_battery.cpp b/src/modules/battery_status/analog_battery.cpp index 51b4fbd3f7..ac9fafd0a2 100644 --- a/src/modules/battery_status/analog_battery.cpp +++ b/src/modules/battery_status/analog_battery.cpp @@ -67,10 +67,6 @@ AnalogBattery::AnalogBattery(int index, ModuleParams *parent, const int sample_i snprintf(param_name, sizeof(param_name), "BAT%d_I_CHANNEL", index); _analog_param_handles.i_channel = param_find(param_name); - - _analog_param_handles.v_div_old = param_find("BAT_V_DIV"); - _analog_param_handles.a_per_v_old = param_find("BAT_A_PER_V"); - _analog_param_handles.adc_channel_old = param_find("BAT_ADC_CHANNEL"); } void @@ -119,24 +115,12 @@ int AnalogBattery::get_current_channel() } } - void AnalogBattery::updateParams() { - if (_index == 1) { - migrateParam(_analog_param_handles.v_div_old, _analog_param_handles.v_div, &_analog_params.v_div_old, - &_analog_params.v_div, _first_parameter_update); - migrateParam(_analog_param_handles.a_per_v_old, _analog_param_handles.a_per_v, &_analog_params.a_per_v_old, - &_analog_params.a_per_v, _first_parameter_update); - migrateParam(_analog_param_handles.adc_channel_old, _analog_param_handles.v_channel, - &_analog_params.adc_channel_old, &_analog_params.v_channel, _first_parameter_update); - - } else { - param_get(_analog_param_handles.v_div, &_analog_params.v_div); - param_get(_analog_param_handles.a_per_v, &_analog_params.a_per_v); - param_get(_analog_param_handles.v_channel, &_analog_params.v_channel); - } - + param_get(_analog_param_handles.v_div, &_analog_params.v_div); + param_get(_analog_param_handles.a_per_v, &_analog_params.a_per_v); + param_get(_analog_param_handles.v_channel, &_analog_params.v_channel); param_get(_analog_param_handles.i_channel, &_analog_params.i_channel); param_get(_analog_param_handles.v_offs_cur, &_analog_params.v_offs_cur); @@ -144,23 +128,12 @@ AnalogBattery::updateParams() /* apply scaling according to defaults if set to default */ _analog_params.v_div = BOARD_BATTERY1_V_DIV; param_set_no_notification(_analog_param_handles.v_div, &_analog_params.v_div); - - if (_index == 1) { - _analog_params.v_div_old = BOARD_BATTERY1_V_DIV; - param_set_no_notification(_analog_param_handles.v_div_old, &_analog_params.v_div_old); - } } if (_analog_params.a_per_v < 0.0f) { /* apply scaling according to defaults if set to default */ - _analog_params.a_per_v = BOARD_BATTERY1_A_PER_V; param_set_no_notification(_analog_param_handles.a_per_v, &_analog_params.a_per_v); - - if (_index == 1) { - _analog_params.a_per_v_old = BOARD_BATTERY1_A_PER_V; - param_set_no_notification(_analog_param_handles.a_per_v_old, &_analog_params.a_per_v_old); - } } Battery::updateParams(); diff --git a/src/modules/battery_status/analog_battery.h b/src/modules/battery_status/analog_battery.h index ddfc8e72a8..fd18319f19 100644 --- a/src/modules/battery_status/analog_battery.h +++ b/src/modules/battery_status/analog_battery.h @@ -78,10 +78,6 @@ protected: param_t a_per_v; param_t v_channel; param_t i_channel; - - param_t v_div_old; - param_t a_per_v_old; - param_t adc_channel_old; } _analog_param_handles; struct { @@ -90,10 +86,6 @@ protected: float a_per_v; int32_t v_channel; int32_t i_channel; - - float v_div_old; - float a_per_v_old; - int32_t adc_channel_old; } _analog_params; virtual void updateParams() override; diff --git a/src/modules/sensors/analog_battery_params_deprecated.c b/src/modules/sensors/analog_battery_params_deprecated.c deleted file mode 100644 index 7166cc3a83..0000000000 --- a/src/modules/sensors/analog_battery_params_deprecated.c +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012-2019 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * This parameter is deprecated. Please use BAT1_V_DIV. - * - * @group Battery Calibration - * @decimal 8 - */ -PARAM_DEFINE_FLOAT(BAT_V_DIV, -1.0); - -/** - * This parameter is deprecated. Please use BAT1_A_PER_V. - * - * @group Battery Calibration - * @decimal 8 - */ -PARAM_DEFINE_FLOAT(BAT_A_PER_V, -1.0);