Subversion Repositories Projects

Rev

Rev 724 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
724 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
#include "lipo.h"
31
#include "eeprom.h"
32
 
33
 
34
//*****************************************************************************
35
// 
36
void set_toggledisplay(void)
37
{
38
        cli(); 
39
 
40
        if (LCD_ORIENTATION == 0)
41
                LCD_ORIENTATION = 4;
42
        else
43
                LCD_ORIENTATION = 0;
44
 
45
        WriteParameter ();
46
 
47
        LCD_Init();
48
 
49
        sei();
50
}
51
 
52
//*****************************************************************************
53
// 
54
void set_viewfont(void)
55
{
56
        uint8_t page;
57
 
58
        page = 0;
59
        lcd_view_font (page);
60
        do
61
        {
62
                if (get_key_press (1 << KEY_PLUS) && (page < 1))
63
                {
64
                        page++;
65
                        lcd_view_font (page);
66
                }
67
                if (get_key_press (1 << KEY_MINUS) && (page > 0))
68
                {
69
                        page--;
70
                        lcd_view_font (page);
71
                }
72
        }
73
        while (!get_key_press (1 << KEY_ESC));
74
        get_key_press(KEY_ALL);
75
}
76
 
77
//*****************************************************************************
78
// 
79
void set_lipo(void)
80
{
81
        lcd_cls();
82
        lcd_printp_at(0, 0, PSTR("LiPo Under Voltage:"), 0);
83
        lcd_printp_at(0, 2, PSTR("Warn Voltage: "), 0);
84
        lcd_printpns_at (0, 7, PSTR(" -    +     Ok"), 0);
85
        do
86
        {
87
                write_ndigit_number_u_10th(14, 2, AD_WarnLevel, 3, 0);
88
                if (get_key_press (1 << KEY_PLUS) && (AD_WarnLevel < 40))
89
                {
90
                        AD_WarnLevel++;
91
                }
92
                else if (get_key_press (1 << KEY_MINUS) && (AD_WarnLevel > 20))
93
                {
94
                        AD_WarnLevel--;
95
                }
96
        }
97
        while (!get_key_press (1 << KEY_ESC));
98
        get_key_press(KEY_ALL);
99
 
100
        WriteParameter ();
101
}
102
 
103
 
104
// Not really usefull :-)
105
// testing....
106
 
107
//*****************************************************************************
108
// 
109
void set_line(void)
110
{
111
        lcd_cls ();
112
#if 1
113
        lcd_line (10, 20, 100, 50, 1);          // draw a line
114
#else
115
        lcd_ecircle(22, 35, 18, 1);
116
 
117
        uint16_t old_d = 0;
118
        for (uint16_t i = 0; i < 360; i += 10)
119
        {
120
                lcd_ecirc_line (22, 35, 17, old_d, 0);
121
                old_d = i;
122
                lcd_ecirc_line (22, 35, 17, i, 1);
123
                while (!get_key_press (1 << KEY_ENTER));
124
        }
125
#endif
126
        while (!get_key_press (1 << KEY_ESC));
127
}
128
 
129
//*****************************************************************************
130
// 
131
void set_rect(void)
132
{
133
        lcd_cls ();
134
        //lcd_rect (10, 20, 100, 40, 1);                // draw a rect
135
        //lcd_ellipse(60, 30, 23, 20, 1);
136
        lcd_frect(10, 10, 20, -5, 1);
137
        write_ndigit_number_s (10, 1, -10, 2, 0);
138
        write_ndigit_number_s (10, 2, -10, 3, 0);
139
        write_ndigit_number_s (10, 3, -10, 4, 0);
140
        write_ndigit_number_s (10, 4, -10, 5, 0);
141
        while (!get_key_press (1 << KEY_ESC));
142
}