Mercurial > public > hwos_code
annotate src/customview.asm @ 619:e76a87e087ef
3.00 release
author | heinrichsweikamp |
---|---|
date | Wed, 06 Feb 2019 13:43:02 +0100 |
parents | d866684249bd |
children | c40025d8e750 be8787f2034d |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
604 | 3 ; File customview.asm REFACTORED VERSION V2.99e |
0 | 4 ; |
604 | 5 ; Custom Views in Surface and Dive Mode |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-10 : [mH] moving from OSTC code | |
11 | |
12 ;============================================================================= | |
13 | |
604 | 14 #include "hwos.inc" ; mandatory header |
582 | 15 #include "tft_outputs.inc" |
16 #include "strings.inc" | |
17 #include "tft.inc" | |
18 #include "isr.inc" | |
19 #include "wait.inc" | |
20 #include "surfmode.inc" | |
21 #include "convert.inc" | |
22 #include "divemode.inc" | |
23 #include "i2c.inc" | |
24 #include "start.inc" | |
0 | 25 |
582 | 26 |
604 | 27 extern gaslist_strcat_gas_cd |
582 | 28 extern char_I_deco_model |
29 extern TFT_surface_compass_mask | |
30 extern TFT_dive_compass_mask | |
31 | |
604 | 32 custview CODE |
0 | 33 |
34 ;============================================================================= | |
604 | 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! | |
0 | 39 |
40 global customview_second | |
41 customview_second: | |
604 | 42 movf menupos3,W ; copy current view (1-...) |
43 dcfsnz WREG,F ; 1: | |
44 goto TFT_avr_stopwatch ; average depth and stopwatch | |
45 dcfsnz WREG,F ; 2: | |
46 return ; compass - will be updated separately (faster) in divemode | |
47 dcfsnz WREG,F ; 3: | |
48 goto TFT_ppo2_sensors ; ppO2 sensors | |
49 dcfsnz WREG,F ; 4: | |
50 goto TFT_sensor_check ; sensor check | |
51 dcfsnz WREG,F ; 5; | |
52 goto TFT_pscr_info ; pSCR data | |
53 dcfsnz WREG,F ; 6: | |
54 IFDEF _rx_functions | |
55 goto TFT_pressures_SAC ; tank pressure and SAC rate | |
56 ELSE | |
57 return ; not available without RX functions | |
58 ENDIF | |
59 dcfsnz WREG,F ; 7: | |
60 goto TFT_gas_needs_ascent ; gas needs for ascent / cave return | |
61 dcfsnz WREG,F ; 8: | |
62 goto TFT_decoplan ; deco plan | |
63 dcfsnz WREG,F ; 9: | |
64 goto TFT_ceiling_GF_tissue ; ceiling, current GF and tissues | |
65 dcfsnz WREG,F ; 10: | |
66 goto TFT_CNS ; CNS values | |
67 dcfsnz WREG,F ; 11: | |
68 goto TFT_ppo2_ead_end_cns ; ppO2, END/EAD and CNS | |
69 dcfsnz WREG,F ; 12: | |
608 | 70 return ; GF factors - only static data |
604 | 71 dcfsnz WREG,F ; 13: |
72 goto TFT_clock_batt_surfpress ; clock, battery and surface pressure | |
73 return ; menupos3 = 0 -> do nothing | |
482
c0ee33f1f399
New customview #12 for PSCR mode shows ppO2, O2 drop and lung ratio
heinrichsweikamp
parents:
476
diff
changeset
|
74 |
123 | 75 |
582 | 76 global customview_alternative_second |
77 customview_alternative_second: | |
604 | 78 movf menupos3,W ; copy current view (0-...) |
560 | 79 dcfsnz WREG,F |
604 | 80 nop ; view 1 |
560 | 81 dcfsnz WREG,F |
604 | 82 nop ; view 2 |
83 ;bra customview_alt_second_view0 ; default view | |
413
12e85930d95c
NEW: New Customview shows ppO2(O2) and ppO2(Diluent) during CCR mode
heinrichsweikamp
parents:
376
diff
changeset
|
84 |
604 | 85 customview_alt_second_view0: |
582 | 86 bsf FLAG_TFT_big_deco_alt |
87 return | |
0 | 88 |
89 ;============================================================================= | |
90 ; Do every-minute tasks for the custom view area | |
91 | |
92 global customview_minute | |
604 | 93 customview_minute: ; called from dive mode, call disabled at present |
582 | 94 return |
604 | 95 ; movf menupos3,W ; copy |
0 | 96 ; dcfsnz WREG,F |
97 ; bra customview_1min_view1 | |
98 ; dcfsnz WREG,F | |
99 ; bra customview_1min_view2 | |
100 ; dcfsnz WREG,F | |
101 ; bra customview_1min_view3 | |
102 ; dcfsnz WREG,F | |
103 ; bra customview_1min_view4 | |
104 ; dcfsnz WREG,F | |
105 ; bra customview_1min_view5 | |
106 ; dcfsnz WREG,F | |
107 ; bra customview_1min_view6 | |
108 ; dcfsnz WREG,F | |
109 ; bra customview_1min_view7 | |
110 ; dcfsnz WREG,F | |
111 ; bra customview_1min_view8 | |
112 ; dcfsnz WREG,F | |
113 ; bra customview_1min_view9 | |
114 ; dcfsnz WREG,F | |
115 ; bra customview_1min_view10 | |
116 ; dcfsnz WREG,F | |
117 ; bra customview_1min_view11 | |
604 | 118 ; ; menupos3=0, do nothing |
0 | 119 ; return |
120 ; | |
121 ;customview_1min_view1: | |
122 ;customview_1min_view2: | |
123 ;customview_1min_view3: | |
124 ;customview_1min_view4: | |
125 ;customview_1min_view5: | |
126 ;customview_1min_view6: | |
127 ;customview_1min_view7: | |
128 ;customview_1min_view8: | |
129 ;customview_1min_view9: | |
130 ;customview_1min_view10: | |
131 ;customview_1min_view11: | |
582 | 132 ;return |
0 | 133 |
582 | 134 global surf_customview_toggle |
0 | 135 surf_customview_toggle: |
136 bcf switch_right | |
604 | 137 incf menupos3,F ; number of custom view to show |
138 | |
139 movlw .6 ; index of surface custom view compass | |
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 | |
582 | 148 movlw .1 |
604 | 149 movwf menupos3 ; reset to one (always one custom view visible) |
0 | 150 |
582 | 151 global surf_customview_mask |
0 | 152 surf_customview_mask: |
582 | 153 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right |
154 ; Prepare title | |
155 WIN_TINY surf_customview_title_column,surf_customview_title_row | |
156 WIN_COLOR color_greenish | |
604 | 157 movf menupos3,W ; menupos3 holds number of custom view function |
158 dcfsnz WREG,F ; 1: | |
159 bra surf_customview_init_view1 ; OC gas list | |
160 dcfsnz WREG,F ; 2: | |
161 bra surf_customview_init_view2 ; CC dil list | |
162 dcfsnz WREG,F ; 3: | |
582 | 163 bra surf_customview_init_view3 ; CC SP list |
604 | 164 dcfsnz WREG,F ; 4: |
165 bra surf_customview_init_view4 ; custom text | |
166 dcfsnz WREG,F ; 5: | |
167 bra surf_customview_init_view5 ; tissue diagram | |
168 dcfsnz WREG,F ; 6: | |
169 bra surf_customview_init_view6 ; compass | |
170 dcfsnz WREG,F ; 7: | |
171 bra surf_customview_init_view7 ; deco settings | |
172 dcfsnz WREG,F ; 8: | |
173 bra surf_customview_init_view8 ; last dive info | |
174 dcfsnz WREG,F ; 9: | |
175 bra surf_customview_init_view9 ; sensor mV readings | |
176 dcfsnz WREG,F ; 10: | |
177 bra surf_customview_init_view10 ; tank data | |
178 bra surf_customview_init_view4 ; default view after restart and loading new firmware | |
0 | 179 |
604 | 180 surf_customview_init_view1: ; view 1: OC Gas list |
582 | 181 btfsc FLAG_gauge_mode |
182 bra surf_customview_toggle | |
183 btfsc FLAG_apnoe_mode | |
184 bra surf_customview_toggle | |
604 | 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 | |
582 | 192 call TFT_standard_color |
604 | 193 call TFT_gaslist_surfmode ; show gas list |
194 bra customview_toggle_exit ; done | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
184
diff
changeset
|
195 |
604 | 196 surf_customview_init_view2: ; view 2: CCR / pSCR diluent list |
197 btfsc FLAG_ccr_mode | |
198 bra surf_customview_init_view2a | |
582 | 199 btfsc FLAG_pscr_mode |
604 | 200 bra surf_customview_init_view2a |
582 | 201 bra surf_customview_toggle |
604 | 202 surf_customview_init_view2a: |
203 STRCPY_TEXT_PRINT tGaslistCC ; title of custom view | |
582 | 204 call TFT_standard_color |
604 | 205 call TFT_dillist_surfmode ; show diluent list |
206 bra customview_toggle_exit ; done | |
582 | 207 |
604 | 208 surf_customview_init_view3: ; view 3: CC SP list |
209 btfsc FLAG_ccr_mode | |
210 bra surf_customview_init_view3a | |
582 | 211 bra surf_customview_toggle |
604 | 212 surf_customview_init_view3a: |
213 STRCPY_TEXT_PRINT tFixedSetpoints ; title of custom view | |
582 | 214 call TFT_standard_color |
604 | 215 call TFT_splist_surfmode ; show setpoint list |
216 bra customview_toggle_exit ; done | |
0 | 217 |
604 | 218 surf_customview_init_view9: ; view 9: sensor mV at the surface |
582 | 219 btfsc FLAG_ccr_mode |
604 | 220 bra surf_customview_init_view9a ; we are in CCR mode |
582 | 221 btfsc FLAG_pscr_mode |
222 bra surf_customview_init_view9a ; we are in PSCR mode | |
604 | 223 bra surf_customview_toggle ; we are not in any rebreather mode, so skip |
224 surf_customview_init_view9a: | |
225 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: Sensor, =2: auto SP | |
226 sublw .1 ; opt_ccr_mode = 1 (sensor)? | |
227 bnz surf_customview_toggle ; sorry, no sensors, skip again | |
228 STRCPY_TEXT_PRINT tSensorMilliVolt ; title of custom view | |
582 | 229 call TFT_sensor_mV ; write sensor mV readings to screen |
604 | 230 bra customview_toggle_exit ; done |
0 | 231 |
604 | 232 surf_customview_init_view4: ; view 4: custom text |
233 call TFT_custom_text ; show the custom text | |
234 bra customview_toggle_exit ; done | |
0 | 235 |
604 | 236 surf_customview_init_view5: ; view 5: tissue diagram |
582 | 237 btfsc FLAG_gauge_mode |
238 bra surf_customview_toggle | |
239 btfsc FLAG_apnoe_mode | |
240 bra surf_customview_toggle | |
241 call TFT_standard_color | |
604 | 242 call TFT_surface_tissues ; show tissue diagram |
243 bra customview_toggle_exit ; done | |
0 | 244 |
604 | 245 surf_customview_init_view6: ; view 6: compass |
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 | |
582 | 250 |
41 | 251 surf_customview_init_view7: |
604 | 252 btfsc FLAG_gauge_mode ; view 7: deco settings |
582 | 253 bra surf_customview_toggle |
254 btfsc FLAG_apnoe_mode | |
255 bra surf_customview_toggle | |
604 | 256 call TFT_surface_decosettings ; show all deco settings |
257 bra customview_toggle_exit ; done | |
582 | 258 |
604 | 259 surf_customview_init_view8: ; view 8: last dive info |
260 call TFT_surface_lastdive ; show last dive interval | |
261 bra customview_toggle_exit ; done | |
582 | 262 |
604 | 263 surf_customview_init_view10: ; transmitter data / debug |
264 IFDEF _rx_functions | |
265 btfss FLAG_tr_enabled ; TR functions enabled? | |
266 bra surf_customview_toggle ; NO - show next view in list | |
267 STRCAT_PRINT "ID bar Volt" ; title of custom view (none language-dependent) | |
268 call TFT_surface_tankdata | |
269 bra customview_toggle_exit ; done | |
270 ELSE | |
271 bra surf_customview_toggle | |
272 ENDIF | |
273 | |
274 | |
275 global switch_layout_to_normal | |
276 switch_layout_to_normal: ; switch back from alternative to normal layout | |
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 | |
582 | 288 |
0 | 289 |
582 | 290 global menuview_toggle |
604 | 291 menuview_toggle: ; show menu or the simulator tasks |
292 bcf switch_left | |
293 btfss alternative_divelayout ; in alternative layout mode? | |
294 bra menuview_toggle2 ; NO - continue with menu or simulator tasks | |
295 rcall switch_layout_to_normal ; YES - switch back to normal layout | |
296 movff customview_divemode,menupos3; - restore the custom view shown in normal layout | |
297 rcall customview_mask ; - re-draw the custom view | |
298 bra menuview_toggle_reset ; - suppress the menu when returning from alternative layout | |
582 | 299 |
560 | 300 menuview_toggle2: |
582 | 301 movlw divemode_menuview_timeout |
302 movwf timeout_counter2 | |
604 | 303 bsf menuview ; flag that the options menu is shown |
304 incf menupos2,F ; number of option to show | |
305 movlw d'10' ; max number of options in divemode | |
306 cpfsgt menupos2 ; max reached? | |
307 bra menuview_mask ; NO - show option | |
582 | 308 global menuview_toggle_reset |
604 | 309 menuview_toggle_reset: ; timeout occurred, beyond max number of options, or item executed |
310 clrf menupos2 ; reset option selector | |
311 bcf menuview ; revoke options menu if shown | |
0 | 312 menuview_mask: |
604 | 313 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.46 ; top, bottom, left, right |
314 btfss FLAG_gauge_mode ; in gauge mode? | |
315 bra menuview_mask2 ; NO | |
316 ; YES - clear some more in gauge mode -- "Reset Avg." text is longer than all the other texts | |
317 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.47, dm_simtext_column+.70 ; top, bottom, left, right | |
327
ca5df826437a
Small fix for the custom grid layout
janos_kovacs <kovjanos@gmail.com>
parents:
315
diff
changeset
|
318 menuview_mask2: |
582 | 319 call TFT_draw_gassep_line |
320 movlw color_yellow | |
321 call TFT_set_color | |
604 | 322 bsf win_invert ; set invert flag |
582 | 323 WIN_SMALL dm_simtext_column,dm_simtext_row |
604 | 324 movf menupos2,W ; menupos2 holds number of menu option to show |
0 | 325 dcfsnz WREG,F |
604 | 326 bra menuview_view_gaschange ; check if a better gas/diluent is advised and prompt for switching if yes |
137 | 327 dcfsnz WREG,F |
604 | 328 bra menuview_view1 ; "Menu?" (skipped in gauge and apnoe modes) |
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
329 dcfsnz WREG,F |
604 | 330 bra menuview_view2 ; "Quit?" (in simulation mode only) |
0 | 331 dcfsnz WREG,F |
604 | 332 bra menuview_view3 ; "Sim-1m" (in simulation mode only) |
0 | 333 dcfsnz WREG,F |
604 | 334 bra menuview_view4 ; "Sim+1m" (in simulation mode only) |
0 | 335 dcfsnz WREG,F |
604 | 336 bra menuview_view5 ; "Quit?" (in apnoe mode only) |
0 | 337 dcfsnz WREG,F |
604 | 338 bra menuview_view6 ; "Reset Avr." (in gauge mode only) |
0 | 339 dcfsnz WREG,F |
604 | 340 bra menuview_view7 ; "Sim+5'" (in simulation mode only) |
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
341 dcfsnz WREG,F |
604 | 342 bra menuview_view8 ; "Heading" (only when compass is shown) |
560 | 343 dcfsnz WREG,F |
604 | 344 bra menuview_view9 ; "Layout" (offer alternative layout, aka blind mode) |
582 | 345 |
0 | 346 menuview_exit: |
582 | 347 call TFT_standard_color |
604 | 348 bcf win_invert ; reset invert flag |
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 | |
137 | 352 |
353 | |
354 menuview_view_gaschange: | |
604 | 355 btfsc divemode_gaschange ; last gas change done yet? |
356 bra menuview_toggle ; NO - call next option | |
357 btfsc FLAG_oc_mode ; in OC mode? | |
358 bra menuview_view_gaschange_OC ; YES | |
359 btfsc FLAG_bailout_mode ; in bailout? | |
360 bra menuview_view_gaschange_OC ; YES | |
361 menuview_view_gaschange_DIL: | |
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 | |
582 | 377 movlw .5 |
604 | 378 movwf FSR2L ; point to 6th character (5 chars are used for the gas/dil description) |
582 | 379 STRCAT_PRINT "?" |
604 | 380 bra menuview_exit ; done |
381 | |
0 | 382 menuview_view1: |
604 | 383 btfsc FLAG_apnoe_mode ; in Apnoe mode? |
384 bra menuview_toggle ; YES - goto next option | |
385 btfsc FLAG_gauge_mode ; in Gauge mode? | |
386 bra menuview_toggle ; YES - goto next option | |
387 STRCPY_TEXT_PRINT tDivePreMenu ; print "Menu?" | |
388 bra menuview_exit ; done | |
389 | |
0 | 390 menuview_view2: |
604 | 391 btfss simulatormode_active ; in simulator mode? |
392 bra menuview_toggle ; NO - goto next option | |
393 STRCPY_TEXT_PRINT tQuitSim ; print "Quit Simulation?" | |
394 bra menuview_exit ; done | |
395 | |
0 | 396 menuview_view3: |
604 | 397 btfss simulatormode_active ; in simulator mode? |
398 bra menuview_toggle ; NO - goto next option | |
399 ; STRCPY_PRINT "Sim-1m" ; print "-" for going down | |
400 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down | |
401 bra menuview_exit ; done | |
402 | |
0 | 403 menuview_view4: |
604 | 404 btfss simulatormode_active ; in simulator mode? |
405 bra menuview_toggle ; NO - goto next option | |
406 ; STRCPY_PRINT "Sim+1m" ; "+" for going up | |
407 STRCPY_PRINT "Sim\xb9" ; print up arrow for going up | |
408 bra menuview_exit ; done | |
409 | |
0 | 410 menuview_view5: |
604 | 411 btfss FLAG_apnoe_mode ; in Apnoe mode? |
412 bra menuview_toggle ; NO - goto next option | |
413 btfss FLAG_active_descent ; descending? | |
414 bra menuview_toggle ; YES - goto next option | |
415 ; We are at the surface: | |
416 STRCPY_TEXT_PRINT tQuitSim ; print "Quit Apnea mode?" | |
417 bra menuview_exit ; done | |
418 | |
0 | 419 menuview_view6: |
604 | 420 btfss FLAG_gauge_mode ; in Gauge mode? |
421 bra menuview_toggle ; NO - goto next option | |
422 STRCPY_TEXT_PRINT tDivemenu_ResetAvg; print "Reset Avg." | |
423 bra menuview_exit ; done | |
424 | |
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
425 menuview_view7: |
604 | 426 btfss simulatormode_active ; in simulator mode? |
427 bra menuview_toggle ; NO - goto next option | |
428 btfsc FLAG_gauge_mode ; in Gauge mode? | |
429 bra menuview_toggle ; YES - goto next option | |
430 btfsc FLAG_apnoe_mode ; in Apnoe mode? | |
431 bra menuview_toggle ; YES - goto next option | |
432 STRCPY_PRINT "Sim+5'" ; print "Sim+5'" | |
433 bra menuview_exit ; done | |
434 | |
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
435 menuview_view8: |
604 | 436 movlw index_compass_dm ; index of compass view |
582 | 437 cpfseq menupos3 ; in compass view? |
604 | 438 bra menuview_toggle ; NO - goto next option |
439 STRCPY_TEXT_PRINT tSetHeading ; print "Heading" | |
440 bra menuview_exit ; done | |
441 | |
560 | 442 menuview_view9: |
604 | 443 btfsc FLAG_apnoe_mode ; in Apnoe mode? |
444 bra menuview_toggle ; YES - goto next option | |
582 | 445 STRCPY_PRINT "Layout" |
604 | 446 bra menuview_exit ; done |
582 | 447 |
448 ;============================================================================= | |
449 | |
604 | 450 global customview_mask_alternative |
582 | 451 customview_toggle_alternative: |
604 | 452 call I2C_sleep_accelerometer ; no compass in alternative layout - stop accelerometer |
453 call I2C_sleep_compass ; no compass in alternative layout - stop compass | |
454 movlw d'0' ; max number of custom views in divemode, alternative layout | |
455 cpfsgt menupos3 ; max reached? | |
456 bra customview_mask_alternative ; NO - show | |
457 clrf menupos3 ; reset to zero (zero = default custom view in alternative layout) | |
458 customview_mask_alternative: | |
582 | 459 ; Clear custom view area in divemode |
604 | 460 WIN_BOX_BLACK dm_customview_row, .239, .0, .159 ; top, bottom, left, right |
461 movf menupos3,W ; menupos3 holds number of custom view function | |
582 | 462 dcfsnz WREG,F |
604 | 463 bra customview_alt_init_view1 ; view 1: -- for test only -- |
582 | 464 dcfsnz WREG,F |
604 | 465 nop ; view 2: ... |
466 ;bra customview_alt_init_view0 ; default view: big deco/ndl and max. depth | |
582 | 467 |
604 | 468 customview_alt_init_view0: ; default view: big deco/ndl and max. depth |
582 | 469 call TFT_max_depth_alternative |
470 call TFT_big_deco_alt | |
471 bra customview_alt_toggle_exit | |
472 | |
604 | 473 customview_alt_init_view1: ; view 1 - just for test use |
474 call TFT_avr_stopwatch_mask ; mask for average depth and stopwatch | |
475 call TFT_avr_stopwatch ; data for average depth and stopwatch | |
582 | 476 bra customview_alt_toggle_exit |
0 | 477 |
604 | 478 customview_alt_toggle_exit: |
479 bcf toggle_customview ; clear flag | |
480 return | |
0 | 481 |
604 | 482 |
483 ; Show next dive mode custom view (and delete this flag) | |
560 | 484 global customview_toggle |
485 customview_toggle: | |
604 | 486 bcf switch_right |
487 incf menupos3,F ; number of custom view to show | |
488 | |
489 btfsc alternative_divelayout ; in alternative layout mode? | |
490 bra customview_toggle_alternative ; YES - use the big ones instead | |
582 | 491 |
604 | 492 movlw index_compass_dm ; index of custom view compass |
493 cpfseq menupos3 ; will compass be shown in custom view? | |
494 call I2C_sleep_accelerometer ; NO - stop accelerometer | |
495 cpfseq menupos3 ; will compass be shown in custom view? | |
496 call I2C_sleep_compass ; NO - stop compass | |
560 | 497 |
604 | 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) | |
582 | 502 |
604 | 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 ; | |
582 | 509 global customview_mask |
604 | 510 customview_mask: |
511 bcf redraw_custview_mask ; clear redraw request flag | |
582 | 512 ; Clear custom view area in divemode |
604 | 513 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
514 movf menupos3,W ; menupos3 holds number of custom view function | |
515 dcfsnz WREG,F ; 1: | |
516 bra init_avr_stopwatch ; average depth and stopwatch | |
517 dcfsnz WREG,F ; 2: | |
518 bra init_TFT_dive_compass ; compass | |
519 dcfsnz WREG,F ; 3: | |
520 bra init_ppo2_sensors ; ppO2 sensors | |
521 dcfsnz WREG,F ; 4: | |
522 bra init_sensor_check ; sensor check | |
523 dcfsnz WREG,F ; 5: | |
524 bra init_pscr_info ; pSCR data | |
525 dcfsnz WREG,F ; 6: | |
526 bra init_pressures_SAC ; tank pressure and SAC rate | |
527 dcfsnz WREG,F ; 7: | |
528 bra init_gas_needs_ascent ; gas needs for ascent / cave return | |
529 dcfsnz WREG,F ; 8: | |
530 bra init_decoplan ; deco plan | |
531 dcfsnz WREG,F ; 9: | |
532 bra init_ceiling_GF_tissue ; ceiling, current GF and tissues | |
533 dcfsnz WREG,F ; 10: | |
534 bra init_CNS ; CNS values | |
535 dcfsnz WREG,F ; 11: | |
536 bra init_ppo2_ead_end_cns ; ppO2, END/EAD and CNS | |
537 dcfsnz WREG,F ; 12: | |
538 bra init_gf_factors ; GF factors | |
539 dcfsnz WREG,F ; 13: | |
540 bra init_clock_batt_surfpress ; clock, battery and surface pressure | |
541 bra customview_toggle_exit ; no view (blank screen in custom view area) | |
582 | 542 |
0 | 543 |
604 | 544 init_ppo2_sensors: |
545 btfsc FLAG_ccr_mode ; in CC mode? | |
546 bra customview_init_view1a ; YES | |
547 btfsc FLAG_pscr_mode ; in PSCR mode? | |
548 bra customview_init_view1a ; YES | |
549 bra customview_toggle ; NO to both, call next view | |
582 | 550 customview_init_view1a: |
551 btfsc analog_o2_input ; do we have an analog input? | |
552 bra customview_init_view1b ; YES - show this view | |
604 | 553 btfsc s8_digital ; NO - do we have a digital input? |
583 | 554 bra customview_init_view1b ; YES - show this view |
555 btfss optical_input ; NO - do we have an optical input? | |
604 | 556 bra customview_toggle ; NO - call next view |
583 | 557 ; YES - show this view |
582 | 558 customview_init_view1b: |
604 | 559 call TFT_ppo2_sensors_mask ; mask for ppO2 sensors |
560 call TFT_ppo2_sensors ; data for ppO2 sensors | |
582 | 561 bra customview_toggle_exit |
0 | 562 |
604 | 563 init_avr_stopwatch: |
564 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
565 bra customview_toggle ; YES - call next view | |
566 call TFT_avr_stopwatch_mask ; mask for average depth and stopwatch | |
567 call TFT_avr_stopwatch ; data for average depth and stopwatch | |
582 | 568 bra customview_toggle_exit |
0 | 569 |
604 | 570 init_decoplan: |
571 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
572 bra customview_toggle ; YES - call next view | |
573 btfsc FLAG_gauge_mode ; in gauge mode? | |
574 bra customview_toggle ; YES - call next view | |
575 call TFT_decoplan_mask ; mask for deco plan | |
576 call TFT_decoplan ; data for deco plan | |
582 | 577 bra customview_toggle_exit |
0 | 578 |
604 | 579 init_clock_batt_surfpress: |
580 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure | |
581 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure | |
582 | 582 bra customview_toggle_exit |
0 | 583 |
604 | 584 init_gf_factors: |
585 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
586 bra customview_toggle ; YES - call next view | |
587 btfsc FLAG_gauge_mode ; in gauge mode? | |
588 bra customview_toggle ; YES - call next view | |
589 TSTOSS char_I_deco_model ; in GF mode (0 = ZH-L16, 1 = ZH-L16-GF)? | |
590 bra customview_toggle ; NO - no GF info for non-GF modes | |
591 call TFT_gf_factors_mask ; mask for GF factors | |
582 | 592 bra customview_toggle_exit |
0 | 593 |
604 | 594 init_TFT_dive_compass: ; compass |
595 call I2C_init_accelerometer ; start accelerometer | |
596 call I2C_init_compass ; start compass | |
597 call TFT_dive_compass_mask ; show compass mask | |
582 | 598 bra customview_toggle_exit |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
599 |
604 | 600 init_pressures_SAC: ; tank pressure and SAC rate |
601 IFDEF _rx_functions | |
602 btfss FLAG_tr_enabled ; TR functions enabled? | |
603 bra customview_toggle ; NO - call next view | |
604 call TFT_pressures_SAC_mask ; mask for pressures and SAC | |
605 call TFT_pressures_SAC ; data for pressures and SAC | |
606 bra customview_toggle_exit | |
607 ELSE | |
608 bra customview_toggle ; skip, not available without RX functions | |
609 ENDIF | |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
53
diff
changeset
|
610 |
604 | 611 init_CNS: ; CNS at end of dive |
612 btfsc FLAG_gauge_mode ; in Gauge mode? | |
613 bra customview_toggle ; YES - call next view | |
614 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
615 bra customview_toggle ; YES - call next view | |
616 call TFT_CNS_mask ; mask for CNS values | |
617 call TFT_CNS ; data for CNS values | |
618 bra customview_toggle_exit | |
333
14b466f66a7f
Extend the Ceiling custom-view with ppO2 and current GF
Janos Kovacs <kovjanos@gmail.com>
parents:
327
diff
changeset
|
619 |
604 | 620 init_ceiling_GF_tissue: ; ceiling, tissues and current GF |
621 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
622 bra customview_toggle ; YES - call next view | |
623 btfsc FLAG_gauge_mode ; in gauge mode? | |
624 bra customview_toggle ; YES - call next view | |
625 call TFT_ceiling_GF_tissue_mask ; mask for ceiling, current GF and tissues | |
626 call TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues | |
582 | 627 bra customview_toggle_exit |
525
00df86a5ac01
BUGFIX: Do not show GF in divemode for non-GF deco mode
heinrichsweikamp
parents:
517
diff
changeset
|
628 |
604 | 629 init_sensor_check: ; sensor check |
630 btfsc FLAG_ccr_mode ; in CCR mode? | |
631 bra customview_init_view10a ; YES | |
632 ; btfsc FLAG_pscr_mode ; in pSCR mode? | |
633 ; bra customview_init_view10a ; YES | |
634 bra customview_toggle ; NO to both, call next view | |
635 customview_init_view10a: | |
636 call TFT_sensor_check_mask ; mask for sensor check | |
637 call TFT_sensor_check ; data for sensor check | |
582 | 638 bra customview_toggle_exit |
123 | 639 |
604 | 640 init_ppo2_ead_end_cns: ; ppO2, END/EAD and CNS |
641 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
642 bra customview_toggle ; YES - call next view | |
643 btfsc FLAG_gauge_mode ; in gauge mode? | |
644 bra customview_toggle ; YES - call next view | |
645 call TFT_ppo2_ead_end_cns_mask ; mask for ppO2, END/EAD and CNS | |
646 call TFT_ppo2_ead_end_cns ; data for ppO2, END/EAD and CNS | |
582 | 647 bra customview_toggle_exit |
560 | 648 |
604 | 649 init_pscr_info: ; pSCR information |
650 btfss FLAG_pscr_mode ; in pSCR mode? | |
651 bra customview_toggle ; NO - call next view | |
652 call TFT_pscr_info_mask ; mask for pSCR info | |
653 call TFT_pscr_info ; data for pSCR info | |
654 bra customview_toggle_exit | |
655 | |
656 init_gas_needs_ascent: ; gas needs for ascent | |
657 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
658 bra customview_toggle ; YES - call next view | |
659 btfsc FLAG_gauge_mode ; in gauge mode? | |
660 bra customview_toggle ; YES - call next view | |
661 TSTOSS opt_calc_asc_gasvolume ; check if gas volume calculation is switched on | |
662 bra customview_toggle ; NO - call next view | |
663 call TFT_gas_needs_ascent_mask ; mask for gas needs ascent | |
664 call TFT_gas_needs_ascent ; data for gas needs ascent | |
582 | 665 bra customview_toggle_exit |
666 | |
0 | 667 customview_toggle_exit: |
604 | 668 bcf toggle_customview ; clear flag |
669 btfsc divemode ; in dive mode? | |
670 bsf FLAG_TFT_temp_divemode ; YES - set flag to redraw temp | |
582 | 671 return |
0 | 672 |
673 | |
582 | 674 global customview_show_mix |
604 | 675 customview_show_mix: ; put "Nxlo", "Txlo/hi", "Air" or "O2" into postinc2 |
582 | 676 tstfsz hi ; He=0? |
604 | 677 bra customview_show_mix5 ; NO - show a TX |
0 | 678 movlw .21 |
582 | 679 cpfseq lo ; Air? |
604 | 680 bra customview_show_mix2 ; NO |
681 STRCAT_TEXT tSelectAir ; YES - show "Air" | |
582 | 682 bra customview_show_mix4b |
0 | 683 customview_show_mix2: |
684 movlw .100 | |
582 | 685 cpfseq lo ; O2? |
604 | 686 bra customview_show_mix3 ; NO |
687 STRCAT_TEXT tSelectO2 ; YES - show "O2" | |
582 | 688 bra customview_show_mix4b |
0 | 689 customview_show_mix3: |
690 movlw .21 | |
582 | 691 cpfslt lo ; < Nx21? |
604 | 692 bra customview_show_mix4 ; NO |
693 STRCAT_TEXT tGasErr ; YES - show "Err" | |
582 | 694 output_99 ; O2 ratio is still in "lo" |
604 | 695 bra customview_show_mix4c |
0 | 696 customview_show_mix4: |
604 | 697 STRCAT_TEXT tSelectNx ; show "Nx" |
582 | 698 output_99 ; O2 ratio is still in "lo" |
0 | 699 customview_show_mix4b: |
582 | 700 STRCAT " " |
0 | 701 customview_show_mix4c: |
604 | 702 btfsc divemode ; in divemode? |
703 return ; YES | |
582 | 704 STRCAT " " |
705 return | |
0 | 706 customview_show_mix5: |
582 | 707 btfsc divemode |
708 bra customview_show_mix6 | |
604 | 709 STRCAT_TEXT tSelectTx ; show "Tx" |
0 | 710 customview_show_mix6: |
582 | 711 output_99 ; O2 ratio is still in "lo" |
712 PUTC "/" | |
713 movff hi,lo | |
714 output_99 ; He ratio | |
715 return | |
0 | 716 |
717 END |