comparison src/divemode.asm @ 628:cd58f7fc86db

3.05 stable work
author heinrichsweikamp
date Thu, 19 Sep 2019 12:01:29 +0200
parents c40025d8e750
children 185ba2f91f59
comparison
equal deleted inserted replaced
627:bf5fee575701 628:cd58f7fc86db
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File divemode.asm combined next generation V3.03.4 3 ; File divemode.asm combined next generation V3.04.3
4 ; 4 ;
5 ; Dive Mode 5 ; Dive Mode
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
178 ; set initial screen layout 178 ; set initial screen layout
179 bcf alt_layout_active ; default to normal layout 179 bcf alt_layout_active ; default to normal layout
180 TSTOSC opt_layout ; alternative layout enabled? 180 TSTOSC opt_layout ; alternative layout enabled?
181 bsf alt_layout_active ; YES - start with alternative layout 181 bsf alt_layout_active ; YES - start with alternative layout
182 182
183 IFDEF _gas_contingency
184 ; disable gas contingency mode (may be left over activated by deco calculator)
185 clrf WREG
186 movff WREG,char_I_gas_contingency
187 ENDIF
188
183 ; boot tasks for all modes 189 ; boot tasks for all modes
184 call diveloop_boot 190 call diveloop_boot
185 191
186 ; startup tasks for all modes 192 ; startup tasks for all modes
187 ; clrf CCP1CON ; stop PWM 193 ; clrf CCP1CON ; stop PWM
363 ENDIF 369 ENDIF
364 370
365 diveloop_loop_6: 371 diveloop_loop_6:
366 ; deco mode tasks every 1/1 second 372 ; deco mode tasks every 1/1 second
367 INCI divesecs_avg_trip ; increment the resettable dive time 373 INCI divesecs_avg_trip ; increment the resettable dive time
368 INCI divesecs_avg_total ; increment the total dive dive time 374 INCI divesecs_avg_total ; increment the total dive time
369 375
370 btfsc FLAG_gauge_mode ; in gauge mode? 376 btfsc FLAG_gauge_mode ; in gauge mode?
371 bra diveloop_loop_7 ; YES - skip deco calculations 377 bra diveloop_loop_7 ; YES - skip deco calculations
372 378
373 call calc_deco_engine ; ##### calculate decompression ##### 379 call calc_deco_engine ; ##### calculate decompression #####
394 btfsc divesecs_avg_trip+0,0 ; on odd second of resettable dive time? 400 btfsc divesecs_avg_trip+0,0 ; on odd second of resettable dive time?
395 rcall safety_stop_control ; YES - exercise safety stop control 401 rcall safety_stop_control ; YES - exercise safety stop control
396 402
397 diveloop_loop_9: 403 diveloop_loop_9:
398 ; deco mode tasks every 1/1 second 404 ; deco mode tasks every 1/1 second
405 rcall check_deco_states ; check and lock if in deco and in the deco stops region
399 rcall TFT_output_3 ; do display updates 406 rcall TFT_output_3 ; do display updates
400 407
401 diveloop_loop_10: 408 diveloop_loop_10:
402 ; common tasks every 1/1 second 409 ; common tasks every 1/1 second
403 rcall timeout_divemode ; check for timeout condition 410 rcall timeout_divemode ; check for timeout condition
527 clrf TFT_output_flags_4 ; mark all TFT updates done 534 clrf TFT_output_flags_4 ; mark all TFT updates done
528 return ; done 535 return ; done
529 536
530 ;-------------------------------------------------------------------------------------------------------- 537 ;--------------------------------------------------------------------------------------------------------
531 538
532 divemode_apnoe_tasks: ; 1 sec. apnoe tasks 539 divemode_apnoe_tasks: ; 1 sec. apnoe tasks
533 bsf FLAG_TFT_apnoe_divetime ; show apnoe dive times (current/last dive and total) 540 bsf FLAG_TFT_apnoe_divetime ; show apnoe dive times (current/last dive and total)
534 btfsc apnoe_at_surface ; at the surface? 541 btfsc apnoe_at_surface ; at the surface?
535 bra divemode_apnoe_tasks_surf ; YES - at the surface 542 bra divemode_apnoe_tasks_surf ; YES - at the surface
536 ;bra divemode_apnoe_tasks_dive ; NO - in dive phase 543 ;bra divemode_apnoe_tasks_dive ; NO - in dive phase
537 544
538 divemode_apnoe_tasks_dive: ; apnoe mode, submerged 545 divemode_apnoe_tasks_dive: ; apnoe mode, submerged
539 btfss apnoe_new_dive ; new dive begun? 546 btfss apnoe_new_dive ; new dive begun?
540 return ; NO - done 547 return ; NO - done
541 bcf apnoe_new_dive ; YES - clear flag 548 bcf apnoe_new_dive ; YES - clear flag
542 bsf FLAG_TFT_clear_apnoe_surface; - clear apnoe mode surface data from screen 549 bsf FLAG_TFT_clear_apnoe_surface ; - clear apnoe mode surface data from screen
543 return ; - done 550 return ; - done
544 551
545 divemode_apnoe_tasks_surf: ; apnoe mode, at the surface 552 divemode_apnoe_tasks_surf: ; apnoe mode, at the surface
546 bsf FLAG_TFT_apnoe_surface_time ; show apnoe mode surface time 553 bsf FLAG_TFT_apnoe_surface_time ; show apnoe mode surface time
547 ; TODO: these outputs would need to be done only once after surfacing... 554 ; TODO: these outputs would need to be done only once after surfacing...
548 bsf FLAG_TFT_depth_maximum_apnoe; show max. depth of last dive 555 bsf FLAG_TFT_depth_maximum_apnoe ; show max. depth of last dive
549 bsf FLAG_TFT_depth_maximum ; show max. depth of all dives 556 bsf FLAG_TFT_depth_maximum ; show max. depth of all dives
550 ;bra apnoe_calc_maxdepth ; calculate overall max. depth and return 557 ;bra apnoe_calc_maxdepth ; calculate overall max. depth and return
551 558
552 559
553 global apnoe_calc_maxdepth 560 global apnoe_calc_maxdepth
554 apnoe_calc_maxdepth: 561 apnoe_calc_maxdepth:
555 MOVII apnoe_max_pressure, sub_a ; get max depth from all dives to far 562 MOVII apnoe_max_pressure, sub_a ; get max depth from all dives to far
1090 MOVII pressure_abs_cached,last_pressure_velocity 1097 MOVII pressure_abs_cached,last_pressure_velocity
1091 1098
1092 ; calculate velocity in m/min 1099 ; calculate velocity in m/min
1093 MOVII sub_c,xA ; copy pressure differential to xA 1100 MOVII sub_c,xA ; copy pressure differential to xA
1094 MOVLI .39,xB ; put scale coefficient into xB (use 77 when called every second) 1101 MOVLI .39,xB ; put scale coefficient into xB (use 77 when called every second)
1095 call mult16x16 ; compute differential pressure in mbar*39 1102 call mult16x16 ; compute differential pressure in mbar * scale coefficient
1096 MOVII xC,divA ; copy result to divA 1103 MOVII xC,divA ; copy result to divA
1104 ADDLI .64,divA ; add some round-up TODO: too sensitive with this?
1097 movlw .7 ; divide by 2^7 1105 movlw .7 ; divide by 2^7
1098 call div16 ; divA = divA / 2^WREG, yields velocity in m/min 1106 call div16 ; divA = divA / 2^WREG, yields velocity in m/min
1099 1107
1100 movlw .99 ; load a 99 1108 movlw .99 ; load a 99
1101 cpfslt divA+0 ; velocity < 99 m/min ? 1109 cpfslt divA+0 ; velocity < 99 m/min ?
1108 bsf FLAG_TFT_velocity_clear ; NO - don't show / request to clear 1116 bsf FLAG_TFT_velocity_clear ; NO - don't show / request to clear
1109 btfsc STATUS,C ; above threshold? 1117 btfsc STATUS,C ; above threshold?
1110 bsf FLAG_TFT_velocity_show ; YES - request to show 1118 bsf FLAG_TFT_velocity_show ; YES - request to show
1111 return ; done 1119 return ; done
1112 1120
1121
1122 ;=============================================================================
1123
1124 check_deco_states:
1125 btfsc deco_region ; been within the deco stops region before?
1126 return ; YES - been in deco then before too, done
1127 movff char_O_deco_info,WREG ; NO - get deco info vector
1128 btfss WREG,deco_stops ; do we have a deco obligation right now?
1129 return ; NO - done
1130 bsf deco_locked ; YES - memorize dive was in deco
1131 movff char_O_deco_depth+0,WREG ; - get depth of first stop in meters into WREG
1132 addlw deco_region_distance+.1 ; - add deco region start distance + 1 meter for the negative test to work
1133 subwf depth_meter,W ; - compute current depth - (first stop depth + deco distance)
1134 btfss STATUS,C ; - result negative?
1135 bsf deco_region ; YES - memorize to have entered the deco stops region
1136 return ; - done
1113 1137
1114 ;============================================================================= 1138 ;=============================================================================
1115 1139
1116 safety_stop_control: 1140 safety_stop_control:
1117 TSTOSS opt_enable_safetystop ; safety stop enabled? (=1: show safety stop) 1141 TSTOSS opt_enable_safetystop ; safety stop enabled? (=1: show safety stop)
1284 IFDEF _cave_mode 1308 IFDEF _cave_mode
1285 1309
1286 update_backtrack: 1310 update_backtrack:
1287 btfsc dive_turned ; dive turned? 1311 btfsc dive_turned ; dive turned?
1288 return ; YES - done 1312 return ; YES - done
1289 movwf lo ; NO - store minutes to add in lo 1313 btfsc FLAG_backtrack_full ; NO - backtracking storage full?
1290 lfsr FSR1,char_I_backtrack_depth ; - load FSR1 with base address of backtrack storage 1314 return ; YES - done
1291 movff char_I_backtrack_time,FSR1L ; - adjust FSR1 to last index 1315 movwf lo ; NO - store minutes to add in lo
1316 lfsr FSR1,char_I_backtrack_depth ; - load FSR1 with base address of backtrack storage
1317 movff char_I_backtrack_time,FSR1L ; - adjust FSR1 to last index
1292 update_backtrack_loop: 1318 update_backtrack_loop:
1293 btfsc FLAG_backtrack_full ; - backtracking storage full? 1319 movff depth_meter,PREINC1 ; increment index and write current depth to backtrack storage
1294 return ; YES - done 1320 incfsz FSR1L,W ; increment index once more and dump to WREG, did a wrap-around occur (backtrack storage full)?
1295 movff depth_meter,PREINC1 ; NO - increment index and write current depth to backtrack storage 1321 bra update_backtrack_loop_1 ; NO - continue loop
1296 incfsz FSR1L,W ; - increment index once more into WREG, did a wrap-around occur (backtrack storage full)? 1322 bsf FLAG_backtrack_full ; YES - flag backtracking storage is full
1297 bra update_backtrack_loop_1 ; NO - continue loop 1323 return ; - done
1298 bsf FLAG_backtrack_full ; YES - flag backtracking storage is full
1299 return ; - done
1300 update_backtrack_loop_1: 1324 update_backtrack_loop_1:
1301 decfsz lo,F ; decrement loop counter, did it became zero? 1325 decfsz lo,F ; decrement loop counter, did it became zero?
1302 bra update_backtrack_loop ; NO - loop 1326 bra update_backtrack_loop ; NO - loop
1303 movff FSR1L,char_I_backtrack_time ; YES - store updated index 1327 movff FSR1L,char_I_backtrack_time ; YES - store updated index
1304 return ; - done 1328 return ; - done
1363 bcf divemode ; NO - quit dive mode as this was no real dive 1387 bcf divemode ; NO - quit dive mode as this was no real dive
1364 return ; done 1388 return ; done
1365 1389
1366 1390
1367 set_powersafe: 1391 set_powersafe:
1368 movlw color_code_battery_low+.1 ; get battery low level threshold [%] 1392 movlw battery_warn_level_36+1 ; get threshold for 3.6 Volt battery warning, incremented by 1
1369 cpfslt batt_percent ; current battery level > low level threshold ? 1393 btfss battery_is_36v ; actually a 3.6 Volt battery detected?
1394 movlw battery_warn_level_15+1 ; NO - replace with 1.5 Volt battery warning, incremented by 1
1395 cpfslt batt_percent ; current battery level > warning threshold ?
1370 return ; YES - ok, done 1396 return ; YES - ok, done
1371 movlw d'7' ; NO - set type of alarm = battery low 1397 movlw d'7' ; NO - set type of alarm = battery low
1372 movwf alarm_type ; - copy to alarm register 1398 movwf alarm_type ; - copy to alarm register
1373 bsf event_occured ; - set event flag 1399 bsf event_occured ; - set event flag
1374 movlw .0 ; - coding of brightness level ECO 1400 movlw .0 ; - coding of brightness level ECO
1612 bz get_first_gas_to_WREG3 ; YES - found the First gas 1638 bz get_first_gas_to_WREG3 ; YES - found the First gas
1613 incf lo,F ; NO - increment index 1639 incf lo,F ; NO - increment index
1614 movlw NUM_GAS+1 ; - get highest index+1 1640 movlw NUM_GAS+1 ; - get highest index+1
1615 cpfseq lo ; - all gases checked? 1641 cpfseq lo ; - all gases checked?
1616 bra get_first_gas_to_WREG2 ; NO - not yet 1642 bra get_first_gas_to_WREG2 ; NO - not yet
1617 movlw .1 ; YES - return gas 1 1643 movlw .1 ; YES - default to gas 1
1618 movff WREG,opt_gas_type+0 ; - set to type First 1644 movff WREG,opt_gas_type+0 ; - force it to be of type First
1619 return ; - done 1645 return ; - done
1620 get_first_gas_to_WREG3: 1646 get_first_gas_to_WREG3:
1621 movf lo,W ; copy index of gas found to be the First to WREG 1647 movf lo,W ; copy index of gas found to be the First to WREG
1622 incf WREG,W ; turn index into gas number (0-4 -> 1-5) 1648 incf WREG,W ; turn index into gas number (0-4 -> 1-5)
1623 return ; done 1649 return ; done
1637 bz get_first_dil_to_WREG3 ; YES - found the First dil 1663 bz get_first_dil_to_WREG3 ; YES - found the First dil
1638 incf lo,F ; NO - increment index 1664 incf lo,F ; NO - increment index
1639 movlw NUM_GAS+1 ; - get highest index+1 1665 movlw NUM_GAS+1 ; - get highest index+1
1640 cpfseq lo ; - dils checked? 1666 cpfseq lo ; - dils checked?
1641 bra get_first_dil_to_WREG2 ; NO - not yet 1667 bra get_first_dil_to_WREG2 ; NO - not yet
1642 movlw .1 ; YES - return dil 1 1668 movlw .1 ; YES - default to dil 1
1643 movff WREG,opt_dil_type+0 ; - set to type First 1669 movff WREG,opt_dil_type+0 ; - force it to be of type First
1644 return ; - done 1670 return ; - done
1645 get_first_dil_to_WREG3: 1671 get_first_dil_to_WREG3:
1646 movf lo,W ; copy index of dil found to be the First to WREG 1672 movf lo,W ; copy index of dil found to be the First to WREG
1647 incf WREG,W ; turn index into dil number (0-4 -> 1-5) 1673 incf WREG,W ; turn index into dil number (0-4 -> 1-5)
1648 return ; done 1674 return ; done
1649 1675
1650 ENDIF 1676 ENDIF
1651 1677
1652 ;============================================================================= 1678 ;=============================================================================
1653 1679
1680 global deco_setup_oc_gases
1654 deco_setup_oc_gases: ; with currently breathed gas in WREG (1-5 or 6) 1681 deco_setup_oc_gases: ; with currently breathed gas in WREG (1-5 or 6)
1655 movff char_O_deco_status,lo ; working copy of char_O_deco_status in bank common 1682 movff char_O_deco_status,lo ; working copy of char_O_deco_status in bank common
1656 deco_setup_oc_gases_pre: ; entry point with lo preloaded 1683 deco_setup_oc_gases_pre: ; entry point with lo preloaded
1657 movff WREG,char_I_current_gas_num ; set gas to start with when doing the deco calculations 1684 movff WREG,char_I_current_gas_num ; set gas to start with when doing the deco calculations
1658 ; 1685 ;
1665 ; opt_gas_type res NUM_GAS | char_I_deco_gas_type res NUM_GAS 1692 ; opt_gas_type res NUM_GAS | char_I_deco_gas_type res NUM_GAS
1666 ; opt_dil_type res NUM_GAS | 1693 ; opt_dil_type res NUM_GAS |
1667 ; opt_gas_change res NUM_GAS | char_I_deco_gas_change res NUM_GAS 1694 ; opt_gas_change res NUM_GAS | char_I_deco_gas_change res NUM_GAS
1668 ; opt_dil_change res NUM_GAS | 1695 ; opt_dil_change res NUM_GAS |
1669 ; 1696 ;
1670 lfsr FSR2,char_I_deco_O2_ratio ; load FSR2 with base address of char_I_deco_O2_ratio. 1697 lfsr FSR2,char_I_deco_O2_ratio ; load FSR2 with base address of char_I_deco_O2_ratio
1671 ; FSR2 will step through all char_I_deco_... vars. 1698 ; FSR2 will step through all char_I_deco_... vars
1672 lfsr FSR1,opt_gas_O2_ratio ; load FSR1 with base address of opt_gas_O2_ratio 1699 lfsr FSR1,opt_gas_O2_ratio ; load FSR1 with base address of opt_gas_O2_ratio
1673 rcall deco_setup_copy ; copy all OC O2 ratios 1700 rcall deco_setup_copy ; copy all OC O2 ratios
1674 lfsr FSR1,opt_gas_He_ratio ; load FSR1 with base address of opt_gas_He_ratio 1701 lfsr FSR1,opt_gas_He_ratio ; load FSR1 with base address of opt_gas_He_ratio
1675 rcall deco_setup_copy ; copy all OC He ratios 1702 rcall deco_setup_copy ; copy all OC He ratios
1676 lfsr FSR1,opt_gas_type ; load FSR1 with base address of opt_gas_type 1703 lfsr FSR1,opt_gas_type ; load FSR1 with base address of opt_gas_type
1685 1712
1686 ;============================================================================= 1713 ;=============================================================================
1687 1714
1688 IFDEF _ccr_pscr 1715 IFDEF _ccr_pscr
1689 1716
1717 global deco_setup_cc_diluents
1690 deco_setup_cc_diluents: ; with currently breathed diluent in WREG (1-5 or 6) 1718 deco_setup_cc_diluents: ; with currently breathed diluent in WREG (1-5 or 6)
1691 movff char_O_deco_status,lo ; working copy of char_O_deco_status in bank common 1719 movff char_O_deco_status,lo ; working copy of char_O_deco_status in bank common
1692 deco_setup_cc_diluents_pre: ; entry point with lo preloaded 1720 deco_setup_cc_diluents_pre: ; entry point with lo preloaded
1693 btfsc bailout_mode ; check if in bailout condition | --------------- FOR SAFETY ONLY -------------- 1721 btfsc bailout_mode ; check if in bailout condition | --------------- FOR SAFETY ONLY --------------
1694 bra deco_setup_oc_gases_pre ; YES - revert to setting up OC gases | This branch should never happen to be taken... 1722 bra deco_setup_oc_gases_pre ; YES - revert to setting up OC gases | This branch should never happen to be taken...
1734 decfsz WREG ; decrement loop counter and check if it became 0 1762 decfsz WREG ; decrement loop counter and check if it became 0
1735 bra deco_setup_copy_loop ; NO - not yet, loop 1763 bra deco_setup_copy_loop ; NO - not yet, loop
1736 return ; YES - done 1764 return ; YES - done
1737 1765
1738 1766
1767 global setup_gas_registers
1739 setup_gas_registers: ; with currently breathed gas in WREG (1-5 or 6) 1768 setup_gas_registers: ; with currently breathed gas in WREG (1-5 or 6)
1740 movwf active_gas ; set as current gas 1769 movwf active_gas ; set as current gas
1741 movlw .6 1770 movlw .6
1742 cpfseq active_gas ; gas = gas6 ? 1771 cpfseq active_gas ; gas = gas6 ?
1743 bra setup_gas_registers_15 ; NO - load gas 1-5 1772 bra setup_gas_registers_15 ; NO - load gas 1-5
1750 movff depth_meter,char_I_gas6_depth;set current depth as change depth 1779 movff depth_meter,char_I_gas6_depth;set current depth as change depth
1751 bra setup_gas_registers_com ; continue with common part 1780 bra setup_gas_registers_com ; continue with common part
1752 setup_gas_registers_15: 1781 setup_gas_registers_15:
1753 lfsr FSR1,opt_gas_O2_ratio ; load base address of gas data 1782 lfsr FSR1,opt_gas_O2_ratio ; load base address of gas data
1754 decf active_gas,W ; set index to O2 ratio of current gas (1-5 -> 0-4) 1783 decf active_gas,W ; set index to O2 ratio of current gas (1-5 -> 0-4)
1755 movff PLUSW1,char_I_O2_ratio ; copy gas 1-5 O2 ratio to deco engine 1784 movff PLUSW1,char_I_O2_ratio ; copy O2 ratio to deco engine
1756 addlw .10 ; advance index from O2 ratio to He ratio 1785 addlw .10 ; advance index from O2 ratio to He ratio
1757 IFDEF _helium 1786 IFDEF _helium
1758 movff PLUSW1,char_I_He_ratio ; copy gas 1-5 He ratio to deco engine 1787 movff PLUSW1,char_I_He_ratio ; copy He ratio to deco engine
1759 ENDIF 1788 ENDIF
1760 addlw .10 ; advance index from He ratio to gas type 1789 addlw .10 ; advance index from He ratio to gas type
1761 movff PLUSW1,char_I_current_gas_type ; copy gas 1-5 type (0=Disabled, 1=First, 2=Travel, 3=Deco) 1790 movff PLUSW1,char_I_current_gas_type ; copy gas type (0=Disabled, 1=First, 2=Travel, 3=Deco)
1762 setup_gas_registers_com: 1791 setup_gas_registers_com:
1763 movff char_O_main_status,lo ; working copy of char_O_main_status in bank common 1792 movff char_O_main_status,lo ; working copy of char_O_main_status in bank common
1764 bcf lo,DECO_MODE_PSCR_FLAG ; clear the pSCR-mode flag (may not be set, but never mind) 1793 bcf lo,DECO_MODE_PSCR_FLAG ; clear the pSCR-mode flag (may not be set, but never mind)
1765 bcf lo,DECO_MODE_LOOP_FLAG ; clear the loop/CCR-mode flag 1794 bcf lo,DECO_MODE_LOOP_FLAG ; clear the loop/CCR-mode flag
1766 movff lo,char_O_main_status ; bank safe write-back of char_O_main_status 1795 movff lo,char_O_main_status ; bank safe write-back of char_O_main_status
1769 1798
1770 ;============================================================================= 1799 ;=============================================================================
1771 1800
1772 IFDEF _ccr_pscr 1801 IFDEF _ccr_pscr
1773 1802
1803 global setup_dil_registers
1774 setup_dil_registers: ; with currently breathed gas in WREG (1-5 or 6) 1804 setup_dil_registers: ; with currently breathed gas in WREG (1-5 or 6)
1775 btfsc bailout_mode ; check if in bailout condition | --------------- FOR SAFETY ONLY -------------- 1805 btfsc bailout_mode ; check if in bailout condition | --------------- FOR SAFETY ONLY --------------
1776 bra setup_gas_registers ; revert to setting up OC gases in bailout condition | This branch should never happen to be taken... 1806 bra setup_gas_registers ; revert to setting up OC gases in bailout condition | This branch should never happen to be taken...
1777 movwf active_dil ; set as current diluent 1807 movwf active_dil ; set as current diluent
1778 movlw .6 1808 movlw .6
1787 movff depth_meter,char_I_gas6_depth;set current depth as change depth 1817 movff depth_meter,char_I_gas6_depth;set current depth as change depth
1788 bra setup_dil_registers_com ; continue with common part 1818 bra setup_dil_registers_com ; continue with common part
1789 setup_dil_registers_15: 1819 setup_dil_registers_15:
1790 lfsr FSR1,opt_dil_O2_ratio ; load base address of diluent data 1820 lfsr FSR1,opt_dil_O2_ratio ; load base address of diluent data
1791 decf active_dil,W ; set index to O2 ratio of current diluent (1-5 -> 0-4) 1821 decf active_dil,W ; set index to O2 ratio of current diluent (1-5 -> 0-4)
1792 movff PLUSW1,char_I_O2_ratio ; copy diluent 1-5 O2 ratio to deco engine 1822 movff PLUSW1,char_I_O2_ratio ; copy O2 ratio to deco engine
1793 addlw .10 ; advance index from O2 ratio to He ratio 1823 addlw .10 ; advance index from O2 ratio to He ratio
1794 IFDEF _helium 1824 IFDEF _helium
1795 movff PLUSW1,char_I_He_ratio ; copy diluent 1-5 He ratio to deco engine 1825 movff PLUSW1,char_I_He_ratio ; copy He ratio to deco engine
1796 ENDIF 1826 ENDIF
1797 addlw .10 ; advance index from He ratio to diluent type 1827 addlw .10 ; advance index from He ratio to diluent type
1798 movff PLUSW1,char_I_current_gas_type ; copy diluent type (0=Disabled, 1=First, 2=Normal) 1828 movff PLUSW1,char_I_current_gas_type ; copy diluent type (0=Disabled, 1=First, 2=Normal)
1799 setup_dil_registers_com: 1829 setup_dil_registers_com:
1800 movff char_O_main_status,lo ; working copy of char_O_main_status in bank common 1830 movff char_O_main_status,lo ; working copy of char_O_main_status in bank common
1872 divemode_option5: 1902 divemode_option5:
1873 bsf request_reset_avg ; request reset of average depth 1903 bsf request_reset_avg ; request reset of average depth
1874 goto menuview_toggle_reset ; terminate pre-menu and return 1904 goto menuview_toggle_reset ; terminate pre-menu and return
1875 1905
1876 divemode_option6: 1906 divemode_option6:
1907 ; check for pending +5 request
1908 movff char_I_sim_advance_time,WREG; get mailbox content
1909 tstfsz WREG ; mailbox clear (=0) ?
1910 return ; NO - still having a pending +5' request, refuse new request
1911
1877 ; advance tissues pressures and deco obligation by 5 minutes 1912 ; advance tissues pressures and deco obligation by 5 minutes
1878 movlw .5 ; + 5 minutes 1913 movlw .5 ; + 5 minutes
1879 movff WREG,char_I_sim_advance_time; copy to mailbox 1914 movff WREG,char_I_sim_advance_time; copy to mailbox
1880 call restart_deco_engine ; condition deco engine to execute the +5 minutes 1915 call restart_deco_engine ; condition deco engine to execute the +5 minutes
1881 1916
1926 ; update backtracking data 1961 ; update backtracking data
1927 movlw .5 ; configure 5 minutes 1962 movlw .5 ; configure 5 minutes
1928 call update_backtrack ; add backtrack data for 5 minutes 1963 call update_backtrack ; add backtrack data for 5 minutes
1929 ENDIF 1964 ENDIF
1930 1965
1931 goto menuview_toggle_reset ; terminate the pre-menu and return 1966 ; goto menuview_toggle_reset ; terminate the pre-menu and return
1967 return ; just return, leaving option avail for repeated selection
1932 1968
1933 IFDEF _compass 1969 IFDEF _compass
1934 divemode_option7: 1970 divemode_option7:
1935 ; store heading for compass view 1971 ; store heading for compass view
1936 MOVII compass_heading_shown,compass_bearing 1972 MOVII compass_heading_shown,compass_bearing
1977 ; - if in bailout, sets better_gas_available on OC gases 2013 ; - if in bailout, sets better_gas_available on OC gases
1978 ; 2014 ;
1979 ; in OC mode : - checks only gases for best gas 2015 ; in OC mode : - checks only gases for best gas
1980 ; - sets better_gas_available on OC gases 2016 ; - sets better_gas_available on OC gases
1981 ; 2017 ;
2018 global check_gas_best
1982 check_gas_best: 2019 check_gas_best:
1983 btfsc FLAG_gauge_mode ; in gauge mode? 2020 btfsc FLAG_gauge_mode ; in gauge mode?
1984 return ; YES - done 2021 return ; YES - done
1985 2022
1986 MOVII pressure_abs_10,xA ; copy absolute pressure / 10 into xA:2, will be used by ppO2 min/max checks later 2023 MOVII pressure_abs_10,xA ; copy absolute pressure / 10 into xA:2, will be used by ppO2 min/max checks later
1991 ADDLI ppO2_margin_on_max,PROD ; add ppO2 margin on max value to compensate for surface pressures > 1000 hPa 2028 ADDLI ppO2_margin_on_max,PROD ; add ppO2 margin on max value to compensate for surface pressures > 1000 hPa
1992 MOVII PROD,ppO2_max_deco ; store as deco ppO2 max 2029 MOVII PROD,ppO2_max_deco ; store as deco ppO2 max
1993 2030
1994 ; compute max. allowed default ppO2 2031 ; compute max. allowed default ppO2
1995 movff char_O_deco_info,lo ; bank-safe copy of deco info vector 2032 movff char_O_deco_info,lo ; bank-safe copy of deco info vector
1996 btfss lo,deco_flag ; is the ppO2 deco limit enabled? 2033 btfss lo,deco_mode ; is the ppO2 deco limit enabled?
1997 bra check_gas_best_1 ; NO - compute default ppO2 max 2034 bra check_gas_best_1 ; NO - compute default ppO2 max
1998 MOVII ppO2_max_deco,ppO2_max_default ; YES - copy default ppO2 max from deco max. 2035 MOVII ppO2_max_deco,ppO2_max_default ; YES - copy default ppO2 max from deco max.
1999 bra check_gas_best_2 ; - continue with common part 2036 bra check_gas_best_2 ; - continue with common part
2000 2037
2001 check_gas_best_1: 2038 check_gas_best_1:
2077 2114
2078 ENDIF ; _ccr_pscr 2115 ENDIF ; _ccr_pscr
2079 2116
2080 check_gas_best_gas: 2117 check_gas_best_gas:
2081 ; set minimum ppO2 required 2118 ; set minimum ppO2 required
2082 movff char_I_ppO2_min,WREG ; min ppO2 for OC and Bailout 2119 movff char_I_ppO2_min,WREG ; min ppO2 for OC and bailout
2083 mullw .100 ; min ppO2 * 100, result in 0.1 mbar 2120 mullw .100 ; min ppO2 * 100, result in 0.1 mbar
2084 MOVII PROD,ppO2_min ; store in ppO2_min 2121 MOVII PROD,ppO2_min ; store in ppO2_min
2085 ; preset results to nothing found 2122 ; preset results to nothing found
2086 clrf best_gas_num ; initialize best gas as 0 = nothing found yet 2123 clrf best_gas_num ; initialize best gas as 0 = nothing found yet
2087 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode 2124 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode
2159 addlw .20 ; add offset of 20 bytes to index type in opt_gas_type/opt_dil_type 2196 addlw .20 ; add offset of 20 bytes to index type in opt_gas_type/opt_dil_type
2160 movff PLUSW1,check_gas_type ; copy type of current gas/dil to check_gas_type (0=disabled, 1=first, 2=travel/normal, 3=deco/-) 2197 movff PLUSW1,check_gas_type ; copy type of current gas/dil to check_gas_type (0=disabled, 1=first, 2=travel/normal, 3=deco/-)
2161 addlw .10 ; add offset of 10 bytes to index change depth in opt_gas_change/opt_dil_change 2198 addlw .10 ; add offset of 10 bytes to index change depth in opt_gas_change/opt_dil_change
2162 movff PLUSW1,check_gas_depth ; copy change depth of current gas/dil to check_gas_depth 2199 movff PLUSW1,check_gas_depth ; copy change depth of current gas/dil to check_gas_depth
2163 MOVII ppO2_max_default,sub_b ; select default ppO2 max for first / travel / normal gas 2200 MOVII ppO2_max_default,sub_b ; select default ppO2 max for first / travel / normal gas
2201 ; check if the gas is the current gas
2202 movf check_gas_num,W ; get the number of the gas to be checked (1-5)
2203 cpfseq lo ; is this the currently used gas?
2204 bra check_gas_best_common0 ; NO - do the disabled & deco gas checks
2205 bra check_gas_best_common3 ; YES - a gas in use overrides disabled and deco status
2206 check_gas_best_common0:
2164 ; check if gas is available (i.e. not disabled) 2207 ; check if gas is available (i.e. not disabled)
2165 tstfsz check_gas_type ; type = disabled (0) ? 2208 tstfsz check_gas_type ; type = disabled (0) ?
2166 bra check_gas_best_common1 ; NO - continue checks 2209 bra check_gas_best_common1 ; NO - continue checks
2167 movf check_gas_num,W ; YES - get the number of the gas to be checked (1-5) 2210 return ; YES - skip disabled gases
2168 cpfseq lo ; - is this the currently used gas?
2169 return ; NO - skip disabled gases which are not the current gas
2170 bra check_gas_best_common3 ; YES - a gas in use overrides it's disabled status, therefore treat it as available
2171 check_gas_best_common1: 2211 check_gas_best_common1:
2172 ; skip deco gases (type=3) if there are no stops, but include them when in bailout mode 2212 ; skip deco gases (type=3) if there are no stops, but include them when in bailout mode
2173 movlw .3 ; coding for deco gas 2213 movlw .3 ; coding for deco gas
2174 cpfseq check_gas_type ; type = deco (3) ? 2214 cpfseq check_gas_type ; type = deco (3) ?
2175 bra check_gas_best_common3 ; NO - first or travel/normal then, ok to use 2215 bra check_gas_best_common3 ; NO - first or travel/normal then, ok to use
2176 btfsc bailout_mode ; YES - in bailout? 2216 btfsc bailout_mode ; YES - in bailout?
2177 bra check_gas_best_common2 ; YES - ok to use (using deco gases is always allowed when in bailout) 2217 bra check_gas_best_common2 ; YES - ok to use (using deco gases is always allowed when in bailout)
2178 2218 TSTOSS opt_extended_stops ; NO - extended stops enables?
2179 TSTOSC opt_extended_stops ; NO - extended stops activated? 2219 bra check_gas_best_common1b ; NO
2180 bra check_gas_best_common1a ; YES - (1) 2220 ;bra check_gas_best_common1a ; YES
2181 movff char_O_deco_info,WREG ; NO - get deco info vector
2182 btfss WREG,deco_flag ; - in deco mode (deco_flag set), i.e. use of deco gases allowed?
2183 return ; NO - skip deco gas while not in deco mode
2184 bra check_gas_best_common2 ; YES - ok to use
2185 check_gas_best_common1a: 2221 check_gas_best_common1a:
2186 movff char_O_deco_depth+0,WREG ; (1) - get depth of the first stop 2222 movff char_O_deco_info,WREG ; get deco info vector
2187 tstfsz WREG ; - is there any stop? 2223 btfss WREG,deco_mode ; are we in deco mode?
2188 bra check_gas_best_common2 ; YES - ok to use a deco gas 2224 return ; NO - skip deco gas while not in deco mode
2189 movf check_gas_num,W ; NO - get the number of the gas to be checked (1-5) 2225 bra check_gas_best_common2 ; YES - deco gases allowed
2190 cpfseq lo ; - is this the currently used gas? 2226 check_gas_best_common1b:
2191 return ; NO - skip this deco gas 2227 btfss deco_region ; are we in the deco region?
2192 ;bra check_gas_best_common2 ; YES - keep this deco gas as continued allowed 2228 return ; NO - skip deco gas while not in the deco region
2193 2229 ;bra check_gas_best_common2 ; YES - deco gases allowed
2194 check_gas_best_common2: 2230 check_gas_best_common2:
2195 MOVII ppO2_max_deco,sub_b ; replace by ppO2 max for a deco gas 2231 MOVII ppO2_max_deco,sub_b ; replace by ppO2 max for a deco gas
2196 check_gas_best_common3: 2232 check_gas_best_common3:
2197 ; check if gas is usable, i.e. its change depth is below or equal to the current depth 2233 ; check if gas is usable, i.e. its change depth is below or equal to the current depth
2198 movf depth_meter,W ; load current depth (in m) into WREG 2234 movf depth_meter,W ; load current depth (in m) into WREG
2204 movf best_gas_num,W ; get best gas found so far (1-5) or 0 if none found yet 2240 movf best_gas_num,W ; get best gas found so far (1-5) or 0 if none found yet
2205 tstfsz WREG ; has a best gas candidate been found yet? 2241 tstfsz WREG ; has a best gas candidate been found yet?
2206 bra check_gas_best_common5 ; YES - check if the new one is better than the one we have so far 2242 bra check_gas_best_common5 ; YES - check if the new one is better than the one we have so far
2207 bra check_gas_best_common6 ; NO - no need to do the above mentioned check 2243 bra check_gas_best_common6 ; NO - no need to do the above mentioned check
2208 check_gas_best_common5: 2244 check_gas_best_common5:
2209 ; check if the change depth of the checked gas is < (shallower) than the change depth of the best gas found so far 2245 ; check if the change depth of the checked gas is <= (shallower or equal) the change depth of the best gas found so far
2210 movf best_gas_depth,W ; load change depth of best gas so far into WREG 2246 movf best_gas_depth,W ; load change depth of best gas so far into WREG
2211 cpfslt check_gas_depth ; change depth of checked gas < (shallower than) change depth of best gas so far? 2247 cpfsgt check_gas_depth ; change depth of checked gas > (deeper than) change depth of best gas so far?
2212 return ; NO - this gas is not better than the best already found 2248 bra check_gas_best_common6 ; NO - this gas is better or equal, continue
2249 return ; YES - this gas is not better than the best already found
2213 check_gas_best_common6: 2250 check_gas_best_common6:
2214 ; check if the gas fits into the ppO2 limits 2251 ; check if the gas fits into the ppO2 limits
2215 movff check_gas_O2_ratio,xB+0 ; xB = O2 ratio, xA is still loaded with (absolute pressure / 10) 2252 movff check_gas_O2_ratio,xB+0 ; xB = O2 ratio, xA is still loaded with (absolute pressure / 10)
2216 clrf xB+1 2253 clrf xB+1
2217 call mult16x16 ; xC = O2 ratio * (absolute pressure / 10), result in 0.1 mbar 2254 call mult16x16 ; xC = O2 ratio * (absolute pressure / 10), result in 0.1 mbar
2348 global dive_boot_oc 2385 global dive_boot_oc
2349 dive_boot_oc: 2386 dive_boot_oc:
2350 ; set-up registers 2387 ; set-up registers
2351 rcall get_first_gas_to_WREG ; get first gas (1-5) into WREG 2388 rcall get_first_gas_to_WREG ; get first gas (1-5) into WREG
2352 rcall setup_gas_registers ; set-up of gas parameters of currently breathed gas (with WREG = gas 1-5) 2389 rcall setup_gas_registers ; set-up of gas parameters of currently breathed gas (with WREG = gas 1-5)
2353 rcall deco_setup_oc_gases ; set-up of gas list for deco calculations (with WREG = gas 1-5) 2390 rcall deco_setup_oc_gases ; set-up of gas list for deco calculations (with WREG = gas 1-5)
2354 return 2391 return
2355 2392
2356 ;============================================================================= 2393 ;=============================================================================
2357 2394
2358 IFDEF _ccr_pscr 2395 IFDEF _ccr_pscr
2366 movff opt_dil_type+3,opt_dil_type_backup+3 ; 0=Disabled, 1=First, 2=Normal 2403 movff opt_dil_type+3,opt_dil_type_backup+3 ; 0=Disabled, 1=First, 2=Normal
2367 movff opt_dil_type+4,opt_dil_type_backup+4 ; 0=Disabled, 1=First, 2=Normal 2404 movff opt_dil_type+4,opt_dil_type_backup+4 ; 0=Disabled, 1=First, 2=Normal
2368 ; set-up registers 2405 ; set-up registers
2369 rcall get_first_dil_to_WREG ; get first diluent (1-5) into WREG 2406 rcall get_first_dil_to_WREG ; get first diluent (1-5) into WREG
2370 rcall setup_dil_registers ; set-up of diluent parameters for currently breathed diluent (with WREG = current diluent 1-5) 2407 rcall setup_dil_registers ; set-up of diluent parameters for currently breathed diluent (with WREG = current diluent 1-5)
2371 rcall deco_setup_cc_diluents ; set-up of diluent list for deco calculations (with WREG = current diluent 1-5) 2408 rcall deco_setup_cc_diluents ; set-up of diluent list for deco calculations (with WREG = current diluent 1-5)
2372 ; done 2409 ; done
2373 return 2410 return
2374 2411
2375 2412
2376 dive_boot_cc_part2: 2413 dive_boot_cc_part2:
2430 diveloop_boot: 2467 diveloop_boot:
2431 ; do the basic initialization 2468 ; do the basic initialization
2432 call restart_set_modes_and_flags 2469 call restart_set_modes_and_flags
2433 2470
2434 ; stop accelerometer and compass 2471 ; stop accelerometer and compass
2435 call I2C_sleep_accelerometer
2436 call I2C_sleep_compass 2472 call I2C_sleep_compass
2437 2473
2438 ; do an early initialization of all deco engine output variables to 2474 ; do an early initialization of all deco engine output variables to
2439 ; avoid glitches in the display outputs during deco engine start-up 2475 ; avoid glitches in the display outputs during deco engine start-up
2440 call deco_init_output_vars; ; (C-code) 2476 call deco_init_output_vars; ; (C-code)
2477 movff char_O_deco_status,lo ; bank-safe read 2513 movff char_O_deco_status,lo ; bank-safe read
2478 bsf lo,DECO_START_NORM ; set flag for doing a normal plan, 2514 bsf lo,DECO_START_NORM ; set flag for doing a normal plan,
2479 bcf lo,DECO_START_ALT ; clear flag for doing an alternative plan, 2515 bcf lo,DECO_START_ALT ; clear flag for doing an alternative plan,
2480 bsf lo,DECO_INITIALIZE ; set flag for initializing the deco engine 2516 bsf lo,DECO_INITIALIZE ; set flag for initializing the deco engine
2481 bcf lo,DECO_ASCENT_FLAG ; disable delayed ascent calculation 2517 bcf lo,DECO_ASCENT_FLAG ; disable delayed ascent calculation
2518 bcf lo,DECO_CALCULATOR_MODE ; deco engine not run from the deco calculator
2482 movff lo,char_O_deco_status ; bank-safe copy back to deco engine 2519 movff lo,char_O_deco_status ; bank-safe copy back to deco engine
2483
2484 ; configure distance between actual depth and depth used for deco calculation
2485 movlw deco_distance
2486 movff WREG,char_I_deco_distance
2487 2520
2488 ; disable "fast forward" function 2521 ; disable "fast forward" function
2489 movlw .0 2522 movlw .0
2490 movff WREG,char_I_sim_advance_time 2523 movff WREG,char_I_sim_advance_time
2491 2524
2748 2781
2749 ;----------------------------------------------------------------------------- 2782 ;-----------------------------------------------------------------------------
2750 2783
2751 global check_warn_battery 2784 global check_warn_battery
2752 check_warn_battery: 2785 check_warn_battery:
2753 movff batt_percent,lo ; get battery %
2754 movlw battery_show_level+1 ; get threshold for showing battery level, incremented by 1 2786 movlw battery_show_level+1 ; get threshold for showing battery level, incremented by 1
2755 cpfslt lo ; battery percentage ok? 2787 cpfslt batt_percent ; battery percentage ok?
2756 return ; YES - no display, no warning 2788 return ; YES - no display, no warning
2757 ; Display Battery, but warn? 2789 ; Display Battery, but warn?
2758 movff batt_percent,lo ; get battery % 2790 movlw battery_warn_level_36+1 ; get threshold for 3.6 Volt battery warning, incremented by 1
2759 movlw color_code_battery_low+1 ; get threshold for battery warning, incremented by 1 2791 btfss battery_is_36v ; actually a 3.6 Volt battery detected?
2760 cpfsgt lo ; battery percent below warning threshold? 2792 movlw battery_warn_level_15+1 ; NO - replace with 1.5 Volt battery warning, incremented by 1
2793 cpfsgt batt_percent ; battery percent below warning threshold?
2761 bsf message_warning ; YES - set warning flag 2794 bsf message_warning ; YES - set warning flag
2762 movlw index_clock_batt_surfpress ; index of custom view clock, battery and surface pressure 2795 movlw index_clock_batt_surfpress ; index of custom view clock, battery and surface pressure
2763 cpfseq active_customview ; battery shown in custom view? 2796 cpfseq active_customview ; battery shown in custom view?
2764 bra check_warn_battery2 ; NO - show warning 2797 bra check_warn_battery2 ; NO - show warning
2765 return ; YES - do not show twice (in custom view and in message area) 2798 return ; YES - do not show twice (in custom view and in message area)
2766 check_warn_battery2: 2799 check_warn_battery2:
2767 incf message_counter,F ; increase counter 2800 incf message_counter,F ; increase counter
2768 goto TFT_msg_batt_percent_divemode ; show percent (and return) 2801 goto TFT_msg_batt_percent_divemode ; show percent (and return)
2769 2802
2770 2803
2771 check_divetimeout: 2804 check_divetimeout:
2772 btfsc count_divetime ; is dive time counted? 2805 btfsc count_divetime ; is dive time counted?
2773 return ; YES - do nothing 2806 return ; YES - do nothing
2816 bra check_ppo2_display ; YES - show 2849 bra check_ppo2_display ; YES - show
2817 return ; NO - in loop mode, ppO2 is already shown via setpoint display 2850 return ; NO - in loop mode, ppO2 is already shown via setpoint display
2818 check_ppo2_display_a: 2851 check_ppo2_display_a:
2819 bsf message_attention ; show attention sign 2852 bsf message_attention ; show attention sign
2820 check_ppo2_display: 2853 check_ppo2_display:
2821 movlw index_ppo2_ead_end_cns ; index of custom view ppO2, EAD/END and CNS) 2854 movlw index_ppo2_ead_end_cns ; index of custom view ppO2, EAD/END and CNS (without He) or gas density (with He)
2822 cpfseq active_customview ; ppO2 shown? 2855 cpfseq active_customview ; ppO2 shown?
2823 bra check_ppO2_b ; NO 2856 bra check_ppO2_b ; NO
2824 return ; YES - do not show twice (in custom view and in warning area) 2857 return ; YES - do not show twice (in custom view and in warning area)
2825 check_ppO2_b: 2858 check_ppO2_b:
2826 movlw index_pscr_info ; index of custom view with pSCR data 2859 movlw index_pscr_info ; index of custom view with pSCR data
2861 return ; NO - done 2894 return ; NO - done
2862 check_cns_violation_1: 2895 check_cns_violation_1:
2863 bsf message_warning ; show warning sign 2896 bsf message_warning ; show warning sign
2864 check_cns_violation_2: 2897 check_cns_violation_2:
2865 bsf message_attention ; show attention sign 2898 bsf message_attention ; show attention sign
2866 movlw index_ppo2_ead_end_cns ; index of custom view ppO2, EAD/END and CNS 2899 IFNDEF _helium
2900 movlw index_ppo2_ead_end_cns ; index of custom view ppO2, EAD/END and CNS (without He) or gas density (with He)
2867 cpfseq active_customview ; CNS shown? 2901 cpfseq active_customview ; CNS shown?
2868 bra check_cns_violation_3 ; NO 2902 bra check_cns_violation_3 ; NO
2869 return ; YES - do not show twice (in custom view and in warning area) 2903 return ; YES - do not show twice (in custom view and in warning area)
2904 ENDIF
2870 check_cns_violation_3: 2905 check_cns_violation_3:
2871 movlw index_CNS ; index of custom view with CNS values 2906 movlw index_CNS ; index of custom view with CNS values
2872 cpfseq active_customview ; CNS shown? 2907 cpfseq active_customview ; CNS shown?
2873 bra check_cns_violation_4 ; NO 2908 bra check_cns_violation_4 ; NO
2874 return ; YES - do not show twice (in custom view and in warning area) 2909 return ; YES - do not show twice (in custom view and in warning area)
2933 btfsc bailout_mode ; YES - in bailout mode? 2968 btfsc bailout_mode ; YES - in bailout mode?
2934 return ; YES - done, return (deco zone flag is not updated when in bailout mode) 2969 return ; YES - done, return (deco zone flag is not updated when in bailout mode)
2935 movff char_O_deco_info,WREG ; NO - get the deco info vector 2970 movff char_O_deco_info,WREG ; NO - get the deco info vector
2936 btfss WREG,deco_zone ; check if the deco zone flag is set 2971 btfss WREG,deco_zone ; check if the deco zone flag is set
2937 return ; NO - done, return 2972 return ; NO - done, return
2938 incf message_counter,F ; YES - increase counter 2973 btfsc use_aGF ; YES - using alternative GF factors?
2939 goto TFT_info_deco ; - show deco info 2974 return ; YES - suppress deco zone info
2975 btfsc alt_layout_active ; NO - in alternative layout?
2976 return ; YES - suppress deco zone info
2977 incf message_counter,F ; NO - increase counter
2978 goto TFT_info_deco ; - show deco info
2940 2979
2941 2980
2942 check_depth_limit: 2981 check_depth_limit:
2943 bcf depth_limit_exceeded ; clear warning flag by default 2982 bcf depth_limit_exceeded ; clear warning flag by default
2944 movff opt_max_depth,WREG ; get depth limit 2983 movff opt_max_depth,WREG ; get depth limit
3044 rcall check_tr_functions_helper6 ; check for transmitter 2 low battery 3083 rcall check_tr_functions_helper6 ; check for transmitter 2 low battery
3045 movff int_IO_pressure_value+3,WREG ; get high byte of 2nd pressure reading 3084 movff int_IO_pressure_value+3,WREG ; get high byte of 2nd pressure reading
3046 rcall check_tr_functions_helper7 ; check for transmitter 2 pressure warning 3085 rcall check_tr_functions_helper7 ; check for transmitter 2 pressure warning
3047 rcall check_tr_functions_helper8 ; check for transmitter 2 pressure attention 3086 rcall check_tr_functions_helper8 ; check for transmitter 2 pressure attention
3048 check_tr_functions_show_xmtr: 3087 check_tr_functions_show_xmtr:
3049 btfss show_transmitter_attention ; shall show transmitter message? 3088 btfss show_transmitter_attention ; shall show transmitter attention message?
3050 bra check_tr_functions_show_warn ; NO - continue with pressure warning 3089 bra check_tr_functions_show_warn ; NO - continue with pressure warning
3051 bsf message_attention ; YES - set flag for attention 3090 bsf message_attention ; YES - set flag for attention
3052 incf message_counter,F ; - increase counter 3091 incf message_counter,F ; - increase counter
3053 call TFT_attention_transmitter ; - show transmitter attention message 3092 call TFT_attention_transmitter ; - show transmitter attention message
3054 check_tr_functions_show_warn: 3093 check_tr_functions_show_warn:
3068 btfsc WREG,char_transmitter_lost ; transmitter 1 lost? 3107 btfsc WREG,char_transmitter_lost ; transmitter 1 lost?
3069 bra check_tr_functions_helper1a ; YES - show transmitter attention message 3108 bra check_tr_functions_helper1a ; YES - show transmitter attention message
3070 bcf transmitter1_lost ; NO - clear flag for old lost attention 3109 bcf transmitter1_lost ; NO - clear flag for old lost attention
3071 return ; - done 3110 return ; - done
3072 check_tr_functions_helper1a: 3111 check_tr_functions_helper1a:
3073 bsf show_transmitter_attention ; show transmitter attention 3112 ; bsf show_transmitter_attention ; show transmitter attention
3074 btfsc transmitter1_lost ; is it a new message? 3113 btfsc transmitter1_lost ; is it a new message?
3075 return ; NO - do not show the pressure readings custom view again 3114 return ; NO - do not show the pressure readings custom view again
3076 bsf transmitter1_lost ; YES - memorize it's an old message now 3115 bsf transmitter1_lost ; YES - memorize it's an old message now
3077 bra check_tr_functions_show_cv ; - show custom view 3116 bra check_tr_functions_show_cv ; - show custom view
3078 3117
3116 btfsc WREG,char_transmitter_lost ; transmitter 2 lost? 3155 btfsc WREG,char_transmitter_lost ; transmitter 2 lost?
3117 bra check_tr_functions_helper5a ; YES - show transmitter attention message 3156 bra check_tr_functions_helper5a ; YES - show transmitter attention message
3118 bcf transmitter2_lost ; NO - clear flag for old lost attention 3157 bcf transmitter2_lost ; NO - clear flag for old lost attention
3119 return ; - done 3158 return ; - done
3120 check_tr_functions_helper5a: 3159 check_tr_functions_helper5a:
3121 bsf show_transmitter_attention ; show transmitter attention 3160 ; bsf show_transmitter_attention ; show transmitter attention
3122 btfsc transmitter2_lost ; is it a new message? 3161 btfsc transmitter2_lost ; is it a new message?
3123 return ; NO - do not show the pressure readings custom view again 3162 return ; NO - do not show the pressure readings custom view again
3124 bsf transmitter2_lost ; YES - memorize it's an old message now 3163 bsf transmitter2_lost ; YES - memorize it's an old message now
3125 bra check_tr_functions_show_cv ; - show custom view 3164 bra check_tr_functions_show_cv ; - show custom view
3126 3165