comparison src/divemode.asm @ 650:bc214815deb2

3.19/10.75 release
author heinrichsweikamp
date Sun, 28 Aug 2022 13:13:38 +0200
parents ef2ed7e3a895
children 75e90cd0c2c3
comparison
equal deleted inserted replaced
649:ef2ed7e3a895 650:bc214815deb2
1915 ; Check if Dive Mode needs to be started (called from Surface Mode) 1915 ; Check if Dive Mode needs to be started (called from Surface Mode)
1916 ; 1916 ;
1917 global check_dive_modes_surf 1917 global check_dive_modes_surf
1918 check_dive_modes_surf: 1918 check_dive_modes_surf:
1919 SMOVII pressure_rel_cur,sub_a ; ISR-safe 2 byte copy of current relative pressure to sub_a 1919 SMOVII pressure_rel_cur,sub_a ; ISR-safe 2 byte copy of current relative pressure to sub_a
1920 bcf divetime_longer_1min ; not diving when in surface mode 1920 bcf divetime_longer_1min ; not diving when in surface mode
1921 bra check_dive_modes ; continue with common part 1921 btfsc cc_active ; charging constant current?
1922 bra check_dive_modes_shallow ; YES - abort (And reset debounce counter)
1923 btfsc cv_active ; NO - charging constant voltage?
1924 bra check_dive_modes_shallow ; YES - abort (And reset debounce counter)
1925 bra check_dive_modes ; continue with common part
1922 1926
1923 1927
1924 ;----------------------------------------------------------------------------- 1928 ;-----------------------------------------------------------------------------
1925 ; Check if Dive Mode needs to be finished (called from Dive Loop) 1929 ; Check if Dive Mode needs to be finished (called from Dive Loop)
1926 ; 1930 ;
1961 1965
1962 check_dive_modes_norm_end: 1966 check_dive_modes_norm_end:
1963 MOVLI dive_threshold_norm_alt_end,sub_b ; load normal altitude end threshold 1967 MOVLI dive_threshold_norm_alt_end,sub_b ; load normal altitude end threshold
1964 bra check_dive_modes_comm ; continue with common part 1968 bra check_dive_modes_comm ; continue with common part
1965 1969
1966 check_dive_modes_norm_start 1970 check_dive_modes_norm_start:
1967 MOVLI dive_threshold_norm_alt_start,sub_b ; load normal altitude start threshold 1971 MOVLI dive_threshold_norm_alt_start,sub_b ; load normal altitude start threshold
1968 ;bra check_dive_modes_comm ; continue with common part 1972 ;bra check_dive_modes_comm ; continue with common part
1969 1973
1970 check_dive_modes_comm: 1974 check_dive_modes_comm:
1971 call cmpU16 ; sub_a - sub_b = pressure_rel_cur - start-dive threshold 1975 call cmpU16 ; sub_a - sub_b = pressure_rel_cur - start-dive threshold
3826 return ; NO - done 3830 return ; NO - done
3827 IFDEF _ccr_pscr 3831 IFDEF _ccr_pscr
3828 btfsc bailout_mode ; YES - in bailout mode? 3832 btfsc bailout_mode ; YES - in bailout mode?
3829 return ; YES - done (deco zone flag is not updated when in bailout mode) 3833 return ; YES - done (deco zone flag is not updated when in bailout mode)
3830 ENDIF 3834 ENDIF
3835 TSTOSS opt_warning_level_divemode ; Warning level set to =1 "All" ?
3836 return ; NO, skip warning/advise then
3831 movff char_O_deco_info,WREG ; NO - get the deco info vector 3837 movff char_O_deco_info,WREG ; NO - get the deco info vector
3832 btfss WREG,deco_zone ; deco zone flag set? 3838 btfss WREG,deco_zone ; deco zone flag set?
3833 return ; NO - done 3839 return ; NO - done
3834 btfsc use_aGF ; YES - using alternative GF factors? 3840 btfsc use_aGF ; YES - using alternative GF factors?
3835 return ; YES - suppress deco zone info 3841 return ; YES - suppress deco zone info
3857 bcf warn_det_depth_limit ; clear warning by default 3863 bcf warn_det_depth_limit ; clear warning by default
3858 movff opt_max_depth,WREG ; get depth limit 3864 movff opt_max_depth,WREG ; get depth limit
3859 cpfsgt depth_meter ; current depth > depth limit? 3865 cpfsgt depth_meter ; current depth > depth limit?
3860 return ; NO - done 3866 return ; NO - done
3861 bsf warn_det_depth_limit ; YES - set warning 3867 bsf warn_det_depth_limit ; YES - set warning
3868 TSTOSS opt_warning_level_divemode ; Warning level set to =1 "All" ?
3869 return ; NO, skip warning/advise then
3862 incf message_counter,F ; - increase message counter 3870 incf message_counter,F ; - increase message counter
3863 goto TFT_message_depth_limit ; - show message 3871 goto TFT_message_depth_limit ; - show message
3864 3872
3865 3873
3866 ;----------------------------------------------------------------------------- 3874 ;-----------------------------------------------------------------------------
3867 ; Check Bühlmann Model Violation 3875 ; Check Bühlmann Model Violation
3868 ; 3876 ;
3869 check_outside: 3877 check_outside:
3870 bcf warn_det_outside ; clear warning 3878 bcf warn_det_outside ; clear warning
3871 bcf attn_det_outside ; clear attention 3879 bcf attn_det_outside ; clear attention
3872 movff char_O_deco_warnings,WREG ; bank-safe copy of deco warnings 3880 movff char_O_deco_warnings,WREG ; bank-safe copy of deco warnings
3897 btfss WREG,mbubble_warning ; currently in micro bubbling zone? 3905 btfss WREG,mbubble_warning ; currently in micro bubbling zone?
3898 bra check_mbubbles_1 ; NO 3906 bra check_mbubbles_1 ; NO
3899 bsf warn_det_microbubble ; YES - set warning 3907 bsf warn_det_microbubble ; YES - set warning
3900 bra check_mbubbles_mesg ; - show message 3908 bra check_mbubbles_mesg ; - show message
3901 3909
3902 check_mbubbles_1 3910 check_mbubbles_1:
3903 btfss WREG,mbubble_warning_lock ; had been in micro bubbling zone? 3911 btfss WREG,mbubble_warning_lock ; had been in micro bubbling zone?
3904 return ; NO - done 3912 return ; NO - done
3905 bsf attn_det_microbubble ; YES - set attention 3913 bsf attn_det_microbubble ; YES - set attention
3906 ;bra check_mbubbles_mesg ; - show message 3914 ;bra check_mbubbles_mesg ; - show message
3907 3915
4038 btfsc better_gas_available ; is a better gas available? 4046 btfsc better_gas_available ; is a better gas available?
4039 bra check_gas_change_mesg ; YES - show a gas change advice 4047 bra check_gas_change_mesg ; YES - show a gas change advice
4040 return ; NO - done 4048 return ; NO - done
4041 4049
4042 check_gas_change_mesg: 4050 check_gas_change_mesg:
4051 TSTOSS opt_warning_level_divemode ; Warning level set to =1 "All" ?
4052 return ; NO, skip warning/advise then
4043 bsf advc_det_change_gas ; set advice 4053 bsf advc_det_change_gas ; set advice
4044 incf message_counter,F ; increase message counter 4054 incf message_counter,F ; increase message counter
4045 goto TFT_message_gas_change ; show advice and return 4055 goto TFT_message_gas_change ; show advice and return
4046 4056
4047 4057