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