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