Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1913 → Rev 1914

/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/HAL_HW3_9.c
0,0 → 1,353
/*****************************************************************************
* 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*
*****************************************************************************/
 
 
#ifndef HAL_HW3_9_C_
#define HAL_HW3_9_C_
 
#include "cpu.h"
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#include <stdbool.h>
#include <stdlib.h>
 
#include "main.h"
 
#if defined HWVERSION3_9
#include "eeprom/eeprom.h"
#include "messages.h"
#include "lcd/lcd.h"
#include "uart/usart.h"
#include "uart/uart1.h"
#include "display.h"
#include "timer/timer.h"
 
#include "wi232/Wi232.h"
#include "motortest/twimaster.h"
#include "bluetooth/bluetooth.h"
#include "bluetooth/error.h"
#include "connect.h"
#include "lipo/lipo.h"
#include "setup/setup.h"
#include "osd/osd.h"
#include "sound/pwmsine8bit.h"
#include "tracking/ng_servo.h"
 
 
 
volatile uint8_t USBBT;
volatile uint8_t U02SV2;
volatile uint8_t PCB_Version;
 
uint8_t PortA;
uint8_t PortB;
uint8_t PortC;
uint8_t PortD;
 
void CheckPCB(void)
{
 
 
DDRA = 0xFF;
DDRB = 0x00;
DDRC = 0x00;
DDRD = 0x00;
PortA = PINA;
PortB = PINB;
PortC = PINC;
PortD = PIND;
 
if (PINC & (1<<PINC7) ) PCB_Version = PKT39m; else PCB_Version = PKT39x;
 
}
 
 
//--------------------------------------------------------------
void InitHWPorts(void) // Initialisierung der Hardware fÃŒr die jeweilige Leiterplattenversion
 
