Mercurial > public > hwos_code
comparison src/start.asm @ 631:185ba2f91f59
3.09 beta 1 release
author | heinrichsweikamp |
---|---|
date | Fri, 28 Feb 2020 15:45:07 +0100 |
parents | 237931377539 |
children | 690c48db7b5b |
comparison
equal
deleted
inserted
replaced
630:4cd81bdbf15c | 631:185ba2f91f59 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File start.asm combined next generation V3.06.1 | 3 ; File start.asm combined next generation V3.08.8 |
4 ; | 4 ; |
5 ; Startup subroutines | 5 ; Startup subroutines |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
26 #include "divemode.inc" | 26 #include "divemode.inc" |
27 #include "rx_ops.inc" | 27 #include "rx_ops.inc" |
28 | 28 |
29 | 29 |
30 extern init_ostc | 30 extern init_ostc |
31 extern option_restore_all | |
32 extern backup_flash_page | 31 extern backup_flash_page |
33 extern restore_decodata_from_eeprom | 32 extern eeprom_deco_data_read |
34 extern oPressureAdjust | 33 extern option_restore_and_check_all |
34 extern option_restore_and_check | |
35 extern option_check_and_store_all | |
36 extern option_check_and_store | |
35 extern option_reset | 37 extern option_reset |
36 extern option_save | 38 extern rtc_init |
37 extern option_save_all | |
38 extern option_check_all | |
39 extern do_new_battery_select | 39 extern do_new_battery_select |
40 extern get_battery_data | 40 extern get_battery_data |
41 extern use_old_prior_209 | 41 extern use_old_prior_209 |
42 extern get_first_gas_to_WREG | 42 extern get_first_gas_to_WREG |
43 | |
44 extern oFirmwareMajor | |
45 extern oFirmwareMinor | |
46 extern oPressureAdjust | |
43 | 47 |
44 IFDEF _ccr_pscr | 48 IFDEF _ccr_pscr |
45 extern option_cleanup_oCCRMode_pSCR | 49 extern option_cleanup_oCCRMode_pSCR |
46 extern option_cleanup_oCCRMode_CCR | 50 extern option_cleanup_oCCRMode_CCR |
47 extern get_first_dil_to_WREG | 51 extern get_first_dil_to_WREG |
92 ; flag that later restart origins from a cold start | 96 ; flag that later restart origins from a cold start |
93 bsf cold_start | 97 bsf cold_start |
94 | 98 |
95 ; initialize averaging for analog buttons | 99 ; initialize averaging for analog buttons |
96 movlw .16 ; set averaging span | 100 movlw .16 ; set averaging span |
97 movff WREG,analog_counter ; write to counter | 101 movff WREG,analog_counter ; write to counter (in bank isr_backup) |
98 | 102 |
99 ; get button type from bootloader info | 103 ; get button type from bootloader info |
100 bsf analog_switches | 104 bsf analog_switches ; assume analog buttons by default |
101 movlw 0x7C | 105 movlw 0x7C ; address bootloader at 0x01F77C |
102 movwf TBLPTRL | 106 movwf TBLPTRL ; ... |
103 movlw 0xF7 | 107 movlw 0xF7 ; ... |
104 movwf TBLPTRH | 108 movwf TBLPTRH ; ... |
105 movlw 0x01 | 109 movlw 0x01 ; ... |
106 movwf TBLPTRU | 110 movwf TBLPTRU ; ... |
107 TBLRD*+ ; read configuration byte | 111 TBLRD*+ ; read configuration byte |
108 movlw 0x07 ; coding for analog buttons | 112 movlw 0x07 ; coding for analog buttons |
109 cpfseq TABLAT ; equal? | 113 cpfseq TABLAT ; equal? |
110 bcf analog_switches ; NO - no analog buttons | 114 bcf analog_switches ; NO - no analog buttons |
111 | 115 |
121 movlw 0x84 ; coding for screen type 3 | 125 movlw 0x84 ; coding for screen type 3 |
122 cpfseq TABLAT ; equal? | 126 cpfseq TABLAT ; equal? |
123 bcf screen_type3 ; NO - not screen type 3 | 127 bcf screen_type3 ; NO - not screen type 3 |
124 | 128 |
125 ; get button polarity from configuration data (EEPROM) | 129 ; get button polarity from configuration data (EEPROM) |
126 movlw LOW .897 | 130 EEPROM_CC_READ eeprom_button_polarity,button_polarity |
127 movwf EEADR | |
128 movlw HIGH .897 | |
129 movwf EEADRH | |
130 call read_eeprom ; EEDATA into EEPROM @ EEADR | |
131 clrf EEADRH ; reset EEADRH | |
132 movff EEDATA,button_polarity ; 0xFF (both normal), 0x00 (both inverted), 0x01 (left inverted only), 0x02 (right inverted only) | |
133 | 131 |
134 ; initialize pressure sensor calibration | 132 ; initialize pressure sensor calibration |
135 call get_calibration_data ; get calibration data from pressure sensor | 133 call get_calibration_data ; get calibration data from pressure sensor |
136 call TFT_DisplayOff ; turn off display | 134 call TFT_DisplayOff ; turn off display |
137 | 135 |
139 bsf LEDr ; turn on red LED | 137 bsf LEDr ; turn on red LED |
140 | 138 |
141 ; first pass, will not have valid temperature yet | 139 ; first pass, will not have valid temperature yet |
142 call wait_1s | 140 call wait_1s |
143 call wait_1s | 141 call wait_1s |
144 ; bcf trigger_pres_update ; make sure ISR pressure update confirmation is not older than from now on | |
145 ; btfss trigger_pres_update ; has the ISR confirmed a pressure update? | |
146 ; bra $-2 ; NO - not yet, loop waiting for the ISR to kick in | |
147 | 142 |
148 ; second pass - complete sensor initialization | 143 ; second pass - complete sensor initialization |
149 call wait_1s | 144 call wait_1s |
150 call wait_1s | 145 call wait_1s |
151 ; bcf trigger_pres_update ; make sure ISR pressure update confirmation is not older than from now on | |
152 ; btfss trigger_pres_update ; has the ISR confirmed a pressure update? | |
153 ; bra $-2 ; NO - not yet, loop waiting for the ISR to kick in | |
154 | 146 |
155 ; sensor calibration completed, first valid pressure value is available | 147 ; sensor calibration completed, first valid pressure value is available |
156 bcf LEDr ; turn off red LED again | 148 bcf LEDr ; turn off red LED again |
157 | 149 |
158 ; load surface pressure into ISR | 150 ; load surface pressure into ISR |
165 btfsc update_surface_pressure ; has the ISR confirmed loading of the surface pressure? | 157 btfsc update_surface_pressure ; has the ISR confirmed loading of the surface pressure? |
166 bra $-2 ; NO - not yet, loop until ISR has confirmed loading | 158 bra $-2 ; NO - not yet, loop until ISR has confirmed loading |
167 | 159 |
168 ; reset all tissue pressures to surface pressure equilibrium state by default | 160 ; reset all tissue pressures to surface pressure equilibrium state by default |
169 call deco_clear_tissue ; (C-code) | 161 call deco_clear_tissue ; (C-code) |
170 banksel common | 162 banksel common ; back to bank common |
171 | 163 |
172 ; restore tissue pressures from EEPROM (if available) | 164 ; restore deco status from EEPROM (if possible) |
173 movlw HIGH .512 ; =2 | 165 EEPROM_CC_READ eeprom_deco_data_validity,WREG ; read deco data validity |
174 movwf EEADRH ; set EEPROM address, high byte | 166 xorlw DECO_DATA_VALID_TOKEN ; deco data valid? |
175 read_int_eeprom .0 ; read tissue storage information flag | 167 bnz start_clean ; NO - start "clean" |
176 clrf EEADRH ; revert EEPROM high address pointer to default | 168 EEPROM_CC_READ eeprom_deco_data_version,WREG ; YES - read deco data format version |
177 movlw 0xAA ; load coding for tissue pressures available | 169 xorlw eeprom_vault_version ; - deco data format compatible? |
178 cpfseq EEDATA ; tissue pressures available? | 170 bnz start_clean ; NO - start "clean" |
179 bra start_1 ; NO - no tissue pressures available | 171 call eeprom_deco_data_read ; YES - restore deco data from EEPROM |
180 call restore_decodata_from_eeprom ; YES - reload tissue pressures from EEPROM | 172 bra start_common ; - continue with common part |
181 | 173 |
182 start_1: | 174 start_clean: |
183 bsf reset_surface_interval ; request ISR to reset the surface interval timer | 175 bsf reset_surface_interval ; request ISR to reset the surface interval timer |
184 | 176 btfss RCON,POR ; was there a power outage ? |
185 ; call rtc_init ; initialize the real time clock (will reset to firmware creation date) | 177 call rtc_init ; YES - initialize RTC to firmware creation date |
186 | 178 |
179 start_common: | |
187 ; check for power-on reset | 180 ; check for power-on reset |
188 btfsc RCON,POR ; was this a power-on reset? | 181 btfsc RCON,POR ; was this a power-on reset? |
189 call use_old_prior_209 ; NO - migrate the last battery status from firmware 2.09 or earlier | 182 call use_old_prior_209 ; NO - migrate the last battery status from firmware 2.09 or earlier |
190 | 183 |
191 bcf use_old_batt_flag ; default to no reload of last battery data | 184 bcf use_old_batt_flag ; default to no reload of last battery data |
207 ; show heinrichsweikamp logo | 200 ; show heinrichsweikamp logo |
208 WIN_TOP .40 | 201 WIN_TOP .40 |
209 WIN_LEFT .10 | 202 WIN_LEFT .10 |
210 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block | 203 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block |
211 | 204 |
212 ; check if a new firmware was loaded, if yes reset option oPressureAdjust | 205 ; check if a new firmware was loaded |
213 movlw d'1' ; set EEPROM address to 0x101 | 206 lfsr FSR0,oFirmwareMajor ; address firmware version |
214 movwf EEADR ; = 0x001 | 207 call option_restore_and_check ; read firmware version, major |
215 movwf EEADRH ; = 0x101 | 208 call option_restore_and_check ; read firmware version, minor |
216 call read_eeprom ; read current version, major | 209 call option_restore_and_check ; read firmware version, beta |
217 movff EEDATA,lo ; store major in lo | 210 |
218 incf EEADR,F ; set EEPROM address to 0x102 | 211 movff opt_fw_version_major,WREG ; get stored major version |
219 call read_eeprom ; read current version, minor | 212 xorlw fw_version_major ; compare with currently active version, equal? |
220 movff EEDATA,hi ; store minor in hi | 213 bnz start_check_new_firmware_new ; NO - a new firmware was loaded |
221 clrf EEADRH ; reset EEADRH | 214 |
222 | 215 movff opt_fw_version_minor,WREG ; get stored minor version |
223 movlw softwareversion_x ; get current major version | 216 xorlw fw_version_minor ; compare with currently active version, equal? |
224 cpfseq lo ; compare with stored version, equal? | 217 bnz start_check_new_firmware_new ; NO - a new firmware was loaded |
225 bra start_check_new_firmware_new ; NO - reset some options and store new version in EEPROM | 218 |
226 | 219 movff opt_fw_version_beta,WREG ; get stored beta version |
227 movlw softwareversion_y ; get current minor version | 220 xorlw fw_version_beta ; compare with currently active version, equal? |
228 cpfseq hi ; compare with stored version, equal? | 221 bnz start_check_new_firmware_new ; NO - a new firmware was loaded |
229 bra start_check_new_firmware_new ; NO - reset some options and store new version in EEPROM | 222 ;bz start_check_new_firmware_old ; YES - same firmware as before |
230 bra start_check_new_firmware_old ; YES - both equal, do not reset options | |
231 | |
232 start_check_new_firmware_new: | |
233 ; new firmware version detected | |
234 call show_fw_mesg_update ; show firmware update message | |
235 | |
236 ; place "after-update reset" here... | |
237 lfsr FSR0,oPressureAdjust ; memory address of option data | |
238 call option_reset ; reset oPressureAdjust to factory default | |
239 lfsr FSR0,oPressureAdjust ; memory address of option data | |
240 call option_save ; save reseted value of oPressureAdjust in EEPROM | |
241 | |
242 ; store current version in EEPROM | |
243 movlw d'1' ; set EEPROM address to 0x101 | |
244 movwf EEADR ; = 0x001 | |
245 movwf EEADRH ; = 0x101 | |
246 movlw softwareversion_x ; get version, major number | |
247 movwf EEDATA ; prepare write | |
248 call write_eeprom ; execute write | |
249 incf EEADR,F ; set EEPROM address to 0x102 | |
250 movlw softwareversion_y ; get version, minor number | |
251 movwf EEDATA ; prepare write | |
252 call write_eeprom ; execute write | |
253 clrf EEADRH ; reset EEADRH | |
254 bra start_check_new_firmware_common ; | |
255 | 223 |
256 start_check_new_firmware_old: | 224 start_check_new_firmware_old: |
257 call show_fw_mesg_kept ; show firmware is kept message | 225 call show_fw_mesg_kept ; show firmware is kept message |
226 bra start_check_new_firmware_common ; continue with common part | |
227 | |
228 start_check_new_firmware_new: | |
229 call show_fw_mesg_update ; show firmware update message | |
230 | |
231 ; reset the pressure sensor correction to factory default | |
232 lfsr FSR0,oPressureAdjust ; address pressure sensor correction | |
233 call option_reset ; set correction to default | |
234 | |
235 lfsr FSR0,oPressureAdjust ; address pressure sensor correction | |
236 call option_check_and_store ; update correction in EEPROM | |
258 | 237 |
259 start_check_new_firmware_common: | 238 start_check_new_firmware_common: |
260 call TFT_Display_FadeIn ; display resulting screen | 239 call TFT_Display_FadeIn ; display resulting screen |
240 | |
261 call backup_flash_page ; back-up the first 128 bytes from program flash memory to EEPROM | 241 call backup_flash_page ; back-up the first 128 bytes from program flash memory to EEPROM |
242 call option_restore_and_check_all ; restore all option values from EEPROM and check them | |
262 | 243 |
263 ; pause 5 seconds | 244 ; pause 5 seconds |
264 movlw .5 ; load loop counter | 245 movlw .5 ; load loop counter |
265 start_check_new_firmware_wait: | 246 start_check_new_firmware_wait: |
266 call wait_1s ; wait <= 1 second | 247 call wait_1s ; wait <= 1 second |
275 ; called on leaving sleep mode, surface menu, communication mode, and | 256 ; called on leaving sleep mode, surface menu, communication mode, and |
276 ; when a start of a dive is detected in all modes except surface mode. | 257 ; when a start of a dive is detected in all modes except surface mode. |
277 ; | 258 ; |
278 global restart | 259 global restart |
279 restart: | 260 restart: |
280 banksel common ; for safety purpose only | 261 ; for safety purpose only |
262 banksel common ; select bank common | |
281 clrf STKPTR ; clear return addresses stack | 263 clrf STKPTR ; clear return addresses stack |
264 call request_speed_normal ; request CPU speed change to normal speed | |
265 | |
266 ; switch off backlight | |
282 clrf CCP1CON ; stop PWM | 267 clrf CCP1CON ; stop PWM |
283 bcf PORTC,2 ; pull PWM out to GND | 268 bcf PORTC,2 ; pull PWM out to GND |
284 | 269 bsf tft_is_dimming ; ignore ambient sensor |
285 call request_speed_normal ; request CPU speed change to normal speed (for safety only) | |
286 | |
287 ; manage the option settings | |
288 btfsc surfmode_menu ; was restart entered by return from surface menu or comm mode? | |
289 call option_save_all ; YES - save all settings into EEPROM | |
290 | |
291 btfss surfmode_menu ; was restart entered by return from surface menu or comm mode? | |
292 call option_restore_all ; NO - load all settings from EEPROM | |
293 | |
294 call option_check_all ; check all options and repair them if not within their min/max boundaries | |
295 | |
296 btfsc option_repaired ; errors found & repaired during options check? | |
297 call option_save_all ; YES - save corrected settings into EEPROM | |
298 | 270 |
299 ; clear flag groups | 271 ; clear flag groups |
300 clrf HW_descriptor ; hardware - OSTC model descriptor | 272 clrf HW_descriptor ; hardware - OSTC model descriptor |
301 clrf HW_flags_state1 ; hardware - states | 273 clrf HW_flags_state1 ; hardware - states |
302 ; ; do not clear HW_flags_state2 ! | 274 ; ; do not clear HW_flags_state2 ! |
303 clrf DM_flags_sensor ; hardware - O2 sensors | 275 clrf DM_flags_sensor ; hardware - O2 sensors |
304 | |
305 clrf OS_flags_ISR1 ; operating system - ISR control 1 | 276 clrf OS_flags_ISR1 ; operating system - ISR control 1 |
306 clrf OS_flags_ISR2 ; operating system - ISR control 2 | 277 clrf OS_flags_ISR2 ; operating system - ISR control 2 |
307 | |
308 clrf eventbase ; event triggers generated by ISR | 278 clrf eventbase ; event triggers generated by ISR |
309 | |
310 clrf DM_flags_deco ; dive deco modes | 279 clrf DM_flags_deco ; dive deco modes |
311 | |
312 clrf MS_flags_control ; menu system - control | 280 clrf MS_flags_control ; menu system - control |
313 clrf MS_flags_imprint ; menu system - data imprinting | 281 clrf MS_flags_imprint ; menu system - data imprinting |
314 | |
315 clrf CVT_flags1 ; convert and display functions | 282 clrf CVT_flags1 ; convert and display functions |
316 clrf CVT_flags2 ; convert and display functions | 283 clrf CVT_flags2 ; convert and display functions |
317 | 284 |
318 ; TFT will be dimming soon, ignore ambient sensor | 285 ; check if option values have changed and thus if the EEPROM needs to be updated |
319 bsf tft_is_dimming | 286 btfsc options_changed ; do the options need to be stored to EEPROM ? |
287 call option_check_and_store_all ; YES - check and store all option values in EEPROM | |
288 bcf options_changed ; clear flag | |
320 | 289 |
321 ; configure the OSTC model descriptor (stored in HW_descriptor) | 290 ; configure the OSTC model descriptor (stored in HW_descriptor) |
322 bcf tft_power ; inverted, here needed for I2C_probe_OSTC_rx, to wake-up RX circuity | 291 bcf tft_power ; inverted, here needed for I2C_probe_OSTC_rx, to wake-up RX circuity |
323 bsf ambient_sensor ; set ambient light sensor as available by default | 292 bsf ambient_sensor ; set ambient light sensor as available by default |
324 bsf optical_input ; set optical input as available by default | 293 bsf optical_input ; set optical input as available by default |
345 bsf lightsen_power ; power-up ambient light sensor again | 314 bsf lightsen_power ; power-up ambient light sensor again |
346 | 315 |
347 restart2: | 316 restart2: |
348 IFNDEF _hwos_sport | 317 IFNDEF _hwos_sport |
349 btfsc vusb_in ; USB power detected? | 318 btfsc vusb_in ; USB power detected? |
350 bra restart3 ; YES | 319 bra restart3 ; YES - no BLE then |
351 bcf PORTE,0 ; start comm | 320 bcf PORTE,0 ; NO - power up BT chip (if available) |
352 WAITMS d'5' ; wait 5 ms | 321 WAITMS d'5' ; - wait 5 ms |
353 btfss vusb_in ; USB power detected? | 322 btfss vusb_in ; - BT chip detected? |
354 bra restart3 ; NO | 323 bra restart3 ; NO - no BLE then |
355 ENDIF | 324 ENDIF |
356 bsf ble_available ; YES - BLE available | 325 bsf ble_available ; YES - BLE available |
357 | 326 |
358 restart3: | 327 restart3: |
359 bsf PORTE,0 ; stop comm | 328 bsf PORTE,0 ; power down BLE chip |
360 btfsc ble_available ; BLE available? | 329 btfsc ble_available ; BLE available? |
361 bra restart4 ; YES - can't be a cR | 330 bra restart4 ; YES - can't be a cR then |
362 btfss battery_gauge_available ; rechargeable? | 331 btfss battery_gauge_available ; NO - rechargeable? |
363 bra restart4 ; NO - can't be a cR | 332 bra restart4 ; NO - can't be a cR |
364 bsf analog_o2_input ; set flag for analog | 333 bsf analog_o2_input ; YES - it's a cR, analog input available |
365 | 334 |
366 restart4: | 335 restart4: |
367 bsf lv_core ; default to low voltage core | 336 bsf lv_core ; default to low voltage core |
368 movlw 0x80 ; point to 0x1F780 | 337 movlw 0x80 ; point to 0x1F780 |
369 movwf TBLPTRL | 338 movwf TBLPTRL ; ... |
370 movlw 0xF7 | 339 movlw 0xF7 ; ... |
371 movwf TBLPTRH | 340 movwf TBLPTRH ; ... |
372 movlw 0x01 | 341 movlw 0x01 ; ... |
373 movwf TBLPTRU | 342 movwf TBLPTRU ; ... |
374 TBLRD*+ ; read from 0x1F780 | 343 TBLRD*+ ; read from 0x1F780 |
375 movlw 0x83 ; coding for low voltage core, part 1 | 344 movlw 0x83 ; coding for low voltage core, part 1 |
376 cpfseq TABLAT ; equal? | 345 cpfseq TABLAT ; equal? |
377 bra restart4a ; NO - no low voltage core then | 346 bra restart4a ; NO - no low voltage core then |
378 movlw 0x81 ; point to 0x1F781 | 347 movlw 0x81 ; YES - point to 0x1F781 |
379 movwf TBLPTRL | 348 movwf TBLPTRL ; - ... |
380 TBLRD*+ ; read from 0x1F781 | 349 TBLRD*+ ; - read from 0x1F781 |
381 movlw 0x94 ; coding for low voltage core, part 2 | 350 movlw 0x94 ; - coding for low voltage core, part 2 |
382 cpfseq TABLAT ; equal? | 351 cpfseq TABLAT ; - equal? |
383 restart4a: | 352 restart4a: |
384 bcf lv_core ; NO - no low voltage core then | 353 bcf lv_core ; NO - no low voltage core then |
385 | 354 |
386 | 355 |
387 IFDEF _rx_functions | 356 IFDEF _rx_functions |
388 | 357 |
389 ; set TR functions as deactivated by default | 358 ; set TR functions as deactivated by default |
409 bra restart4e ; YES - no need to update | 378 bra restart4e ; YES - no need to update |
410 | 379 |
411 restart4b: | 380 restart4b: |
412 ; print TR module update message | 381 ; print TR module update message |
413 call TFT_boot ; initialize TFT (includes clear screen & backlight switch-off) | 382 call TFT_boot ; initialize TFT (includes clear screen & backlight switch-off) |
414 WIN_TOP .40 ; show heinrichsweikamp logo | 383 WIN_TOP .40 ; set position |
415 WIN_LEFT .10 | 384 WIN_LEFT .10 ; ... |
416 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block | 385 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block ; show heinrichsweikamp logo |
417 WIN_SMALL .10,.130 | 386 WIN_SMALL .10,.130 ; set position |
418 STRCAT_PRINT "Updating TR Module..." ; print update message | 387 STRCAT_PRINT "Updating TR Module..." ; print update message |
419 call TFT_Display_FadeIn ; display screen | 388 call TFT_Display_FadeIn ; dimm up backlight to show outputs |
420 WIN_SMALL .10,.160 | |
421 STRCAT "TR Update " ; prepare result message | |
422 | 389 |
423 ; update firmware in RX module | 390 ; update firmware in RX module |
424 call I2C_sleep_compass ; stop compass | 391 call I2C_sleep_compass ; stop compass |
425 call update_tr_module ; update TR module | 392 call update_tr_module ; update TR module |
426 | 393 |
503 ; | 470 ; |
504 ; called from divemode.asm, menu_tree.asm and surfmode.asm | 471 ; called from divemode.asm, menu_tree.asm and surfmode.asm |
505 ; | 472 ; |
506 global restart_set_modes_and_flags | 473 global restart_set_modes_and_flags |
507 restart_set_modes_and_flags: | 474 restart_set_modes_and_flags: |
508 call option_restore_all ; restore all options settings from EEPROM | |
509 call disable_ir_s8 ; switch off IR/S8 digital interface by default (for all compile versions!) | 475 call disable_ir_s8 ; switch off IR/S8 digital interface by default (for all compile versions!) |
510 | 476 |
511 IFDEF _external_sensor | 477 IFDEF _external_sensor |
512 WAITMS d'100' ; some delay to power down S8-HUD properly | 478 WAITMS d'100' ; some delay to power down S8-HUD properly |
513 ENDIF | 479 ENDIF |
533 ENDIF | 499 ENDIF |
534 | 500 |
535 ; configure saturation / desaturation safety factors | 501 ; configure saturation / desaturation safety factors |
536 movff opt_sat_multiplier_gf, char_I_saturation_multiplier ; use factors for GF mode by default | 502 movff opt_sat_multiplier_gf, char_I_saturation_multiplier ; use factors for GF mode by default |
537 movff opt_desat_multiplier_gf,char_I_desaturation_multiplier ; ... | 503 movff opt_desat_multiplier_gf,char_I_desaturation_multiplier ; ... |
538 TSTOSC char_I_deco_model ; get deco model ZH-L16-GF (1) selected? | 504 TSTOSC char_I_model ; get deco model ZH-L16-GF (1) selected? |
539 bra restart_set_modes_and_flags2 ; YES - keep them | 505 bra restart_set_modes_and_flags2 ; YES - keep them |
540 movff opt_sat_multiplier_non_gf, char_I_saturation_multiplier ; NO - overwrite them with non-GF factors | 506 movff opt_sat_multiplier_non_gf, char_I_saturation_multiplier ; NO - overwrite them with non-GF factors |
541 movff opt_desat_multiplier_non_gf,char_I_desaturation_multiplier ; - ... | 507 movff opt_desat_multiplier_non_gf,char_I_desaturation_multiplier ; - ... |
542 | 508 |
543 restart_set_modes_and_flags2: | 509 restart_set_modes_and_flags2: |
580 | 546 |
581 restart_set_modes_and_flags5: | 547 restart_set_modes_and_flags5: |
582 decfsz lo,F ; Apnea mode? | 548 decfsz lo,F ; Apnea mode? |
583 bra restart_set_modes_and_flags6 ; NO | 549 bra restart_set_modes_and_flags6 ; NO |
584 bsf FLAG_apnoe_mode ; YES - set apnea flag | 550 bsf FLAG_apnoe_mode ; YES - set apnea flag |
585 movlw samplingrate_apnoe ; get apnoe sampling rate | 551 movlw samplingrate_apnoe ; - get apnoe sampling rate |
586 movwf sampling_rate ; overwrite user-selected 2/10 seconds setting with apnoe default | 552 movwf sampling_rate ; - overwrite user-selected 2/10 seconds setting with apnoe default |
587 IFDEF _rx_functions | 553 IFDEF _rx_functions |
588 call option_cleanup_oTrMode_no_CCR ; - revert TR mode from 'CCR Dil+O2' to 'on' | 554 call option_cleanup_oTrMode_no_CCR ; - revert TR mode from 'CCR Dil+O2' to 'on' |
589 ENDIF | 555 ENDIF |
590 return ; - done | 556 return ; - done |
591 | 557 |