35#include "generated/airframe.h"
36#include "generated/modules.h"
39#ifdef MILLIAMP_PER_PERCENT
40#warning "deprecated MILLIAMP_PER_PERCENT --> Please use MILLIAMP_AT_FULL_THROTTLE"
42#if defined BATTERY_SENS || defined BATTERY_OFFSET
43#warning "BATTERY_SENS and BATTERY_OFFSET are deprecated, please remove them --> if you want to change the default use VoltageOfAdc"
46#if defined COMMAND_THROTTLE
47#define COMMAND_CURRENT_ESTIMATION COMMAND_THROTTLE
48#elif defined COMMAND_THRUST
49#define COMMAND_CURRENT_ESTIMATION COMMAND_THRUST
52#ifndef BAT_CHECKER_DELAY
53#define BAT_CHECKER_DELAY 5
57#define MIN_BAT_LEVEL 3
60#ifndef TAKEOFF_BAT_LEVEL
61#define TAKEOFF_BAT_LEVEL LOW_BAT_LEVEL
70#define VoltageOfAdc(adc) DefaultVoltageOfAdc(adc)
73#define VBoardOfAdc(adc) DefaultVBoardOfAdc(adc)
75#ifndef MilliAmpereOfAdc
76#define MilliAmpereOfAdc(adc) DefaultMilliAmpereOfAdc(adc)
79#ifndef CURRENT_ESTIMATION_NONLINEARITY
80#define CURRENT_ESTIMATION_NONLINEARITY 1.2
84#if defined MILLIAMP_AT_FULL_THROTTLE && !defined MILLIAMP_AT_IDLE_THROTTLE
86 #define MILLIAMP_AT_IDLE_THROTTLE 0
94#if defined ADC_CHANNEL_VSUPPLY || (defined ADC_CHANNEL_CURRENT && !defined SITL) || defined MILLIAMP_AT_FULL_THROTTLE
96#ifdef ADC_CHANNEL_VSUPPLY
99#if defined ADC_CHANNEL_VBOARD
102#if defined ADC_CHANNEL_CURRENT && !defined SITL
105#if defined ADC_CHANNEL_CURRENT2 && !defined SITL
108#ifdef MILLIAMP_AT_FULL_THROTTLE
114#ifdef PREFLIGHT_CHECKS
141#if defined ADC_CHANNEL_VSUPPLY
145#if defined ADC_CHANNEL_VBOARD
150#if defined ADC_CHANNEL_CURRENT && !defined SITL
153#if defined ADC_CHANNEL_CURRENT2 && !defined SITL
156#elif defined MILLIAMP_AT_FULL_THROTTLE
172#if defined(ADC_CHANNEL_VSUPPLY) && !defined(SITL) && !USE_BATTERY_MONITOR
177#if defined(ADC_CHANNEL_VBOARD) && !defined(SITL)
182#ifdef ADC_CHANNEL_CURRENT
187#ifdef ADC_CHANNEL_CURRENT2
192#elif defined MILLIAMP_AT_FULL_THROTTLE && defined COMMAND_CURRENT_ESTIMATION
arch independent ADC (Analog to Digital Converter) API
#define DEFAULT_AV_NB_SAMPLE
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
#define ADC_CHANNEL_VSUPPLY
bool autopilot_throttle_killed(void)
get kill status
Core autopilot interface common to all firmwares.
void adc_buf_channel(uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample)
Link between ChibiOS ADC drivers and Paparazzi adc_buffers.
Hardware independent code for commands handling.
#define ADC_CHANNEL_VBOARD
#define ADC_CHANNEL_CURRENT
void electrical_avg_reset(float var)
#define BAT_CHECKER_DELAY
#define VoltageOfAdc(adc)
#define MilliAmpereOfAdc(adc)
struct Electrical electrical
#define TAKEOFF_BAT_LEVEL
#define CURRENT_ESTIMATION_NONLINEARITY
void electrical_init(void)
void electrical_periodic(void)
Interface for electrical status: supply voltage, current, battery status, etc.
uint32_t avg_power
average power sum
#define LOW_BAT_LEVEL
low battery level in Volts (for 3S LiPo)
float energy
consumed energy in Wh
float current
current in A
uint32_t avg_cnt
average power counter
#define CRITIC_BAT_LEVEL
critical battery level in Volts (for 3S LiPo)
bool bat_low
battery low status
float charge
consumed electric charge in Ah
float vboard
board voltage in V
float vsupply
supply voltage in V
bool bat_critical
battery critical status
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
void preflight_error(struct preflight_result_t *result, const char *fmt,...)
Register a preflight error used inside the preflight checking functions.
void preflight_success(struct preflight_result_t *result, const char *fmt,...)
Register a preflight success used inside the preflight checking functions.
void preflight_check_register(struct preflight_check_t *check, preflight_check_f func)
Register a preflight check and add it to the linked list.
static const ShellCommand commands[]
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.