Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1307 → Rev 1308

/beta/Code Redesign killagreg/eeprom.h
3,27 → 3,31
 
#include <inttypes.h>
 
#define EEPROM_ADR_PARAM_BEGIN 0
#define PID_PARAM_REVISION 1 // byte
#define PID_ACTIVE_SET 2 // byte
#define PID_PRESSURE_OFFSET 3 // byte
#define PID_ACC_NICK 4 // word
#define PID_ACC_ROLL 6 // word
#define PID_ACC_TOP 8 // word
#define EEPROM_ADR_PARAM_BEGIN 0
#define PID_PARAM_REVISION 1 // byte
#define PID_ACTIVE_SET 2 // byte
#define PID_PRESSURE_OFFSET 3 // byte
 
#define PID_ACC_NICK 4 // word
#define PID_ACC_ROLL 6 // word
#define PID_ACC_TOP 8 // word
 
#define PID_FLIGHT_MINUTES_TOTAL 10 // word
#define PID_FLIGHT_MINUTES 14 // word
 
#ifdef USE_KILLAGREG
#define PID_MM3_X_OFF 11 // byte
#define PID_MM3_Y_OFF 12 // byte
#define PID_MM3_Z_OFF 13 // byte
#define PID_MM3_X_RANGE 14 // word
#define PID_MM3_Y_RANGE 16 // word
#define PID_MM3_Z_RANGE 18 // word
#define PID_MM3_X_OFF 31 // byte
#define PID_MM3_Y_OFF 32 // byte
#define PID_MM3_Z_OFF 33 // byte
#define PID_MM3_X_RANGE 34 // word
#define PID_MM3_Y_RANGE 36 // word
#define PID_MM3_Z_RANGE 38 // word
#endif
 
 
#define EEPROM_ADR_CHANNELS 80 // 8 bytes
#define EEPROM_ADR_CHANNELS 80 // 8 bytes
 
#define EEPROM_ADR_PARAMSET_LENGTH 98 // word
#define EEPROM_ADR_PARAMSET_LENGTH 98 // word
#define EEPROM_ADR_PARAMSET_BEGIN 100
 
 
30,7 → 34,6
#define EEPROM_ADR_MIXER_TABLE 1000 // 1000 - 1076
 
 
 
#define MIX_GAS 0
#define MIX_NICK 1
#define MIX_ROLL 2
/beta/Code Redesign killagreg/fc.c
58,6 → 58,7
#include "eeprom.h"
#include "timer0.h"
#include "analog.h"
#include "printf_P.h"
#include "fc.h"
#include "uart0.h"
#include "rc.h"
270,6 → 271,14
AdBiasAccNick = (int16_t)GetParamWord(PID_ACC_NICK);
AdBiasAccRoll = (int16_t)GetParamWord(PID_ACC_ROLL);
AdBiasAccTop = (int16_t)GetParamWord(PID_ACC_TOP);
 
if((AdBiasAccNick > 2048) || (AdBiasAccRoll > 2048) || (AdBiasAccTop > 1024))
{
printf("\n\rACC not calibrated!\r\n");
AdBiasAccNick = 1024;
AdBiasAccRoll = 1024;
AdBiasAccTop = 725;
}
}
// offset for height reading
StartAirPressure = AirPressure;
/beta/Code Redesign killagreg/main.c
82,6 → 82,7
uint8_t BoardRelease = 10;
uint8_t CPUType = ATMEGA644;
uint8_t LowVoltageWarning = 94;
uint16_t FlightMinutes = 0, FlightMinutesTotal = 0;
 