{
CheckPCB(); // Version der Leiterplatte prüfen
PORTA |= (1<<PORTA4)|(1<<PORTA5)|(1<<PORTA6)|(1<<PORTA7); // Enable Pull Up for the 4 keys
DDRA &= ~(1<<DDA4); // Eingang: A4 auf Low setzen (Power On)
//DDRA &= ~(1<<DDA1); // Eingang: PKT Lipo Messung // MartinR so war es
if (Config.Lipomessung == true)
{
DDRA &= ~(1<<DDA1); // Eingang: PKT Lipo Messung
PORTA &= ~(1<<PORTA1);
}
 
DDRB = 0xFF; // Alles AusgÀnge
 
PORTC |= (1<<PORTC4)|(1<<PORTC7); // Enable Pull Up for LBO + Summer
DDRC |= (1<<DDC2)|(1<<DDC3)|(1<<DDC5)|(1<<DDC6|(1<<DDC7)); // Ausgang: Led2,Rs232Switch,Summer
DDRC &= ~(1<<DDC4); // Eingang: LowBat LTC1308
_BTOn(); // Erstmal USB dektivieren, damit beim versehentlichen Einschalten USB im PC ruhig bleibt
 
PORTD |= (1<<PORTD6); // Wi232-CMD auf High schalten
DDRD |= (1<<DDD4)|(1<<DDD5)|(1<<DDD6)|(1<<DDD7); // Ausgang: PiepserTest, Servo, Wi232-CMD und Beleuchtung
set_V_On(); // Spannung mit T3 halten
Timer0_Init (); // system
 
Display_on = 1;
USART_Init (UART_BAUD_SELECT(USART_BAUD,F_CPU));
uart1_init (UART_BAUD_SELECT(USART_BAUD,F_CPU)); // USB
I2C_Init(1);
 
LCD_Init (0); // muss vor "ReadParameter" stehen
ReadParameter (); // Aktuelle Werte aus EEProm auslesen
servoInit(SERVO_PERIODE);
// servoSetDefaultPos();
sei ();
 
 
 
 
 
Old_Baudrate = Config.PKT_Baudrate;
SetBaudUart1(Config.PKT_Baudrate);
SetBaudUart0(Config.PKT_Baudrate);
if (Config.DisplayLanguage > NUM_LANG) // Beim ersten Start Sprache abfragen
{ Config.DisplayLanguage = 1;
Config.DisplayLanguage = Edit_generic(Config.DisplayLanguage,0,3,DISPLAY3,Language);
// WriteParameter();
}
 
if ((Config.HWSound==0)&&(PCB_Version == PKT39m))
{
Timer2_Init(); // Displaybeleuchtung
OCR2A = Config.LCD_Helligkeit * 2.55;
}
if (Config.HWSound==1) InitSound();
LCD_Init (1);
set_beep ( 400, 0x0080, BeepNormal);
 
OSD_active = false; //keine OSD Ausgabe
ADC_Init(); // ADC für Lipomessung// MartinR: verschoben
 
if (PCB_Version==PKT39m)
{
lcd_printp_at (2, 0, PSTR("Hardware PKT 3.9m"),0);
lcd_printp_at (7, 1, PSTR("09.2011"),0);
}
if (PCB_Version==PKT39x)
{
lcd_printp_at (2, 0, PSTR("Hardware PKT 3.9x"),0);
lcd_printp_at (7, 1, PSTR("11.2012"),0);
}
lcd_printp_at (0, 3, PSTR("Software:"),0);
// lcd_printpj_at (8, 3, PSTR(PKTSWVersion),0);
lcd_printp_at (8, 3, PSTR(PKTSWVersion), MBIG);
 
 
lcd_puts_at(0, 5, strGet(BOOT1), 0);
lcd_puts_at(0, 6, strGet(BOOT2), 0);
 
_delay_ms(800);
 
if (PINA & (1<<PINA7)) // Spannung eingeschaltet lassen
clr_V_On();
 
_delay_ms(100);
 
set_beep ( 400, 0x0080, BeepNormal);
get_key_press(KEY_ALL);
if (Config.HWSound==1);
{
playTone(505,100,Config.Volume);
playTone(515,100,Config.Volume);
playTone(525,100,Config.Volume);
playTone(535,100,Config.Volume);
playTone(525,100,Config.Volume);
playTone(515,100,Config.Volume);
playTone(505,100,Config.Volume);
}
lcd_cls();
 
 
// servoSetPosition(1,0);
// _delay_ms(250);
// servoSetPosition(0,0);
// _delay_ms(250);
// servoSetPosition(1,400);
// _delay_ms(250);
// servoSetPosition(0,400);
// _delay_ms(250);
// servoSetPosition(1,0);
// _delay_ms(250);
// servoSetPosition(0,0);
// _delay_ms(250);
// servoSetPosition(1,400);
// _delay_ms(250);
// servoSetPosition(0,400);
 
set_BTOff();
if ((Config.UseWi == true) && (Config.WiIsSet == false))
{
InitWi232(Config.PKT_Baudrate); // wenn Wi232 nicht initialisiert ist, dann jetzt tun
}
 
lcd_cls();
// BT ausschalten
if ((Config.UseBT == true) && (Config.BTIsSet == false))
{
bt_init();
// set_USBOn();
}
bt_start();
lcd_cls();
 
if ((Config.UseWi == true) && (U02SV2 == 0))
{
Change_Output(Uart02Wi); // Verbindung zu Wi232 herstellen
if (Config.PKT_StartInfo == true)
{
lcd_puts_at(0, 0, strGet(BOOT_WI1), 0);
lcd_puts_at(0, 1, strGet(BOOT_WI2), 0);
_delay_ms(2000);
}
}
else
{
Change_Output(Uart02FC); // Verbindung zu SV" (Kabel) herstellen
if (Config.PKT_StartInfo == true)
{
lcd_puts_at(0, 0, strGet(BOOT_WI1), 0);
lcd_puts_at(0, 1, strGet(BOOT_SV), 0);
_delay_ms(2000);
}
}
 
lcd_cls();
 
}
 
//#define set_BEEP() (PORTC &= ~(1 << Summer)) // Summer
//#define clr_BEEP() (PORTC |= (1 << Summer))
 
void set_BEEP(void)
{
if (PCB_Version == PKT39m)
PORTC &= ~(1 << Summer); // Summer
if (PCB_Version == PKT39x)
PORTD &= ~(1 << SummerV2); // Summer
}
 
void clr_BEEP(void)
{
if (PCB_Version == PKT39m)
PORTC |= (1 << Summer); // Summer
if (PCB_Version == PKT39x)
PORTD |= (1 << SummerV2); // Summer
}
 
void set_D_LIGHT(void) /* Displaybeleuchtung ein*/
{
if (PCB_Version == PKT39m)
{
if (Config.HWSound==0)
{
// PWM einschalten
TCCR2A |= (1 << WGM21) | (1 << WGM20) | (1 << COM2A1);
TCCR2B |= (1 << CS20);
}
else
clr_DISPLAYLIGHT();
}
 
if (PCB_Version == PKT39x)
{
// if (HWSound==0)
// {
// // PWM einschalten
// TCCR2A |= (1 << WGM21) | (1 << WGM20) | (1 << COM2A1);
// TCCR2B |= (1 << CS20);
// }
// else
clr_DISPLAYLIGHTV2();
}
}
 
void clr_D_LIGHT(void) /* Displaybeleuchtung aus*/
{
if (PCB_Version == PKT39m)
{
if (Config.HWSound==0)
{
// PWM ausschalten
TCCR2A = 0;
TCCR2B = 0;
}
else
set_DISPLAYLIGHT();
}
if (PCB_Version == PKT39x)
{
// if (HWSound==0)
// {
// // PWM ausschalten
// TCCR2A = 0;
// TCCR2B = 0;
// }
// else
set_DISPLAYLIGHTV2();
}
}
 
 
 
 
uint8_t BTIsOn=0;
 
