Subversion Repositories Projects

Rev

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