sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
MultiWii.cpp File Reference
#include <avr/io.h>
#include "Arduino.h"
#include "config.h"
#include "def.h"
#include "types.h"
#include "MultiWii.h"
#include "Alarms.h"
#include "EEPROM.h"
#include "IMU.h"
#include "LCD.h"
#include "Output.h"
#include "RX.h"
#include "Sensors.h"
#include "Serial.h"
#include "GPS.h"
#include "Protocol.h"
#include <avr/pgmspace.h>

Macros

#define ROL_LO   (1<<(2*ROLL))
 
#define ROL_CE   (3<<(2*ROLL))
 
#define ROL_HI   (2<<(2*ROLL))
 
#define PIT_LO   (1<<(2*PITCH))
 
#define PIT_CE   (3<<(2*PITCH))
 
#define PIT_HI   (2<<(2*PITCH))
 
#define YAW_LO   (1<<(2*YAW))
 
#define YAW_CE   (3<<(2*YAW))
 
#define YAW_HI   (2<<(2*YAW))
 
#define THR_LO   (1<<(2*THROTTLE))
 
#define THR_CE   (3<<(2*THROTTLE))
 
#define THR_HI   (2<<(2*THROTTLE))
 
#define DYN_THR_PID_CHANNEL   THROTTLE
 
#define GYRO_P_MAX   300
 
#define GYRO_I_MAX   250
 

Functions

void annexCode ()
 
void setup ()
 
void go_arm ()
 
void go_disarm ()
 
void loop ()
 

Variables

const char pidnames[] PROGMEM
 
uint32_t currentTime = 0
 
uint16_t previousTime = 0
 
uint16_t cycleTime = 0
 
uint16_t calibratingA = 0
 
uint16_t calibratingB = 0
 
uint16_t calibratingG
 
int16_t magHold
 
int16_t headFreeModeHold
 
uint8_t vbatMin = VBATNOMINAL
 
uint8_t rcOptions [CHECKBOXITEMS]
 
int32_t AltHold
 
int16_t sonarAlt
 
int16_t BaroPID = 0
 
int16_t errorAltitudeI = 0
 
int16_t gyroZero [3] = {0,0,0}
 
imu_t imu
 
analog_t analog
 
alt_t alt
 
att_t att
 
int16_t debug [4]
 
flags_struct_t f
 
int16_t i2c_errors_count = 0
 
uint16_t intPowerTrigger1
 
int16_t failsafeEvents = 0
 
volatile int16_t failsafeCnt = 0
 
int16_t rcData [RC_CHANS]
 
int16_t rcSerial [8]
 
int16_t rcCommand [4]
 
uint8_t rcSerialCount = 0
 
int16_t lookupPitchRollRC [5]
 
uint16_t lookupThrottleRC [11]
 
int16_t axisPID [3]
 
int16_t motor [8]
 
int16_t servo [8] = {1500,1500,1500,1500,1500,1500,1500,1000}
 
global_conf_t global_conf
 
conf_t conf
 
int16_t GPS_angle [2] = { 0, 0}
 
int32_t GPS_coord [2]
 
int32_t GPS_home [2]
 
int32_t GPS_hold [2]
 
int32_t GPS_prev [2]
 
int32_t GPS_poi [2]
 
uint8_t GPS_numSat
 
uint16_t GPS_distanceToHome
 
int16_t GPS_directionToHome
 
int32_t GPS_directionToPoi
 
uint16_t GPS_altitude
 
uint16_t GPS_speed
 
uint8_t GPS_update = 0
 
uint16_t GPS_ground_course = 0
 
uint8_t NAV_state = 0
 
uint8_t NAV_error = 0
 
uint8_t prv_gps_modes = 0
 
uint32_t nav_timer_stop = 0
 GPS_checkbox items packed into 1 byte for checking GPS mode changes. More...
 