void set_BTOn(void)
{
if (BTIsOn == 0)
{
_BTOn();
BTIsOn = 1;
_delay_ms(2000);
}
}
void set_BTOff(void)
{
set_USBOn();
BTIsOn = 0;
}
 
 
 
#endif
#endif // HAL_HW3_9_C_
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/HAL_HW3_9.h
0,0 → 1,153
/*****************************************************************************
* 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*
*****************************************************************************/
 
 
#ifndef HAL_HW3_9_H_
#define HAL_HW3_9_H_
 
 
 
//#define PIEPSER_NERVT // Summer zu Testzwecken ganz Ausschalten
 
 
// Hardware 3.9 Portbelegung
#define KEY_PIN PINA // Port A als Input
 
#define Touch0 PA0 // Pin 37
#define Touch1 PA1 // Pin 36
#define Touch2 PA2 // Pin 35
#define Touch3 PA3 // Pin 34
#define KEY_EXT PINA3 // MartinR
 
#define Key1 PA4 // Pin 33
#define Key2 PA5 // Pin 32
#define Key3 PA6 // Pin 31
#define Key4 PA7 // Pin 30
 
#define USB2Wi PB0 // Pin 40 aktiv low > IC5
#define VoltageHold PB1 // Pin 41 High = Spannung T3 halten
#define Display_Reset PB2 // Pin 42
#define Display_A0 PB3 // Pin 43
#define Display_CS PB4 // Pin 44
#define Display_SI PB5 // Pin 1
#define LED1 PB6 // Pin 2 Low = LED1 (nicht benutzbar wegen SCL
#define Display_SCL PB7 // Pin 3
 
#define I2C_SCL PC0 // Pin 19 SCL
#define I2C_CDA PC1 // Pin 20 SDA
#define USB2FC PC2 // Pin 21 aktiv low > IC5
#define USB_BT PC3 // Pin 22 high = USB, Low = Bluetooth, LED2
#define LowBat PC4 // Pin 23 Low Bat Warning Lipo PKT,Input
#define Uart02Wi PC5 // Pin 24 aktiv Low > IC4
#define Uart02FC PC6 // Pin 25 aktiv Low > IC4
#define Summer PC7 // Pin 26 Low = Summer
#define DisplaybeleuchtungV2 PC7 // Pin 26 High = Display-LED PCB 3.9w
 
#define Uart0RxD PD0 // Pin 9 über IC4 =Wi | SV2
#define Uart0TxD PD1 // Pin 10 über IC4 =Wi | SV2
#define Uart1RxD PD2 // Pin 11 direkt = USB, BTM, über IC5 = Wi | SV2
#define Uart1TxD PD3 // Pin 12 direkt = USB, BTM, über IC5 = Wi | SV2
#define SERVO2 PD4 // Pin 13 PWM Servo 2
#define SERVO1 PD5 // Pin 14 PWM Servo 1
#define Wi232_CMD PD6 // Pin 15 aktiv Low = Wi232 CMD
#define Displaybeleuchtung PD7 // Pin 16 High = Display-LED
#define SummerV2 PD7 // Pin 16 Low = Summer, PCB 3.9w
 
#define KEY_ENTER Key1
#define KEY_ESC Key2
#define KEY_PLUS Key3
#define KEY_MINUS Key4
 
 
 
// |= schaltet Ausgang auf HIGH
// &= ~ schaltet Ausgang auf LOW
 
#define set_reset() (PORTB |= (1 << Display_Reset))
#define clr_reset() (PORTB &= ~(1 << Display_Reset))
 
#define set_A0() (PORTB |= (1 << Display_A0))
#define clr_A0() (PORTB &= ~(1 << Display_A0))
 
#define set_cs() (PORTB |= (1 << Display_CS))
#define clr_cs() (PORTB &= ~(1 << Display_CS))
 
#define set_si() (PORTB |= (1 << Display_SI))
#define clr_si() (PORTB &= ~(1 << Display_SI))
 
#define set_scl() (PORTB |= (1 << Display_SCL))
#define clr_scl() (PORTB &= ~(1 << Display_SCL))
 
#define _BTOn() (PORTC &= ~(1 << USB_BT)) // Bluetooth ein
 
#define set_USBOn() (PORTC |= (1 << USB_BT)) // USB ein
 
#define clr_V_On() (PORTB &= ~(1 << VoltageHold)) // Spannung mit T3 halten
#define set_V_On() (PORTB |= (1 << VoltageHold))
 
#define set_USB2FC() (PORTC &= ~(1 << USB2FC)) // USB mit FC-Kabel verbinden
#define clr_USB2FC() (PORTC |= (1 << USB2FC))
 
