Subversion Repositories Projects

Rev

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