Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 818:3d9f56e0d18c
more auto-sp work
author | heinrichsweikamp |
---|---|
date | Sat, 06 Jun 2015 19:17:04 +0200 |
parents | df8cd5ffd993 |
children | 95c08c0cfc29 |
comparison
equal
deleted
inserted
replaced
817:e49a35ab7394 | 818:3d9f56e0d18c |
---|---|
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 DISP_const_ppO2_value ; display const ppO2 setting in [bar] | 134 call DISP_const_ppO2_value ; display const ppO2 setting in [bar] |
134 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) |
135 btfsc is_bailout ; Are we in Bailout mode? | 136 btfsc is_bailout ; Are we in Bailout mode? |
136 call check_ppO2_bail ; Yes, display ppO2 (If required) | 137 call check_ppO2_bail ; Yes, display ppO2 (If required) |
137 | 138 |
2027 clrf average_divesecs+1 | 2028 clrf average_divesecs+1 |
2028 bcf reset_average_depth ; Clear flag | 2029 bcf reset_average_depth ; Clear flag |
2029 return | 2030 return |
2030 | 2031 |
2031 ;============================================================================= | 2032 ;============================================================================= |
2033 ; Check for Auto-SP | |
2034 ; | |
2035 dive_check_autosp: ; Check for Auto-SP | |
2036 read_int_eeprom .116 | |
2037 tstfsz EEDATA ; =0: Manual | |
2038 bra dive_check_autosp2 | |
2039 return | |
2040 dive_check_autosp2: | |
2041 ; Check for auto sp | |
2042 return | |
2043 | |
2044 ;============================================================================= | |
2032 ; Setup everything to enter divemode. | 2045 ; Setup everything to enter divemode. |
2033 ; | 2046 ; |
2034 diveloop_boot: | 2047 diveloop_boot: |
2035 ostc_debug 'Q' ; Sends debug-information to screen if debugmode active | 2048 ostc_debug 'Q' ; Sends debug-information to screen if debugmode active |
2036 clrf max_pressure+0 ; clear some variables | 2049 clrf max_pressure+0 ; clear some variables |
2083 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 2096 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
2084 bcf tts_extra_time ;=1: Compute TTS if extra time spent at current depth | 2097 bcf tts_extra_time ;=1: Compute TTS if extra time spent at current depth |
2085 bcf show_safety_stop ;=1: Show the safety stop | 2098 bcf show_safety_stop ;=1: Show the safety stop |
2086 clrf safety_stop_countdown ; Clear count-down | 2099 clrf safety_stop_countdown ; Clear count-down |
2087 bcf gaschange_cnt_active ; Do not show the countdown on start | 2100 bcf gaschange_cnt_active ; Do not show the countdown on start |
2101 ; clear auto-SP flags | |
2102 bcf sp1_switched | |
2103 bcf sp2_switched | |
2104 bcf sp3_switched | |
2088 | 2105 |
2089 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! | 2106 call get_free_EEPROM_location ; get last position in external EEPROM, may be up to 2 secs! |
2090 | 2107 |
2091 btfsc simulatormode_active | 2108 btfsc simulatormode_active |
2092 bra diveloop_boot_1 | 2109 bra diveloop_boot_1 |
2128 ; Overwrite some parameters in Apnoe mode.... | 2145 ; Overwrite some parameters in Apnoe mode.... |
2129 movlw d'1' | 2146 movlw d'1' |
2130 movwf samplesecs_value ; to avoid EEPROM access in the ISR | 2147 movwf samplesecs_value ; to avoid EEPROM access in the ISR |
2131 | 2148 |
2132 divemode1: | 2149 divemode1: |
2133 read_int_eeprom d'36' ; Read mix 1 ppO2 | 2150 read_int_eeprom d'36' ; Read SP 1 |
2134 btfsc FLAG_const_ppO2_mode | 2151 btfsc FLAG_const_ppO2_mode |
2135 movff EEDATA,char_I_const_ppO2 ; Set ppO2 setpoint if in ppO2 mode | 2152 movff EEDATA,char_I_const_ppO2 ; Set ppO2 setpoint if in ppO2 mode |
2136 movff EEDATA,ppO2_setpoint_store ; Store also in this byte... | 2153 movff EEDATA,ppO2_setpoint_store ; Store also in this byte... |
2154 bsf sp1_switched ; Set flag so we won't auto-switch to it again | |
2137 | 2155 |
2138 bcf LED_blue | 2156 bcf LED_blue |
2139 bcf low_battery_state ; clear flag for battery warning mode | 2157 bcf low_battery_state ; clear flag for battery warning mode |
2140 bcf header_stored | 2158 bcf header_stored |
2141 bcf premenu | 2159 bcf premenu |
2173 movff WREG, char_I_N2_ratio ; = N2! | 2191 movff WREG, char_I_N2_ratio ; = N2! |
2174 | 2192 |
2175 ; Configure gaslist_active flag register | 2193 ; Configure gaslist_active flag register |
2176 read_int_eeprom d'27' | 2194 read_int_eeprom d'27' |
2177 movff EEDATA, gaslist_active | 2195 movff EEDATA, gaslist_active |
2178 return | 2196 return ; Done with "boot" |
2179 | 2197 |
2180 set_first_gas_ccr: ; Set Diluent | 2198 set_first_gas_ccr: ; Set Diluent |
2181 call get_first_diluent ; Read first diluent into lo(O2) and hi(He) | 2199 call get_first_diluent ; Read first diluent into lo(O2) and hi(He) |
2182 movff hi,char_I_He_ratio ; And copy into hold register | 2200 movff hi,char_I_He_ratio ; And copy into hold register |
2183 movff lo, char_I_O2_ratio ; O2 ratio | 2201 movff lo, char_I_O2_ratio ; O2 ratio |
2188 bsf STATUS,C ; Borrow bit | 2206 bsf STATUS,C ; Borrow bit |
2189 subfwb lo,W ; minus O2 | 2207 subfwb lo,W ; minus O2 |
2190 movff WREG, char_I_N2_ratio ; = N2! | 2208 movff WREG, char_I_N2_ratio ; = N2! |
2191 read_int_eeprom d'115' ; Read First Diluent (1-5) | 2209 read_int_eeprom d'115' ; Read First Diluent (1-5) |
2192 movff EEDATA,active_diluent | 2210 movff EEDATA,active_diluent |
2193 return | 2211 return ; Done with "boot" |