22,12 → 22,12 |
#include <stdint.h> |
|
#ifdef _BETA_ |
static const int MK_VERSION_SETTINGS = 82; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
static const int MK_VERSION_SETTINGS = 84; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
#else |
static const int MK_VERSION_SETTINGS = 82; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
static const int MK_VERSION_SETTINGS = 84; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
#endif |
|
static const int MK_VERSION_NAVI = 3; // wird angepasst, wenn sich die Navi-Daten ge�ndert haben |
static const int MK_VERSION_NAVI = 4; // wird angepasst, wenn sich die Navi-Daten ge�ndert haben |
|
static const int MK_VERSION_MIXER = 1; // wird angepasst, wenn sich die Mixer-Daten ge�ndert haben |
static const int MK_MAX_MOTOR = 16; // Maximale Anzahl der Motoren im Mixer |
41,14 → 41,32 |
static const int ADDRESS_FC = 1; |
static const int ADDRESS_NC = 2; |
static const int ADDRESS_MK3MAG = 3; |
static const int ADDRESS_BLC = 5; |
|
#define FLAG_MOTOR_RUN 1 |
#define FLAG_FLY 2 |
#define FLAG_CALIBRATE 4 |
#define FLAG_START 8 |
#define FLAG_NOTLANDUNG 16 |
#define FLAG_LOWBAT 32 |
#define FCFLAG_MOTOR_RUN 0x01 |
#define FCFLAG_FLY 0x02 |
#define FCFLAG_CALIBRATE 0x04 |
#define FCFLAG_START 0x08 |
#define FCFLAG_NOTLANDUNG 0x10 |
#define FCFLAG_LOWBAT 0x20 |
#define FCFLAG_SPI_RX_ERR 0x40 |
#define FCFLAG_I2CERR 0x80 |
|
#define DEFEKT_G_NICK 0x01 |
#define DEFEKT_G_ROLL 0x02 |
#define DEFEKT_G_GIER 0x04 |
#define DEFEKT_A_NICK 0x08 |
#define DEFEKT_A_ROLL 0x10 |
#define DEFEKT_A_Z 0x20 |
#define DEFEKT_PRESSURE 0x40 |
#define DEFEKT_CAREFREE_ERR 0x80 |
|
#define DEFEKT_I2C 0x01 |
#define DEFEKT_BL_MISSING 0x02 |
#define DEFEKT_SPI_RX_ERR 0x04 |
#define DEFEKT_PPM_ERR 0x08 |
#define DEFEKT_MIXER_ERR 0x10 |
|
#define CFG_HOEHENREGELUNG 0x01 |
#define CFG_HOEHEN_SCHALTER 0x02 |
#define CFG_HEADING_HOLD 0x04 |
71,6 → 89,34 |
#define CFG2_VARIO_BEEP 0x02 |
#define CFG_SENSITIVE_RC 0x04 |
|
#define CFG0_AIRPRESS_SENSOR 0x01 |
#define CFG0_HEIGHT_SWITCH 0x02 |
#define CFG0_HEADING_HOLD 0x04 |
#define CFG0_COMPASS_ACTIVE 0x08 |
#define CFG0_COMPASS_FIX 0x10 |
#define CFG0_GPS_ACTIVE 0x20 |
#define CFG0_AXIS_COUPLING_ACTIVE 0x40 |
#define CFG0_ROTARY_RATE_LIMITER 0x80 |
|
// defines for the receiver selection |
#define RECEIVER_PPM 0 |
#define RECEIVER_SPEKTRUM 1 |
#define RECEIVER_SPEKTRUM_HI_RES 2 |
#define RECEIVER_SPEKTRUM_LOW_RES 3 |
#define RECEIVER_JETI 4 |
#define RECEIVER_ACT_DSL 5 |
#define RECEIVER_UNKNOWN 0xFF |
|
struct s_MK_VersionInfo |
{ |
unsigned char SWMajor; |
unsigned char SWMinor; |
unsigned char ProtoMajor; |
unsigned char ProtoMinor; |
unsigned char SWPatch; |
unsigned char HardwareError[5]; |
}; |
|
struct s_MK_Debug |
{ |
unsigned char Digital[2]; |
95,8 → 141,8 |
{ |
// Die ersten beiden Bytes nicht an den MK senden. |
unsigned char Index; |
unsigned char Version; |
|
|
unsigned char Revision; |
unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char GlobalConfig; // 0x01=H�henregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
unsigned char Hoehe_MinGas; // Wert : 0-100 |
118,12 → 164,13 |
unsigned char Gyro_P; // Wert : 10-250 |
unsigned char Gyro_I; // Wert : 0-250 |
unsigned char Gyro_D; // Wert : 0-250 |
unsigned char Gyro_Gier_P; // Wert : 10-250 |
unsigned char Gyro_Gier_I; // Wert : 0-250 |
unsigned char Gyro_Gier_P; // Wert : 10-250 |
unsigned char Gyro_Gier_I; // Wert : 0-250 |
unsigned char Gyro_Stability; // 0.80 Wert : 0-16 |
unsigned char UnterspannungsWarnung; // Wert : 0-250 |
unsigned char NotGas; // Wert : 0-250 //Gaswert bei Emp�ngsverlust |
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
unsigned char I_Faktor; // Wert : 0-250 |
unsigned char UserParam1; // Wert : 0-250 |
unsigned char UserParam2; // Wert : 0-250 |
133,39 → 180,36 |
unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
//--- Seit V0.75 |
unsigned char ServoRollControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoRollComp; // Wert : 0-250 |
unsigned char ServoRollMin; // Wert : 0-250 |
unsigned char ServoRollMax; // Wert : 0-250 |
//--- |
unsigned char ServoNickRefresh; // Speed of the Servo |
unsigned char Servo3; // Value or mapping of the Servo Output |
unsigned char Servo4; // Value or mapping of the Servo Output |
unsigned char Servo5; // Value or mapping of the Servo Output |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas w�hrend Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle f�r Stickausschlag |
unsigned char LoopHysterese; // Wert: 0-250 Hysterese f�r Stickausschlag |
unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char WinkelUmschlagNick; // Wert: 0-250 180�-Punkt |
unsigned char WinkelUmschlagRoll; // Wert: 0-250 180�-Punkt |
unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
unsigned char Driftkomp; |
unsigned char DynamicStability; |
unsigned char UserParam5; // Wert : 0-250 |
unsigned char UserParam6; // Wert : 0-250 |
unsigned char UserParam7; // Wert : 0-250 |
unsigned char UserParam8; // Wert : 0-250 |
unsigned char ServoRollControl; // 0.75 Wert : 0-250 // Stellung des Servos |
unsigned char ServoRollComp; // 0.75 Wert : 0-250 |
unsigned char ServoRollMin; // 0.75 Wert : 0-250 |
unsigned char ServoRollMax; // 0.75 Wert : 0-250 |
unsigned char ServoNickRefresh; // Speed of the Servo |
unsigned char Servo3; // Value or mapping of the Servo Output |
unsigned char Servo4; // Value or mapping of the Servo Output |
unsigned char Servo5; // Value or mapping of the Servo Output |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas w�hrend Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle f�r Stickausschlag |
unsigned char LoopHysterese; // Wert: 0-250 Hysterese f�r Stickausschlag |
unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char WinkelUmschlagNick; // Wert: 0-250 180�-Punkt |
unsigned char WinkelUmschlagRoll; // Wert: 0-250 180�-Punkt |
unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
unsigned char Driftkomp; // |
unsigned char DynamicStability; // |
unsigned char UserParam5; // Wert : 0-250 |
unsigned char UserParam6; // Wert : 0-250 |
unsigned char UserParam7; // Wert : 0-250 |
unsigned char UserParam8; // Wert : 0-250 |
//---Output --------------------------------------------- |
unsigned char J16Bitmask; // for the J16 Output |
unsigned char J16Timing; // for the J16 Output |
unsigned char J17Bitmask; // for the J17 Output |
unsigned char J17Timing; // for the J17 Output |
// seit version V0.75c |
unsigned char WARN_J16_Bitmask; // for the J16 Output |
unsigned char WARN_J17_Bitmask; // for the J17 Output |
unsigned char J16Bitmask; // for the J16 Output |
unsigned char J16Timing; // for the J16 Output |
unsigned char J17Bitmask; // for the J17 Output |
unsigned char J17Timing; // for the J17 Output |
unsigned char WARN_J16_Bitmask; // 0.75 for the J16 Output |
unsigned char WARN_J17_Bitmask; // 0.75 for the J17 Output |
//---NaviCtrl--------------------------------------------- |
unsigned char NaviGpsModeControl; // Parameters for the Naviboard |
unsigned char NaviGpsGain; |
185,19 → 229,24 |
unsigned char NaviPH_LoginTime; |
//---Ext.Ctrl--------------------------------------------- |
unsigned char ExternalControl; // for serial Control |
//------------------------------------------------ |
//---CareFree--------------------------------------------- |
unsigned char OrientationAngle; // 0.80 Where is the front-direction? |
unsigned char OrientationModeControl; // 0.80 switch for CareFree |
//-------------------------------------------------------- |
unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
unsigned char ExtraConfig; // bitcodiert |
char Name[12]; |
unsigned char crc; |
|
}; |
|
struct s_MK_Mixer |
{ |
char Revision; |
char Name[12]; |
signed char Motor[16][4]; |
uint8_t Revision; |
char Name[12]; |
int8_t Motor[16][4]; |
uint8_t crc; |
}; |
|
/////////////// |
204,8 → 253,8 |
// Navi-Ctrl // |
/////////////// |
|
#define INVALID 0x00 |
#define NEWDATA 0x01 |
#define INVALID 0x00 |
#define NEWDATA 0x01 |
#define PROCESSED 0x02 |
|
#define NC_FLAG_FREE 0x01 |
217,6 → 266,9 |
#define NC_FLAG_MANUAL_CONTROL 0x40 |
#define NC_FLAG_8 0x80 |
|
#define POINT_TYPE_WP 0 |
#define POINT_TYPE_POI 1 |
|
typedef struct |
{ |
int32_t Longitude; // in 1E-7 deg |
252,7 → 304,7 |
int8_t AngleNick; // current Nick angle in 1° |
int8_t AngleRoll; // current Rick angle in 1° |
uint8_t RC_Quality; // RC_Quality |
uint8_t MKFlags; // Flags from FC |
uint8_t FCFlags; // Flags from FC |
uint8_t NCFlags; // Flags from NC |
uint8_t Errorcode; // 0 --> okay |
uint8_t OperatingRadius; // current operation radius around the Home Position in m |
273,7 → 325,9 |
uint8_t ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
uint8_t HoldTime; // in seconds, if the was once in the tolerance area around a WP, this time defies the delay before the next WP is triggered |
uint8_t Event_Flag; // future emplementation |
uint8_t reserve[12]; // reserve |
uint8_t Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
uint8_t Type; // type of Waypoint |
uint8_t reserve[11]; // reserve |
} __attribute__((packed)) s_MK_WayPoint; |
|
#endif // MK_DATATYPES_H |