#define set_USB2Wi() (PORTB &= ~(1 << USB2Wi)) // USB mit Wi232 verbinden
#define clr_USB2Wi() (PORTB |= (1 << USB2Wi))
 
#define set_Uart02FC() (PORTC &= ~(1 << Uart02FC)) // Uart0 mit FC-Kabel verbinden
#define clr_Uart02FC() (PORTC |= (1 << Uart02FC))
 
#define set_Uart02Wi() (PORTC &= ~(1 << Uart02Wi)) // Uart0 mit Wi232 verbinden
#define clr_Uart02Wi() (PORTC |= (1 << Uart02Wi))
 
 
#define set_DISPLAYLIGHT() (PORTD &= ~(1 << Displaybeleuchtung)) // Displaybeleuchtung
#define clr_DISPLAYLIGHT() (PORTD |= (1 << Displaybeleuchtung))
#define set_DISPLAYLIGHTV2() (PORTC &= ~(1 << DisplaybeleuchtungV2)) // Displaybeleuchtung PCB3.9w
#define clr_DISPLAYLIGHTV2() (PORTC |= (1 << DisplaybeleuchtungV2))
 
#define set_WI232CMD() (PORTD &= ~(1 << Wi232_CMD)) // Wi232 Programmierpin
#define clr_WI232CMD() (PORTD |= (1 << Wi232_CMD))
 
 
#define PKT39m 1
#define PKT39x 2
 
