Subversion Repositories Projects

Rev

Rev 2194 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2136 - 1
/*****************************************************************************
2
 *   Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de                  *
3
 *   Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net                  *
4
 *   Copyright (C) 2012 Christian "Cebra" Brandtner, brandtner@brandtner.net *
5
 *   Copyright (C) 2012 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
//# HISTORY  main.h
36
//#
2198 - 37
//# 19.09.2015 Cebra
38
//# - add: Ordner 10DOF hinzugefügt für die Bearbeitung des GY-87 Sensorboard
39
//#        Kompass, Gyro, ACC, Luftdruck
40
//#
2136 - 41
//# 03.08.2015 Cebra
42
//# - add: Define für GPS Debug hinzugefügt für GPS Berechnung FollowMe
43
//# - add: #define USE_WAYPOINTS , Code sparen
44
//#
45
//# 30.07.2015 Cebra
46
//# - chg: neue Version 3.85e wegen einigen Änderungen in GPS-Maus Bereich, CRC Erkennung und Weitergabe
47
//#
48
//#
49
//# 30.07.2015 Cebra
50
//# - chg: neue Version 3.85d wegen Änderungen in gpsmouse.c
51
//#
52
//#
53
//# 16.07.2015 Cebra
54
//# - chg: neue Version 3.85a wegen FC2.11a
55
//#
56
//# 09.04.2015 Cebra
57
//# - chg: neue Version 3.84a wegen FC2.09j
58
//#
59
//# 05.04.2015 Cebra (PKT383b)
60
//# - chg: Änderungen wegen Fehlfunktion mit NC 2.09h
61
//#        SendOutData( 'h', ADDRESS_ANY, 2, &mkdisplayCmd, 1, 0x00,1)
62
//#        ergänzt um 2. Parameter
63
//#
64
//# 19.03.2015 Cebra (PKT383a)
65
//# - chg: Anpassung an FC209d
66
//#
67
//# 27.01.2015 Cebra (PKT382a)
68
//# - chg: Anpassung an FC209a
69
//#
70
//# 26.09.2014 Cebra (PKT381b)
71
//#
72
//#
73
//# 26.09.2014 Cebra (PKT381a)
74
//#
75
//# 01.07.2014 OG (PKT380e)
76
//#
77
//# 28.06.2014 OG (PKT380dX4)
78
//#
79
//# 27.06.2014 OG (PKT380dX3)
80
//# - chg: USE_FOLLOWME eingeschaltet
81
//# - chg: USE_TRACKING abgeschaltet
82
//#
83
//# 22.06.2014 OG (PKT380dX3)
84
//#
85
//# 20.06.2014 OG (PKT380dX2)
86
//#
87
//# 18.06.2014 OG (PKT380dX1)
88
//#
89
//# 18.06.2014 OG (PKT380d)
90
//#
91
//# 05.06.2014 OG (PKT380cX5)
92
//#
93
//# 02.06.2014 OG (PKT380cX4)
94
//# Update auf Windows Atmel AVR Studio 6.2.1153 (Release)
95
//# (von ehemals Atmel AVR Studio 6.2 Beta)
96
//#
97
//# 27.05.2014 OG (PKT380cX3)
98
//#
99
//# 20.05.2014 OG (PKT380cX2)
100
//#
101
//# 19.05.2014 OG (PKT380cX1)
102
//# - add: USE_OSD_SCREEN_WAYPOINTS (keine Freigabe! In Entwicklung!)
103
//#
104
//# 18.05.2014 OG (PKT380cX1)
105
//#
106
//# 15.05.2014 OG (PKT380c)
107
//#
108
//# 15.05.2014 OG (PKT380bX7)
109
//# - chg: USE_OSD_SCREEN_3DLAGE eingeschaltet (war ungewollt abgeschaltet)
110
//#
111
//# 14.05.2014 OG (PKT380bX7)
112
//#
113
//# 13.05.2014 OG (PKT380bX6)
114
//# - add: USE_MAINMENU_SEPARATOR (aus menu.h hierhin verschoben)
115
//# - del: MKINFO_AUTO_REFRESH
116
//#
117
//# 12.05.2014 OG (PKT380bX5b)
118
//# - chg: keine Code-Changes - dafuer Compiler jetzt Atmel Studio 6.2 Beta
119
//#        (statt bisher Atmel Studio 5.1)
120
//#
121
//# 07.05.2014 OG (PKT380bX4)
122
//#
123
//# 07.05.2014 OG (PKT380bX3)
124
//# - fix: EEpromversion erhoeht auf 138 (siehe eeprom.c)
125
//#
126
//# 02.05.2014 OG (PKT380bX2)
127
//#
128
//# 28.04.2014 OG
129
//# - chg: USE_OSD_SCREEN_OLD abgeschaltet
130
//#
131
//# 20.04.2014 OG (PKT380bX1)
132
//#
133
//# 18.04.2014 OG (PKT380b)
134
//#
135
//# 17.04.2014 OG (PKT380aX1)
136
//# - chg: PKT Versionsanzeige geaendert auf "3.80a" statt wie frueher "3.8.0a"
137
//#
138
//# 16.04.2014 OG (PKT380a)
139
//#
140
//# 14.04.2014 OG (PKT374aX8)
141
//#
142
//# 02.04.2014 OG
143
//# - chg: define fuer Baud_2400 von 0 auf 7 geaendert
144
//#        (0/false wird benoetigt um zu erkennen ob keine Baud-Rate erkannt wurde)
145
//#
146
//# 01.04.2014 OG
147
//# - add: USE_SV2MODULE_BLE (Bluetooth 4 Low Energy Modul an SV2)
148
//#
149
//# 31.03.2014 OG (PKT374aX7)
150
//#
151
//# 30.03.2014 OG (PKT374aX6)
152
//# Sprachunterstuetzung fuer Hollaendisch vollstaendig entfernt
153
//#
154
//# 30.03.2014 OG (PKT374aX5)
155
//# Source-Schnipp PKT374aX5
156
//#
157
//# 01.03.2014 OG (PKT374aX5)
158
//#
159
//# 26.02.2014 OG (PKT374aX4)
160
//# - chg: DEBUG_NEW_PARAMETERS umbenannt zu DEBUG_PARAMSET
161
//#
162
//# 22.02.2014 OG (PKT374aX4)
163
//#
164
//# 17.02.2014 OG (PKT374aX3)
165
//# - chg: umbenannt: USE_MKPARAMETER -> USE_MKSETTINGS
166
//#
167
//# 14.02.2014 OG (PKT374aX2)
168
//# - add: MKINFO_AUTO_REFRESH
169
//# - del: veraltete PKT defines HWVERSION... entfernt
170
//#
171
//# 12.02.2014 OG (PKT374aX2)
172
//# - del: defines zu MKVERSIONnnn entfernt
173
//#
174
//# 10.02.2014 OG (PKT374aX1)
175
//# - add: ...
176
//#
177
//# 05.02.2014 OG (PKT374aX1)
178
//# - add: DEBUG_NEW_PARAMETERS - nur fuer Entwicklung!
179
//#
180
//# 30.01.2014 OG (PKT373cX4)
181
//# - add: USE_BLUETOOTH
182
//#
183
//# 29.01.2014 OG (3.7.3cX3)
184
//# - del: extern uint8_t searchMK(void) ist jetzt in mk/mkbase.c
185
//#
186
//# 24.01.2014 OG (3.7.3cX1)
187
//# - add: DEBUG_FC_COMMUNICATION (Auswirkung in usart.c)
188
//#
189
//# 06.01.2014 CB
190
//# - add: Abschaltung MK Parameter aendern bei nicht passender FC Software
191
//#
192
//# 02.12.2013 CB
193
//# - add: Anpassung Parameter an FC 2.01f
194
//#
195
//# 21.10.2013 CB
196
//# - add: Anpassung Parameter an FC 2.01a
197
//#
198
//# 16.07.2013 CB
199
//# - chg: neuen Versionsnummer wegen Wiflypatch
200
//#
201
//# 07.07.2013 OG
202
//# - add: ABO_TIMEOUT und von 3 sec auf 2 sec gesetzt (war vorher in timer.h)
203
//# - del: define USE_OSD_SCREEN_ELECTRIC_N
204
//# - del: USE_PKT_STARTINFO (wird nicht mehr benoetigt)
205
//# - add: DEBUG_SV2_EXTENSION um Debug-Ausgaben fuer den SV2-Patch an-/auszuschalten
206
//#
207
//# 05.07.2013 CB
208
//# - add: USE_WLAN
209
//#
210
//# 30.06.2013 OG
211
//# - add: USE_OSD_PKTHOOK
212
//#
213
//# 26.06.2013 OG
214
//# - del: USE_PKT_STARTINFO (wird nicht mehr benoetigt)
215
//#
216
//# 24.06.2013 OG
217
//# - add: USE_PKTTOOLS_SV2 - zeigt SV2-Verbindungsmenuepunkte in PKT-Tools an
218
//#        bzw. nicht an. Am PKT-SV2 liegen +5 Volt für die FC/NC an.
219
//#        Anmerkung OG: bei meinen Kompilaten wird das erstmal ausgeschaltet
220
//#                      sein bis 100% klar ist ob das keine Probleme macht
221
//#                      wenn der Kopter mit FC/NC nicht bereits anderweitig
222
//#                      (Netzteil/Lipo) mit Strom versorgt wird.
223
//#
224
//# 22.06.2013 Cebra
225
//# - chg: Fehler bei der Lipooffset Einstellung beseitigt, neue Version 3.7.0c
226
//#
227
//# 20.06.2013 Cebra
228
//# - chg: falsche Versionsnummer korrigiert, neu jetzt 3.7.0b
229
//#
230
//# 13.06.2013 OG
231
//# - del: USE_PCFASTCONNECT (nicht mehr benoetigt)
232
//#
233
//# 12.06.2013 Cebra
234
//# - chg: Versionswechsel auf 3.7.0a, Zielrelease für FC-Software 0.91 (bzw.1.00??)
235
//#
236
//# 10.06.2013 Cebra
237
//# - add: #define MKVERSION091f für FC-Version 0.91f
238
//#
239
//# 30.05.2013 Cebra
240
//# - add: #define MKVERSION091a für FC-Version 0.91a
241
//#
242
//# 19.05.2013 OG
243
//# - del: PKT_Update(), PKT_CheckUpdate(), PKT_Info(), PKT_SwitchOff()
244
//#        -> verschoben nach pkt/pkt.c
245
//# - chg: Kommentare zum Module-Support
246
//#
247
//# 19.05.2013 OG
248
//# - add: USE_MODULEINFO
249
//# - add: PKT_Update(), PKT_CheckUpdate(), PKT_Info(), PKT_SwitchOff()
250
//#
251
//# 18.05.2013 OG
252
//# - add: USE_JOYSTICK, USE_TRACKING, USE_OSDDATA, USE_MKPARAMETER, USE_MKDISPLAY
253
//#
254
//# 16.05.2013 OG
255
//# - add: USE_OSD_SCREEN_NAVIGATION, USE_OSD_SCREEN_ELECTRIC, USE_OSD_SCREEN_ELECTRIC_N,
256
//#        USE_OSD_SCREEN_MKSTATUS, USE_OSD_SCREEN_USERGPS, USE_OSD_SCREEN_3DLAGE,
257
//#        USE_OSD_SCREEN_STATISTIC
258
//# - add: USE_MKGPSINFO
259
//#
260
//# 15.05.2013 OG
261
//# - add: define USE_PKT_STARTINFO
262
//#
263
//# 13.05.2013 Cebra
264
//# - add: #define MKVERSION090h    // wegen GPS-Zeitausgabe NC
265
//#
266
//# 13.05.2013 Cebra
267
//# - add: #define USE_I2CMOTORTEST, I2C Funktionen schaltbar
268
//#
269
//# 05.05.2013 Cebra
270
//# - chg: #define USE_FOLLOWME
271
//#
272
//# 03.05.2013 OG
273
//# - del: USE_XPRINTF_LONG - spart keinen Platz mehr und ist nun dauerhaft notwendig
274
//#
275
//# 28.04.2013 OG
276
//# - add: define USE_PCFASTCONNECT
277
//# - add: define USE_FONT_BIG
278
//# - add: define USE_XPRINTF_LONG
279
//# - chg: Anordnung der Feature- & Debug-defines um einfacher via Copy&Paste
280
//#        die Einstellungen notieren bzw. posten zu koennen
281
//#
282
//# 03.04.2013 OG
283
//# - chg: define 'analognames' zu define 'USE_MKDEBUGDATA'
284
//# - add: USE_OSD_... defines
285
//############################################################################
286
 
287
#ifndef _MAIN_H
288
#define _MAIN_H
289
 
290
// Softwareversion des PKT
2150 - 291
#define PKTSWVersion "3.85f"        // PKT Version
2136 - 292
 
293
 
294
//#########################################################################
295
//# Einstellungen
296
//#########################################################################
297
#define USE_MAINMENU_SEPARATOR      // Menuetrennlinien im PKT-Hauptmenues anzeigen
298
 
299
 
300
//#########################################################################
301
//# MODULE SUPPORT
302
//# ein-/ausgeschalten von Modulen des PKT um ggf. Speicherplatz zu sparen
303
//#
304
//# Hinweis:
305
//#  wenn neue USE_* hinzugefuegt werden bitte die in PKT_Info()(pkt.c)
306
//#  ergaenzen fuer eine aktualisierte Modul-Info
307
//#########################################################################
308
 
309
//---------------------------------------------
310
//- Module: Hauptfunktionen und allgemeine
311
//---------------------------------------------
312
#define USE_OSDDATA                 // zeigt die OSD-Statistikdaten an (ca. 3.5 KByte)
313
#define USE_MKSETTINGS              // lesen, aktivieren und bearbeiten der MK-Settings 1-5 (ca. ?? KByte)
314
#define USE_MKDEBUGDATA             // Anzeige MK-Debug-Data (ca. 1.7 KByte)
315
#define USE_MKDISPLAY               // Anzeige MK-Display (ca. 1 KByte)
316
#define USE_MKGPSINFO               // Anzeige MK-GPS-Daten (ca. 2 KByte)
317
//#define USE_SOUND                 // PKT Sounderweiterung, benoetigt entsprechende Hardware (ca. 2.5 Kbyte)
318
#define USE_MODULEINFO              // Anzeige installierter Module in PKT_Info()  (ca. 1.8 KByte)
319
#define USE_BLUETOOTH               // Bluetooth Unterstuetzung des PKT (ca. 13 KByte)
320
                                    // Achtung! Das schaltet USE_TRACKING, USE_FOLLOWME aus!
321
//#define USE_WAYPOINTS               // Waypoint mit dem PKT
322
 
323
//Entwicklung:
2198 - 324
//#define USE_ACCCALIBRATION         // schaltet ACC Calibration im Menü ein/aus
325
//#define USE_KOMPASS                // Tilt kompensierter Kompass für FollowMe Funktionen
2136 - 326
//---------------------------------------------
327
//- Module: OSD-Screens
328
//---------------------------------------------
329
//#define USE_OSD_SCREEN_OLD        // OSD Screens OSD0, OSD1, OSD2 (ca. 6.6 KByte)
330
#define USE_OSD_SCREEN_NAVIGATION   // OSD-Screen: Navigation
331
#define USE_OSD_SCREEN_WAYPOINTS    // OSD-Screen: Waypoints
332
#define USE_OSD_SCREEN_ELECTRIC     // OSD-Screen: Electric
333
#define USE_OSD_SCREEN_MKSTATUS     // OSD-Screen: MK-Status
334
#define USE_OSD_SCREEN_USERGPS      // OSD-Screen: UserGPS
335
#define USE_OSD_SCREEN_3DLAGE       // OSD-Screen: 3D-Lage  (ca. 900 Bytes)
336
#define USE_OSD_SCREEN_STATISTIC    // OSD-Screen: Statistic
337
 
338
//---------------------------------------------
339
//- Module fuer spezielle Benutzergruppen
340
//---------------------------------------------
341
#define USE_FOLLOWME                // FollowMe Funktionen (ca. 3 Kbyte)
342
//#define USE_FOLLOWME_STEP2          // FollowMe Funktionen Abstand und Winkel einstellbar
343
//#define USE_JOYSTICK                // Joystick Support, benoetigt spezielle Hardware (ca. 4.1 KByte)
344
#define USE_WLAN                    // WLAN WiFly Modul an SV2 (ca. 6 KByte))
345
#define USE_SV2MODULE_BLE           // Bluetooth 4 Low Energy Modul - externes Modul an SV2 (RedBearLab BLE Mini) (ca. 200 Bytes)
346
 
347
//---------------------------------------------
348
//- Module mit geringer Relevanz
349
//---------------------------------------------
350
//#define USE_I2CMOTORTEST          // I2C Funktionen für Motortest (ca. 3.8 KByte)
351
//#define USE_FONT_BIG              // grosser 8x8 Font (ca. 2.2 KByte, bei Verwendung von USE_OSD_SCREEN_OLD ca. 2.4 KByte)
352
 
353
//---------------------------------------------
354
//- Module unfertig bzw. noch in der Entwicklung
355
//---------------------------------------------
2194 - 356
//#define USE_TRACKING                // Antennentracking, benoetigt spezielle Hardware (ca. 6 KByte)
2136 - 357
 
358
 
359
//---------------------------------------------
360
//- zusaetzliche Optionen
361
//---------------------------------------------
362
//#define USE_OSD_PKTHOOK
363
#define USE_PKTTOOLS_SV2            // im Menue von PKT-Tools erscheinen Punkte zur Verbindung zum MK via
364
                                    // 10-Pol-Kabel am PKT-SV2. Der PKT-SV2-Anschluss liefert zur FC/NC +5 Volt!
365
 
366
 
367
//#########################################################################
368
//# Debug Module & Einstellungen
369
//# Nur fuer die Entwicklung - fuer Veroeffentlichung alles abschalten!
370
//#########################################################################
371
//#define IgnoreFCVersion           // keine FC-Revisions Pruefung
372
//#define DEBUG_SV2_EXTENSION       // ...
373
//#define USE_OSD_DEMO              // zeigt Demo-Daten in den OSD-Screens (sofern vom Screen unterstuetzt) (fuer Fotos) (nicht fuer die Oeffentlichkeit)
374
//#define USE_OSD_SCREEN_DEBUG      // zusaetzliche Debug-Screen's aktivieren (ca. 1 KByte) (nicht fuer die Oeffentlichkeit)
375
//#define DEBUG                     // ?? Funktion unbekannt!
376
//#define DEBUG_FC_COMMUNICATION    // in usart.c Debugausgaben auf dem PKT bzgl. Datenempfang vom Kopter
377
//#define DEBUG_PARAMSET            // nur fuer Entwicklung! Fuer Release ABSCHALTEN!
378
//#define DEBUG_GPS                   // Entwicklung der GPS Berechnung für FollowMe
379
 
380
 
381
//#########################################################################
382
//# Einstellungen
383
//#########################################################################
384
//#define ABO_TIMEOUT       300 // 3 sec
385
#define ABO_TIMEOUT       200   // 2 sec
386
 
387
 
388
 
389
 
390
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
391
//+ ggf. abhaengige USE-defines deaktivieren
392
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
393
#ifndef USE_BLUETOOTH
394
  #undef USE_TRACKING
395
  #undef USE_FOLLOWME
396
#endif
397
 
398
 
399
 
400
// Fusebits fü½r Hardware 1.2 D7 DC FC
401
// Fusebits für Hardware 1.3 D7 DC FC
402
// Fusebits für Hardware 3.x D7 DC FC
403
// avrdude -pm1284p -cavr109 -P/dev/ttyUSB1 -b115200 -V -Uflash:w:Dateiname.hex:a
404
 
405
 
406
// hier die entsprechende Hardwareversion der Leiterplatte einstellen
407
#define HWVERSION3_9   // Hardware Cebra Oktober 2011 ATmega1284P
408
 
409
#ifdef HWVERSION3_9
410
#include "HAL_HW3_9.h"
411
#endif
412
 
413
#define NO     0
414
#define NC     1
415
#define FC     2
416
#define MK3MAG 3
417
#define MKGPS  4
418
#define Wi232  5
419
 
420
// CB #define ENABLE_PWM
421
 
422
 
423
//                      Baud Rate
424
#define Baud_9600       1
425
#define Baud_19200      2
426
#define Baud_38400      3
427
#define Baud_57600      4
428
#define Baud_115200     5
429
#define Baud_4800       6
430
#define Baud_2400       7
431
 
432
 
433
//----------------------------------------------------------------------------
434
// Anmerkung: 29.01.2014 OG
435
// - muss spaeter an geeignete Stelle verschoben werden (ggf. mkbase.c/usart.c)
436
//----------------------------------------------------------------------------
437
extern volatile uint8_t mode;
438
extern uint8_t hardware;
439
extern uint8_t current_hardware;
440
 
441
#endif