comparison src/divemenu_tree.asm @ 640:8c1f1f334275

3.13 release
author heinrichsweikamp
date Thu, 29 Oct 2020 09:29:15 +0100
parents 4050675965ea
children 7d8a4c60ec1a
comparison
equal deleted inserted replaced
639:0ff82370991d 640:8c1f1f334275
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File divemenu_tree.asm * combined next generation V3.09.5 3 ; File divemenu_tree.asm * combined next generation V3.12.3
4 ; 4 ;
5 ; OSTC dive mode menu 5 ; OSTC dive mode menu
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all rights reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all rights reserved.
8 ;============================================================================= 8 ;=============================================================================
147 147
148 IFDEF _external_sensor 148 IFDEF _external_sensor
149 main_divemenu_pscr_sensors: 149 main_divemenu_pscr_sensors:
150 MENU_BEGIN_DIVE .6 150 MENU_BEGIN_DIVE .6
151 MENU_CALL tDiveBailout, do_divemode_gaslist_bail 151 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
152 MENU_CALL tCCRSensor, do_divemode_setpoint_pscr 152 MENU_CALL tCCRModeSensor, do_divemode_setpoint_pscr
153 MENU_CALL tDivemenu_Premix, do_divemode_gaslist 153 MENU_CALL tDivemenu_Premix, do_divemode_gaslist
154 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr 154 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
155 MENU_DYNAMIC dyn_toggle_gf, do_toggle_gf 155 MENU_DYNAMIC dyn_toggle_gf, do_toggle_gf
156 MENU_CALL tExit, do_exit_divemode_menu 156 MENU_CALL tExit, do_exit_divemode_menu
157 MENU_END 157 MENU_END
170 ;----------------------------------------------------------------------------- 170 ;-----------------------------------------------------------------------------
171 ; Call Function - switch to calculated Setpoint (pSCR) 171 ; Call Function - switch to calculated Setpoint (pSCR)
172 ; 172 ;
173 do_switch_sp_calc: 173 do_switch_sp_calc:
174 bcf warn_det_sensors_lost ; clear fallback condition (revoke all sensors lost warning) 174 bcf warn_det_sensors_lost ; clear fallback condition (revoke all sensors lost warning)
175 clrf WREG ; switch to fixed SP 175 clrf dive_ccr_mode ; switch to fixed SP
176 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP 176 clrf WREG ; set setpoint to 0, this forces deco engine to take the computed ppO2
177 movff WREG,char_I_const_ppO2 ; set setpoint to 0, this forces deco engine to take the computed ppO2 177 movff WREG,char_I_const_ppO2 ; ...
178 bra do_switch_sp_com ; continue with common part 178 bra do_switch_sp_com ; continue with common part
179 179
180 ENDIF ; _ccr_pscr 180 ENDIF ; _ccr_pscr
181 181
182 182
524 ; Sub Menu - select Setpoint 524 ; Sub Menu - select Setpoint
525 ; 525 ;
526 do_divemode_splist: 526 do_divemode_splist:
527 bsf short_gas_descriptions ; do not show "SP" etc. 527 bsf short_gas_descriptions ; do not show "SP" etc.
528 movlw .1 ; default to first menu item 528 movlw .1 ; default to first menu item
529 movff opt_ccr_mode,lo ; get CCR mode (0: Fixed SP, 1: Sensor, 2: Auto SP) 529 movff dive_ccr_mode,lo ; get CCR mode (0: Fixed SP, 1: Sensor, 2: Auto SP)
530 dcfsnz lo,F ; mode = sensor ? 530 dcfsnz lo,F ; mode = sensor ?
531 movlw .6 ; YES - load menu item number for 'sensor' 531 movlw .6 ; YES - load menu item number for 'sensor'
532 btfsc warn_det_sensors_lost ; all sensors lost? 532 btfsc warn_det_sensors_lost ; all sensors lost?
533 movlw .1 ; YES - revert to first menu item 533 movlw .1 ; YES - revert to first menu item
534 movwf menu_pos_cur ; set cursor position 534 movwf menu_pos_cur ; set cursor position
539 btfsc ext_input_optical ; do we have an optical input (OSTC 3)? 539 btfsc ext_input_optical ; do we have an optical input (OSTC 3)?
540 bra do_divemode_splist_sensor ; YES 540 bra do_divemode_splist_sensor ; YES
541 ENDIF ; _external_sensor 541 ENDIF ; _external_sensor
542 542
543 do_divemode_splist_no_sensor: 543 do_divemode_splist_no_sensor:
544 MENU_BEGIN_DIVE .5 544 MENU_BEGIN_DIVE .6
545 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 545 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
546 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 546 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
547 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 547 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
548 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 548 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
549 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 549 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
550 MENU_CALL tCCRModeAutoSP, do_switch_auto
550 MENU_END 551 MENU_END
551 552
552 553
553 IFDEF _external_sensor 554 IFDEF _external_sensor
554 555
557 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 558 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
558 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 559 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
559 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 560 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
560 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 561 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
561 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp 562 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp
562 MENU_CALL tCCRSensor, do_divemode_sensor 563 MENU_CALL tCCRModeSensor, do_divemode_sensor
563 MENU_END 564 MENU_END
564 565
565 ENDIF ; _external_sensor 566 ENDIF ; _external_sensor
566 567
567 568
581 movff PLUSW1,char_I_const_ppO2 ; set selected setpoint 582 movff PLUSW1,char_I_const_ppO2 ; set selected setpoint
582 IFDEF _external_sensor 583 IFDEF _external_sensor
583 call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics 584 call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics
584 ENDIF 585 ENDIF
585 bcf warn_det_sensors_lost ; clear fallback condition (revoke all sensors lost warning) 586 bcf warn_det_sensors_lost ; clear fallback condition (revoke all sensors lost warning)
586 clrf WREG ; switch to fixed SP 587 clrf dive_ccr_mode ; switch to fixed SP
587 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP 588 bra do_switch_sp_com ; continue with common part
589
590
591 ;-----------------------------------------------------------------------------
592 ; Call Function - switch to Auto-SP (CCR)
593 ;
594 do_switch_auto:
595 movff opt_setpoint_cbar+0,char_I_const_ppO2 ; selected 1st setpoint
596 bcf warn_det_sensors_lost ; clear fallback condition
597 movlw .2 ; switch to auto SP
598 movwf dive_ccr_mode ; =0: fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: auto SP
599 bsf restart_auto_sp ; restart auto SP selection
588 ;bra do_switch_sp_com ; continue with common part 600 ;bra do_switch_sp_com ; continue with common part
589 601
590 602
591 ;----------------------------------------------------------------------------- 603 ;-----------------------------------------------------------------------------
592 ; Helper Function - common Part of Setpoint Switching 604 ; Helper Function - common Part of Setpoint Switching
593 ; 605 ;
594 do_switch_sp_com: ; common part 606 do_switch_sp_com: ; common part
595 bsf event_occured ; set global event byte 607 bsf event_occured ; set global event byte
596 bsf event_SP_change ; set setpoint event flag 608 bsf event_SP_change ; set setpoint event flag
597 609
598 ; Clear some flags in case we were in bailout before... 610 ; clear some flags in case we were in bailout before...
599 bcf bailout_mode ; end bailout mode 611 bcf bailout_mode ; end bailout mode
600 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode 612 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode
601 bcf better_dil_available ; =1: a better diluent is available and a gas change is advised in dive mode 613 bcf better_dil_available ; =1: a better diluent is available and a gas change is advised in dive mode
602 bcf better_gas_blinking ; clear blinking flag 614 bcf better_gas_blinking ; clear blinking flag
603 bcf better_dil_blinking ; clear blinking flag 615 bcf better_dil_blinking ; clear blinking flag
656 ;----------------------------------------------------------------------------- 668 ;-----------------------------------------------------------------------------
657 ; Call Function - switch to using Sensors 669 ; Call Function - switch to using Sensors
658 ; 670 ;
659 do_switch_sensor: 671 do_switch_sensor:
660 movlw .1 ; switch to sensor (0: fixed/ calculated SP, 1: Sensor, 2: AutoSP) 672 movlw .1 ; switch to sensor (0: fixed/ calculated SP, 1: Sensor, 2: AutoSP)
661 movff WREG,opt_ccr_mode ; ... 673 movwf dive_ccr_mode ; ...
662 674
663 ; check for external HUD/ppO2 Monitor 675 ; check for external HUD/ppO2 Monitor
664 btfss ext_input_optical ; do we have an optical input? 676 btfss ext_input_optical ; do we have an optical input?
665 bra do_switch_sp_com ; NO - continue with common part 677 bra do_switch_sp_com ; NO - continue with common part
666 btfsc sensor1_active ; YES - process flags from HUD/ppO2 Monitor 678 btfsc sensor1_active ; YES - process flags from HUD/ppO2 Monitor