Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
730 | woggle | 1 | /***************************************************************************** |
2 | * Copyright (C) 2008 Thomas Kaiser, thomas@ft-fanpage.de * |
||
3 | * Copyright (C) 2009-2010 Peter "woggle" Mack, mac@denich.net * |
||
4 | * * |
||
5 | * This program is free software; you can redistribute it and/or modify * |
||
6 | * it under the terms of the GNU General Public License as published by * |
||
7 | * the Free Software Foundation; either version 2 of the License. * |
||
8 | * * |
||
9 | * This program is distributed in the hope that it will be useful, * |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
12 | * GNU General Public License for more details. * |
||
13 | * * |
||
14 | * You should have received a copy of the GNU General Public License * |
||
15 | * along with this program; if not, write to the * |
||
16 | * Free Software Foundation, Inc., * |
||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
18 | * * |
||
19 | *****************************************************************************/ |
||
20 | |||
21 | #include <avr/io.h> |
||
22 | #include <avr/pgmspace.h> |
||
23 | #include <avr/interrupt.h> |
||
24 | |||
25 | #include "main.h" |
||
26 | #include "menu.h" |
||
27 | #include "lcd.h" |
||
28 | #include "settings.h" |
||
29 | #include "timer.h" |
||
30 | #ifndef USE_MMT |
||
31 | #include "lipo.h" |
||
32 | #endif |
||
33 | #include "eeprom.h" |
||
34 | |||
35 | |||
36 | //***************************************************************************** |
||
37 | // |
||
38 | void set_toggledisplay(void) |
||
39 | { |
||
40 | cli(); |
||
41 | |||
42 | if (LCD_ORIENTATION == 0) |
||
43 | LCD_ORIENTATION = 4; |
||
44 | else |
||
45 | LCD_ORIENTATION = 0; |
||
46 | |||
47 | WriteParameter (); |
||
48 | |||
49 | LCD_Init(); |
||
50 | |||
51 | sei(); |
||
52 | } |
||
53 | |||
54 | //***************************************************************************** |
||
55 | // |
||
56 | void set_viewfont(void) |
||
57 | { |
||
58 | uint8_t page; |
||
59 | |||
60 | page = 0; |
||
61 | lcd_view_font (page); |
||
62 | do |
||
63 | { |
||
64 | if (get_key_press (1 << KEY_PLUS) && (page < 1)) |
||
65 | { |
||
66 | page++; |
||
67 | lcd_view_font (page); |
||
68 | } |
||
69 | if (get_key_press (1 << KEY_MINUS) && (page > 0)) |
||
70 | { |
||
71 | page--; |
||
72 | lcd_view_font (page); |
||
73 | } |
||
74 | } |
||
75 | while (!get_key_press (1 << KEY_ESC)); |
||
76 | get_key_press(KEY_ALL); |
||
77 | } |
||
78 | |||
79 | //***************************************************************************** |
||
80 | // |
||
81 | #ifndef USE_MMT |
||
82 | void set_lipo(void) |
||
83 | { |
||
84 | lcd_cls(); |
||
85 | lcd_printp_at(0, 0, PSTR("LiPo Under Voltage:"), 0); |
||
86 | lcd_printp_at(0, 2, PSTR("Warn Voltage: "), 0); |
||
87 | lcd_printpns_at (0, 7, PSTR(" - + Ok"), 0); |
||
88 | do |
||
89 | { |
||
90 | write_ndigit_number_u_10th(14, 2, AD_WarnLevel, 3, 0); |
||
91 | if (get_key_press (1 << KEY_PLUS) && (AD_WarnLevel < 40)) |
||
92 | { |
||
93 | AD_WarnLevel++; |
||
94 | } |
||
95 | else if (get_key_press (1 << KEY_MINUS) && (AD_WarnLevel > 20)) |
||
96 | { |
||
97 | AD_WarnLevel--; |
||
98 | } |
||
99 | } |
||
100 | while (!get_key_press (1 << KEY_ESC)); |
||
101 | get_key_press(KEY_ALL); |
||
102 | |||
103 | WriteParameter (); |
||
104 | } |
||
105 | #endif |
||
106 | |||
107 | // Not really usefull :-) |
||
108 | // testing.... |
||
109 | |||
110 | //***************************************************************************** |
||
111 | // |
||
112 | void set_line(void) |
||
113 | { |
||
114 | lcd_cls (); |
||
115 | #if 1 |
||
116 | lcd_line (10, 20, 100, 50, 1); // draw a line |
||
117 | #else |
||
118 | lcd_ecircle(22, 35, 18, 1); |
||
119 | |||
120 | uint16_t old_d = 0; |
||
121 | for (uint16_t i = 0; i < 360; i += 10) |
||
122 | { |
||
123 | lcd_ecirc_line (22, 35, 17, old_d, 0); |
||
124 | old_d = i; |
||
125 | lcd_ecirc_line (22, 35, 17, i, 1); |
||
126 | while (!get_key_press (1 << KEY_ENTER)); |
||
127 | } |
||
128 | #endif |
||
129 | while (!get_key_press (1 << KEY_ESC)); |
||
130 | } |
||
131 | |||
132 | //***************************************************************************** |
||
133 | // |
||
134 | void set_rect(void) |
||
135 | { |
||
136 | lcd_cls (); |
||
137 | //lcd_rect (10, 20, 100, 40, 1); // draw a rect |
||
138 | //lcd_ellipse(60, 30, 23, 20, 1); |
||
139 | lcd_frect(10, 10, 20, -5, 1); |
||
140 | write_ndigit_number_s (10, 1, -10, 2, 0); |
||
141 | write_ndigit_number_s (10, 2, -10, 3, 0); |
||
142 | write_ndigit_number_s (10, 3, -10, 4, 0); |
||
143 | write_ndigit_number_s (10, 4, -10, 5, 0); |
||
144 | while (!get_key_press (1 << KEY_ESC)); |
||
145 | } |