uint8_t GetCPUType(void)
{ // works only after reset or power on when the registers have default values
163,7 → 164,7
 
int16_t main (void)
{
uint16_t timer;
uint16_t timer, flighttimer;
uint8_t i;
 
// disable interrupts global
254,12 → 255,6
}
printf("\n\r===================================");
 
 
if(GetParamWord(PID_ACC_NICK) > 2048)
{
printf("\n\rACC not calibrated!");
}
 
//wait for a short time (otherwise the RC channel check won't work below)
timer = SetDelay(500);
while(!CheckDelay(timer));
296,7 → 291,7
else printf("\n\rSupport for GPS at 1st UART");
#endif
 
 
// init variables
SetNeutral(NO_ACC_CALIB);
 
RED_OFF;
305,6 → 300,17
ExternControl.Digital[0] = 0x55;
 
 
FlightMinutes = GetParamWord(PID_FLIGHT_MINUTES);
FlightMinutesTotal = GetParamWord(PID_FLIGHT_MINUTES_TOTAL);
flighttimer = 0;
if(FlightMinutesTotal == 0xFFFF)
{
FlightMinutes = 0;
FlightMinutesTotal = 0;
}
printf("\n\rFlight-time %u min Total:%u min", FlightMinutes, FlightMinutesTotal);
 
 
printf("\n\rControl: ");
if (ParamSet.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
else printf("Neutral (ACC-Mode)");
402,6 → 408,16
SPI_StartTransmitPacket();
SendSPI = 4;
#endif
 
if(!(MKFlags & MKFLAG_MOTOR_RUN)) flighttimer = 1465; // 0.5 minutes round up
if(++flighttimer == 2930) // one minute
{
flighttimer = 0;
FlightMinutesTotal++;
FlightMinutes++;
SetParamWord(PID_FLIGHT_MINUTES_TOTAL, FlightMinutesTotal);
SetParamWord(PID_FLIGHT_MINUTES, FlightMinutes);
}
timer = SetDelay(20); // every 20 ms
}
 
/beta/Code Redesign killagreg/main.h
23,6 → 23,7
extern uint8_t LowVoltageWarning;
extern uint8_t BoardRelease;
extern uint8_t CPUType;
extern uint16_t FlightMinutes, FlightMinutesTotal;
void LipoDetection(uint8_t print);
 
#endif //_MAIN_H
/beta/Code Redesign killagreg/makefile
5,7 → 5,7
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 75
VERSION_PATCH = 8
VERSION_PATCH = 9
 
VERSION_SERIAL_MAJOR = 10 # Serial Protocol Major Version
VERSION_SERIAL_MINOR = 1 # Serial Protocol Minor Version
/beta/Code Redesign killagreg/menu.c
69,14 → 69,14
#endif
 
#if (!defined (USE_KILLAGREG) && !defined (USE_MK3MAG))
uint8_t MaxMenuItem = 13;
uint8_t MaxMenuItem = 14;
#else
#ifdef USE_MK3MAG
uint8_t MaxMenuItem = 14;
uint8_t MaxMenuItem = 15;
#endif
 
#ifdef USE_KILLAGREG
uint8_t MaxMenuItem = 16;
uint8_t MaxMenuItem = 17;
#endif
#endif
uint8_t MenuItem = 0;
136,7 → 136,7
}
else
{
LCD_printfxy(16,0,"[%i]",MenuItem);
LCD_printfxy(16,0,"[%i]",MenuItem);
}
 
switch(MenuItem)
266,9 → 266,20
if(Motor[10].Present) LCD_printfxy(8,3,"11");
if(Motor[11].Present) LCD_printfxy(12,3,"12");
break;
case 14:// flight time counter
LCD_printfxy(0,0,"Flight-Time " );
LCD_printfxy(0,1,"Trip: %5u min",FlightMinutes);
LCD_printfxy(0,2,"Total:%5u min",FlightMinutesTotal);
LCD_printfxy(13,3,"(reset)");
if(RemoteKeys & KEY4)
{
FlightMinutes = 0;
SetParamWord(PID_FLIGHT_MINUTES, FlightMinutes);
}
break;
 
#if (defined (USE_KILLAGREG) || defined (USE_MK3MAG))
case 14://GPS Lat/Lon coords
case 15://GPS Lat/Lon coords
if (GPSInfo.status == INVALID)
{
LCD_printfxy(0,0,"No GPS data!");
306,13 → 317,13
break;
#endif
#ifdef USE_KILLAGREG
case 15:// MM3 Kompass
case 16:// MM3 Kompass
LCD_printfxy(0,0,"MM3 Offset");
LCD_printfxy(0,1,"X_Offset: %3i",MM3_calib.X_off);
LCD_printfxy(0,2,"Y_Offset: %3i",MM3_calib.Y_off);
LCD_printfxy(0,3,"Z_Offset: %3i",MM3_calib.Z_off);
break;
case 16://MM3 Range
case 17://MM3 Range
LCD_printfxy(0,0,"MM3 Range");
LCD_printfxy(0,1,"X_Range: %4i",MM3_calib.X_range);
LCD_printfxy(0,2,"Y_Range: %4i",MM3_calib.Y_range);
/beta/Code Redesign killagreg/version.txt
305,9 → 305,12
- "hoovergas-Variation" als Parameter
- Kompatibilität zu NC und PC erhöht
 
Anpassungen bzgl. V0.75i
G.Stobrawa 7.9.2009:
0.75j H.Buss 17.09.2009
- Laufzeitzähler eingebaut
 
Anpassungen bzgl. V0.75j
G.Stobrawa 17.9.2009:
 
- Code stärker modularisiert und restrukturiert
- viele Kommentare zur Erklärug eingefügt
- konsequent englische Variablennamen