1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

CF/BF - refactor voltage refresh/read api. update voltage/current msp code

msp code is still unfinished, but the plan is clearer now.

move some defaults from battery.h and allow targets to override them.

define ID's for all voltage and current sensors, the idea being a list
of ids wil lbe created for each build which will allow all the voltage
and current meters to be exposed via MSP.
This commit is contained in:
Hydra 2017-03-16 22:11:17 +00:00 committed by Dominic Clifton
parent 089042e136
commit f3e740c598
6 changed files with 234 additions and 43 deletions

View file

@ -26,6 +26,49 @@ typedef enum {
CURRENT_METER_MAX = CURRENT_METER_ESC
} currentMeterSource_e;
//
// fixed ids, current can be measured at many different places, these identifiers are the ones we support or would consider supporting.
//
typedef enum {
CURRENT_METER_ID_NONE = 0,
CURRENT_METER_ID_VBAT_1 = 10, // 10-19 for battery meters
CURRENT_METER_ID_VBAT_2,
//..
CURRENT_METER_ID_VBAT_10 = 19,
CURRENT_METER_ID_5V_1 = 20, // 20-29 for 5V meters
CURRENT_METER_ID_5V_2,
//..
CURRENT_METER_ID_5V_10 = 29,
CURRENT_METER_ID_9V_1 = 30, // 30-39 for 9V meters
CURRENT_METER_ID_9V_2,
//..
CURRENT_METER_ID_9V_10 = 39,
CURRENT_METER_ID_12V_1 = 40, // 40-49 for 12V meters
CURRENT_METER_ID_12V_2,
//..
CURRENT_METER_ID_12V_10 = 49,
CURRENT_METER_ID_ESC_COMBINED_1 = 50, // 50-59 for ESC combined (it's doubtful an FC would ever expose 51-59 however)
// ...
CURRENT_METER_ID_ESC_COMBINED_10 = 59,
CURRENT_METER_ID_ESC_MOTOR_1 = 60, // 60-79 for ESC motors (20 motors)
CURRENT_METER_ID_ESC_MOTOR_2,
CURRENT_METER_ID_ESC_MOTOR_3,
CURRENT_METER_ID_ESC_MOTOR_4,
CURRENT_METER_ID_ESC_MOTOR_5,
CURRENT_METER_ID_ESC_MOTOR_6,
CURRENT_METER_ID_ESC_MOTOR_7,
CURRENT_METER_ID_ESC_MOTOR_8,
//...
CURRENT_METER_ID_ESC_MOTOR_20 = 79,
} currentMeterId_e;
typedef struct currentMeter_s {
int32_t amperage; // current read by current sensor in centiampere (1/100th A)
int32_t amperageLatest; // current read by current sensor in centiampere (1/100th A) (unfiltered)