/branches/V0.69k CRK HexaLotte/fc.c |
---|
68,8 → 68,9 |
#include "mm3.h" |
#include "gps.h" |
#endif |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
#include "mk3mag.h" |
#include "gps.h" |
#endif |
#include "led.h" |
704,7 → 705,7 |
Reading_IntegralGyroRoll2 = IntegralRoll; |
SumPitch = 0; |
SumRoll = 0; |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
if(ParamSet.GlobalConfig & CFG_GPS_ACTIVE) |
{ |
GPS_SetHomePosition(); |
723,7 → 724,7 |
delay_stopmotors = 0; // do not repeat if once executed |
Model_Is_Flying = 0; |
MotorsOn = 0; |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
if(ParamSet.GlobalConfig & CFG_GPS_ACTIVE) |
{ |
GPS_ClearHomePosition(); |
1212,7 → 1213,7 |
} |
} |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// GPS |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/branches/V0.69k CRK HexaLotte/gps.c |
---|
4,7 → 4,7 |
#include "ubx.h" |
#include "mymath.h" |
#include "timer0.h" |
#include "uart.h" |
//#include "uart.h" |
#include "rc.h" |
#include "eeprom.h" |
274,7 → 274,6 |
break; |
case VALID: // new valid data from gps device |
// if the gps data quality is good |
DebugOut.Analog[29] = (int16_t)GPSInfo.updatetime; |
if (GPSInfo.satfix == SATFIX_3D) |
{ |
switch(GPS_Task) // check what's to do |
/branches/V0.69k CRK HexaLotte/led.c |
---|
31,7 → 31,7 |
} |
else J16_ON; |
if (LED2_Time < 20) J17_OFF; |
if (LED2_Time < 20) J17_ON; |
else if(LED2_Time < 220) |
{ |
if((2 * J17_blinkcount) < LED2_Time) J17_ON; |
38,5 → 38,5 |
else J17_OFF; |
if(J17_blinkcount++ >= LED2_Time) J17_blinkcount = 0; |
} |
else J17_OFF; |
else J17_ON; |
} |
/branches/V0.69k CRK HexaLotte/main.c |
---|
73,7 → 73,7 |
#ifdef USE_NAVICTRL |
#include "spi.h" |
#endif |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
#include "mk3mag.h" |
#endif |
#include "twimaster.h" |
134,13 → 134,14 |
ADC_Init(); |
I2C_Init(); |
#ifdef USE_NAVICTRL |
SPI_MasterInit(); |
#endif |
#ifdef USE_KILLAGREG |
MM3_Init(); |
#endif |
#ifdef USE_NAVICTRL |
SPI_MasterInit(); |
#endif |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
MK3MAG_Init(); |
#endif |
169,11 → 170,6 |
while(!CheckDelay(timer)); |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
printf("\n\rSupport for MK3MAG Compass"); |
#endif |
if(ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL) |
{ |
printf("\n\rCalibrating air pressure sensor.."); |
183,8 → 179,20 |
printf("OK\n\r"); |
} |
#ifdef USE_NAVICTRL |
printf("\n\rSupport for NaviCtrl"); |
#endif |
#ifdef USE_KILLAGREG |
printf("\n\rSupport for MicroMag3 Compass"); |
#endif |
#ifdef USE_MK3MAG |
printf("\n\rSupport for MK3MAG Compass"); |
#endif |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
#if defined (__AVR_ATmega644P__) |
if(BoardRelease == 10) |
{ |
199,6 → 207,8 |
#endif |
#endif |
SetNeutral(); |
ROT_OFF; |
/branches/V0.69k CRK HexaLotte/makefile |
---|
16,10 → 16,10 |
VERSION_COMPATIBLE = 7 # PC-Kompatibilität |
#------------------------------------------------------------------- |
#OPTIONS |
# Use on of the extensions für a gps solution |
# If no extension is used the support for the MK3MAG only is included. |
# Use one of the extensions for a gps solution |
#EXT = KILLAGREG |
#EXT = NAVICTRL |
EXT = MK3MAG |
#------------------------------------------------------------------- |
ifeq ($(MCU), atmega644) |
97,9 → 97,10 |
endif |
ifeq ($(EXT), KILLAGREG) |
SRC += mm3.c mymath.c gps.c ubx.c |
else |
SRC += mk3mag.c |
endif |
ifeq ($(EXT), MK3MAG) |
SRC += mk3mag.c mymath.c gps.c ubx.c |
endif |
ifeq ($(EXT), NAVICTRL) |
SRC += spi.c |
endif |
149,6 → 150,9 |
ifeq ($(EXT), KILLAGREG) |
CFLAGS += -DUSE_KILLAGREG |
endif |
ifeq ($(EXT), MK3MAG) |
CFLAGS += -DUSE_MK3MAG |
endif |
ifeq ($(EXT), NAVICTRL) |
CFLAGS += -DUSE_NAVICTRL |
endif |
/branches/V0.69k CRK HexaLotte/menu.c |
---|
17,6 → 17,8 |
#include "analog.h" |
#ifdef USE_KILLAGREG |
#include "mm3.h" |
#endif |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
#include "ubx.h" |
#endif |
#include "_Settings.h" |
51,11 → 53,17 |
// Display with 20 characters in 4 lines |
void LCD_PrintMenu(void) |
{ |
#if !defined (USE_MK3MAG) & !defined (USE_MK3MAG) |
static uint8_t MaxMenuItem = 11; |
#else |
#ifdef USE_MK3MAG |
static uint8_t MaxMenuItem = 12; |
#endif |
#ifdef USE_KILLAGREG |
static uint8_t MaxMenuItem = 14; |
#else |
static uint8_t MaxMenuItem = 11; |
#endif |
#endif |
static uint8_t MenuItem=0; |
// if KEY1 is activated goto previous menu item |
179,7 → 187,7 |
LCD_printfxy(0,3,"Hi:%4i Cf:%4i ",ExternControl.Height, ExternControl.Config); |
break; |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
case 12://GPS Lat/Lon coords |
if (GPSInfo.status == INVALID) |
{ |
216,6 → 224,8 |
LCD_printfxy(0,3,"Alt: %d.%.3d m",i1, i2); |
} |
break; |
#endif |
#ifdef USE_KILLAGREG |
case 13:// MM3 Kompass |
LCD_printfxy(0,0,"MM3 Offset"); |
LCD_printfxy(0,1,"X_Offset: %3i",MM3_calib.X_off); |
/branches/V0.69k CRK HexaLotte/mk3mag.c |
---|
2,7 → 2,6 |
#include <stdlib.h> |
#include <inttypes.h> |
#include "timer0.h" |
#include "uart.h" |
#include "fc.h" |
#include "rc.h" |
#include "eeprom.h" |
41,6 → 40,7 |
// so the cycle time is 65mS + the pulse width. |
// pwm is high |
if(PINC & (1<<PINC4)) |
{ // If PWM signal is high increment PWM high counter |
// This counter is incremented by a periode of 102.4us, |
56,7 → 56,7 |
} |
else // pwm is low |
{ // ignore pwm values values of 0 and higher than 37 ms |
{ // ignore pwm values values of 0 and higher than 37 ms; |
if((PWMCount) && (PWMCount < 362)) // 362 * 102.4us = 37.0688 ms |
{ |
if(PWMCount <10) CompassHeading = 0; |
65,15 → 65,8 |
PWMTimeout = 12; // if 12 periodes long no valid PWM was detected the data are invalid |
// 12 * 362 counts * 102.4 us |
} |
else |
{ // bad pwm value (out of range or permanent low) |
if(PWMTimeout) PWMTimeout--; // decrement timeout |
CompassHeading = -1; // unknown heading |
CompassOffCourse = 0; |
} |
PWMCount = 0; // reset pwm counter |
} |
if(!PWMTimeout) |
{ |
if(CheckDelay(BeepDelay)) |
/branches/V0.69k CRK HexaLotte/timer0.c |
---|
8,7 → 8,7 |
#ifdef USE_KILLAGREG |
#include "mm3.h" |
#endif |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
#include "mk3mag.h" |
#endif |
154,7 → 154,7 |
#ifdef USE_KILLAGREG |
MM3_Update(); // read out mm3 board |
#endif |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
MK3MAG_Update(); // read out mk3mag pwm |
#endif |
} |
/branches/V0.69k CRK HexaLotte/uart.c |
---|
17,10 → 17,10 |
#include "fc.h" |
#include "_Settings.h" |
#include "rc.h" |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
#include "ubx.h" |
#endif |
#if !defined(USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
#include "mk3mag.h" |
#endif |
57,7 → 57,7 |
int16_t Debug_Timer; |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
int16_t Compass_Timer; |
#endif |
172,7 → 172,7 |
Debug_Timer = SetDelay(200); |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
Compass_Timer = SetDelay(220); |
#endif |
215,7 → 215,7 |
c = UDR0; // catch the received byte |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
// If the FC 1.0 cpu is used the ublox module should be conneced to rxd of the 1st uart. |
// The FC 1.1 /1.2 has the ATMEGA644p cpu with a 2nd uart to which the ublox should be connected. |
#if defined (__AVR_ATmega644P__) |
223,7 → 223,7 |
#else |
ubx_parser(c); |
#endif |
#endif // USE_KILLAGREG |
#endif |
if(rxd_buffer_locked) return; // if rxd buffer is locked immediately return |
364,7 → 364,7 |
switch(rxd_buffer[2]) |
{ |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
case 'K':// Compass value |
Decode64((uint8_t *) &tmp_int_arr1[0], sizeof(tmp_int_arr1), 3, ReceivedBytes); |
CompassHeading = tmp_int_arr1[0]; |
469,7 → 469,7 |
RequestExternalControl = FALSE; |
} |
#if !defined (USE_KILLAGREG) && !defined (USE_NAVICTRL) |
#ifdef USE_MK3MAG |
if((CheckDelay(Compass_Timer)) && txd_complete) |
{ |
ToMk3Mag.Attitude[0] = (int16_t) (IntegralPitch / 108); // approx. 0,1 Deg |
/branches/V0.69k CRK HexaLotte/uart1.c |
---|
142,7 → 142,7 |
{ |
uint8_t c; |
c = UDR1; // get data byte |
#ifdef USE_KILLAGREG |
#if defined (USE_KILLAGREG) || defined (USE_MK3MAG) |
if (BoardRelease == 11) ubx_parser(c); // and put it into the ubx protocol parser |
#endif |
} |
/branches/V0.69k CRK HexaLotte/version.txt |
---|
136,7 → 136,7 |
Anpassungen bzgl. V0.69k |
G.Stobrawa 01.06.2008: |
G.Stobrawa 17.07.2008: |
- Code stärker modularisiert und restrukturiert |
- viele Kommentare zur Erklärug eingefügt |
144,11 → 144,12 |
- PPM24 Support für bis zu 12 RC-Kanäle. |
- 2. Uart wird nun unterstützt (MCU = atmega644p im Makefile) |
- Makefile: EXT nicht definiert Unerstützung des MK3MAG direct an FC |
- Makefile: EXT=NAVICTRL Unterstützung der SPI Communikation zum Naviboard |
- Makefile: EXT nicht definiert Unerstützung des MK3MAG direct an FC und Conrad UBLOX Modul |
- Makefile: EXT=KILLAGREG Unterstützung vom KillagregBoard mit MM3 und Conrad UBLOX Modul |
- Ausertung des UBX-Pprotocols an 1. oder 2. Uart |
- GPS-Hold-Funktion hinzugefügt |
- GPS-Home-Funktion hinzugefügt (wird beim Motorstart gelernt, und bei Motorenstop wieder gelöscht) |