Mercurial > public > hwos_code
comparison src/simulator.asm @ 545:7e6df19264b6
BUGFIX: Simulator in CC mode
BUGFIX: Changing the dive mode and starting the simulator (without leaving the menu first) caused false calculations in the simulator
BUGFIX: PSCR Mode "OC Gases" showed Diluents, not OC gases
BUGFIX: CCR Mode ("First Diluent") was chosen based on OC "First Gas" number
| author | heinrichsweikamp |
|---|---|
| date | Wed, 06 Sep 2017 21:26:18 +0200 |
| parents | a346aff513c4 |
| children | abf3cbd5815e |
comparison
equal
deleted
inserted
replaced
| 544:64a45f203144 | 545:7e6df19264b6 |
|---|---|
| 125 clrf int_I_divemins+1 | 125 clrf int_I_divemins+1 |
| 126 banksel common ; Bank1 | 126 banksel common ; Bank1 |
| 127 bcf use_agf ; =1: Use aGF | 127 bcf use_agf ; =1: Use aGF |
| 128 | 128 |
| 129 rcall deco_setup_dive | 129 rcall deco_setup_dive |
| 130 | |
| 131 movlw .0 | |
| 132 movff WREG,char_I_const_ppO2 ; deactivate CCR-mode in deco calculations unless in CCR mode (char_I_const_ppO2 is filled below again) | |
| 130 | 133 |
| 131 ; Setup char_I_const_ppO2 for CC modes | 134 ; Setup char_I_const_ppO2 for CC modes |
| 132 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active | 135 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active |
| 133 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; Setup fixed Setpoint (Always start with SP1) | 136 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; Setup fixed Setpoint (Always start with SP1) |
| 134 | 137 rcall get_first_gas_to_WREG ; Gets first gas (0-4) into WREG |
| 135 rcall get_first_gas_to_WREG ; Gets first gas (0-4) into WREG | 138 |
| 139 ; Overwrite WREG in CCR and PSCR Mode | |
| 140 btfsc FLAG_ccr_mode | |
| 141 rcall get_first_dil_to_WREG | |
| 142 btfsc FLAG_pscr_mode | |
| 143 rcall get_first_dil_to_WREG | |
| 144 | |
| 145 addlw .1 ; 1-5 | |
| 136 movff WREG,char_I_first_gas ; Copy for compatibility | 146 movff WREG,char_I_first_gas ; Copy for compatibility |
| 137 banksel char_I_first_gas | 147 sublw .1 ; 0-4 |
| 138 incf char_I_first_gas,F ; 0-4 -> 1-5 | |
| 139 banksel common | |
| 140 extern setup_gas_registers | 148 extern setup_gas_registers |
| 141 call setup_gas_registers ; With WREG=Gas 0-4, set current N2/He/O2 ratios. | 149 call setup_gas_registers ; With WREG=Gas 0-4, set current N2/He/O2 ratios. |
| 142 extern set_actual_ppo2 | 150 extern set_actual_ppo2 |
| 143 call set_actual_ppo2 ; Then configure char_I_actual_ppO2 (For CNS) | 151 goto set_actual_ppo2 ; Then configure char_I_actual_ppO2 (For CNS) (And return!) |
| 144 return | |
| 145 | 152 |
| 146 global deco_setup_dive | 153 global deco_setup_dive |
| 147 deco_setup_dive: ; Called from divemode | 154 deco_setup_dive: ; Called from divemode |
| 148 banksel common ; Bank1 | 155 banksel common ; Bank1 |
| 149 | 156 |
| 150 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active | 157 btfsc is_bailout |
| 151 rcall deco_setup_cc_diluents ; Setup CC Diluents | 158 bra deco_setup_dive_oc |
| 152 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active | 159 btfsc FLAG_ccr_mode |
| 153 rcall deco_setup_oc_gases ; Setup OC Gases | 160 bra deco_setup_dive_cc |
| 154 btfsc is_bailout ; =1: Bailout | 161 btfsc FLAG_pscr_mode |
| 155 rcall deco_setup_oc_gases ; Setup OC/Bailout Gases | 162 bra deco_setup_dive_cc |
| 163 | |
| 164 deco_setup_dive_oc: | |
| 165 rcall deco_setup_oc_gases ; Setup OC/Bailout Gases | |
| 166 bra deco_setup_dive_cont | |
| 167 deco_setup_dive_cc: | |
| 168 rcall deco_setup_cc_diluents ; Setup CC Diluents | |
| 169 deco_setup_dive_cont: | |
| 156 | 170 |
| 157 movff divemins+0,int_I_divemins+0 ; Current dive time. | 171 movff divemins+0,int_I_divemins+0 ; Current dive time. |
| 158 movff divemins+1,int_I_divemins+1 | 172 movff divemins+1,int_I_divemins+1 |
| 159 | 173 |
| 160 movlw deco_distance | 174 movlw deco_distance |
| 382 banksel common | 396 banksel common |
| 383 btfss is_bailout ; Doing a bailout decoplan ? | 397 btfss is_bailout ; Doing a bailout decoplan ? |
| 384 bra deco_planer_finishing ; NO: keep gases | 398 bra deco_planer_finishing ; NO: keep gases |
| 385 | 399 |
| 386 rcall deco_setup_oc_gases ; Switch to OC gas and no const_ppO2 | 400 rcall deco_setup_oc_gases ; Switch to OC gas and no const_ppO2 |
| 401 | |
| 402 movlw .0 | |
| 403 movff WREG,char_I_const_ppO2 ; deactivate CCR-mode deco calculations | |
| 387 | 404 |
| 388 ;---- Wait until status reach zero ------------------------------------------- | 405 ;---- Wait until status reach zero ------------------------------------------- |
| 389 deco_planer_finishing: | 406 deco_planer_finishing: |
| 390 btg LEDg | 407 btg LEDg |
| 391 ; clrf TMR5L | 408 ; clrf TMR5L |