void set_D_LIGHT(void); /* Displaybeleuchtung ein*/
void clr_D_LIGHT(void); /* Displaybeleuchtung aus */
void set_BEEP(void); /* Beeper ein*/
void clr_BEEP(void); /* Beeper aus*/
void InitHWPorts(void);
void set_BTOn(void); /* Bluetooth einschalten*/
void set_BTOff(void); /* Bluetooth einschalten*/
extern volatile uint8_t PCB_Version;
 
 
#endif
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/connect.c
0,0 → 1,332
/*****************************************************************************
* 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/pgmspace.h>
#include <util/delay.h>
#include "lcd/lcd.h"
#include "timer/timer.h"
#include "eeprom/eeprom.h"
#include "messages.h"
#include "lipo/lipo.h"
#include "main.h"
#include "bluetooth/bluetooth.h"
 
#if defined HWVERSION3_9
//--------------------------------------------------------------
void Change_Output(uint8_t UartMode) // Schaltet die Rx/Tx Richtungen
{
// hiermit werden die 74HTC125 (IC5) Gatter geschaltet
clr_USB2FC(); // PC2 aus
clr_USB2Wi(); // PB0 aus
clr_Uart02FC(); // PC6 aus
clr_Uart02Wi(); // PC5 aus
 
 
switch (UartMode)
{
case USB2FC:
UCSR1B &= ~(1<<RXEN1);
UCSR1B &= ~(1<<TXEN1);
UCSR1B &= ~(1<<RXCIE1);
 
DDRD &= ~(1<<DDD2); // Pins auf Eingang setzen
DDRD &= ~(1<<DDD3);
PORTD &= ~(1<<PD2); // Pullup aus
PORTD &= ~(1<<PD3);
 
set_USB2FC();
break;
 
case Uart02Wi:
set_Uart02Wi();
break;
 
case Uart02FC:
set_Uart02FC();
break;
 
case USB2Wi:
UCSR1B &= ~(1<<RXEN1);
UCSR1B &= ~(1<<TXEN1);
UCSR1B &= ~(1<<RXCIE1);
 
DDRD &= ~(1<<DDD2); // Pins auf Eingang setzen
DDRD &= ~(1<<DDD3);
PORTD &= ~(1<<PD2); // Pullup aus
PORTD &= ~(1<<PD3);
 
set_USB2Wi();
break;
}
 
}
 
 
//--------------------------------------------------------------
// Function: BT2FC()
// Purpose: Connect BT direct to FC-Kabel (SV2 as MKUSB)
// Returns:
//--------------------------------------------------------------
void Port_BT2FC(void)
{
lcd_cls ();
 
if(Config.UseBT == true)
{
 
lcd_puts_at(0, 0, strGet(CONNECT14), 2);
lcd_puts_at(0, 1, strGet(CONNECT15), 0);
lcd_puts_at(0, 3, strGet(CONNECT16), 0);
lcd_puts_at(0, 4, strGet(CONNECT17), 0);
lcd_puts_at(0, 5, strGet(CONNECT23), 0);
lcd_printp_at (0, 6, PSTR("Baudrate: "), 0);
show_baudrate (10,6,Config.PKT_Baudrate,0);
lcd_puts_at(12, 7, strGet(ESC), 0);
set_BTOn();
_delay_ms(2000);
if (!Config.BTIsSlave==true) bt_set_mode(BLUETOOTH_SLAVE);
Change_Output(USB2FC);
do
{
show_Lipo();
}
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
if (Config.U02SV2 == 1)
Change_Output(Uart02FC);
else
Change_Output(Uart02Wi);
 
set_BTOff();
return;
}
else
{
lcd_puts_at(0, 1, strGet(CONNECT12), 0);
lcd_puts_at(0, 1, strGet(CONNECT13), 0);
lcd_puts_at(0, 2, strGet(CONNECT7), 0);
lcd_puts_at(0, 3, strGet(CONNECT8), 0);
lcd_puts_at(0, 4, strGet(CONNECT9), 0);
lcd_puts_at(12, 7, strGet(ENDE), 0);
// lcd_printp_at (12, 7, PSTR("Ende"), 0);
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
return;
}
}
 
 
//--------------------------------------------------------------
// Function: BT2Wi()
// Purpose: Connect BT direct to Wi.232
// Returns:
//--------------------------------------------------------------
void Port_BT2Wi(void)
{
 
lcd_cls ();
 
lcd_puts_at(0, 0, strGet(CONNECT14), 2);
lcd_puts_at(0, 1, strGet(CONNECT18), 2);
lcd_printp_at (5, 2, PSTR("RE-ID: "), 0);
for (uint8_t i = 0; i < RE_ID_length; i++)
{
lcd_putc (12+i,2, Config.RE_ID[i], 0);
 
}
lcd_puts_at(0, 3, strGet(CONNECT16), 0);
lcd_puts_at(0, 4, strGet(CONNECT19), 0);
lcd_puts_at(0, 5, strGet(CONNECT23), 0);
lcd_printp_at (0, 6, PSTR("Baudrate: "), 0);
show_baudrate (10,6,Config.PKT_Baudrate,0);
lcd_puts_at(12, 7, strGet(ESC), 0);
set_BTOn();
_delay_ms(2000);
if (!Config.BTIsSlave==true) bt_set_mode(BLUETOOTH_SLAVE);
 
Change_Output(USB2Wi);
do
{
show_Lipo();
}
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
if (Config.U02SV2 == 1)
Change_Output(Uart02FC);
else
Change_Output(Uart02Wi);
 
set_BTOff();
return;
}
 
 
//--------------------------------------------------------------
// Function: FC2CFG_BT()
// Purpose: Connect FC (Tx1 Pin3, Rx1 Pin4) direct to BT
// Returns:
//--------------------------------------------------------------
void Port_FC2CFG_BT(void)
{
 
lcd_cls ();
lcd_printp_at (0, 0, PSTR("BTM-222 Konfigurieren"), 2);
lcd_printp_at (0, 1, PSTR("FC > MK-USB > BTM-222"), 2);
lcd_printp_at (0, 3, PSTR("MK-USB an PC anschl. "), 0);
lcd_printp_at (0, 4, PSTR("Zwischen MK-USB und "), 0);
lcd_printp_at (0, 5, PSTR("PKT ein gekreuztes "), 0);
lcd_printp_at (0, 6, PSTR("Kabel anschliessen. "), 0);
lcd_puts_at(12, 7, strGet(ESC), 0);
 
set_BTOn();
Change_Output(USB2FC);
 
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
if (Config.U02SV2 == 1)
Change_Output(Uart02FC);
else
Change_Output(Uart02Wi);
 
set_BTOff();
return;
}
 
 
//--------------------------------------------------------------
// Function: USB2FC()
// Purpose: Connect USB direct to FC-Kabel (SV2 as MKUSB)
// Returns:
//--------------------------------------------------------------
void Port_USB2FC(void)
{
lcd_cls ();
lcd_puts_at(0, 0, strGet(CONNECT14), 2);
lcd_puts_at(0, 1, strGet(CONNECT20), 0);
lcd_puts_at(0, 3, strGet(CONNECT21), 0);
lcd_puts_at(0, 4, strGet(CONNECT17), 0);
lcd_puts_at(0, 5, strGet(CONNECT23), 0);
lcd_puts_at(12, 7, strGet(ESC), 0);
Change_Output(USB2FC);
do
{
show_Lipo();
}
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
if (Config.U02SV2 == 1)
Change_Output(Uart02FC);
else
Change_Output(Uart02Wi);
 
return;
}
 
//--------------------------------------------------------------
// Function: USB2Wi()
// Purpose: Connect USB direct to Wi.232
// Returns:
//--------------------------------------------------------------
void Port_USB2Wi(void)
{
 
lcd_cls ();
lcd_puts_at(0, 0, strGet(CONNECT14), 2);
lcd_puts_at(0, 1, strGet(CONNECT22), 2);
lcd_puts_at(0, 3, strGet(CONNECT21), 0);
lcd_puts_at(0, 4, strGet(CONNECT19), 0);
lcd_puts_at(0, 5, strGet(CONNECT23), 0);
lcd_printp_at (0, 6, PSTR("Baudrate: "), 0);
show_baudrate (10,6,Config.PKT_Baudrate,0);
lcd_puts_at(12, 7, strGet(ESC), 0);
 
Change_Output(USB2Wi);
do
{
show_Lipo();
}
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
if (Config.U02SV2 == 1)
Change_Output(Uart02FC);
else
Change_Output(Uart02Wi);
 
return;
 
 
}
 
//--------------------------------------------------------------
// Function: USB2CFG_Wi()
// Purpose: Connect USB direct to Wi.232 in Progmode
// Returns:
//--------------------------------------------------------------
void Port_USB2CFG_Wi(void)
{
 
lcd_cls ();
lcd_puts_at(0, 0, strGet(CONNECT24), 2);
lcd_puts_at(0, 1, strGet(CONNECT22), 2);
lcd_puts_at(0, 3, strGet(CONNECT21), 0);
lcd_printp_at (0, 4, PSTR("Radiotronix Wi.232DTS"), 0);
lcd_printp_at (0, 5, PSTR("Evaluation (868MHz) "), 0);
lcd_puts_at(0, 6, strGet(CONNECT25), 0);
lcd_puts_at(12, 7, strGet(ESC), 0);
 
Change_Output(USB2Wi);
 
set_WI232CMD(); // Port D6 = CMD
 
while(!get_key_press (1 << KEY_ESC));
 
get_key_press(KEY_ALL);
clr_WI232CMD(); // Port D6 = CMD
 
if (Config.U02SV2 == 1)
Change_Output(Uart02FC);
else
Change_Output(Uart02Wi);
 
return;
}
 
#endif
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/connect.h
0,0 → 1,48
/*****************************************************************************
* 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*
*****************************************************************************/
 
 
#ifndef _CONNECT_H
#define _CONNECT_H
 
