mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 11:43:25 +00:00
selfcheck.py: address situation when individual cells voltage is unknown
When length of cell_voltage array is 1, it means that cell voltage is unknown and overall voltage is reported instead. Consider this situation gathering the number of cells from PX4 parameters.
This commit is contained in:
@@ -303,6 +303,14 @@ def check_fcu():
|
||||
failure('cell voltage is not available, https://clover.coex.tech/power')
|
||||
else:
|
||||
cell = battery.cell_voltage[0]
|
||||
# number of cells 1 means this is overall voltage
|
||||
if len(battery.cell_voltage) == 1:
|
||||
n_cells = get_param('BAT1_N_CELLS', strict=False)
|
||||
if n_cells is None:
|
||||
# older PX4
|
||||
n_cells = get_param('BAT_N_CELLS', strict=True)
|
||||
cell /= n_cells
|
||||
|
||||
if cell > 4.3 or cell < 3.0:
|
||||
failure('incorrect cell voltage: %.2f V, https://clover.coex.tech/power', cell)
|
||||
elif cell < 3.7:
|
||||
|
||||
Reference in New Issue
Block a user