Mercurial > public > hwos_code
annotate src/surfmode.asm @ 576:690bfb76911c
Italian update
author | heinrichsweikamp |
---|---|
date | Fri, 16 Feb 2018 12:15:43 +0100 |
parents | 54346c651b6a |
children | b455b31ce022 |
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 call calc_deko_divemode_sensor | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
233
diff
changeset
|
151 |
480
ad8acade5567
NEW: PSCR mode (Passive semi-closed rebreather)
heinrichsweikamp
parents:
476
diff
changeset
|
152 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
232 | 153 tstfsz lo |
154 bra surfloop_no_oc ; Not OC | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
233
diff
changeset
|
155 call TFT_show_OC_startgas_surface; Show first gas and "OSTC2-like" active gases |
232 | 156 surfloop_no_oc: |
158 | 157 movff customview_surfmode,menupos3 ; Reload last customview |
158 call surf_customview_mask ; Update #menupos3 view | |
0 | 159 |
160 call TFT_Display_FadeIn ; Display resulting surface screen. | |
161 | |
560 | 162 ; MOVED from above to here ## V2.94 |
163 bcf switch_left | |
164 bcf switch_right | |
165 | |
0 | 166 ;---- Late initialisations ----------------------------------------------- |
560 | 167 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine ## not used any more (!?) |
168 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values ## not used any more (!?) | |
0 | 169 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine |
170 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; 30min old values | |
171 movff last_surfpressure_30min+0,last_surfpressure+0 ; Use 30min old airpressure | |
172 movff last_surfpressure_30min+1,last_surfpressure+1 ; Use 30min old airpressure | |
173 | |
560 | 174 ; NEW ## no fly |
175 movff opt_GF_low,char_I_GF_Low_percentage | |
176 movff opt_GF_high,char_I_GF_High_percentage | |
177 | |
158 | 178 ; Startup tasks for all modes |
0 | 179 ; Desaturation time needs: |
180 ; int_I_pres_surface | |
181 ; char_I_desaturation_multiplier | |
182 call deco_calc_desaturation_time ; calculate desaturation time | |
560 | 183 |
184 ; REPLACE ## (code unification) | |
185 ; movlb b'00000001' ; select ram bank 1 | |
186 ; BY | |
187 banksel common | |
0 | 188 |
189 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
190 call enable_rs232 ; Also sets to speed_normal ... | |
191 | |
192 surfloop_loop: | |
193 btfss onesecupdate ; do every second tasks? | |
194 bra surfloop_loop2 ; no, loop | |
195 | |
196 ; One Second tasks for all modes | |
197 call speed_normal | |
487 | 198 ;call TFT_debug_output |
0 | 199 call TFT_clock ; update clock |
200 call timeout_surfmode ; check timeout | |
201 call get_battery_voltage ; get battery voltage | |
202 call TFT_update_batt_voltage ; display battery voltage | |
203 call set_dive_modes ; tests if depth>threshold | |
204 btfss secs,0 ; Every two seconds... | |
205 call TFT_temp_surfmode ; Displays temperature | |
206 btfss secs,0 ; Every two seconds... | |
207 call surfmode_check_for_warnings ; ... check for warnings (and display/update) them | |
208 bcf onesecupdate ; every second tasks done | |
209 | |
210 surfloop_loop2: | |
211 ; Tasks approx. every 50ms for all modes | |
212 call test_switches_surfmode ; check switches | |
487 | 213 call TFT_debug_output |
0 | 214 |
215 ; One minute tasks for all modes | |
216 btfsc oneminupdate ; do every minute tasks | |
217 call update_surfloop60 ; yes, e.g. update time and date | |
218 | |
219 ; Mode tasks | |
230
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
220 btfsc divemode ; Divemode active? |
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
221 goto diveloop ; Yes, switch into Divemode! |
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
222 |
0 | 223 btfsc menubit ; Menu? |
224 goto do_main_menu ; Menu! | |
225 | |
226 btfsc pressure_refresh ; new pressure available? | |
227 call TFT_update_surf_press ; display surface pressure | |
228 bcf pressure_refresh ; until new pressure is available | |
229 | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
230 ; Updates every 1/4 second |
0 | 231 btfss quarter_second_update |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
232 bra surfloop_loop2b |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
233 |
0 | 234 bcf quarter_second_update |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
235 |
564 | 236 call calc_deko_divemode_sensor |
560 | 237 |
485 | 238 btfsc FLAG_ccr_mode ; In CCR mode? |
560 | 239 bra surfloop_loop2a1 ; Yes. |
485 | 240 btfss FLAG_pscr_mode ; In PSCR mode? |
560 | 241 bra surfloop_loop2a ; No, skip |
485 | 242 |
243 surfloop_loop2a1: | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
244 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
|
245 sublw .1 ; opt_ccr_mode = 1 (Sensor)? |
560 | 246 bnz surfloop_loop2a ; No, skip |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
247 |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
248 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
|
249 call TFT_sensor_surface_warning ; Show a warning arrow-down behind sensor readings when sensor is end-of-life |
530 | 250 movlw .9 |
560 | 251 cpfseq menupos3 ; in Sensor mV surface custom view? |
252 bra surfloop_loop2a ; No | |
530 | 253 extern TFT_sensor_mV |
254 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
|
255 |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
256 surfloop_loop2a: |
0 | 257 movlw .6 |
258 cpfseq menupos3 ; in compass view? | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
259 bra surfloop_loop2b ; No |
256
5b4ef0b9090d
place compass display code into compass_ops.asm
heinrichsweikamp
parents:
245
diff
changeset
|
260 extern TFT_surface_compass_heading |
0 | 261 call TFT_surface_compass_heading ; Yes, update compass heading value |
262 | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
263 surfloop_loop2b: |
0 | 264 btfsc toggle_customview ; Next view? |
265 call surf_customview_toggle ; Yes, show next customview (and delete this flag) | |
266 | |
267 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
268 bra surfloop_loop3 | |
560 | 269 |
270 ; DELETE - In surface mode, only charing is available now - but now you can see the charging status :-) ## USB | |
271 ; To do USB communication, you now need to be in menu or logbook mode | |
272 ;btfsc vusb_in ; USB plugged in? | |
273 ;call comm_mode ; Start COMM mode | |
274 | |
0 | 275 bra surfloop_loop4 |
276 surfloop_loop3: | |
277 btfss vusb_in ; USB (still) plugged in? | |
278 bcf enable_screen_dumps ; No, clear flag | |
279 call rs232_get_byte | |
280 btfsc rs232_recieve_overflow | |
281 bra surfloop_loop4 | |
282 movlw "l" | |
283 cpfseq RCREG1 | |
284 bra surfloop_loop4 | |
560 | 285 call TFT_dump_screen ; Dump the screen contents |
0 | 286 surfloop_loop4: |
560 | 287 btfsc sleepmode ; Sleepmode active? |
288 goto sleeploop ; Yes, switch into sleepmode! | |
0 | 289 |
560 | 290 bra surfloop_loop ; loop surfacemode |
0 | 291 |
292 update_surfloop60: | |
293 ; One minute tasks for all modes | |
560 | 294 call TFT_date ; Update date |
295 | |
296 ; REPLACE ## no fly 2 | |
297 ; call calc_deko_surfmode ; calculate desaturation time every minute | |
298 ; BY | |
299 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode. int_I_pres_surface gets updated by | |
300 call deco_calc_desaturation_time ; TFT_update_surf_press when amb_pressure has changed by >= 10 mbar | |
301 banksel common | |
302 | |
303 ; NEW ## deco engine | |
304 ; update tissue diagram if it is on display | |
305 movlw .5 ; number of tissue custom view | |
306 cpfseq menupos3 ; is this the current customview? | |
307 bra update_surfloop60_1 ; NO | |
308 call TFT_standard_color ; YES - set standard color | |
309 call TFT_surface_tissues ; show tissue diagram | |
310 update_surfloop60_1: | |
311 | |
312 ; NEW ## no fly | |
313 ; update last dive info if it is on display | |
314 movlw .8 ; number of the last dive info customview | |
315 cpfseq menupos3 ; is this the current customview? | |
316 bra update_surfloop60_2 ; NO | |
317 call TFT_standard_color ; YES - set standard color | |
318 call TFT_surface_lastdive ; show last dive infos | |
319 update_surfloop60_2: | |
320 | |
0 | 321 bcf oneminupdate |
322 return | |
323 | |
324 extern check_cns_violation,check_warn_battery,check_and_store_gf_violation | |
325 surfmode_check_for_warnings: | |
560 | 326 |
327 ; DELETE ## (screen flicker) | |
328 ; movf warning_counter_backup,W | |
329 ; cpfseq warning_counter ; warning_counter_backup = warning_counter? | |
330 ; call TFT_clear_warning_text ; No, clear all warnings | |
331 ; movff warning_counter,warning_counter_backup ; copy warning_counter | |
0 | 332 |
333 bcf warning_active ; Clear flag | |
334 clrf warning_counter ; Clear counter | |
335 | |
336 ; Warnings for all modes | |
337 call check_warn_battery ; Check if the battery level should be displayed/warned | |
560 | 338 |
339 ; DELETE HERE... ## (general fix) | |
340 ; rcall surfmode_check_for_nofly ; Check if nofly time should be shown | |
341 ; rcall surfmode_check_for_desat ; Check if desat time should be shown | |
342 | |
343 ; DELETE - surface interval is now shown in last dive custom view, not as "warning" any more ## no fly | |
344 ; rcall surfmode_check_for_interval ; Check if surface interval should be shown | |
0 | 345 |
560 | 346 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode |
0 | 347 bra surfmode_check_for_warnings2 |
560 | 348 btfsc FLAG_gauge_mode ; Done for Apnoe or Gauge mode |
0 | 349 bra surfmode_check_for_warnings2 |
350 | |
351 ; Warnings only in deco modes | |
560 | 352 |
353 ; ...INSERT HERE ## (general fix) - desat and no-fly time belong to deco modes | |
354 rcall surfmode_check_for_desat ; Check if desat time should be shown | |
355 rcall surfmode_check_for_nofly ; Check if nofly time should be shown | |
356 | |
0 | 357 call check_cns_violation ; Check CNS value and display it, if required |
358 call check_and_store_gf_violation ; Check GF value and display it, if required | |
359 | |
560 | 360 ; NEW ## microbubbles |
361 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
362 btfsc WREG,mbubble_warning_lock ; do we have a microbubbles warning? | |
363 extern warn_mbubbles | |
364 call warn_mbubbles ; YES | |
365 | |
0 | 366 surfmode_check_for_warnings2: |
367 ; Setup warning_page number | |
368 incf warning_page,F | |
369 bcf STATUS,C | |
370 rlcf warning_page,W ; *2 | |
371 cpfsgt warning_counter ; > warning_counter | |
372 clrf warning_page ; No, clear | |
560 | 373 |
374 ; NEW ## (screen flicker) | |
375 ; Clear both rows of warnings if there is nothing to show at all | |
376 tstfsz warning_counter ; any warnings? | |
377 bra surfmode_check_for_warnings3 ; YES - look if second row needs to be cleared | |
378 call TFT_clear_warning_text ; NO - clear complete warnings area | |
379 return | |
380 surfmode_check_for_warnings3: | |
0 | 381 |
382 ; Clear 2nd row of warnings if there is nothing to show (on this page) | |
383 btfss second_row_warning ; =1: The second row contains a warning | |
384 call TFT_clear_warning_text_2nd_row ; No, clear this row | |
385 return ; Done. | |
386 | |
560 | 387 ; DELETE - surface interval is now shown in last dive custom view, not as "warning" any more ## no fly |
388 ; | |
389 ;surfmode_check_for_interval: | |
390 ; movf surface_interval+0,W ; Is interval null ? | |
391 ; iorwf surface_interval+1,W | |
392 ; bnz surfmode_check_for_interval2 ; No | |
393 ; return | |
394 ;surfmode_check_for_interval2: | |
395 ; incf warning_counter,F ; increase counter | |
396 ; call TFT_interval | |
397 ; return | |
0 | 398 |
399 | |
400 surfmode_check_for_desat: | |
560 | 401 ; REPLACE ## no fly |
402 ; movf desaturation_time+0,W ; Is nofly null ? | |
403 ; iorwf desaturation_time+1,W | |
404 ; BY | |
405 banksel int_O_desaturation_time | |
406 movf int_O_desaturation_time+0,W ; Is nofly null ? | |
407 iorwf int_O_desaturation_time+1,W | |
408 | |
409 bnz surfmode_check_for_desat2 ; No | |
410 | |
411 ; NEW ## no fly | |
412 banksel common | |
413 | |
0 | 414 return |
560 | 415 |
0 | 416 surfmode_check_for_desat2: |
560 | 417 ; NEW ## no fly |
418 banksel common | |
419 | |
420 incf warning_counter,F ; increase counter | |
0 | 421 call TFT_desaturation_time |
422 return | |
423 | |
424 surfmode_check_for_nofly: | |
560 | 425 ; REPLACE ## no fly |
426 ; movf nofly_time+0,W ; Is nofly null ? | |
427 ; iorwf nofly_time+1,W | |
428 ; BY | |
429 banksel int_O_nofly_time | |
430 movf int_O_nofly_time+0,W ; Is nofly null ? | |
431 iorwf int_O_nofly_time+1,W | |
432 | |
433 bnz surfmode_check_for_nofly2 ; No... | |
434 | |
435 ; NEW ## no fly | |
436 banksel common | |
437 | |
0 | 438 return |
560 | 439 |
0 | 440 surfmode_check_for_nofly2: |
560 | 441 ; NEW ## no fly |
442 banksel common | |
443 | |
444 incf warning_counter,F ; increase counter | |
0 | 445 call TFT_nofly_time |
446 return | |
447 | |
448 | |
449 ;============================================================================= | |
560 | 450 |
451 ; DELETE - not used any more ## no fly | |
452 ; global calc_deko_surfmode | |
453 ;calc_deko_surfmode: | |
454 ; | |
455 ; ; DELETE - deco_calc_wo_deco_step_1_min uses int_I_pres_surface, not int_I_pres_respiration ## no fly | |
456 ; ; SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine | |
457 ; | |
458 ; call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
459 ; | |
460 ; ; NEW ## no fly | |
461 ; ; call deco_calc_desaturation_time | |
462 ; | |
463 ; banksel common | |
464 ; return | |
0 | 465 |
466 test_switches_surfmode: ; checks switches in surfacemode | |
467 btfsc switch_right | |
468 bra test_switches_surfmode2 | |
469 btfsc switch_left | |
470 bra test_switches_surfmode3 | |
471 | |
472 ; No button press | |
473 return | |
474 | |
475 test_switches_surfmode3: | |
382 | 476 movlw .6 |
477 cpfseq menupos3 ; in compass view? | |
478 bra test_switches_surfmode3a ; No | |
479 | |
480 btfsc premenu ; already shown "Bearing" | |
481 bra test_switches_surfmode3b ; Yes, remove it | |
482 | |
483 extern TFT_surf_set_bearing | |
484 call TFT_surf_set_bearing ; Yes. | |
485 bcf switch_left | |
486 return | |
487 | |
488 test_switches_surfmode3a: | |
0 | 489 bcf switch_left |
560 | 490 bsf menubit ; Enter Menu! |
0 | 491 return |
492 | |
382 | 493 test_switches_surfmode3b: |
494 ; Clear "Heading?" | |
495 WIN_BOX_BLACK .158,.190, .15, .99 ; top, bottom, left, right | |
496 bcf premenu | |
497 bcf switch_left | |
498 return | |
499 | |
0 | 500 test_switches_surfmode2: |
382 | 501 movlw .6 |
502 cpfseq menupos3 ; in compass view? | |
503 bra test_switches_surfmode2a ; No | |
504 btfss premenu ; "Heading?" shown? | |
505 bra test_switches_surfmode2a ; No | |
506 ; Set new heading | |
507 bcf premenu | |
508 bsf compass_bearing_set | |
509 movff compass_heading_shown+0,compass_bearing+0 | |
510 movff compass_heading_shown+1,compass_bearing+1 | |
511 bcf switch_right | |
512 return | |
513 | |
514 test_switches_surfmode2a: | |
0 | 515 bcf switch_right |
516 bsf toggle_customview | |
382 | 517 bcf premenu |
0 | 518 clrf timeout_counter2 ; and reset timeout |
519 return | |
520 | |
521 global timeout_surfmode | |
522 timeout_surfmode: | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
523 movlw timeout_surfacemode ; [s] Default timeout |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
158
diff
changeset
|
524 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
|
525 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
|
526 btfsc menubit ; in Menu? |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
527 bra timeout_testmode ; No, done. |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
528 ; Must be in surface mode |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
529 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
|
530 bra timeout_testmode ; No, not CCR |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
531 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
|
532 |
0 | 533 global timeout_testmode |
534 timeout_testmode: | |
535 incf timeout_counter2,F ; increase timeout counter | |
536 cpfsgt timeout_counter2 ; Compare with timeout_counter2 | |
537 return ; return, no timeout | |
538 bsf sleepmode ; Set Flag | |
539 return ; Return | |
540 | |
541 END |