Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1940 - 1
/*****************************************************************************
2
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
3
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
4
 *   Copyright (C) 2013 Christian "Cebra" Brandtner, brandtner@brandtner.net *
5
 *   Copyright (C) 2011 Harald Bongartz                                      *
6
 *                                                                           *
7
 *   This program is free software; you can redistribute it and/or modify    *
8
 *   it under the terms of the GNU General Public License as published by    *
9
 *   the Free Software Foundation; either version 2 of the License.          *
10
 *                                                                           *
11
 *   This program is distributed in the hope that it will be useful,         *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
14
 *   GNU General Public License for more details.                            *
15
 *                                                                           *
16
 *   You should have received a copy of the GNU General Public License       *
17
 *   along with this program; if not, write to the                           *
18
 *   Free Software Foundation, Inc.,                                         *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.               *
20
 *                                                                           *
21
 *                                                                           *
22
 *   Credits to:                                                             *
23
 *   Holger Buss & Ingo Busker from mikrokopter.de for the MK project + SVN  *
24
 *                          http://www.mikrokopter.de                        *
25
 *   Gregor "killagreg" Stobrawa for his version of the MK code              *
26
 *   Thomas Kaiser "thkais" for the original project. See                    *
27
 *                          http://www.ft-fanpage.de/mikrokopter/            *
28
 *                          http://forum.mikrokopter.de/topic-4061-1.html    *
29
 *   Claas Anders "CaScAdE" Rathje for providing the font and his C-OSD code *
30
 *                          http://www.mylifesucks.de/oss/c-osd/             *
31
 *   Harald Bongartz "HaraldB" for providing his Ideas and Code for usibility*
32
 *****************************************************************************/
33
 
34
 
35
#ifndef _EEPROM_H
36
#define _EEPROM_H
37
 
38
#include <stdbool.h>
39
#include "../mk-data-structs.h"
40
#include "../connect.h"
41
#include "../tracking/ng_servo.h"
42
#include "../waypoints/waypoints.h"
43
 
44
 
45
 
46
 
47
//[General]
48
//FileVersion = 2
49
//NumberOfWaypoints = 15
50
//UsePOI = 0
51
//POI_CAM_NICK_CTRL = 0
52
 
53
//[POI]
54
//Altitude = 1
55
//Latitude = 46.7140763
56
//Longitude = 19.2507334
57
 
58
//[Waypoint1]
59
//Latitude = 46.7145686
60
//Longitude = 19.2515702
61
//Radius = 10
62
//Altitude = 15
63
//ClimbRate = 0
64
//DelayTime = 4
65
//WP_Event_Channel_Value = 96
66
//Heading = 180
67
 
68
 
69
#define EEpromVersion           0x78  //wird nach jeder Parametererweiterung hochgezählt
70
 
71
#define NumberOfWaypoints       55      //Anzahl der Waypoints in der EEPromliste
72
#define NumberOfWPLists         5       //Anzahl WP Listen im PKT
73
#define MAX_LIST_LEN            31      // Länge Waypointlist
74
 
75
#define bt_pin_length           4
76
#define RE_ID_length            4       // Länge der RE-ID
77
#define bt_name_length          10
78
#define bt_mac_length           14
79
#define GPS_Bluetoothmouse1     0       //NMEA BT-Mouse
80
#define GPS_Mikrokopter         1      // GPS Daten vom MK für Tracking
81
 
82
 
83
#define POINT_TYPE_INVALID      255
84
#define POINT_TYPE_WP           0
85
#define POINT_TYPE_POI          1
86
#define INVALID                 0x00
87
#define MAX_WPLIST_LEN          31
88
 
89
 
90
 
91
 
92
typedef struct {
93
        uint8_t rev;
94
        uint16_t min;
95
        uint16_t max;
96
        uint16_t mid;
97
} servo_t;
98
 
99
 
100
typedef struct
101
{
102
        uint8_t WPIndex;        // Index in der EEpromliste
103
        Point_t Waypoint;       // Waypoint
104
} WayPoints;
105
 
106
typedef struct
107
{
108
        uint8_t WPListnumber;           // Nummer der WP Liste im PKT
109
        uint8_t WPListAktiv;            // Liste aktiv
110
        uint8_t WPDirectory[31];        // Enthält die Indexe der Waypoints im EEPROM
111
        uint8_t UsePOI;
112
        uint8_t POI_CAM_NICK_CTR;
113
 
114
} WPListHeader;
115
 
116
typedef struct
117
{
118
        WPListHeader    WPList;         // Waypointliste im PKT
119
} WPListDirectory;
120
 
121
 
122
 
123
 
