Mercurial > public > hwos_code
annotate src/surfmode.asm @ 563:f4faff954816
minor
author | heinrichsweikamp |
---|---|
date | Sat, 03 Feb 2018 17:02:23 +0100 |
parents | b7eb98dbd800 |
children | 54346c651b6a |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
560 | 3 ; File surfmode.asm REFACTORED VERSION V2.94 |
0 | 4 ; |
5 ; Surfacemode | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-07 : [mH] moving from OSTC code | |
11 | |
560 | 12 #include "hwos.inc" ; Mandatory header |
505
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
14 #include "start.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
15 #include "tft.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
16 #include "tft_outputs.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
17 #include "isr.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
18 #include "adc_lightsensor.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
19 #include "menu_processor.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
20 #include "strings.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
21 #include "sleepmode.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
22 #include "wait.inc" ; speed_* |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
23 #include "external_flash.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
24 #include "customview.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
25 #include "divemode.inc" |
0 | 26 #include "mcp.inc" ; RX |
27 #include "i2c.inc" | |
28 #include "comm.inc" | |
29 #include "eeprom_rs232.inc" | |
113 | 30 #include "calibrate.inc" |
0 | 31 |
213 | 32 extern do_main_menu |
33 | |
0 | 34 #DEFINE menu_pos_row .215 |
213 | 35 #DEFINE menu_pos_column .1 |
0 | 36 #DEFINE view_row .215 |
37 #DEFINE view_column .124 | |
38 | |
39 gui CODE | |
40 | |
41 | |
42 ;============================================================================= | |
43 ; Boot tasks for all modes | |
44 global surfloop | |
45 surfloop: | |
560 | 46 call speed_normal |
0 | 47 bcf no_sensor_int ; Normal pressure mode |
48 | |
245 | 49 bcf LEDr |
50 | |
560 | 51 clrf CCP1CON ; stop PWM |
52 bcf PORTC,2 ; Pull PWM output to GND | |
53 call TFT_boot ; Initialize TFT (includes clear screen) | |
54 bcf restore_deco_data | |
0 | 55 |
56 WIN_TOP .50 | |
57 WIN_LEFT .10 | |
58 movlw LOW 0x1E000 | |
59 movwf TBLPTRL | |
60 movlw HIGH 0x1E000 | |
61 movwf TBLPTRH | |
62 movlw UPPER 0x1E000 | |
63 movwf TBLPTRU | |
64 extern color_image | |
65 call color_image ; Show logo | |
66 | |
67 WIN_TOP .100 | |
68 WIN_LEFT .34 | |
275 | 69 extern ostc_logo_block |
70 movlw LOW(ostc_logo_block) | |
0 | 71 movwf TBLPTRL |
275 | 72 movlw HIGH ostc_logo_block;&0xFFFF |
0 | 73 movwf TBLPTRH |
275 | 74 movlw UPPER(ostc_logo_block) |
0 | 75 movwf TBLPTRU |
76 call color_image | |
77 call TFT_Display_FadeIn ; Show splash | |
78 call TFT_serial ; Show serial and firmware version | |
79 | |
80 ;---- Do any usefull initializes that takes time ------------------------- | |
81 call restart_set_modes_and_flags ; Sets decomode flags | |
82 bcf pressure_refresh | |
83 call I2C_init_compass | |
84 call I2C_init_accelerometer | |
85 clrf ext_flash_address+0 | |
86 clrf ext_flash_address+1 | |
87 clrf ext_flash_address+2 | |
88 | |
354 | 89 movlw surface_sp ; in cbar |
90 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics | |
221
90923a081ae7
minor: configure buttons during splash screen
heinrichsweikamp
parents:
213
diff
changeset
|
91 |
0 | 92 clrf timeout_counter2 |
93 clrf timeout_counter3 | |
94 bcf menubit ; clear menu flag | |
382 | 95 bcf premenu |
0 | 96 clrf last_pressure+0 |
97 clrf last_pressure+1 | |
98 bcf is_bailout ; =1: Bailout | |
99 bcf ccr_diluent_setup ; Use OC gases for gaslist routine | |
100 | |
101 bcf simulatormode_active ; Quit simulator mode (if active) | |
560 | 102 |
103 ; MOVE from here to below ## V2.94 | |
104 ; bcf switch_left | |
105 ; bcf switch_right | |
0 | 106 |
107 ;---- Fade to standard surface view -------------------------------------- | |
108 ; Wait 1 second | |
109 bcf onesecupdate | |
110 btfss onesecupdate | |
111 bra $-2 | |
112 ; Wait 1 second | |
113 bcf onesecupdate | |
114 btfss onesecupdate | |
115 bra $-2 | |
116 | |
117 call TFT_Display_FadeOut ; Go to black screen | |
118 call TFT_ClearScreen ; Then change everything | |
119 WIN_TOP .0 | |
120 WIN_LEFT .0 | |
121 WIN_FONT FT_SMALL | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
122 bcf win_invert ; Reset invert flag |
0 | 123 |
124 WIN_COLOR color_lightblue | |
125 WIN_SMALL menu_pos_column,menu_pos_row | |
126 STRCPY_TEXT_PRINT tMenu ;"<Menu" | |
127 WIN_SMALL view_column,view_row | |
128 STRCPY_TEXT_PRINT tView ;"View>" | |
129 call TFT_standard_color | |
130 | |
48 | 131 ; Logo |
0 | 132 WIN_TOP .0 |
133 WIN_LEFT .70 | |
275 | 134 movlw LOW(ostc_logo_block) |
0 | 135 movwf TBLPTRL |
275 | 136 movlw HIGH ostc_logo_block;&0xFFFF |
0 | 137 movwf TBLPTRH |
275 | 138 movlw UPPER(ostc_logo_block) |
0 | 139 movwf TBLPTRU |
140 call color_image | |
141 | |
158 | 142 call TFT_clock ; display time |
143 call update_surfloop60 | |
144 call get_battery_voltage ; get battery voltage | |
145 call TFT_update_batt_voltage ; display battery voltage | |
146 call TFT_update_surf_press ; display surface pressure | |
147 call TFT_temp_surfmode ; Displays temperature | |
148 call TFT_display_decotype_surface | |
560 | 149 |
150 ; REPLACE ## voting logic | |
151 ; call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays | |
152 ; call check_sensors ; Set enable/disable flags | |
153 ; BY | |
154 call calc_deko_divemode_sensor | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
233
diff
changeset
|
155 |
480
ad8acade5567
NEW: PSCR mode (Passive semi-closed rebreather)
heinrichsweikamp
parents:
476
diff
changeset
|
156 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
232 | 157 tstfsz lo |
158 bra surfloop_no_oc ; Not OC | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
233
diff
changeset
|
159 call TFT_show_OC_startgas_surface; Show first gas and "OSTC2-like" active gases |
232 | 160 surfloop_no_oc: |
158 | 161 movff customview_surfmode,menupos3 ; Reload last customview |
162 call surf_customview_mask ; Update #menupos3 view | |
0 | 163 |
164 call TFT_Display_FadeIn ; Display resulting surface screen. | |
165 | |
560 | 166 ; MOVED from above to here ## V2.94 |
167 bcf switch_left | |
168 bcf switch_right | |
169 | |
0 | 170 ;---- Late initialisations ----------------------------------------------- |
560 | 171 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine ## not used any more (!?) |
172 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values ## not used any more (!?) | |
0 | 173 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine |
174 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; 30min old values | |
175 movff last_surfpressure_30min+0,last_surfpressure+0 ; Use 30min old airpressure | |
176 movff last_surfpressure_30min+1,last_surfpressure+1 ; Use 30min old airpressure | |
177 | |
560 | 178 ; NEW ## no fly |
179 movff opt_GF_low,char_I_GF_Low_percentage | |
180 movff opt_GF_high,char_I_GF_High_percentage | |
181 | |
158 | 182 ; Startup tasks for all modes |
0 | 183 ; Desaturation time needs: |
184 ; int_I_pres_surface | |
185 ; char_I_desaturation_multiplier | |
186 call deco_calc_desaturation_time ; calculate desaturation time | |
560 | 187 |
188 ; REPLACE ## (code unification) | |
189 ; movlb b'00000001' ; select ram bank 1 | |
190 ; BY | |
191 banksel common | |
0 | 192 |
193 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
194 call enable_rs232 ; Also sets to speed_normal ... | |
195 | |
196 surfloop_loop: | |
197 btfss onesecupdate ; do every second tasks? | |
198 bra surfloop_loop2 ; no, loop | |
199 | |
200 ; One Second tasks for all modes | |
201 call speed_normal | |
487 | 202 ;call TFT_debug_output |
0 | 203 call TFT_clock ; update clock |
204 call timeout_surfmode ; check timeout | |
205 call get_battery_voltage ; get battery voltage | |
206 call TFT_update_batt_voltage ; display battery voltage | |
207 call set_dive_modes ; tests if depth>threshold | |
208 btfss secs,0 ; Every two seconds... | |
209 call TFT_temp_surfmode ; Displays temperature | |
210 btfss secs,0 ; Every two seconds... | |
211 call surfmode_check_for_warnings ; ... check for warnings (and display/update) them | |
212 bcf onesecupdate ; every second tasks done | |
213 | |
214 surfloop_loop2: | |
215 ; Tasks approx. every 50ms for all modes | |
216 call test_switches_surfmode ; check switches | |
487 | 217 call TFT_debug_output |
0 | 218 |
219 ; One minute tasks for all modes | |
220 btfsc oneminupdate ; do every minute tasks | |
221 call update_surfloop60 ; yes, e.g. update time and date | |
222 | |
223 ; Mode tasks | |
230
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
224 btfsc divemode ; Divemode active? |
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
225 goto diveloop ; Yes, switch into Divemode! |
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
226 |
0 | 227 btfsc menubit ; Menu? |
228 goto do_main_menu ; Menu! | |
229 | |
230 btfsc pressure_refresh ; new pressure available? | |
231 call TFT_update_surf_press ; display surface pressure | |
232 bcf pressure_refresh ; until new pressure is available | |
233 | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
234 ; Updates every 1/4 second |
0 | 235 btfss quarter_second_update |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
236 bra surfloop_loop2b |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
237 |
0 | 238 bcf quarter_second_update |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
239 |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
240 ; Update Sensors |
560 | 241 ; REPLACE ## voting logic |
242 ; call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays | |
243 ; call check_sensors ; Set enable/disable flags | |
244 ; BY | |
245 call calc_deko_divemode_sensor | |
246 | |
485 | 247 btfsc FLAG_ccr_mode ; In CCR mode? |
560 | 248 bra surfloop_loop2a1 ; Yes. |
485 | 249 btfss FLAG_pscr_mode ; In PSCR mode? |
560 | 250 bra surfloop_loop2a ; No, skip |
485 | 251 |
252 surfloop_loop2a1: | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
253 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
254 sublw .1 ; opt_ccr_mode = 1 (Sensor)? |
560 | 255 bnz surfloop_loop2a ; No, skip |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
256 |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
257 call TFT_surface_sensor ; ...update sensor data in surface mode |
535
cf68fe0c3002
NEW: Show a warning for each sensor if the sensor is end-of-life after calibration (Less then 8mV in Air at sea level)
heinrichsweikamp
parents:
530
diff
changeset
|
258 call TFT_sensor_surface_warning ; Show a warning arrow-down behind sensor readings when sensor is end-of-life |
530 | 259 movlw .9 |
560 | 260 cpfseq menupos3 ; in Sensor mV surface custom view? |
261 bra surfloop_loop2a ; No | |
530 | 262 extern TFT_sensor_mV |
263 call TFT_sensor_mV ; Yes, update mV readings (Each 1/4 second and not each second as in customview.asm) | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
264 |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
265 surfloop_loop2a: |
0 | 266 movlw .6 |
267 cpfseq menupos3 ; in compass view? | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
268 bra surfloop_loop2b ; No |
256
5b4ef0b9090d
place compass display code into compass_ops.asm
heinrichsweikamp
parents:
245
diff
changeset
|
269 extern TFT_surface_compass_heading |
0 | 270 call TFT_surface_compass_heading ; Yes, update compass heading value |
271 | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
272 surfloop_loop2b: |
0 | 273 btfsc toggle_customview ; Next view? |
274 call surf_customview_toggle ; Yes, show next customview (and delete this flag) | |
275 | |
276 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
277 bra surfloop_loop3 | |
560 | 278 |
279 ; DELETE - In surface mode, only charing is available now - but now you can see the charging status :-) ## USB | |
280 ; To do USB communication, you now need to be in menu or logbook mode | |
281 ;btfsc vusb_in ; USB plugged in? | |
282 ;call comm_mode ; Start COMM mode | |
283 | |
0 | 284 bra surfloop_loop4 |
285 surfloop_loop3: | |
286 btfss vusb_in ; USB (still) plugged in? | |
287 bcf enable_screen_dumps ; No, clear flag | |
288 call rs232_get_byte | |
289 btfsc rs232_recieve_overflow | |
290 bra surfloop_loop4 | |
291 movlw "l" | |
292 cpfseq RCREG1 | |
293 bra surfloop_loop4 | |
560 | 294 call TFT_dump_screen ; Dump the screen contents |
0 | 295 surfloop_loop4: |
560 | 296 btfsc sleepmode ; Sleepmode active? |
297 goto sleeploop ; Yes, switch into sleepmode! | |
0 | 298 |
560 | 299 bra surfloop_loop ; loop surfacemode |
0 | 300 |
301 update_surfloop60: | |
302 ; One minute tasks for all modes | |
560 | 303 call TFT_date ; Update date |
304 | |
305 ; REPLACE ## no fly 2 | |
306 ; call calc_deko_surfmode ; calculate desaturation time every minute | |
307 ; BY | |
308 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode. int_I_pres_surface gets updated by | |
309 call deco_calc_desaturation_time ; TFT_update_surf_press when amb_pressure has changed by >= 10 mbar | |
310 banksel common | |
311 | |
312 ; NEW ## deco engine | |
313 ; update tissue diagram if it is on display | |
314 movlw .5 ; number of tissue custom view | |
315 cpfseq menupos3 ; is this the current customview? | |
316 bra update_surfloop60_1 ; NO | |
317 call TFT_standard_color ; YES - set standard color | |
318 call TFT_surface_tissues ; show tissue diagram | |
319 update_surfloop60_1: | |
320 | |
321 ; NEW ## no fly | |
322 ; update last dive info if it is on display | |
323 movlw .8 ; number of the last dive info customview | |
324 cpfseq menupos3 ; is this the current customview? | |
325 bra update_surfloop60_2 ; NO | |
326 call TFT_standard_color ; YES - set standard color | |
327 call TFT_surface_lastdive ; show last dive infos | |
328 update_surfloop60_2: | |
329 | |
0 | 330 bcf oneminupdate |
331 return | |
332 | |
333 extern check_cns_violation,check_warn_battery,check_and_store_gf_violation | |
334 surfmode_check_for_warnings: | |
560 | 335 |
336 ; DELETE ## (screen flicker) | |
337 ; movf warning_counter_backup,W | |
338 ; cpfseq warning_counter ; warning_counter_backup = warning_counter? | |
339 ; call TFT_clear_warning_text ; No, clear all warnings | |
340 ; movff warning_counter,warning_counter_backup ; copy warning_counter | |
0 | 341 |
342 bcf warning_active ; Clear flag | |
343 clrf warning_counter ; Clear counter | |
344 | |
345 ; Warnings for all modes | |
346 call check_warn_battery ; Check if the battery level should be displayed/warned | |
560 | 347 |
348 ; DELETE HERE... ## (general fix) | |
349 ; rcall surfmode_check_for_nofly ; Check if nofly time should be shown | |
350 ; rcall surfmode_check_for_desat ; Check if desat time should be shown | |
351 | |
352 ; DELETE - surface interval is now shown in last dive custom view, not as "warning" any more ## no fly | |
353 ; rcall surfmode_check_for_interval ; Check if surface interval should be shown | |
0 | 354 |
560 | 355 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode |
0 | 356 bra surfmode_check_for_warnings2 |
560 | 357 btfsc FLAG_gauge_mode ; Done for Apnoe or Gauge mode |
0 | 358 bra surfmode_check_for_warnings2 |
359 | |
360 ; Warnings only in deco modes | |
560 | 361 |
362 ; ...INSERT HERE ## (general fix) - desat and no-fly time belong to deco modes | |
363 rcall surfmode_check_for_desat ; Check if desat time should be shown | |
364 rcall surfmode_check_for_nofly ; Check if nofly time should be shown | |
365 | |
0 | 366 call check_cns_violation ; Check CNS value and display it, if required |
367 call check_and_store_gf_violation ; Check GF value and display it, if required | |
368 | |
560 | 369 ; NEW ## microbubbles |
370 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
371 btfsc WREG,mbubble_warning_lock ; do we have a microbubbles warning? | |
372 extern warn_mbubbles | |
373 call warn_mbubbles ; YES | |
374 | |
0 | 375 surfmode_check_for_warnings2: |
376 ; Setup warning_page number | |
377 incf warning_page,F | |
378 bcf STATUS,C | |
379 rlcf warning_page,W ; *2 | |
380 cpfsgt warning_counter ; > warning_counter | |
381 clrf warning_page ; No, clear | |
560 | 382 |
383 ; NEW ## (screen flicker) | |
384 ; Clear both rows of warnings if there is nothing to show at all | |
385 tstfsz warning_counter ; any warnings? | |
386 bra surfmode_check_for_warnings3 ; YES - look if second row needs to be cleared | |
387 call TFT_clear_warning_text ; NO - clear complete warnings area | |
388 return | |
389 surfmode_check_for_warnings3: | |
0 | 390 |
391 ; Clear 2nd row of warnings if there is nothing to show (on this page) | |
392 btfss second_row_warning ; =1: The second row contains a warning | |
393 call TFT_clear_warning_text_2nd_row ; No, clear this row | |
394 return ; Done. | |
395 | |
560 | 396 ; DELETE - surface interval is now shown in last dive custom view, not as "warning" any more ## no fly |
397 ; | |
398 ;surfmode_check_for_interval: | |
399 ; movf surface_interval+0,W ; Is interval null ? | |
400 ; iorwf surface_interval+1,W | |
401 ; bnz surfmode_check_for_interval2 ; No | |
402 ; return | |
403 ;surfmode_check_for_interval2: | |
404 ; incf warning_counter,F ; increase counter | |
405 ; call TFT_interval | |
406 ; return | |
0 | 407 |
408 | |
409 surfmode_check_for_desat: | |
560 | 410 ; REPLACE ## no fly |
411 ; movf desaturation_time+0,W ; Is nofly null ? | |
412 ; iorwf desaturation_time+1,W | |
413 ; BY | |
414 banksel int_O_desaturation_time | |
415 movf int_O_desaturation_time+0,W ; Is nofly null ? | |
416 iorwf int_O_desaturation_time+1,W | |
417 | |
418 bnz surfmode_check_for_desat2 ; No | |
419 | |
420 ; NEW ## no fly | |
421 banksel common | |
422 | |
0 | 423 return |
560 | 424 |
0 | 425 surfmode_check_for_desat2: |
560 | 426 ; NEW ## no fly |
427 banksel common | |
428 | |
429 incf warning_counter,F ; increase counter | |
0 | 430 call TFT_desaturation_time |
431 return | |
432 | |
433 surfmode_check_for_nofly: | |
560 | 434 ; REPLACE ## no fly |
435 ; movf nofly_time+0,W ; Is nofly null ? | |
436 ; iorwf nofly_time+1,W | |
437 ; BY | |
438 banksel int_O_nofly_time | |
439 movf int_O_nofly_time+0,W ; Is nofly null ? | |
440 iorwf int_O_nofly_time+1,W | |
441 | |
442 bnz surfmode_check_for_nofly2 ; No... | |
443 | |
444 ; NEW ## no fly | |
445 banksel common | |
446 | |
0 | 447 return |
560 | 448 |
0 | 449 surfmode_check_for_nofly2: |
560 | 450 ; NEW ## no fly |
451 banksel common | |
452 | |
453 incf warning_counter,F ; increase counter | |
0 | 454 call TFT_nofly_time |
455 return | |
456 | |
457 | |
458 ;============================================================================= | |
560 | 459 |
460 ; DELETE - not used any more ## no fly | |
461 ; global calc_deko_surfmode | |
462 ;calc_deko_surfmode: | |
463 ; | |
464 ; ; DELETE - deco_calc_wo_deco_step_1_min uses int_I_pres_surface, not int_I_pres_respiration ## no fly | |
465 ; ; SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine | |
466 ; | |
467 ; call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
468 ; | |
469 ; ; NEW ## no fly | |
470 ; ; call deco_calc_desaturation_time | |
471 ; | |
472 ; banksel common | |
473 ; return | |
0 | 474 |
475 test_switches_surfmode: ; checks switches in surfacemode | |
476 btfsc switch_right | |
477 bra test_switches_surfmode2 | |
478 btfsc switch_left | |
479 bra test_switches_surfmode3 | |
480 | |
481 ; No button press | |
482 return | |
483 | |
484 test_switches_surfmode3: | |
382 | 485 movlw .6 |
486 cpfseq menupos3 ; in compass view? | |
487 bra test_switches_surfmode3a ; No | |
488 | |
489 btfsc premenu ; already shown "Bearing" | |
490 bra test_switches_surfmode3b ; Yes, remove it | |
491 | |
492 extern TFT_surf_set_bearing | |
493 call TFT_surf_set_bearing ; Yes. | |
494 bcf switch_left | |
495 return | |
496 | |
497 test_switches_surfmode3a: | |
0 | 498 bcf switch_left |
560 | 499 bsf menubit ; Enter Menu! |
0 | 500 return |
501 | |
382 | 502 test_switches_surfmode3b: |
503 ; Clear "Heading?" | |
504 WIN_BOX_BLACK .158,.190, .15, .99 ; top, bottom, left, right | |
505 bcf premenu | |
506 bcf switch_left | |
507 return | |
508 | |
0 | 509 test_switches_surfmode2: |
382 | 510 movlw .6 |
511 cpfseq menupos3 ; in compass view? | |
512 bra test_switches_surfmode2a ; No | |
513 btfss premenu ; "Heading?" shown? | |
514 bra test_switches_surfmode2a ; No | |
515 ; Set new heading | |
516 bcf premenu | |
517 bsf compass_bearing_set | |
518 movff compass_heading_shown+0,compass_bearing+0 | |
519 movff compass_heading_shown+1,compass_bearing+1 | |
520 bcf switch_right | |
521 return | |
522 | |
523 test_switches_surfmode2a: | |
0 | 524 bcf switch_right |
525 bsf toggle_customview | |
382 | 526 bcf premenu |
0 | 527 clrf timeout_counter2 ; and reset timeout |
528 return | |
529 | |
530 global timeout_surfmode | |
531 timeout_surfmode: | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
532 movlw timeout_surfacemode ; [s] Default timeout |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
158
diff
changeset
|
533 btfsc menu_show_sensors2 ; In the "Calibrate" menu? |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
534 movlw timeout_calibrate_menu ; [s] CCR Calibrate Menu timeout |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
535 btfsc menubit ; in Menu? |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
536 bra timeout_testmode ; No, done. |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
537 ; Must be in surface mode |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
538 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
539 bra timeout_testmode ; No, not CCR |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
540 movlw timeout_ccr_surface ; [s] CCR Surface mode timeout |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
541 |
0 | 542 global timeout_testmode |
543 timeout_testmode: | |
544 incf timeout_counter2,F ; increase timeout counter | |
545 cpfsgt timeout_counter2 ; Compare with timeout_counter2 | |
546 return ; return, no timeout | |
547 bsf sleepmode ; Set Flag | |
548 return ; Return | |
549 | |
550 END |