annotate src/menu_processor.inc @ 410:d3087a8ed7e1

BUGFIX: Fix rare issue after battery change (OSTC3 did not start properly)
author heinrichsweikamp
date Tue, 08 Mar 2016 11:42:58 +0100
parents 653a3ab08062
children b455b31ce022
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File menu_processor.asm
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 169
diff changeset
5 ; Routines to handle all OSTC graphic/text menus.
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-05-30 : [jDG] Creation.
heinrichsweikamp
parents:
diff changeset
11
heinrichsweikamp
parents:
diff changeset
12 ; Restart menu-system from first icon/line:
heinrichsweikamp
parents:
diff changeset
13 extern menu_processor_reset
heinrichsweikamp
parents:
diff changeset
14
heinrichsweikamp
parents:
diff changeset
15 ; Recal last (automatically) saved icon/line when returning from submenu.
heinrichsweikamp
parents:
diff changeset
16 extern menu_processor_pop
heinrichsweikamp
parents:
diff changeset
17
heinrichsweikamp
parents:
diff changeset
18 ; Rexecute the menu block
heinrichsweikamp
parents:
diff changeset
19 extern menu_processor
heinrichsweikamp
parents:
diff changeset
20
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 0
diff changeset
21 extern menu_processor_bottom_line
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 0
diff changeset
22
0
heinrichsweikamp
parents:
diff changeset
23 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
24 ; Menus parameters
heinrichsweikamp
parents:
diff changeset
25
heinrichsweikamp
parents:
diff changeset
26 ;NOTE: should be idenric in .inc and .asm !
heinrichsweikamp
parents:
diff changeset
27 #define MENU_LINES_MAX .7 ; Number of lines per screen?
heinrichsweikamp
parents:
diff changeset
28 #define MENU_HEIGHT .27 ; Spacing on screen.
heinrichsweikamp
parents:
diff changeset
29 #define MENU_VCENTER .125 ; Position on screen.
heinrichsweikamp
parents:
diff changeset
30
heinrichsweikamp
parents:
diff changeset
31 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
32
heinrichsweikamp
parents:
diff changeset
33 COMMON_BEGIN_MENU MACRO dynamic, txt, nb_items
heinrichsweikamp
parents:
diff changeset
34 local center
heinrichsweikamp
parents:
diff changeset
35 If nb_items > MENU_LINES_MAX
heinrichsweikamp
parents:
diff changeset
36 center set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX
heinrichsweikamp
parents:
diff changeset
37 Else
heinrichsweikamp
parents:
diff changeset
38 center set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items
heinrichsweikamp
parents:
diff changeset
39 Endif
heinrichsweikamp
parents:
diff changeset
40 If nb_items <= 0
heinrichsweikamp
parents:
diff changeset
41 Error "Zero items in menu ", x
heinrichsweikamp
parents:
diff changeset
42 Endif
heinrichsweikamp
parents:
diff changeset
43
heinrichsweikamp
parents:
diff changeset
44 extern txt
heinrichsweikamp
parents:
diff changeset
45 call menu_processor
heinrichsweikamp
parents:
diff changeset
46 ; Push 6 bytes of menu header data.
heinrichsweikamp
parents:
diff changeset
47 db nb_items, dynamic
heinrichsweikamp
parents:
diff changeset
48 db LOW(txt), HIGH(txt)
heinrichsweikamp
parents:
diff changeset
49 db UPPER(txt), center
heinrichsweikamp
parents:
diff changeset
50 ENDM
heinrichsweikamp
parents:
diff changeset
51
heinrichsweikamp
parents:
diff changeset
52 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
53 ; Macro to generat (and check) menu vertical menu blocks with data.
heinrichsweikamp
parents:
diff changeset
54 ;
heinrichsweikamp
parents:
diff changeset
55 MENU_BEGIN MACRO menu_title, nb_items
heinrichsweikamp
parents:
diff changeset
56 COMMON_BEGIN_MENU 0, menu_title, nb_items
heinrichsweikamp
parents:
diff changeset
57 ENDM
heinrichsweikamp
parents:
diff changeset
58
heinrichsweikamp
parents:
diff changeset
59 MENU_BEGIN_DYNAMIC macro title_proc, nb_items
heinrichsweikamp
parents:
diff changeset
60 COMMON_BEGIN_MENU 1, title_proc, nb_items
heinrichsweikamp
parents:
diff changeset
61 ENDM
heinrichsweikamp
parents:
diff changeset
62
heinrichsweikamp
parents:
diff changeset
63 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
64
heinrichsweikamp
parents:
diff changeset
65 ; Submenu
heinrichsweikamp
parents:
diff changeset
66 MENU_CALL MACRO txt, proc
heinrichsweikamp
parents:
diff changeset
67 extern txt
heinrichsweikamp
parents:
diff changeset
68 db 0, 0, 0, 0
heinrichsweikamp
parents:
diff changeset
69 db LOW(proc), HIGH(proc), UPPER(proc), 0
heinrichsweikamp
parents:
diff changeset
70 db LOW(txt), HIGH(txt)
heinrichsweikamp
parents:
diff changeset
71 ENDM
heinrichsweikamp
parents:
diff changeset
72
heinrichsweikamp
parents:
diff changeset
73 ; Generic option menu
heinrichsweikamp
parents:
diff changeset
74 MENU_OPTION MACRO txt, option, callback
heinrichsweikamp
parents:
diff changeset
75 extern txt
heinrichsweikamp
parents:
diff changeset
76 extern option
heinrichsweikamp
parents:
diff changeset
77 db 2, LOW(callback), HIGH(callback), UPPER(callback)
heinrichsweikamp
parents:
diff changeset
78 db LOW(option),HIGH(option),UPPER(option), 0
heinrichsweikamp
parents:
diff changeset
79 db LOW(txt), HIGH(txt)
heinrichsweikamp
parents:
diff changeset
80 ENDM
heinrichsweikamp
parents:
diff changeset
81
heinrichsweikamp
parents:
diff changeset
82 MENU_DYNAMIC MACRO callback, proc
heinrichsweikamp
parents:
diff changeset
83 extern callback
heinrichsweikamp
parents:
diff changeset
84 db 3, LOW(callback), HIGH(callback), UPPER(callback)
heinrichsweikamp
parents:
diff changeset
85 db LOW(proc), HIGH(proc), UPPER(proc), 0
heinrichsweikamp
parents:
diff changeset
86 db 0, 0
heinrichsweikamp
parents:
diff changeset
87 ENDM
heinrichsweikamp
parents:
diff changeset
88
heinrichsweikamp
parents:
diff changeset
89 MENU_END MACRO
heinrichsweikamp
parents:
diff changeset
90 ENDM