0,0 → 1,482 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* Copyright (C) 2011 Harald Bongartz * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
* * |
* * |
* Credits to: * |
* Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN * |
* http://www.mikrokopter.de * |
* Gregor "killagreg" Stobrawa for his version of the MK code * |
* Thomas Kaiser "thkais" for the original project. See * |
* http://www.ft-fanpage.de/mikrokopter/ * |
* http://forum.mikrokopter.de/topic-4061-1.html * |
* Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code * |
* http://www.mylifesucks.de/oss/c-osd/ * |
* Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility* |
*****************************************************************************/ |
|
|
#include "cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <avr/eeprom.h> |
#include <stdbool.h> |
#include <avr/wdt.h> |
#include "lcd.h" |
#include "main.h" |
#include "timer.h" |
#include "eeprom.h" |
#include "Wi232.h" |
#include "mk-data-structs.h" |
#include "connect.h" |
|
|
//-------------------------------------------------------------- |
// |
|
uint8_t EE_LowBat EEMEM = 137; // 13,7V |
uint8_t EE_DisplayTimeout EEMEM = 0; // Display immer an |
uint8_t EE_DisplayLanguage EEMEM = 254; // Default ungesetzt |
uint8_t EE_WiTXRXChannel EEMEM = 1; // Kanal 1 MK Standard |
uint8_t EE_WiNetworkGroup EEMEM = 66; // Gruppe 66 MK Standard |
uint8_t EE_WiNetworkMode EEMEM = NetMode_Normal; // MK Standard; |
uint8_t EE_WiTXTO EEMEM = TWaitTime16; // MK Standard |
uint8_t EE_WiUartMTU EEMEM = UartMTU64; // MK Standard |
uint8_t EE_LCD_Orientation EEMEM = 0; // normale Ansicht |
uint8_t EE_LCD_DisplayMode EEMEM = 0; // Normal |
uint8_t EE_LCD_Kontrast EEMEM = 27; // Kontrast normal |
uint8_t EE_LCD_Helligkeit EEMEM = 100; // Helligkeit in %gkeit in % |
uint8_t EE_USBBT EEMEM = 0; // USB Betrieb |
uint8_t EE_U02SV2 EEMEM = 1; // SV2 (Kabel) Standard |
uint8_t EE_Debug EEMEM = 0; // kein Debug |
uint8_t EE_UseWi EEMEM = true; // Wi.232 eingebaut? |
uint8_t EE_UseBT EEMEM = true; // BT-222 eingebaut? |
uint8_t EE_BTIsSlave EEMEM = true; // BT-222 Slave gesetzt? |
uint8_t EE_WiIsSet EEMEM = false; // Flag für die Initialisierung Wi232 |
uint8_t EE_BTIsSet EEMEM = false; // Flag für die Initialisierung Bluetooth |
uint8_t EE_PKT_IdleBeep EEMEM = 0; // kein Piepsen bei Inaktivität |
uint8_t EE_PKT_StartInfo EEMEM = true; // Startinformationen anzeigen |
uint16_t EE_Lipo_UOffset EEMEM = 0; // Offset für die Lipospannugsmessung |
uint8_t EE_PKT_Accutyp EEMEM = true; // True = Lipo, False = LiON |
uint8_t EE_OSD_RCErrorbeep EEMEM = true; //Empfangsausffallwarnung im OSD Screen |
uint8_t EE_OSD_InvertOut EEMEM = false; // Invertierte Anzeige Out1 und Out2 |
uint8_t EE_OSD_LEDform EEMEM = 1; // Form der Anzeige ( + oder schwarz) |
uint8_t EE_OSD_SendOSD EEMEM = false; // Sende OSD-Daten an SV2 |
uint8_t EE_OSD_Fallspeed EEMEM = 0; // Maximal Sinkrate, für Warnmeldung |
uint8_t EE_OSD_VarioBeep EEMEM = 1; // Vario Beep im OSD Screen |
uint8_t EE_OSD_HomeMKView EEMEM = true; // Home Circle from MK-View |
uint16_t EE_OSD_mAh_Warning EEMEM = 10000; //Warnschwelle für mAh |
uint8_t EE_OSD_ScreenMode EEMEM = 0; //Variante des OSD-Screen |
uint8_t EE_OSD_LipoBar EEMEM = 0; //Bargraphanzeige für MK Lipo |
uint8_t EE_PKT_Baudrate EEMEM = Wi232_57600; // Baudrate für BT und Wi232, siehe Wi223.h |
uint16_t EE_FM_Refresh EEMEM = 500; // FollowMe interval |
uint16_t EE_FM_Speed EEMEM = 30; // FollowMe Speed in m/s *0.1 |
uint16_t EE_FM_Radius EEMEM = 5; // Waypoint Tolerance Radius in meter |
|
uint8_t EEMEM EE_BTPin[bt_pin_length + 1]; |
uint8_t EEMEM EE_BTName[bt_name_length + 1]; |
|
uint8_t EEMEM EE_gps_UsedDevName[20]; // benutztes GPS Device Name |
uint8_t EEMEM EE_gps_UsedMac[14]; // benutztes GPS Device Mac Adresse |
uint8_t EEMEM EE_gps_UseGPS; // ist GPS aktiv? |
uint8_t EEMEM EE_gps_UsedGPSMouse; // GPS Maustyp |
|
uint32_t EE_LastLongitude EEMEM = 0; |
uint32_t EE_LastLatitude EEMEM = 0; |
|
WPListDirectory EEWPDirectory[NumberOfWPLists] EEMEM; |
WayPoints EEWayPointList[NumberOfWaypoints] EEMEM; |
|
|
uint8_t EE_PKTVersion EEMEM = EEpromVersion; |
|
|
volatile uint8_t DisplayTimeout; |
volatile uint8_t DisplayLanguage; |
volatile uint8_t WiTXRXChannel; |
volatile uint8_t WiNetworkGroup; |
volatile uint8_t WiNetworkMode; |
volatile uint8_t WiTXTO; |
volatile uint8_t WiUartMTU; |
volatile uint8_t LCD_ORIENTATION; |
volatile uint8_t LCD_DisplayMode; |
volatile uint8_t LCD_Kontrast; |
volatile uint8_t LCD_Helligkeit; |
volatile uint8_t USBBT; |
volatile uint8_t U02SV2; |
volatile uint8_t Debug; |
volatile uint8_t UseWi; // Wi232 wird genutzt |
volatile uint8_t UseBT; // BT wird genutzt |
|
volatile uint8_t WiIsSet; // Wi232 ist initialisiert |
volatile uint8_t BTIsSet; // BT ist initialisiert |
volatile uint8_t BTIsSlave; // Slave Flag |
char bt_pin[bt_pin_length + 1]; // BT Pinnummer |
char bt_name[bt_name_length + 1]; // BT Name |
|
char gps_UsedDevName[20]; // benutztes GPS Device Name |
char gps_UsedMac[14]; // benutztes GPS Device Mac Adresse |
volatile uint8_t gps_UseGPS; // ist GPS aktiv? |
volatile uint8_t gps_UsedGPSMouse; // GPS Maustyp |
|
volatile uint32_t LastLongitude; // Letzte Position |
volatile uint32_t LastLatitude; |
volatile uint8_t PKT_IdleBeep; |
volatile uint8_t PKT_StartInfo; |
volatile uint16_t Lipo_UOffset; // Offset für die Lipospannugsmessung |
volatile uint8_t PKT_Accutyp; // verwendeter Akkutyp |
volatile uint8_t OSD_RCErrorbeep; //Empfangsausffallwarnung im OSD Screen |
volatile uint8_t OSD_InvertOut; // Out1/2 invertiert anzeigen |
volatile uint8_t OSD_LEDform; // Form der Anzeige ( + oder schwarz) |
volatile uint8_t OSD_SendOSD; // OSD Daten an SV2 senden |
volatile uint8_t OSD_Fallspeed; // maximale Sinkrate |
volatile uint8_t OSD_VarioBeep; // Vario Beep im OSD Screen |
volatile uint8_t OSD_HomeMKView; // Home Circle from MK-View |
volatile uint16_t OSD_mAh_Warning; // mAh Warnschwelle |
volatile uint8_t OSD_ScreenMode; //Variante des OSD-Screen |
volatile uint8_t OSD_LipoBar; //Bargraphanzeige für MK Lipo |
volatile uint8_t PKT_Baudrate; // Baudrate für BT und Wi232 |
volatile uint16_t FM_Refresh; // FollowMe interval |
volatile uint16_t FM_Speed; // FollowMe Speed in m/s *0.1 |
volatile uint16_t FM_Radius; // Waypoint Tolerance Radius in meter |
volatile WayPoints PKTWayPoint; // Waypointdaten für einen Waypoint |
volatile WPListDirectory PKTWayPointDirectory; // Inhaltsverzeichnis der Listen |
|
|
|
//-------------------------------------------------------------- |
// |
void WriteWiInitFlag(void) |
{ |
WiIsSet = true; |
eeprom_write_byte(&EE_WiIsSet, WiIsSet); |
|
} |
|
|
//-------------------------------------------------------------- |
// |
void WriteBTInitFlag(void) |
{ |
BTIsSet = true; |
eeprom_write_byte(&EE_BTIsSet, BTIsSet); |
|
} |
//-------------------------------------------------------------- |
// |
void WriteBTSlaveFlag(void) |
{ |
BTIsSlave = true; |
eeprom_write_byte(&EE_BTIsSlave, BTIsSlave); |
|
} |
//-------------------------------------------------------------- |
// |
void WriteBTMasterFlag(void) |
{ |
BTIsSlave = false; |
eeprom_write_byte(&EE_BTIsSlave, BTIsSlave); |
|
} |
//-------------------------------------------------------------- |
// |
void ReadLastPosition(void) |
|
{ |
LastLongitude = eeprom_read_dword(&EE_LastLongitude); |
LastLatitude = eeprom_read_dword(&EE_LastLatitude); |
} |
|
|
//-------------------------------------------------------------- |
// |
void WriteLastPosition(uint32_t ELongitude,uint32_t ELatitude) |
|
{ |
|
eeprom_write_dword(&EE_LastLongitude,ELongitude); |
eeprom_write_dword(&EE_LastLatitude,ELatitude); |
} |
|
|
//-------------------------------------------------------------- |
// |
void ReadParameter (void) |
{ |
if (eeprom_read_byte(&EE_PKTVersion) == EEpromVersion) |
|
{ |
MK_LowBat = eeprom_read_byte (&EE_LowBat); |
DisplayTimeout = eeprom_read_byte (&EE_DisplayTimeout); |
DisplayLanguage = eeprom_read_byte (&EE_DisplayLanguage); |
WiTXRXChannel = eeprom_read_byte (&EE_WiTXRXChannel); |
WiNetworkGroup = eeprom_read_byte (&EE_WiNetworkGroup); |
WiNetworkMode = eeprom_read_byte (&EE_WiNetworkMode); |
WiTXTO = eeprom_read_byte (&EE_WiTXTO); |
WiUartMTU = eeprom_read_byte (&EE_WiUartMTU); |
LCD_ORIENTATION = eeprom_read_byte (&EE_LCD_Orientation); |
LCD_DisplayMode = eeprom_read_byte (&EE_LCD_DisplayMode); |
LCD_Kontrast = eeprom_read_byte (&EE_LCD_Kontrast); |
LCD_Helligkeit = eeprom_read_byte (&EE_LCD_Helligkeit); |
USBBT = eeprom_read_byte (&EE_USBBT); |
U02SV2 = eeprom_read_byte (&EE_U02SV2); |
Debug = eeprom_read_byte (&EE_Debug); |
UseWi = eeprom_read_byte (&EE_UseWi); |
UseBT = eeprom_read_byte (&EE_UseBT); |
WiIsSet = eeprom_read_byte (&EE_WiIsSet); |
BTIsSet = eeprom_read_byte (&EE_BTIsSet); |
BTIsSlave = eeprom_read_byte (&EE_BTIsSlave); |
PKT_IdleBeep = eeprom_read_byte (&EE_PKT_IdleBeep); |
PKT_StartInfo = eeprom_read_byte (&EE_PKT_StartInfo); |
Lipo_UOffset = eeprom_read_word (&EE_Lipo_UOffset); |
PKT_Accutyp = eeprom_read_byte (&EE_PKT_Accutyp); |
OSD_RCErrorbeep = eeprom_read_byte (&EE_OSD_RCErrorbeep); |
OSD_InvertOut = eeprom_read_byte (&EE_OSD_InvertOut); |
OSD_LEDform = eeprom_read_byte (&EE_OSD_LEDform); |
OSD_SendOSD = eeprom_read_byte (&EE_OSD_SendOSD); |
OSD_Fallspeed = eeprom_read_byte (&EE_OSD_Fallspeed); |
OSD_VarioBeep = eeprom_read_byte (&EE_OSD_VarioBeep); |
OSD_HomeMKView = eeprom_read_byte (&EE_OSD_HomeMKView); |
OSD_mAh_Warning = eeprom_read_word (&EE_OSD_mAh_Warning); |
OSD_ScreenMode = eeprom_read_byte (&EE_OSD_ScreenMode); |
OSD_LipoBar = eeprom_read_byte (&EE_OSD_LipoBar); |
PKT_Baudrate = eeprom_read_byte (&EE_PKT_Baudrate); |
FM_Refresh = eeprom_read_word (&EE_FM_Refresh); |
FM_Speed = eeprom_read_word (&EE_FM_Speed); |
FM_Radius = eeprom_read_word (&EE_FM_Radius); |
|
New_Baudrate = PKT_Baudrate; // Merkzellen setzen |
Old_Baudrate = PKT_Baudrate; |
eeprom_read_block ((void*)&bt_pin, (const void*)&EE_BTPin, bt_pin_length); |
eeprom_read_block ((void*)&bt_name, (const void*)&EE_BTName, bt_name_length); |
eeprom_read_block ((void*)&gps_UsedDevName, (const void*)&EE_gps_UsedDevName, 20); |
eeprom_read_block ((void*)&gps_UsedMac, (const void*)&EE_gps_UsedMac, 14); |
gps_UseGPS = eeprom_read_byte (&EE_gps_UseGPS); |
gps_UsedGPSMouse = eeprom_read_byte (&EE_gps_UsedGPSMouse); |
LastLongitude = eeprom_read_dword (&EE_LastLongitude); |
LastLatitude = eeprom_read_dword (&EE_LastLatitude); |
} |
|
else |
Delete_EEPROM(); |
|
} |
|
//-------------------------------------------------------------- |
void Delete_EEPROM(void) |
{ |
// EEPROM auf Default setzen |
|
lcd_cls(); |
lcd_printp_at (0, 0, PSTR(" EEPROM Parameter "), 2); |
lcd_printp_at (0, 1, PSTR("werden auf"), 0); |
lcd_printp_at (0, 2, PSTR("Standardwerte gesetzt"), 0); |
|
MK_LowBat = 137; // 13,7V |
DisplayTimeout = 0; // Display immer an |
DisplayLanguage = 1; // default englisch |
WiTXRXChannel = 1; // Kanal 1 MK Standard |
WiNetworkGroup = 66; // Gruppe 66 MK Standard |
WiNetworkMode = NetMode_Normal; // MK Standard |
WiTXTO = TWaitTime16; // MK Standard |
WiUartMTU = UartMTU64; // MK Standard |
LCD_ORIENTATION = 0; // normale Ansicht |
LCD_DisplayMode = 0; // Normal |
LCD_Kontrast = 20; // Kontrast normal |
LCD_Helligkeit = 100; // Helligkeit in % |
USBBT = 0; // USB Betrieb |
U02SV2 = 0; // SV2 (Kabel) Standard |
Debug = 0; // kein Debug |
UseWi = true; // Wi.232 eingebaut? |
UseBT = true; // BT-222 eingebaut? |
WiIsSet = false; // Flag für die Initialisierung Wi232 |
BTIsSet = false; // Flag für die Initialisierung Bluetooth |
BTIsSlave = true; // Slave Flag setzen |
PKT_IdleBeep = 0; // kein Piepsen bei Inaktivität |
PKT_StartInfo = true; // Startnformationen anzeigen |
PKT_Accutyp = true; // True = Lipo, False= LiON |
OSD_RCErrorbeep = true; // OSD Receiveerrorbeep |
OSD_InvertOut = false; // LED Anzeige invertiren |
OSD_LEDform = 1; // Form der Anzeige ( + oder schwarz) |
OSD_SendOSD = false; // OSD Daten an SV2 |
OSD_Fallspeed = 40; // maximale Sinkrate |
OSD_VarioBeep = 1; // Vario Beep ein |
OSD_HomeMKView = true; // Home Circle from MK View |
OSD_mAh_Warning = 10000; //mAh Warnschwelle |
OSD_ScreenMode = 0; // Variante des OSD Screen |
OSD_LipoBar = 0; //Bargraphanzeige für MK Lipo |
PKT_Baudrate = Wi232_57600; //Baudrate für BT und Wi232 |
Lipo_UOffset = 6000; // Offset für PKT-Lipomessung |
FM_Refresh = 500; // FollowMe interval |
FM_Speed = 30; // FollowMe Speed in m/s *0.1 |
FM_Radius = 5; // Waypoint Tolerance Radius in meter |
|
|
LastLongitude = 88199720; |
LastLatitude = 522039630; |
eeprom_write_dword(&EE_LastLongitude,LastLongitude); |
eeprom_write_dword(&EE_LastLatitude,LastLatitude); |
|
strcpy_P(bt_pin, PSTR("0000")); |
eeprom_write_block ((const void*)&bt_pin, (void*)&EE_BTPin, bt_pin_length); |
|
strcpy_P(bt_name, PSTR("PKT Cebra ")); // Wenn Name kürzer als "bt_name_length" mit Leerzeichen auffüllen |
eeprom_write_block ((const void*)&bt_name, (void*)&EE_BTName, bt_name_length); |
|
for(uint8_t i = 0; i < 20; i++) |
{ |
gps_UsedDevName[i] = 0; // benutztes GPS Device Name |
} |
for(uint8_t i = 0; i < 14; i++) |
{ |
gps_UsedMac[i] = '0'; // benutztes GPS Device Mac Adresse |
} |
gps_UseGPS = false; // ist GPS aktiv? |
gps_UsedGPSMouse = 0; |
|
eeprom_write_byte(&EE_WiIsSet,WiIsSet); |
eeprom_write_byte(&EE_BTIsSet,BTIsSet); |
eeprom_write_byte(&EE_PKTVersion,EEpromVersion); |
|
WriteParameter(); |
|
// lcd_printp_at (0, 4, PSTR("Waypoints loeschen"), 0); |
// EEWayPointList_Clear(); |
|
lcd_printp_at (0, 6, PSTR("!!Check Parameter!! "), 0); |
lcd_printp_at (18, 7, PSTR("OK"), 0); |
set_beep ( 200, 0x0080, BeepNormal); |
do{} |
while (!(get_key_short (1 << KEY_ENTER))); |
// _delay_ms(500); |
//#if defined HWVERSION3_9 |
// clr_V_On(); |
//#else |
// |
// wdt_enable( WDTO_250MS ); |
// while (1) |
// {;} |
//#endif |
} |
|
|
//-------------------------------------------------------------- |
// |
void WriteParameter (void) |
{ |
eeprom_write_byte (&EE_LowBat, MK_LowBat); |
eeprom_write_byte (&EE_DisplayTimeout, DisplayTimeout); |
eeprom_write_byte (&EE_DisplayLanguage, DisplayLanguage); |
eeprom_write_byte (&EE_WiTXRXChannel, WiTXRXChannel); |
eeprom_write_byte (&EE_WiNetworkGroup, WiNetworkGroup); |
eeprom_write_byte (&EE_WiNetworkMode, WiNetworkMode); |
eeprom_write_byte (&EE_WiTXTO, WiTXTO); |
eeprom_write_byte (&EE_WiUartMTU, WiUartMTU); |
eeprom_write_byte (&EE_LCD_Orientation, LCD_ORIENTATION); |
eeprom_write_byte (&EE_LCD_DisplayMode, LCD_DisplayMode); |
eeprom_write_byte (&EE_LCD_Kontrast, LCD_Kontrast); |
eeprom_write_byte (&EE_LCD_Helligkeit, LCD_Helligkeit); |
eeprom_write_byte (&EE_USBBT, USBBT); |
eeprom_write_byte (&EE_U02SV2, U02SV2); |
eeprom_write_byte (&EE_Debug, Debug); |
eeprom_write_byte (&EE_UseWi, UseWi); |
eeprom_write_byte (&EE_UseBT, UseBT); |
eeprom_write_byte (&EE_WiIsSet, WiIsSet); |
eeprom_write_byte (&EE_BTIsSet, BTIsSet); |
eeprom_write_byte (&EE_BTIsSlave, BTIsSlave); |
eeprom_write_byte (&EE_PKT_IdleBeep, PKT_IdleBeep); |
eeprom_write_byte (&EE_PKT_StartInfo, PKT_StartInfo); |
eeprom_write_word (&EE_Lipo_UOffset,Lipo_UOffset); |
eeprom_write_byte (&EE_PKT_Accutyp, PKT_Accutyp); |
eeprom_write_byte (&EE_OSD_RCErrorbeep, OSD_RCErrorbeep); |
eeprom_write_byte (&EE_OSD_InvertOut, OSD_InvertOut); |
eeprom_write_byte (&EE_OSD_LEDform, OSD_LEDform); |
eeprom_write_byte (&EE_OSD_SendOSD, OSD_SendOSD); |
eeprom_write_byte (&EE_OSD_Fallspeed, OSD_Fallspeed); |
eeprom_write_byte (&EE_OSD_VarioBeep, OSD_VarioBeep); |
eeprom_write_byte (&EE_OSD_HomeMKView, OSD_HomeMKView); |
eeprom_write_word (&EE_OSD_mAh_Warning, OSD_mAh_Warning); |
eeprom_write_byte (&EE_OSD_ScreenMode, OSD_ScreenMode); |
eeprom_write_byte (&EE_OSD_LipoBar, OSD_LipoBar); |
eeprom_write_byte (&EE_PKT_Baudrate, PKT_Baudrate); |
eeprom_write_word (&EE_FM_Refresh,FM_Refresh); |
eeprom_write_word (&EE_FM_Speed,FM_Speed); |
eeprom_write_word (&EE_FM_Radius,FM_Radius); |
|
eeprom_write_block ((const void*)&bt_pin, (void*)&EE_BTPin, bt_pin_length); |
eeprom_write_block ((const void*)&bt_name, (void*)&EE_BTName, bt_name_length); |
|
eeprom_write_block ((const void*)&gps_UsedDevName, (void*)&EE_gps_UsedDevName, 20); |
eeprom_write_block ((const void*)&gps_UsedMac, (void*)&EE_gps_UsedMac, 14); |
eeprom_write_byte (&EE_gps_UseGPS,gps_UseGPS); |
eeprom_write_byte (&EE_gps_UsedGPSMouse,gps_UsedGPSMouse); |
|
} |
|
|
|
|
//-------------------------------------------------------------- |
// |
void EEWayPointList_Clear(void) // löschen der Waypointliste im EEProm |
{ |
uint8_t i; |
PKTWayPoint.Waypoint.Position.Latitude = 0; |
PKTWayPoint.Waypoint.Position.Longitude = 0; |
PKTWayPoint.Waypoint.Position.Altitude = 0; |
PKTWayPoint.Waypoint.Heading = 361; |
|
for(i = 0; i < MAX_WPLIST_LEN; i++) |
{ |
PKTWayPointDirectory.WPList.WPDirectory[i] = 0; |
} |
|
for(i = 0; i < NumberOfWaypoints; i++) |
{ |
lcd_printp (PSTR("."), 0); |
eeprom_write_byte (&EEWayPointList[i].WPIndex, i); |
eeprom_write_byte (&EEWayPointList[i].Waypoint.Position.Status, INVALID); |
eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Position.Latitude, (void*)&EEWayPointList[i].Waypoint.Position.Latitude, sizeof(EEWayPointList[i].Waypoint.Position.Latitude)); |
eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Position.Longitude, (void*)&EEWayPointList[i].Waypoint.Position.Longitude, sizeof(EEWayPointList[i].Waypoint.Position.Longitude)); |
eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Position.Altitude, (void*)&EEWayPointList[i].Waypoint.Position.Altitude, sizeof(EEWayPointList[i].Waypoint.Position.Altitude)); |
eeprom_write_block ((const void*)&PKTWayPoint.Waypoint.Heading, (void*)&EEWayPointList[i].Waypoint.Heading, sizeof(EEWayPointList[i].Waypoint.Heading)); |
|
eeprom_write_byte (&EEWayPointList[i].Waypoint.ToleranceRadius, 0); // in meters, if the MK is within that range around the target, then the next target is triggered |
eeprom_write_byte (&EEWayPointList[i].Waypoint.HoldTime, 0); // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
eeprom_write_byte (&EEWayPointList[i].Waypoint.Type, POINT_TYPE_INVALID); |
eeprom_write_byte (&EEWayPointList[i].Waypoint.Event_Flag, 0); // future implementation |
eeprom_write_byte (&EEWayPointList[i].Waypoint.AltitudeRate, 0); // no change of setpoint |
} |
|
for(i = 0; i < NumberOfWPLists; i++) |
{ |
lcd_printp (PSTR("."), 0); |
eeprom_write_byte (&EEWPDirectory[i].WPList.WPListnumber, i); |
eeprom_write_byte (&EEWPDirectory[i].WPList.WPListAktiv, false); |
eeprom_write_byte (&EEWPDirectory[i].WPList.POI_CAM_NICK_CTR, 0); |
eeprom_write_byte (&EEWPDirectory[i].WPList.UsePOI, 0); |
eeprom_write_block ((const void*)&PKTWayPointDirectory.WPList.WPDirectory, (void*)&EEWPDirectory[i].WPList.WPDirectory, sizeof(EEWPDirectory[i].WPList.WPDirectory)); |
|
} |
lcd_printp (PSTR("\r\n"), 0); |
|
} |