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