Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
112 | mikeljo | 1 | |
2 | #include <avr/io.h> |
||
3 | #include <inttypes.h> |
||
4 | #include <stdlib.h> |
||
5 | #include <avr/pgmspace.h> |
||
6 | |||
7 | #include "main.h" |
||
8 | #include "lcd.h" |
||
9 | #include "rs232.h" |
||
10 | #include "base64.h" |
||
11 | #include "parameter.h" |
||
12 | #include "menu.h" |
||
13 | #include "display.h" |
||
14 | #include "motortest.h" |
||
15 | #include "debug.h" |
||
16 | #include "settings.h" |
||
17 | |||
18 | |||
19 | // Subroutine für den Stern (*) bzw. Cursor |
||
20 | |||
21 | void menu_set_cursor (uint8_t before, uint8_t line, uint8_t pos) |
||
22 | { |
||
23 | lcd_print_atp(pos,before,PSTR(" "),0); // Die vorhergehende Position löschen |
||
24 | lcd_print_atp(pos,line,PSTR("*"),0); // Den Cursor an der aktuellen Position anzeigen |
||
25 | } |
||
26 | |||
27 | |||
28 | // Zeigt einen Stern (*) an der x-Position <pos> an, y-Position von min bis max. |
||
29 | // Mit der +/- Taste kann ein Menü-Punkt ausgewählt und mit (Enter) bestätigt werden. |
||
30 | // Die Zeilennummer des aktuellen Menüpunkts wird zurückgegeben. |
||
31 | |||
32 | uint8_t menu_choose (uint8_t min, uint8_t max, uint8_t pos) |
||
33 | { |
||
34 | uint8_t line, before; |
||
35 | |||
36 | line = min; |
||
37 | before = min; |
||
38 | menu_set_cursor(line,line,pos); |
||
39 | |||
40 | do |
||
41 | { |
||
42 | while (key != key_nokey); |
||
43 | while(key == key_nokey); |
||
44 | |||
45 | if ((key == key_plus) && (line < max)) |
||
46 | line ++; |
||
47 | if ((key == key_minus) && (line > min)) |
||
48 | line --; |
||
49 | |||
50 | menu_set_cursor(before,line,pos); |
||
51 | before = line; |
||
52 | } |
||
53 | while ((key != key_enter) && (key != key_esc)); // Schleife wiederholen, bis (Enter) / Esc gedrückt wurde |
||
54 | if (key == key_esc) |
||
55 | line = 255; |
||
56 | while (key != key_nokey); // Warten, bis Taste wieder losgelassen wurde |
||
57 | return line; |
||
58 | } |
||
59 | |||
60 | void main_menu (void) |
||
61 | { |
||
62 | lcd_cls(); |
||
63 | lcd_printp(PSTR("Portables Koptertool\r\n"),0); |
||
64 | lcd_printp(PSTR(" Hauptmenü (V0.1.1)\r\n"),0); |
||
65 | lcd_printp(PSTR(" Display\r\n"),0); |
||
66 | lcd_printp(PSTR(" Parameter\r\n"),0); |
||
67 | lcd_printp(PSTR(" Motortest\r\n"),0); |
||
68 | lcd_printp(PSTR(" Debug Daten\r\n"),0); |
||
69 | lcd_printp(PSTR(" Settings\r\n"),0); |
||
70 | lcd_printp(PSTR("Mod by Mikeljo 05/08"),0); |
||
71 | |||
72 | switch(menu_choose(2,6,15)) |
||
73 | { |
||
74 | case 2: |
||
75 | display_data(); // LCD-Modus |
||
76 | break; |
||
77 | case 3: |
||
78 | edit_parameter(); // Parameter (Settings) laden/editieren |
||
79 | break; |
||
80 | case 4: |
||
81 | motor_test(); // primitiver Motor-Test |
||
82 | break; |
||
83 | case 5: |
||
84 | display_debug(); // Debug Daten |
||
85 | break; |
||
86 | case 6: |
||
87 | LCD_settings(); // Einstellungen |
||
88 | break; |
||
89 | } |
||
90 | |||
91 | } |