0,0 → 1,142 |
/***************************************************************************** |
* Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
* Copyright (C) 2009-2010 Peter "woggle" Mack, mac@denich.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. * |
* * |
*****************************************************************************/ |
|
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <avr/interrupt.h> |
|
#include "main.h" |
#include "menu.h" |
#include "lcd.h" |
#include "settings.h" |
#include "timer.h" |
#include "lipo.h" |
#include "eeprom.h" |
|
|
//***************************************************************************** |
// |
void set_toggledisplay(void) |
{ |
cli(); |
|
if (LCD_ORIENTATION == 0) |
LCD_ORIENTATION = 4; |
else |
LCD_ORIENTATION = 0; |
|
WriteParameter (); |
|
LCD_Init(); |
|
sei(); |
} |
|
//***************************************************************************** |
// |
void set_viewfont(void) |
{ |
uint8_t page; |
|
page = 0; |
lcd_view_font (page); |
do |
{ |
if (get_key_press (1 << KEY_PLUS) && (page < 1)) |
{ |
page++; |
lcd_view_font (page); |
} |
if (get_key_press (1 << KEY_MINUS) && (page > 0)) |
{ |
page--; |
lcd_view_font (page); |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
} |
|
//***************************************************************************** |
// |
void set_lipo(void) |
{ |
lcd_cls(); |
lcd_printp_at(0, 0, PSTR("LiPo Under Voltage:"), 0); |
lcd_printp_at(0, 2, PSTR("Warn Voltage: "), 0); |
lcd_printpns_at (0, 7, PSTR(" - + Ok"), 0); |
do |
{ |
write_ndigit_number_u_10th(14, 2, AD_WarnLevel, 3, 0); |
if (get_key_press (1 << KEY_PLUS) && (AD_WarnLevel < 40)) |
{ |
AD_WarnLevel++; |
} |
else if (get_key_press (1 << KEY_MINUS) && (AD_WarnLevel > 20)) |
{ |
AD_WarnLevel--; |
} |
} |
while (!get_key_press (1 << KEY_ESC)); |
get_key_press(KEY_ALL); |
|
WriteParameter (); |
} |
|
|
// Not really usefull :-) |
// testing.... |
|
//***************************************************************************** |
// |
void set_line(void) |
{ |
lcd_cls (); |
#if 1 |
lcd_line (10, 20, 100, 50, 1); // draw a line |
#else |
lcd_ecircle(22, 35, 18, 1); |
|
uint16_t old_d = 0; |
for (uint16_t i = 0; i < 360; i += 10) |
{ |
lcd_ecirc_line (22, 35, 17, old_d, 0); |
old_d = i; |
lcd_ecirc_line (22, 35, 17, i, 1); |
while (!get_key_press (1 << KEY_ENTER)); |
} |
#endif |
while (!get_key_press (1 << KEY_ESC)); |
} |
|
//***************************************************************************** |
// |
void set_rect(void) |
{ |
lcd_cls (); |
//lcd_rect (10, 20, 100, 40, 1); // draw a rect |
//lcd_ellipse(60, 30, 23, 20, 1); |
lcd_frect(10, 10, 20, -5, 1); |
write_ndigit_number_s (10, 1, -10, 2, 0); |
write_ndigit_number_s (10, 2, -10, 3, 0); |
write_ndigit_number_s (10, 3, -10, 4, 0); |
write_ndigit_number_s (10, 4, -10, 5, 0); |
while (!get_key_press (1 << KEY_ESC)); |
} |