comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 819:95c08c0cfc29

3.04 beta release
author heinrichsweikamp
date Sun, 07 Jun 2015 11:18:28 +0200
parents 3d9f56e0d18c
children 2151c4135fad
comparison
equal deleted inserted replaced
818:3d9f56e0d18c 819:95c08c0cfc29
128 128
129 ; Tasks only for ppO2 mode 129 ; Tasks only for ppO2 mode
130 diveloop_loop1c: 130 diveloop_loop1c:
131 btfsc show_safety_stop ; Show the safety stop? 131 btfsc show_safety_stop ; Show the safety stop?
132 call DISP_show_safety_stop ; Yes, show/delete if done. 132 call DISP_show_safety_stop ; Yes, show/delete if done.
133 call dive_check_autosp ; Check for Auto-SP 133 call check_dive_autosp ; Check for Auto-SP
134 call DISP_const_ppO2_value ; display const ppO2 setting in [bar] 134 call DISP_const_ppO2_value ; display const ppO2 setting in [bar]
135 call calc_deko_divemode ; calculate decompression and display result (any two seconds) 135 call calc_deko_divemode ; calculate decompression and display result (any two seconds)
136 btfsc is_bailout ; Are we in Bailout mode? 136 btfsc is_bailout ; Are we in Bailout mode?
137 call check_ppO2_bail ; Yes, display ppO2 (If required) 137 call check_ppO2_bail ; Yes, display ppO2 (If required)
138 138
2030 return 2030 return
2031 2031
2032 ;============================================================================= 2032 ;=============================================================================
2033 ; Check for Auto-SP 2033 ; Check for Auto-SP
2034 ; 2034 ;
2035 dive_check_autosp: ; Check for Auto-SP 2035 check_dive_autosp: ; Check for Auto-SP
2036 read_int_eeprom .116 2036 read_int_eeprom .116
2037 tstfsz EEDATA ; =0: Manual 2037 tstfsz EEDATA ; =0: Manual
2038 bra dive_check_autosp2 2038 bra check_dive_autosp2
2039 return 2039 return ; Skip check
2040 dive_check_autosp2: 2040 check_dive_autosp2:
2041 ; Check for auto sp 2041 SAFE_2BYTE_COPY rel_pressure,xA
2042 return 2042 movlw d'100'
2043 movwf xB+0
2044 clrf xB+1
2045 call div16x16 ; compute depth in full m -> result in xC+0
2046 ; Check SP1
2047 btfsc sp1_switched ;=1: This setpoint has been autoselected already
2048 bra check_dive_autosp3 ; Skip check
2049 read_int_eeprom .117 ; Get depth in m
2050 tstfsz EEDATA ; =?
2051 bra $+4 ; No, continue
2052 bra check_dive_autosp3 ; Skip check
2053 decf EEDATA,W ; -1 -> WREG
2054 cpfsgt xC+0 ; Compare with depth
2055 bra check_dive_autosp3 ; lower depth, do not switch
2056 ; auto switch to SP1
2057 read_int_eeprom .36 ; Get Setpoint
2058 movff EEDATA, char_I_const_ppO2 ; Use SetPoint
2059 movff EEDATA, ppO2_setpoint_store ; Store also in this byte...
2060 bsf setpoint_changed
2061 bsf event_occured ; set global event flag
2062 bsf sp1_switched ; Set flag
2063 check_dive_autosp3:
2064 ; Check SP2
2065 btfsc sp2_switched ;=1: This setpoint has been autoselected already
2066 bra check_dive_autosp4 ; Skip check
2067 read_int_eeprom .118 ; Get depth in m
2068 tstfsz EEDATA ; =?
2069 bra $+4 ; No, continue
2070 bra check_dive_autosp4 ; Skip check
2071 decf EEDATA,W ; -1 -> WREG
2072 cpfsgt xC+0 ; Compare with depth
2073 bra check_dive_autosp4 ; lower depth, do not switch
2074 ; auto switch to SP2
2075 read_int_eeprom .37 ; Get Setpoint
2076 movff EEDATA, char_I_const_ppO2 ; Use SetPoint
2077 movff EEDATA, ppO2_setpoint_store ; Store also in this byte...
2078 bsf setpoint_changed
2079 bsf event_occured ; set global event flag
2080 bsf sp2_switched ; Set flag
2081 check_dive_autosp4:
2082 ; Check SP3
2083 btfsc sp3_switched ;=1: This setpoint has been autoselected already
2084 bra check_dive_autosp5 ; Skip check
2085 read_int_eeprom .119 ; Get depth in m
2086 tstfsz EEDATA ; =?
2087 bra $+4 ; No, continue
2088 bra check_dive_autosp5 ; Skip check
2089 decf EEDATA,W ; -1 -> WREG
2090 cpfsgt xC+0 ; Compare with depth
2091 bra check_dive_autosp5 ; lower depth, do not switch
2092 ; auto switch to SP3
2093 read_int_eeprom .38 ; Get Setpoint
2094 movff EEDATA, char_I_const_ppO2 ; Use SetPoint
2095 movff EEDATA, ppO2_setpoint_store ; Store also in this byte...
2096 bsf setpoint_changed
2097 bsf event_occured ; set global event flag
2098 bsf sp3_switched ; Set flag
2099 check_dive_autosp5:
2100 return ; Done.
2043 2101
2044 ;============================================================================= 2102 ;=============================================================================
2045 ; Setup everything to enter divemode. 2103 ; Setup everything to enter divemode.
2046 ; 2104 ;
2047 diveloop_boot: 2105 diveloop_boot: