/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/lcd.c |
---|
0,0 → 1,1370 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* * |
* 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. * |
* * |
*****************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include "font8x6.h" |
//#include "font8x8.h" |
#include "eeprom.h" |
#include "lcd.h" |
#include "HAL_HW3_9.h" |
#define DISP_W 128 |
#define DISP_H 64 |
#define DISP_BUFFER ((DISP_H * DISP_W) / 8) |
#define LINE_BUFFER (((DISP_H/8) * DISP_W) / 8) |
#define Jeti 0 // Jeti Routinen |
volatile uint8_t display_buffer[DISP_BUFFER]; // Display-Puffer, weil nicht zurückgelesen werden kann |
volatile uint8_t line_buffer[LINE_BUFFER]; // Zeilen-Puffer, weil nicht zurückgelesen werden kann |
volatile uint16_t display_buffer_pointer; // Pointer auf das aktuell übertragene Byte |
volatile uint8_t display_buffer_counter; // Hilfszähler zur Selektierung der Page |
volatile uint8_t display_page_counter; // aktuelle Page-Nummer |
volatile uint8_t display_mode; // Modus für State-Machine |
volatile uint8_t LCD_ORIENTATION; |
// DOG: 128 x 64 with 6x8 Font => 21 x 8 |
// MAX7456: 30 x 16 |
uint8_t lcd_xpos; |
uint8_t lcd_ypos; |
//----------------------------------------------------------- |
void send_byte (uint8_t data) |
{ |
clr_cs (); |
SPDR = data; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
// * Writes one command byte |
// * cmd - the command byte |
// |
void lcd_command(uint8_t cmd) |
{ |
// LCD_SELECT(); |
// LCD_CMD(); |
// spi_write(cmd); |
// LCD_UNSELECT(); |
clr_cs (); |
SPDR = cmd; |
while (!(SPSR & (1<<SPIF))); |
//SPSR = SPSR; |
set_cs (); |
} |
//----------------------------------------------------------- |
void lcd_cls (void) |
{ |
uint16_t i, j; |
// memset (display_buffer, 0, 1024); |
for (i = 0; i < DISP_BUFFER; i++) |
display_buffer[i] = 0x00; |
for (i = 0; i < 8; i++) |
{ |
clr_A0 (); |
send_byte (0xB0 + i); //1011xxxx |
send_byte (0x10); //00010000 |
// send_byte(0x04); //00000100 gedreht plus 4 Byte |
// send_byte(0x00); //00000000 |
send_byte (LCD_ORIENTATION); //00000000 |
set_A0 (); |
for (j = 0; j < 128; j++) |
send_byte (0x00); |
} |
lcd_xpos = 0; |
lcd_ypos = 0; |
} |
//----------------------------------------------------------- |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w) |
{ |
uint8_t lcd_width; |
uint8_t lcd_zpos; |
uint8_t i; |
uint8_t max = 21; |
lcd_width = w; |
lcd_xpos = x; |
lcd_ypos = y; |
if ((lcd_xpos + lcd_width) > max) |
lcd_width = max - lcd_xpos; |
lcd_zpos = lcd_xpos + lcd_width; |
for (i = lcd_xpos; i < lcd_zpos; i++) |
lcd_putc (i, lcd_ypos, 0x20, 0); |
} |
//----------------------------------------------------------- |
void wait_1ms (void) |
{ |
_delay_ms (1); |
} |
//----------------------------------------------------------- |
void wait_ms (uint16_t time) |
{ |
uint16_t i; |
for (i = 0; i < time; i++) |
wait_1ms (); |
} |
//----------------------------------------------------------- |
void LCD_Init (uint8_t LCD_Mode) // LCD_Mode 0= Default Mode 1= EEPROM-Parameter) |
{ |
lcd_xpos = 0; |
lcd_ypos = 0; |
// DDRB = 0xFF; |
// SPI max. speed |
// the DOGM128 lcd controller can work at 20 MHz |
SPCR = (1 << SPE) | (1 << MSTR) | (1 << CPHA) | (1 << CPOL); |
SPSR = (1 << SPI2X); |
set_cs (); |
clr_reset (); |
wait_ms (10); |
set_reset (); |
clr_cs (); |
clr_A0 (); |
send_byte (0x40); //Display start line = 0 |
if (LCD_Mode == 1) |
{ |
if (LCD_ORIENTATION == 0) |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
else |
{ |
send_byte (0xA0); // A1 normal A0 reverse(original) |
send_byte (0xC8); // C0 normal C8 reverse(original) |
} |
} |
else |
{ |
send_byte (0xA1); // A1 normal A0 reverse(original) |
send_byte (0xC0); // C0 normal C8 reverse(original) |
} |
if (LCD_Mode == 1) |
{ |
if (LCD_DisplayMode == 0) |
send_byte (0xA6); //Display normal, not mirrored |
else |
send_byte (0xA7); //Display reverse, not mirrored |
} |
else |
send_byte (0xA6); |
send_byte (0xA2); //Set bias 1/9 (Duty 1/65) |
send_byte (0x2F); //Booster, regulator and follower on |
send_byte (0xF8); //Set internal booster to 4x |
send_byte (0x00); //Set internal booster to 4x |
send_byte (0x27); //resistor ratio set |
if (LCD_Mode == 1) |
{ |
send_byte (0x81); //Electronic volume register set |
send_byte (LCD_Kontrast); //Electronic volume register set |
} |
else |
{ |
send_byte (0x81); |
send_byte (0x16); |
} |
send_byte (0xAC); //Cursor |
send_byte (0x00); //No Cursor |
send_byte (0xAF); //No indicator |
if (LCD_Mode == 1) |
{ |
// Helligkeit setzen |
OCR2A = LCD_Helligkeit * 2.55; |
} |
else |
{ |
OCR2A = 255; |
} |
lcd_cls (); |
} |
//----------------------------------------------------------- |
void set_adress (uint16_t adress, uint8_t data) |
{ |
uint8_t page; |
uint8_t column; |
page = adress >> 7; |
clr_A0 (); |
send_byte (0xB0 + page); |
column = (adress & 0x7F) + LCD_ORIENTATION; |
send_byte (0x10 + (column >> 4)); |
send_byte (column & 0x0F); |
set_A0 (); |
send_byte (data); |
} |
//----------------------------------------------------------- |
void scroll (void) |
{ |
uint16_t adress; |
for (adress = 0; adress < 896; adress++) |
{ |
display_buffer[adress] = display_buffer[adress + 128]; |
set_adress (adress, display_buffer[adress]); |
} |
for (adress = 896; adress < 1024; adress++) |
{ |
display_buffer[adress] = 0; |
set_adress (adress, 0); |
} |
} |
//----------------------------------------------------------- |
// sicher eine Zeile für die Statusanzeige |
void copy_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
line_buffer[i] = display_buffer[adress+i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
// holt gesicherte Zeile wieder zurück |
void paste_line (uint8_t y) |
{ |
uint8_t i; |
uint16_t adress; |
adress = y * 128 + 0 * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6*21; i++) |
{ |
display_buffer[adress+i] =line_buffer[i]; |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ) |
{ |
while (*s) |
{ |
lcd_putc(x, y, *s++, mode); |
x++; |
} |
}/* lcd_puts */ |
//----------------------------------------------------------- |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode) |
{ |
uint8_t ch; |
uint8_t i; |
uint16_t adress; |
if (mode == 2) |
lcd_frect ((x*6),(y*8),5,7,1); // invertierte Darstellung |
switch (c) |
{ // ISO 8859-1 |
case 0xc4: // Ä |
c = 0x01; |
break; |
case 0xe4: // ä |
c = 0x02; |
break; |
case 0xd6: // Ö |
c = 0x03; |
break; |
case 0xf6: // ö |
c = 0x04; |
break; |
case 0xdc: // Ü |
c = 0x05; |
break; |
case 0xfc: // ü |
c = 0x06; |
break; |
case 0xdf: // ß |
//c = 0x07; |
c = 0x1e; // ° (used by Jeti) |
break; |
} |
c &= 0x7f; |
adress = y * 128 + x * 6; |
adress &= 0x3FF; |
for (i = 0; i < 6; i++) |
{ |
ch = pgm_read_byte (&font8x6[0][0] + i + c * 6); |
switch (mode) |
{ |
case 0: |
display_buffer[adress+i] = ch; |
break; |
case 1: |
display_buffer[adress+i] |= ch; |
break; |
case 2: |
display_buffer[adress+i] ^= ch; |
break; |
case 3: |
display_buffer[adress+i] &= ch; |
break; |
case 4: |
display_buffer[adress+i] &= ~ch; |
break; |
} |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
#if Jeti |
//----------------------------------------------------------- |
void lcd_putc_jeti (uint8_t x, uint8_t y, uint8_t c, uint8_t mode) |
{ |
uint8_t ch; |
uint8_t i; |
uint16_t adress; |
switch (c) |
{ |
case 0x7e: |
c = 0x1a; // -> |
break; |
case 0x7f: |
c = 0x1b; // <- |
break; |
case 0xdf: |
c = 0xf8; // ° |
break; |
} |
adress = y * 128 + x * 8; |
adress &= 0x3FF; |
for (i = 0; i < 8; i++) |
{ |
ch = pgm_read_byte (&font8x8[0][0] + i + c * 8); |
switch (mode) |
{ |
case 0: |
display_buffer[adress+i] = ch; |
break; |
case 1: |
display_buffer[adress+i] |= ch; |
break; |
case 2: |
display_buffer[adress+i] ^= ch; |
break; |
case 3: |
display_buffer[adress+i] &= ch; |
break; |
case 4: |
display_buffer[adress+i] &= ~ch; |
break; |
} |
set_adress (adress + i, display_buffer[adress + i]); |
} |
} |
//----------------------------------------------------------- |
void lcd_printpj (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc_jeti (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpj_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpj (text, mode); |
} |
#endif |
//----------------------------------------------------------- |
void new_line (void) |
{ |
lcd_ypos++; |
if (lcd_ypos > 7) |
{ |
scroll (); |
lcd_ypos = 7; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
// new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printpns (text, mode); |
} |
//----------------------------------------------------------- |
void lcd_printp (const char *text, uint8_t mode) |
{ |
while (pgm_read_byte(text)) |
{ |
switch (pgm_read_byte(text)) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, pgm_read_byte(text), mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_printp (text, mode); |
} |
//----------------------------------------------------------- |
void lcd_print (uint8_t *text, uint8_t mode) |
{ |
while (*text) |
{ |
switch (*text) |
{ |
case 0x0D: |
lcd_xpos = 0; |
break; |
case 0x0A: |
new_line(); |
break; |
default: |
lcd_putc (lcd_xpos, lcd_ypos, *text, mode); |
lcd_xpos++; |
if (lcd_xpos > 21) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
break; |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_print (text, mode); |
} |
//----------------------------------------------------------- |
void print_display (uint8_t *text) |
{ |
while (*text) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, *text, 0); |
lcd_xpos++; |
if (lcd_xpos >= 20) |
{ |
lcd_xpos = 0; |
new_line (); |
} |
text++; |
} |
} |
//----------------------------------------------------------- |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
print_display (text); |
} |
//----------------------------------------------------------- |
// + Plot (set one Pixel) |
//----------------------------------------------------------- |
// mode: |
// 0=Clear, 1=Set, 2=XOR |
void lcd_plot (uint8_t xpos, uint8_t ypos, uint8_t mode) |
{ |
uint16_t adress; |
uint8_t mask; |
if ((xpos < DISP_W) && (ypos < DISP_H)) |
{ |
adress = (ypos / 8) * DISP_W + xpos; // adress = 0/8 * 128 + 0 = 0 |
mask = 1 << (ypos & 0x07); // mask = 1<<0 = 1 |
adress &= DISP_BUFFER - 1; |
switch (mode) |
{ |
case 0: |
display_buffer[adress] &= ~mask; |
break; |
case 1: |
display_buffer[adress] |= mask; |
break; |
case 2: |
display_buffer[adress] ^= mask; |
break; |
} |
set_adress (adress, display_buffer[adress]); |
} |
} |
//----------------------------------------------------------- |
// + Line (draws a line from x1,y1 to x2,y2 |
// + Based on Bresenham line-Algorithm |
// + found in the internet, modified by thkais 2007 |
//----------------------------------------------------------- |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode) |
{ |
int x, y, count, xs, ys, xm, ym; |
x = (int) x1; |
y = (int) y1; |
xs = (int) x2 - (int) x1; |
ys = (int) y2 - (int) y1; |
if (xs < 0) |
xm = -1; |
else |
if (xs > 0) |
xm = 1; |
else |
xm = 0; |
if (ys < 0) |
ym = -1; |
else |
if (ys > 0) |
ym = 1; |
else |
ym = 0; |
if (xs < 0) |
xs = -xs; |
if (ys < 0) |
ys = -ys; |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
if (xs > ys) // Flat Line <45 degrees |
{ |
count = -(xs / 2); |
while (x != x2) |
{ |
count = count + ys; |
x = x + xm; |
if (count > 0) |
{ |
y = y + ym; |
count = count - xs; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
else // Line >=45 degrees |
{ |
count =- (ys / 2); |
while (y != y2) |
{ |
count = count + xs; |
y = y + ym; |
if (count > 0) |
{ |
x = x + xm; |
count = count - ys; |
} |
lcd_plot ((unsigned char) x, (unsigned char) y, mode); |
} |
} |
} |
//----------------------------------------------------------- |
// + Filled rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
uint16_t i; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
for (i = y1; i <= y2; i++) |
{ |
lcd_line (x1, i, x2, i, mode); |
} |
} |
//----------------------------------------------------------- |
// + outline of rectangle |
// + x1, y1 = upper left corner |
//----------------------------------------------------------- |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode) |
{ |
uint16_t x2, y2; |
if (x1 >= DISP_W) |
x1 = DISP_W - 1; |
if (y1 >= DISP_H) |
y1 = DISP_H - 1; |
x2 = x1 + widthx; |
y2 = y1 + widthy; |
if (x2 > DISP_W) |
x2 = DISP_W; |
if (y2 > DISP_H) |
y2 = DISP_H; |
lcd_line (x1, y1, x2, y1, mode); |
lcd_line (x2, y1, x2, y2, mode); |
lcd_line (x2, y2, x1, y2, mode); |
lcd_line (x1, y2, x1, y1, mode); |
} |
//----------------------------------------------------------- |
// + outline of a circle |
// + Based on Bresenham-algorithm found in wikipedia |
// + modified by thkais (2007) |
//----------------------------------------------------------- |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_plot (x0, y0 + radius, mode); |
lcd_plot (x0, y0 - radius, mode); |
lcd_plot (x0 + radius, y0, mode); |
lcd_plot (x0 - radius, y0, mode); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y --; |
ddF_y += 2; |
f += ddF_y; |
} |
x ++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
lcd_plot (x0 + y, y0 + x, mode); |
lcd_plot (x0 - y, y0 + x, mode); |
lcd_plot (x0 + y, y0 - x, mode); |
lcd_plot (x0 - y, y0 - x, mode); |
} |
} |
//----------------------------------------------------------- |
// + filled Circle |
// + modified circle-algorithm thkais (2007) |
//----------------------------------------------------------- |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius) |
{ |
int16_t f = 1 - radius; |
int16_t ddF_x = 0; |
int16_t ddF_y = -2 * radius; |
int16_t x = 0; |
int16_t y = radius; |
lcd_line (x0, y0 + radius, x0, y0 - radius, 1); |
lcd_line (x0 + radius, y0, x0 - radius, y0, 1); |
while (x < y) |
{ |
if (f >= 0) |
{ |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x + 1; |
lcd_line (x0 + x, y0 + y, x0 - x, y0 + y, 1); |
lcd_line (x0 + x, y0 - y, x0 - x, y0 - y, 1); |
lcd_line (x0 + y, y0 + x, x0 - y, y0 + x, 1); |
lcd_line (x0 + y, y0 - x, x0 - y, y0 - x, 1); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) r); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) r); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode) |
{ |
uint8_t xc, yc; |
double deg_rad; |
deg_rad = (deg * M_PI) / 180.0; |
yc = y - (uint8_t) round (cos (deg_rad) * (double) ry); |
xc = x + (uint8_t) round (sin (deg_rad) * (double) rx); |
lcd_line (x, y, xc, yc, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode) |
{ |
const int16_t rx2 = rx * rx; |
const int16_t ry2 = ry * ry; |
int16_t F = round (ry2 - rx2 * ry + 0.25 * rx2); |
int16_t ddF_x = 0; |
int16_t ddF_y = 2 * rx2 * ry; |
int16_t x = 0; |
int16_t y = ry; |
lcd_plot (x0, y0 + ry, mode); |
lcd_plot (x0, y0 - ry, mode); |
lcd_plot (x0 + rx, y0, mode); |
lcd_plot (x0 - rx, y0, mode); |
// while ( 2*ry2*x < 2*rx2*y ) { we can use ddF_x and ddF_y |
while (ddF_x < ddF_y) |
{ |
if(F >= 0) |
{ |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F -= ddF_y; |
} |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x + ry2; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
F = round (ry2 * (x + 0.5) * (x + 0.5) + rx2 * (y - 1) * (y - 1) - rx2 * ry2); |
while(y > 0) |
{ |
if(F <= 0) |
{ |
x += 1; // east |
ddF_x += 2 * ry2; |
F += ddF_x; |
} |
y -= 1; // south |
ddF_y -= 2 * rx2; |
F += rx2 - ddF_y; |
lcd_plot (x0 + x, y0 + y, mode); |
lcd_plot (x0 + x, y0 - y, mode); |
lcd_plot (x0 - x, y0 + y, mode); |
lcd_plot (x0 - x, y0 - y, mode); |
} |
} |
//----------------------------------------------------------- |
// |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode) |
{ |
lcd_ellipse (x0, y0, radius + 3, radius, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode) |
{ |
lcd_ellipse_line(x, y, r + 3, r, deg, mode); |
} |
//----------------------------------------------------------- |
// |
void lcd_view_font (uint8_t page) |
{ |
int x; |
int y; |
lcd_cls (); |
lcd_printp (PSTR(" 0123456789ABCDEF\r\n"), 0); |
lcd_printpns_at (0, 7, PSTR(" \x1a \x1b Exit"), 0); |
lcd_ypos = 2; |
for (y = page * 4 ; y < (page * 4 + 4); y++) |
{ |
if (y < 10) |
{ |
lcd_putc (0, lcd_ypos, '0' + y, 0); |
} |
else |
{ |
lcd_putc (0, lcd_ypos, 'A' + y - 10, 0); |
} |
lcd_xpos = 2; |
for (x = 0; x < 16; x++) |
{ |
lcd_putc (lcd_xpos, lcd_ypos, y * 16 + x, 0); |
lcd_xpos++; |
} |
lcd_ypos++; |
} |
} |
//----------------------------------------------------------- |
uint8_t hdigit (uint8_t d) |
{ |
if (d < 10) |
{ |
return '0' + d; |
} |
else |
{ |
return 'A' + d - 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos, lcd_ypos, hdigit (h & 0x0f), mode); |
} |
//----------------------------------------------------------- |
void lcd_print_hex (uint8_t h, uint8_t mode) |
{ |
// lcd_xpos = x; |
// lcd_ypos = y; |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h >> 4), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, hdigit (h & 0x0f), mode); |
lcd_putc (lcd_xpos++, lcd_ypos, ' ', mode); |
} |
//----------------------------------------------------------- |
void lcd_write_number_u (uint8_t number) |
{ |
uint8_t num = 100; |
uint8_t started = 0; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if (b > 0 || started || num == 1) |
{ |
lcd_putc (lcd_xpos++, lcd_ypos, '0' + b, 0); |
started = 1; |
} |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number) |
{ |
lcd_xpos = x; |
lcd_ypos = y; |
lcd_write_number_u (number); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) |
{ |
char s[7]; |
utoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', 0); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
} |
lcd_print_at(x, y, (uint8_t*)s, 0); |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) |
{ |
char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', 0); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
} |
lcd_print_at(x, y, (uint8_t*)s, 0); |
} |
//----------------------------------------------------------- |
// Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) |
{ |
char s[7]; |
itoa(number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', 0); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcd_putc (x-1, y, '0', 0); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcd_putc (x-1, y, '-', 0); |
lcd_putc (x, y, '0', 0); |
} |
else |
{ |
lcd_print_at(x, y, (uint8_t*)s, 0); |
} |
x += len - 1; |
lcd_putc (x++, y, '.', 0); |
lcd_putc (x++, y, rest, 0); |
} |
//----------------------------------------------------------- |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) |
{ |
uint8_t num = 100; |
while (num > 0) |
{ |
uint8_t b = number / num; |
if ((num / 10) == 1) |
{ |
lcd_putc (x++, y, '.', 0); |
} |
lcd_putc (x++, y, '0' + b, 0); |
number -= b * num; |
num /= 10; |
} |
} |
//----------------------------------------------------------- |
// Write only some digits of a signed <number> at <x>/<y> to MAX7456 display memory |
// as /10th of the value |
// <num> represents the largest multiple of 10 that will still be displayable as |
// the first digit, so num = 10 will be 0-99 and so on |
// <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
// |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) |
{ |
char s[7]; |
itoa (number, s, 10 ); |
uint8_t len = strlen(s); |
if (length < len) |
{ |
for (uint8_t i = 0; i < length; i++) |
{ |
lcd_putc (x++, y, '*', 0); |
} |
return; |
} |
for (uint8_t i = 0; i < length - len; i++) |
{ |
if (pad) |
{ |
lcd_putc (x++, y, '0', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
} |
char rest = s[len - 1]; |
s[len - 1] = 0; |
if (len == 1) |
{ |
lcd_putc (x-1, y, '0', 0); |
} |
else if (len == 2 && s[0] == '-') |
{ |
lcd_putc (x-1, y, '-', 0); |
lcd_putc (x, y, '0', 0); |
} |
else |
{ |
lcd_print_at(x, y, (uint8_t*)s, 0); |
} |
x += len - 1; |
lcd_putc (x++, y, '.', 0); |
lcd_putc (x++, y, rest, 0); |
} |
//----------------------------------------------------------- |
// write <seconds> as human readable time at <x>/<y> to MAX7456 display mem |
// |
void write_time (uint8_t x, uint8_t y, uint16_t seconds) |
{ |
uint16_t min = seconds / 60; |
seconds -= min * 60; |
write_ndigit_number_u (x, y, min, 2, 0); |
lcd_putc (x + 2, y, ':', 0); |
write_ndigit_number_u (x + 3, y, seconds, 2, 1); |
} |
//----------------------------------------------------------- |
// wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
// |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position) |
{ |
if (position < 0) |
{ |
position ^= ~0; |
position++; |
lcd_putc (x++, y, '-', 0); |
} |
else |
{ |
lcd_putc (x++, y, ' ', 0); |
} |
write_ndigit_number_u (x, y, (uint16_t) (position / (int32_t) 10000000), 3, 1); |
lcd_putc (x + 3, y, '.', 0); |
position = position - ((position / (int32_t) 10000000) * (int32_t) 10000000); |
write_ndigit_number_u (x + 4, y, (uint16_t) (position / (int32_t) 1000), 4, 1); |
position = position - ((uint16_t) (position / (int32_t) 1000) * (int32_t) 1000); |
write_ndigit_number_u (x + 8, y, (uint16_t) position, 3, 1); |
lcd_putc (x + 11, y, 0x1e, 0); // degree symbol |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/lcd.h |
---|
0,0 → 1,273 |
/***************************************************************************** |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* - original LCD control by Thomas "thkais" Kaiser * |
* - special number formating routines taken from C-OSD * |
* from Claas Anders "CaScAdE" Rathje * |
* - some extension, ellipse and circ_line by Peter "woggle" Mack * |
* Thanks to Oliver Schwaneberg for adding several functions to this library!* |
* * |
* Author: Jan Michel (jan at mueschelsoft dot de) * |
* License: GNU General Public License, version 3 * |
* Version: v0.93 September 2010 * |
* * |
* 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. * |
* * |
*****************************************************************************/ |
#ifndef _LCD_H |
#define _LCD_H |
/* |
//----------------------------------------------------------------------------- |
// Command Codes |
//----------------------------------------------------------------------------- |
//1: Display on/off |
#define LCD_DISPLAY_ON 0xAF //switch display on |
#define LCD_DISPLAY_OFF 0xAE //switch display off |
//2: display start line set (lower 6 bits select first line on lcd from 64 lines in memory) |
#define LCD_START_LINE 0x40 |
//3: Page address set (lower 4 bits select one of 8 pages) |
#define LCD_PAGE_ADDRESS 0xB0 |
//4: column address (lower 4 bits are upper / lower nibble of column address) |
#define LCD_COL_ADDRESS_MSB 0x10 |
#define LCD_COL_ADDRESS_LSB 0x00 //second part of column address |
//8: select orientation (black side of the display should be further away from viewer) |
#define LCD_BOTTOMVIEW 0xA1 //6 o'clock view |
#define LCD_TOPVIEW 0xA0 //12 o'clock view |
//9: select normal (white background, black pixels) or reverse (black background, white pixels) mode |
#define LCD_DISPLAY_POSITIVE 0xA6 //not inverted mode |
#define LCD_DISPLAY_INVERTED 0xA7 //inverted display |
//10: show memory content or switch all pixels on |
#define LCD_SHOW_NORMAL 0xA4 //show dram content |
#define LCD_SHOW_ALL_POINTS 0xA5 //show all points |
//11: lcd bias set |
#define LCD_BIAS_1_9 0xA2 |
#define LCD_BIAS_1_7 0xA3 |
//14: Reset Controller |
#define LCD_RESET_CMD 0xE2 |
//15: output mode select (turns display upside-down) |
#define LCD_SCAN_DIR_NORMAL 0xC0 //normal scan direction |
#define LCD_SCAN_DIR_REVERSE 0xC8 //reversed scan direction |
//16: power control set (lower 3 bits select operating mode) |
//Bit 0: Voltage follower on/off - Bit 1: Voltage regulator on/off - Bit 2: Booster circuit on/off |
#define LCD_POWER_CONTROL 0x28 //base command |
#define LCD_POWER_LOW_POWER 0x2F |
#define LCD_POWER_WIDE_RANGE 0x2F |
#define LCD_POWER_LOW_VOLTAGE 0x2B |
//17: voltage regulator resistor ratio set (lower 3 bits select ratio) |
//selects lcd voltage - 000 is low (~ -2V), 111 is high (~ - 10V), also depending on volume mode. Datasheet suggests 011 |
#define LCD_VOLTAGE 0x20 |
//18: Volume mode set (2-byte command, lower 6 bits in second word select value, datasheet suggests 0x1F) |
#define LCD_VOLUME_MODE_1 0x81 |
#define LCD_VOLUME_MODE_2 0x00 |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
//19: static indicator (2-byte command), first on/off, then blinking mode |
#define LCD_INDICATOR_ON 0xAD //static indicator on |
#define LCD_INDICATOR_OFF 0xAC //static indicator off |
#define LCD_INDICATOR_MODE_OFF 0x00 |
#define LCD_INDICATOR_MODE_1HZ 0x01 |
#define LCD_INDICATOR_MODE_2HZ 0x10 |
#define LCD_INDICATOR_MODE_ON 0x11 |
//20: booster ratio set (2-byte command) |
#define LCD_BOOSTER_SET 0xF8 //set booster ratio |
#define LCD_BOOSTER_234 0x00 //2x-4x |
#define LCD_BOOSTER_5 0x01 //5x |
#define LCD_BOOSTER_6 0x03 //6x |
//#endif |
//22: NOP command |
#define LCD_NOP 0xE3 |
//#if DISPLAY_TYPE == 102 |
////25: advanced program control |
//#define LCD_ADV_PROG_CTRL 0xFA |
//#define LCD_ADV_PROG_CTRL2 0x10 |
//#endif |
//----------------------------------------------------------------------------- |
// Makros to execute commands |
//----------------------------------------------------------------------------- |
#define LCD_SWITCH_ON() lcd_command(LCD_DISPLAY_ON) |
#define LCD_SWITCH_OFF() lcd_command(LCD_DISPLAY_OFF) |
#define LCD_SET_FIRST_LINE(i) lcd_command(LCD_START_LINE | ((i) & 0x3F)) |
#define LCD_SET_PAGE_ADDR(i) lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x0F)) |
#define LCD_SET_COLUMN_ADDR(i) lcd_command(LCD_COL_ADDRESS_MSB | ((i>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((i) & 0x0F)) |
#define LCD_GOTO_ADDRESS(page,col); lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_MSB | ((col>>4) & 0x0F)); \ |
lcd_command(LCD_COL_ADDRESS_LSB | ((col) & 0x0F)); |
#define LCD_SET_BOTTOM_VIEW() lcd_command(LCD_BOTTOMVIEW) |
#define LCD_SET_TOP_VIEW() lcd_command(LCD_TOPVIEW) |
#define LCD_SET_MODE_POSITIVE() lcd_command(LCD_DISPLAY_POSITIVE) |
#define LCD_SET_MODE_INVERTED() lcd_command(LCD_DISPLAY_INVERTED) |
#define LCD_SHOW_ALL_PIXELS_ON() lcd_command(LCD_SHOW_ALL_POINTS) |
#define LCD_SHOW_ALL_PIXELS_OFF() lcd_command(LCD_SHOW_NORMAL) |
#define LCD_SET_BIAS_RATIO_1_7() lcd_command(LCD_BIAS_1_7) |
#define LCD_SET_BIAS_RATIO_1_9() lcd_command(LCD_BIAS_1_9) |
#define LCD_SEND_RESET() lcd_command(LCD_RESET_CMD) |
#define LCD_ORIENTATION_NORMAL() lcd_command(LCD_SCAN_DIR_NORMAL) |
#define LCD_ORIENTATION_UPSIDEDOWN() lcd_command(LCD_SCAN_DIR_REVERSE) |
#define LCD_SET_POWER_CONTROL(i) lcd_command(LCD_POWER_CONTROL | ((i) & 0x07)) |
#define LCD_SET_LOW_POWER() lcd_command(LCD_POWER_LOW_POWER) |
#define LCD_SET_WIDE_RANGE() lcd_command(LCD_POWER_WIDE_RANGE) |
#define LCD_SET_LOW_VOLTAGE() lcd_command(LCD_POWER_LOW_VOLTAGE) |
#define LCD_SET_BIAS_VOLTAGE(i) lcd_command(LCD_VOLTAGE | ((i) & 0x07)) |
#define LCD_SET_VOLUME_MODE(i) lcd_command(LCD_VOLUME_MODE_1); \ |
lcd_command(LCD_VOLUME_MODE_2 | ((i) & 0x3F)) |
//#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 |
#define LCD_SET_INDICATOR_OFF() lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_INDICATOR_MODE_OFF) |
#define LCD_SET_INDICATOR_STATIC() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_ON) |
#define LCD_SET_INDICATOR_1HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_1HZ) |
#define LCD_SET_INDICATOR_2HZ() lcd_command(LCD_INDICATOR_ON); \ |
lcd_command(LCD_INDICATOR_MODE_2HZ) |
#define LCD_SET_INDICATOR(i,j) lcd_command(LCD_INDICATOR_OFF | ((i) & 1)); \ |
lcd_command(((j) & 2)) |
#define LCD_SLEEP_MODE lcd_command(LCD_INDICATOR_OFF); \ |
lcd_command(LCD_DISPLAY_OFF); \ |
lcd_command(LCD_SHOW_ALL_POINTS) |
//#endif |
//#if DISPLAY_TYPE == 102 |
//#define LCD_TEMPCOMP_HIGH 0x80 |
//#define LCD_COLWRAP 0x02 |
//#define LCD_PAGEWRAP 0x01 |
//#define LCD_SET_ADV_PROG_CTRL(i) lcd_command(LCD_ADV_PROG_CTRL); |
// lcd_command(LCD_ADV_PROG_CTRL2 & i) |
//#endif |
*/ |
extern volatile uint8_t LCD_ORIENTATION; |
//#define LCD_LINES 8 |
//#define LCD_COLS 21 |
extern uint8_t lcd_xpos; |
extern uint8_t lcd_ypos; |
void lcd_command(uint8_t cmd); |
void send_byte (uint8_t data); |
void LCD_Init (uint8_t LCD_Mode); |
void lcd_puts_at(uint8_t x, uint8_t y,const char *s, uint8_t mode ); |
void lcd_putc (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void send_byte (uint8_t data); |
void lcd_print (uint8_t *text, uint8_t mode); |
void lcd_print_at (uint8_t x, uint8_t y, uint8_t *text, uint8_t mode); |
void lcd_printp (const char *text, uint8_t mode); |
void lcd_printp_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_printpns (const char *text, uint8_t mode); |
void lcd_printpns_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_cls (void); |
void lcd_cls_line (uint8_t x, uint8_t y, uint8_t w); |
void print_display (uint8_t *text); |
void print_display_at (uint8_t x, uint8_t y, uint8_t *text); |
void copy_line (uint8_t y); |
void paste_line (uint8_t y); |
// Jeti |
void lcd_putc_jeti (uint8_t x, uint8_t y, uint8_t c, uint8_t mode); |
void lcd_printpj (const char *text, uint8_t mode); |
void lcd_printpj_at (uint8_t x, uint8_t y, const char *text, uint8_t mode); |
void lcd_plot (uint8_t x, uint8_t y, uint8_t mode); |
void lcd_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uint8_t mode); |
void lcd_rect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_frect (uint8_t x1, uint8_t y1, uint8_t widthx, uint8_t widthy, uint8_t mode); |
void lcd_circle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_fcircle (int16_t x0, int16_t y0, int16_t radius); |
void lcd_circ_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_ellipse (int16_t x0, int16_t y0, int16_t rx, int16_t ry, uint8_t mode); |
void lcd_ellipse_line (uint8_t x, uint8_t y, uint8_t rx, uint8_t ry, uint16_t deg, uint8_t mode); |
void lcd_ecircle (int16_t x0, int16_t y0, int16_t radius, uint8_t mode); |
void lcd_ecirc_line (uint8_t x, uint8_t y, uint8_t r, uint16_t deg, uint8_t mode); |
void lcd_view_font (uint8_t page); |
void lcd_print_hex_at (uint8_t x, uint8_t y, uint8_t h, uint8_t mode); |
void lcd_write_number_u (uint8_t number); |
void lcd_write_number_u_at (uint8_t x, uint8_t y, uint8_t number); |
void lcd_print_hex (uint8_t h, uint8_t mode); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_u (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a signed <number> at <x>/<y> |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_s (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_10th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> as /100th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_u_100th (uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad); |
/** |
* Write only some digits of a signed <number> at <x>/<y> as /10th of the value |
* <length> represents the length to rightbound the number |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 00.7 instead of .7 |
*/ |
void write_ndigit_number_s_10th (uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad); |
/** |
* write <seconds> as human readable time at <x>/<y> |
*/ |
void write_time (uint8_t x, uint8_t y, uint16_t seconds); |
/** |
* wirte a <position> at <x>/<y> assuming it is a gps position for long-/latitude |
*/ |
void write_gps_pos (uint8_t x, uint8_t y, int32_t position); |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/lipo.c |
---|
0,0 → 1,149 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* based on the key handling by Peter Dannegger * |
* see www.mikrocontroller.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 <util/delay.h> |
#include <avr/interrupt.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include "lcd.h" |
#include "lipo.h" |
#include "eeprom.h" |
// Global variables |
double accumulator = 0; //!< Accumulated 10-bit samples |
double Vin = 0; //!< 16-bit float number result |
short temp = 0; //!< Temporary variable |
short samples = 0; //!< Number of conversions |
uint16_t volt_avg = 0; |
//! ADC interrupt routine |
ISR (ADC_vect) |
{ |
accumulator += ADCW; |
samples++; |
if(samples>4095) |
{ |
oversampled(); |
} |
} |
//-------------------------------------------------------------- |
// |
void ADC_Init (void) |
{ |
ADMUX = (0<<REFS1) | (1<<REFS0); // externe 5V Referenzspannung nutzen |
ADMUX = (ADMUX & ~(0x1F)) | (1 & 0x1F); // ADC1 verwenden |
ADCSRA = (1<<ADEN)|(1<<ADIE)|(1<<ADSC)|(1<<ADATE)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); // Prescaler 128, Freilaufend, Interrupte frei |
} |
/*! Error compensation, Scaling 16-bit result, Rounding up |
, Calculate 16-bit result, Resets variables |
Quelle AVR121: Enhancing ADC resolution by versampling |
*/ |
void oversampled(void) |
{ |
cli(); |
accumulator += Lipo_UOffset; //5150 Offset error compensation |
// accumulator *= 0.9993; // Gain error compensation |
accumulator *= 0.9600; //0.9800 Gain error compensation |
temp=(int)accumulator%64; |
accumulator/=64; // Scaling the answer |
if(temp>=32) |
{ |
accumulator += 1; // Round up |
} |
// Vin = (accumulator/65536)*4.910; // Calculating 16-bit result |
Vin =accumulator/7.5; |
volt_avg = Vin; |
// write_ndigit_number_u(0, 3, Vin, 5, 0); |
// write_ndigit_number_u(0, 4, volt_avg, 5, 0); |
samples = 0; |
accumulator = 0; |
sei(); |
} |
void show_Lipo(void) |
{ |
uint16_t Balken = 0; |
lcd_rect(103,2,1,3,1); |
if (volt_avg < 320) |
{ |
Balken = 0; |
lcd_frect(106 + Balken-1, 2, 19-Balken, 3, 0); // löschen |
} |
if (PKT_Accutyp == true) //LiPO Akku |
{ |
lcd_rect(104, 0, 23, 7, 1); // Rahmen |
if (volt_avg >= 420) Balken = 19; |
if ((volt_avg > 320) && (volt_avg < 420)) Balken = (volt_avg-320)/5; |
lcd_frect(106 + Balken+1, 2, 19-Balken, 3, 0); // löschen |
} |
if (PKT_Accutyp == false) // LiON Akku |
{ |
lcd_rect(104, 0, 22, 7, 1); // Rahmen |
if (volt_avg >= 410) Balken = 18; |
if ((volt_avg > 320) && (volt_avg < 410)) Balken = ((volt_avg-320)/5); |
lcd_frect(106 + Balken+1, 2, 18-Balken, 3, 0); // löschen |
} |
if (Balken > 0) lcd_frect(106, 2, Balken, 3, 1); // Füllung |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/lipo.h |
---|
0,0 → 1,50 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009 Peter "woggle" Mack, mac@denich.net * |
* based on the key handling by Peter Dannegger * |
* see www.mikrocontroller.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 _LIPO_H |
#define _LIPO_H |
short samples; //!< Number of conversions |
double Vin; |
double accumulator; |
uint16_t volt_avg; |
void ADC_Init (void); |
void oversampled(void); |
void show_Lipo(void); |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/main.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 <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include <util/delay.h> |
#include <avr/eeprom.h> |
//************************************************************************************ |
// Watchdog integrieren und abschalten, wird für Bootloader benötigt |
// !!muss hier stehen bleiben!! |
//-------------------------------------------------------------- |
void wdt_init(void) __attribute__((naked)) __attribute__((section(".init1"))); |
//-------------------------------------------------------------- |
void wdt_init(void) |
{ |
MCUSR = 0; |
wdt_disable(); |
return; |
} |
//************************************************************************************ |
// erst ab hier weitere #includes |
#include "lipo.h" |
#include "main.h" |
#include "lcd.h" |
#include "usart.h" |
#include "uart1.h" |
#include "mk-data-structs.h" |
#include "parameter.h" |
#include "menu.h" |
#include "display.h" |
#include "timer.h" |
#include "eeprom.h" |
#include "Wi232.h" |
#include "twimaster.h" |
#include "messages.h" |
//#define MTEST 0 // Menu Test (skip FC/NC detection) |
Version_t *version; |
volatile uint8_t mode = 0; |
uint8_t hardware = 0; |
uint8_t current_hardware = 0; |
mk_param_struct_t *mk_param_struct; |
//-------------------------------------------------------------- |
int main (void) |
{ |
#ifndef DEBUG |
uint8_t timeout; |
uint8_t val =0; |
uint8_t spalte =0; |
#endif |
InitHWPorts(); // Hardwareanhängige Ports konfigurieren |
// dafür wird je nach Hardware die HAL_HWxxx verwendet |
// Define dazu in der main.h |
hardware = NO; |
current_hardware = 0; |
if (PKT_StartInfo == true) |
{ |
lcd_cls (); |
// lcd_printp_at (0,0,PSTR("Portables Kopter Tool"), 0); |
lcd_puts_at(0, 0, strGet(START_MSG1), 0); |
lcd_puts_at(0, 1, strGet(START_MSG2), 0); |
// lcd_printp_at (0,1,PSTR("für FC Ver "), 0); |
// lcd_printp_at (11,1,PSTR(FC_Version),0); |
// lcd_printp_at (0,3,PSTR("GNU GPL License"), 0); |
lcd_puts_at(0, 3, strGet(GNU_GPL), 0); |
#ifdef HWVERSION1_2 |
// lcd_printp_at (0,4,PSTR("Hardware 1.2"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644"), 0); |
lcd_puts_at(0, 4, strGet(HW12), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644), 0); |
#endif |
#ifdef HWVERSION1_2W |
// lcd_printp_at (0,4,PSTR("Hardware 1.2W"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644"), 0); |
lcd_puts_at(0, 4, strGet(HW12W), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644), 0); |
#endif |
#ifdef HWVERSION1_3 |
// lcd_printp_at (0,4,PSTR("Hardware 1.3"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644P"), 0); |
lcd_puts_at(0, 4, strGet(HW13), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644P), 0); |
#endif |
#ifdef HWVERSION1_3W |
// lcd_printp_at (0,4,PSTR("Hardware 1.3W"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 644P"), 0); |
lcd_puts_at(0, 4, strGet(HW13W), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA644P), 0); |
#endif |
#ifdef HWVERSION3_9 |
// lcd_printp_at (0,4,PSTR("Hardware 3.9"), 0); |
// lcd_printp_at (0,5,PSTR("ATmega 1284P"), 0); |
lcd_puts_at(0, 4, strGet(HW39), 0); |
lcd_puts_at(0, 5, strGet(ATMEGA1284P), 0); |
#endif |
_delay_ms(1500); |
} |
#ifndef DEBUG |
ReadLastPosition (); |
if (LastLongitude>0x00000000 && LastLatitude>0x00000000) |
{ |
// lcd_printp_at (0, 4, PSTR(" Letzte Position "), 2); |
// lcd_printp_at (0, 5, PSTR(" Breitengr Längengr "), 2); |
// lcd_printp_at (0, 7, PSTR("löschen weiter"), 0); |
lcd_puts_at(0, 4, strGet(START_LASTPOS), 2); |
lcd_puts_at(0, 5, strGet(START_LASTPOS1), 3); |
lcd_puts_at(0, 7, strGet(START_LASTPOS2), 0); |
write_ndigit_number_u (1, 6, (uint16_t)(LastLongitude/10000000), 2, 0); |
lcd_printp_at (3, 6, PSTR("."), 0); |
write_ndigit_number_u (4, 6, (uint16_t)((LastLongitude/1000) % 10000), 4, 1); |
write_ndigit_number_u (8, 6, (uint16_t)((LastLongitude/10) % 100), 2, 1); |
write_ndigit_number_u (12, 6, (uint16_t)(LastLatitude/10000000), 2, 0); |
lcd_printp_at (14, 6, PSTR("."), 0); |
write_ndigit_number_u (15, 6, (uint16_t)((LastLatitude/1000) % 10000), 4, 1); |
write_ndigit_number_u (19, 6, (uint16_t)((LastLatitude/10) % 100), 2, 1); |
for (;;) |
{ |
if (get_key_press (1 << KEY_MINUS)) |
{ |
WriteLastPosition(0x00000000,0x00000000); // Löschen |
lcd_frect (0, (8*4), 128, 8, 0); // Zeile löschen (x, y, l, h, in Pixel) |
lcd_frect (0, (8*5), 128, 8, 0); |
// lcd_printp_at (0,5,PSTR(" gelöscht "), 0); |
lcd_puts_at(0, 5, strGet(START_LASTPOSDEL), 0); |
lcd_cls_line (0, 6, 21); |
lcd_cls_line (0, 7, 21); |
_delay_ms(1000); |
break; |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
lcd_cls_line (0, 4, 21); |
lcd_cls_line (0, 5, 21); |
lcd_cls_line (0, 6, 21); |
lcd_cls_line (0, 7, 21); |
break; |
} |
} |
} |
#endif |
// switch to NC |
USART_putc (0x1b); |
USART_putc (0x1b); |
USART_putc (0x55); |
USART_putc (0xaa); |
USART_putc (0x00); |
mode = 'V'; |
#ifndef DEBUG |
do |
{ |
timeout = 50; |
lcd_cls(); |
// lcd_printp_at (0,4,PSTR("Suche FC..."), 0); |
// lcd_printp_at (12, 7, PSTR("Ende"), 0); |
lcd_puts_at(0, 4, strGet(START_SEARCHFC), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData('v', ADDRESS_ANY, 0); |
timer = 20; |
while (timer > 0); |
timeout--; |
if (spalte <= 20) |
{ |
lcd_printp_at (spalte,6,PSTR("?"),0); |
spalte++; |
} |
else |
{ |
lcd_cls_line (0,6,21); |
spalte=0; |
} |
if (get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
for (;;) |
{ |
Debug = 0; |
hardware = NO; |
main_menu (); |
} |
} |
} |
if(timeout == 0) |
{ |
// lcd_printp_at (0,5,PSTR("FC nicht gefunden!"), 0); |
lcd_puts_at(0, 5, strGet(START_FCNOTFOUND), 0); |
timer = 90; |
while (timer > 0); |
} |
} |
while(timeout == 0); |
if (timeout != 0) |
Decode64 (); |
version = (Version_t *) pRxData; |
if (PKT_StartInfo == true) |
{ |
lcd_cls (); |
// lcd_printp (PSTR("PKT-Tool GNU GPL\r\n"), 0); |
// lcd_printp (PSTR("gefunden:\r\n\n"), 0); |
lcd_puts_at(0, 0, strGet(START_FCFOUND), 0); |
lcd_puts_at(0, 1, strGet(START_FCFOUND1), 0); |
} |
if ((rxd_buffer[1] - 'a') == ADDRESS_FC) |
{ |
if (PKT_StartInfo == true) |
{ |
// lcd_printp (PSTR("Flight-Ctrl\r\n"), 0); |
lcd_puts_at(0, 1, strGet(START_FCFOUND2), 0); |
} |
hardware = FC; |
current_hardware = hardware; |
} |
else if ((rxd_buffer[1] - 'a') == ADDRESS_NC) |
{ |
if (PKT_StartInfo == true) |
{ |
// lcd_printp (PSTR("Navi-Ctrl\r\n"), 0); |
lcd_puts_at(0, 1, strGet(START_FCFOUND3), 0); |
} |
hardware = NC; |
current_hardware = hardware; |
} |
if (PKT_StartInfo == true) |
{ |
// lcd_printp (PSTR("Version: "), 0); |
lcd_puts_at(0, 2, strGet(START_VERSIONCHECK), 0); |
lcd_write_number_u (version->SWMajor); |
lcd_printp (PSTR("."), 0); |
lcd_write_number_u (version->SWMinor); |
lcd_putc (lcd_xpos, lcd_ypos, version->SWPatch + 'a', 0); |
_delay_ms(1500); |
} |
SwitchToFC(); |
#else |
if (PKT_StartInfo == true) |
{ |
lcd_cls (); |
lcd_printp (PSTR("PKT-Test DEBUG\r\n"), 0); |
_delay_ms(1500); |
} |
#endif |
#ifndef DEBUG |
// EEprom Version / Struktur prüfen |
// val = load_setting(1); // Parameterset 1 holen |
val = load_setting(0xff); // aktuelles Parameterset holen |
if (mk_param_struct->Revision != EEProm_Version) |
{ |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("EEPromRev.:"), 0); |
lcd_write_number_u (EEProm_Version); |
lcd_puts_at(0, 1, strGet(START_VERSIONCHECK1), 0); |
// lcd_printp (PSTR(" erwartet\r\n"), 0); |
lcd_printp_at (0, 1, PSTR("EEPromRev.:"), 0); |
lcd_write_number_u (mk_param_struct->Revision); |
lcd_puts_at(0, 2, strGet(START_VERSIONCHECK2), 0); |
// lcd_printp (PSTR(" gefunden\r\n"), 0); |
// lcd_printp (PSTR("PKT-Tool nur mit\r\n"), 0); |
// lcd_printp (PSTR("FC Software "), 0); |
lcd_puts_at(0, 3, strGet(START_VERSIONCHECK3), 0); |
lcd_puts_at(0, 4, strGet(START_VERSIONCHECK4), 0); |
lcd_printp (PSTR(FC_Version),0); |
// lcd_printp (PSTR("\r\nkompatibel"), 0); |
lcd_puts_at(0, 5, strGet(START_VERSIONCHECK5), 0); |
hardware = NO; |
BeepTime = 1500; |
BeepMuster = 0x0040; |
_delay_ms(4000); |
} |
#endif |
mode = 0; |
rxd_buffer_locked = FALSE; |
timer = 50; |
while (timer > 0); |
for (;;) |
{ |
main_menu (); |
} |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/main.h |
---|
0,0 → 1,107 |
/***************************************************************************** |
* 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 _MAIN_H |
#define _MAIN_H |
// Version der Software |
#define PKTSWVersion "3.5.8a" |
//#define DEBUG |
// Fusebits für Hardware 1.2 D7 DC FC |
// Fusebits für Hardware 1.3 |
// Fusebits für Hardware 3.x D7 DC FC |
// avrdude -pm1284p -cavr109 -P/dev/ttyUSB1 -b115200 -V -Uflash:w:Dateiname.hex:a |
// hier die entsprechende Hardwareversion der Leiterplatte einstellen |
//#define HWVERSION1_2 // Hardware sebseb7 |
//#define HWVERSION1_2W // Hardware sebseb7 mit Wi232 Support |
//#define HWVERSION1_3 // Hardware sebseb7 |
//#define HWVERSION1_3W // Hardware sebseb7 mit Wi232 Support |
//#define HWVERSION3_1 // Test Hardware Cebra Juni 2011 |
#define HWVERSION3_9 // Hardware Cebra Oktober 2011 ATmega1284P |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
#include "HAL_HW1_2.h" |
#endif |
#if defined HWVERSION1_3W || defined HWVERSION1_3 |
#include "HAL_HW1_3.h" |
#endif |
#ifdef HWVERSION3_9 |
#include "HAL_HW3_9.h" |
#endif |
#define NO 0 |
#define NC 1 |
#define FC 2 |
#define MK3MAG 3 |
#define MKGPS 4 |
#define Wi232 5 |
#define ENABLE_PWM |
// Menueleiste am unteren Rand definieren |
// |
// 11 <> Change |
// |
// 12 /\ Up 13 \/ Down 14 < Left 15 > Right |
// |
// 16 /|\ Arrow up 17 \|/ Arrow down 18 <- Arrow left 19 -> Arrow right |
// |
// 1A ^ Triangle up 1B v Triangle down 1C < Triangle left 1D > Triangle right |
// |
// "01 234567 8901234567890" |
// "|O |||||O |||||O|||||O|" |
// |
//#define KEY_LINE_1 " \x1a \x1b Ende OK" |
//#define KEY_LINE_2 " \x18 \x19 Ende OK" |
//#define KEY_LINE_3 " \x18 \x19 Ende" |
extern volatile uint8_t mode; |
extern uint8_t hardware; |
extern uint8_t current_hardware; |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/menu.c |
---|
0,0 → 1,639 |
/***************************************************************************** |
* 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 <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include <util/delay.h> |
#include "main.h" |
#include "lcd.h" |
#include "parameter.h" |
#include "menu.h" |
#include "messages.h" |
#include "display.h" |
#include "debug.h" |
#include "timer.h" |
#include "osd.h" |
#include "motortest.h" |
#include "gps.h" |
#include "eeprom.h" |
#include "setup.h" |
#include "uart1.h" |
#include "mk-data-structs.h" |
#include "Wi232.h" |
#include "servo.h" |
#include "tools.h" |
#include "connect.h" |
#include "lipo.h" |
#include "messages.h" |
#define ITEMS_NC 7 |
prog_char param_menuitems_nc[ITEMS_NC][NUM_LANG][18]= // zeilen,zeichen+1 |
// German, English, French, Netherlands |
{ |
{"OSD ","OSD ","OSD ","OSD "}, |
{"3D Lage ","3D angeles ","3D location ","3D locatie "}, |
{"MK Display ","MK Display ","MK Display ","MK Display "}, |
{"Parameter \x1d","Parameter \x1d","Parameter \x1d","Parameters \x1d"}, |
{"Debug Data ","Debug Data ","Debug Data ","Debug Data "}, |
{"GPS Info ","GPS Info ","GPS Info ","GPS Info "}, |
{"PKT Tools \x1d","PKT Tools \x1d","PKT Tools \x1d","PKT Tools \x1d"}, |
}; |
#define ITEMS_FC 4 |
prog_char param_menuitems_fc[ITEMS_FC][NUM_LANG][18]= // zeilen,zeichen+1 |
{ |
{"MK Display ","MK Display ","MK Display ","MK Display "}, |
{"Parameter \x1d","Parameter \x1d","Parameter \x1d","Parameter \x1d"}, |
{"Debug Data ","Debug Data ","Debug Data ","Debug Data "}, |
{"PKT Tools \x1d","PKT Tools \x1d","PKT Tools \x1d","PKT Tools \x1d"}, |
}; |
#define ITEMS_NO 6 |
prog_char param_menuitems_no[ITEMS_NO][NUM_LANG][18]= // zeilen,zeichen+1 |
{ |
{"BL-Ctrl. Tester ","BL-Ctrl. Tester ","BL-Ctrl. Tester ","BL-Ctrl. Tester "}, |
{"Servo Tester ","Servo Tester ","Servo Tester ","Servo Tester "}, |
{"PC BT > Kopter ","PC BT > Kopter ","PC BT > Kopter ","PC BT > Kopter "}, |
{"PC USB > Kopter ","PC USB > Kopter ","PC USB > Kopter ","PC USB > Kopter "}, |
{"PKT Setup \x1d","PKT Setup \x1d","PKT Setup \x1d","PKT Setup \x1d"}, |
{"PKT Version ","PKT Version ","PKT Version ","PKT Versie "}, |
}; |
#define ITEMS_CR 9 |
prog_char param_copyright[ITEMS_CR][22]= // zeilen,zeichen+1 |
{ |
" ", |
"(C) GNU GPL License ", |
" NO WARRANTY ", |
" ", |
"2008 Thomas Kaiser ", |
"2009-2010 Peter Mack ", |
"2010 Sebastian Boehm ", |
"2011 Chr. Brandtner &", |
" Harald Bongartz ", |
}; |
//-------------------------------------------------------------- |
// print cursor |
void menu_set_cursor (uint8_t before, uint8_t line, uint8_t pos) |
{ |
lcd_printp_at (pos, before, PSTR(" "), 0); |
lcd_printp_at (pos, line, PSTR("\x1d"), 0); |
} |
// F�r Seting-Auswahl ------------------------------------------ |
// |
uint8_t menu_choose (uint8_t min, uint8_t max, uint8_t pos, uint8_t start) |
{ |
uint8_t line = start; |
uint8_t before = start; |
uint8_t k; |
menu_set_cursor (line, line, pos); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if (line < max) |
line ++; |
else |
line = max; |
// line = min; // Wenn wiederholen soll |
} |
if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if (line > min) |
line --; |
else |
line = min; |
// line = max; // Wenn wiederholen soll |
} |
if (line != before) |
{ |
menu_set_cursor (before, line, pos); |
before = line; |
} |
} |
while (!(k = get_key_press ((1 << KEY_ENTER) | (1 << KEY_ESC)))); |
if (k & (1 << KEY_ESC)) |
line = 255; |
return line; |
} |
// F�r Setup und Parameter ------------------------------------------ |
// |
uint8_t menu_choose2 (uint8_t min, uint8_t max, uint8_t start, uint8_t return_at_start, uint8_t return_at_end) |
{ |
uint8_t pos = 1; |
uint8_t line = start; |
uint8_t before = start; |
uint8_t k; |
menu_set_cursor (line, line, pos); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if (line < max) |
line ++; |
else |
{ |
if(return_at_end == 1) |
return 254; |
else |
line = max; |
// line = min; // Wenn wiederholen soll |
} |
} |
if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if (line > min) |
line --; |
else |
{ |
if(return_at_start == 1) |
return 253; |
else |
line = min; |
// line = max; // Wenn wiederholen soll |
} |
} |
if (line != before) |
{ |
menu_set_cursor (before, line, pos); |
before = line; |
} |
} |
while (!(k = get_key_press ((1 << KEY_ENTER) | (1 << KEY_ESC)))); |
if (k & (1 << KEY_ESC)) |
line = 255; |
return line; |
} |
// F�r das Hauptmenue ------------------------------------------ |
// |
uint8_t menu_choose3 (uint8_t min, uint8_t max,uint8_t start, uint8_t return_at_start, uint8_t return_at_end) |
{ |
uint8_t pos = 1; |
uint8_t line = start; |
uint8_t before = start; |
menu_set_cursor (line, line, pos); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if (line < max) |
line ++; |
else |
{ |
if(return_at_end == 1) |
return 254; |
else |
line = max; |
// line = min; // Wenn wiederholen soll |
} |
} |
if (get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if (line > min) |
line --; |
else |
{ |
if(return_at_start == 1) |
return 253; |
else |
line = min; |
// line = max; // Wenn wiederholen soll |
} |
} |
if (get_key_long (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return 250; |
} |
if(get_key_long (1 << KEY_ENTER)) |
{ |
get_key_press(KEY_ALL); |
return 251; |
} |
if (get_key_short (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return 252; |
} |
if (line != before) |
{ |
menu_set_cursor (before, line, pos); |
before = line; |
} |
show_Lipo(); |
} |
while (!(get_key_short (1 << KEY_ENTER))); |
return line; |
} |
//-------------------------------------------------------------- |
// |
void main_menu (void) |
{ |
uint8_t ii = 0; |
uint8_t offset = 0; |
uint8_t size = 0; |
uint8_t Save_hardware = 0; |
uint8_t dmode = 0; |
uint8_t target_pos = 1; |
uint8_t val =0; |
Save_hardware = hardware; |
get_key_press(KEY_ALL); |
while(1) |
{ |
if (Debug==1) |
hardware = NC; |
if (Debug==0) |
hardware = Save_hardware; |
if(hardware == NO) |
size = ITEMS_NO ; |
if(hardware == NC) |
size = ITEMS_NC ; |
if(hardware == FC) |
size = ITEMS_FC ; |
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("PKT-Tool FC "), 2); |
lcd_printp_at (12, 0, PSTR(FC_Version), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// lcd_printp_at (12, 7, PSTR("Aus "), 0); |
lcd_puts_at(12, 7, strGet(OFF), 0); |
while(2) |
{ |
ii = 0; |
if(offset > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
{ |
if(hardware == NC) |
lcd_printp_at(3,ii+1,param_menuitems_nc[ii+offset][DisplayLanguage], 0); |
else if(hardware == FC) |
lcd_printp_at(3,ii+1,param_menuitems_fc[ii+offset][DisplayLanguage], 0); |
else |
lcd_printp_at(3,ii+1,param_menuitems_no[ii+offset][DisplayLanguage], 0); |
} |
if((ii == 5)&&(ii+offset < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
show_Lipo(); |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
val = menu_choose3 (1, 5, target_pos,0,1); //menu_choose3 (min, max, start, return_at_start, return_at_end) |
else |
val = menu_choose3 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
val = menu_choose3 (2, 6, target_pos,1,0); |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(val == 254) |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
#if defined HWVERSION3_9 |
else if(val == 252) |
{ |
lcd_cls(); |
// lcd_printp_at (0, 2, PSTR(" PKT ausschalten?"),0); |
lcd_puts_at(0, 2, strGet(SHUTDOWN), 0); |
// lcd_printp_at (12, 7, PSTR("Nein Ja"),0); |
lcd_puts_at(12, 7, strGet(YESNO), 0); |
while(1) |
{ |
if (get_key_press (1 << KEY_ENTER)) |
clr_V_On(); // Spannung abschalten |
if (get_key_short (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR("PKT-Tool FC "), 2); |
lcd_printp_at (12, 0,PSTR(FC_Version), 2); |
// show_Lipo(); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
// lcd_printp_at (12, 7, PSTR("Aus "), 0); |
lcd_puts_at(12, 7, strGet(OFF), 0); |
break; |
} |
} |
} |
else if(val == 251) |
{ |
PC_Fast_Connect(); |
return; |
} |
#endif |
else if(val == 250) |
{ |
// Test_HB(); |
Test_Language(); |
return; |
} |
else |
break; |
} |
target_pos = val; |
if(hardware == NC) |
{ |
if((val+offset) == 1 ) |
osd(OSD_Mode); |
if((val+offset) == 2 ) |
osd(THREE_D_Mode); |
if((val+offset) == 3 ) |
display_data(); |
if((val+offset) == 4 ) |
edit_parameter(); |
if((val+offset) == 5 ) |
display_debug(); |
if((val+offset) == 6 ) |
gps(); |
if((val+offset) == 7 ) |
PKT_Tools(); |
} |
if(hardware == FC) |
{ |
if((val+offset) == 1 ) |
display_data(); |
if((val+offset) == 2 ) |
edit_parameter(); |
if((val+offset) == 3 ) |
display_debug(); |
if((val+offset) == 4 ) |
PKT_Tools(); |
} |
if(hardware == NO) |
{ |
if((val+offset) == 1 ) |
motor_test(FC_Mode); |
if((val+offset) == 2 ) |
servo_test(); |
#ifdef HWVERSION3_9 |
if (U02SV2 == 0) |
{ |
if((val+offset) == 3 ) |
Port_BT2Wi(); |
if((val+offset) == 4 ) |
Port_USB2Wi(); |
} |
else if (U02SV2 == 1) |
{ |
if((val+offset) == 3 ) |
Port_BT2FC(); |
if((val+offset) == 4 ) |
Port_USB2FC(); |
} |
#else |
if((val+offset) == 3 ) |
Show_Error_HW(); |
if((val+offset) == 4 ) |
Show_Error_HW(); |
#endif |
if((val+offset) == 5 ) |
PKT_Setup(); |
if((val+offset) == 6 ) |
Show_Version(); |
} |
} |
} |
//-------------------------------------------------------------- |
// |
void Update_PKT (void) |
{ |
lcd_cls(); |
lcd_printp_at (0, 0, PSTR(" PKT Update "),2); |
// lcd_printp_at (0, 1, PSTR("Connect PC to PKT-USB"),0); |
lcd_puts_at(0, 1, strGet(UPDATE1), 0); |
// lcd_printp_at (0, 2, PSTR("Press 'Start' on PKT "),0); |
lcd_puts_at(0, 2, strGet(UPDATE2), 0); |
lcd_printp_at (0, 3, PSTR("Start avrdude.exe "),0); |
lcd_printp_at (0, 4, PSTR("-pm1284p -cavr109 "),0); |
lcd_printp_at (0, 5, PSTR("-Pcom? -b115200 "),0); |
lcd_printp_at (0, 6, PSTR("-Uflash:w:FILE.hex:a "),0); |
// avrdude -pm1284p -cavr109 -P/dev/ttyUSB1 -b115200 -V -Uflash:w:Dateiname.hex:a |
// lcd_printp_at (0, 7, PSTR(" Ende Start"), 0); |
lcd_puts_at(0, 7, strGet(ENDSTART), 0); |
do |
{ |
if (get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
while (!(get_key_press (1 << KEY_ENTER))); |
{ |
// start bootloader with Reset, Hold KEY_ENTER*/ |
wdt_enable( WDTO_250MS ); |
while (1) |
{;} |
} |
} |
//-------------------------------------------------------------- |
// |
void Show_Error_HW (void) |
{ |
lcd_cls (); |
lcd_printp_at (0, 2, PSTR(" Mit dieser Hardware"), 0); |
lcd_printp_at (0, 3, PSTR(" nicht möglich!"), 0); |
lcd_printp_at (12, 7, PSTR("Ende"), 0); |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
return; |
} |
//-------------------------------------------------------------- |
// |
void Show_Version (void) |
{ |
uint8_t ii = 0; |
uint8_t size = ITEMS_CR; |
uint8_t page = 0; |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR("PKT Tool ver "), 2); |
// lcd_printp_at (13,0, PSTR(PKTSWVersion),2); |
// lcdPuts(Msg(MSG_VERSION1)); |
// lcd_printp_at (0, 0, Msg(MSG_VERSION1), 2); |
// lcd_printp_at (0, 1, PSTR("für FC ver "), 2); |
// lcd_printp_at (12,1, PSTR(FC_Version),2); |
lcd_puts_at(0, 1, strGet(START_MSG2), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
while(1) |
{ |
for(ii = 0;ii < 3 ; ii++) |
if((ii + page) < size) |
lcd_printp_at(0,ii + 3,param_copyright[ii + page], 0); |
if (page == 0) |
{ |
lcd_printp_at (0, 2, PSTR(" "), 0); |
lcd_printp_at (0, 6, PSTR("\x13"), 0); |
} |
if (page > 0 && page < (size - 3)) |
{ |
lcd_printp_at (0, 2, PSTR("\x12"), 0); |
lcd_printp_at (0, 6, PSTR("\x13"), 0); |
} |
if (page >= (size - 3)) |
{ |
lcd_printp_at (0, 2, PSTR("\x12"), 0); |
lcd_printp_at (0, 6, PSTR(" "), 0); |
} |
if (get_key_press (1 << KEY_PLUS)) |
if (page < size - 3) |
page++; |
if (get_key_press (1 << KEY_MINUS)) |
if (page > 0) |
page--; |
if (get_key_press (1 << KEY_ESC) || get_key_press (1 << KEY_ENTER)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/menu.h |
---|
0,0 → 1,55 |
/***************************************************************************** |
* 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 MENU_H |
#define MENU_H |
#define CURSOR_COL 1 // column where the menu cursor is displayed |
#define MENU_LINE 1 // starting line of menu |
#define MENU_COL 3 // column where the menu starts |
#define OSD_Mode 1 // OSD Anzeige als OSD |
#define THREE_D_Mode 3 // OSD Anzeige in 3D Position |
void main_menu (void); |
void Show_Version (void); |
void Show_Error_HW (void); |
void Update_PKT (void); |
void PC_Fast_Connect (void); |
uint8_t menu_choose (uint8_t min, uint8_t max, uint8_t pos, uint8_t start); |
uint8_t menu_choose2 (uint8_t min, uint8_t max, uint8_t start, uint8_t return_at_start, uint8_t return_at_end); |
uint8_t menu_choose3 (uint8_t min, uint8_t max, uint8_t start, uint8_t return_at_start, uint8_t return_at_end); |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/messages.c |
---|
0,0 → 1,1442 |
/**************************************************************************************** |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* * |
* 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. * |
* * |
* * |
* Languagesupport: * |
* http://www.netrino.com/Embedded-Systems/How-To/Firmware-Internationalization * |
* Nigel Jones * |
****************************************************************************************/ |
#include "cpu.h" |
#include <avr/io.h> |
#include <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <avr/wdt.h> |
#include <util/delay.h> |
#include "lcd.h" |
#include "timer.h" |
#include "eeprom.h" |
#include "messages.h" |
typedef enum |
{ GERMAN,ENGLISH, FRENCH, NETHERLAND, LAST_LANGUAGE } |
LANGUAGE; |
typedef struct |
{ |
/* |
* Maximum length |
*/ |
int const len; |
/* |
* Array of pointers to language-specific string |
*/ |
char const * const text[LAST_LANGUAGE]; |
} STRING; |
//-------------------------------------------------------------------------------------------------------------------- |
// Typdefinitionen für alle verwendeten Strings, LAST_STR muss am Ende stehen bleiben |
//typedef enum |
//{ |
// BOOT1,BOOT2,BOOT_WI1,BOOT_WI2,BOOT_SV,START_MSG1,START_MSG2,GNU_GPL,ATMEGA644,ATMEGA644P,ATMEGA1284P,HW12,HW12W,HW13,HW13W,HW39,START_LASTPOS,START_LASTPOS1,START_LASTPOS2,START_LASTPOSDEL, |
// START_SEARCHFC,ENDE,START_FCNOTFOUND,START_FCFOUND,START_FCFOUND1,START_FCFOUND2,START_FCFOUND3,START_VERSIONCHECK,START_VERSIONCHECK1, |
// START_VERSIONCHECK2,START_VERSIONCHECK3,START_VERSIONCHECK4,START_VERSIONCHECK5,LAST_STR |
//} STR; |
static const STRING strings[LAST_STR] = |
{ |
{ /*KEYLINE1*/ |
21, |
{ |
" \x1a \x1b Ende OK", /* German */ |
" \x1a \x1b end OK", /* English*/ |
" \x1a \x1b fin OK", /* French */ |
" \x1a \x1b Einde OK", /* Dutch */ |
} |
}, |
{ /*KEYLINE2*/ |
21, |
{ |
" \x18 \x19 Ende OK", /* German */ |
" \x18 \x19 end OK", /* English*/ |
" \x18 \x19 fin OK", /* French */ |
" \x18 \x19 Einde OK", /* Dutch */ |
} |
}, |
{ /*KEYLINE3*/ |
21, |
{ |
" \x18 \x19 Ende ", /* German */ |
" \x18 \x19 end ", /* English*/ |
" \x18 \x19 fin ", /* French */ |
" \x18 \x19 Einde", /* Dutch */ |
} |
}, |
{ /*KEYLINE4*/ |
21, |
{ |
"Ende OK", /* German */ |
"end OK", /* English*/ |
"fin OK", /* French */ |
"Einde OK", /* Dutch */ |
} |
}, |
{ /*BOOT1*/ |
21, |
{ |
"Taste 1 Sekunde", /* German */ |
"Keep the button", /* English*/ |
"Maintenez le bouton", /* French */ |
"Houd de knop ", /* Dutch */ |
} |
}, |
{ /* BOOT2*/ |
21, |
{ |
"lang festhalten.", /* German */ |
"pressed for 1 second", /* English*/ |
"enfoncée pend. 1 sec", /* French */ |
"1 seconde ingedrukt.", /* Dutch */ |
} |
}, |
{ /*BOOT_WI1*/ |
21, |
{ |
"Verbindung zum MK ist", /* German */ |
"Connection to MK is", /* English*/ |
"Connexion à MK est", /* French */ |
"Verbinding met MK is", /* Dutch */ |
} |
}, |
{ /* BOOT_WI2*/ |
21, |
{ |
"auf Wi232 eingestellt", /* German */ |
"set to Wi232", /* English*/ |
"mis à Wi232", /* French */ |
"ingesteld op Wi232", /* Dutch */ |
} |
}, |
{ /*BOOTSV1*/ |
21, |
{ |
"auf Kabel eingestellt", /* German */ |
"set to kabel on SV2", /* English*/ |
"mis à kabel sur SV2", /* French */ |
"via kabelverbinding", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Portables Kopter Tool", /* German */ |
"Portable Kopter Tool ", /* English*/ |
"Portable Kopter Tool ", /* French */ |
"Portable Kopter Tool ", /* Dutch */ |
} |
}, |
{ /*START_MSG2 */ |
21, |
{ |
"für FC Ver "FC_Version, /* German */ |
"for FC Ver "FC_Version, /* English*/ |
"pour FC Ver "FC_Version, /* French */ |
"Voor FC Ver "FC_Version, /* Dutch */ |
} |
}, |
{ /* GNU/GPL */ |
21, |
{ |
"GNU GPL License", /* German */ |
"GNU GPL License", /* English*/ |
"GNU GPL License", /* French */ |
"GNU GPL License", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"ATmega 644", /* German */ |
"ATmega 644", /* English*/ |
"ATmega 644", /* French */ |
"ATmega 644", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"ATmega 644P", /* German */ |
"ATmega 644P", /* English*/ |
"ATmega 644P", /* French */ |
"ATmega 644P", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"ATmega 1284P", /* German */ |
"ATmega 1284P", /* English*/ |
"ATmega 1284P", /* French */ |
"ATmega 1284P", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.2", /* German */ |
"Hardware 1.2", /* English*/ |
"Hardware 1.2", /* French */ |
"Hardware 1.2", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.2W", /* German */ |
"Hardware 1.2W", /* English*/ |
"Hardware 1.2W", /* French */ |
"Hardware 1.2W", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.3", /* German */ |
"Hardware 1.3", /* English*/ |
"Hardware 1.3", /* French */ |
"Hardware 1.3", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 1.3W", /* German */ |
"Hardware 1.3W", /* English*/ |
"Hardware 1.3W", /* French */ |
"Hardware 1.3W", /* Dutch */ |
} |
}, |
{ /**/ |
21, |
{ |
"Hardware 3.9", /* German */ |
"Hardware 3.9", /* English*/ |
"Hardware 3.9", /* French */ |
"Hardware 3.9", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS*/ |
21, |
{ |
" Letzte Position ", /* German */ |
" last position ", /* English*/ |
" dernière position ", /* French */ |
" Laatste positie ", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS1*/ |
21, |
{ |
" Längengr Breitengr", /* German */ |
" longitude latitude ", /* English*/ |
" longitude latitude ", /* French */ |
" lengtegr. breedtegr.", /* Dutch */ |
} |
}, |
{ /*START_LASTPOS2*/ |
21, |
{ |
"löschen weiter", /* German */ |
"delete exit ", /* English*/ |
"supprimer plus ", /* French */ |
"wissen verder", /* Dutch */ |
} |
}, |
{ /*START_LASTPOSDEL*/ |
21, |
{ |
" gelöscht ", /* German */ |
" deleted ", /* English*/ |
" supprimé ", /* French */ |
" gewist ", /* Dutch */ |
} |
}, |
{ /*START_SEARCHFC*/ |
21, |
{ |
"Suche FC...", /* German */ |
"searching FC...", /* English*/ |
"cherchant FC...", /* French */ |
"zoek FC...", /* Dutch */ |
} |
}, |
{ /*ENDE*/ |
21, |
{ |
"Ende ", /* German */ |
"end ", /* English*/ |
"fin ", /* French */ |
"Einde", /* Dutch */ |
} |
}, |
{ /*OK*/ |
21, |
{ |
"Ok", /* German */ |
"ok", /* English*/ |
"ok", /* French */ |
"gued", /* Dutch */ |
} |
}, |
{ /*FEHLER*/ |
21, |
{ |
"Fehler", /* German */ |
"error", /* English*/ |
"d'erreur", /* French */ |
"fout", /* Dutch */ |
} |
}, |
{ /*AKTIV*/ |
21, |
{ |
"aktiv", /* German */ |
"activ", /* English*/ |
"actifs", /* French */ |
"actief", /* Dutch */ |
} |
}, |
{ /*START_FCNOTFOUND*/ |
21, |
{ |
"FC nicht gefunden!", /* German */ |
"FC not found!", /* English*/ |
"FC pas trouvé!", /* French */ |
"FC niet gevonden!", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND*/ |
21, |
{ |
"PKT-Tool GNU GPL", /* German */ |
"PKT-Tool GNU GPL", /* English*/ |
"PKT-Tool GNU GPL", /* French */ |
"PKT-Tool GNU GPL", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND1*/ |
21, |
{ |
"gefunden: ", /* German */ |
"found: ", /* English*/ |
"trouvés: ", /* French */ |
"gevonden: ", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND2*/ |
21, |
{ |
"Flight-Ctrl", /* German */ |
"Flight-Ctrl", /* English*/ |
"Flight-Ctrl", /* French */ |
"Flight-Ctrl", /* Dutch */ |
} |
}, |
{ /*START_FCFOUND3*/ |
21, |
{ |
"Navi-Ctrl", /* German */ |
"Navi-Ctrl", /* English*/ |
"Navi-Ctrl", /* French */ |
"Navi-Ctrl", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK*/ |
21, |
{ |
"Version: ", /* German */ |
"Version: ", /* English*/ |
"Version: ", /* French */ |
"Versie: ", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK1*/ |
21, |
{ |
" erwartet", /* German */ |
" expected", /* English*/ |
" attendus", /* French */ |
" verwacht", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK2*/ |
21, |
{ |
" gefunden", /* German */ |
" found", /* English*/ |
" trouvés", /* French */ |
" gevonden", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK3*/ |
21, |
{ |
"PKT-Tool nur mit", /* German */ |
"PKT-Tool only with", /* English*/ |
"PKT uniquement avec", /* French */ |
"PKT-Tool alleen met", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK4*/ |
21, |
{ |
"FC Software ", /* German */ |
"FC Software ", /* English*/ |
"FC Software ", /* French */ |
"FC Software ", /* Dutch */ |
} |
}, |
{ /*START_VERSIONCHECK5*/ |
21, |
{ |
"kompatibel", /* German */ |
"compatible", /* English*/ |
"compatibles", /* French */ |
"compatibel", /* Dutch */ |
} |
}, |
{ /*ON*/ |
21, |
{ |
"Ein ", /* German */ |
"On ", /* English*/ |
"Un ", /* French */ |
"Aan ", /* Dutch */ |
} |
}, |
{ /*AUS*/ |
21, |
{ |
"Aus ", /* German */ |
"Off ", /* English*/ |
"Du ", /* French */ |
"Uit ", /* Dutch */ |
} |
}, |
{ /*ESC*/ |
21, |
{ |
"ESC", /* German */ |
"ESC", /* English*/ |
"ESC", /* French */ |
"ESC", /* Dutch */ |
} |
}, |
{ /*SHUTDOWN*/ |
21, |
{ |
" PKT ausschalten?", /* German */ |
" shutdown PKT ?", /* English*/ |
" désactiver PKT ?", /* French */ |
" PKT uitschakelen ?", /* Dutch */ |
} |
}, |
{ /*YES NO*/ |
21, |
{ |
"Nein Ja", /* German */ |
"no yes", /* English*/ |
"non oui", /* French */ |
"Nee Ja", /* Dutch */ |
} |
}, |
{ /*UPDATE1*/ |
21, |
{ |
"Verbinde PC mit PKT ", /* German */ |
"Connect PC to PKT-USB", /* English*/ |
"associer PC a PKT-USB", /* French */ |
"Verbind PC met PKT ", /* Dutch */ |
} |
}, |
{ /*UPDATE2*/ |
21, |
{ |
"Drücke 'Start' am PKT", /* German */ |
"Press 'Start' on PKT ", /* English*/ |
"presse 'lancer' a PKT", /* French */ |
"Druk 'Start' op PKT ", /* Dutch */ |
} |
}, |
{ /*ENDSTART*/ |
21, |
{ |
" Ende Start", /* German */ |
" End Start", /* English*/ |
" fin lancer", /* French */ |
" Einde Start", /* Dutch */ |
} |
}, |
{ /*TOOLS1*/ |
21, |
{ |
" PC-Quick-Verbindung ", /* German */ |
" PC-Quick-Connection ", /* English*/ |
" PC-connexion rapide ", /* French */ |
" Snelle PC-verbinding", /* Dutch */ |
} |
}, |
{ /*CONNECT1,*/ |
21, |
{ |
"Verbinde das PKT mit", /* German */ |
"Connect PKT with MK", /* English*/ |
"connectez PKT a MK", /* French */ |
"Verbind PKT ", /* Dutch */ |
} |
}, |
{ /*CONNECT2*/ |
21, |
{ |
"dem MK über:", /* German */ |
" over :", /* English*/ |
" a propos :", /* French */ |
" met :", /* Dutch */ |
} |
}, |
{ /*CONNECT4,*/ |
21, |
{ |
"dem MK über: Kabel, ", /* German */ |
"over: Kabel", /* English*/ |
"a propos: Cable", /* French */ |
"MK via: kabel ", /* Dutch */ |
} |
}, |
{ /*CONNECT5*/ |
21, |
{ |
"es ist kein Wi.232", /* German */ |
"there is no Wi.232", /* English*/ |
"l n'ya pas de ", /* French */ |
"er is geen wi.232 ", /* Dutch */ |
} |
}, |
{ /*CONNECT6*/ |
21, |
{ |
"Modul eingebaut.", /* German */ |
"built in.", /* English*/ |
"module intégré Wi232", /* French */ |
"module ingebouwd.", /* Dutch */ |
} |
}, |
{ /*CONNECT7,*/ |
21, |
{ |
"Wenn doch, dann bitte", /* German */ |
"if yes, then first", /* English*/ |
"Si vous le faites", /* French */ |
"zo ja, dan aub eerst", /* Dutch */ |
} |
}, |
{ /*CONNECT8*/ |
21, |
{ |
"das Modul zuerst im ", /* German */ |
"activate modul in", /* English*/ |
"activer le module", /* French */ |
"de module aktiveren", /* Dutch */ |
} |
}, |
{ /*CONNECT9*/ |
21, |
{ |
"Setupmenü aktivieren.", /* German */ |
"Setupmenu", /* English*/ |
"dans menu de config.", /* French */ |
"in het Setupmenu.", /* Dutch */ |
} |
}, |
{ /*CONNECT10*/ |
21, |
{ |
"Sie müssen das PKT", /* German */ |
"You have to", /* English*/ |
"Vous devez", /* French */ |
"U moet de PKT", /* Dutch */ |
} |
}, |
{ /*CONNECT11*/ |
21, |
{ |
"jetzt neu starten!", /* German */ |
"restart PKT", /* English*/ |
"redémarrer PKT", /* French */ |
"nu opnieuw starten!", /* Dutch */ |
} |
}, |
{ /*CONNECT12*/ |
21, |
{ |
"Es ist kein BTM-222", /* German */ |
"There is no BTM-222", /* English*/ |
"l n'ya pas de ", /* French */ |
"Er is geen BTM-222", /* Dutch */ |
} |
}, |
{ /*CONNECT13*/ |
21, |
{ |
"Modul eingebaut", /* German */ |
"Modul built in", /* English*/ |
"module intégré BTM222", /* French */ |
"module ingebouwd.", /* Dutch */ |
} |
}, |
{ /*CONNECT14*/ |
21, |
{ |
" MK-USB Funktion ", /* German */ |
" MK-USB Function ", /* English*/ |
" MK-USB fonction ", /* French */ |
" MK-USB Functie ", /* Dutch */ |
} |
}, |
{ /*CONNECT15*/ |
21, |
{ |
" BT --> Kabel an FC ", /* German */ |
" BT --> Kabel to FC ", /* English*/ |
" BT --> Cable a FC ", /* French */ |
" BT --> kabel naar FC", /* Dutch */ |
} |
}, |
{ /*CONNECT16*/ |
21, |
{ |
"PC mit BT verb.", /* German */ |
"connect PC with BT", /* English*/ |
"associer PC a BT", /* French */ |
"PC via BT verbonden.", /* Dutch */ |
} |
}, |
{ /*CONNECT17*/ |
21, |
{ |
"PKT-Kabel an FC", /* German */ |
"PKT-Kabel to FC", /* English*/ |
"PKT-Cable a FC", /* French */ |
"PKT-kabel naar FC", /* Dutch */ |
} |
}, |
{ /*CONNECT18*/ |
21, |
{ |
" BT --> Wi.232 ", /* German */ |
" BT --> Wi.232 ", /* English*/ |
" BT --> Wi.232 ", /* French */ |
" BT --> Wi.232 ", /* Dutch */ |
} |
}, |
{ /*CONNECT19*/ |
21, |
{ |
"Wi.232 an FC ", /* German */ |
"Wi.232 to FC ", /* English*/ |
"Wi.232 a FC ", /* French */ |
"Wi.232 naar FC ", /* Dutch */ |
} |
}, |
{ /*CONNECT20*/ |
21, |
{ |
" USB --> Kabel an FC ", /* German */ |
" USB --> cable to FC ", /* English*/ |
" USB --> cable a FC ", /* French */ |
"USB --> kabel naar FC", /* Dutch */ |
} |
}, |
{ /*CONNECT21*/ |
21, |
{ |
"PC mit USB verbinden ", /* German */ |
"connect PC with USB ", /* English*/ |
"associer PC a USB ", /* French */ |
"Verbind PC met USB ", /* Dutch */ |
} |
}, |
{ /*CONNECT22*/ |
21, |
{ |
" USB --> Wi.232 ", /* German */ |
" USB --> Wi.232 ", /* English*/ |
" USB --> Wi.232 ", /* French */ |
" USB --> Wi.232 ", /* Dutch */ |
} |
}, |
{ /*CONNECT23*/ |
21, |
{ |
"MK-Tool starten", /* German */ |
"start MK-Tool", /* English*/ |
"démarrage MK-Tool", /* French */ |
"start MK-Tool", /* Dutch */ |
} |
}, |
{ /*CONNECT24*/ |
21, |
{ |
" Wi.232 Konfigurieren", /* German */ |
" Wi.232 Configuration", /* English*/ |
" Wi.232 configurer ", /* French */ |
" Wi.232 Configuratie ", /* Dutch */ |
} |
}, |
{ /*CONNECT25*/ |
21, |
{ |
"Programm starten. ", /* German */ |
"start program ", /* English*/ |
"Démarrer le programme", /* French */ |
"start programma.", /* Dutch */ |
} |
}, |
{ /*CONNECT26*/ |
21, |
{ |
"BTM-222 Konfigurieren", /* German */ |
"BTM-222 configuration", /* English*/ |
"BTM-222 de configura.", /* French */ |
"BTM-222 configuratie", /* Dutch */ |
} |
}, |
{ /*CONNECT27*/ |
21, |
{ |
"FC > MK-USB > BTM-222", /* German */ |
"FC > MK-USB > BTM-222", /* English*/ |
"FC > MK-USB > BTM-222", /* French */ |
"FC > MK-USB > BTM-222", /* Dutch */ |
} |
}, |
{ /*CONNECT28*/ |
21, |
{ |
"MK-USB an PC anschl. ", /* German */ |
"connect PC to MK-USB ", /* English*/ |
"associer PC a MK-USB ", /* French */ |
"Verbind PC met MK-USB", /* Dutch */ |
} |
}, |
{ /*CONNECT29*/ |
21, |
{ |
"Zwischen MK-USB und ", /* German */ |
"connect crossed cable", /* English*/ |
"la connexion entre PC", /* French */ |
"Tussen MK-USB en PKT ", /* Dutch */ |
} |
}, |
{ /*CONNECT30*/ |
21, |
{ |
"PKT ein gekreuztes ", /* German */ |
"between MK-USB and ", /* English*/ |
"et FC un câble croisé", /* French */ |
"een gekruiste kabel ", /* Dutch */ |
} |
}, |
{ /*CONNECT31*/ |
21, |
{ |
"Kabel anschliessen. ", /* German */ |
"PKT SV2", /* English*/ |
" ", /* French */ |
"aansluiten.", /* Dutch */ |
} |
}, |
{ /*Kabel*/ |
21, |
{ |
"Kabel", /* German */ |
"cable", /* English*/ |
"cable", /* French */ |
"Kabel", /* Dutch */ |
} |
}, |
{ /*SLAVE*/ |
21, |
{ |
"Slave ", /* German */ |
"Slave ", /* English*/ |
"esclaves", /* French */ |
"Slave ", /* Dutch */ |
} |
}, |
{ /*NORMAL*/ |
21, |
{ |
"Normal", /* German */ |
"Normal", /* English*/ |
"normale", /* French */ |
"Normaal", /* Dutch */ |
} |
}, |
{ /*Reverse*/ |
21, |
{ |
"Reverse", /* German */ |
"inverse", /* English*/ |
"inverse", /* French */ |
"geinver", /* Dutch */ |
} |
}, |
{ /*ENDOK*/ |
21, |
{ |
"Ende OK", /* German */ |
"End OK", /* English*/ |
"Fin OK", /* French */ |
"Eind OK", /* Dutch */ |
} |
}, |
{ /*EEPROM1*/ |
21, |
{ |
" EEProm wirklich", /* German */ |
" Realy delete", /* English*/ |
" eeprom supprimer?", /* French */ |
" Eeprom werkelijk", /* Dutch */ |
} |
}, |
{ /*EEPROM2*/ |
21, |
{ |
" löschen?", /* German */ |
" EEprom?", /* English*/ |
" ", /* French */ |
" wissen?", /* Dutch */ |
} |
}, |
{ /*DEUTSCH*/ |
21, |
{ |
"deutsch ", /* German */ |
"german ", /* English*/ |
"allemande ", /* French */ |
"duits ", /* Dutch */ |
} |
}, |
{ /*ENGLISCH*/ |
21, |
{ |
"englisch ", /* German */ |
"english ", /* English*/ |
"anglaise ", /* French */ |
"engels ", /* Dutch */ |
} |
}, |
{ /*FRANCE*/ |
21, |
{ |
"französisch", /* German */ |
"french " , /* English*/ |
"française ", /* French */ |
"frans ", /* Dutch */ |
} |
}, |
{ /*NETHERL*/ |
21, |
{ |
"holländisch", /* German */ |
"dutch ", /* English*/ |
"hollandaise", /* French */ |
"nederlands ", /* Dutch */ |
} |
}, |
{ /*DISPLAY1*/ |
21, |
{ |
"Anzeige Einstellungen", /* German */ |
" Display Setup ", /* English*/ |
" d'affichage config. ", /* French */ |
"Display instellingen ", /* Dutch */ |
} |
}, |
{ /*DISPLAY2*/ |
21, |
{ |
"Infos bei Start:", /* German */ |
"Info at startup ", /* English*/ |
"Inf.au demarrage", /* French */ |
"Info bij opstart", /* Dutch */ |
} |
}, |
{ /*DISPLAY3*/ |
21, |
{ |
"Sprache : ", /* German */ |
"Language: ", /* English*/ |
"la langue: ", /* French */ |
"Taal: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY4*/ |
21, |
{ |
"Licht aus nach:", /* German */ |
"Light off after:", /* English*/ |
"Exti.feux p.les:", /* French */ |
"Licht uit na: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY5*/ |
21, |
{ |
"LCD Helligk.:", /* German */ |
" Brightness :", /* English*/ |
" luminosite :", /* French */ |
" intensiteit:", /* Dutch */ |
} |
}, |
{ /*DISPLAY6*/ |
21, |
{ |
"LCD Kontrast:", /* German */ |
"LCD contrast:", /* English*/ |
"LCD contrast:", /* French */ |
"LCD contrast:", /* Dutch */ |
} |
}, |
{ /*DISPLAY7*/ |
21, |
{ |
"LCD Norm/Inv: ", /* German */ |
"LCD Norm/Inv: ", /* English*/ |
"LCD Norm/Inv: ", /* French */ |
"LCD Norm/Inv: ", /* Dutch */ |
} |
}, |
{ /*DISPLAY8*/ |
21, |
{ |
"LCD Orient.: ", /* German */ |
"LCD Orient.: ", /* English*/ |
"LCD Orient.: ", /* French */ |
"LCD Orient.: ", /* Dutch */ |
} |
}, |
{ /*DEBUGPKT*/ |
21, |
{ |
"Debug PKT", /* German */ |
"Debug PKT", /* English*/ |
"Debug PKT", /* French */ |
"Debug PKT", /* Dutch */ |
} |
}, |
{ /*WITXRX*/ |
21, |
{ |
"Wi TX/RX Chan:", /* German */ |
"Wi TX/RX Chan:", /* English*/ |
"Wi TX/RX Chan:", /* French */ |
"Wi TX/RX Chan:", /* Dutch */ |
} |
}, |
{ /*WINETG*/ |
21, |
{ |
"Wi NetW. Grp.:", /* German */ |
"Wi NetW. Grp.:", /* English*/ |
"Wi NetW. Grp.:", /* French */ |
"Wi NetW. Grp.:", /* Dutch */ |
} |
}, |
{ /*WINETM*/ |
21, |
{ |
"Wi NetW. Mode:", /* German */ |
"Wi NetW. Mode:", /* English*/ |
"Wi NetW. Mode:", /* French */ |
"Wi NetW. Mode:", /* Dutch */ |
} |
}, |
{ /*WITIMEOUT*/ |
21, |
{ |
"Wi TX Timeout:", /* German */ |
"Wi TX Timeout:", /* English*/ |
"Wi TX Timeout:", /* French */ |
"Wi TX Timeout:", /* Dutch */ |
} |
}, |
{ /*WIUART*/ |
21, |
{ |
"Wi UART MTU :", /* German */ |
"Wi UART MTU :", /* English*/ |
"Wi UART MTU :", /* French */ |
"Wi UART MTU :", /* Dutch */ |
} |
}, |
{ /*WI2321*/ |
21, |
{ |
"Wi.232 eingebaut:", /* German */ |
"Wi.232 built in :", /* English*/ |
"Wi.232 intégré :", /* French */ |
"Wi.232 ingebouwd:", /* Dutch */ |
} |
}, |
{ /*WI2322*/ |
21, |
{ |
"Ist ein Wi.232-Modul ", /* German */ |
"Is Wi232 modul", /* English*/ |
"est un module ", /* French */ |
"Is er een Wi.232", /* Dutch */ |
} |
}, |
{ /*WI2323*/ |
21, |
{ |
"eingebaut?", /* German */ |
"built in?", /* English*/ |
"integre Wi232?", /* French */ |
"module ingebouwd?", /* Dutch */ |
} |
}, |
{ /*YES*/ |
21, |
{ |
"Ja ", /* German */ |
"yes ", /* English*/ |
"oui ", /* French */ |
"Ja ", /* Dutch */ |
} |
}, |
{ /*NO*/ |
21, |
{ |
"Nein", /* German */ |
"no ", /* English*/ |
"non ", /* French */ |
"Nee ", /* Dutch */ |
} |
}, |
{ /*BT1*/ |
21, |
{ |
"BTM222 eingebaut:", /* German */ |
"BTM222 built in :", /* English*/ |
"BTM222 integre :", /* French */ |
"BTM222 ingebouwd:", /* Dutch */ |
} |
}, |
{ /*BT2*/ |
21, |
{ |
"Ist ein BTM-222-Modul", /* German */ |
"Is BTM-222 Modul", /* English*/ |
"est un module ", /* French */ |
"Is er een BTM-222", /* Dutch */ |
} |
}, |
{ /*BT3*/ |
21, |
{ |
"eingebaut?", /* German */ |
"built in?", /* English*/ |
"integre BTM222?", /* French */ |
"module ingebouwd?", /* Dutch */ |
} |
}, |
{ /*LIPO1*/ |
21, |
{ |
" PKT Akku Einstellung", /* German */ |
" PKT Accu Setup ", /* English*/ |
" PKT Accu Setup ", /* French */ |
" PKT Accu Setup ", /* Dutch */ |
} |
}, |
{ /*LIPO2*/ |
21, |
{ |
"PKT Akkutyp: ", /* German */ |
"PKT Accutyp: ", /* English*/ |
"PKT Accutyp: ", /* French */ |
"PKT Accutype: ", /* Dutch */ |
} |
}, |
{ /*LIPO3*/ |
21, |
{ |
"Akku U Offset: ", /* German */ |
"Accu U Offset: ", /* English*/ |
"Accu U Offset: ", /* French */ |
"Accu U Offset: ", /* Dutch */ |
} |
}, |
{ /*LIPO4*/ |
21, |
{ |
"PKT Akkutyp: ", /* German */ |
"PKT Accutyp: ", /* English*/ |
"PKT Accutyp: ", /* French */ |
"PKT Accutype: ", /* Dutch */ |
} |
}, |
{ /*LIPO5*/ |
21, |
{ |
"Offset verstellen bis", /* German */ |
"adjust offset until", /* English*/ |
"Decalage l'ajuster ", /* French */ |
"Offset afregelen tot", /* Dutch */ |
} |
}, |
{ /*LIPO6*/ |
21, |
{ |
"die Spannung passt", /* German */ |
"voltage fits", /* English*/ |
"a la tension", /* French */ |
"de spanning juist is.", /* Dutch */ |
} |
}, |
{ /*LOWBAT*/ |
21, |
{ |
"LowBat Warn V:", /* German */ |
"LowBat Warn V:", /* English*/ |
"LowBat Warn V:", /* French */ |
"LowBat alarmering:", /* Dutch */ |
} |
}, |
{ /*OSD_V, vorne*/ |
21, |
{ |
"V", /* German */ |
"F", /* English*/ |
"L", /* French */ |
"F", /* Dutch */ |
} |
}, |
{ /*OSD_H, hinten*/ |
21, |
{ |
"H", /* German */ |
"B", /* English*/ |
"D", /* French */ |
"A", /* Dutch */ |
} |
}, |
{ /*OSD_L, links*/ |
21, |
{ |
"L", /* German */ |
"L", /* English*/ |
"G", /* French */ |
"L", /* Dutch */ |
} |
}, |
{ /*OSD_R, rechts*/ |
21, |
{ |
"R", /* German */ |
"R", /* English*/ |
"D", /* French */ |
"R", /* Dutch */ |
} |
}, |
{ /*OSD_ERROR*/ |
21, |
{ |
"FEHLER: Datenverlust ", /* German */ |
"ERROR: Data lost", /* English*/ |
"perte de données", /* French */ |
"verlies van gegevens ", /* Dutch */ |
} |
}, |
{ /*OSD_POS1*/ |
21, |
{ |
"Letzte bekannte", /* German */ |
"Last known ", /* English*/ |
"Dernière position", /* French */ |
"Laatst bekende", /* Dutch */ |
} |
}, |
{ /*OSD_POS2*/ |
21, |
{ |
"Position gespeichert", /* German */ |
"position saved", /* English*/ |
"connue sauvé", /* French */ |
"positie gered", /* Dutch */ |
} |
}, |
{ /*PARA_SETTINGS*/ |
21, |
{ |
" Einstellungen x ", /* German */ |
" Setting x ", /* English*/ |
" Paramètres x ", /* French */ |
" Instellingen x ", /* Dutch */ |
} |
}, |
{ /*PARA_CHANGE*/ |
21, |
{ |
"ändern", /* German */ |
"change", /* English*/ |
"le changement", /* French */ |
"verandering", /* Dutch */ |
} |
}, |
{ /*PARA_AKTIVI*/ |
21, |
{ |
"aktivieren", /* German */ |
"activate", /* English*/ |
"activer", /* French */ |
"activeren", /* Dutch */ |
} |
}, |
{ /*PARA_AKTIV*/ |
21, |
{ |
"aktiviert", /* German */ |
"activated", /* English*/ |
"activée", /* French */ |
"geactiveerd", /* Dutch */ |
} |
}, |
{ /*PARA_SAVESETT*/ |
21, |
{ |
" Setting x speichern?", /* German */ |
" store setting?", /* English*/ |
" Réglage magasin?", /* French */ |
" instell.op te slaan?", /* Dutch */ |
} |
}, |
{ /*PARA_SETTSAVED*/ |
21, |
{ |
"Gespeichert und", /* German */ |
"stored and", /* English*/ |
"stockés et", /* French */ |
"opgeslagen en", /* Dutch */ |
} |
}, |
{ /*PARA_COPY*/ |
21, |
{ |
"Kopiere Setting", /* German */ |
"copy settings", /* English*/ |
"paramètres de copie", /* French */ |
"kopieer instellingen", /* Dutch */ |
} |
}, |
{ /*PARA_FROMTO*/ |
21, |
{ |
" von x nach y", /* German */ |
" from x to y", /* English*/ |
" des x après y", /* French */ |
" van x na y", /* Dutch */ |
} |
}, |
{ /*PARA_ENDE*/ |
21, |
{ |
"von nach Ende OK", /* German */ |
"from to end OK", /* English*/ |
"des après fin OK", /* French */ |
"van na einde OK", /* Dutch */ |
} |
}, |
{ /*PARA_COPYQ*/ |
21, |
{ |
"Wirklich kopieren?", /* German */ |
"really copy?", /* English*/ |
"vraiment copie?", /* French */ |
"echt kopie?", /* Dutch */ |
} |
}, |
{ /*PARA_COPYACTIV*/ |
21, |
{ |
"Kopiert und aktiviert", /* German */ |
"copied and activated ", /* English*/ |
"copies et actifs", /* French */ |
"Kopieën en actief", /* Dutch */ |
} |
}, |
{ /*PARA_CHANGESETT*/ |
21, |
{ |
"Ändere Einstellungen ", /* German */ |
" change settings ", /* English*/ |
"modifier les réglages", /* French */ |
"instellingen wijzigen", /* Dutch */ |
} |
}, |
{ /*PARA_SELECT*/ |
21, |
{ |
" Wähle Parameter ", /* German */ |
" select parameters ", /* English*/ |
"sélectionnez Paramèt.", /* French */ |
"Selecteer Parameters ", /* Dutch */ |
} |
}, |
{ /*PARA_SEITE*/ |
21, |
{ |
" Wähle Seite ", /* German */ |
" select page ", /* English*/ |
"Sélectionnez la page ", /* French */ |
" Selecteer pagina ", /* Dutch */ |
} |
}, |
{ /*PARA_SELSETT*/ |
21, |
{ |
" Wähle Setting: ", /* German */ |
" select setting ", /* English*/ |
"Sélectionnez setting ", /* French */ |
" Selecteer setting ", /* Dutch */ |
} |
}, |
//---------, , |
//----------------- |
}; |
char const * strGet(int str_no) |
{ |
return strings[str_no].text[DisplayLanguage]; |
} |
void Test_Language (void) // bleibt für Tests |
{ |
lcd_cls(); |
lcd_printp_at(12, 7, PSTR("Ende"), 0); |
do |
{ |
lcd_puts_at(1, 2, strGet(BOOT_WI1), 0); |
// lcd_printp_at(1, 2, strGet(BOOT_WI1), 0); |
} |
while(!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
return; |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/messages.h |
---|
0,0 → 1,49 |
/**************************************************************************************** |
* Copyright (C) 2011 Christian "Cebra" Brandtner, brandtner@brandtner.net * |
* * |
* 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. * |
* * |
* * |
* Languagesupport: * |
* http://www.netrino.com/Embedded-Systems/How-To/Firmware-Internationalization * |
* Nigel Jones * |
****************************************************************************************/ |
#ifndef MESSAGES_H |
#define MESSAGES_H |
//--------------------------------------------------------------------------------------------------------------------- |
// Typdefinitionen für alle verwendeten Strings, LAST_STR muss am Ende stehen bleiben |
typedef enum |
{ |
KEYLINE1, KEYLINE2, KEYLINE3,KEYLINE4, BOOT1, BOOT2, BOOT_WI1, BOOT_WI2, BOOT_SV, START_MSG1, START_MSG2, GNU_GPL, ATMEGA644, ATMEGA644P, ATMEGA1284P, HW12, HW12W, HW13, |
HW13W, HW39, START_LASTPOS, START_LASTPOS1, START_LASTPOS2, START_LASTPOSDEL, START_SEARCHFC, ENDE, OK, FEHLER, AKTIV, START_FCNOTFOUND, START_FCFOUND, START_FCFOUND1, START_FCFOUND2, |
START_FCFOUND3, START_VERSIONCHECK, START_VERSIONCHECK1, START_VERSIONCHECK2, START_VERSIONCHECK3, START_VERSIONCHECK4, START_VERSIONCHECK5, ON, OFF, ESC, SHUTDOWN, |
YESNO, UPDATE1, UPDATE2, ENDSTART, TOOLS1, CONNECT1, CONNECT2, CONNECT4, CONNECT5, CONNECT6, CONNECT7, CONNECT8, CONNECT9, CONNECT10, CONNECT11, CONNECT12, |
CONNECT13, CONNECT14, CONNECT15, CONNECT16, CONNECT17, CONNECT18, CONNECT19, CONNECT20, CONNECT21, CONNECT22, CONNECT23, CONNECT24, CONNECT25, CONNECT26, CONNECT27, |
CONNECT28, CONNECT29, CONNECT30, CONNECT31, KABEL, SLAVE, NORMAL, REVERSE, ENDOK, EEPROM1, EEPROM2, DEUTSCH, ENGLISCH, FRANCE, NETHERL, DISPLAY1, DISPLAY2, |
DISPLAY3, DISPLAY4, DISPLAY5, DISPLAY6, DISPLAY7, DISPLAY8, DEBUGPKT, WITXRX, WINETWG, WINETWM, WITIMEOUT, WIUART, WI2321, WI2322, WI2323, YES, NOO, BT1, BT2, |
BT3, LIPO1, LIPO2, LIPO3, LIPO4, LIPO5, LIPO6, LOWBAT, OSD_V, OSD_H,OSD_L, OSD_R, OSD_ERROR, OSD_POS1, OSD_POS2, PARA_SETTINGS, PARA_CHANGE, PARA_AKTIVI, PARA_AKTIV, |
PARA_SAVESETT, PARA_SETTSAVED,PARA_COPY, PARA_FROMTO, PARA_ENDE,PARA_COPYQ ,PARA_COPYACTIV,PARA_CHANGESETT, PARA_SELECT, PARA_SEITE, PARA_SELSETT, LAST_STR |
} STR; |
#define NUM_LANG 4 // German, English, French, Netherlands |
char const * strGet(int str_no); |
void Test_Language (void); // bleibt für Tests |
#endif /* _MESSAGES_H_ */ |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/mk-data-structs.h |
---|
0,0 → 1,330 |
/***************************************************************************** |
* 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 _MK_DATA_STRUCTS_H |
#define _MK_DATA_STRUCTS_H |
// FC Version 0.86 |
#define EEProm_Version 88 // FC EEProm Revision / Struktur FC 0.86 |
#define FC_Version "0.86x" //Softwareversion der FC |
#define u8 uint8_t |
#define s8 int8_t |
#define u16 uint16_t |
#define s16 int16_t |
#define u32 uint32_t |
#define s32 int32_t |
#define NUMBER_OF_DEBUG_DATAS 32 |
#define ANALOG_NAME_LENGTH 16 |
// Version of supported serial protocol |
#define MIN_VERSION 7 |
#define MAX_VERSION 10 |
// Setting index |
#define SETTING_1 1 |
#define SETTING_2 2 |
#define SETTING_3 3 |
#define SETTING_4 4 |
#define SETTING_5 5 |
#define SETTING_CURRENT 0xff |
typedef struct |
{ |
unsigned char SWMajor; |
unsigned char SWMinor; |
unsigned char ProtoMajor; |
unsigned char ProtoMinor; |
unsigned char SWPatch; |
unsigned char HardwareError[5]; |
} __attribute__((packed)) Version_t; |
// FC Debug Struct |
// portions taken and adapted from |
// http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h |
// |
typedef struct |
{ |
uint8_t Digital[2]; |
// NC: unsigned; FC: signed !!!! |
int16_t Analog[32]; // Debugvalues |
} __attribute__((packed)) DebugData_t; |
//typedef struct |
//{ |
// uint8_t line; |
// uint8_t text[20]; |
//} __attribute__((packed)) Display_t; |
//typedef struct |
//{ |
// uint8_t Revision; |
// int8_t Name[12]; |
// int8_t Motor[16][4]; |
// uint8_t crc; |
//} __attribute__((packed)) Mixer_t; |
// |
// NaviCtrl OSD Structs |
// portions taken and adapted from |
// http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
// |
//typedef struct |
//{ |
// signed int Winkel[3]; // nick, roll, compass in 0,1.^ |
// signed char Centroid[3]; |
// signed char reserve[5]; |
//} __attribute__((packed)) Data3D_t; |
typedef struct |
{ |
s32 Longitude; // in 1E-7 deg |
s32 Latitude; // in 1E-7 deg |
s32 Altitude; // in mm |
u8 Status; // validity of data |
} __attribute__((packed)) GPS_Pos_t; |
typedef struct |
{ |
u16 Distance; // distance to target in cm |
s16 Bearing; // course to target in deg |
} __attribute__((packed)) GPS_PosDev_t; |
typedef struct |
{ |
GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
u8 HoldTime; // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered |
u8 Event_Flag; // future implementation |
u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
u8 Type; // typeof Waypoint |
u8 WP_EventChannelValue; |
u8 AltitudeRate; // rate to change the setpoint |
u8 reserve[8]; // reserve |
} __attribute__((packed)) Point_t; |
// NaviCtrl struct |
// taken from |
// http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
// |
typedef struct |
{ |
u8 Version; // version of the data structure |
GPS_Pos_t CurrentPosition; // see ubx.h for details |
GPS_Pos_t TargetPosition; |
GPS_PosDev_t TargetPositionDeviation; |
GPS_Pos_t HomePosition; |
GPS_PosDev_t HomePositionDeviation; |
u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
u8 WaypointNumber; // number of stored waypoints |
u8 SatsInUse; // number of satellites used for position solution |
s16 Altimeter; // hight according to air pressure |
s16 Variometer; // climb(+) and sink(-) rate |
u16 FlyingTime; // in seconds |
u8 UBat; // Battery Voltage in 0.1 Volts |
u16 GroundSpeed; // speed over ground in cm/s (2D) |
s16 Heading; // current flight direction in . as angle to north |
s16 CompassHeading; // current compass value in . |
s8 AngleNick; // current Nick angle in 1. |
s8 AngleRoll; // current Rick angle in 1. |
u8 RC_Quality; // RC_Quality |
u8 FCFlags; // Flags from FC |
u8 NCFlags; // Flags from NC |
u8 Errorcode; // 0 --> okay |
u8 OperatingRadius; // current operation radius around the Home Position in m |
s16 TopSpeed; // velocity in vertical direction in cm/s |
u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
u8 RC_RSSI; // Receiver signal strength (since version 2 added) |
s16 SetpointAltitude; // setpoint for altitude |
u8 Gas; // for future use |
u16 Current; // actual current in 0.1A steps |
u16 UsedCapacity; // used capacity in mAh |
} __attribute__((packed)) NaviData_t; |
// MikroKopter Flags |
// taken from |
// http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.73d%2Ffc.h |
// |
#define FCFLAG_MOTOR_RUN 0x01 |
#define FCFLAG_FLY 0x02 |
#define FCFLAG_CALIBRATE 0x04 |
#define FCFLAG_START 0x08 |
#define FCFLAG_NOTLANDUNG 0x10 |
#define FCFLAG_LOWBAT 0x20 |
#define FCFLAG_SPI_RX_ERR 0x40 |
#define FCFLAG_I2CERR 0x80 |
// NaviCtrl Flags |
// taken from |
// http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.15c%2Fuart1.h |
// |
#define NC_FLAG_FREE 0x01 |
#define NC_FLAG_PH 0x02 |
#define NC_FLAG_CH 0x04 |
#define NC_FLAG_RANGE_LIMIT 0x08 |
#define NC_FLAG_NOSERIALLINK 0x10 |
#define NC_FLAG_TARGET_REACHED 0x20 |
#define NC_FLAG_MANUAL_CONTROL 0x40 |
#define NC_FLAG_GPS_OK 0x80 |
// Aus FC eeprom.h |
// |
typedef struct |
{ |
unsigned char Revision; |
unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
unsigned char Hoehe_MinGas; // Wert : 0-100 |
unsigned char Luftdruck_D; // Wert : 0-250 |
unsigned char MaxHoehe; // Wert : 0-32 |
unsigned char Hoehe_P; // Wert : 0-32 |
unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
unsigned char Hoehe_HoverBand; // Wert : 0-250 |
unsigned char Hoehe_GPS_Z; // Wert : 0-250 |
unsigned char Hoehe_StickNeutralPoint; // Wert : 0-250 |
unsigned char Stick_P; // Wert : 1-6 |
unsigned char Stick_D; // Wert : 0-64 |
unsigned char StickGier_P; // Wert : 1-20 |
unsigned char Gas_Min; // Wert : 0-32 |
unsigned char Gas_Max; // Wert : 33-250 |
unsigned char GyroAccFaktor; // Wert : 1-64 |
unsigned char KompassWirkung; // Wert : 0-32 |
unsigned char Gyro_P; // Wert : 10-250 |
unsigned char Gyro_I; // Wert : 0-250 |
unsigned char Gyro_D; // Wert : 0-250 |
unsigned char Gyro_Gier_P; // Wert : 10-250 |
unsigned char Gyro_Gier_I; // Wert : 0-250 |
unsigned char Gyro_Stability; // Wert : 0-16 |
unsigned char UnterspannungsWarnung; // Wert : 0-250 |
unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
unsigned char I_Faktor; // Wert : 0-250 |
unsigned char UserParam1; // Wert : 0-250 |
unsigned char UserParam2; // Wert : 0-250 |
unsigned char UserParam3; // Wert : 0-250 |
unsigned char UserParam4; // Wert : 0-250 |
unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
//--- Seit V0.75 |
unsigned char ServoRollControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoRollComp; // Wert : 0-250 |
unsigned char ServoRollMin; // Wert : 0-250 |
unsigned char ServoRollMax; // Wert : 0-250 |
//--- |
unsigned char ServoNickRefresh; // Speed of the Servo |
unsigned char ServoManualControlSpeed; // |
unsigned char CamOrientation; // |
unsigned char Servo3; // Value or mapping of the Servo Output |
unsigned char Servo4; // Value or mapping of the Servo Output |
unsigned char Servo5; // Value or mapping of the Servo Output |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
unsigned char LoopHysterese; // Wert: 0-250 Hysterese für Stickausschlag |
unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt |
unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt |
unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
unsigned char Driftkomp; |
unsigned char DynamicStability; |
unsigned char UserParam5; // Wert : 0-250 |
unsigned char UserParam6; // Wert : 0-250 |
unsigned char UserParam7; // Wert : 0-250 |
unsigned char UserParam8; // Wert : 0-250 |
//---Output --------------------------------------------- |
unsigned char J16Bitmask; // for the J16 Output |
unsigned char J16Timing; // for the J16 Output |
unsigned char J17Bitmask; // for the J17 Output |
unsigned char J17Timing; // for the J17 Output |
// seit version V0.75c |
unsigned char WARN_J16_Bitmask; // for the J16 Output |
unsigned char WARN_J17_Bitmask; // for the J17 Output |
//---NaviCtrl--------------------------------------------- |
unsigned char NaviGpsModeControl; // Parameters for the Naviboard |
unsigned char NaviGpsGain; |
unsigned char NaviGpsP; |
unsigned char NaviGpsI; |
unsigned char NaviGpsD; |
unsigned char NaviGpsPLimit; |
unsigned char NaviGpsILimit; |
unsigned char NaviGpsDLimit; |
unsigned char NaviGpsACC; |
unsigned char NaviGpsMinSat; |
unsigned char NaviStickThreshold; |
unsigned char NaviWindCorrection; |
unsigned char NaviAccCompensation; // New since 0.86 -> was: SpeedCompensation |
unsigned char NaviOperatingRadius; |
unsigned char NaviAngleLimitation; |
unsigned char NaviPH_LoginTime; |
//---Ext.Ctrl--------------------------------------------- |
unsigned char ExternalControl; // for serial Control |
//---CareFree--------------------------------------------- |
unsigned char OrientationAngle; // Where is the front-direction? |
unsigned char CareFreeModeControl; // switch for CareFree |
unsigned char MotorSafetySwitch; |
unsigned char MotorSmooth; |
unsigned char ComingHomeAltitude; |
unsigned char FailSafeTime; |
unsigned char MaxAltitude; |
//------------------------------------------------ |
unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
unsigned char ServoCompInvert; // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
unsigned char ExtraConfig; // bitcodiert |
char Name[12]; |
unsigned char crc; // MUST BE THE LAST BYTE! |
} __attribute__((packed)) mk_param_struct_t; |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/motortest.c |
---|
0,0 → 1,419 |
/***************************************************************************** |
* 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/interrupt.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdlib.h> |
#include "main.h" |
#include "motortest.h" |
#include "lcd.h" |
#include "timer.h" |
#include "twimaster.h" |
//#include "menu.h" |
#include "uart1.h" |
#include "usart.h" |
#include "messages.h" |
uint8_t m; |
uint8_t mmode; // 0=Value 1=Motor |
uint8_t v; |
volatile uint8_t i2c_state; |
volatile uint8_t motor_addr = 0; |
//-------------------------------------------------------------- |
// Senden der Motorwerte per I2C-Bus |
// |
void SendMotorData(uint8_t m,uint8_t v) |
{ |
if (m==0) |
for(m=0;m<MAX_MOTORS;m++) // alle Motoren |
{ |
// Motor[m].SetPoint = MotorTest[m]; |
Motor[m].SetPoint = v; |
Motor[m].SetPointLowerBits = 0; |
// Motor[i].SetPoint = MotorTest[i] / 4; // testing the high resolution |
// Motor[i].SetPointLowerBits = MotorTest[i] % 4; |
} |
else |
{ |
Motor[m-1].SetPoint = v; |
Motor[m-1].SetPointLowerBits = 0; |
} |
if(I2C_TransferActive) |
I2C_TransferActive = 0; // enable for the next time |
else |
{ |
motor_write = 0; |
I2C_Start(TWI_STATE_MOTOR_TX); //Start I2C Interrupt Mode |
} |
} |
//-------------------------------------------------------------- |
// |
void Search_BL (void) |
{ |
uint8_t i = 0; |
unsigned int timer; |
lcd_cls (); |
MotorenEin =0; |
MotorTest[i] = 0; |
lcd_printp (PSTR("Suche BL-Ctrl"), 0); |
// Check connected BL-Ctrls |
BLFlags |= BLFLAG_READ_VERSION; |
motor_read = 0; // read the first I2C-Data |
SendMotorData(0,0); |
timer = SetDelay(1); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
timer = SetDelay(1); |
for(i=0; i < MAX_MOTORS; i++) |
{ |
SendMotorData(i,0); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
if(Motor[i].State & MOTOR_STATE_PRESENT_MASK) |
{ |
lcd_printp_at (0, 1, PSTR("Found BL-Ctrl:"), 0); |
lcd_print_hex_at (18,1,i,0); |
lcd_printp_at (0, 2, PSTR("Version:"), 0); |
lcd_print_hex_at (8,2,Motor[i].Version,0); |
lcd_printp_at (11, 2, PSTR("SetPoi:"), 0); |
lcd_print_hex_at (18,2,Motor[i].SetPoint,0); |
lcd_printp_at (0, 3, PSTR("SetPoiL:"), 0); |
lcd_print_hex_at (8,3,Motor[i].SetPointLowerBits,0); |
lcd_printp_at (11, 3, PSTR("State :"), 0); |
lcd_print_hex_at (18,3,Motor[i].State,0); |
lcd_printp_at (0, 4, PSTR("ReadMod:"), 0); |
lcd_print_hex_at (8,4,Motor[i].ReadMode,0); |
lcd_printp_at (11, 4, PSTR("Currnt:"), 0); |
lcd_print_hex_at (18,4,Motor[i].Current,0); |
lcd_printp_at (0, 5, PSTR("MaxPWM :"), 0); |
lcd_print_hex_at (8,5,Motor[i].MaxPWM,0); |
lcd_printp_at (11, 5, PSTR("Temp :"), 0); |
write_ndigit_number_u (18,5,Motor[i].Temperature,3,1); |
} |
} //End For I |
} |
//-------------------------------------------------------------- |
// |
void motor (uint8_t m,uint8_t v) |
{ |
memset (buffer, 0, 16); |
if(m == 0) |
{ |
memset (buffer, v, 16); |
} |
else |
{ |
buffer[m-1] = v; |
} |
SendOutData('t', ADDRESS_FC, 1, buffer, 16); |
} |
//-------------------------------------------------------------- |
// |
void motor_test (uint8_t MotorMode) |
{ |
lcd_cls (); |
mmode = 1; // 1=Motor |
m = 1; |
v = 0; |
char buffer[7]; |
unsigned int SerLoop; |
SerLoop = 10; |
if (MotorMode == I2C_Mode) |
{ |
Search_BL(); |
do |
{ |
lcd_printp_at (11, 7, PSTR("Ende Check"), 0); |
if (get_key_press (1 << KEY_ESC)) |
{ |
get_key_press(KEY_ALL); |
return; |
} |
} |
while (!get_key_press (1 << KEY_ENTER)); |
} |
lcd_cls(); |
lcd_printp (PSTR(" BL-Ctrl Test "), 2); |
lcd_printp_at (2, 2, PSTR("Motor: 1"), 0); |
lcd_printp_at (2, 3, PSTR("Value: 0"), 0); |
lcd_frect ((8*1), (8*5), (0 * (14*8)) / 255, 6, 1); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_3), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE3), 0); |
lcd_printp_at (18, 7, PSTR("\x1a \x1b"), 0); |
lcd_printp_at (0, 2, PSTR("\x1d"), 0); |
#if defined HWVERSION1_3W || defined HWVERSION1_3 || defined HWVERSION3_9 |
if (MotorMode == I2C_Mode) |
uart1_puts("Motor;Version;Setpoint high;Setpoint low;State;ReadMode;Current;MaxPWM;Temperature\r"); |
#endif |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
if (MotorMode == I2C_Mode) |
USART_puts("Motor;Version;Setpoint high;Setpoint low;State;ReadMode;Current;MaxPWM;Temperature\r"); |
#endif |
if (MotorMode == FC_Mode) |
{ |
if (hardware == NC && current_hardware == NC) |
{ |
SwitchToFC(); |
} |
} |
do |
{ |
// mmode 0=Value 1=Motor |
if ((mmode == 0) && (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) && (v < 254)) |
{ |
v++; |
write_ndigit_number_u (9, 3, v, 3, 0); |
if (MotorMode == FC_Mode) |
lcd_frect ((8*1), (8*5), (v * (14*8)) / 255, 6, 1); |
} |
if ((mmode == 0) && (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) && (v > 0)) |
{ |
if (MotorMode == FC_Mode) |
lcd_frect (((v * (14*8) / 255) + 8), (8*5), ((14*8) / 255), 6, 0); |
v--; |
write_ndigit_number_u (9, 3, v, 3, 0); |
if (MotorMode == FC_Mode) |
lcd_frect ((8*1), (8*5), (v * (14*8)) / 255, 6, 1); |
} |
if ((mmode == 1) && (get_key_press (1 << KEY_PLUS) || get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) && (m < 16)) |
{ |
m++; |
write_ndigit_number_u (9, 2, m, 3, 0); |
} |
if ((mmode == 1) && (get_key_press (1 << KEY_MINUS) || get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) && (m > 0)) |
{ |
m--; |
if(m > 0) |
write_ndigit_number_u (9, 2, m, 3, 0); |
if(m == 0) |
lcd_printp_at (9, 2, PSTR("All"), 0); |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
if (MotorMode == I2C_Mode) |
{ |
if (v > 0) |
{ |
m = 0; |
v=0; |
lcd_frect ((8*1), (8*5), (0 * (14*8)) / 255, 6, 1); |
lcd_cls_line (0, 5, 21); |
if(m > 0) write_ndigit_number_u (9, 2, m, 3, 0); |
if(m == 0) lcd_printp_at (9, 2, PSTR("All"), 0); |
write_ndigit_number_u (9, 3, v, 3, 0); |
SendMotorData(m,v); |
timer = SetDelay(1); |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
} |
} |
if(mmode == 0) // 0=Value |
{ |
lcd_printp_at (0, 2, PSTR("\x1d"), 0); |
lcd_printp_at (0, 3, PSTR(" "), 0); |
mmode = 1; // 1=Motor |
} |
else |
{ |
lcd_printp_at (0, 2, PSTR(" "), 0); |
lcd_printp_at (0, 3, PSTR("\x1d"), 0); |
mmode = 0; // 0=Value |
} |
} |
//if (get_key_press (1 << KEY_ENTER))// |
if (MotorMode == I2C_Mode) |
{ |
SendMotorData(m,v); |
timer = SetDelay(1); |
lcd_printp_at (0, 3, PSTR("SetPoint :"), 0); |
write_ndigit_number_u (13,3,Motor[m-1].SetPoint,3,0); |
lcd_printp_at (0, 4, PSTR("Current :"), 0); |
lcd_print_hex_at (13,4,Motor[m-1].Current,0); |
write_ndigit_number_u (13,4,Motor[m-1].Current,3,0); |
lcd_printp_at (0, 5, PSTR("Temperature:"), 0); |
write_ndigit_number_u (13,5,Motor[m-1].Temperature,3,0); |
lcd_printp_at (0, 6, PSTR("Version:"), 0); |
lcd_print_hex_at (8,6,Motor[m-1].Version,0); |
lcd_printp_at (11, 6, PSTR("State :"), 0); |
lcd_print_hex_at (18,6,Motor[m-1].State,0); |
#if defined HWVERSION1_3W || defined HWVERSION1_3 || defined HWVERSION3_9 |
if (Motor[m-1].SetPoint > 0) |
{ |
if (SerLoop == 0) |
{ |
itoa( m-1, buffer, 10); // convert interger into string (decimal format) |
uart1_puts(buffer); // and transmit string to UART |
uart1_puts(";"); |
itoa( Motor[m-1].Version, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].SetPoint, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].SetPointLowerBits, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].State, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].ReadMode, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].Current, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].MaxPWM, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts(";"); |
itoa( Motor[m-1].Temperature, buffer, 10); // |
uart1_puts(buffer); |
uart1_puts("\r"); |
uart1_puts("\n"); |
SerLoop =200; |
} |
else |
SerLoop--; |
} |
#endif |
#if defined HWVERSION1_2W || defined HWVERSION1_2 |
if (Motor[m-1].SetPoint > 0) |
{ |
if (SerLoop == 0) |
{ |
itoa( m-1, buffer, 10); // convert interger into string (decimal format) |
USART_puts(buffer); // and transmit string to UART |
USART_puts(";"); |
itoa( Motor[m-1].Version, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].SetPoint, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].SetPointLowerBits, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].State, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].ReadMode, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].Current, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].MaxPWM, buffer, 10); // |
USART_puts(buffer); |
USART_puts(";"); |
itoa( Motor[m-1].Temperature, buffer, 10); // |
USART_puts(buffer); |
USART_puts("\r"); |
USART_puts("\n"); |
SerLoop =200; |
} |
else |
SerLoop--; |
} |
#endif |
while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer |
} |
else |
motor (m,v); //if (MotorMode == I2C_Mode)// |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
if (MotorMode == FC_Mode) |
{ |
motor(0,0); // switch all engines off at exit |
} |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/motortest.h |
---|
0,0 → 1,46 |
/***************************************************************************** |
* 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 _MOTORTEST_H |
#define _MOTORTEST_H |
#define I2C_Mode 1 // Motortest Lokal |
#define FC_Mode 2 // Motortest ueber FC |
void motor_test (uint8_t MotorMode); |
void SendMotorData(uint8_t m,uint8_t v); |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/osd.c |
---|
0,0 → 1,695 |
/***************************************************************************** |
* 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 <inttypes.h> |
#include <stdlib.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include "main.h" |
#include "osd.h" |
#include "lcd.h" |
#include "timer.h" |
#include "usart.h" |
#include "eeprom.h" |
#include "messages.h" |
#include "mk-data-structs.h" |
#define COSD_WASFLYING 4 |
#define TIMEOUT 200 // 2 sec |
// global definitions and global vars |
NaviData_t *naviData; |
// löschen und alle mit "naviData->Variometer" ersetzen |
//int8_t Variometer = 0; |
// Hier Höhenanzeigefehler Korrigieren |
#define AltimeterAdjust 1.5 |
// stats for after flight |
int16_t max_Altimeter = 0; |
uint16_t max_GroundSpeed = 0; |
int16_t max_Distance = 0; |
uint8_t min_UBat = 255; |
uint16_t max_FlyingTime = 0; |
uint16_t max_Current = 0; |
uint16_t max_Capacity = 0; |
// cache old vars for blinking attribute, checkup is faster than full |
// attribute write each time |
volatile uint8_t last_UBat = 255; |
volatile uint8_t last_RC_Quality = 255; |
volatile uint16_t ftimer = 0; |
// store stats description in progmem to save space |
const char stats_item_0[] PROGMEM = "max Altitude:"; |
const char stats_item_1[] PROGMEM = "max Speed :"; |
const char stats_item_2[] PROGMEM = "max Distance:"; |
const char stats_item_3[] PROGMEM = "min Voltage :"; |
const char stats_item_4[] PROGMEM = "max Time :"; |
#if 1 |
const char stats_item_5[] PROGMEM = "max Current :"; |
const char stats_item_6[] PROGMEM = "UsedCapacity:"; |
#else |
const char stats_item_5[] PROGMEM = "Long. :"; |
const char stats_item_6[] PROGMEM = "Lat. :"; |
#endif |
const char *stats_item_pointers[] PROGMEM = { |
stats_item_0, |
stats_item_1, |
stats_item_2, |
stats_item_3, |
stats_item_4, |
stats_item_5, |
stats_item_6 |
}; |
//char* rose = "-+-N-+-O-+-S-+-W-+-N-+-O-+-S-+-W-+-N-+-O-+-S-+-W"; |
const char rose[48] PROGMEM = { |
0x0e, 0x0f, 0x0e, 'N', 0x0e, 0x0f, 0x0e, 'O', 0x0e, 0x0f, 0x0e, 'S', |
0x0e, 0x0f, 0x0e, 'W', 0x0e, 0x0f, 0x0e, 'N', 0x0e, 0x0f, 0x0e, 'O', |
0x0e, 0x0f, 0x0e, 'S', 0x0e, 0x0f, 0x0e, 'W', 0x0e, 0x0f, 0x0e, 'N', |
0x0e, 0x0f, 0x0e, 'O', 0x0e, 0x0f, 0x0e, 'S', 0x0e, 0x0f, 0x0e, 'W', |
}; |
// the center is char 19 (north), we add the current heading in 8th |
// which would be 22.5 degrees, but float would bloat up the code |
// and *10 / 225 would take ages... so we take the uncorrect way |
const char str_NE[] PROGMEM = "NE"; |
const char str_E[] PROGMEM = "E "; |
const char str_SE[] PROGMEM = "SE"; |
const char str_S[] PROGMEM = "S "; |
const char str_SW[] PROGMEM = "SW"; |
const char str_W[] PROGMEM = "W "; |
const char str_NW[] PROGMEM = "NW"; |
const char str_N[] PROGMEM = "N "; |
const char *directions_p[8] PROGMEM = { |
str_NE, |
str_E, |
str_SE, |
str_S, |
str_SW, |
str_W, |
str_NW, |
str_N |
}; |
// Flags |
uint8_t COSD_FLAGS2 = 0; |
GPS_Pos_t last5pos[7]; |
uint8_t error = 0; |
//-------------------------------------------------------------- |
// convert the <heading> gotton from NC into an index |
uint8_t heading_conv (uint16_t heading) |
{ |
if (heading > 23 && heading < 68) |
return 0; //direction = "NE"; |
else if (heading > 67 && heading < 113) |
return 1; //direction = "E "; |
else if (heading > 112 && heading < 158) |
return 2; //direction = "SE"; |
else if (heading > 157 && heading < 203) |
return 3; //direction = "S "; |
else if (heading > 202 && heading < 248) |
return 4; //direction = "SW"; |
else if (heading > 247 && heading < 293) |
return 5; //direction = "W "; |
else if (heading > 292 && heading < 338) |
return 6; //direction = "NW"; |
return 7; //direction = "N "; |
} |
//-------------------------------------------------------------- |
// draw a compass rose at <x>/<y> for <heading> |
void draw_compass (uint8_t x, uint8_t y, uint16_t heading) |
{ |
uint8_t front = 19 + (heading / 22); |
for (uint8_t i = 0; i < 9; i++) |
lcd_putc (x++, y, pgm_read_byte(&rose[front - 4 + i]), 0); |
} |
//-------------------------------------------------------------- |
// variometer |
// draw variometer arrows at <x>/<y> according to <variometer> |
// |
void draw_variometer (uint8_t x, uint8_t y, uint8_t width, uint8_t hight, int16_t variometer) |
{ |
lcd_rect (x, y - ((hight) / 2), width, hight, 1); |
lcd_frect (x + 1, y - ((hight) / 2) + 1, width - 2, hight - 2, 0); |
lcd_line (x, y, x + width, y, 1); |
if (variometer > 0) // steigend |
{ |
switch (variometer / 5) |
{ |
case 0: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
break; |
case 1: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
lcd_frect (x + 3, y - 3, 4, 1, 1); // 5 > 9 |
break; |
case 2: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
lcd_frect (x + 3, y - 3, 4, 1, 1); // 5 > 9 |
lcd_frect (x + 2, y - 5, 6, 1, 1); // 10 > 14 |
break; |
default: |
lcd_line (x + 4, y - 1, x + 6, y - 1, 1); // 1 > 4 |
lcd_frect (x + 3, y - 3, 4, 1, 1); // 5 > 9 |
lcd_frect (x + 2, y - 5, 6, 1, 1); // 10 > 14 |
lcd_frect (x + 1, y - 6, 8, 1, 1); // 15 > |
break; |
} |
} |
else if (variometer < 0) // fallend |
{ |
switch ((variometer) / -5) |
{ |
case 0: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
break; |
case 1: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
lcd_frect (x + 3, y + 2, 4, 1, 1); // - 5 > - 9 |
break; |
case 2: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
lcd_frect (x + 3, y + 2, 4, 1, 1); // - 5 > - 9 |
lcd_frect (x + 2, y + 4, 6, 1, 1); // -10 > -14 |
break; |
default: |
lcd_line (x + 4, y + 1, x + 6, y + 1, 1); // - 1 > - 4 |
lcd_frect (x + 3, y + 2, 4, 1, 1); // - 5 > - 9 |
lcd_frect (x + 2, y + 4, 6, 1, 1); // -10 > -14 |
lcd_frect (x + 1, y + 5, 8, 1, 1); // -15 > |
break; |
} |
} |
} |
//-------------------------------------------------------------- |
void print_statistics (void) |
{ |
uint8_t line = 0; |
lcd_cls (); |
// lcd_printp_at (12, 7, PSTR("Ende"), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
// max Altitude |
lcd_printp_at (0, line, stats_item_pointers[0], 0); |
write_ndigit_number_s (13, line, max_Altimeter / (30 / AltimeterAdjust), 4, 0); |
lcd_putc (17, line, 'm', 0); |
// max Speed |
lcd_printp_at (0, ++line, stats_item_pointers[1], 0); |
write_ndigit_number_u (14, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0); |
lcd_printp_at(17, line, PSTR("km/h"), 0); |
// max Distance |
lcd_printp_at (0, ++line, stats_item_pointers[2], 0); |
write_ndigit_number_u (14, line, max_Distance / 10, 3, 0); |
lcd_putc (17, line, 'm', 0); |
// max time |
lcd_printp_at (0, ++line, stats_item_pointers[4], 0); |
write_time (13, line, max_FlyingTime); |
// min voltage |
lcd_printp_at (0, ++line, stats_item_pointers[3], 0); |
write_ndigit_number_u_10th (13, line, min_UBat, 3, 0); |
lcd_putc (17, line, 'V', 0); |
#if 1 |
// max Current |
lcd_printp_at (0, ++line, stats_item_pointers[5], 0); |
write_ndigit_number_u_10th (13, line, max_Current, 3, 0); |
lcd_putc (17, line, 'A', 0); |
// Used Capacity |
lcd_printp_at (0, ++line, stats_item_pointers[6], 0); |
write_ndigit_number_u (13, line, max_Capacity, 4, 0); |
lcd_printp_at(17, line, PSTR("mAh"), 0); |
#else |
// longitude |
lcd_printp_at (0, ++line, stats_item_pointers[5], 0); |
write_gps_pos (8, line, naviData->CurrentPosition.Longitude); |
// latitude |
lcd_printp_at (0, ++line, stats_item_pointers[6], 0); |
write_gps_pos (8, line, naviData->CurrentPosition.Latitude); |
#endif |
while (!get_key_press (1 << KEY_ESC)) |
timer = TIMEOUT; |
COSD_FLAGS2 &= ~COSD_WASFLYING; |
get_key_press(KEY_ALL); |
lcd_cls(); |
} |
//-------------------------------------------------------------- |
void print_position (void) |
{ |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Breitengr Längengr "), 2); |
lcd_puts_at(0, 0, strGet(START_LASTPOS1), 2); |
// lcd_printp_at (12, 7, PSTR("Ende"), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
uint8_t ij =0; |
for(ij=0;ij<6;ij++) |
{ |
uint32_t lon = last5pos[ij].Longitude; |
write_ndigit_number_u (1, ij+1, (uint16_t)(lon/10000000), 2, 0); |
lcd_printp_at (3, ij+1, PSTR("."), 0); |
write_ndigit_number_u (4, ij+1, (uint16_t)((lon/1000) % 10000), 4, 1); |
write_ndigit_number_u (8, ij+1, (uint16_t)((lon/10) % 100), 2, 1); |
uint32_t lat = last5pos[ij].Latitude; |
write_ndigit_number_u (12, ij+1, (uint16_t)(lat/10000000), 2, 0); |
lcd_printp_at (14, ij+1, PSTR("."), 0); |
write_ndigit_number_u (15, ij+1, (uint16_t)((lat/1000) % 10000), 4, 1); |
write_ndigit_number_u (19, ij+1, (uint16_t)((lat/10) % 100), 2, 1); |
} |
while (!get_key_press (1 << KEY_ESC)) |
timer = TIMEOUT; |
get_key_press(KEY_ALL); |
lcd_cls(); |
} |
//-------------------------------------------------------------- |
void osd (uint8_t ShowMode) |
{ |
uint8_t flag; |
uint8_t tmp_dat; |
uint8_t OSD_Mode; |
uint8_t info_3D = 0; |
// Clear statistics |
max_Altimeter = 0; |
max_GroundSpeed = 0; |
max_Distance = 0; |
min_UBat = 255; |
max_FlyingTime = 0; |
// flags from last round to check for changes |
uint8_t old_FCFlags = 0; |
uint16_t old_hh = 0; |
uint8_t old_AngleNick = 0; |
uint8_t old_AngleRoll = 0; |
OSD_Mode = ShowMode; |
if(error == 0) |
lcd_cls(); |
if (hardware == FC) |
{ |
lcd_printp_at(0, 3, PSTR("Only with NC !"), 0); |
timer = 100; |
while (timer > 0); |
return; |
} |
SwitchToNC(); |
mode = 'O'; |
// disable debug... |
// RS232_request_mk_data (0, 'd', 0); |
tmp_dat = 0; |
SendOutData ('d', ADDRESS_ANY, 1, &tmp_dat, 1); |
// request OSD Data from NC every 100ms |
// RS232_request_mk_data (1, 'o', 100); |
tmp_dat = 10; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
flag = 0; |
timer = TIMEOUT; |
abo_timer = ABO_TIMEOUT; |
do |
{ |
if (rxd_buffer_locked) |
{ |
timer = TIMEOUT; |
Decode64 (); |
naviData = (NaviData_t *) pRxData; |
if(error == 1) |
lcd_cls(); |
error = 0; |
GPS_Pos_t currpos; |
currpos.Latitude = naviData->CurrentPosition.Latitude; |
currpos.Longitude = naviData->CurrentPosition.Longitude; |
if((currpos.Latitude != last5pos[0].Latitude)&&(currpos.Longitude != last5pos[0].Longitude)) |
{ |
last5pos[6] = last5pos[5]; |
last5pos[5] = last5pos[4]; |
last5pos[4] = last5pos[3]; |
last5pos[3] = last5pos[2]; |
last5pos[2] = last5pos[1]; |
last5pos[1] = last5pos[0]; |
last5pos[0] = currpos; |
} |
flag = 1; |
if (OSD_Mode == 1) |
{ |
if (naviData->FCFlags & FCFLAG_MOTOR_RUN) |
{ // should be engines running |
// motors are on, assume we were/are flying |
COSD_FLAGS2 |= COSD_WASFLYING; |
} |
else |
{ // stats |
if ((COSD_FLAGS2 & COSD_WASFLYING) | (get_key_press (1 << KEY_ENTER))) |
print_statistics (); |
if (get_key_press (1 << KEY_PLUS)) |
print_position (); |
} |
lcd_ecircle(22, 35, 16, 1); |
// Ground Speed |
write_ndigit_number_u (1, 0, (uint16_t) (((uint32_t) naviData->GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0); |
lcd_printp_at(4, 0, PSTR("km/h"), 0); |
// Compass |
write_ndigit_number_u (14, 0, naviData->CompassHeading, 3, 0); |
lcd_putc (17, 0, 0x1E, 0); // degree symbol |
lcd_printp_at (18, 0, (const char *) (pgm_read_word ( &(directions_p[heading_conv(naviData->CompassHeading)]))), 0); |
draw_compass (12, 1, naviData->CompassHeading); |
// Altitude |
//note:lephisto:according to several sources it's /30 |
if (naviData->Altimeter > (300 / AltimeterAdjust) || naviData->Altimeter < (-300 / AltimeterAdjust)) // above 10m only write full meters |
write_ndigit_number_s (0, 1, naviData->Altimeter / (30 / AltimeterAdjust), 4, 0); |
else // up to 10m write meters.dm |
write_ndigit_number_s_10th (0, 1, naviData->Altimeter / (3 / AltimeterAdjust), 3, 0); |
lcd_putc (4, 1, 'm', 0); |
draw_variometer (54, 7, 10, 14, naviData->Variometer); |
// TODO: verify correctness |
uint16_t heading_home = (naviData->HomePositionDeviation.Bearing + 360 - naviData->CompassHeading) % 360; |
lcd_ecirc_line (22, 35, 15, old_hh, 0); |
old_hh = heading_home; |
lcd_ecirc_line (22, 35, 15, heading_home, 1); |
write_ndigit_number_u (7, 3, heading_home, 3, 0); |
lcd_putc (10, 3, 0x1e, 0); // degree symbol |
write_ndigit_number_u (7, 2, naviData->HomePositionDeviation.Distance / 10, 3, 0); |
lcd_putc (10, 2, 'm', 0); |
// Sats in use |
lcd_printp_at(11, 4, PSTR("Sats"), 0); |
write_ndigit_number_u (8, 4, naviData->SatsInUse, 2, 0); |
if (naviData->NCFlags & NC_FLAG_MANUAL_CONTROL) |
lcd_putc (19, 4, 'M', 0); // rc transmitter |
else |
lcd_putc (19, 4, 'X', 0); // clear |
if (naviData->NCFlags & NC_FLAG_CH) |
lcd_printp_at (8, 5, PSTR("Coming Home"), 0); |
else if (naviData->NCFlags & NC_FLAG_PH) |
lcd_printp_at (8, 5, PSTR("Pos. Hold "), 0); |
else // (naviData->NCFlags & NC_FLAG_FREE) |
lcd_printp_at (8, 5, PSTR("Free "), 0); |
// Flying time |
write_time (7, 6, naviData->FlyingTime); |
lcd_printp_at (12, 6, PSTR("h"), 0); |
// RC |
write_ndigit_number_u (15, 6, naviData->RC_Quality, 3, 0); |
lcd_printp_at(18, 6, PSTR("\x1F"), 0); // RC-transmitter |
if (naviData->NCFlags & NC_FLAG_NOSERIALLINK) |
{ |
lcd_printpns_at(19, 6, PSTR(" "), 0); // clear |
} |
else |
{ |
lcd_printpns_at(19, 6, PSTR("PC"), 0); |
} |
// Battery level |
write_ndigit_number_u_10th (0, 7, naviData->UBat, 3, 0); |
lcd_putc (4, 7, 'V', 0); |
// Akku Warnung |
if (naviData->UBat < MK_LowBat) |
{ //Beeper ein |
BeepTime = 3000; |
BeepMuster = 0x0020; |
} |
//if (naviData->UBat > MK_LowBat+2) //bei kurzzeitigen Schwankungen Beeper erst wieder aus wenn UBat 0,2 V höher als Warnschwelle |
//{ //Beeper aus |
// BeepTime = 0; |
// BeepMuster = 0xFFFF; |
//} |
// Akku Warnung Ende |
// Current |
write_ndigit_number_u_10th (7, 7, naviData->Current, 3, 0); |
lcd_putc (11, 7, 'A', 0); |
// Capacity |
write_ndigit_number_u (14, 7, naviData->UsedCapacity, 4, 0); |
lcd_printp_at(18, 7, PSTR("mAh"), 0); |
// remember statistics (only when engines running) |
if (naviData->FCFlags & FCFLAG_MOTOR_RUN) |
{ |
if (naviData->Altimeter > max_Altimeter) max_Altimeter = naviData->Altimeter; |
if (naviData->GroundSpeed > max_GroundSpeed) max_GroundSpeed = naviData->GroundSpeed; |
if (naviData->HomePositionDeviation.Distance > max_Distance) max_Distance = naviData->HomePositionDeviation.Distance; |
if (naviData->UBat < min_UBat) min_UBat = naviData->UBat; |
if (naviData->FlyingTime > max_FlyingTime) max_FlyingTime = naviData->FlyingTime; |
if (naviData->Current > max_Current) max_Current = naviData->Current; |
if (naviData->UsedCapacity > max_Capacity) max_Capacity = naviData->UsedCapacity; |
} |
// remember last values |
last_RC_Quality = naviData->RC_Quality; |
last_UBat = naviData->UBat; |
old_FCFlags = naviData->FCFlags; |
rxd_buffer_locked = FALSE; |
} |
// 3D Lage anzeige beginnt hier ----------------------------------- |
else if (OSD_Mode == 3) |
{ |
uint16_t head_home = (naviData->HomePositionDeviation.Bearing + 360 - naviData->CompassHeading) % 360; |
lcd_cls (); |
lcd_line(0,32,128,32,1); // horizontal // |
lcd_line(64,0,64,64,1); // vertical // |
lcd_printp_at(12, 7, PSTR("End Info"), 0); |
// 45' Angel |
lcd_line(62,11,66,11,1); // -- // |
lcd_line(22,30,22,34,1); // | // |
lcd_line(106,30,106,34,1); // | // |
lcd_line(62,53,66,53,1); // -- // |
if (info_3D == 1) |
{ |
lcd_line(34,17,36,15,1); // / // |
lcd_line(92,15,94,17,1); // \ // |
lcd_line(34,47,36,49,1); // \ // |
lcd_line(92,49,94,47,1); // / // |
// lcd_printp_at(9, 0, PSTR("V"), 0); |
// lcd_printp_at(0, 3, PSTR("L"), 0); |
// lcd_printp_at(20, 3, PSTR("R"), 0); |
// lcd_printp_at(9, 7, PSTR("H"), 0); |
lcd_puts_at(9, 0, strGet(OSD_V), 0); |
lcd_puts_at(0, 3, strGet(OSD_L), 0); |
lcd_puts_at(20, 3, strGet(OSD_R), 0); |
lcd_puts_at(9, 7, strGet(OSD_H), 0); |
lcd_printp_at(0, 0, PSTR("N:"), 0); |
write_ndigit_number_s (2, 0, naviData->AngleNick, 3, 0); |
lcd_printp_at(0, 7, PSTR("R:"), 0); |
write_ndigit_number_s (2, 7, naviData->AngleRoll, 3, 0); |
lcd_printp_at(15, 0, PSTR("K:"), 0); |
write_ndigit_number_s (18, 0,head_home, 3, 0); |
} |
if (get_key_press (1 << KEY_ENTER)) |
{ |
info_3D++; |
if (info_3D > 1) |
info_3D = 0; |
} |
uint8_t Nick = ((-naviData->AngleNick/2)+32); |
uint8_t Roll = -naviData->AngleRoll+64; |
lcd_ecircle(old_AngleRoll,old_AngleNick, 10, 0); |
lcd_ecirc_line (old_AngleRoll, old_AngleNick, 9, old_hh, 0); |
lcd_ecircle(Roll, Nick, 10, 1); |
lcd_ecirc_line (Roll, Nick, 9, head_home, 1); |
old_hh = head_home; |
old_AngleNick = Nick; |
old_AngleRoll = Roll; |
// remember last values |
last_RC_Quality = naviData->RC_Quality; |
last_UBat = naviData->UBat; |
old_FCFlags = naviData->FCFlags; |
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 ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
abo_timer = ABO_TIMEOUT; |
} |
} |
} |
while (!get_key_press (1 << KEY_ESC) && timer); |
get_key_press(KEY_ALL); |
// disable OSD Data from NC |
// RS232_request_mk_data (1, 'o', 0); |
tmp_dat = 0; |
SendOutData ('o', ADDRESS_NC, 1, &tmp_dat, 1); |
mode = 0; |
rxd_buffer_locked = FALSE; |
// Bei Verbindungsverlusst werden hier die letzten bekannten Koordinaten ausgegeben!!! |
if (!timer) |
{ // timeout occured |
if (flag) |
{ |
// Falls Spannungswarnung an war Beeper aus// |
BeepTime = 0; |
BeepMuster = 0xFFFF; |
lcd_cls (); |
WriteLastPosition(last5pos[0].Longitude,last5pos[0].Latitude); // im EEprom speichern |
lcd_puts_at(0, 0, strGet(OSD_ERROR), 2); |
// lcd_printp_at (0, 0, PSTR(" ERROR: Datenverlust "), 2); |
// lcd_printp_at (0, 2, PSTR("Letzte bekannte"), 0); |
// lcd_printp_at (0, 3, PSTR("Position gespeichert."), 0); |
lcd_puts_at(0, 2, strGet(OSD_POS1), 0); |
lcd_puts_at(0, 3, strGet(OSD_POS2), 0); |
// lcd_printp_at (19, 7, PSTR("OK"), 0); |
lcd_puts_at(19, 7, strGet(OK), 0); |
// lcd_printp_at (0, 5, PSTR(" Breitengr Längengr "), 0); |
lcd_puts_at(0, 5, strGet(START_LASTPOS1), 0); |
lcd_puts_at(12, 7, strGet(ENDE), 0); |
BeepTime = 1500; |
BeepMuster = 0x0040; |
error = 1; |
uint32_t lon = last5pos[0].Longitude; |
write_ndigit_number_u (1, 6, (uint16_t)(lon/10000000), 2, 0); |
lcd_printp_at (3, 6, PSTR("."), 0); |
write_ndigit_number_u (4, 6, (uint16_t)((lon/1000) % 10000), 4, 1); |
write_ndigit_number_u (8, 6, (uint16_t)((lon/10) % 100), 2, 1); |
uint32_t lat = last5pos[0].Latitude; |
write_ndigit_number_u (12, 6, (uint16_t)(lat/10000000), 2, 0); |
lcd_printp_at (14, 6, PSTR("."), 0); |
write_ndigit_number_u (15, 6, (uint16_t)((lat/1000) % 10000), 4, 1); |
write_ndigit_number_u (19, 6, (uint16_t)((lat/10) % 100), 2, 1); |
while (!get_key_press (1 << KEY_ENTER)); |
timer = TIMEOUT; |
lcd_cls(); |
return; |
} |
} |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/osd.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 _OSD_H |
#define _OSD_H |
void osd (uint8_t ShowMode); |
void vario_beep_output (void); |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/parameter.c |
---|
0,0 → 1,1379 |
/***************************************************************************** |
* 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 <stdlib.h> |
#include "main.h" |
#include "lcd.h" |
#include "timer.h" |
#include "usart.h" |
#include "mk-data-structs.h" |
#include "parameter.h" |
#include "menu.h" |
#include "eeprom.h" |
#include "parameter_names.h" |
#include "messages.h" |
#define TIMEOUT 500 // 5 sec |
uint8_t display_settings_menu (void); |
uint8_t display_param_menu (uint8_t); |
uint8_t load_setting (uint8_t); |
uint8_t write_setting (uint8_t); |
uint8_t display_section_menu(void); |
void edit_param(uint8_t); |
void copy_setting(void); |
mk_param_struct_t *mk_param_struct; |
uint8_t ii; |
volatile uint8_t offset = 0; |
volatile uint8_t dmode = 0; |
volatile uint8_t target_pos = 1; |
volatile uint8_t offset2 = 0; |
volatile uint8_t pmode = 0; |
volatile uint8_t target_pos2 = 1; |
volatile uint8_t setting = 0; |
uint8_t changes = 0; |
#define OFFSETOF(type, field) ((unsigned int) &(((type *) 0)->field)) |
#define MKOSO(field) (uint8_t)OFFSETOF(mk_param_struct_t, field) |
//-------------------------------------------------------------- |
// Group, Typ, Min, Max, Struct-Name(Value), Default1, Default2, Default3+4+5, |
// 0 1 2 3 4 5 6 7 |
// ||| |
// Typ == (0 ohne Poti, 1 mit Poti, 2 bitfield, 3 serCh, 4 LEDmask, 5 Angle, 6 Empfaenger), |
// |
prog_uchar param_config[8*PARAM_COUNT]= |
{ |
// group 0 (kanaele) 1-15 |
0,0,1,12, MKOSO(Kanalbelegung)+2 , 1,1,1, // gas |
0,0,1,12, MKOSO(Kanalbelegung)+3 , 4,4,4, // gier |
0,0,1,12, MKOSO(Kanalbelegung)+0 , 3,3,3, // nick |
0,0,1,12, MKOSO(Kanalbelegung)+1 , 2,2,2, // roll |
0,3,1,25, MKOSO(Kanalbelegung)+4 , 5,5,5, // poti1 |
0,3,1,25, MKOSO(Kanalbelegung)+5 , 6,6,6, // poti2 |
0,3,1,25, MKOSO(Kanalbelegung)+6 , 7,7,7, // poti3 |
0,3,1,25, MKOSO(Kanalbelegung)+7 , 8,8,8, // poti4 |
0,3,1,25, MKOSO(Kanalbelegung)+8 , 9,9,9, // poti5 |
0,3,1,25, MKOSO(Kanalbelegung)+9 , 10,10,10, // poti6 |
0,3,1,25, MKOSO(Kanalbelegung)+10, 11,11,11, // poti7 |
0,3,1,25, MKOSO(Kanalbelegung)+11, 12,12,12, // poti8 |
0,0,0,12, MKOSO(MotorSafetySwitch), 0,0,0, // Motor Sicherungsswitch |
0,2,0,0x04, MKOSO(ExtraConfig), 0,0,0, // erweiterte signal pruefung |
0,6,0,6, MKOSO(Receiver), 1,1,1, |
// group 1 (main) 16-23 |
1,2,0,0x01, MKOSO(GlobalConfig), 0,0,0, // hoehenregler |
1,2,0,0x20, MKOSO(GlobalConfig), 1,1,1, // gps |
1,2,0,0x08, MKOSO(GlobalConfig), 1,1,1, // kompass |
1,2,0,0x10, MKOSO(GlobalConfig), 0,0,0, // feste ausrichtung |
1,2,0,0x04, MKOSO(ExtraConfig), 0,0,0, // erweiterte signal pruefung |
1,2,0,0x40, MKOSO(GlobalConfig), 1,1,1, // achsentkopplung |
1,2,0,0x80, MKOSO(GlobalConfig), 0,0,0, // drehratenbregrenzung |
1,2,0,0x04, MKOSO(GlobalConfig), 0,0,0, // heading hold |
// group 2 (stick) 24-27 |
2,0,0,20, MKOSO(Stick_P), 10,8,6, |
2,0,0,20, MKOSO(Stick_D), 16,16,10, |
2,1,0,255, MKOSO(StickGier_P), 6,6,4, |
2,1,0,255, MKOSO(ExternalControl), 0,0,0, |
// group3 : looping 28-36 |
3,2,0,0x01, MKOSO(BitConfig), 0,0,0, // oben |
3,2,0,0x02, MKOSO(BitConfig), 0,0,0, // unten |
3,2,0,0x04, MKOSO(BitConfig), 0,0,0, // links |
3,2,0,0x08, MKOSO(BitConfig), 0,0,0, // rechts |
3,1,0,255, MKOSO(LoopGasLimit), 50,50,50, |
3,0,0,247, MKOSO(LoopThreshold), 90,90,90, |
3,0,0,247, MKOSO(LoopHysterese), 50,50,50, |
3,0,0,247, MKOSO(WinkelUmschlagNick), 78,78,78, |
3,0,0,247, MKOSO(WinkelUmschlagRoll), 78,78,78, |
// group 4 (hoehe) 37-50 |
4,2,0,0x01, MKOSO(GlobalConfig), 0,0,0, // hoehenrelger |
4,2,0,0x01, MKOSO(ExtraConfig), 0,0,0, // vario oder hoeenbergenzung |
4,2,0,0x02, MKOSO(GlobalConfig), 1,1,1, // hoehenschalter |
4,2,0,0x02, MKOSO(ExtraConfig), 1,1,1, // variobeep |
4,1,0,255, MKOSO(MaxHoehe), 255,255,255, |
4,0,0,247, MKOSO(Hoehe_MinGas), 30,30,30, |
4,1,0,255, MKOSO(Hoehe_P), 15,15,15, |
4,1,0,255, MKOSO(Luftdruck_D), 30,30,30, |
4,1,0,255, MKOSO(Hoehe_ACC_Wirkung), 0,0,0, |
4,1,0,255, MKOSO(MaxAltitude), 150,150,150, |
4,0,0,247, MKOSO(Hoehe_Verstaerkung), 15,15,15, |
4,0,0,247, MKOSO(Hoehe_HoverBand), 8,8,8, |
4,1,0,255, MKOSO(Hoehe_GPS_Z), 64,64,64, |
4,0,0,160, MKOSO(Hoehe_StickNeutralPoint), 0,0,0, |
// group 5 : kamera 51-66 |
5,1,0,255, MKOSO(ServoNickControl), 128,128,128, |
5,0,0,247, MKOSO(ServoNickComp), 50,50,50, |
5,2,0,0x01, MKOSO(ServoCompInvert), 0,0,0, // nick |
5,0,0,247, MKOSO(ServoNickMin), 15,15,15, |
5,0,0,247, MKOSO(ServoNickMax), 230,230,230, |
5,1,0,255, MKOSO(ServoRollControl), 128,128,128, |
5,0,0,247, MKOSO(ServoRollComp), 85,85,85, |
5,2,0,0x02, MKOSO(ServoCompInvert), 0,0,0, // roll |
5,0,0,247, MKOSO(ServoRollMin), 70,70,70, |
5,0,0,247, MKOSO(ServoRollMax), 220,220,220, |
5,0,2,8, MKOSO(ServoNickRefresh), 4,4,4, |
5,0,0,247, MKOSO(ServoManualControlSpeed), 60,60,60, |
5,5,0,247, MKOSO(CamOrientation), 0,0,0, |
5,1,0,255, MKOSO(Servo3), 125,125,125, |
5,1,0,255, MKOSO(Servo4), 125,125,125, |
5,1,0,255, MKOSO(Servo5), 125,125,125, |
// group 6 : navictrl 67-85 |
6,2,0,0x20, MKOSO(GlobalConfig), 1,1,1, // gps |
6,1,0,255, MKOSO(NaviGpsModeControl), 254,254,254, |
6,1,0,255, MKOSO(NaviGpsGain), 100,100,100, |
6,0,0,247, MKOSO(NaviStickThreshold), 8,8,8, |
6,0,0,247, MKOSO(NaviGpsMinSat), 6,6,6, |
6,1,0,255, MKOSO(NaviGpsP), 90,90,90, |
6,1,0,255, MKOSO(NaviGpsI), 90,90,90, |
6,1,0,255, MKOSO(NaviGpsD), 90,90,90, |
6,1,0,255, MKOSO(NaviGpsPLimit), 75,75,75, |
6,1,0,255, MKOSO(NaviGpsILimit), 85,85,85, |
6,1,0,255, MKOSO(NaviGpsDLimit), 75,75,75, |
6,1,0,255, MKOSO(NaviGpsACC), 0,0,0, |
6,1,0,255, MKOSO(NaviWindCorrection), 90,90,90, |
6,1,0,255, MKOSO(NaviAccCompensation), 42,42,42, |
6,1,0,255, MKOSO(NaviOperatingRadius), 245,245,245, |
6,1,0,255, MKOSO(NaviAngleLimitation), 140,140,140, |
6,0,0,247, MKOSO(NaviPH_LoginTime), 5,5,5, |
6,2,0,0x20, MKOSO(ExtraConfig), 0,0,0, // dynamic ph |
6,0,0,247, MKOSO(ComingHomeAltitude), 0,0,0, |
// group 7 : ausgaenge 86-95 |
7,4,0,255, MKOSO(J16Bitmask), 95,95,95, |
7,1,0,255, MKOSO(J16Timing), 20,20,20, |
7,2,0,0x20, MKOSO(BitConfig), 0,0,0, // Motor_Off_Led1 |
7,2,0,0x10, MKOSO(BitConfig), 1,1,1, // Motor_Blink1 |
7,4,0,255, MKOSO(J17Bitmask), 243,243,243, |
7,1,0,255, MKOSO(J17Timing), 20,20,20, |
7,2,0,0x40, MKOSO(BitConfig), 0,0,0, // Motor_Off_Led2 |
7,2,0,0x80, MKOSO(BitConfig), 1,1,1, // Motor_Blink2 |
7,4,0,255, MKOSO(WARN_J16_Bitmask), 170,170,170, |
7,4,0,255, MKOSO(WARN_J17_Bitmask), 170,170,170, |
// group 8 : versch. 96-107 |
8,0,0,247, MKOSO(Gas_Min), 8,8,8, |
8,0,0,247, MKOSO(Gas_Max), 230,230,230, |
8,1,0,255, MKOSO(KompassWirkung), 64,64,64, |
8,1,0,255, MKOSO(CareFreeModeControl), 0,0,0, // Carefree |
8,2,0,0x40, MKOSO(ExtraConfig), 0,0,0, // teachable Carefree |
8,0,0,247, MKOSO(UnterspannungsWarnung), 33,33,33, |
8,2,0,0x08, MKOSO(ExtraConfig), 0,0,0, // Voltage referenz |
8,0,0,247, MKOSO(NotGasZeit), 90,90,90, |
8,0,0,247, MKOSO(NotGas), 45,45,45, |
8,0,0,247, MKOSO(FailSafeTime), 0,0,0, |
8,2,0,0x80, MKOSO(ExtraConfig), 0,0,0, // Ignore Compass Error |
8,2,0,0x10, MKOSO(ExtraConfig), 0,0,0, // Kein Summer ohne Sender beim Start |
// group 9 : gyro 108-120 |
9,1,0,255, MKOSO(Gyro_P), 90,100,100, |
9,1,0,255, MKOSO(Gyro_I), 120,120,120, |
9,1,0,255, MKOSO(Gyro_D), 10,10,10, |
9,1,0,255, MKOSO(Gyro_Gier_P), 90,100,100, |
9,1,0,255, MKOSO(Gyro_Gier_I), 120,120,120, |
9,1,0,255, MKOSO(DynamicStability), 70,70,70, |
9,2,0,0x80, MKOSO(GlobalConfig), 0,0,0, // drehratenbregrenzung |
9,0,0,247, MKOSO(GyroAccFaktor), 27,27,27, |
9,0,0,247, MKOSO(GyroAccAbgleich), 32,32,32, |
9,1,0,255, MKOSO(I_Faktor), 16,16,16, |
9,0,0,247, MKOSO(Driftkomp), 0,0,0, |
9,0,0,16, MKOSO(Gyro_Stability), 6,6,6, |
9,0,0,247, MKOSO(MotorSmooth), 0,0,0, |
// group 10: benutzer 121-128 |
10,1,0,255, MKOSO(UserParam1), 0,0,0, |
10,1,0,255, MKOSO(UserParam2), 0,0,0, |
10,1,0,255, MKOSO(UserParam3), 0,0,0, |
10,1,0,255, MKOSO(UserParam4), 0,0,0, |
10,1,0,255, MKOSO(UserParam5), 0,0,0, |
10,1,0,255, MKOSO(UserParam6), 0,0,0, |
10,1,0,255, MKOSO(UserParam7), 0,0,0, |
10,1,0,255, MKOSO(UserParam8), 0,0,0, |
// group 11: achskoppl 129-132 |
11,2,0,0x40, MKOSO(GlobalConfig), 0,0,0, // achsentkopplung |
11,1,0,255, MKOSO(AchsKopplung1), 90,90,90, |
11,1,0,255, MKOSO(AchsKopplung2), 55,55,55, |
11,1,0,255, MKOSO(CouplingYawCorrection), 70,70,70, |
// group 12: mixer 133 |
12,5,0,23,MKOSO(OrientationAngle), 0,0,0, |
// group 13 (easy-setup) 134-144 |
13,2,0,0x01, MKOSO(GlobalConfig), 0,0,0, // hoehenrelger |
13,1,0,255, MKOSO(MaxHoehe), 255,255,255, |
13,0,0,160, MKOSO(Hoehe_StickNeutralPoint), 0,0,0, |
13,2,0,0x20, MKOSO(GlobalConfig), 1,1,1, // gps |
13,1,0,255, MKOSO(NaviGpsModeControl), 254,254,254, |
13,2,0,0x20, MKOSO(ExtraConfig), 0,0,0, // dynamic ph |
13,0,0,247, MKOSO(ComingHomeAltitude), 0,0,0, |
13,1,0,255, MKOSO(CareFreeModeControl), 0,0,0, // Carefree |
13,2,0,0x40, MKOSO(ExtraConfig), 0,0,0, // teachable Carefree |
13,0,0,12, MKOSO(MotorSafetySwitch), 0,0,0, // Motor Sicherungsswitch |
13,5,0,23, MKOSO(OrientationAngle), 0,0,0, |
}; |
//-------------------------------------------------------------- |
#define ITEMS_RX 7 |
prog_char param_items_rx[ITEMS_RX][17]= // zeilen,zeichen+1 |
{ |
"PPM ", |
"Spektrum ", |
"Spektrum HiRes ", |
"Spektrum LoRes ", |
"Jeti ", |
"ACT DSL ", |
"HOTT ", |
}; |
//-------------------------------------------------------------- |
void edit_parameter(void) |
{ |
SwitchToFC(); |
// uint8_t setting; |
setting = display_settings_menu(); |
if(setting == 255) |
return; |
if(setting == 6) |
{ |
copy_setting(); |
return; |
} |
lcd_cls(); |
// lcd_printp_at (0, 0, PSTR(" Setting x "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SETTINGS), 2); |
lcd_putc (9, 0, (setting + 48), 2); // ASCII ab 48 (hex 30) beginnt 0 - 9 |
// lcd_printp_at (3, 2, PSTR("ändern"), 0); |
// lcd_printp_at (3, 3, PSTR("aktivieren"), 0); |
lcd_puts_at(3, 2, strGet(PARA_CHANGE), 0); |
lcd_puts_at(3, 3, strGet(PARA_AKTIVI), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
uint8_t val = menu_choose2 (2, 3, 2, 0, 0); |
if (val == 255) |
return; |
if(val == 3) |
{ |
load_setting(setting); |
uint8_t setting_written = write_setting(setting); |
if(setting_written == setting) |
{ |
lcd_cls_line (0,2,21); |
lcd_cls_line (0,3,21); |
// lcd_printp_at (11, 0, PSTR("aktiviert"), 0); |
lcd_puts_at(11, 0, strGet(PARA_AKTIV), 0); |
} |
else |
{ |
lcd_cls_line (0,2,21); |
lcd_cls_line (0,3,21); |
// lcd_printp_at (0, 4, PSTR("Error"), 0); |
lcd_puts_at(0, 4, strGet(FEHLER), 0); |
} |
_delay_ms(2000); |
return; |
} |
if(setting == 255) |
return; |
uint8_t setting_loaded = load_setting(setting); |
if(setting_loaded == 255) |
return; |
offset = 0; |
dmode = 0; |
target_pos = 1; |
changes =0; |
uint8_t group =0; |
do |
{ |
group = display_section_menu(); |
if(group != 255) |
{ |
offset2 = 0; |
pmode = 0; |
target_pos2 = 1; |
uint8_t param; |
do |
{ |
param = display_param_menu(group); |
if(param != 255) |
{ |
edit_param(param); |
} |
} |
while(param != 255); |
} |
} |
while(group != 255); |
if(changes == 1) |
{ |
lcd_cls(); |
// lcd_printp_at (0, 0, PSTR(" Setting x speichern?"), 2); |
lcd_puts_at(0, 0, strGet(PARA_SAVESETT), 2); |
lcd_putc (9, 0, (setting + 48), 2); // ASCII ab 48 (hex 30) beginnt 0 - 9 |
write_ndigit_number_u(9, 0, setting, 1, 0); |
// lcd_printp_at (3, 2, PSTR("Ja"), 0); |
// lcd_printp_at (3, 3, PSTR("Nein"), 0); |
lcd_puts_at(3, 2, strGet(YES), 0); |
lcd_puts_at(3, 3, strGet(NOO), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
uint8_t val = menu_choose2 (2, 3, 2, 0, 0); |
if(val == 2) |
{ |
uint8_t setting_written = write_setting(setting); |
if(setting_written == setting) |
{ |
// lcd_printp_at (3, 4, PSTR("Gespeichert und"), 0); |
lcd_puts_at(3, 4, strGet(PARA_SETTSAVED), 0); |
// lcd_printp_at (3, 5, PSTR("Aktiviert"), 0); |
lcd_puts_at(3, 5, strGet(PARA_AKTIV), 0); |
} |
else |
{ |
// lcd_printp_at (0, 4, PSTR("Error"), 0); |
lcd_puts_at(0, 4, strGet(FEHLER), 0); |
} |
timer = 100; |
while (timer > 0); |
} |
} |
} |
//-------------------------------------------------------------- |
void copy_setting(void) |
{ |
uint8_t fromsetting = 3; |
uint8_t tosetting = 5; |
lcd_cls(); |
// lcd_printp_at (0, 1, PSTR("Kopiere Setting"), 0); |
// lcd_printp_at (0, 3, PSTR("von x nach y"), 0); |
// lcd_printp_at (0, 7, PSTR("von nach Ende OK"), 0); |
lcd_puts_at(0, 1, strGet(PARA_COPY), 0); |
lcd_puts_at(0, 3, strGet(PARA_FROMTO), 0); |
lcd_puts_at(0, 7, strGet(PARA_ENDE), 0); |
do |
{ |
write_ndigit_number_u(5,3,fromsetting, 1,0); |
write_ndigit_number_u(14,3,tosetting, 1,0); |
if(get_key_press (1 << KEY_MINUS)) |
{ |
fromsetting++; |
if(fromsetting == 6) fromsetting = 1; |
} |
if(get_key_press (1 << KEY_PLUS)) |
{ |
tosetting++; |
if(tosetting == 6) tosetting = 1; |
} |
if(get_key_press (1 << KEY_ENTER)) |
{ |
lcd_printp_at (0, 5, PSTR("Wirklich Kopieren?"), 0); |
lcd_puts_at(0, 5, strGet(PARA_COPYQ), 0); |
// lcd_printp_at (0, 7, PSTR(" Ende OK"), 0); |
lcd_puts_at(12, 7, strGet(KEYLINE4), 0); |
do |
{ |
if(get_key_press (1 << KEY_ENTER)) |
{ |
uint8_t loaded = load_setting(fromsetting); |
if(loaded == fromsetting) |
{ |
uint8_t written = write_setting(tosetting); |
if(written == tosetting) |
{ |
lcd_printp_at (0, 5, PSTR("Kopiert und Aktiviert"), 0); |
lcd_puts_at(0, 5, strGet(PARA_COPYACTIV), 0); |
} |
else |
{ |
// lcd_printp_at (0, 5, PSTR("Fehler"), 0); |
lcd_puts_at(0, 5, strGet(FEHLER), 0); |
lcd_cls_line (6, 5, 14); |
} |
} |
else |
{ |
// lcd_printp_at (0, 5, PSTR("Fehler"), 0); |
lcd_puts_at(0, 5, strGet(FEHLER), 0); |
lcd_cls_line (6, 5, 14); |
} |
timer = 100; |
while (timer > 0); |
return; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
lcd_cls_line (0, 5, 21); |
// lcd_printp_at (0, 7, PSTR("von nach Ende OK"), 0); |
lcd_puts_at(0, 7, strGet(PARA_ENDE), 0); |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//-------------------------------------------------------------- |
void edit_param(uint8_t param) |
{ |
lcd_cls(); |
uint8_t type = pgm_read_byte(param_config+(8*param)+1); |
// lcd_printp_at (0, 0, PSTR(" Ändere Setting: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_CHANGESETT), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
if(type != 6) |
lcd_printp_at(0,2,param_names[param][DisplayLanguage], 0); |
//------------------------------------------------------- |
if(type == 0) // ohne poti |
{ |
lcd_printp_at (4, 4, PSTR("( - ) (d: )"), 0); |
lcd_printp_at (12, 6, PSTR("Std."), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t min = pgm_read_byte(param_config+(8*param)+2); |
uint8_t max = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
write_ndigit_number_u (5, 4, min, 3, 0); |
write_ndigit_number_u (9, 4, max, 3, 0); |
write_ndigit_number_u (17, 4, defaultvalue, 3, 0); |
do |
{ |
write_ndigit_number_u (0, 4, newvalue, 3, 0); |
lcd_frect ((8*0), (8*5), (newvalue * (16*8) / max), 6, 1); |
if(max >= 50) |
{ |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) |
{ |
if((newvalue-1) >= min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
// lcd_frect ((newvalue * (16*8) / max), (8*5), ((16*8) / max), 6, 0); |
newvalue--; |
} |
} |
} |
else |
{ |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) |
{ |
if((newvalue-1) >= min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
// lcd_frect ((newvalue * (16*8) / max), (8*5), ((16*8) / max), 6, 0); |
newvalue--; |
} |
} |
} |
if(get_key_long (1 << KEY_ESC)) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = defaultvalue; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 1) // mit poti |
{ |
lcd_printp_at (4, 4, PSTR("(0-247-P8)(d:Po )"), 0); |
lcd_printp_at (12, 6, PSTR("Std."), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t min = pgm_read_byte(param_config+(8*param)+2); |
uint8_t max = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
uint8_t mode = 0; |
if(defaultvalue > 247) |
{ |
lcd_printp_at (17, 4, PSTR("Po )"), 0); |
write_ndigit_number_u (19, 4, 256-defaultvalue, 1, 0); |
} |
else |
write_ndigit_number_u (17, 4, defaultvalue, 3, 0); |
if(value > 247) |
mode = 1; |
do |
{ |
if(newvalue > 247) |
mode = 1; |
else |
mode = 0; |
if(mode == 0) |
{ |
write_ndigit_number_u (0, 4, newvalue, 3, 0); |
lcd_frect ((8*0), (8*5), (newvalue * (16*8) / max), 6, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 3)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
if(newvalue > 247) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = 255; |
} |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 3)) |
{ |
if((newvalue-1)>=min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
// lcd_frect ((newvalue * (16*8) / max), (8*5), ((16*8) / max), 6, 0); |
newvalue--; |
} |
} |
} |
else |
{ |
lcd_printp_at (0, 4, PSTR("Po"), 0); |
write_ndigit_number_u (2, 4, 256 - newvalue, 1, 0); |
lcd_frect ((8*0), (8*5), ((256 - newvalue) * (16*8) / 8), 6, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
if(newvalue - 1 > 247) |
{ |
newvalue--; |
} |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
lcd_frect (((255 - newvalue) * (16*8) / 8), (8*5), (16*8), 6, 0); |
// lcd_frect (((255 - newvalue) * (16*8) / 8), (8*5), ((16*8) / 8), 6, 0); |
newvalue++; |
if(newvalue == 0) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); // balken löschen |
newvalue = 247; |
} |
} |
} |
if(get_key_long (1 << KEY_ESC)) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = defaultvalue; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 2) // ja/nein |
{ |
// lcd_printp_at (3, 4, PSTR("Ja"), 0); |
// lcd_printp_at (3, 5, PSTR("Nein"), 0); |
lcd_puts_at(3, 4, strGet(YES), 0); |
lcd_puts_at(3, 5, strGet(NOO), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
uint8_t bitmap = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
if(defaultvalue == 1) |
lcd_printp_at (8, 4, PSTR("*"), 0); |
if(defaultvalue == 0) |
lcd_printp_at (8, 5, PSTR("*"), 0); |
do |
{ |
if(newvalue & bitmap) |
{ |
lcd_printp_at (1, 4, PSTR("\x1d"), 0); |
lcd_printp_at (1, 5, PSTR(" "), 0); |
} |
else |
{ |
lcd_printp_at (1, 4, PSTR(" "), 0); |
lcd_printp_at (1, 5, PSTR("\x1d"), 0); |
} |
if((get_key_press (1 << KEY_MINUS)) && (!(newvalue & bitmap))) |
newvalue ^= bitmap; |
if((get_key_press (1 << KEY_PLUS)) && (newvalue & bitmap)) |
newvalue ^= bitmap; |
if(get_key_press (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 3) // serCH |
{ |
lcd_printp_at (4, 4, PSTR("(1-S12/W) (d: )"), 0); |
lcd_printp_at (12, 6, PSTR("Std."), 0); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t min = pgm_read_byte(param_config+(8*param)+2); |
uint8_t max = pgm_read_byte(param_config+(8*param)+3); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t defaultvalue = pgm_read_byte(param_config+(8*param)+4 + setting ); // 5 - 7 |
uint8_t newvalue = value; |
write_ndigit_number_u (17, 4, defaultvalue, 3, 0); |
do |
{ |
if (newvalue<=(max-13)) |
write_ndigit_number_u (0, 4, newvalue, 3, 0); |
else |
{ |
if (newvalue<=(max-1)) |
{ |
lcd_printp_at (0, 4, PSTR("S"), 0); |
write_ndigit_number_u (1, 4, (newvalue-12), 2, 0); |
} |
} |
if (newvalue==max) |
lcd_printp_at (0, 4, PSTR("WPE"), 0); |
lcd_frect ((8*0), (8*5), (newvalue * (16*8)) / max, 6, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 2)) |
{ |
if((newvalue+1) <= max) |
newvalue++; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 2)) |
{ |
if((newvalue-1)>=min) |
{ |
lcd_frect (((newvalue - 1) * (16*8) / max), (8*5), (16*8), 6, 0); |
newvalue--; |
} |
} |
if(get_key_long (1 << KEY_ESC)) |
{ |
lcd_frect ((8*0), (8*5), (16*8), 6, 0); |
newvalue = defaultvalue; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 4) // led bitfeld |
{ |
// TODO: Übersetzung |
lcd_printp_at (0, 7, PSTR(" \x19 0\x11I Ende OK"), 0); |
if (param == 93 || param == 94) |
// lcd_printp_at (5, 6, PSTR("aktiv"), 0); |
lcd_puts_at(5, 6, strGet(AKTIV), 0); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t newvalue = value; |
uint8_t pos = 0; |
do |
{ |
for(ii = 0; ii < 8; ii++) |
{ |
if(newvalue & (1 << ii)) |
lcd_printp_at (8-ii, 4,PSTR("1"),0); |
else |
lcd_printp_at (8-ii, 4,PSTR("0"),0); |
} |
lcd_printp_at (pos+1, 5,PSTR("\x12"),0); |
if(get_key_press (1 << KEY_MINUS)) |
{ |
lcd_printp_at (pos+1, 5,PSTR(" "),0); |
pos++; |
if(pos == 8) |
pos = 0; |
} |
if (param == 93 || param == 94) |
{ |
if(get_key_long (1 << KEY_PLUS)) |
{ |
if (newvalue != 0) |
newvalue = 0; |
else |
newvalue = 170; |
} |
} |
if(get_key_short (1 << KEY_PLUS)) |
newvalue ^= (1<<(7-pos)); |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes = 1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 5) // Angle |
{ |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_2), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE2), 0); |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
lcd_ecircle(102, 35, 16, 1); |
uint8_t newvalue = value; |
uint8_t oldvalue = newvalue; |
do |
{ |
if(oldvalue != newvalue) lcd_ecirc_line (102, 35, 15, oldvalue*15, 0); |
oldvalue = newvalue; |
lcd_ecirc_line (102, 35, 15, newvalue*15, 1); |
if(get_key_press (1 << KEY_PLUS) | get_key_long_rpt_sp ((1 << KEY_PLUS), 1)) |
{ |
newvalue++; |
if(newvalue == 24) |
newvalue = 0; |
} |
if(get_key_press (1 << KEY_MINUS) | get_key_long_rpt_sp ((1 << KEY_MINUS), 1)) |
{ |
if(newvalue == 0) |
newvalue = 24; |
newvalue--; |
} |
if(get_key_short (1 << KEY_ENTER)) |
{ |
if(newvalue != value) |
{ |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
} |
break; |
} |
} |
while (!get_key_short (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
//------------------------------------------------------- |
if(type == 6) // receiver |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)); |
uint8_t newvalue = value + 1; |
uint8_t val =0; |
uint8_t ii = 0; |
uint8_t offset = 0; |
uint8_t dmode = 0; |
uint8_t target_pos = 1; |
uint8_t size = ITEMS_RX; |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
while(1) |
{ |
ii = 0; |
if(offset > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
lcd_printp_at(3,ii+1,param_items_rx[ii+offset], 0); |
if((ii == 5)&&(ii+offset < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
val = menu_choose3 (1, 5, target_pos,0,1); //menu_choose3 (min, max, start, return_at_start, return_at_end) |
else |
val = menu_choose3 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
val = menu_choose3 (2, 6, target_pos,1,0); |
else |
val = menu_choose3 (2, 5, target_pos,1,1); |
} |
if(val == 254) // überlauf unten |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) // überlauf oben |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
else if(val == 252) // ESC |
return; |
else if(val <= size) |
{ |
newvalue = val + offset - 1; |
*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*param)+4)) = newvalue; |
changes=1; |
return; |
} |
} |
} |
} |
//-------------------------------------------------------------- |
uint8_t display_param_menu(uint8_t group) |
{ |
uint8_t items[20]; |
uint8_t size=0; |
for(ii = 0;ii < PARAM_COUNT; ii++) |
{ |
if(pgm_read_byte(param_config+(8*ii)) == (group-1)) |
{ |
items[size] = ii; |
size++; |
} |
} |
uint8_t val =0 ; |
while(1) |
{ |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Wähle Parameter: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SELECT), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
ii = 0; |
if(offset2 > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset2) < size) |
{ |
lcd_printp_at(3,ii+1,param_names[items[ii+offset2]][DisplayLanguage], 0); |
// this reads the the offset in the struct from the pgm configuration table and then reads the value from the struct |
uint8_t type = pgm_read_byte(param_config+(8*items[ii+offset2])+1); |
if(type == 0) |
write_ndigit_number_u (18, ii+1, *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)), 3, 0); |
if(type == 1) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
if(value < 248) |
write_ndigit_number_u (18, ii+1, value, 3, 0); |
if(value >= 248) |
{ |
lcd_printp_at (18, ii+1, PSTR(" P"), 0); |
write_ndigit_number_u (20, ii+1, 256-value, 1, 0); |
} |
} |
if(type == 2) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
uint8_t bitmap = pgm_read_byte(param_config+(8*items[ii+offset2])+3); |
if(value & bitmap) |
lcd_printp_at (18, ii+1, PSTR(" J"), 0); |
else |
lcd_printp_at (18, ii+1, PSTR(" N"), 0); |
} |
if(type == 3) |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
if (value<=12) |
write_ndigit_number_u (18, ii+1, value, 3, 0); |
else |
if (value<=(24)) |
{ |
lcd_printp_at (18, ii+1, PSTR("S"), 0); |
write_ndigit_number_u (19, ii+1, (value-12), 2, 0); |
} |
if (value==25) |
lcd_printp_at (18, ii+1, PSTR("WPE"), 0); |
} |
if(type == 4) |
write_ndigit_number_u (18, ii+1, *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)), 3, 0); |
if(type == 5) |
write_ndigit_number_u (18, ii+1, (*(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)))*15, 3, 0); |
if(type == 6) // Empfänger Typ |
{ |
uint8_t value = *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)); |
if(value == 0) |
lcd_printp_at (18, ii+1, PSTR("PPM"), 0); |
else if(value == 1) |
lcd_printp_at (18, ii+1, PSTR("Spe"), 0); |
else if(value == 2) |
lcd_printp_at (18, ii+1, PSTR("SpH"), 0); |
else if(value == 3) |
lcd_printp_at (18, ii+1, PSTR("SpL"), 0); |
else if(value == 4) |
lcd_printp_at (18, ii+1, PSTR("Jet"), 0); |
else if(value == 5) |
lcd_printp_at (18, ii+1, PSTR("ACT"), 0); |
else if(value == 6) |
lcd_printp_at (18, ii+1, PSTR("HoT"), 0); |
else |
write_ndigit_number_u (18, ii+1, *(((uint8_t*)mk_param_struct) + pgm_read_byte(param_config+(8*items[ii+offset2])+4)), 3, 0); |
} |
} |
if((ii == 5)&&(ii+offset2 < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
if(pmode == 0) |
{ |
if(offset2 == 0) |
{ |
if(size > 6) |
val = menu_choose2 (1, 5, target_pos2,0,1); |
else |
val = menu_choose2 (1, size, target_pos2,0,0); |
} |
else |
val = menu_choose2 (2, 5, target_pos2,1,1); |
} |
if(pmode == 1) |
{ |
if(offset2+7 > size) |
val = menu_choose2 (2, 6, target_pos2,1,0); |
else |
val = menu_choose2 (2, 5, target_pos2,1,1); |
} |
if(val == 254) |
{ |
offset2++; |
pmode = 1; |
target_pos2 = 5; |
} |
else if(val == 253) |
{ |
offset2--; |
pmode = 0; |
target_pos2 = 2; |
} |
else |
break; |
} |
if(val != 255) |
{ |
target_pos2=val; |
return items[val+offset2-1]; |
} |
else |
return val; |
} |
//-------------------------------------------------------------- |
uint8_t display_section_menu(void) |
{ |
uint8_t size = PAGES; |
uint8_t val =0; |
while(1) |
{ |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Wähle Seite: "), 2); |
lcd_puts_at(0, 7, strGet(PARA_SEITE),2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
ii = 0; |
if(offset > 0) |
lcd_printp_at(1,1, PSTR("\x12"), 0); |
for(ii = 0;ii < 6 ; ii++) |
{ |
if((ii+offset) < size) |
lcd_printp_at(3,ii+1,param_pages[ii+offset][DisplayLanguage], 0); |
if((ii == 5)&&(ii+offset < (size-1))) |
lcd_printp_at(1,6, PSTR("\x13"), 0); |
} |
if(dmode == 0) |
{ |
if(offset == 0) |
{ |
if(size > 6) |
val = menu_choose2 (1, 5, target_pos,0,1); |
else |
val = menu_choose2 (1, size, target_pos,0,0); |
} |
else |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
if(dmode == 1) |
{ |
if(offset+7 > size) |
val = menu_choose2 (2, 6, target_pos,1,0); |
else |
val = menu_choose2 (2, 5, target_pos,1,1); |
} |
if(val == 254) |
{ |
offset++; |
dmode = 1; |
target_pos = 5; |
} |
else if(val == 253) |
{ |
offset--; |
dmode = 0; |
target_pos = 2; |
} |
else |
break; |
} |
if(val != 255) |
{ |
target_pos=val; |
return val+offset; |
} |
else |
return val; |
} |
//-------------------------------------------------------------- |
uint8_t display_settings_menu (void) |
{ |
uint8_t status; |
lcd_cls (); |
// lcd_printp_at (0, 0, PSTR(" Wähle Setting: "), 2); |
lcd_puts_at(0, 0, strGet(PARA_SELSETT), 2); |
// lcd_printp_at (0, 7, PSTR(KEY_LINE_1), 0); |
lcd_puts_at(0, 7, strGet(KEYLINE1), 0); |
for(setting=1;setting<6;setting++) |
{ |
status = load_setting(setting); |
if(status == 255) |
return 255; |
write_ndigit_number_u (3, setting, status, 1, 0); |
lcd_print_at (5,setting,(uint8_t*)mk_param_struct->Name, 0); |
} |
// lcd_printp_at (3, 6, PSTR("Kopiere Setting"), 0); |
lcd_puts_at(3, 6, strGet(PARA_COPY), 0); |
status = load_setting(0xff); |
if(status == 255) |
return 255; |
setting = menu_choose (1, 6, 1,status); |
return setting; |
} |
//-------------------------------------------------------------- |
uint8_t load_setting(uint8_t setting) |
{ |
mode = 'Q'; // Settings |
uint8_t timeout = 50; |
rxd_buffer_locked = FALSE; |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData ('q', ADDRESS_FC, 1, &setting, 1); |
// _delay_ms(50); |
timer = 20; |
while (timer > 0); |
timeout--; |
} |
if (timeout != 0) |
{ |
Decode64 (); |
setting = *pRxData; |
mk_param_struct = (mk_param_struct_t *) (pRxData + 1) ; |
} |
else |
{ // timeout occured |
// lcd_printp_at (0, 2, PSTR("Fehler: keine Daten"), 0); |
lcd_puts_at(0, 2, strGet(OSD_ERROR), 0); |
timer = 100; |
while (timer > 0); |
setting = 255; |
} |
return setting; |
} |
//-------------------------------------------------------------- |
uint8_t write_setting(uint8_t setting) |
{ |
mode = 'S'; // Settings |
uint8_t timeout = 50; |
rxd_buffer_locked = FALSE; |
while (!rxd_buffer_locked && timeout) |
{ |
SendOutData ('s', ADDRESS_FC, 2, &setting, 1, mk_param_struct, sizeof(mk_param_struct_t)); |
// _delay_ms(50); |
timer = 20; |
while (timer > 0); |
timeout--; |
} |
if (timeout != 0) |
{ |
Decode64 (); |
setting = *pRxData; |
} |
else // timeout occured |
{ |
// lcd_printp_at (0, 2, PSTR("Fehler: keine Daten"), 0); |
lcd_puts_at(0, 2, strGet(OSD_ERROR), 0); |
timer = 100; |
while (timer > 0); |
setting = 255; |
} |
return setting; |
} |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/parameter.h |
---|
0,0 → 1,46 |
/***************************************************************************** |
* 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 _PARAMETER_H |
#define _PARAMETER_H |
void edit_parameter (void); |
uint8_t load_setting(uint8_t setting); |
#endif |
/Transportables_Koptertool/branch/GPL_PKT_V3_5_8a_FC086/parameter_names.h |
---|
0,0 → 1,267 |
/***************************************************************************** |
* 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* |
*****************************************************************************/ |
#define PAGES 14 |
#define PARAM_COUNT 144 |
#define PARAM_LENGTH 15 |
#define PARAM_NUM_LANG 4 |
// German Englisch Franzïösisch Holländisch |
prog_char param_pages[PAGES][PARAM_NUM_LANG][PARAM_LENGTH]= // zeilen,zeichen+1 |
{ |
{"Kanäle ","Channel ","Canaux ","Kanaal "}, |
{"Konfiguration ","main ","Config ","Configuratie "}, |
{"Stick ","stick ","Manche ","Stick "}, |
{"Looping ","Looping ","Looping ","Looping "}, |
{"Höhe ","Altitude ","Altitude ","Hoogte "}, |
{"Kamera ","Camera ","Camera ","Camera "}, |
{"NaviCtrl ","NaviCtrl ","NaviCtrl ","NaviCtrl "}, |
{"Ausgänge ","Outputs ","Sorties ","Uitgangen "}, |
{"Verschiedenes ","Divers ","Divers ","Diversen "}, |
{"Gyro ","Gyro ","Gyro ","Gyro "}, |
{"Benutzer ","User ","Parametres ","Gebruiker "}, |
{"Achskopplung ","Coupl Axes ","Coupl Axes ","Koppeling Ass "}, |
{"Mixer-Setup ","Config Mix ","Config Mix ","Config. Mixer "}, |
{"Easy Setup ","Config Easy ","Config Easy ","Config. easy "}, |
}; |
//Namen |
prog_char param_names[PARAM_COUNT][PARAM_NUM_LANG][PARAM_LENGTH]= |
{ |
// group 0 (kanaele) 1-15 |
{"Gas ","Throttle ","Gaz ","Gas "}, |
{"Gier ","Gier ","Lacet ","Gier "}, |
{"Nick ","Nick ","Tangage ","Nick "}, |
{"Roll ","Roll ","Roulis ","Roll "}, |
{"Poti 1 ","Poti 1 ","Poti 1 ","Poti 1 "}, |
{"Poti 2 ","Poti 2 ","Poti 2 ","Poti 2 "}, |
{"Poti 3 ","Poti 3 ","Poti 3 ","Poti 3 "}, |
{"Poti 4 ","Poti 4 ","Poti 4 ","Poti 4 "}, |
{"Poti 5 ","Poti 5 ","Poti 5 ","Poti 5 "}, |
{"Poti 6 ","Poti 6 ","Poti 6 ","Poti 6 "}, |
{"Poti 7 ","Poti 7 ","Poti 7 ","Poti 7 "}, |
{"Poti 8 ","Poti 8 ","Poti 8 ","Poti 8 "}, |
{"Motor Sich.Sch","Mot.Safety Sw.","Mot.Safety Sw.","Mot.saf.schak."}, |
{"Erw. Sig. Pr. ","Enh. Sig.Check","Recep Renforce","Uitg.Sig.Check"}, |
{"Empfänger Typ ","Receiver Type ","Type Recepteur","Ontvang. Type "}, |
// group 1 (main) 16-23 |
{"Höhenregeler ","Ctrl Altitude ","Ctrl Altitude ","Ctrl Hoogte "}, |
{"GPS ","GPS ","GPS ","GPS "}, |
{"Kompass ","Compass ","Compas ","Kompas "}, |
{"KompFest Ausr.","CompOrient.Fix","Maintien Cap ","Kompas vast "}, |
{"Erw. Sig. Pr. ","Sens.RcvSigVal","Ctrl Ren Recep","ExtRec Signaal"}, |
{"Achs(e.)koppl.","Axis Couping ","Decouplage Axe","As koppeling "}, |
{"Drehratenbegr.","RotRate limit.","Limit Vit. Rot","RotRate limit."}, |
{"Heading Hold ","Nick/Roll ","Orient. Fixe ","Koers vast "}, |
// group 2 (stick) 24-27 |
{"Nick/Roll P ","Nick/Roll P ","Roul/Tang P ","Nick/Roll P "}, |
{"Nick/Roll D ","Nick/Roll D ","Roul/Tang D ","Nick/Roll D "}, |
{"Gier P ","Gier P ","Lacet P ","Gier P "}, |
{"Externe Kontr.","Extern Ctrl ","Ctrl Externe ","Extern Control"}, |
// group3 : (looping) 28-36 |
{"Looping oben ","Looping up ","Looping Avant ","Looping omhoog"}, |
{"Looping unten ","Looping down ","Looping Arrier","Looping bened."}, |
{"Looping links ","Looping left ","Looping Gauche","Looping links "}, |
{"Looping rechts","Looping right ","Looping Droite","Looping rechts"}, |
{"Gas Limit ","Throttle Limit","Limite Gaz ","Gas Limiet "}, |
{"Ansprechschw. ","Seuil Reponse ","Seuil Reponse ","Drempelwaarde "}, |
{"Hysterese ","Hysteresis ","Hysteresis ","Hysterese "}, |
{"Umkehrp. Nick ","Nick Invers ","Invers Roulis ","Nick geinvert."}, |
{"Umkehrp. Roll ","Roll Invers ","Invers Tangage","Roll geinvert."}, |
// group 4 (hoehe) 37-50 |
{"Höhenregelung ","Altitude Ctrl ","Ctrl Altitude ","Hoogte Control"}, |
{"J:HBeg,N:Vario","Y:LimH,N:Vario","Y:LimH,N:Vario","Y:LimH,N:Vario"}, |
{"Schalter f. H.","Switch f. High","Swith Hauteur ","Schak. Hoogte "}, |
{"akust. Vario ","acoustic Vario","Vario Acoustic","Akoest. Vario "}, |
{"Sollhöhe ","Setpoint ","Hauteur Max ","Gewenste hoogt"}, |
{"Min. Gas ","min. throttle ","Gaz Min ","Minimaal gas "}, |
{"Höhe P ","Altitude P ","Altitude P ","Hoogte P "}, |
{"Luftdruck D ","Barometric D ","Pression D ","Barometr. D "}, |
{"Z-ACC ","ACC Z ","ACC Z ","ACC Z "}, |
{"Max. Höhe ","Max. High ","Max. High ","Max. hoogte "}, |
{"Verstärkung/R ","gain/rate ","Gain/Frequence","Verst./rate "}, |
{"Schwebegas +/-","hoover varia. ","Var Vol Stat ","hoover varia. "}, |
{"GPS Z ","GPS Z ","GPS Z ","GPS Z "}, |
{"Stick Neutr. P","stick neutr. P","Pos Neutre Man","stick neutr. P"}, |
// group 5 : (kamera) 51-66 |
{"Nick S. Anst. ","nick serv ctrl","Asserv Tangage","nick serv ctrl"}, |
{"Nick Kompens. ","nick compens. ","Comp Tangage ","nick compens. "}, |
{"Nick Umkehren ","nick inv. dir.","Inverser Roul ","nick inv.rich."}, |
{"Nick Servo min","nick servo min","Servo Min ","nick servo min"}, |
{"Nick Servo max","nick servo max","Servo Max ","nick servo max"}, |
{"Roll S. Anst. ","roll serv ctrl","Asserv Roulis ","roll serv ctrl"}, |
{"Roll Kompens. ","roll compens. ","Comp Tangage ","roll compens. "}, |
{"Roll Umkehren ","roll inv. dir.","Inverser Tang ","roll omkeren "}, |
{"Roll Servo min","roll servo min","Servo Min ","roll servo min"}, |
{"Roll Servo max","roll servo max","Servo Max ","roll servo max"}, |
{"Anst. Geschw. ","servo refresh ","Taux Refresh ","Servo refresh "}, |
{"Manuelle Gesch","manuell Speed ","Vitesse Man. ","Snelh.handbed."}, |
{"Cam Richtung ","Cam Orient ","Cam Orient ","Camera richt. "}, |
{"Servo 3 ","Servo 3 ","Servo 3 ","Servo 3 "}, |
{"Servo 4 ","Servo 4 ","Servo 4 ","Servo 4 "}, |
{"Servo 5 ","Servo 5 ","Servo 5 ","Servo 5 "}, |
// group 6 : (navictrl) 67-85 "CH Hoogte " |
{"GPS ","enable GPS ","Activer GPS ","enable GPS "}, |
{"GPS Modus St. ","GPS mode contr","Def Mode GPS ","GPS mode contr"}, |
{"GPS Verstärk. ","GPS Gain ","Gain GPS ","GPS versterk. "}, |
{"GPS St. Schw. ","GPS stick thre","Seuil Manche ","GPS st. dremp."}, |
{"Min. Sat. ","Min. Sat. ","Nbre Min. Sat.","Min. Sat. "}, |
{"GPS-P ","GPS-P ","GPS-P ","GPS-P "}, |
{"GPS-I ","GPS-I ","GPS-I ","GPS-I "}, |
{"GPS-D ","GPS-D ","GPS-D ","GPS-D "}, |
{"P Limit ","Limit P ","Limite P ","Limiet P "}, |
{"I Limit ","Limit I ","Limite I ","Limiet I "}, |
{"D Limit ","Limit D ","Limite D ","Limiet D "}, |
{"GPS Acc ","GPS Acc ","Accel GPS ","GPS Acc "}, |
{"GPS Windkorr. ","GPS Wind Corr.","Correct Vent ","GPS Wind Corr."}, |
{"Bremswirkung ","Speed compens.","Compens Vit ","Remwerking "}, |
{"GPS max. Rad. ","GPS max.radius","Rayon GPS Max ","GPS max.radius"}, |
{"GPS Winkel Li.","GPS angl.limit","Limit Angl GPS","GPS hoek lim. "}, |
{"PH Login time ","PH login time ","Tps Memoris ","PH login tijd "}, |
{"Dynamic PH ","Dynamic PH ","Dynamic PH ","Dynamische PH "}, |
{"CH Höhe ","CH High ","CH High ","CH Hoogte "}, |
// group 7 : (ausgaenge) 86-95 |
{"LED1 Bitmaske ","Out1 Bitmask ","Bitmask S1 ","Uitg1 Bitpatr."}, |
{" Timing ","Out1 Timing ","Horloge S1 ","Uitg1 Timing "}, |
{" sofort an","Activ ","Actif ","Direct aan "}, |
{" n.m.Motor","Act. wi. Motor","Actif Au Repos","Akt. motor uit"}, |
{"LED2 Bitmaske ","Out2 Bitmask ","Bitmask S2 ","Uitg2 Bitpatr."}, |
{" Timing ","Out2 Timing ","Horloge S2 ","Uitg2 Timing "}, |
{" sofort an","Activ ","Actif ","Direct aan "}, |
{" n.m.Motor","Act. wi. Motor","Actif Au Repos","Akt. motor uit"}, |
{"LED1 Vmin.Warn","Out1 undervolt","Al Undervoltag","Uitg1 ondersp."}, |
{"LED2 Vmin.Warn","Out2 undervolt","Al Undervoltag","Uitg2 ondersp."}, |
// group 8 : (verschiedenes) 96-107 |
{"Min. Gas ","min. throttle ","Gaz Min. ","minimaal gas "}, |
{"Max. Gas ","max. throttle ","Gaz Max. ","maximaal gas "}, |
{"Kompasswirkung","compass effect","Effet compas ","Kompas effect "}, |
{"Carefree St. ","Carefree Ctrl ","Carefree Ctrl ","Carefree Ctrl "}, |
{"Teachable Care","Teachable Care","Teachable Care","Teachable Care"}, |
{"Unterspannung ","undervoltage ","Sous Tension ","Onderspanning "}, |
{"Volt Referenz ","Volt Referenz ","Tension Ref ","Ref. spanning "}, |
{"Not Gas Zeit ","Emerg.Thr.Time","Duree secours ","Nood gas tijd "}, |
{"Not Gas ","Emerg.Throttle","Gaz de secours","Nood gas "}, |
{"Fails. CH Time","Fails. CH Time","Fails. CH Time","Fails. CH Tijd"}, |
{"Compass Error ","Compass Error ","Compass Error ","Kompas Error "}, |
{"k.Summer o Sen","Compass Error ","Son Abs Emett ","Kompas Error "}, |
// group 9 : (gyro) 108-120 |
{"Gyro P ","Gyro P ","Gyro P ","Gyro P "}, |
{"Gyro I ","Gyro I ","Gyro I ","Gyro I "}, |
{"Gyro D ","Gyro D ","Gyro D ","Gyro D "}, |
{"Gier P ","Lacet P ","Lacet P ","Gier P "}, |
{"Gier I ","Lacet I ","Lacet I ","Gier I "}, |
{"Dynamische St.","dynamic stabi.","Stab Dynamique","Dynamis. stab."}, |
{"Drehratenbeg. ","RotRate limit.","Limit Dit Rota","Toerental lim."}, |
{"ACC/Gyro Fak. ","ACC/Gyro Fact ","ACC/Gyro Fact ","ACC/Gyro Fact "}, |
{"ACC/Gyro Komp.","Comp ACC/Gyro ","Comp ACC/Gyro ","Comp ACC/Gyro "}, |
{"Hauptregler I ","Main I ","Regul Princ I ","Hoofdregel. I "}, |
{"Drifkompensat.","drift Compens.","Compens Deriv ","Drift compens."}, |
{"Gyro stab. ","Gyro stability","Gyro Stability","Gyro stabilit."}, |
{"Motor smooth ","Motor smooth ","Motor Smooth ","Motor smooth "}, |
// group 10: (benutzer) 121-128 |
{"Parameter 1 ","Parameter 1 ","Parameter 1 ","Parameter 1 "}, |
{"Parameter 2 ","Parameter 2 ","Parameter 2 ","Parameter 2 "}, |
{"Parameter 3 ","Parameter 3 ","Parameter 3 ","Parameter 3 "}, |
{"Parameter 4 ","Parameter 4 ","Parameter 4 ","Parameter 4 "}, |
{"Parameter 5 ","Parameter 5 ","Parameter 5 ","Parameter 5 "}, |
{"Parameter 6 ","Parameter 6 ","Parameter 6 ","Parameter 6 "}, |
{"Parameter 7 ","Parameter 7 ","Parameter 7 ","Parameter 7 "}, |
{"Parameter 8 ","Parameter 8 ","Parameter 8 ","Parameter 8 "}, |
// group 11: (achskopplung) 129-132 |
{"Achs(e.)koppl.","(De)Coupl Axes","(De)Coupl Axes","As koppeling "}, |
{"Gier pos. Kopp","Retroac lacet ","Retroac Lacet ","Gier pos. kop."}, |
{"Nick/Roll Kopp","Retro roul/tan","Retro Roul/Tan","Nick/Roll kop."}, |
{"Gier Korrektur","Correct lacet ","Correct Lacet ","Gier correctie"}, |
// group 12: (mixer) 133 |
{"Orientierung ","Orientierung ","Orientation "}, |
// group 13 (easy) 134-144 |
{"Höhenregelung ","Altitude Ctrl ","Ctrl Altitude ","Hoogte Contr. "}, |
{"Sollhöhe ","Setpoint ","Hauteur Max ","Gewenst.hoogte"}, |
{"Stick Neutr. P","stick neutr. P","Pos Neutre Man","Stick neutr. P"}, |
{"GPS ","enable GPS ","Activer GPS ","Enable GPS "}, |
{"GPS Modus St. ","GPS mode contr","Def mode GPS ","GPS mode contr"}, |
{"Dynamic PH ","Dynamic PH ","Dynamic PH ","Dynamic PH "}, |
{"CH Höhe ","CH High ","CH High ","CH hoogte "}, |
{"Carefree St. ","Carefree Ctrl ","Carefree Ctrl ","Carefree Ctrl "}, |
{"Teachable Care","Teachable Care","Teachable Care","Teachable Care"}, |
{"Motor Sich.Sch","Mot.Safety Sw.","Mot.Safety Sw.","Mot.saf.schak."}, |
{"Orientierung ","Orientation ","Orientierung ","Orientatie "}, |
}; |