void Change_Output(uint8_t UartMode);
 
void Port_BT2Wi(void);
void Port_BT2FC(void);
void Port_FC2CFG_BT(void);
 
void Port_USB2FC(void);
void Port_USB2Wi(void);
void Port_USB2CFG_Wi(void);
 
#endif
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/cpu.h
0,0 → 1,41
/*****************************************************************************
* 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*
*****************************************************************************/
 
 
#ifndef _CPU_H
#define _CPU_H
 
// Quarz Frequenz in Hz
#define F_CPU 20000000UL
 
#endif
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/debug.c
0,0 → 1,378
/*****************************************************************************
* 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 <string.h>
 
#include "main.h"
#ifdef analognames
//#include "menu.h"
#include "lcd/lcd.h"
#include "uart/usart.h"
#include "debug.h"
#include "timer/timer.h"
#include "messages.h"
 
#include "mk-data-structs.h"
 
 
#ifdef HWVERSION3_9
 
 
#define TIMEOUT 200 // 2 sec
#define ANALOGTIME 20 // 200 ms
 
// WARNING: this work for NC & FC only
// if current_hardware == MK3MAG or MKGPS the access is outside of the array...
uint8_t AnalogNames[2][32][16 + 1]; // 32 names, 16 characters + 1 0x00
uint8_t AnalogNamesRead[2] = {0,0};
 
//--------------------------------------------------------------
//
void GetAnalogNames (void)
{
uint8_t i = AnalogNamesRead[current_hardware - 1];
uint8_t t = 0;
 
lcd_cls ();
lcd_printp_at (0, 3, PSTR("Reading"), 0);
lcd_printp_at (0, 4, PSTR("Analog Names: "), 0);
 
mode = 'A'; // read Names
_delay_ms(200);
rxd_buffer_locked = FALSE;
 
timer = ANALOGTIME;
 
while (i < 32)
{
SendOutData ('a', ADDRESS_ANY, 1, &i, 1);
while (!rxd_buffer_locked && timer);
if (timer)
{
Decode64 ();
if (i == *pRxData)
{
write_ndigit_number_u(14, 4, i, 2, 0,0);
memcpy (AnalogNames[current_hardware - 1][*pRxData], (uint8_t *) pRxData + 1, 16);
AnalogNames[current_hardware - 1][*pRxData][16] = 0;
i++;
t = 0;
}
else
{
_delay_ms (100);
}
 
timer = ANALOGTIME;
rxd_buffer_locked = FALSE;
}
else
{ // timeout occured
t++;
timer = ANALOGTIME;
 
if (t >= 50)
{
lcd_printp_at (0, 2, PSTR("ERROR: no data"), 0);
 
timer = 100;
while (timer > 0);
break;
}
}
}
 
AnalogNamesRead[current_hardware - 1] = i;
 
#if 0
if (timer)
{
for (page = 0; page < 5; page++)
{
for (i = 0; i < 7; i++)
{
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0);
}
while (!get_key_press (1 << KEY_ESC)); // ESC
get_key_press(KEY_ALL);
}
}
//return;
#endif
}
 
 
//--------------------------------------------------------------
//
void display_debug (void)
{
uint8_t i = 0;
uint8_t tmp_dat;
uint8_t page = 0;
 
DebugData_t *DebugData;
 
lcd_cls ();
 
timer = TIMEOUT;
 
if (AnalogNamesRead[current_hardware - 1] < 32)
{
GetAnalogNames ();
}
 
if (!timer)
{
return;
}
 
mode = 'D'; // Debug Data
rxd_buffer_locked = FALSE;
timer = TIMEOUT;
 
tmp_dat = 10;
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1);
abo_timer = ABO_TIMEOUT;
 
for (i = 0; i < 7; i++)
{
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0);
if (page == 4 && i > 3)
{
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen
{
lcd_cls_line (0, i, 21);
}
i = 7;
}
}
 
do
{
if (rxd_buffer_locked)
{
Decode64 ();
DebugData = (DebugData_t *) pRxData;
 
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0);
lcd_puts_at(0, 7, strGet(KEYLINE3), 0);
lcd_write_number_u_at (5, 7, page + 1);
switch (current_hardware)
{
case FC:
lcd_printp_at (3, 7, PSTR("FC"), 0);
lcd_printp_at (19, 7, PSTR("NC"), 0);
break;
 
case NC:
lcd_printp_at (3, 7, PSTR("NC"), 0);
lcd_printp_at (19, 7, PSTR("FC"), 0);
break;
 
default:
lcd_printp_at (19, 7, PSTR("?"), 0);
break;
}
 
for (i = 0; i < 7; i++)
{
//lcd_print_at (0, i, AnalogNames[i + page * 7], 0);
uint8_t size =0;
if( DebugData->Analog[i + page * 7] < -9999)
{
size = 6;
}
else if ( DebugData->Analog[i + page * 7] < -999)
{
size = 5;
}
else if ( DebugData->Analog[i + page * 7] < -99)
{
size = 4;
}
else if ( DebugData->Analog[i + page * 7] < 999)
{
size = 3;
}
else if ( DebugData->Analog[i + page * 7] < 9999)
{
size = 4;
}
else
{
size = 5;
}
write_ndigit_number_s (21-size, i, DebugData->Analog[i + page * 7], size, 0,0);
if (page == 4 && i > 3)
{
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen
{
lcd_cls_line (0, i, 21);
}
i = 7;
}
}
timer = TIMEOUT;
rxd_buffer_locked = FALSE;
}
 
if (!abo_timer)
{ // renew abo every 3 sec
// request OSD Data from NC every 100ms
// RS232_request_mk_data (1, 'o', 100);
tmp_dat = 10;
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1);
 
abo_timer = ABO_TIMEOUT;
}
 
if (get_key_press (1 << KEY_MINUS))
{
page--;
if (page > 4)
{
page = 4;
}
lcd_cls ();
for (i = 0; i < 7; i++)
{
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0);
if (page == 4 && i > 3)
{
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen
{
lcd_cls_line (0, i, 21);
}
i = 7;
}
}
}
else if (get_key_press (1 << KEY_PLUS))
{
page++;
if (page > 4)
{
page = 0;
}
lcd_cls ();
for (i = 0; i < 7; i++)
{
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0);
if (page == 4 && i > 3)
{
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen
{
lcd_cls_line (0, i, 21);
}
i = 7;
}
}
}
if ((hardware == NC) && get_key_press (1 << KEY_ENTER))
{
tmp_dat = 0;
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1);
 
_delay_ms (200);
 
if (current_hardware == NC)
{
SwitchToFC();
 
timer = TIMEOUT;
}
else
{
SwitchToNC();
 
timer = TIMEOUT;
}
 
_delay_ms (200);
 
if (AnalogNamesRead[current_hardware - 1] < 32)
{
GetAnalogNames ();
}
 
mode = 'D'; // Debug Data
rxd_buffer_locked = FALSE;
timer = TIMEOUT;
 
tmp_dat = 10;
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1);
 
lcd_cls ();
page = 0;
 
for (i = 0; i < 7; i++)
{
lcd_print_at (0, i, AnalogNames[current_hardware - 1][i + page * 7], 0);
if (page == 4 && i > 3)
{
for (i = 4; i < 7; i++) // Linie 4, 5, 6 loeschen
{
lcd_cls_line (0, i, 21);
}
i = 7;
}
}
}
}
while (!get_key_press (1 << KEY_ESC) && timer); // ESC
get_key_press(KEY_ALL);
 
tmp_dat = 0;
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1);
 
mode = 0;
rxd_buffer_locked = FALSE;
 
if (!timer)
{ // timeout occured
lcd_cls ();
lcd_printp_at (0, 2, PSTR("ERROR: no data"), 0);
 
timer = 100;
while (timer > 0);
}
SwitchToNC();
}
#endif
#endif
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/debug.h
0,0 → 1,42
/*****************************************************************************
* 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*
*****************************************************************************/
 
 
#ifndef _DEBUG_H
#define _DEBUG_H
 
