comparison src/divemode.asm @ 386:3c55627d5f8f

some cleanups, jump to 1.90 stable
author heinrichsweikamp
date Wed, 07 Oct 2015 14:46:39 +0200
parents b075fa71b659
children 9175429bdeba
comparison
equal deleted inserted replaced
385:b075fa71b659 386:3c55627d5f8f
1041 addwfc average_divesecs+1,F ; Add 5*60 seconds 1041 addwfc average_divesecs+1,F ; Add 5*60 seconds
1042 movlw LOW (.5*.60) 1042 movlw LOW (.5*.60)
1043 addwf total_divetime_seconds+0,F 1043 addwf total_divetime_seconds+0,F
1044 movlw HIGH (.5*.60) 1044 movlw HIGH (.5*.60)
1045 addwfc total_divetime_seconds+1,F ; Add 5*60 seconds 1045 addwfc total_divetime_seconds+1,F ; Add 5*60 seconds
1046 ; 1. Add 300xdepth to the Sum of depths registers
1047 SAFE_2BYTE_COPY rel_pressure, xB ; Buffer...
1048 movlw LOW (.5*.60)
1049 movwf xA+0
1050 movlw HIGH (.5*.60)
1051 movwf xA+1
1052 call mult16x16 ;xA*xB=xC
1053
1054 movf xC+0,w
1055 addwf average_depth_hold+0,F
1056 movf xC+1,w
1057 addwfc average_depth_hold+1,F
1058 movf xC+2,w
1059 addwfc average_depth_hold+2,F
1060 movf xC+3,w
1061 addwfc average_depth_hold+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
1062
1063 ; Do the same for the _total registers (Non-Resettable)
1064 movf xC+0,w
1065 addwf average_depth_hold_total+0,F
1066 movf xC+1,w
1067 addwfc average_depth_hold_total+1,F
1068 movf xC+2,w
1069 addwfc average_depth_hold_total+2,F
1070 movf xC+3,w
1071 addwfc average_depth_hold_total+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
1072
1046 movlw .5 1073 movlw .5
1047 movwf up ; counter 1074 movwf up ; counter
1048 ; 1min mode 1075 ; 1min mode
1049 divemode_option6_2: 1076 divemode_option6_2:
1050 movlw .1 1077 movlw .1
1416 bcf use_agf ; Start with normal GF set 1443 bcf use_agf ; Start with normal GF set
1417 bcf divemode_menu ; clear divemode menu flag 1444 bcf divemode_menu ; clear divemode menu flag
1418 movlw d'1' 1445 movlw d'1'
1419 movwf apnoe_max_pressure+0 1446 movwf apnoe_max_pressure+0
1420 clrf apnoe_max_pressure+1 1447 clrf apnoe_max_pressure+1
1421 clrf apnoe_surface_mins 1448 ; clrf apnoe_surface_mins
1422 clrf apnoe_surface_secs 1449 ; clrf apnoe_surface_secs
1423 clrf apnoe_mins 1450 clrf apnoe_mins
1424 clrf divemins+0 1451 clrf divemins+0
1425 clrf divemins+1 1452 clrf divemins+1
1426 bcf no_more_divesecs ; =1: Do no longer show seconds in divemode 1453 bcf no_more_divesecs ; =1: Do no longer show seconds in divemode
1427 bcf divemode_menu_active 1454 bcf divemode_menu_active
1602 1629
1603 check_divetimeout: 1630 check_divetimeout:
1604 btfsc divemode2 1631 btfsc divemode2
1605 return ; displayed divetime is not running 1632 return ; displayed divetime is not running
1606 incf warning_counter,F ; increase counter 1633 incf warning_counter,F ; increase counter
1607 call TFT_divetimeout ; Show timeout counter 1634 goto TFT_divetimeout ; Show timeout counter (and return)
1608 return
1609 1635
1610 1636
1611 check_ppO2: ; check current ppO2 and display warning if required 1637 check_ppO2: ; check current ppO2 and display warning if required
1612 SAFE_2BYTE_COPY amb_pressure, xA 1638 SAFE_2BYTE_COPY amb_pressure, xA
1613 movlw d'10' 1639 movlw d'10'
1690 cpfseq menupos3 ; ppO2 shown in Custom View? 1716 cpfseq menupos3 ; ppO2 shown in Custom View?
1691 bra check_ppO2_a ; No 1717 bra check_ppO2_a ; No
1692 return ; Yes, do not show twice (in custom view and in warning area) 1718 return ; Yes, do not show twice (in custom view and in warning area)
1693 check_ppO2_a: 1719 check_ppO2_a:
1694 incf warning_counter,F ; increase counter 1720 incf warning_counter,F ; increase counter
1695 call TFT_display_ppo2 ; Show ppO2 1721 goto TFT_display_ppo2 ; Show ppO2 (and return)
1696 return
1697
1698 1722
1699 global check_cns_violation 1723 global check_cns_violation
1700 check_cns_violation: 1724 check_cns_violation:
1701 ; Check if CNS should be displayed 1725 ; Check if CNS should be displayed
1702 movff int_O_CNS_fraction+1,lo ; copy into bank1 1726 movff int_O_CNS_fraction+1,lo ; copy into bank1
1713 subwf lo,W 1737 subwf lo,W
1714 btfss STATUS,C 1738 btfss STATUS,C
1715 return ; No Display, no warning 1739 return ; No Display, no warning
1716 ; Display CNS 1740 ; Display CNS
1717 incf warning_counter,F ; increase counter 1741 incf warning_counter,F ; increase counter
1718 call TFT_display_cns ; Show CNS 1742 goto TFT_display_cns ; Show CNS (and return)
1719 return
1720 1743
1721 check_cns_violation2: 1744 check_cns_violation2:
1722 incf warning_counter,F ; increase counter 1745 incf warning_counter,F ; increase counter
1723 call TFT_display_cns ; Show CNS 1746 bsf warning_active ; Set Warning flag
1724 bsf warning_active ; Set Warning flag 1747 goto TFT_display_cns ; Show CNS (and return)
1725 return
1726 1748
1727 global check_and_store_gf_violation 1749 global check_and_store_gf_violation
1728 check_and_store_gf_violation: 1750 check_and_store_gf_violation:
1729 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) 1751 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model)
1730 movff char_I_deco_model,hi 1752 movff char_I_deco_model,hi
1742 movlw gf_display_high 1764 movlw gf_display_high
1743 cpfsgt lo 1765 cpfsgt lo
1744 return ; No Display, no warning 1766 return ; No Display, no warning
1745 ; Display GF 1767 ; Display GF
1746 incf warning_counter,F ; increase counter 1768 incf warning_counter,F ; increase counter
1747 call TFT_warning_gf ; Show GF Warning 1769 goto TFT_warning_gf ; Show GF Warning (and return)
1748 return
1749 1770
1750 warn_agf: 1771 warn_agf:
1751 incf warning_counter,F ; increase counter 1772 incf warning_counter,F ; increase counter
1752 call TFT_warning_agf ; Show aGF warning 1773 goto TFT_warning_agf ; Show aGF warning (and return)
1753 return
1754 1774
1755 warn_fallback: 1775 warn_fallback:
1756 incf warning_counter,F ; increase counter 1776 incf warning_counter,F ; increase counter
1757 call TFT_warning_fallback ; Show fallback warning
1758 bsf warning_active ; Set Warning flag 1777 bsf warning_active ; Set Warning flag
1759 return 1778 goto TFT_warning_fallback ; Show fallback warning (and return)
1760 1779
1761 1780
1762 END 1781 END