comparison code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 169:e26f49674956

Merge decoplan display for both GF and Buhlmann models. + Add CF(54) to reverse deco plan display order. + Clean state machine to faster redisplay in divemode. Fix don't flip screen for soft emulation.
author JeanDo
date Wed, 26 Jan 2011 19:19:02 +0100
parents 4f9f477bb452
children b6dd54b3567c
comparison
equal deleted inserted replaced
168:494587193f5d 169:e26f49674956
157 dcfsnz menupos,F 157 dcfsnz menupos,F
158 bra divemode_menu3 ; Customview-function 158 bra divemode_menu3 ; Customview-function
159 dcfsnz menupos,F 159 dcfsnz menupos,F
160 bra divemode_toggle_brightness ; Toggle OLED-Brightness 160 bra divemode_toggle_brightness ; Toggle OLED-Brightness
161 dcfsnz menupos,F 161 dcfsnz menupos,F
162 bra timeout_divemenu2 ; Quit divemode menu
162 bra timeout_divemenu2 ; Quit divemode menu 163 bra timeout_divemenu2 ; Quit divemode menu
163 bra timeout_divemenu2 ; Quit divemode menu
164 164
165 divemode_menu3: 165 divemode_menu3:
166 movff menupos3,temp1 ; copy 166 movff menupos3,temp1 ; copy
167 dcfsnz temp1,F 167 dcfsnz temp1,F
168 bra toggle_stopwatch ; Toggle Stopwatch/Average register 168 bra toggle_stopwatch ; Toggle Stopwatch/Average register
169 dcfsnz temp1,F 169 dcfsnz temp1,F
170 bra set_marker ; Set Marker 170 bra set_marker ; Set Marker
171 dcfsnz temp1,F 171 dcfsnz temp1,F
175 175
176 divemode_menu3_nothing: 176 divemode_menu3_nothing:
177 bra timeout_divemenu2 ; Quit divemode menu 177 bra timeout_divemenu2 ; Quit divemode menu
178 178
179 set_marker: 179 set_marker:
180 movlw d'6' ; Type of Alarm (Manual Marker) 180 movlw d'6' ; Type of Alarm (Manual Marker)
181 movwf AlarmType ; Copy to Alarm Register 181 movwf AlarmType ; Copy to Alarm Register
182 bsf event_occured ; Set Event Flag 182 bsf event_occured ; Set Event Flag
183 bra timeout_divemenu2 ; quit menu! 183 bra timeout_divemenu2 ; quit menu!
184 184
185 toggle_stopwatch: 185 toggle_stopwatch:
186 bsf reset_average_depth ; Average Depth will be resetted in divemode.asm 186 bsf reset_average_depth ; Average Depth will be resetted in divemode.asm
187 bra timeout_divemenu2 ; quit menu! 187 bra timeout_divemenu2 ; quit menu!
331 331
332 divemenu_see_decoplan: 332 divemenu_see_decoplan:
333 bsf display_see_deco ; set flag 333 bsf display_see_deco ; set flag
334 call PLED_clear_divemode_menu ; Clear Menu 334 call PLED_clear_divemode_menu ; Clear Menu
335 335
336 read_int_eeprom d'34'
337 movlw d'3'
338 cpfsgt EEDATA ; in multi-gf mode? Z16 GF OC=4 and Z16 GF CC=5
339 bra divemenu_see_decoplan1 ; No, standard ZH-L16
340
341 bsf multi_gf_display ; Yes, display the multi-gf table screen
342 bcf last_ceiling_gf_shown ; Clear flag 336 bcf last_ceiling_gf_shown ; Clear flag
343
344 clrf decoplan_page ; Starts on page 0 337 clrf decoplan_page ; Starts on page 0
345 call PLED_decoplan_gf ; Display the new screen 338 bra divemenu_see_decoplan2_1
346 return
347
348 divemenu_see_decoplan1:
349 movff char_O_deco_status,WREG
350 tstfsz WREG ; deco_status=0 if decompression calculation done
351 return ; calculation not yet finished!
352
353 call PLED_decoplan ; display the Decoplan
354 return
355 339
356 divemenu_see_decoplan2: 340 divemenu_see_decoplan2:
357 btfsc multi_gf_display ; Next Page in Multi-GF Screen? 341 incf decoplan_page,F
358 bra divemenu_see_decoplan2_nextgf ; Yes! 342 btfsc last_ceiling_gf_shown ; last ceiling shown?
359 ; No, remove outputs! 343 bra divemenu_see_decoplan2_0 ; All done, clear and return
344
345 divemenu_see_decoplan2_1:
346 clrf timeout_counter3 ; Clear timeout Divemode menu
347 call PLED_decoplan ; Display the new screen
348 return
349
360 divemenu_see_decoplan2_0: 350 divemenu_see_decoplan2_0:
361 bcf display_see_deco ; clear flag 351 bcf display_see_deco ; clear flag
362 bra timeout_divemenu2 ; quit menu! 352 bra timeout_divemenu2 ; quit menu!
363
364 divemenu_see_decoplan2_nextgf:
365 incf decoplan_page,F
366 btfsc last_ceiling_gf_shown ; last ceiling shown?
367 bra divemenu_see_decoplan2_0 ; All done, clear and return
368
369 clrf timeout_counter3 ; Clear timeout Divemode menu
370 bra timeout_divemenu3x ; Display next page
371 353
372 divemenu_set_xgas2: 354 divemenu_set_xgas2:
373 dcfsnz menupos,F 355 dcfsnz menupos,F
374 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit 356 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit
375 dcfsnz menupos,F 357 dcfsnz menupos,F
591 btfsc display_set_simulator ; Is the Simulator Mask active? 573 btfsc display_set_simulator ; Is the Simulator Mask active?
592 bra timeout_divemenu6 ; Yes, update Simulator mask 574 bra timeout_divemenu6 ; Yes, update Simulator mask
593 575
594 btfss display_see_deco ; Is the decoplan active? 576 btfss display_see_deco ; Is the decoplan active?
595 bra timeout_divemenu1 ; No, skip updating the decoplan 577 bra timeout_divemenu1 ; No, skip updating the decoplan
596 578 bra timeout_divemenu3 ; Yes...
597 btfsc multi_gf_display ; display the multi-gf table screen?
598 bra timeout_divemenu3 ; Yes...
599
600 movff char_O_deco_status,WREG
601 tstfsz WREG ; deco_status=0 if decompression calculation done
602 bra timeout_divemenu1 ; No, skip updating the decoplan
603
604 call PLED_decoplan ; update the Decoplan
605 579
606 timeout_divemenu1: 580 timeout_divemenu1:
607 incf timeout_counter3,F ; increase timeout_counter3 581 incf timeout_counter3,F ; increase timeout_counter3
608 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG 582 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG
609 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu 583 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu
610 return ; No! 584 return ; No!
585
611 timeout_divemenu2: ; quit divemode menu 586 timeout_divemenu2: ; quit divemode menu
612 ; btfss multi_gf_display ; Was the Multi-GF Table displayed?
613 ; bra timeout_divemenu2a ; No, normal OLED rebuild
614
615 ; Restore some outputs 587 ; Restore some outputs
616 clrf decoplan_page ; Page 0-1 of deco list 588 clrf decoplan_page ; Page 0-1 of deco list
617 call PLED_clear_divemode_menu; Clear dive mode menu 589 call PLED_clear_divemode_menu; Clear dive mode menu
618 590
619 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode 591 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
625 call PLED_display_deko_mask ; clear nostop time, display decodata 597 call PLED_display_deko_mask ; clear nostop time, display decodata
626 btfss dekostop_active 598 btfss dekostop_active
627 call PLED_display_ndl_mask ; Clear deco data, display nostop time 599 call PLED_display_ndl_mask ; Clear deco data, display nostop time
628 600
629 timeout_divemenu2a: 601 timeout_divemenu2a:
630 bcf multi_gf_display ; Do not display the multi-gf table screen
631 bcf menubit 602 bcf menubit
632 bcf premenu ; Yes, clear flags and menu, display dive time and mask again 603 bcf premenu ; Yes, clear flags and menu, display dive time and mask again
633 call PLED_active_gas_divemode; Display gas, if required 604 call PLED_active_gas_divemode; Display gas, if required
634 call PLED_divemode_mask ; Display mask 605 call PLED_divemode_mask ; Display mask
635 call PLED_divemins ; Display (new) divetime! 606 call PLED_divemins ; Display (new) divetime!
641 bcf display_set_setpoint 612 bcf display_set_setpoint
642 bcf display_set_simulator 613 bcf display_set_simulator
643 bcf switch_left ; and debounce switches 614 bcf switch_left ; and debounce switches
644 bcf switch_right 615 bcf switch_right
645 return 616 return
646 617
618 ; Re-Draw current page of decoplan (may have more stops)
647 timeout_divemenu3: 619 timeout_divemenu3:
648 movff char_O_deco_status,WREG 620 movff char_O_deco_status,WREG ; Get last computation state (BANK safe)
649 tstfsz WREG ; deco_status=0 if decompression calculation done 621 iorwf WREG ; Is it zero ?
650 bra timeout_divemenu1 ; No, skip updating the decoplan 622 btfsc STATUS,Z
651 timeout_divemenu3x: 623 call PLED_decoplan ; Yes: new data available.
652 call PLED_decoplan_gf ; Re-Draw Current page of GF Decoplan
653 bra timeout_divemenu1 ; Check timeout 624 bra timeout_divemenu1 ; Check timeout
654 625
655 timeout_divemenu6: 626 timeout_divemenu6:
656 ; Update Simulator Mask 627 ; Update Simulator Mask
657 call PLED_divemode_simulator_mask; Show mask 628 call PLED_divemode_simulator_mask; Show mask
658 call PLED_divemenu_cursor ; update cursor 629 call PLED_divemenu_cursor ; update cursor
659 bra timeout_divemenu1 ; Check timeout 630 bra timeout_divemenu1 ; Check timeout