extern uint8_t AnalogNamesRead[2];
 
void display_debug(void);
 
#endif
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/display.c
0,0 → 1,180
/*****************************************************************************
* 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 "main.h"
#include "lcd/lcd.h"
#include "uart/usart.h"
#include "timer/timer.h"
#include "messages.h"
 
#include "mk-data-structs.h"
 
#define TIMEOUT 500 // 5 sec
 
 
void display_data (void)
{
uint8_t cmd;
uint8_t flag = 0;;
 
mode = 'H';
 
lcd_cls ();
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0);
lcd_puts_at(0, 7, strGet(KEYLINE3), 0);
if (current_hardware == NC)
{
lcd_printp_at (0, 0, PSTR(" Navi-Ctrl Display "), 2);
lcd_printp_at (19, 7, PSTR("FC"), 0);
}
else
{
if (hardware == FC)
{
lcd_printp_at (0, 0, PSTR(" Display "), 2);
lcd_printp_at (19, 7, PSTR(" "), 0);
}
else
{
lcd_printp_at (0, 0, PSTR(" Flight-Ctrl Display "), 2);
lcd_printp_at (19, 7, PSTR("NC"), 0);
}
}
 
rxd_buffer_locked = FALSE;
timer = TIMEOUT;
cmd = 0xfc; // Home = first page
 
do
{
SendOutData('h', ADDRESS_ANY, 1, &cmd, 1);
cmd = 0xff;
//LED6_TOGGLE;
_delay_ms (250);
 
if (rxd_buffer_locked)
{
Decode64 ();
flag = 1;
 
if (!hardware)
{ // hardware was not detected at startup
hardware = rxd_buffer[1] - 'a';
if (hardware == NC)
{
lcd_printp_at (0, 0, PSTR(" Navi-Ctrl Display "), 2);
lcd_printp_at (19, 7, PSTR("FC"), 0);
current_hardware = NC;
}
else
{
lcd_printp_at (0, 0, PSTR(" Display "), 2);
lcd_printp_at (19, 7, PSTR(" "), 0);
current_hardware = FC;
}
}
 
#if 0
rxd_buffer[24] = 0;
 
lcd_print_at (0, rxd_buffer[3] + 1, (uint8_t *) &rxd_buffer[4], 0);
#else
rxd_buffer[83] = 0;
 
print_display_at (0, 2, (uint8_t *) &rxd_buffer[3]);
#endif
 
rxd_buffer_locked = FALSE;
timer = TIMEOUT;
}
 
if (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 2))
{
cmd = 0xfe; // next page
//SendOutData('h', ADDRESS_ANY, 1, &cmd, 1);
//cmd = 0;
}
else if (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 2))
{
cmd = 0xfd; // previous page
//SendOutData('h', ADDRESS_ANY, 1, &cmd, 1);
//cmd = 0;
}
else if ((hardware == NC) && get_key_press (1 << KEY_ENTER))
{
if (current_hardware == NC)
{
SwitchToFC();
 
//timer = TIMEOUT;
lcd_printp_at (0, 0, PSTR(" Flight-Ctrl Display "), 2);
lcd_printp_at (19, 7, PSTR("NC"), 0);
}
else
{
SwitchToNC();
 
//timer = TIMEOUT;
lcd_printp_at (0, 0, PSTR(" Navi-Ctrl Display "), 2);
lcd_printp_at (19, 7, PSTR("FC"), 0);
}
cmd = 0xfc; // Home = first page
//SendOutData('h', ADDRESS_ANY, 1, &cmd, 1);
//cmd = 0;
}
}
while (!get_key_press (1 << KEY_ESC) && timer);
get_key_press(KEY_ALL);
 
mode = 0;
rxd_buffer_locked = FALSE;
 
if (!timer)
{ // timeout occured
if (flag)
{
lcd_cls ();
}
lcd_printp_at (0, 2, PSTR("Fehler: Keine Daten"), 0);
 
timer = 100;
while (timer > 0);
}
SwitchToNC();
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/Transportables_Koptertool/branch/test2/GPL_PKT_V3_6_7f_FC090b/display.h
0,0 → 1,42
/*****************************************************************************
* 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*
*****************************************************************************/
 
 
#ifndef _DISPLAY_H
#define _DISPLAY_H
 
void display_data (void);
 
#endif
 
 
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property