PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
BatteryStatus () | |
~BatteryStatus () override | |
void | Run () override |
bool | init () |
int | print_status () override |
Static Public Member Functions | |
static int | task_spawn (int argc, char *argv[]) |
static int | custom_command (int argc, char *argv[]) |
static int | print_usage (const char *reason=nullptr) |
Private Member Functions | |
int | parameters_update () |
Update our local parameter cache. More... | |
int | adc_init () |
Do adc-related initialisation. More... | |
void | parameter_update_poll (bool forced=false) |
Check for changes in parameters. More... | |
void | adc_poll () |
Poll the ADC and update readings to suit. More... | |
Private Attributes | |
DevHandle | _h_adc |
ADC driver handle. More... | |
bool | _armed {false} |
arming status of the vehicle More... | |
uORB::Subscription | _actuator_ctrl_0_sub {ORB_ID(actuator_controls_0)} |
attitude controls sub More... | |
uORB::Subscription | _parameter_update_sub {ORB_ID(parameter_update)} |
notification of parameter updates More... | |
uORB::Subscription | _vcontrol_mode_sub {ORB_ID(vehicle_control_mode)} |
vehicle control mode subscription More... | |
orb_advert_t | _battery_pub [BOARD_NUMBER_BRICKS] {} |
battery status More... | |
Battery | _battery [BOARD_NUMBER_BRICKS] |
Helper lib to publish battery_status topic. More... | |
perf_counter_t | _loop_perf |
loop performance counter More... | |
hrt_abstime | _last_config_update {0} |
Parameters | _parameters {} |
local copies of interesting parameters More... | |
ParameterHandles | _parameter_handles {} |
handles for interesting parameters More... | |
Definition at line 110 of file battery_status.cpp.
BatteryStatus::BatteryStatus | ( | ) |
Definition at line 178 of file battery_status.cpp.
References _battery, _parameter_handles, and battery_status::initialize_parameter_handles().
Referenced by task_spawn().
|
override |
Definition at line 190 of file battery_status.cpp.
|
private |
Do adc-related initialisation.
Definition at line 209 of file battery_status.cpp.
References _h_adc, ADC0_DEVICE_PATH, and OK.
Referenced by Run().
|
private |
Poll the ADC and update readings to suit.
raw | Combined sensor data structure into which data should be returned. |
Definition at line 237 of file battery_status.cpp.
References _actuator_ctrl_0_sub, _armed, _battery, _battery_pub, _h_adc, _parameters, battery_status::Parameters::battery_a_per_v, battery_status::Parameters::battery_adc_channel, battery_status::Parameters::battery_current_offset, battery_status::Parameters::battery_current_scaling, battery_status::Parameters::battery_source, battery_status::Parameters::battery_v_div, battery_status::Parameters::battery_voltage_scaling, uORB::Subscription::copy(), hrt_absolute_time(), ll40ls::instance, orb_advert_t, ORB_ID, ORB_PRIO_DEFAULT, orb_publish_auto(), px4_adc_msg_t, PX4_MAX_ADC_CHANNELS, and Battery::updateBatteryStatus().
Referenced by Run().
|
static |
Definition at line 417 of file battery_status.cpp.
References print_usage().
bool BatteryStatus::init | ( | ) |
Definition at line 405 of file battery_status.cpp.
Referenced by task_spawn().
|
private |
Check for changes in parameters.
Definition at line 222 of file battery_status.cpp.
References _parameter_update_sub, uORB::Subscription::copy(), parameters_update(), and uORB::Subscription::updated().
Referenced by Run().
|
private |
Update our local parameter cache.
Definition at line 196 of file battery_status.cpp.
References _parameter_handles, _parameters, and battery_status::update_parameters().
Referenced by parameter_update_poll().
|
override |
Definition at line 412 of file battery_status.cpp.
|
static |
Definition at line 422 of file battery_status.cpp.
Referenced by custom_command().
|
override |
Definition at line 351 of file battery_status.cpp.
References _armed, _h_adc, _loop_perf, _vcontrol_mode_sub, adc_init(), adc_poll(), uORB::Subscription::copy(), parameter_update_poll(), perf_begin(), perf_end(), and uORB::Subscription::updated().
|
static |
Definition at line 381 of file battery_status.cpp.
References BatteryStatus(), init(), and ll40ls::instance.
|
private |
|
private |
arming status of the vehicle
Definition at line 134 of file battery_status.cpp.
Referenced by adc_poll(), and Run().
|
private |
Helper lib to publish battery_status topic.
Definition at line 141 of file battery_status.cpp.
Referenced by adc_poll(), and BatteryStatus().
|
private |
|
private |
ADC driver handle.
Definition at line 132 of file battery_status.cpp.
Referenced by adc_init(), adc_poll(), and Run().
|
private |
Definition at line 149 of file battery_status.cpp.
|
private |
|
private |
handles for interesting parameters
Definition at line 152 of file battery_status.cpp.
Referenced by BatteryStatus(), and parameters_update().
|
private |
notification of parameter updates
Definition at line 137 of file battery_status.cpp.
Referenced by parameter_update_poll().
|
private |
local copies of interesting parameters
Definition at line 151 of file battery_status.cpp.
Referenced by adc_poll(), and parameters_update().
|
private |
vehicle control mode subscription
Definition at line 138 of file battery_status.cpp.
Referenced by Run().