124
typedef struct SStructure{
125
         uint8_t Version;
126
         uint8_t MK_LowBat;
127
volatile uint8_t DisplayTimeout;
128
volatile uint8_t DisplayLanguage;
129
volatile uint8_t WiTXRXChannel;
130
volatile uint8_t WiNetworkGroup;
131
volatile uint8_t WiNetworkMode;
132
volatile uint8_t WiTXTO;
133
volatile uint8_t WiUartMTU;
134
volatile uint8_t LCD_ORIENTATION;
135
volatile uint8_t LCD_DisplayMode;
136
volatile uint8_t LCD_Kontrast;
137
volatile uint8_t LCD_Helligkeit;
138
volatile uint8_t USBBT;
139
volatile uint8_t U02SV2;
140
volatile uint8_t Debug;
141
volatile uint8_t UseWi;                                                 // Wi232 wird genutzt
142
volatile uint8_t UseBT;                                                 // BT wird genutzt
143
 
144
volatile uint8_t WiIsSet;                                               // Wi232 ist initialisiert
145
volatile uint8_t BTIsSet;                                               // BT ist initialisiert
146
volatile uint8_t BTIsSlave;                                    // Slave Flag
147
char bt_pin[bt_pin_length + 1];                                 // BT Pinnummer
148
char bt_name[bt_name_length + 1];                               // BT Name
149
char RE_ID[RE_ID_length + 1];                                 // RE-ID
150
char bt_Mac[bt_mac_length + 1];                                 // MAC-Adresse BTM222
151
 
152
char gps_UsedDevName[20];                                         // benutztes GPS Device Name
153
char gps_UsedMac[14];                                             // benutztes GPS Device Mac Adresse
154
volatile uint8_t gps_UseGPS;                                        // ist GPS aktiv?
155
volatile uint8_t gps_UsedGPSMouse;                                  // GPS Maustyp
156
 
157
volatile uint32_t LastLongitude;                                // Letzte Position
158
volatile uint32_t LastLatitude;
159
volatile uint8_t PKT_IdleBeep;
160
volatile uint8_t PKT_StartInfo;
161
volatile uint16_t Lipo_UOffset;                                 // Offset für die Lipospannugsmessung
162
volatile uint8_t PKT_Accutyp;                                   // verwendeter Akkutyp
163
volatile uint8_t OSD_RCErrorbeep;                               //Empfangsausffallwarnung im OSD Screen
164
volatile uint8_t OSD_InvertOut;                                 // Out1/2 invertiert anzeigen
165
volatile uint8_t OSD_LEDform;                                   // Form der Anzeige ( + oder schwarz)
166
volatile uint8_t OSD_SendOSD;                                   // OSD Daten an SV2 senden
167
volatile uint8_t OSD_Fallspeed;                                 // maximale Sinkrate
168
volatile uint8_t OSD_VarioBeep;                                 // Vario Beep im OSD Screen
169
volatile uint8_t OSD_HomeMKView;                                // Home Circle from MK-View
170
volatile uint16_t OSD_mAh_Warning;                              // mAh Warnschwelle
171
volatile uint8_t OSD_ScreenMode;                                //Variante des OSD-Screen
172
volatile uint8_t OSD_LipoBar;                                   //Bargraphanzeige für MK Lipo
173
volatile uint8_t PKT_Baudrate;                                  // Baudrate für BT und Wi232
174
volatile uint16_t FM_Refresh;                                   // FollowMe interval
175
volatile uint16_t FM_Speed;                                     // FollowMe Speed in m/s *0.1
176
volatile uint16_t FM_Radius;                                    // Waypoint Tolerance Radius in meter
177
volatile uint8_t HWSound;                                       // Hardware Sounderweiterung an PD7
178
volatile uint8_t HWBeeper;                                       // Hardware Beeper an PC7
179
volatile uint8_t Volume;                                        // Lautstärke
180
volatile servo_t  servo[2];
181
volatile uint8_t   sIdxSteps;
182
volatile uint16_t  hyst_u_min;
183
volatile uint8_t   servo_frame;
184
 
185
volatile uint8_t   single_step;
186
volatile uint8_t   repeat;
187
volatile uint8_t   pause;
188
volatile uint8_t   pause_step;
189
volatile uint8_t   tracking;
190
volatile uint8_t   track_hyst;
191
volatile uint8_t   track_tx;
192
// Stickparameter
193
volatile uint16_t stick_min[5];
194
volatile uint16_t stick_max[5];
195
volatile uint8_t  stick_typ[5];
196
volatile uint8_t  stick_dir[5];
197
volatile uint8_t  stick_neutral[5];     // ja/nein
198
volatile uint8_t  Lipomessung;          // wenn Lipomessung deaktiviert(Lötbrücke öffnen), kann der Kanal als Stick verwendet werden
199
Point_t PointList[MAX_LIST_LEN];        // ab 3.6.6b EEPROM Version 78
200
 
201
 
202
//!!!neue Parameter immer am Ende anfügen!!!!!!
203
}  ST;
204
 
205
extern ST Config;
206
 
207
void ReadParameter (void);
208
void WriteParameter (void);
209
void ReadLastPosition(void);
210
void WriteLastPosition(uint32_t ELongitude,uint32_t ELatitude);
211
void WriteWiInitFlag(void);
212
void WriteBTInitFlag(void);
213
void WriteBTSlaveFlag(void);
214
void WriteBTMasterFlag(void);
215
void Delete_EEPROM(void);
216
//void EEWayPointList_Clear(void);      // l�schen der Waypointliste im EEProm
217
 
218
#endif