annotate src/surfmode.asm @ 562:8b7ea27ea1fa

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