annotate src/menu_processor.asm @ 570:c8ea60294175

react to external S8 HUD disconnect or failure in surface mode
author heinrichsweikamp
date Sun, 11 Feb 2018 11:52:50 +0100
parents b7eb98dbd800
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 ;
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
3 ; File menu_processor.asm REFACTORED VERSION V2.91
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 229
diff changeset
5 ; Routines to handle all hwOS 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
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 229
diff changeset
10 ; 2012-11-02 : [jDG] Cleanup for hwOS: removed icons. Added scrolling.
0
heinrichsweikamp
parents:
diff changeset
11 ; But need a font with lower/upper alpha chars...
heinrichsweikamp
parents:
diff changeset
12
heinrichsweikamp
parents:
diff changeset
13 #include "convert.inc"
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 229
diff changeset
14 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
15 #include "strings.inc"
heinrichsweikamp
parents:
diff changeset
16 #include "tft.inc"
heinrichsweikamp
parents:
diff changeset
17 #include "varargs.inc"
heinrichsweikamp
parents:
diff changeset
18 #include "wait.inc"
heinrichsweikamp
parents:
diff changeset
19 #include "start.inc"
heinrichsweikamp
parents:
diff changeset
20 #include "surfmode.inc"
heinrichsweikamp
parents:
diff changeset
21 #include "divemode.inc"
heinrichsweikamp
parents:
diff changeset
22 #include "tft_outputs.inc"
heinrichsweikamp
parents:
diff changeset
23 #include "eeprom_rs232.inc"
62
e7c7c7eeea58 show battery voltage in info menu
heinrichsweikamp
parents: 50
diff changeset
24 #include "adc_lightsensor.inc"
229
e1e5876bd777 minor cleanup
mh@mh-THINK
parents: 189
diff changeset
25
0
heinrichsweikamp
parents:
diff changeset
26
229
e1e5876bd777 minor cleanup
mh@mh-THINK
parents: 189
diff changeset
27 ;NOTE: should be identic in .inc and .asm !
0
heinrichsweikamp
parents:
diff changeset
28 #define MENU_LINES_MAX .7 ; Number of lines per screen?
heinrichsweikamp
parents:
diff changeset
29 #define MENU_TITLE_FONT WIN_STD ; Font should contains lower/UPPER alpha
heinrichsweikamp
parents:
diff changeset
30 #define MENU_LINE_FONT WIN_SMALL ; Font should contains lower/UPPER alpha
heinrichsweikamp
parents:
diff changeset
31 #define MENU_LEFT .20 ; Position of first menu item
heinrichsweikamp
parents:
diff changeset
32 #define MENU_HEIGHT .27 ; Spacing between menu lines.
heinrichsweikamp
parents:
diff changeset
33 #define MENU_VCENTER .125 ; Position on screen.
heinrichsweikamp
parents:
diff changeset
34 #define MENU_LINE_MAX_LENGTH .20 ; Length in characters
heinrichsweikamp
parents:
diff changeset
35
heinrichsweikamp
parents:
diff changeset
36 ; Other needed references
heinrichsweikamp
parents:
diff changeset
37 extern aa_wordprocessor,option_inc,option_draw,comm_mode
heinrichsweikamp
parents:
diff changeset
38
heinrichsweikamp
parents:
diff changeset
39
heinrichsweikamp
parents:
diff changeset
40 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
41 ; Temporary data.
heinrichsweikamp
parents:
diff changeset
42
heinrichsweikamp
parents:
diff changeset
43 CBLOCK tmp+0x20 ; Reserved space for options.asm
heinrichsweikamp
parents:
diff changeset
44 menu_flags ; Various flags for menu:
heinrichsweikamp
parents:
diff changeset
45 ; bit 0 :dynamic menu
heinrichsweikamp
parents:
diff changeset
46 menu_item ; Index of the current item.
heinrichsweikamp
parents:
diff changeset
47 start_item ; Index of the first item (scrolling)
heinrichsweikamp
parents:
diff changeset
48 item_max ; Number of items in menu.
heinrichsweikamp
parents:
diff changeset
49 selected_item ; Index of the current item.
heinrichsweikamp
parents:
diff changeset
50 value_type ; Type for vertical menu.
heinrichsweikamp
parents:
diff changeset
51 dynamic_item:3 ; Callback addr
heinrichsweikamp
parents:
diff changeset
52 menu_block:3 ; Address of the menu block (ie. item 0)
heinrichsweikamp
parents:
diff changeset
53 menu_title:3 ; text or proc for dynamic menu.
heinrichsweikamp
parents:
diff changeset
54 menu_center ; centering for line menu.
heinrichsweikamp
parents:
diff changeset
55 proc_item:3 ; Address of the current proc.
heinrichsweikamp
parents:
diff changeset
56 text_item:2 ; Address of the current text.
heinrichsweikamp
parents:
diff changeset
57 ; Reserved to tmp+0x35
heinrichsweikamp
parents:
diff changeset
58 ENDC
heinrichsweikamp
parents:
diff changeset
59
heinrichsweikamp
parents:
diff changeset
60 #define option_item proc_item
heinrichsweikamp
parents:
diff changeset
61
heinrichsweikamp
parents:
diff changeset
62 basic CODE
heinrichsweikamp
parents:
diff changeset
63 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
64 ; menu handler.
heinrichsweikamp
parents:
diff changeset
65 ;
heinrichsweikamp
parents:
diff changeset
66 ; Input: TBLPTR = addr of menu block.
heinrichsweikamp
parents:
diff changeset
67 global menu_processor
heinrichsweikamp
parents:
diff changeset
68 menu_processor:
heinrichsweikamp
parents:
diff changeset
69 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
70 btfss divemode ; Not in divemode
heinrichsweikamp
parents:
diff changeset
71 call speed_fastest ; Make it quick !
heinrichsweikamp
parents:
diff changeset
72
heinrichsweikamp
parents:
diff changeset
73 ;---- Read menu block ------------------------------------------------
heinrichsweikamp
parents:
diff changeset
74 VARARGS_BEGIN ; Read inline PROM data
heinrichsweikamp
parents:
diff changeset
75 clrf STKPTR ; Never return, anyway...
heinrichsweikamp
parents:
diff changeset
76 VARARGS_GET8 item_max ; Get number of items
heinrichsweikamp
parents:
diff changeset
77 VARARGS_GET8 menu_flags ; Get flags
heinrichsweikamp
parents:
diff changeset
78 VARARGS_GET24 menu_title ; Get pointer to menu title
heinrichsweikamp
parents:
diff changeset
79 VARARGS_GET8 menu_center ; Vertical position
heinrichsweikamp
parents:
diff changeset
80 movff TBLPTRL, menu_block+0 ; Save base address for menu_read_item
heinrichsweikamp
parents:
diff changeset
81 movff TBLPTRH, menu_block+1
heinrichsweikamp
parents:
diff changeset
82 movff TBLPTRU, menu_block+2
heinrichsweikamp
parents:
diff changeset
83
heinrichsweikamp
parents:
diff changeset
84 btfss divemode ; In divemode?
heinrichsweikamp
parents:
diff changeset
85 bra menu_processor0 ; No
heinrichsweikamp
parents:
diff changeset
86
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
87 ; Required for menus with less entries then the calling menu but not so nice when setting up gas 6.... mH
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
88 extern TFT_clear_divemode_menu
0
heinrichsweikamp
parents:
diff changeset
89 movlw .1
heinrichsweikamp
parents:
diff changeset
90 cpfsgt menupos ; only if menupos=1...
heinrichsweikamp
parents:
diff changeset
91 call TFT_clear_divemode_menu ; ... Clear the menu!
175
d097e10b383b CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents: 169
diff changeset
92
d097e10b383b CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents: 169
diff changeset
93 ; Draw one frame around the divemode menu
d097e10b383b CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents: 169
diff changeset
94 extern TFT_divemask_color
d097e10b383b CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents: 169
diff changeset
95 call TFT_divemask_color
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
96 WIN_FRAME_COLOR16 dm_menu_row, dm_menu_lower, dm_menu_left ,dm_menu_right ; top, bottom, left, right
175
d097e10b383b CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents: 169
diff changeset
97 call TFT_standard_color
d097e10b383b CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents: 169
diff changeset
98
0
heinrichsweikamp
parents:
diff changeset
99 bra menu_processor1 ; Yes, skip some lines here
heinrichsweikamp
parents:
diff changeset
100
heinrichsweikamp
parents:
diff changeset
101 menu_processor0:
heinrichsweikamp
parents:
diff changeset
102 ;---- draw menu title ------------------------------------------------
heinrichsweikamp
parents:
diff changeset
103 clrf CCP1CON ; stop PWM
heinrichsweikamp
parents:
diff changeset
104 bcf PORTC,2 ; Pull PWM out to GND
heinrichsweikamp
parents:
diff changeset
105 call TFT_ClearScreen
heinrichsweikamp
parents:
diff changeset
106 rcall menu_processor_title
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
107 rcall menu_processor_bottom_line
0
heinrichsweikamp
parents:
diff changeset
108
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
109 menu_processor1:
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
110 movlw FT_SMALL
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
111 movff WREG, win_font
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
112
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
113 ;---- Select menu type -----------------------------------------------
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
114 bra menu_vertical
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
115
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
116 global menu_processor_bottom_line
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
117 menu_processor_bottom_line:
0
heinrichsweikamp
parents:
diff changeset
118 ;---- Draw bottomline ------------------------------------------------
heinrichsweikamp
parents:
diff changeset
119 TEXT_TINY .5, .240-.16, tNext
390
e6dab80e7e15 Fix text alignment for French version
heinrichsweikamp
parents: 388
diff changeset
120 TEXT_TINY .160-.6*.6, .240-.16, tEnter
0
heinrichsweikamp
parents:
diff changeset
121
76
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
122 WIN_COLOR color_greenish
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
123 ; Serial and Firmware Version
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
124 WIN_TINY .57,.240-.16
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
125 STRCPY "#"
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
126 call TFT_cat_serial
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
127 STRCAT " v"
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
128 call TFT_cat_firmware
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
129 STRCAT_PRINT ""
a5ea132770db 1.21 release
heinrichsweikamp
parents: 68
diff changeset
130 call TFT_standard_color
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
131 bcf win_invert
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 125
diff changeset
132 return
0
heinrichsweikamp
parents:
diff changeset
133
heinrichsweikamp
parents:
diff changeset
134 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
135 ; (re-)draw menu title.
heinrichsweikamp
parents:
diff changeset
136 ;
heinrichsweikamp
parents:
diff changeset
137 menu_processor_title:
369
ca32cf2435c6 fixing some layout issues
heinrichsweikamp
parents: 300
diff changeset
138 WIN_BOX_BLACK .2,.23,.0,.159 ; Clear Menu title
125
heinrichsweikamp
parents: 113
diff changeset
139 MENU_TITLE_FONT .0, .2 ; Menu title positionning
heinrichsweikamp
parents: 113
diff changeset
140
0
heinrichsweikamp
parents:
diff changeset
141 btfss menu_flags,0 ; Static or dynmic title ?
heinrichsweikamp
parents:
diff changeset
142 bra menu_processor_static_title
heinrichsweikamp
parents:
diff changeset
143
heinrichsweikamp
parents:
diff changeset
144 rcall menu_processor_call_title ; add gas, detail and color.
heinrichsweikamp
parents:
diff changeset
145 bra menu_processor_title_1
heinrichsweikamp
parents:
diff changeset
146
heinrichsweikamp
parents:
diff changeset
147 menu_processor_static_title:
heinrichsweikamp
parents:
diff changeset
148 movff menu_title+0,FSR1L ; Just copy string.
heinrichsweikamp
parents:
diff changeset
149 movff menu_title+1,FSR1H
heinrichsweikamp
parents:
diff changeset
150 call strcpy_text
heinrichsweikamp
parents:
diff changeset
151
heinrichsweikamp
parents:
diff changeset
152 menu_processor_title_1:
heinrichsweikamp
parents:
diff changeset
153 WIN_COLOR color_greenish
heinrichsweikamp
parents:
diff changeset
154 movf FSR2L,W ; Get title length
heinrichsweikamp
parents:
diff changeset
155 mullw .9 ; Convert to half pixels
heinrichsweikamp
parents:
diff changeset
156 bcf STATUS,C ; Clear carry
heinrichsweikamp
parents:
diff changeset
157 rrcf PRODL ; /2
heinrichsweikamp
parents:
diff changeset
158 movf PRODL,W ; Back to WREG
heinrichsweikamp
parents:
diff changeset
159 sublw .80 ; 80 - width
heinrichsweikamp
parents:
diff changeset
160 movwf win_leftx2 ; Aligned to center.
388
d8e2cf055fc3 BUGFIX: German texts in ppo2 menu were too long for screen resulting in resulting in text display issues
heinrichsweikamp
parents: 369
diff changeset
161
d8e2cf055fc3 BUGFIX: German texts in ppo2 menu were too long for screen resulting in resulting in text display issues
heinrichsweikamp
parents: 369
diff changeset
162 movlw .0
d8e2cf055fc3 BUGFIX: German texts in ppo2 menu were too long for screen resulting in resulting in text display issues
heinrichsweikamp
parents: 369
diff changeset
163 movff WREG,buffer+.17 ; limit to 17chars (Std font max.)
d8e2cf055fc3 BUGFIX: German texts in ppo2 menu were too long for screen resulting in resulting in text display issues
heinrichsweikamp
parents: 369
diff changeset
164
0
heinrichsweikamp
parents:
diff changeset
165 call aa_wordprocessor
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 0
diff changeset
166 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
167 return
heinrichsweikamp
parents:
diff changeset
168
heinrichsweikamp
parents:
diff changeset
169 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
170 ; Call dynamic proc for menu title:
heinrichsweikamp
parents:
diff changeset
171
heinrichsweikamp
parents:
diff changeset
172 menu_processor_call_title:
heinrichsweikamp
parents:
diff changeset
173 movff menu_title+2,PCLATU ; Just execute computed goto.
heinrichsweikamp
parents:
diff changeset
174 movff menu_title+1,PCLATH
heinrichsweikamp
parents:
diff changeset
175 movf menu_title+0,W
heinrichsweikamp
parents:
diff changeset
176 movwf PCL
heinrichsweikamp
parents:
diff changeset
177
heinrichsweikamp
parents:
diff changeset
178 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
179 ; Restart with first icon/line selected.
heinrichsweikamp
parents:
diff changeset
180 global menu_processor_reset
heinrichsweikamp
parents:
diff changeset
181 menu_processor_reset:
heinrichsweikamp
parents:
diff changeset
182 banksel common
heinrichsweikamp
parents:
diff changeset
183 lfsr FSR2,menustack
heinrichsweikamp
parents:
diff changeset
184 clrf POSTINC2
heinrichsweikamp
parents:
diff changeset
185 clrf POSTINC2
heinrichsweikamp
parents:
diff changeset
186 clrf POSTINC2
heinrichsweikamp
parents:
diff changeset
187 clrf POSTINC2
heinrichsweikamp
parents:
diff changeset
188 clrf POSTINC2
heinrichsweikamp
parents:
diff changeset
189 clrf selected_item
heinrichsweikamp
parents:
diff changeset
190 return
heinrichsweikamp
parents:
diff changeset
191
heinrichsweikamp
parents:
diff changeset
192 global menu_processor_pop
heinrichsweikamp
parents:
diff changeset
193 menu_processor_pop:
heinrichsweikamp
parents:
diff changeset
194 movff menustack+0,selected_item
heinrichsweikamp
parents:
diff changeset
195 movff menustack+1,menustack+0
heinrichsweikamp
parents:
diff changeset
196 movff menustack+2,menustack+1
heinrichsweikamp
parents:
diff changeset
197 movff menustack+3,menustack+2
heinrichsweikamp
parents:
diff changeset
198 movff menustack+4,menustack+3
heinrichsweikamp
parents:
diff changeset
199 return
heinrichsweikamp
parents:
diff changeset
200
heinrichsweikamp
parents:
diff changeset
201 menu_processor_push:
heinrichsweikamp
parents:
diff changeset
202 movff menustack+3,menustack+4
heinrichsweikamp
parents:
diff changeset
203 movff menustack+2,menustack+3
heinrichsweikamp
parents:
diff changeset
204 movff menustack+1,menustack+2
heinrichsweikamp
parents:
diff changeset
205 movff menustack+0,menustack+1
heinrichsweikamp
parents:
diff changeset
206 movff selected_item,menustack+0
heinrichsweikamp
parents:
diff changeset
207 clrf selected_item
heinrichsweikamp
parents:
diff changeset
208 return
heinrichsweikamp
parents:
diff changeset
209
heinrichsweikamp
parents:
diff changeset
210 ;---- Execute menu selection -------------------------------------------------
heinrichsweikamp
parents:
diff changeset
211 do_menu_item:
heinrichsweikamp
parents:
diff changeset
212 bcf switch_right ; Avoid loops.
heinrichsweikamp
parents:
diff changeset
213 call speed_normal ; Back to normal speed.
heinrichsweikamp
parents:
diff changeset
214
heinrichsweikamp
parents:
diff changeset
215 movf selected_item,W ; Reread proc address from table.
heinrichsweikamp
parents:
diff changeset
216 rcall menu_read_item ; (destroy PROD)
heinrichsweikamp
parents:
diff changeset
217
heinrichsweikamp
parents:
diff changeset
218 movff selected_item,PRODL ; Pass along selected line
heinrichsweikamp
parents:
diff changeset
219
heinrichsweikamp
parents:
diff changeset
220 rcall menu_processor_push ; Remember where we get from. (clears selected_item)
heinrichsweikamp
parents:
diff changeset
221
heinrichsweikamp
parents:
diff changeset
222 movff proc_item+2,PCLATU ; Then execute computed goto.
heinrichsweikamp
parents:
diff changeset
223 movff proc_item+1,PCLATH
heinrichsweikamp
parents:
diff changeset
224 movf proc_item+0,W
heinrichsweikamp
parents:
diff changeset
225 movwf PCL
heinrichsweikamp
parents:
diff changeset
226
heinrichsweikamp
parents:
diff changeset
227 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
228 ; Get current item from table.
heinrichsweikamp
parents:
diff changeset
229 ;
heinrichsweikamp
parents:
diff changeset
230 ; Input : Item number in WREG, menu_block.
heinrichsweikamp
parents:
diff changeset
231 ;
heinrichsweikamp
parents:
diff changeset
232 ; Output: icon_large, text_item, proc_item 16bits pointers.
heinrichsweikamp
parents:
diff changeset
233 ;
heinrichsweikamp
parents:
diff changeset
234 ; Trashed: PROD, WREG
heinrichsweikamp
parents:
diff changeset
235 menu_read_item:
heinrichsweikamp
parents:
diff changeset
236 mullw .10 ; 10 bytes per item.
heinrichsweikamp
parents:
diff changeset
237 movf PRODL,W ; Then do a 24bits add
heinrichsweikamp
parents:
diff changeset
238 addwf menu_block+0,W ; with menu_block, and
heinrichsweikamp
parents:
diff changeset
239 movwf TBLPTRL ; setup TBLPTR
heinrichsweikamp
parents:
diff changeset
240 movf PRODH,W
heinrichsweikamp
parents:
diff changeset
241 addwfc menu_block+1,W
heinrichsweikamp
parents:
diff changeset
242 movwf TBLPTRH
heinrichsweikamp
parents:
diff changeset
243 movlw 0
heinrichsweikamp
parents:
diff changeset
244 addwfc menu_block+2,W
heinrichsweikamp
parents:
diff changeset
245 movwf TBLPTRU
heinrichsweikamp
parents:
diff changeset
246
heinrichsweikamp
parents:
diff changeset
247 VARARGS_GET8 value_type ; Read 10 bytes of item data
heinrichsweikamp
parents:
diff changeset
248 VARARGS_GET24 dynamic_item
heinrichsweikamp
parents:
diff changeset
249 VARARGS_GET24 proc_item
heinrichsweikamp
parents:
diff changeset
250 VARARGS_GET8 WREG ; Skip dummy byte
heinrichsweikamp
parents:
diff changeset
251 VARARGS_GET16 text_item
heinrichsweikamp
parents:
diff changeset
252
heinrichsweikamp
parents:
diff changeset
253 return
heinrichsweikamp
parents:
diff changeset
254
heinrichsweikamp
parents:
diff changeset
255 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
256 ; Vertical menu : set of line/value to choose from.
heinrichsweikamp
parents:
diff changeset
257 ; Entry point to update lines already shown.
heinrichsweikamp
parents:
diff changeset
258 ;
heinrichsweikamp
parents:
diff changeset
259 global menu_vertical
heinrichsweikamp
parents:
diff changeset
260 menu_vertical:
heinrichsweikamp
parents:
diff changeset
261 btfss divemode ; Not in divemode
heinrichsweikamp
parents:
diff changeset
262 clrf timeout_counter2 ; Reset timeout
heinrichsweikamp
parents:
diff changeset
263
heinrichsweikamp
parents:
diff changeset
264 menu_vertical_2:
heinrichsweikamp
parents:
diff changeset
265 rcall menu_draw_lines ; Always re-draw whole menu
heinrichsweikamp
parents:
diff changeset
266
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 229
diff changeset
267 movlw CCP1CON_VALUE ; See hwos.inc
0
heinrichsweikamp
parents:
diff changeset
268 btfss divemode ; Not in divemode
heinrichsweikamp
parents:
diff changeset
269 movwf CCP1CON ; Power-on backlight
heinrichsweikamp
parents:
diff changeset
270
heinrichsweikamp
parents:
diff changeset
271 menu_vertical_1:
heinrichsweikamp
parents:
diff changeset
272 movf selected_item,W ; Get current item data
heinrichsweikamp
parents:
diff changeset
273 rcall menu_read_item
heinrichsweikamp
parents:
diff changeset
274 movf proc_item+0,W ; Check if pro address is NULL ?
heinrichsweikamp
parents:
diff changeset
275 iorwf proc_item+1,W
heinrichsweikamp
parents:
diff changeset
276 bz next_line_menu ; YES: not selectable !
heinrichsweikamp
parents:
diff changeset
277
heinrichsweikamp
parents:
diff changeset
278 btfss divemode ; Not in divemode
heinrichsweikamp
parents:
diff changeset
279 rcall menu_draw_selected_line
heinrichsweikamp
parents:
diff changeset
280
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 0
diff changeset
281 btfsc in_color_menu ; =1: In the color scheme menu
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 0
diff changeset
282 call TFT_show_color_schemes ; Yes, update the color schemes
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 0
diff changeset
283
0
heinrichsweikamp
parents:
diff changeset
284 extern rtc_set_rtc
heinrichsweikamp
parents:
diff changeset
285 btfss settime_setdate ; In the Set Time or Set Date menu?
heinrichsweikamp
parents:
diff changeset
286 bra menu_line_loop_pre2 ; no, skip all following
heinrichsweikamp
parents:
diff changeset
287
heinrichsweikamp
parents:
diff changeset
288 movff month,lo ; new month
heinrichsweikamp
parents:
diff changeset
289 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
290 movlw .31
heinrichsweikamp
parents:
diff changeset
291 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
292 movlw .28
heinrichsweikamp
parents:
diff changeset
293 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
294 movlw .31
heinrichsweikamp
parents:
diff changeset
295 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
296 movlw .30
heinrichsweikamp
parents:
diff changeset
297 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
298 movlw .31
heinrichsweikamp
parents:
diff changeset
299 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
300 movlw .30
heinrichsweikamp
parents:
diff changeset
301 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
302 movlw .31
heinrichsweikamp
parents:
diff changeset
303 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
304 movlw .31
heinrichsweikamp
parents:
diff changeset
305 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
306 movlw .30
heinrichsweikamp
parents:
diff changeset
307 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
308 movlw .31
heinrichsweikamp
parents:
diff changeset
309 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
310 movlw .30
heinrichsweikamp
parents:
diff changeset
311 dcfsnz lo,F
heinrichsweikamp
parents:
diff changeset
312 movlw .31
heinrichsweikamp
parents:
diff changeset
313 cpfsgt day ; day ok?
heinrichsweikamp
parents:
diff changeset
314 bra menu_line_loop_pre1 ; OK!
heinrichsweikamp
parents:
diff changeset
315 movlw .1 ; not OK, set to 1st
heinrichsweikamp
parents:
diff changeset
316 movwf day
heinrichsweikamp
parents:
diff changeset
317
heinrichsweikamp
parents:
diff changeset
318 menu_line_loop_pre1:
heinrichsweikamp
parents:
diff changeset
319 btfsc switch_right ; Enter pressed?
heinrichsweikamp
parents:
diff changeset
320 call rtc_set_rtc ; Yes, update mins,sec,hours,day,month and year to rtc module
heinrichsweikamp
parents:
diff changeset
321 call TFT_show_time_date_menu ; Update clock
heinrichsweikamp
parents:
diff changeset
322
heinrichsweikamp
parents:
diff changeset
323 menu_line_loop_pre2:
heinrichsweikamp
parents:
diff changeset
324 bcf switch_right
heinrichsweikamp
parents:
diff changeset
325 bcf switch_left
heinrichsweikamp
parents:
diff changeset
326 btfss divemode ; Not in Divemode
heinrichsweikamp
parents:
diff changeset
327 call speed_normal
heinrichsweikamp
parents:
diff changeset
328
heinrichsweikamp
parents:
diff changeset
329 menu_line_loop_pre3:
heinrichsweikamp
parents:
diff changeset
330 extern divemode_option0_return
heinrichsweikamp
parents:
diff changeset
331 btfsc divemode ; In divemode?
heinrichsweikamp
parents:
diff changeset
332 goto divemode_option0_return ; Yes, return to it
heinrichsweikamp
parents:
diff changeset
333
heinrichsweikamp
parents:
diff changeset
334 menu_line_loop:
heinrichsweikamp
parents:
diff changeset
335 btfsc switch_right
heinrichsweikamp
parents:
diff changeset
336 bra do_line_menu ; Type dependent
heinrichsweikamp
parents:
diff changeset
337 btfsc switch_left
heinrichsweikamp
parents:
diff changeset
338 bra next_line_menu
heinrichsweikamp
parents:
diff changeset
339
113
heinrichsweikamp
parents: 76
diff changeset
340 btfss quarter_second_update ; 1/4 second?
heinrichsweikamp
parents: 76
diff changeset
341 bra menu_line_loop1 ; Not yet...
heinrichsweikamp
parents: 76
diff changeset
342
heinrichsweikamp
parents: 76
diff changeset
343 btfsc menu_show_sensors2 ; In the "Calibrate" menu?
187
669b5d00706d CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents: 175
diff changeset
344 call TFT_menu_calibrate ; Yes, update mV data
113
heinrichsweikamp
parents: 76
diff changeset
345 bcf quarter_second_update ; Clear flag
heinrichsweikamp
parents: 76
diff changeset
346
heinrichsweikamp
parents: 76
diff changeset
347 menu_line_loop1:
0
heinrichsweikamp
parents:
diff changeset
348 btfss onesecupdate ; New second
heinrichsweikamp
parents:
diff changeset
349 bra menu_line_loop2 ; not yet...
heinrichsweikamp
parents:
diff changeset
350
heinrichsweikamp
parents:
diff changeset
351 call timeout_surfmode ; timeout
heinrichsweikamp
parents:
diff changeset
352 call set_dive_modes ; check, if divemode must be entered
113
heinrichsweikamp
parents: 76
diff changeset
353 call get_battery_voltage ; gets battery voltage
0
heinrichsweikamp
parents:
diff changeset
354
heinrichsweikamp
parents:
diff changeset
355 btfsc settime_setdate ; In the Set Time or Set Date menu?
heinrichsweikamp
parents:
diff changeset
356 call TFT_show_time_date_menu ; Yes, update clock
113
heinrichsweikamp
parents: 76
diff changeset
357
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
358 ; DELETE - menu has been deleted ## memory
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
359 ; btfsc menu_show_sensors ; In the "Sensors" menu?
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
360 ; call TFT_menu_hud ; Yes, update HUD data
0
heinrichsweikamp
parents:
diff changeset
361
heinrichsweikamp
parents:
diff changeset
362 bcf onesecupdate ; one second updates done
heinrichsweikamp
parents:
diff changeset
363
heinrichsweikamp
parents:
diff changeset
364 menu_line_loop2:
heinrichsweikamp
parents:
diff changeset
365 btfsc sleepmode ; Timeout?
heinrichsweikamp
parents:
diff changeset
366 goto restart ; Yes, back to surfacemode
heinrichsweikamp
parents:
diff changeset
367 btfsc divemode
heinrichsweikamp
parents:
diff changeset
368 goto restart ; Enter Divemode if required
heinrichsweikamp
parents:
diff changeset
369
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
370 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
0
heinrichsweikamp
parents:
diff changeset
371 bra menu_line_loop3
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
372 btfsc vusb_in ; USB plugged in?
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
373 call comm_mode ; Start COMM mode
0
heinrichsweikamp
parents:
diff changeset
374 bra menu_line_loop4
heinrichsweikamp
parents:
diff changeset
375 menu_line_loop3:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
376 btfss vusb_in ; USB (still) plugged in?
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
377 bcf enable_screen_dumps ; No, clear flag
0
heinrichsweikamp
parents:
diff changeset
378 call rs232_get_byte
heinrichsweikamp
parents:
diff changeset
379 btfsc rs232_recieve_overflow
heinrichsweikamp
parents:
diff changeset
380 bra menu_line_loop4
heinrichsweikamp
parents:
diff changeset
381 movlw "l"
heinrichsweikamp
parents:
diff changeset
382 cpfseq RCREG1
heinrichsweikamp
parents:
diff changeset
383 bra menu_line_loop4
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
384 call TFT_dump_screen ; Dump the screen contents
0
heinrichsweikamp
parents:
diff changeset
385 menu_line_loop4:
heinrichsweikamp
parents:
diff changeset
386
heinrichsweikamp
parents:
diff changeset
387 bra menu_line_loop
heinrichsweikamp
parents:
diff changeset
388
heinrichsweikamp
parents:
diff changeset
389 ;---- Move to menu's next line
heinrichsweikamp
parents:
diff changeset
390 next_line_menu:
heinrichsweikamp
parents:
diff changeset
391 btfss divemode ; not in divemode
heinrichsweikamp
parents:
diff changeset
392 call speed_fastest
heinrichsweikamp
parents:
diff changeset
393 bcf switch_left ; Avoid looping.
heinrichsweikamp
parents:
diff changeset
394
heinrichsweikamp
parents:
diff changeset
395 incf selected_item,F ; Select next item.
heinrichsweikamp
parents:
diff changeset
396 movf selected_item,W ; Index == max ?
heinrichsweikamp
parents:
diff changeset
397 cpfseq item_max
heinrichsweikamp
parents:
diff changeset
398 bra menu_vertical_1 ; NO: redraw cursor.
heinrichsweikamp
parents:
diff changeset
399
heinrichsweikamp
parents:
diff changeset
400 clrf selected_item ; YES: restart for item 0.
heinrichsweikamp
parents:
diff changeset
401 bra menu_vertical_1 ; Then redraw cursor.
heinrichsweikamp
parents:
diff changeset
402
heinrichsweikamp
parents:
diff changeset
403 global do_line_menu
heinrichsweikamp
parents:
diff changeset
404 do_line_menu:
heinrichsweikamp
parents:
diff changeset
405 btfss divemode ; not in divemode
heinrichsweikamp
parents:
diff changeset
406 call speed_fastest
heinrichsweikamp
parents:
diff changeset
407 ; bcf switch_right ; Avoid looping.
heinrichsweikamp
parents:
diff changeset
408
heinrichsweikamp
parents:
diff changeset
409 decf menupos,W ; menu_processor needs 0-5...
heinrichsweikamp
parents:
diff changeset
410 btfsc divemode ; only in divemode
heinrichsweikamp
parents:
diff changeset
411 movwf selected_item
heinrichsweikamp
parents:
diff changeset
412
heinrichsweikamp
parents:
diff changeset
413 movf selected_item,W ; Read selected descriptor
heinrichsweikamp
parents:
diff changeset
414 rcall menu_read_item
heinrichsweikamp
parents:
diff changeset
415
heinrichsweikamp
parents:
diff changeset
416 movf value_type,W ; Switch on data type
heinrichsweikamp
parents:
diff changeset
417 bz menu_do_line_call ; CALL
heinrichsweikamp
parents:
diff changeset
418 dcfsnz WREG
heinrichsweikamp
parents:
diff changeset
419 bra menu_do_line_call ; STRING: do as call
heinrichsweikamp
parents:
diff changeset
420 dcfsnz WREG
heinrichsweikamp
parents:
diff changeset
421 bra menu_do_line_option ; OPTION
heinrichsweikamp
parents:
diff changeset
422 dcfsnz WREG
heinrichsweikamp
parents:
diff changeset
423 bra menu_do_line_call ; DYNAMIC: do as call
heinrichsweikamp
parents:
diff changeset
424 bra menu_line_loop_pre3 ; else do nothing...
heinrichsweikamp
parents:
diff changeset
425
heinrichsweikamp
parents:
diff changeset
426 ;---- CALL
heinrichsweikamp
parents:
diff changeset
427 menu_do_line_call:
heinrichsweikamp
parents:
diff changeset
428 rcall do_menu_item ; Same as icon menu: calculated goto.
heinrichsweikamp
parents:
diff changeset
429 rcall menu_processor_pop ; Back to same line,
heinrichsweikamp
parents:
diff changeset
430 bra menu_vertical ; Then continue into menu...
heinrichsweikamp
parents:
diff changeset
431
heinrichsweikamp
parents:
diff changeset
432 ;---- Call option specific increment subroutine
heinrichsweikamp
parents:
diff changeset
433 menu_do_line_option:
heinrichsweikamp
parents:
diff changeset
434 movff option_item+0,FSR0L ; Get option handle
heinrichsweikamp
parents:
diff changeset
435 movff option_item+1,FSR0H
heinrichsweikamp
parents:
diff changeset
436 call option_inc ; increment
heinrichsweikamp
parents:
diff changeset
437
heinrichsweikamp
parents:
diff changeset
438 movff selected_item,PRODL ; Pass selection to callback.
heinrichsweikamp
parents:
diff changeset
439 rcall menu_text_call
heinrichsweikamp
parents:
diff changeset
440 bra menu_vertical_2 ; redraw all lines...
heinrichsweikamp
parents:
diff changeset
441
heinrichsweikamp
parents:
diff changeset
442 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
443
heinrichsweikamp
parents:
diff changeset
444 menu_draw_lines_divemode:
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
445 movlw dm_menu_item1_row
0
heinrichsweikamp
parents:
diff changeset
446 movff WREG,win_top
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
447 movlw dm_menu_item1_column
0
heinrichsweikamp
parents:
diff changeset
448 movff WREG,win_leftx2
heinrichsweikamp
parents:
diff changeset
449 clrf start_item
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
450 movff item_max,menupos4 ; Copy item_max for divemode cursor routine
0
heinrichsweikamp
parents:
diff changeset
451 bra menu_draw_lines_2
heinrichsweikamp
parents:
diff changeset
452
heinrichsweikamp
parents:
diff changeset
453 menu_draw_lines:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
454 btfsc divemode ; in divemode?
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
455 bra menu_draw_lines_divemode; Yes
0
heinrichsweikamp
parents:
diff changeset
456
heinrichsweikamp
parents:
diff changeset
457 btfsc menu_flags,0 ; Dynamic title ?
heinrichsweikamp
parents:
diff changeset
458 rcall menu_processor_title ; YES: redraw it then.
heinrichsweikamp
parents:
diff changeset
459
heinrichsweikamp
parents:
diff changeset
460 MENU_LINE_FONT MENU_LEFT, 0 ; Init start position/font
heinrichsweikamp
parents:
diff changeset
461 movff menu_center,win_top ; computed in menu block.
heinrichsweikamp
parents:
diff changeset
462
heinrichsweikamp
parents:
diff changeset
463 ; Does the menu have more than 6 lines ?
heinrichsweikamp
parents:
diff changeset
464 movf item_max,W
heinrichsweikamp
parents:
diff changeset
465 addlw -(MENU_LINES_MAX+1) ; (max - 7)
heinrichsweikamp
parents:
diff changeset
466 bnn menu_draw_long_menu ; bra if (max >= 7)
heinrichsweikamp
parents:
diff changeset
467
heinrichsweikamp
parents:
diff changeset
468 clrf start_item
heinrichsweikamp
parents:
diff changeset
469 bra menu_draw_lines_2
heinrichsweikamp
parents:
diff changeset
470
heinrichsweikamp
parents:
diff changeset
471 menu_draw_long_menu:
heinrichsweikamp
parents:
diff changeset
472 movf selected_item,W ; Start at selected-6
heinrichsweikamp
parents:
diff changeset
473 addlw -(MENU_LINES_MAX-1)
heinrichsweikamp
parents:
diff changeset
474 btfsc STATUS,N ; This is <0 ?
heinrichsweikamp
parents:
diff changeset
475 clrf WREG ; YES: start from top instead.
heinrichsweikamp
parents:
diff changeset
476 movwf start_item
heinrichsweikamp
parents:
diff changeset
477
heinrichsweikamp
parents:
diff changeset
478 menu_draw_lines_2:
heinrichsweikamp
parents:
diff changeset
479 movff start_item, menu_item
heinrichsweikamp
parents:
diff changeset
480
heinrichsweikamp
parents:
diff changeset
481 menu_draw_lines_1:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 551
diff changeset
482 call TFT_standard_color ; Restore color after disabled lines.
0
heinrichsweikamp
parents:
diff changeset
483
heinrichsweikamp
parents:
diff changeset
484 movf menu_item,W
heinrichsweikamp
parents:
diff changeset
485 rcall menu_read_item
heinrichsweikamp
parents:
diff changeset
486
heinrichsweikamp
parents:
diff changeset
487 movf value_type,W ; Switch on data type
heinrichsweikamp
parents:
diff changeset
488 bz menu_draw_line_call
heinrichsweikamp
parents:
diff changeset
489 dcfsnz WREG
heinrichsweikamp
parents:
diff changeset
490 bra menu_draw_line_string
heinrichsweikamp
parents:
diff changeset
491 dcfsnz WREG
heinrichsweikamp
parents:
diff changeset
492 bra menu_draw_line_option
heinrichsweikamp
parents:
diff changeset
493 dcfsnz WREG
heinrichsweikamp
parents:
diff changeset
494 bra menu_draw_line_dynamic
heinrichsweikamp
parents:
diff changeset
495 bra menu_draw_line_none
heinrichsweikamp
parents:
diff changeset
496
heinrichsweikamp
parents:
diff changeset
497 menu_draw_line_string:
heinrichsweikamp
parents:
diff changeset
498 movff text_item+0,TBLPTRL ; Read not-translated string from PROM.
heinrichsweikamp
parents:
diff changeset
499 movff text_item+1,TBLPTRH
heinrichsweikamp
parents:
diff changeset
500 call strcpy_prom ; Copy in buffer
heinrichsweikamp
parents:
diff changeset
501 bra menu_draw_line_none
heinrichsweikamp
parents:
diff changeset
502
heinrichsweikamp
parents:
diff changeset
503 menu_draw_line_call:
heinrichsweikamp
parents:
diff changeset
504 movff text_item+0,FSR1L ; Read string from PROM.
heinrichsweikamp
parents:
diff changeset
505 movff text_item+1,FSR1H
heinrichsweikamp
parents:
diff changeset
506 call strcpy_text ; Copy in buffer
heinrichsweikamp
parents:
diff changeset
507
heinrichsweikamp
parents:
diff changeset
508 bra menu_draw_line_none
heinrichsweikamp
parents:
diff changeset
509
heinrichsweikamp
parents:
diff changeset
510 menu_draw_line_option:
heinrichsweikamp
parents:
diff changeset
511 movff text_item+0,FSR1L ; Read string from PROM.
heinrichsweikamp
parents:
diff changeset
512 movff text_item+1,FSR1H
heinrichsweikamp
parents:
diff changeset
513 call strcpy_text ; Copy in buffer
heinrichsweikamp
parents:
diff changeset
514
heinrichsweikamp
parents:
diff changeset
515 movff option_item+0,FSR0L ; Retrieve option handle.
heinrichsweikamp
parents:
diff changeset
516 movff option_item+1,FSR0H
68
53b64c5472e1 BUGFIX: Set Day for months <31 days
heinrichsweikamp
parents: 62
diff changeset
517 btfss settime_setdate ; Not in Time/Date menu...
0
heinrichsweikamp
parents:
diff changeset
518 call option_draw
heinrichsweikamp
parents:
diff changeset
519 bra menu_draw_line_none
heinrichsweikamp
parents:
diff changeset
520
heinrichsweikamp
parents:
diff changeset
521 menu_draw_line_dynamic:
heinrichsweikamp
parents:
diff changeset
522 lfsr FSR2,buffer
heinrichsweikamp
parents:
diff changeset
523 movff menu_item,PRODL ; Pass item to callback.
heinrichsweikamp
parents:
diff changeset
524 rcall menu_text_call ; Push return address.
heinrichsweikamp
parents:
diff changeset
525 bra menu_draw_line_none
heinrichsweikamp
parents:
diff changeset
526
heinrichsweikamp
parents:
diff changeset
527 ; Computed goto to pointer inside dynamic_item:
heinrichsweikamp
parents:
diff changeset
528 menu_text_call:
heinrichsweikamp
parents:
diff changeset
529 movf dynamic_item+0,W ; Check if callback is NULL
heinrichsweikamp
parents:
diff changeset
530 iorwf dynamic_item+1,W
heinrichsweikamp
parents:
diff changeset
531 iorwf dynamic_item+2,W
heinrichsweikamp
parents:
diff changeset
532 btfsc STATUS,Z
heinrichsweikamp
parents:
diff changeset
533 return ; YES: don't call it.
heinrichsweikamp
parents:
diff changeset
534
heinrichsweikamp
parents:
diff changeset
535 movff dynamic_item+2,PCLATU ; Prepare...
heinrichsweikamp
parents:
diff changeset
536 movff dynamic_item+1,PCLATH
heinrichsweikamp
parents:
diff changeset
537 movf dynamic_item+0,W
heinrichsweikamp
parents:
diff changeset
538 movwf PCL ; And jump !
heinrichsweikamp
parents:
diff changeset
539
heinrichsweikamp
parents:
diff changeset
540 menu_draw_line_none:
heinrichsweikamp
parents:
diff changeset
541 extern TFT_fillup_with_spaces
heinrichsweikamp
parents:
diff changeset
542
heinrichsweikamp
parents:
diff changeset
543 btfsc divemode ; In divemode?
heinrichsweikamp
parents:
diff changeset
544 bra menu_draw_line_none_divemode ; Yes
heinrichsweikamp
parents:
diff changeset
545
heinrichsweikamp
parents:
diff changeset
546 movlw MENU_LINE_MAX_LENGTH
heinrichsweikamp
parents:
diff changeset
547 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
heinrichsweikamp
parents:
diff changeset
548 clrf WREG
heinrichsweikamp
parents:
diff changeset
549 movff WREG,buffer+MENU_LINE_MAX_LENGTH;No ; Make sure won't be longer than MENU_LINE_MAX_LENGTH ch
heinrichsweikamp
parents:
diff changeset
550 call aa_wordprocessor
heinrichsweikamp
parents:
diff changeset
551 movlw MENU_HEIGHT ; No, Move to next line
heinrichsweikamp
parents:
diff changeset
552 addwf win_top,F
heinrichsweikamp
parents:
diff changeset
553 incf menu_item,F ; inc loop counter
heinrichsweikamp
parents:
diff changeset
554
heinrichsweikamp
parents:
diff changeset
555 movf start_item,W ; First line (scrolled)
heinrichsweikamp
parents:
diff changeset
556 subwf menu_item,W ; current - first
heinrichsweikamp
parents:
diff changeset
557 xorlw MENU_LINES_MAX ; Already done 6 lines ?
heinrichsweikamp
parents:
diff changeset
558 btfsc STATUS,Z
heinrichsweikamp
parents:
diff changeset
559 return ; YES
heinrichsweikamp
parents:
diff changeset
560 menu_draw_line_none2:
heinrichsweikamp
parents:
diff changeset
561 movf menu_item,W ; Done item_max lines ?
heinrichsweikamp
parents:
diff changeset
562 xorwf item_max,W
heinrichsweikamp
parents:
diff changeset
563 btfss STATUS,Z
heinrichsweikamp
parents:
diff changeset
564 bra menu_draw_lines_1 ; No: loop...
heinrichsweikamp
parents:
diff changeset
565 return
heinrichsweikamp
parents:
diff changeset
566
heinrichsweikamp
parents:
diff changeset
567 menu_draw_line_none_divemode:
heinrichsweikamp
parents:
diff changeset
568 movlw .10
heinrichsweikamp
parents:
diff changeset
569 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
heinrichsweikamp
parents:
diff changeset
570 clrf WREG
heinrichsweikamp
parents:
diff changeset
571 movff WREG,buffer+.10
heinrichsweikamp
parents:
diff changeset
572
heinrichsweikamp
parents:
diff changeset
573 call aa_wordprocessor ; Draw the line!
heinrichsweikamp
parents:
diff changeset
574
189
e79bc535ef9e ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents: 187
diff changeset
575 banksel common
e79bc535ef9e ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents: 187
diff changeset
576 bcf win_invert ; Reset invert flag
e79bc535ef9e ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents: 187
diff changeset
577 banksel win_top
0
heinrichsweikamp
parents:
diff changeset
578
heinrichsweikamp
parents:
diff changeset
579 movlw .24 ; Divemode menu spacing
heinrichsweikamp
parents:
diff changeset
580 addwf win_top,F
heinrichsweikamp
parents:
diff changeset
581 incf menu_item,F ; inc loop counter
heinrichsweikamp
parents:
diff changeset
582
heinrichsweikamp
parents:
diff changeset
583 movlw .3
heinrichsweikamp
parents:
diff changeset
584 cpfseq menu_item ; At pos 4?
heinrichsweikamp
parents:
diff changeset
585 bra menu_draw_line_none2 ; No
heinrichsweikamp
parents:
diff changeset
586
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
587 movlw dm_menu_item4_row
0
heinrichsweikamp
parents:
diff changeset
588 movff WREG,win_top ; Reset row
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 275
diff changeset
589 movlw dm_menu_item4_column
0
heinrichsweikamp
parents:
diff changeset
590 movff WREG,win_leftx2 ; New column
heinrichsweikamp
parents:
diff changeset
591 bra menu_draw_line_none2 ; Done.
heinrichsweikamp
parents:
diff changeset
592
heinrichsweikamp
parents:
diff changeset
593 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
594 ; Put a mark in front of the current line
heinrichsweikamp
parents:
diff changeset
595 menu_draw_selected_line:
heinrichsweikamp
parents:
diff changeset
596 clrf timeout_counter2 ; Reset timeout
heinrichsweikamp
parents:
diff changeset
597 WIN_BOX_BLACK .34,.221,MENU_LEFT-8,MENU_LEFT-2 ; Clear left column
heinrichsweikamp
parents:
diff changeset
598
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 0
diff changeset
599 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
600 WIN_SMALL MENU_LEFT-8, 0 ; Arrow symbol only in small font
heinrichsweikamp
parents:
diff changeset
601 movf start_item,W ; First line (scrolled)
heinrichsweikamp
parents:
diff changeset
602 subwf selected_item,W ; selected - first
heinrichsweikamp
parents:
diff changeset
603 mullw MENU_HEIGHT ; 30 pixel by line
heinrichsweikamp
parents:
diff changeset
604 movf PRODL,W ; result
heinrichsweikamp
parents:
diff changeset
605 addwf menu_center,W ; added to first line
heinrichsweikamp
parents:
diff changeset
606 movwf win_top ; and stored to pos.
heinrichsweikamp
parents:
diff changeset
607 STRCPY_PRINT "\xb7" ; print cursor
heinrichsweikamp
parents:
diff changeset
608
heinrichsweikamp
parents:
diff changeset
609 return
heinrichsweikamp
parents:
diff changeset
610
heinrichsweikamp
parents:
diff changeset
611 END