/trunk/logging.c |
---|
178,7 → 178,7 |
{ |
case LOGFILE_IDLE: |
case LOGFILE_CLOSED: |
if((GPSData.Status != INVALID) && (GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.SatFix == SATFIX_3D) && (FC.StatusFlags & FC_STATUS_FLY)) |
if((GPSData.Status != INVALID) && (GPSData.NumOfSats > 2) && /*(GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.SatFix == SATFIX_3D)*/ (FC.StatusFlags & FC_STATUS_FLY)) |
{ |
logfilestate = LOGFILE_START; |
} |
/trunk/main.c |
---|
64,6 → 64,7 |
#include "gps.h" |
#include "i2c.h" |
#include "compass.h" |
#include "ncmag.h" |
#include "timer1.h" |
#include "timer2.h" |
#include "analog.h" |
274,6 → 275,14 |
StopNavigation = 1; |
// UBX_Timeout = SetDelay(500); |
} |
else if(Compass_Heading < 0 && NCMAG_Present && !NCMAG_IsCalibrated) |
{ |
LED_RED_ON; |
sprintf(ErrorMSG,"compass not calibr."); |
newErrorCode = 31; |
StopNavigation = 1; |
UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE; |
} |
else if(Compass_Heading < 0) |
{ |
LED_RED_ON; |
/trunk/menu.c |
---|
67,6 → 67,7 |
#include "uart1.h" |
#include "ncmag.h" |
#include "logging.h" |
#include "settings.h" |
u8 DispPtr = 0; |
s8 DisplayBuff[DISPLAYBUFFSIZE]; |
73,7 → 74,7 |
u8 MenuItem = 0; |
u8 MaxMenuItem = 19; |
u8 MaxMenuItem = 20; |
void Menu_Putchar(char c) |
{ |
371,7 → 372,7 |
LCD_printfxy(0,3,"UP7:%3i UP8:%3i",Parameter.User7,Parameter.User8); |
break; |
case 17: // User Parameter |
LCD_printfxy(0,0,"SD-Card Logs",Parameter.User1,Parameter.User2); |
LCD_printfxy(0,0,"SD-Card Logs"); |
LCD_printfxy(0,1,"GPX:%4i (%3ims) ",Logged_GPX_Counter,LogCfg.GPX_Interval); |
LCD_printfxy(0,2,"KML:%4i (%3ims) ",Logged_KML_Counter,LogCfg.KML_Interval); |
break; |
434,6 → 435,10 |
LCD_printfxy(0,2,"Declination:%c%i.%1i ", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
LCD_printfxy(0,3,"Inclination:%2i (%2i)", EarthMagneticInclination, EarthMagneticInclinationTheoretic); |
break; |
case 20: // User Parameter |
LCD_printfxy(0,0,"SD-Setting "); |
LCD_printfxy(0,2,"WP-Dynamic:%4i ",WaypointAcceleration); |
break; |
default: |
//MaxMenuItem = MenuItem - 1; |
MenuItem = 0; |
/trunk/ncmag.h |
---|
8,7 → 8,8 |
u8 NCMAG_Init(void); |
void NCMAG_Update(void); |
extern u8 NCMAG_Present; |
extern u8 NCMAG_IsCalibrated; |
#endif // __NCMAG_H |
/trunk/settings.c |
---|
62,8 → 62,9 |
#include "settings.h" |
#include "uart1.h" |
#include "main.h" |
u16 WaypointAccelerationSetting = 100; // acceleration for flying waypoints in percent (0-100) or Poti -> 255 = Poti1, 254 = Poti2... |
u16 WaypointAcceleration = 100; // the real value |
typedef struct |
{ |
ParamId_t ParamId; |
83,12 → 84,13 |
{ |
//{PID , "1234567890123456" , Comment, Group, Value, Default, Min, Max }, |
{PID_KML_LOGGING , "KMLLOGGING \0" ,"KML logging interval in ms (0 = disabled) ", 1, 500, 500, 0, 60000}, // the log interval for KML logging, 0 = off |
{PID_GPX_LOGGING , "GPXLOGGING \0" ,"GPX logging interval in ms (0 = disabled) ", 1, 1000, 1000, 0, 60000}, // the log interval for GPX logging, 0 = off |
{PID_GPX_LOGGING , "GPXLOGGING \0" ,"GPX logging interval in ms (0 = disabled) ", 1, 500, 1000, 0, 60000}, // the log interval for GPX logging, 0 = off |
{PID_ABSOLUTE_FLYING_ALT , "MAX_FLYING_ALT \0" ,"max. altitude in m ", 1, 0, 0, 0, 30000}, // in [m] |
{PID_ABSOLUTE_FLYING_RANGE , "MAX_FLYING_RANGE\0" ,"max. range in m ", 1, 0, 0, 0, 60000}, // in [m] |
{PID_AUTO_DESCEND_RANGE , "DESCEND_RANGE \0" ,"Auto-descend range in m (0 = disabled) (only comm. License) ", 1, 0, 0, 0, 60000}, // in [m] |
{PID_GPS_SBAS_CONFIG , "GPS_SBAS_DGPS_ON\0" ,"GPS SBAS mode (0 = off, 1 = on) ", 1, 1, 1, 0, 1}, |
{PID_MIN_EVENT_TIME , "MIN_EVENT_TIME \0" ,"minimum time of the Waypoint-Event value (seconds) ", 1, 2, 2, 0, 600}, // in seconds |
{PID_WP_ACCELERATE , "WAYPOINT DYNAMIC\0" ,"acceleration for flying waypoints in percent (0-100) ", 1, 100, 100, 0, 255}, // in percent or Poti |
{PID_GPS_AUTOCONFIG , "GPSAUTOCONFIG \0" ,"GPS configmode (0 = off, 1 = on) ", 1, 1, 1, 0, 1} |
}; |
/trunk/settings.h |
---|
12,13 → 12,15 |
PID_ABSOLUTE_FLYING_ALT, |
PID_GPS_SBAS_CONFIG, |
PID_AUTO_DESCEND_RANGE, |
PID_MIN_EVENT_TIME |
PID_MIN_EVENT_TIME, |
PID_WP_ACCELERATE |
} ParamId_t; |
void Settings_Init(void); |
void Settings_SetDefaultValues(void); |
u8 Settings_GetParamValue(ParamId_t Pid, u16* pValue); |
extern u16 WaypointAccelerationSetting; // acceleration for flying waypoints in percent (0-100) or Poti -> 255 = Poti1, 254 = Poti2... |
extern u16 WaypointAcceleration; // the real value |
#endif // _SETTINGS_H |
/trunk/spi_slave.c |
---|
69,6 → 69,7 |
#include "compass.h" |
#include "params.h" |
#include "stdlib.h" |
#include "settings.h" |
#define SPI_RXSYNCBYTE1 0xAA |
#define SPI_RXSYNCBYTE2 0x83 |
285,8 → 286,9 |
void SPI0_UpdateBuffer(void) |
{ |
static u32 timeout = 0; |
static u8 counter = 50,hott_index = 0, last_error_code = 0; |
s16 tmp, last_wp_event = 0; |
static u8 counter = 50,hott_index = 0, last_error_code = 0, enable_injecting = 0; |
static s16 last_wp_event = 0; |
s16 tmp; |
s32 i1,i2; |
SPIWatchDog = 3500; // stop communication to FC after this timeout |
302,17 → 304,26 |
ToFlightCtrl.MagVecZ = MagVector.Z; |
// ToFlightCtrl.NCStatus = 0; |
// cycle spi commands |
if(ErrorCode != last_error_code) ToFlightCtrl.Command = SPI_NCCMD_VERSION; |
if(ErrorCode != last_error_code && enable_injecting) |
{ |
ToFlightCtrl.Command = SPI_NCCMD_VERSION; |
last_error_code = ErrorCode; |
enable_injecting = 0; |
} |
else |
if(FC_WP_EventChannel != last_wp_event) ToFlightCtrl.Command = SPI_NCCMD_GPSINFO; |
if(FC_WP_EventChannel != last_wp_event && enable_injecting) |
{ |
ToFlightCtrl.Command = SPI_NCCMD_GPSINFO; |
last_wp_event = FC_WP_EventChannel; |
enable_injecting = 0; |
} |
else |
{ |
ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++]; |
// restart command cycle at the end |
if(SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0; |
if(ToFlightCtrl.Command == SPI_NCCMD_KALMAN) enable_injecting = 1; |
} |
last_error_code = ErrorCode; |
last_wp_event = FC_WP_EventChannel; |
#define FLAG_GPS_AID 0x01 |
switch (ToFlightCtrl.Command) |
379,7 → 390,6 |
ToFlightCtrl.Param.Byte[9] = 0; |
ToFlightCtrl.Param.Byte[10] = 0; |
ToFlightCtrl.Param.Byte[11] = 0; |
//DebugOut.Analog[16] = SpeakHoTT; |
SpeakHoTT = 0; |
break; |
573,10 → 583,6 |
NaviData.Current = FC.BAT_Current; |
NaviData.UsedCapacity = FC.BAT_UsedCapacity; |
break; |
#define CHK_POTI(b,a) { if(a < 248) b = a; else b = FC.Poti[255 - a]; } |
#define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max); } |
case SPI_FCCMD_PARAMETER1: |
CHK_POTI_MM(Parameter.NaviGpsModeControl,FromFlightCtrl.Param.Byte[0],0,255); |
CHK_POTI_MM(Parameter.NaviGpsGain,FromFlightCtrl.Param.Byte[1],0,255); |
607,6 → 613,7 |
FC.Poti[5] = FromFlightCtrl.Param.Byte[9]; |
FC.Poti[6] = FromFlightCtrl.Param.Byte[10]; |
FC.Poti[7] = FromFlightCtrl.Param.Byte[11]; |
CHK_POTI_MM(WaypointAcceleration,WaypointAccelerationSetting,0,255); // that could be a Poti-Value |
break; |
case SPI_FCCMD_MISC: |
/trunk/spi_slave.h |
---|
29,6 → 29,9 |
#define SPI_FCCMD_ACCU 16 |
#define SPI_FCCMD_PARAMETER2 17 |
#define CHK_POTI(b,a) { if(a < 248) b = a; else b = FC.Poti[255 - a]; } |
#define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max); } |
extern s32 Kalman_K; |
extern s32 Kalman_Kompass ; |
extern s32 Kalman_MaxDrift; |