uint16_t nav_hold_time
 common timer used in navigation (contains the desired stop time in millis() More...
 
uint8_t NAV_paused_at = 0
 time in seconds to hold position More...
 
uint8_t next_step = 1
 
int16_t jump_times = -10
 The mission step which is upcoming it equals with the mission_step stored in EEPROM. More...
 
int16_t nav [2]
 
int16_t nav_rated [2]
 
int32_t original_altitude
 
int32_t target_altitude
 
int32_t alt_to_hold
 
uint32_t alt_change_timer
 
int8_t alt_change_flag
 
uint32_t alt_change
 
uint8_t alarmArray [ALRM_FAC_SIZE]
 

Macro Definition Documentation

#define DYN_THR_PID_CHANNEL   THROTTLE
#define GYRO_I_MAX   250
#define GYRO_P_MAX   300
#define PIT_CE   (3<<(2*PITCH))
#define PIT_HI   (2<<(2*PITCH))
#define PIT_LO   (1<<(2*PITCH))
#define ROL_CE   (3<<(2*ROLL))
#define ROL_HI   (2<<(2*ROLL))
#define ROL_LO   (1<<(2*ROLL))
#define THR_CE   (3<<(2*THROTTLE))
#define THR_HI   (2<<(2*THROTTLE))
#define THR_LO   (1<<(2*THROTTLE))
#define YAW_CE   (3<<(2*YAW))
#define YAW_HI   (2<<(2*YAW))
#define YAW_LO   (1<<(2*YAW))

Function Documentation

void annexCode ( )
void go_arm ( )
void go_disarm ( )
void loop ( void  )
void setup ( void  )

Variable Documentation

uint8_t alarmArray[ALRM_FAC_SIZE]
alt_t alt
uint32_t alt_change
int8_t alt_change_flag
uint32_t alt_change_timer
int32_t alt_to_hold
int32_t AltHold
analog_t analog
att_t att
int16_t axisPID[3]
int16_t BaroPID = 0
uint16_t calibratingA = 0
uint16_t calibratingB = 0
uint16_t calibratingG
conf_t conf
uint32_t currentTime = 0
uint16_t cycleTime = 0
int16_t debug[4]
int16_t errorAltitudeI = 0
volatile int16_t failsafeCnt = 0
int16_t failsafeEvents = 0
global_conf_t global_conf
uint16_t GPS_altitude
int16_t GPS_angle[2] = { 0, 0}
int32_t GPS_coord[2]
int16_t GPS_directionToHome
int32_t GPS_directionToPoi
uint16_t GPS_distanceToHome
uint16_t GPS_ground_course = 0
int32_t GPS_hold[2]
int32_t GPS_home[2]
uint8_t GPS_numSat
int32_t GPS_poi[2]
int32_t GPS_prev[2]
uint16_t GPS_speed
uint8_t GPS_update = 0
int16_t gyroZero[3] = {0,0,0}
int16_t headFreeModeHold
int16_t i2c_errors_count = 0
imu_t imu
uint16_t intPowerTrigger1
int16_t jump_times = -10

The mission step which is upcoming it equals with the mission_step stored in EEPROM.

int16_t lookupPitchRollRC[5]
uint16_t lookupThrottleRC[11]
int16_t magHold
int16_t motor[8]
int16_t nav[2]
uint8_t NAV_error = 0
uint16_t nav_hold_time

common timer used in navigation (contains the desired stop time in millis()

uint8_t NAV_paused_at = 0

time in seconds to hold position

int16_t nav_rated[2]
uint8_t NAV_state = 0
uint32_t nav_timer_stop = 0

GPS_checkbox items packed into 1 byte for checking GPS mode changes.

uint8_t next_step = 1
int32_t original_altitude
uint16_t previousTime = 0
const uint8_t boxids [] PROGMEM
Initial value:
=
"ROLL;"
"PITCH;"
"YAW;"
"ALT;"
"Pos;"
"PosR;"
"NavR;"
"LEVEL;"
"MAG;"
"VEL;"
uint8_t prv_gps_modes = 0
int16_t rcCommand[4]
int16_t rcData[RC_CHANS]
uint8_t rcOptions[CHECKBOXITEMS]
int16_t rcSerial[8]
uint8_t rcSerialCount = 0
int16_t servo[8] = {1500,1500,1500,1500,1500,1500,1500,1000}
int16_t sonarAlt
int32_t target_altitude
uint8_t vbatMin = VBATNOMINAL