Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "subsystems/electrical.h"
#include "mcu_periph/adc.h"
#include "subsystems/commands.h"
#include "autopilot.h"
#include "generated/airframe.h"
#include <BOARD_CONFIG>
Go to the source code of this file.
Macros | |
#define | BAT_CHECKER_DELAY 5 |
#define | ELECTRICAL_PERIODIC_FREQ 10 |
#define | MIN_BAT_LEVEL 3 |
#define | VoltageOfAdc(adc) DefaultVoltageOfAdc(adc) |
#define | MilliAmpereOfAdc(adc) DefaultMilliAmpereOfAdc(adc) |
#define | CURRENT_ESTIMATION_NONLINEARITY 1.2 |
Functions | |
void | electrical_init (void) |
void | electrical_periodic (void) |
Variables | |
static float | period_to_hour = 1 / 3600.f / ELECTRICAL_PERIODIC_FREQ |
struct Electrical | electrical |
Implemnetation for electrical status: supply voltage, current, battery status, etc.
Definition in file electrical.c.
#define BAT_CHECKER_DELAY 5 |
Definition at line 52 of file electrical.c.
#define CURRENT_ESTIMATION_NONLINEARITY 1.2 |
Definition at line 90 of file electrical.c.
#define ELECTRICAL_PERIODIC_FREQ 10 |
Definition at line 55 of file electrical.c.
#define MilliAmpereOfAdc | ( | adc | ) | DefaultMilliAmpereOfAdc(adc) |
Definition at line 86 of file electrical.c.
#define MIN_BAT_LEVEL 3 |
Definition at line 59 of file electrical.c.
#define VoltageOfAdc | ( | adc | ) | DefaultVoltageOfAdc(adc) |
Definition at line 83 of file electrical.c.
void electrical_init | ( | void | ) |
Definition at line 100 of file electrical.c.
References adc_buf_channel(), ADC_CHANNEL_CURRENT, ADC_CHANNEL_VSUPPLY, Electrical::bat_critical, Electrical::bat_low, Electrical::charge, Electrical::current, CURRENT_ESTIMATION_NONLINEARITY, DEFAULT_AV_NB_SAMPLE, electrical, Electrical::energy, and Electrical::vsupply.
Referenced by init_fbw(), and main_init().
void electrical_periodic | ( | void | ) |
Definition at line 123 of file electrical.c.
References autopilot_throttle_killed(), BAT_CHECKER_DELAY, Electrical::bat_critical, Electrical::bat_low, Electrical::charge, commands, CRITIC_BAT_LEVEL, Electrical::current, electrical, ELECTRICAL_PERIODIC_FREQ, Electrical::energy, f, LOW_BAT_LEVEL, MAX_PPRZ, MilliAmpereOfAdc, MIN_BAT_LEVEL, period_to_hour, VoltageOfAdc, and Electrical::vsupply.
Referenced by handle_periodic_tasks(), handle_periodic_tasks_fbw(), and sim_periodic_task().
struct Electrical electrical |
Definition at line 66 of file electrical.c.
Referenced by actuators_bebop_commit(), actuators_disco_commit(), bat_checker_periodic(), bat_read(), bat_voltage_ardrone2_periodic(), battery_monitor_read_bus(), bf_adcGetChannel(), bf_getAmperage(), bf_getBatteryVoltage(), bf_getLegacyBatteryVoltage(), bf_getMAhDrawn(), calc_flight_time_left(), draw_osd(), electrical_init(), electrical_periodic(), ezcurrent_read_event(), failsafe_check(), generic_com_periodic(), gsm_send_report_continue(), guidance_h_module_run(), guidance_v_module_run(), handle_battery(), hott_update_eam_msg(), intermcu_send_status(), mavlink_send_battery_status(), mavlink_send_sys_status(), nps_electrical_run_step(), rpm_sensor_send_motor(), send_energy(), send_fbw_status(), send_imu_mag_current(), send_status(), send_windtunnel_meas(), and update_bat().
|
static |
Definition at line 56 of file electrical.c.
Referenced by electrical_periodic().