Mercurial > public > hwos_code
comparison src/customview.asm @ 604:ca4556fb60b9
bump to 2.99beta, work on 3.00 stable
author | heinrichsweikamp |
---|---|
date | Thu, 22 Nov 2018 19:47:26 +0100 |
parents | 6636cbe64c6d |
children | d866684249bd |
comparison
equal
deleted
inserted
replaced
603:00b24fb4324d | 604:ca4556fb60b9 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File customview.asm REFACTORED VERSION V2.98 | 3 ; File customview.asm REFACTORED VERSION V2.99e |
4 ; | 4 ; |
5 ; Customview in Surfacemode and Divemode | 5 ; Custom Views in Surface and Dive Mode |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
9 ; HISTORY | 9 ; HISTORY |
10 ; 2011-08-10 : [mH] moving from OSTC code | 10 ; 2011-08-10 : [mH] moving from OSTC code |
11 | 11 |
12 ;============================================================================= | 12 ;============================================================================= |
13 | 13 |
14 #include "hwos.inc" ; Mandatory header | 14 #include "hwos.inc" ; mandatory header |
15 #include "tft_outputs.inc" | 15 #include "tft_outputs.inc" |
16 #include "strings.inc" | 16 #include "strings.inc" |
17 #include "tft.inc" | 17 #include "tft.inc" |
18 #include "isr.inc" | 18 #include "isr.inc" |
19 #include "wait.inc" | 19 #include "wait.inc" |
22 #include "divemode.inc" | 22 #include "divemode.inc" |
23 #include "i2c.inc" | 23 #include "i2c.inc" |
24 #include "start.inc" | 24 #include "start.inc" |
25 | 25 |
26 | 26 |
27 extern gaslist_strcat_gas_mod | 27 extern gaslist_strcat_gas_cd |
28 extern char_I_deco_model | 28 extern char_I_deco_model |
29 extern TFT_sensor_mV | |
30 extern TFT_surface_compass_mask | 29 extern TFT_surface_compass_mask |
31 extern TFT_dive_compass_mask | 30 extern TFT_dive_compass_mask |
32 | 31 |
33 | 32 custview CODE |
34 gui CODE | |
35 | 33 |
36 ;============================================================================= | 34 ;============================================================================= |
37 ; Do every-second tasks for the custom view area (Dive mode) | 35 ; Jump table for the every-second tasks for the custom view area (dive mode) |
36 ; | |
37 ; Attention: the ordering must be in line with the init jump table and the | |
38 ; index numbers defined in hwos.inc! | |
38 | 39 |
39 global customview_second | 40 global customview_second |
40 customview_second: | 41 customview_second: |
41 movff menupos3,WREG ; copy current view (1-...) | 42 movf menupos3,W ; copy current view (1-...) |
42 dcfsnz WREG,F | 43 dcfsnz WREG,F ; 1: |
43 goto TFT_update_ppo2_sensors ; Update Sensor data ; and return | 44 goto TFT_avr_stopwatch ; average depth and stopwatch |
44 dcfsnz WREG,F | 45 dcfsnz WREG,F ; 2: |
45 goto TFT_update_avr_stopwatch ; Update average depth and stopwatch; and return | 46 return ; compass - will be updated separately (faster) in divemode |
46 dcfsnz WREG,F | 47 dcfsnz WREG,F ; 3: |
47 goto TFT_decoplan ; Show decoplan ; and return | 48 goto TFT_ppo2_sensors ; ppO2 sensors |
48 dcfsnz WREG,F | 49 dcfsnz WREG,F ; 4: |
49 goto TFT_battinfo_tissues_clock ; Update Battery, Tissues and clock ; and return | 50 goto TFT_sensor_check ; sensor check |
50 dcfsnz WREG,F | 51 dcfsnz WREG,F ; 5; |
51 goto TFT_gf_info ; Update GF informations ; and return | 52 goto TFT_pscr_info ; pSCR data |
52 dcfsnz WREG,F | 53 dcfsnz WREG,F ; 6: |
53 return ; Compass updated separately (faster) in divemode; | 54 IFDEF _rx_functions |
54 dcfsnz WREG,F | 55 goto TFT_pressures_SAC ; tank pressure and SAC rate |
55 nop ; ex goto TFT_dyn_gaslist | 56 ELSE |
56 dcfsnz WREG,F | 57 return ; not available without RX functions |
57 goto TFT_CNS ; Show CNS values for end-of-dive, ex goto TFT_hud_voltages | 58 ENDIF |
58 dcfsnz WREG,F | 59 dcfsnz WREG,F ; 7: |
59 bra customview_1sec_view9 ; Make sure to change value in "check_ppo2_display:" when moving around custom views | 60 goto TFT_gas_needs_ascent ; gas needs for ascent / cave return |
60 dcfsnz WREG,F | 61 dcfsnz WREG,F ; 8: |
61 goto TFT_sensor_check ; Show ppO2 of O2 and Diluent ; and return | 62 goto TFT_decoplan ; deco plan |
62 dcfsnz WREG,F | 63 dcfsnz WREG,F ; 9: |
63 goto TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS; and return | 64 goto TFT_ceiling_GF_tissue ; ceiling, current GF and tissues |
64 dcfsnz WREG,F | 65 dcfsnz WREG,F ; 10: |
65 goto TFT_pscr_info ; Show ppO2, drop and lung ratio; and return | 66 goto TFT_CNS ; CNS values |
66 dcfsnz WREG,F | 67 dcfsnz WREG,F ; 11: |
67 goto TFT_gas_needs ; Show gas needs | 68 goto TFT_ppo2_ead_end_cns ; ppO2, END/EAD and CNS |
68 | 69 dcfsnz WREG,F ; 12: |
69 ; Menupos3=0, do nothing | 70 goto TFT_gf_factors ; GF factors |
70 return | 71 dcfsnz WREG,F ; 13: |
71 | 72 goto TFT_clock_batt_surfpress ; clock, battery and surface pressure |
72 customview_1sec_view9: ; Ceiling | 73 return ; menupos3 = 0 -> do nothing |
73 call TFT_ceiling ; Show Ceiling | 74 |
74 call TFT_display_pure_ppo2 ; ppO2 value | |
75 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF | |
76 return ; No GF info for non-GF modes | |
77 goto TFT_gf_info ; Update GF informations ; and return | |
78 | 75 |
79 global customview_alternative_second | 76 global customview_alternative_second |
80 customview_alternative_second: | 77 customview_alternative_second: |
81 movff menupos3,WREG ; copy current view (1-...) | 78 movf menupos3,W ; copy current view (0-...) |
82 dcfsnz WREG,F | 79 dcfsnz WREG,F |
83 bra customview_alt_second_view1 ; View 1 | 80 nop ; view 1 |
84 dcfsnz WREG,F | 81 dcfsnz WREG,F |
85 nop ; View 2 | 82 nop ; view 2 |
86 | 83 ;bra customview_alt_second_view0 ; default view |
87 ; Menupos3=0, do nothing | 84 |
88 return | 85 customview_alt_second_view0: |
89 | |
90 customview_alt_second_view1: | |
91 bsf FLAG_TFT_max_depth_alt | |
92 bsf FLAG_TFT_big_deco_alt | 86 bsf FLAG_TFT_big_deco_alt |
93 return | 87 return |
94 | 88 |
95 ;============================================================================= | 89 ;============================================================================= |
96 ; Do every-minute tasks for the custom view area | 90 ; Do every-minute tasks for the custom view area |
97 | 91 |
98 global customview_minute | 92 global customview_minute |
99 customview_minute: | 93 customview_minute: ; called from dive mode, call disabled at present |
100 return | 94 return |
101 ; movff menupos3,WREG ; copy | 95 ; movf menupos3,W ; copy |
102 ; dcfsnz WREG,F | 96 ; dcfsnz WREG,F |
103 ; bra customview_1min_view1 | 97 ; bra customview_1min_view1 |
104 ; dcfsnz WREG,F | 98 ; dcfsnz WREG,F |
105 ; bra customview_1min_view2 | 99 ; bra customview_1min_view2 |
106 ; dcfsnz WREG,F | 100 ; dcfsnz WREG,F |
119 ; bra customview_1min_view9 | 113 ; bra customview_1min_view9 |
120 ; dcfsnz WREG,F | 114 ; dcfsnz WREG,F |
121 ; bra customview_1min_view10 | 115 ; bra customview_1min_view10 |
122 ; dcfsnz WREG,F | 116 ; dcfsnz WREG,F |
123 ; bra customview_1min_view11 | 117 ; bra customview_1min_view11 |
124 ; ; Menupos3=0, do nothing | 118 ; ; menupos3=0, do nothing |
125 ; return | 119 ; return |
126 ; | 120 ; |
127 ;customview_1min_view1: | 121 ;customview_1min_view1: |
128 ;customview_1min_view2: | 122 ;customview_1min_view2: |
129 ;customview_1min_view3: | 123 ;customview_1min_view3: |
138 ;return | 132 ;return |
139 | 133 |
140 global surf_customview_toggle | 134 global surf_customview_toggle |
141 surf_customview_toggle: | 135 surf_customview_toggle: |
142 bcf switch_right | 136 bcf switch_right |
143 incf menupos3,F ; Number of customview to show | 137 incf menupos3,F ; number of custom view to show |
144 movlw d'9' ; Max number of customsviews in surface mode | 138 |
145 cpfsgt menupos3 ; Max reached? | 139 movlw .6 ; index of surface custom view compass |
146 bra surf_customview_mask ; No, show | 140 cpfseq menupos3 ; will compass be shown in custom view? |
141 call I2C_sleep_accelerometer ; NO - stop accelerometer | |
142 cpfseq menupos3 ; will compass be shown in custom view? | |
143 call I2C_sleep_compass ; NO - stop compass | |
144 | |
145 movlw d'10' ; max number of custom views in surface mode | |
146 cpfsgt menupos3 ; max reached? | |
147 bra surf_customview_mask ; NO - show | |
147 movlw .1 | 148 movlw .1 |
148 movwf menupos3 ; Reset to one (Always one custom view visible) | 149 movwf menupos3 ; reset to one (always one custom view visible) |
149 | 150 |
150 global surf_customview_mask | 151 global surf_customview_mask |
151 surf_customview_mask: | 152 surf_customview_mask: |
152 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right | 153 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right |
153 ; Prepare title | 154 ; Prepare title |
154 WIN_TINY surf_customview_title_column,surf_customview_title_row | 155 WIN_TINY surf_customview_title_column,surf_customview_title_row |
155 WIN_COLOR color_greenish | 156 WIN_COLOR color_greenish |
156 movff menupos3,WREG ; Menupos3 holds number of customview function | 157 movf menupos3,W ; menupos3 holds number of custom view function |
157 dcfsnz WREG,F | 158 dcfsnz WREG,F ; 1: |
158 bra surf_customview_init_view1 ; OC Gas list | 159 bra surf_customview_init_view1 ; OC gas list |
159 dcfsnz WREG,F | 160 dcfsnz WREG,F ; 2: |
160 bra surf_customview_init_view2 ; CC Dil list | 161 bra surf_customview_init_view2 ; CC dil list |
161 dcfsnz WREG,F | 162 dcfsnz WREG,F ; 3: |
162 bra surf_customview_init_view3 ; CC SP list | 163 bra surf_customview_init_view3 ; CC SP list |
163 dcfsnz WREG,F | 164 dcfsnz WREG,F ; 4: |
164 bra surf_customview_init_view4 ; Custom Text | 165 bra surf_customview_init_view4 ; custom text |
165 dcfsnz WREG,F | 166 dcfsnz WREG,F ; 5: |
166 bra surf_customview_init_view5 ; Tissue Diagram | 167 bra surf_customview_init_view5 ; tissue diagram |
167 dcfsnz WREG,F | 168 dcfsnz WREG,F ; 6: |
168 bra surf_customview_init_view6 ; Compass | 169 bra surf_customview_init_view6 ; compass |
169 dcfsnz WREG,F | 170 dcfsnz WREG,F ; 7: |
170 bra surf_customview_init_view7 ; Deco settings | 171 bra surf_customview_init_view7 ; deco settings |
171 dcfsnz WREG,F | 172 dcfsnz WREG,F ; 8: |
172 bra surf_customview_init_view8 ; Last Dive info | 173 bra surf_customview_init_view8 ; last dive info |
173 dcfsnz WREG,F | 174 dcfsnz WREG,F ; 9: |
174 bra surf_customview_init_view9 ; Sensor mV readings | 175 bra surf_customview_init_view9 ; sensor mV readings |
175 | 176 dcfsnz WREG,F ; 10: |
176 call I2C_sleep_accelerometer ; Stop accelerometer | 177 bra surf_customview_init_view10 ; tank data |
177 call I2C_sleep_compass ; Stop compass | 178 bra surf_customview_init_view4 ; default view after restart and loading new firmware |
178 | 179 |
179 movlw .1 | 180 surf_customview_init_view1: ; view 1: OC Gas list |
180 movwf menupos3 ; Reset to one (Always one custom view visible) | |
181 | |
182 surf_customview_init_view1: ; View1: OC Gas list | |
183 btfsc FLAG_gauge_mode | 181 btfsc FLAG_gauge_mode |
184 bra surf_customview_toggle | 182 bra surf_customview_toggle |
185 btfsc FLAG_apnoe_mode | 183 btfsc FLAG_apnoe_mode |
186 bra surf_customview_toggle | 184 bra surf_customview_toggle |
185 btfss FLAG_oc_mode | |
186 bra surf_customview_init_view1a ; bailout version of "OC Gas List" | |
187 STRCPY_TEXT_PRINT tGaslist ; title of custom view / OC mode | |
188 bra surf_customview_init_view1b | |
189 surf_customview_init_view1a: | |
190 STRCPY_TEXT_PRINT tDiveBailout ; title of custom view / CCR & pSCR mode | |
191 surf_customview_init_view1b: ; remaining common part | |
192 call TFT_standard_color | |
193 call TFT_gaslist_surfmode ; show gas list | |
194 bra customview_toggle_exit ; done | |
195 | |
196 surf_customview_init_view2: ; view 2: CCR / pSCR diluent list | |
187 btfsc FLAG_ccr_mode | 197 btfsc FLAG_ccr_mode |
188 bra surf_customview_init_view1_bail ; Bailout version of "OC Gas List" | 198 bra surf_customview_init_view2a |
189 btfsc FLAG_pscr_mode | 199 btfsc FLAG_pscr_mode |
190 bra surf_customview_init_view1_bail ; Bailout version of "OC Gas List" | 200 bra surf_customview_init_view2a |
191 STRCPY_TEXT_PRINT tGaslist ; Title of customview | 201 bra surf_customview_toggle |
202 surf_customview_init_view2a: | |
203 STRCPY_TEXT_PRINT tGaslistCC ; title of custom view | |
192 call TFT_standard_color | 204 call TFT_standard_color |
193 call TFT_gaslist_surfmode ; Show gas list | 205 call TFT_dillist_surfmode ; show diluent list |
194 bra customview_toggle_exit ; Done. | 206 bra customview_toggle_exit ; done |
195 | 207 |
196 surf_customview_init_view1_bail: | 208 surf_customview_init_view3: ; view 3: CC SP list |
197 STRCPY_TEXT_PRINT tDiveBailout ; Title of customview | 209 btfsc FLAG_ccr_mode |
210 bra surf_customview_init_view3a | |
211 bra surf_customview_toggle | |
212 surf_customview_init_view3a: | |
213 STRCPY_TEXT_PRINT tFixedSetpoints ; title of custom view | |
198 call TFT_standard_color | 214 call TFT_standard_color |
199 call TFT_gaslist_surfmode ; Show gas list | 215 call TFT_splist_surfmode ; show setpoint list |
200 bra customview_toggle_exit ; Done. | 216 bra customview_toggle_exit ; done |
201 | 217 |
202 surf_customview_init_view2: ; View2: CC Dil list | 218 surf_customview_init_view9: ; view 9: sensor mV at the surface |
203 btfsc FLAG_pscr_mode | |
204 bra surf_customview_init_view2_2 | |
205 btfss FLAG_ccr_mode | |
206 bra surf_customview_toggle | |
207 btfsc FLAG_gauge_mode | |
208 bra surf_customview_toggle | |
209 btfsc FLAG_apnoe_mode | |
210 bra surf_customview_toggle | |
211 surf_customview_init_view2_2: | |
212 STRCPY_TEXT_PRINT tGaslistCC ; Title of customview | |
213 call TFT_standard_color | |
214 call TFT_dillist_surfmode ; Show diluent list | |
215 bra customview_toggle_exit ; Done. | |
216 | |
217 surf_customview_init_view3: ; View3: CC SP list | |
218 btfss FLAG_ccr_mode | |
219 bra surf_customview_toggle | |
220 btfsc FLAG_gauge_mode | |
221 bra surf_customview_toggle | |
222 btfsc FLAG_apnoe_mode | |
223 bra surf_customview_toggle | |
224 STRCPY_TEXT_PRINT tFixedSetpoints ; Title of customview | |
225 call TFT_standard_color | |
226 call TFT_splist_surfmode ; Show Setpoint list | |
227 bra customview_toggle_exit ; Done. | |
228 | |
229 surf_customview_init_view9: ; View 9: Sensor mV on the surface | |
230 btfsc FLAG_ccr_mode | 219 btfsc FLAG_ccr_mode |
231 bra surf_customview_init_view9a ; we are in CCR mode | 220 bra surf_customview_init_view9a ; we are in CCR mode |
232 btfsc FLAG_pscr_mode | 221 btfsc FLAG_pscr_mode |
233 bra surf_customview_init_view9a ; we are in PSCR mode | 222 bra surf_customview_init_view9a ; we are in PSCR mode |
234 bra surf_customview_toggle ; we are not in any rebreather mode, so skip | 223 bra surf_customview_toggle ; we are not in any rebreather mode, so skip |
235 surf_customview_init_view9a: | 224 surf_customview_init_view9a: |
236 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | 225 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: Sensor, =2: auto SP |
237 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | 226 sublw .1 ; opt_ccr_mode = 1 (sensor)? |
238 bnz surf_customview_toggle ; sorry, no sensors, skip again | 227 bnz surf_customview_toggle ; sorry, no sensors, skip again |
239 STRCPY_TEXT_PRINT tSensorMilliVolt ; Title of customview | 228 STRCPY_TEXT_PRINT tSensorMilliVolt ; title of custom view |
240 call TFT_standard_color | |
241 call TFT_sensor_mV ; write sensor mV readings to screen | 229 call TFT_sensor_mV ; write sensor mV readings to screen |
242 bra customview_toggle_exit ; Done. | 230 bra customview_toggle_exit ; done |
243 | 231 |
244 surf_customview_init_view4: ; View4: Custom text | 232 surf_customview_init_view4: ; view 4: custom text |
233 call TFT_custom_text ; show the custom text | |
234 bra customview_toggle_exit ; done | |
235 | |
236 surf_customview_init_view5: ; view 5: tissue diagram | |
237 btfsc FLAG_gauge_mode | |
238 bra surf_customview_toggle | |
239 btfsc FLAG_apnoe_mode | |
240 bra surf_customview_toggle | |
245 call TFT_standard_color | 241 call TFT_standard_color |
246 call TFT_custom_text ; Show the custom text | 242 call TFT_surface_tissues ; show tissue diagram |
247 bra customview_toggle_exit ; Done. | 243 bra customview_toggle_exit ; done |
248 | 244 |
249 surf_customview_init_view5: ; View5: Tissue Diagram | 245 surf_customview_init_view6: ; view 6: compass |
250 btfsc FLAG_gauge_mode | 246 call I2C_init_accelerometer ; start accelerometer |
247 call I2C_init_compass ; start compass | |
248 call TFT_surface_compass_mask ; show compass mask | |
249 bra customview_toggle_exit ; done | |
250 | |
251 surf_customview_init_view7: | |
252 btfsc FLAG_gauge_mode ; view 7: deco settings | |
251 bra surf_customview_toggle | 253 bra surf_customview_toggle |
252 btfsc FLAG_apnoe_mode | 254 btfsc FLAG_apnoe_mode |
253 bra surf_customview_toggle | 255 bra surf_customview_toggle |
254 call TFT_standard_color | 256 call TFT_surface_decosettings ; show all deco settings |
255 call TFT_surface_tissues ; Show Tissue diagram | 257 bra customview_toggle_exit ; done |
256 bra customview_toggle_exit ; Done. | 258 |
257 | 259 surf_customview_init_view8: ; view 8: last dive info |
258 surf_customview_init_view6: ; View6: Compass | 260 call TFT_surface_lastdive ; show last dive interval |
259 call I2C_init_accelerometer ; Start accelerometer | 261 bra customview_toggle_exit ; done |
260 call I2C_init_compass ; Start compass | 262 |
261 call TFT_surface_compass_mask ; Show compass | 263 surf_customview_init_view10: ; transmitter data / debug |
262 bra customview_toggle_exit ; Done. | 264 IFDEF _rx_functions |
263 | 265 btfss FLAG_tr_enabled ; TR functions enabled? |
264 surf_customview_init_view7: | 266 bra surf_customview_toggle ; NO - show next view in list |
265 btfsc FLAG_gauge_mode ; View7: Deco settings | 267 STRCAT_PRINT "ID bar Volt" ; title of custom view (none language-dependent) |
266 bra surf_customview_toggle | 268 call TFT_surface_tankdata |
267 btfsc FLAG_apnoe_mode | 269 bra customview_toggle_exit ; done |
268 bra surf_customview_toggle | 270 ELSE |
269 | 271 bra surf_customview_toggle |
270 call TFT_surface_decosettings ; Show all deco settings | 272 ENDIF |
271 bra customview_toggle_exit ; Done. | 273 |
272 | 274 |
273 surf_customview_init_view8: ; View8: Last dive info | 275 global switch_layout_to_normal |
274 call TFT_surface_lastdive ; Show last dive interval | 276 switch_layout_to_normal: ; switch back from alternative to normal layout |
275 bra customview_toggle_exit ; Done. | 277 ; needs custom view to be selected / restored separately! |
278 bcf alternative_divelayout ; clear flag | |
279 bsf FLAG_TFT_divemode_mask ; set flag for normal layout mask | |
280 bsf FLAG_TFT_max_depth ; set flag for normal layout data | |
281 btfss decostop_active ; deco? | |
282 bsf FLAG_TFT_display_ndl_mask ; NO - set flag for normal layout NDL data | |
283 btfsc decostop_active ; deco? | |
284 bsf FLAG_TFT_display_deko_mask ; YES - set flag for normal layout deco data | |
285 clrf menupos3 ; set to no active custom view | |
286 call TFT_ClearScreen ; clear the whole screen | |
287 return | |
276 | 288 |
277 | 289 |
278 global menuview_toggle | 290 global menuview_toggle |
279 menuview_toggle: ; Show Menu or the simulator tasks | 291 menuview_toggle: ; show menu or the simulator tasks |
280 btfss alternative_divelayout ; In alternative layout mode? | 292 bcf switch_left |
281 bra menuview_toggle2 ; No | 293 btfss alternative_divelayout ; in alternative layout mode? |
282 ; Switch back to normal mode for any menu tasks | 294 bra menuview_toggle2 ; NO - continue with menu or simulator tasks |
283 bcf alternative_divelayout ; clear flag | 295 rcall switch_layout_to_normal ; YES - switch back to normal layout |
284 bsf FLAG_TFT_divemode_mask ; Set flag for mask | 296 movff customview_divemode,menupos3; - restore the custom view shown in normal layout |
285 bsf FLAG_TFT_max_depth ; set flag | 297 rcall customview_mask ; - re-draw the custom view |
286 btfss decostop_active ; deco? | 298 bra menuview_toggle_reset ; - suppress the menu when returning from alternative layout |
287 bsf FLAG_TFT_display_ndl_mask ; NDL | |
288 btfsc decostop_active ; deco? | |
289 bsf FLAG_TFT_display_deko_mask ; Deco | |
290 call TFT_ClearScreen ; Clear screen | |
291 rcall customview_mask ; Re-Draw customview | |
292 | 299 |
293 menuview_toggle2: | 300 menuview_toggle2: |
294 movlw divemode_menuview_timeout | 301 movlw divemode_menuview_timeout |
295 movwf timeout_counter2 | 302 movwf timeout_counter2 |
296 bsf menuview | 303 bsf menuview ; flag that the options menu is shown |
297 bcf switch_left | 304 incf menupos2,F ; number of option to show |
298 incf menupos2,F ; Number of options to show | 305 movlw d'10' ; max number of options in divemode |
299 movlw d'10' ; Max number of options in divemode | 306 cpfsgt menupos2 ; max reached? |
300 cpfsgt menupos2 ; Max reached? | 307 bra menuview_mask ; NO - show option |
301 bra menuview_mask ; No, show | |
302 global menuview_toggle_reset | 308 global menuview_toggle_reset |
303 menuview_toggle_reset: ; Timeout occurred | 309 menuview_toggle_reset: ; timeout occurred, beyond max number of options, or item executed |
304 clrf menupos2 | 310 clrf menupos2 ; reset option selector |
305 bcf menuview | 311 bcf menuview ; revoke options menu if shown |
306 menuview_mask: | 312 menuview_mask: |
307 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.49 ; top, bottom, left, right | 313 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.46 ; top, bottom, left, right |
308 btfss FLAG_gauge_mode | 314 btfss FLAG_gauge_mode ; in gauge mode? |
309 bra menuview_mask2 | 315 bra menuview_mask2 ; NO |
310 ; Clear some more in gauge mode -- "Reset Avg." text is longer than normal simtext | 316 ; YES - clear some more in gauge mode -- "Reset Avg." text is longer than all the other texts |
311 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.50, dm_simtext_column+.70 ; top, bottom, left, right | 317 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.47, dm_simtext_column+.70 ; top, bottom, left, right |
312 menuview_mask2: | 318 menuview_mask2: |
313 call TFT_draw_gassep_line | 319 call TFT_draw_gassep_line |
314 movlw color_yellow | 320 movlw color_yellow |
315 call TFT_set_color | 321 call TFT_set_color |
316 bsf win_invert ; Set invert flag | 322 bsf win_invert ; set invert flag |
317 WIN_SMALL dm_simtext_column,dm_simtext_row | 323 WIN_SMALL dm_simtext_column,dm_simtext_row |
318 movff menupos2,WREG ; Menupos2 holds number of menu option to show | 324 movf menupos2,W ; menupos2 holds number of menu option to show |
319 dcfsnz WREG,F | 325 dcfsnz WREG,F |
320 bra menuview_view_gaschange ; If a better gas is indicated | 326 bra menuview_view_gaschange ; check if a better gas/diluent is advised and prompt for switching if yes |
321 dcfsnz WREG,F | 327 dcfsnz WREG,F |
322 bra menuview_view1 ; "Menu?" (Not in Gauge and Anpnoe) | 328 bra menuview_view1 ; "Menu?" (skipped in gauge and apnoe modes) |
323 dcfsnz WREG,F | 329 dcfsnz WREG,F |
324 bra menuview_view2 ; "Quit Simulation?" (Sim only) | 330 bra menuview_view2 ; "Quit?" (in simulation mode only) |
325 dcfsnz WREG,F | 331 dcfsnz WREG,F |
326 bra menuview_view3 ; "Descent 1m" (Sim only) | 332 bra menuview_view3 ; "Sim-1m" (in simulation mode only) |
327 dcfsnz WREG,F | 333 dcfsnz WREG,F |
328 bra menuview_view4 ; "Ascend 1m" (Sim only) | 334 bra menuview_view4 ; "Sim+1m" (in simulation mode only) |
329 dcfsnz WREG,F | 335 dcfsnz WREG,F |
330 bra menuview_view5 ; "Quit Apnea mode?" (Apnea only) | 336 bra menuview_view5 ; "Quit?" (in apnoe mode only) |
331 dcfsnz WREG,F | 337 dcfsnz WREG,F |
332 bra menuview_view6 ; "Reset Avr." (Gauge only) | 338 bra menuview_view6 ; "Reset Avr." (in gauge mode only) |
333 dcfsnz WREG,F | 339 dcfsnz WREG,F |
334 bra menuview_view7 ; "Sim:+5mins" (Sim only) | 340 bra menuview_view7 ; "Sim+5'" (in simulation mode only) |
335 dcfsnz WREG,F | 341 dcfsnz WREG,F |
336 bra menuview_view8 ; "Heading" (When compass is shown) | 342 bra menuview_view8 ; "Heading" (only when compass is shown) |
337 dcfsnz WREG,F | 343 dcfsnz WREG,F |
338 bra menuview_view9 ; "Layout" (Alternative Layout, aka Blind mode) | 344 bra menuview_view9 ; "Layout" (offer alternative layout, aka blind mode) |
339 | 345 |
340 menuview_exit: | 346 menuview_exit: |
341 call TFT_standard_color | 347 call TFT_standard_color |
342 bcf win_invert ; Reset invert flag | 348 bcf win_invert ; reset invert flag |
343 return ; Menupos2 = 0, Show nothing | 349 btfss alternative_divelayout ; in alternative layout? |
350 bsf FLAG_TFT_active_gas_divemode; NO - redraw gas and setpoint (eventually needed to restore the "Bailout" text) | |
351 return ; menupos2 = 0, show nothing | |
344 | 352 |
345 | 353 |
346 menuview_view_gaschange: | 354 menuview_view_gaschange: |
347 btfss better_gas_available ; =1: A better gas is available | 355 btfsc divemode_gaschange ; last gas change done yet? |
348 bra menuview_toggle ; No, call next option | 356 bra menuview_toggle ; NO - call next option |
349 btfsc divemode_gaschange ; Skip if the last gas change is not done yet. | 357 btfsc FLAG_oc_mode ; in OC mode? |
350 bra menuview_toggle | 358 bra menuview_view_gaschange_OC ; YES |
351 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | 359 btfsc FLAG_bailout_mode ; in bailout? |
352 movff better_gas_number,PRODL ; number (1-5) of the "better gas" in divemode, =0: no better gas available | 360 bra menuview_view_gaschange_OC ; YES |
353 decf PRODL,F | 361 menuview_view_gaschange_DIL: |
354 call gaslist_strcat_gas_mod ; Append gas description of gas #PRODL (0-4) to current string | 362 btfss better_dil_available ; is the better diluent still available? |
363 bra menuview_toggle ; NO - call next option | |
364 movff best_dil_number,PRODL ; number (1-5) of the "best diluent" | |
365 bsf FLAG_diluent_setup ; flag to use diluents | |
366 bra menuview_view_gaschange_com | |
367 menuview_view_gaschange_OC: | |
368 btfss better_gas_available ; is the better gas still available? | |
369 bra menuview_toggle ; NO - call next option | |
370 movff best_gas_number,PRODL ; number (1-5) of the "best gas" | |
371 bcf FLAG_diluent_setup ; flag to use oc gases | |
372 menuview_view_gaschange_com: | |
373 decf PRODL,F ; (1-5) -> (0-4) | |
374 bsf short_gas_decriptions ; =1: use short version of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
375 bsf better_gas_hint ; color-code as best gas/diluent | |
376 call gaslist_strcat_gas_cd ; append gas description of gas #PRODL (0-4) to current string | |
355 movlw .5 | 377 movlw .5 |
356 movwf FSR2L ; Point to char 6 (5 chars gas description only) | 378 movwf FSR2L ; point to 6th character (5 chars are used for the gas/dil description) |
357 STRCAT_PRINT "?" | 379 STRCAT_PRINT "?" |
358 bra menuview_exit ; Done. | 380 bra menuview_exit ; done |
381 | |
359 menuview_view1: | 382 menuview_view1: |
360 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 383 btfsc FLAG_apnoe_mode ; in Apnoe mode? |
361 bra menuview_toggle ; Call next option | 384 bra menuview_toggle ; YES - goto next option |
362 btfsc FLAG_gauge_mode ; In Gauge mode? | 385 btfsc FLAG_gauge_mode ; in Gauge mode? |
363 bra menuview_toggle ; Call next option | 386 bra menuview_toggle ; YES - goto next option |
364 STRCPY_TEXT_PRINT tDivePreMenu ; "Menu?" | 387 STRCPY_TEXT_PRINT tDivePreMenu ; print "Menu?" |
365 bra menuview_exit ; Done. | 388 bra menuview_exit ; done |
389 | |
366 menuview_view2: | 390 menuview_view2: |
367 btfss simulatormode_active ; View only for simulator mode | 391 btfss simulatormode_active ; in simulator mode? |
368 bra menuview_toggle ; Call next option | 392 bra menuview_toggle ; NO - goto next option |
369 STRCPY_TEXT_PRINT tQuitSim ; "Quit Simulation?" | 393 STRCPY_TEXT_PRINT tQuitSim ; print "Quit Simulation?" |
370 bra menuview_exit ; Done. | 394 bra menuview_exit ; done |
395 | |
371 menuview_view3: | 396 menuview_view3: |
372 btfss simulatormode_active ; View only for simulator mode | 397 btfss simulatormode_active ; in simulator mode? |
373 bra menuview_toggle ; Call next option | 398 bra menuview_toggle ; NO - goto next option |
374 STRCPY_PRINT "Sim-1m" ; "-" for going down | 399 ; STRCPY_PRINT "Sim-1m" ; print "-" for going down |
375 bra menuview_exit ; Done. | 400 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down |
401 bra menuview_exit ; done | |
402 | |
376 menuview_view4: | 403 menuview_view4: |
377 btfss simulatormode_active ; View only for simulator mode | 404 btfss simulatormode_active ; in simulator mode? |
378 bra menuview_toggle ; Call next option | 405 bra menuview_toggle ; NO - goto next option |
379 STRCPY_PRINT "Sim+1m" ; "+" for going up | 406 ; STRCPY_PRINT "Sim+1m" ; "+" for going up |
380 bra menuview_exit ; Done. | 407 STRCPY_PRINT "Sim\xb9" ; print up arrow for going up |
408 bra menuview_exit ; done | |
409 | |
381 menuview_view5: | 410 menuview_view5: |
382 btfss FLAG_apnoe_mode ; In Apnoe mode? | 411 btfss FLAG_apnoe_mode ; in Apnoe mode? |
383 bra menuview_toggle ; No, call next option | 412 bra menuview_toggle ; NO - goto next option |
384 btfss FLAG_active_descent ; Are we descending? | 413 btfss FLAG_active_descent ; descending? |
385 bra menuview_toggle ; Yes | 414 bra menuview_toggle ; YES - goto next option |
386 ; We are at the surface: | 415 ; We are at the surface: |
387 STRCPY_TEXT_PRINT tQuitSim ; "Quit Apnea mode?" | 416 STRCPY_TEXT_PRINT tQuitSim ; print "Quit Apnea mode?" |
388 bra menuview_exit ; Done. | 417 bra menuview_exit ; done |
418 | |
389 menuview_view6: | 419 menuview_view6: |
390 btfss FLAG_gauge_mode ; In Gauge mode? | 420 btfss FLAG_gauge_mode ; in Gauge mode? |
391 bra menuview_toggle ; No, call next option | 421 bra menuview_toggle ; NO - goto next option |
392 STRCPY_TEXT_PRINT tDivemenu_ResetAvg; "Reset Avg." | 422 STRCPY_TEXT_PRINT tDivemenu_ResetAvg; print "Reset Avg." |
393 bra menuview_exit ; Done. | 423 bra menuview_exit ; done |
424 | |
394 menuview_view7: | 425 menuview_view7: |
395 btfss simulatormode_active ; View only for simulator mode | 426 btfss simulatormode_active ; in simulator mode? |
396 bra menuview_toggle ; Call next option | 427 bra menuview_toggle ; NO - goto next option |
397 btfsc FLAG_gauge_mode ; In Gauge mode? | 428 btfsc FLAG_gauge_mode ; in Gauge mode? |
398 bra menuview_toggle ; Yes, call next option | 429 bra menuview_toggle ; YES - goto next option |
399 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 430 btfsc FLAG_apnoe_mode ; in Apnoe mode? |
400 bra menuview_toggle ; Yes, call next option | 431 bra menuview_toggle ; YES - goto next option |
401 STRCPY_PRINT "Sim+5'" | 432 STRCPY_PRINT "Sim+5'" ; print "Sim+5'" |
402 bra menuview_exit ; Done. | 433 bra menuview_exit ; done |
434 | |
403 menuview_view8: | 435 menuview_view8: |
404 movlw .6 | 436 movlw index_compass_dm ; index of compass view |
405 cpfseq menupos3 ; in compass view? | 437 cpfseq menupos3 ; in compass view? |
406 bra menuview_toggle ; No, call next option | 438 bra menuview_toggle ; NO - goto next option |
407 STRCPY_TEXT_PRINT tSetHeading ; "Heading" | 439 STRCPY_TEXT_PRINT tSetHeading ; print "Heading" |
408 bra menuview_exit ; Done. | 440 bra menuview_exit ; done |
441 | |
409 menuview_view9: | 442 menuview_view9: |
410 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 443 btfsc FLAG_apnoe_mode ; in Apnoe mode? |
411 bra menuview_toggle ; Yes, call next option | 444 bra menuview_toggle ; YES - goto next option |
412 btfsc FLAG_gauge_mode ; In Gauge mode? | |
413 bra menuview_toggle ; Yes, call next option | |
414 STRCPY_PRINT "Layout" | 445 STRCPY_PRINT "Layout" |
415 bra menuview_exit ; Done. | 446 bra menuview_exit ; done |
416 | 447 |
417 ;============================================================================= | 448 ;============================================================================= |
418 | 449 |
450 global customview_mask_alternative | |
419 customview_toggle_alternative: | 451 customview_toggle_alternative: |
420 movlw d'1' ; Max number of customviews in divemode, alternative layout | 452 call I2C_sleep_accelerometer ; no compass in alternative layout - stop accelerometer |
421 cpfsgt menupos3 ; Max reached? | 453 call I2C_sleep_compass ; no compass in alternative layout - stop compass |
422 bra customview_mask_alternative ; No, show | 454 movlw d'0' ; max number of custom views in divemode, alternative layout |
423 movlw .1 | 455 cpfsgt menupos3 ; max reached? |
424 movwf menupos3 ; Reset to one, always one customview visible in alternative layout | 456 bra customview_mask_alternative ; NO - show |
425 customview_mask_alternative: | 457 clrf menupos3 ; reset to zero (zero = default custom view in alternative layout) |
458 customview_mask_alternative: | |
426 ; Clear custom view area in divemode | 459 ; Clear custom view area in divemode |
427 WIN_BOX_BLACK dm_customview_row, .239, .0, .159 ; top, bottom, left, right | 460 WIN_BOX_BLACK dm_customview_row, .239, .0, .159 ; top, bottom, left, right |
428 call TFT_standard_color | 461 movf menupos3,W ; menupos3 holds number of custom view function |
429 movff menupos3,WREG ; Menupos3 holds number of customview function | 462 dcfsnz WREG,F |
430 dcfsnz WREG,F | 463 bra customview_alt_init_view1 ; view 1: -- for test only -- |
431 bra customview_alt_init_view1 ; View 1: Big deco/ndl and max. depth | 464 dcfsnz WREG,F |
432 dcfsnz WREG,F | 465 nop ; view 2: ... |
433 bra customview_alt_init_view2 ; View 2: | 466 ;bra customview_alt_init_view0 ; default view: big deco/ndl and max. depth |
434 | 467 |
435 ;bra customview_alternative_toggle_exit ; No view (menupos3=0) | 468 customview_alt_init_view0: ; default view: big deco/ndl and max. depth |
436 | |
437 customview_alt_toggle_exit: | |
438 call TFT_standard_color | |
439 bcf toggle_customview ; Clear flag | |
440 return | |
441 | |
442 customview_alt_init_view1: ; View 1: Big deco/ndl and max. depth | |
443 call TFT_max_depth_alternative | 469 call TFT_max_depth_alternative |
444 call TFT_big_deco_alt | 470 call TFT_big_deco_alt |
445 bra customview_alt_toggle_exit | 471 bra customview_alt_toggle_exit |
446 | 472 |
447 customview_alt_init_view2: | 473 customview_alt_init_view1: ; view 1 - just for test use |
448 ; /* Just for test... | 474 call TFT_avr_stopwatch_mask ; mask for average depth and stopwatch |
449 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch | 475 call TFT_avr_stopwatch ; data for average depth and stopwatch |
450 call TFT_update_avr_stopwatch ; Update average depth and stopwatch | |
451 ; ...Just for test */ | |
452 bra customview_alt_toggle_exit | 476 bra customview_alt_toggle_exit |
453 | 477 |
454 | 478 customview_alt_toggle_exit: |
455 ; Show next customview (and delete this flag) | 479 bcf toggle_customview ; clear flag |
480 return | |
481 | |
482 | |
483 ; Show next dive mode custom view (and delete this flag) | |
456 global customview_toggle | 484 global customview_toggle |
457 customview_toggle: | 485 customview_toggle: |
458 bcf switch_right | 486 bcf switch_right |
459 incf menupos3,F ; Number of customview to show | 487 incf menupos3,F ; number of custom view to show |
460 | 488 |
461 btfsc alternative_divelayout ; In alternative layout mode? | 489 btfsc alternative_divelayout ; in alternative layout mode? |
462 bra customview_toggle_alternative ; Yes, use the big ones instead | 490 bra customview_toggle_alternative ; YES - use the big ones instead |
463 | 491 |
464 movlw d'13' ; Max number of customviews in divemode | 492 movlw index_compass_dm ; index of custom view compass |
465 cpfsgt menupos3 ; Max reached? | 493 cpfseq menupos3 ; will compass be shown in custom view? |
466 bra customview_mask ; No, show | 494 call I2C_sleep_accelerometer ; NO - stop accelerometer |
467 clrf menupos3 ; Reset to zero (Zero=no custom view) | 495 cpfseq menupos3 ; will compass be shown in custom view? |
468 | 496 call I2C_sleep_compass ; NO - stop compass |
497 | |
498 movlw index_cv_dm_max ; highest index in use in dive mode custom view | |
499 cpfsgt menupos3 ; max reached? | |
500 bra customview_mask ; NO - show | |
501 clrf menupos3 ; reset to zero (zero = no custom view) | |
502 | |
503 ;---------------------------------------------------------------------------------- | |
504 ; Jump table for initialization of the every-second tasks in custom view area (dive mode) | |
505 ; | |
506 ; Attention: the ordering must be in line with the every-second update jump table | |
507 ; and the index numbers defined in hwos.inc! | |
508 ; | |
469 global customview_mask | 509 global customview_mask |
470 customview_mask: | 510 customview_mask: |
511 bcf redraw_custview_mask ; clear redraw request flag | |
471 ; Clear custom view area in divemode | 512 ; Clear custom view area in divemode |
472 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right | 513 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
473 WIN_SMALL dm_customview_column,dm_customview_row | 514 movf menupos3,W ; menupos3 holds number of custom view function |
474 call TFT_standard_color | 515 dcfsnz WREG,F ; 1: |
475 movff menupos3,WREG ; Menupos3 holds number of customview function | 516 bra init_avr_stopwatch ; average depth and stopwatch |
476 dcfsnz WREG,F | 517 dcfsnz WREG,F ; 2: |
477 bra customview_init_view1 ; Update Sensor data | 518 bra init_TFT_dive_compass ; compass |
478 dcfsnz WREG,F | 519 dcfsnz WREG,F ; 3: |
479 bra customview_init_view2 ; average depth and stopwatch | 520 bra init_ppo2_sensors ; ppO2 sensors |
480 dcfsnz WREG,F | 521 dcfsnz WREG,F ; 4: |
481 bra customview_init_view3 ; Decoplan | 522 bra init_sensor_check ; sensor check |
482 dcfsnz WREG,F | 523 dcfsnz WREG,F ; 5: |
483 bra customview_init_view4 ; Battery info, Tissues and clock | 524 bra init_pscr_info ; pSCR data |
484 dcfsnz WREG,F | 525 dcfsnz WREG,F ; 6: |
485 bra customview_init_view5 ; GF informations | 526 bra init_pressures_SAC ; tank pressure and SAC rate |
486 dcfsnz WREG,F | 527 dcfsnz WREG,F ; 7: |
487 bra customview_init_view6 ; Compass | 528 bra init_gas_needs_ascent ; gas needs for ascent / cave return |
488 dcfsnz WREG,F | 529 dcfsnz WREG,F ; 8: |
489 bra customview_init_view7 ; Dynamic gaslist | 530 bra init_decoplan ; deco plan |
490 dcfsnz WREG,F | 531 dcfsnz WREG,F ; 9: |
491 bra customview_init_view8 ; CNS | 532 bra init_ceiling_GF_tissue ; ceiling, current GF and tissues |
492 dcfsnz WREG,F | 533 dcfsnz WREG,F ; 10: |
493 bra customview_init_view9 ; ppO2, Ceiling and current GF | 534 bra init_CNS ; CNS values |
494 dcfsnz WREG,F | 535 dcfsnz WREG,F ; 11: |
495 bra customview_init_view10 ; Sensor check | 536 bra init_ppo2_ead_end_cns ; ppO2, END/EAD and CNS |
496 dcfsnz WREG,F | 537 dcfsnz WREG,F ; 12: |
497 bra customview_init_view11 ; ppO2, END/EAD and CNS | 538 bra init_gf_factors ; GF factors |
498 dcfsnz WREG,F | 539 dcfsnz WREG,F ; 13: |
499 bra customview_init_view12 ; PSCR Info | 540 bra init_clock_batt_surfpress ; clock, battery and surface pressure |
500 dcfsnz WREG,F | 541 bra customview_toggle_exit ; no view (blank screen in custom view area) |
501 bra customview_init_view13 ; Gas needs | 542 |
502 | 543 |
503 customview_init_nocustomview: | 544 init_ppo2_sensors: |
504 call I2C_sleep_accelerometer ; Stop accelerometer | 545 btfsc FLAG_ccr_mode ; in CC mode? |
505 call I2C_sleep_compass ; Stop compass | 546 bra customview_init_view1a ; YES |
506 bra customview_toggle_exit | 547 btfsc FLAG_pscr_mode ; in PSCR mode? |
507 | 548 bra customview_init_view1a ; YES |
508 customview_init_view1: | 549 bra customview_toggle ; NO to both, call next view |
509 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
510 bra customview_toggle ; yes, Call next view... | |
511 btfsc FLAG_pscr_mode ; In PSCR mode? | |
512 bra customview_init_view1a ; Yes | |
513 btfss FLAG_ccr_mode ; In CC mode? | |
514 bra customview_toggle ; no, Call next view... | |
515 | |
516 customview_init_view1a: | 550 customview_init_view1a: |
517 btfsc analog_o2_input ; do we have an analog input? | 551 btfsc analog_o2_input ; do we have an analog input? |
518 bra customview_init_view1b ; YES - show this view | 552 bra customview_init_view1b ; YES - show this view |
519 btfsc s8_digital ; NO - do we have a digital input? | 553 btfsc s8_digital ; NO - do we have a digital input? |
520 bra customview_init_view1b ; YES - show this view | 554 bra customview_init_view1b ; YES - show this view |
521 btfss optical_input ; NO - do we have an optical input? | 555 btfss optical_input ; NO - do we have an optical input? |
522 bra customview_toggle ; NO - call next view... | 556 bra customview_toggle ; NO - call next view |
523 | |
524 ; YES - show this view | 557 ; YES - show this view |
525 customview_init_view1b: | 558 customview_init_view1b: |
526 call TFT_hud_mask ; Setup HUD mask | 559 call TFT_ppo2_sensors_mask ; mask for ppO2 sensors |
527 call TFT_update_ppo2_sensors ; Update Sensor data | 560 call TFT_ppo2_sensors ; data for ppO2 sensors |
528 bra customview_toggle_exit | 561 bra customview_toggle_exit |
529 | 562 |
530 customview_init_view2: | 563 init_avr_stopwatch: |
531 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 564 btfsc FLAG_apnoe_mode ; in apnoe mode? |
532 bra customview_toggle ; Yes, Call next view... | 565 bra customview_toggle ; YES - call next view |
533 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch | 566 call TFT_avr_stopwatch_mask ; mask for average depth and stopwatch |
534 call TFT_update_avr_stopwatch ; Update average depth and stopwatch | 567 call TFT_avr_stopwatch ; data for average depth and stopwatch |
535 bra customview_toggle_exit | 568 bra customview_toggle_exit |
536 | 569 |
537 customview_init_view3: | 570 init_decoplan: |
538 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 571 btfsc FLAG_apnoe_mode ; in apnoe mode? |
539 bra customview_toggle ; Yes, Call next view... | 572 bra customview_toggle ; YES - call next view |
540 btfsc FLAG_gauge_mode ; In Gauge mode? | 573 btfsc FLAG_gauge_mode ; in gauge mode? |
541 bra customview_toggle ; Yes, Call next view... | 574 bra customview_toggle ; YES - call next view |
542 call TFT_decoplan ; Show decoplan | 575 call TFT_decoplan_mask ; mask for deco plan |
543 bra customview_toggle_exit | 576 call TFT_decoplan ; data for deco plan |
544 | 577 bra customview_toggle_exit |
545 customview_init_view4: | 578 |
546 call TFT_battinfo_tissues_clock_mask ; Setup Mask | 579 init_clock_batt_surfpress: |
547 call TFT_battinfo_tissues_clock ; Show Battery info, Tissues and clock | 580 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure |
548 bra customview_toggle_exit | 581 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure |
549 | 582 bra customview_toggle_exit |
550 customview_init_view5: | 583 |
551 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 584 init_gf_factors: |
552 bra customview_toggle ; Yes, Call next view... | 585 btfsc FLAG_apnoe_mode ; in apnoe mode? |
553 btfsc FLAG_gauge_mode ; In Gauge mode? | 586 bra customview_toggle ; YES - call next view |
554 bra customview_toggle ; Yes, Call next view... | 587 btfsc FLAG_gauge_mode ; in gauge mode? |
555 | 588 bra customview_toggle ; YES - call next view |
556 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF | 589 TSTOSS char_I_deco_model ; in GF mode (0 = ZH-L16, 1 = ZH-L16-GF)? |
557 bra customview_toggle ; No GF info for non-GF modes | 590 bra customview_toggle ; NO - no GF info for non-GF modes |
558 | 591 call TFT_gf_factors_mask ; mask for GF factors |
559 call TFT_gf_mask ; Setup Mask | 592 call TFT_gf_factors ; data for GF factors |
560 call TFT_gf_info ; Show GF informations | 593 bra customview_toggle_exit |
561 bra customview_toggle_exit | 594 |
562 | 595 init_TFT_dive_compass: ; compass |
563 customview_init_view6: ; Compass (View 6) | 596 call I2C_init_accelerometer ; start accelerometer |
564 call I2C_init_accelerometer ; Start accelerometer | 597 call I2C_init_compass ; start compass |
565 call I2C_init_compass ; Start compass | 598 call TFT_dive_compass_mask ; show compass mask |
566 call TFT_dive_compass_mask ; Show compass | 599 bra customview_toggle_exit |
567 bra customview_toggle_exit | 600 |
568 | 601 init_pressures_SAC: ; tank pressure and SAC rate |
569 customview_init_view7: ; view disabled | 602 IFDEF _rx_functions |
570 bra customview_toggle | 603 btfss FLAG_tr_enabled ; TR functions enabled? |
571 | 604 bra customview_toggle ; NO - call next view |
572 customview_init_view8: ; CNS at end of dive | 605 call TFT_pressures_SAC_mask ; mask for pressures and SAC |
573 btfsc FLAG_gauge_mode ; In Gauge mode? | 606 call TFT_pressures_SAC ; data for pressures and SAC |
574 bra customview_toggle ; Yes, Call next view... | 607 bra customview_toggle_exit |
575 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 608 ELSE |
576 bra customview_toggle ; yes, Call next view... | 609 bra customview_toggle ; skip, not available without RX functions |
577 call TFT_CNS_mask | 610 ENDIF |
578 call TFT_CNS | 611 |
579 goto customview_toggle_exit | 612 init_CNS: ; CNS at end of dive |
580 | 613 btfsc FLAG_gauge_mode ; in Gauge mode? |
581 customview_init_view9: ; ppO2, Ceiling and current GF | 614 bra customview_toggle ; YES - call next view |
582 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 615 btfsc FLAG_apnoe_mode ; in apnoe mode? |
583 bra customview_toggle ; yes, Call next view... | 616 bra customview_toggle ; YES - call next view |
584 btfsc FLAG_gauge_mode ; In Gauge mode? | 617 call TFT_CNS_mask ; mask for CNS values |
585 bra customview_toggle ; Yes, Call next view... | 618 call TFT_CNS ; data for CNS values |
586 call TFT_ceiling_mask ; Setup mask | 619 bra customview_toggle_exit |
587 call TFT_ceiling ; Show Ceiling | 620 |
588 | 621 init_ceiling_GF_tissue: ; ceiling, tissues and current GF |
589 ; ppO2 value | 622 btfsc FLAG_apnoe_mode ; in apnoe mode? |
590 call TFT_mask_ppo2 | 623 bra customview_toggle ; YES - call next view |
591 call TFT_display_pure_ppo2 | 624 btfsc FLAG_gauge_mode ; in gauge mode? |
592 | 625 bra customview_toggle ; YES - call next view |
593 ; current GF value | 626 call TFT_ceiling_GF_tissue_mask ; mask for ceiling, current GF and tissues |
594 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF | 627 call TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues |
595 bra customview_toggle_exit ; No GF info for non-GF modes | 628 bra customview_toggle_exit |
596 ; current GF value | 629 |
597 call TFT_gf_mask_cGF ; Setup Mask - current GF only | 630 init_sensor_check: ; sensor check |
598 call TFT_gf_info ; Show GF informations | 631 btfsc FLAG_ccr_mode ; in CCR mode? |
599 bra customview_toggle_exit | 632 bra customview_init_view10a ; YES |
600 | 633 ; btfsc FLAG_pscr_mode ; in pSCR mode? |
601 customview_init_view10: ; Sensor check | 634 ; bra customview_init_view10a ; YES |
602 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 635 bra customview_toggle ; NO to both, call next view |
603 bra customview_toggle ; yes, Call next view... | 636 customview_init_view10a: |
604 btfsc FLAG_gauge_mode ; In Gauge mode? | 637 call TFT_sensor_check_mask ; mask for sensor check |
605 bra customview_toggle ; Yes, Call next view... | 638 call TFT_sensor_check ; data for sensor check |
606 btfss FLAG_ccr_mode ; In CC mode? | 639 bra customview_toggle_exit |
607 bra customview_toggle ; no, Call next view... | 640 |
608 | 641 init_ppo2_ead_end_cns: ; ppO2, END/EAD and CNS |
609 call TFT_sensor_check_mask ; Show ppO2 of O2 and Diluent mask | 642 btfsc FLAG_apnoe_mode ; in apnoe mode? |
610 call TFT_sensor_check ; Show ppO2 of O2 and Diluent | 643 bra customview_toggle ; YES - call next view |
611 bra customview_toggle_exit | 644 btfsc FLAG_gauge_mode ; in gauge mode? |
612 | 645 bra customview_toggle ; YES - call next view |
613 customview_init_view11: ; ppO2, END/EAD and CNS | 646 call TFT_ppo2_ead_end_cns_mask ; mask for ppO2, END/EAD and CNS |
614 btfsc FLAG_apnoe_mode ; In Apnoe mode? | 647 call TFT_ppo2_ead_end_cns ; data for ppO2, END/EAD and CNS |
615 bra customview_toggle ; yes, Call next view... | 648 bra customview_toggle_exit |
616 btfsc FLAG_gauge_mode ; In Gauge mode? | 649 |
617 bra customview_toggle ; Yes, Call next view... | 650 init_pscr_info: ; pSCR information |
618 | 651 btfss FLAG_pscr_mode ; in pSCR mode? |
619 call TFT_ppo2_ead_end_cns_mask ; Show ppO2, END/EAD and CNS mask | 652 bra customview_toggle ; NO - call next view |
620 call TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS | 653 call TFT_pscr_info_mask ; mask for pSCR info |
621 goto customview_toggle_exit | 654 call TFT_pscr_info ; data for pSCR info |
622 | 655 bra customview_toggle_exit |
623 customview_init_view12: ; PSCR Info | 656 |
624 btfss FLAG_pscr_mode ; In PSCR mode? | 657 init_gas_needs_ascent: ; gas needs for ascent |
625 bra customview_toggle ; No, Call next view... | 658 btfsc FLAG_apnoe_mode ; in apnoe mode? |
626 | 659 bra customview_toggle ; YES - call next view |
627 call TFT_pscr_info_mask ; Show ppO2, drop and lung ratio | 660 btfsc FLAG_gauge_mode ; in gauge mode? |
628 call TFT_pscr_info ; Show ppO2, drop and lung ratio | 661 bra customview_toggle ; YES - call next view |
629 bra customview_toggle_exit | 662 TSTOSS opt_calc_asc_gasvolume ; check if gas volume calculation is switched on |
630 | 663 bra customview_toggle ; NO - call next view |
631 customview_init_view13: ; Gas Needs | 664 call TFT_gas_needs_ascent_mask ; mask for gas needs ascent |
632 TSTOSS opt_calc_asc_gasvolume ; check if gas volume calculations is switched on | 665 call TFT_gas_needs_ascent ; data for gas needs ascent |
633 bra customview_toggle ; NO - Call next view... | |
634 call TFT_gas_needs_mask ; YES - Show the mask for gas needs | |
635 call TFT_gas_needs ; Show the gas needs | |
636 bra customview_toggle_exit | 666 bra customview_toggle_exit |
637 | 667 |
638 customview_toggle_exit: | 668 customview_toggle_exit: |
639 btfsc divemode ; In Dive Mode? | 669 bcf toggle_customview ; clear flag |
640 bsf FLAG_TFT_temp_divemode ; Set flag to redraw temp | 670 btfsc divemode ; in dive mode? |
641 call TFT_standard_color | 671 bsf FLAG_TFT_temp_divemode ; YES - set flag to redraw temp |
642 bcf toggle_customview ; Clear flag | |
643 return | 672 return |
644 | 673 |
645 global customview_show_change_depth | |
646 customview_show_change_depth: ; Put " lom" or " loft" into Postinc2 | |
647 PUTC " " | |
648 TSTOSS opt_units ; 0=m, 1=ft | |
649 bra customview_show_mix_metric | |
650 movf lo,W | |
651 mullw .100 ; convert meters to mbar | |
652 movff PRODL,lo | |
653 movff PRODH,hi | |
654 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
655 bsf leftbind | |
656 output_16 ; Change depth in lo:hi | |
657 bcf leftbind | |
658 STRCAT_TEXT tFeets | |
659 return | |
660 customview_show_mix_metric: | |
661 output_99 ; Change depth in lo | |
662 STRCAT_TEXT tMeters | |
663 return | |
664 | |
665 | 674 |
666 global customview_show_mix | 675 global customview_show_mix |
667 customview_show_mix: ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | 676 customview_show_mix: ; put "Nxlo", "Txlo/hi", "Air" or "O2" into postinc2 |
668 tstfsz hi ; He=0? | 677 tstfsz hi ; He=0? |
669 bra customview_show_mix5 ; No, Show a TX | 678 bra customview_show_mix5 ; NO - show a TX |
670 movlw .21 | 679 movlw .21 |
671 cpfseq lo ; Air? | 680 cpfseq lo ; Air? |
672 bra customview_show_mix2 ; No | 681 bra customview_show_mix2 ; NO |
673 STRCAT_TEXT tSelectAir ; Yes, show "Air" | 682 STRCAT_TEXT tSelectAir ; YES - show "Air" |
674 bra customview_show_mix4b | 683 bra customview_show_mix4b |
675 customview_show_mix2: | 684 customview_show_mix2: |
676 movlw .100 | 685 movlw .100 |
677 cpfseq lo ; O2? | 686 cpfseq lo ; O2? |
678 bra customview_show_mix3 ; No | 687 bra customview_show_mix3 ; NO |
679 STRCAT_TEXT tSelectO2 ; Yes, show "O2" | 688 STRCAT_TEXT tSelectO2 ; YES - show "O2" |
680 bra customview_show_mix4b | 689 bra customview_show_mix4b |
681 | |
682 customview_show_mix3: | 690 customview_show_mix3: |
683 movlw .21 | 691 movlw .21 |
684 cpfslt lo ; < Nx21? | 692 cpfslt lo ; < Nx21? |
685 bra customview_show_mix4 ; No | 693 bra customview_show_mix4 ; NO |
686 STRCAT_TEXT tGasErr ; Yes, show "Err" | 694 STRCAT_TEXT tGasErr ; YES - show "Err" |
687 output_99 ; O2 ratio is still in "lo" | 695 output_99 ; O2 ratio is still in "lo" |
688 bra customview_show_mix4c | 696 bra customview_show_mix4c |
689 | |
690 customview_show_mix4: | 697 customview_show_mix4: |
691 STRCAT_TEXT tSelectNx ; Show "Nx" | 698 STRCAT_TEXT tSelectNx ; show "Nx" |
692 output_99 ; O2 ratio is still in "lo" | 699 output_99 ; O2 ratio is still in "lo" |
693 customview_show_mix4b: | 700 customview_show_mix4b: |
694 STRCAT " " | 701 STRCAT " " |
695 customview_show_mix4c: | 702 customview_show_mix4c: |
696 btfsc divemode ; In divemode | 703 btfsc divemode ; in divemode? |
697 return ; Yes | 704 return ; YES |
698 STRCAT " " | 705 STRCAT " " |
699 return | 706 return |
700 | |
701 customview_show_mix5: | 707 customview_show_mix5: |
702 btfsc divemode | 708 btfsc divemode |
703 bra customview_show_mix6 | 709 bra customview_show_mix6 |
704 STRCAT_TEXT tSelectTx ; Show "Tx" | 710 STRCAT_TEXT tSelectTx ; show "Tx" |
705 customview_show_mix6: | 711 customview_show_mix6: |
706 output_99 ; O2 ratio is still in "lo" | 712 output_99 ; O2 ratio is still in "lo" |
707 PUTC "/" | 713 PUTC "/" |
708 movff hi,lo | 714 movff hi,lo |
709 output_99 ; He ratio | 715 output_99 ; He ratio |