annotate src/menu_processor.inc @ 592:05053910d668

BUGFIX: Re-enable Sensors after sleep in PSCR mode
author heinrichsweikamp
date Wed, 18 Apr 2018 17:03:52 +0200
parents b455b31ce022
children c40025d8e750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
3 ; File menu_processor.asm REFACTORED VERSION V2.97
0
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
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
12 ; Restart menu-system from first icon/line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
13 extern menu_processor_reset
0
heinrichsweikamp
parents:
diff changeset
14
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
15 ; Recall last (automatically) saved icon/line when returning from submenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
16 extern menu_processor_pop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
17 extern menu_processor_double_pop
0
heinrichsweikamp
parents:
diff changeset
18
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
19 ; execute the menu block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
20 extern menu_processor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
21 extern menu_processor_bottom_line
169
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 !
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
27 #define MENU_LINES_MAX .7 ; Number of lines per screen?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
28 #define MENU_HEIGHT .27 ; Spacing on screen.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
29 #define MENU_VCENTER .125 ; Position on screen.
0
heinrichsweikamp
parents:
diff changeset
30
heinrichsweikamp
parents:
diff changeset
31 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
32
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
33 COMMON_BEGIN_MENU MACRO dynamic, txt, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
34 local center
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
35
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
36 If nb_items > MENU_LINES_MAX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
37 center set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
38 Else
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
39 center set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
40 Endif
0
heinrichsweikamp
parents:
diff changeset
41
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
42 If nb_items <= 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
43 Error "Zero items in menu ", x
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
44 Endif
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
45
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
46 extern txt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
47 call menu_processor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
48
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
49 ; Push 6 bytes of menu header data.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
50 db nb_items, dynamic
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
51 db LOW(txt), HIGH(txt)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
52 db UPPER(txt), center
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
53 ENDM
0
heinrichsweikamp
parents:
diff changeset
54
heinrichsweikamp
parents:
diff changeset
55 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
56
0
heinrichsweikamp
parents:
diff changeset
57 ; Macro to generat (and check) menu vertical menu blocks with data.
heinrichsweikamp
parents:
diff changeset
58
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
59 MENU_BEGIN MACRO menu_title, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
60 COMMON_BEGIN_MENU 0, menu_title, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
61 ENDM
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
62
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
63 MENU_BEGIN_DYNAMIC MACRO title_proc, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
64 COMMON_BEGIN_MENU 1, title_proc, nb_items
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
65 ENDM
0
heinrichsweikamp
parents:
diff changeset
66
heinrichsweikamp
parents:
diff changeset
67 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
68
heinrichsweikamp
parents:
diff changeset
69 ; Submenu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
70
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
71 MENU_CALL MACRO txt, proc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
72 extern txt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
73 db 0, 0, 0, 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
74 db LOW(proc), HIGH(proc), UPPER(proc), 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
75 db LOW(txt), HIGH(txt)
0
heinrichsweikamp
parents:
diff changeset
76 ENDM
heinrichsweikamp
parents:
diff changeset
77
heinrichsweikamp
parents:
diff changeset
78 ; Generic option menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
79
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
80 MENU_OPTION MACRO txt, option, callback
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
81 extern txt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
82 extern option
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
83 db 2, LOW(callback), HIGH(callback), UPPER(callback)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
84 db LOW(option), HIGH(option), UPPER(option), 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
85 db LOW(txt), HIGH(txt)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
86 ENDM
0
heinrichsweikamp
parents:
diff changeset
87
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
88 MENU_DYNAMIC MACRO callback, proc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
89 extern callback
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
90 db 3, LOW(callback), HIGH(callback), UPPER(callback)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
91 db LOW(proc), HIGH(proc), UPPER(proc), 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
92 db 0, 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
93 ENDM
0
heinrichsweikamp
parents:
diff changeset
94
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
95 MENU_END MACRO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
96 ENDM