Mercurial > public > hwos_code
annotate src/customview.asm @ 585:00ad4ffd915b
CNS Fix2
author | heinrichsweikamp |
---|---|
date | Wed, 28 Feb 2018 16:24:18 +0100 |
parents | 6636cbe64c6d |
children | ca4556fb60b9 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
582 | 3 ; File customview.asm REFACTORED VERSION V2.98 |
0 | 4 ; |
5 ; Customview in Surfacemode and Divemode | |
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 | |
582 | 14 #include "hwos.inc" ; Mandatory header |
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 |
27 extern gaslist_strcat_gas_mod | |
28 extern char_I_deco_model | |
29 extern TFT_sensor_mV | |
30 extern TFT_surface_compass_mask | |
31 extern TFT_dive_compass_mask | |
32 | |
33 | |
34 gui CODE | |
0 | 35 |
36 ;============================================================================= | |
37 ; Do every-second tasks for the custom view area (Dive mode) | |
38 | |
39 global customview_second | |
40 customview_second: | |
582 | 41 movff menupos3,WREG ; copy current view (1-...) |
0 | 42 dcfsnz WREG,F |
582 | 43 goto TFT_update_ppo2_sensors ; Update Sensor data ; and return |
0 | 44 dcfsnz WREG,F |
582 | 45 goto TFT_update_avr_stopwatch ; Update average depth and stopwatch; and return |
0 | 46 dcfsnz WREG,F |
582 | 47 goto TFT_decoplan ; Show decoplan ; and return |
0 | 48 dcfsnz WREG,F |
582 | 49 goto TFT_battinfo_tissues_clock ; Update Battery, Tissues and clock ; and return |
0 | 50 dcfsnz WREG,F |
582 | 51 goto TFT_gf_info ; Update GF informations ; and return |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
52 dcfsnz WREG,F |
582 | 53 return ; Compass updated separately (faster) in divemode; |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
54 dcfsnz WREG,F |
582 | 55 nop ; ex goto TFT_dyn_gaslist |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
53
diff
changeset
|
56 dcfsnz WREG,F |
582 | 57 goto TFT_CNS ; Show CNS values for end-of-dive, ex goto TFT_hud_voltages |
123 | 58 dcfsnz WREG,F |
582 | 59 bra customview_1sec_view9 ; Make sure to change value in "check_ppo2_display:" when moving around custom views |
413
12e85930d95c
NEW: New Customview shows ppO2(O2) and ppO2(Diluent) during CCR mode
heinrichsweikamp
parents:
376
diff
changeset
|
60 dcfsnz WREG,F |
582 | 61 goto TFT_sensor_check ; Show ppO2 of O2 and Diluent ; and return |
471
9edb1359ce43
NEW: New Customview 11 in dive mode shows ppO2, EAD/END and CNS
heinrichsweikamp
parents:
437
diff
changeset
|
62 dcfsnz WREG,F |
582 | 63 goto TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS; and return |
482
c0ee33f1f399
New customview #12 for PSCR mode shows ppO2, O2 drop and lung ratio
heinrichsweikamp
parents:
476
diff
changeset
|
64 dcfsnz WREG,F |
582 | 65 goto TFT_pscr_info ; Show ppO2, drop and lung ratio; and return |
560 | 66 dcfsnz WREG,F |
582 | 67 goto TFT_gas_needs ; Show gas needs |
482
c0ee33f1f399
New customview #12 for PSCR mode shows ppO2, O2 drop and lung ratio
heinrichsweikamp
parents:
476
diff
changeset
|
68 |
0 | 69 ; Menupos3=0, do nothing |
70 return | |
71 | |
582 | 72 customview_1sec_view9: ; Ceiling |
73 call TFT_ceiling ; Show Ceiling | |
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 | |
123 | 78 |
582 | 79 global customview_alternative_second |
80 customview_alternative_second: | |
81 movff menupos3,WREG ; copy current view (1-...) | |
560 | 82 dcfsnz WREG,F |
83 bra customview_alt_second_view1 ; View 1 | |
84 dcfsnz WREG,F | |
582 | 85 nop ; View 2 |
413
12e85930d95c
NEW: New Customview shows ppO2(O2) and ppO2(Diluent) during CCR mode
heinrichsweikamp
parents:
376
diff
changeset
|
86 |
560 | 87 ; Menupos3=0, do nothing |
88 return | |
582 | 89 |
560 | 90 customview_alt_second_view1: |
582 | 91 bsf FLAG_TFT_max_depth_alt |
92 bsf FLAG_TFT_big_deco_alt | |
93 return | |
0 | 94 |
95 ;============================================================================= | |
96 ; Do every-minute tasks for the custom view area | |
97 | |
98 global customview_minute | |
99 customview_minute: | |
582 | 100 return |
101 ; movff menupos3,WREG ; copy | |
0 | 102 ; dcfsnz WREG,F |
103 ; bra customview_1min_view1 | |
104 ; dcfsnz WREG,F | |
105 ; bra customview_1min_view2 | |
106 ; dcfsnz WREG,F | |
107 ; bra customview_1min_view3 | |
108 ; dcfsnz WREG,F | |
109 ; bra customview_1min_view4 | |
110 ; dcfsnz WREG,F | |
111 ; bra customview_1min_view5 | |
112 ; dcfsnz WREG,F | |
113 ; bra customview_1min_view6 | |
114 ; dcfsnz WREG,F | |
115 ; bra customview_1min_view7 | |
116 ; dcfsnz WREG,F | |
117 ; bra customview_1min_view8 | |
118 ; dcfsnz WREG,F | |
119 ; bra customview_1min_view9 | |
120 ; dcfsnz WREG,F | |
121 ; bra customview_1min_view10 | |
122 ; dcfsnz WREG,F | |
123 ; bra customview_1min_view11 | |
124 ; ; Menupos3=0, do nothing | |
125 ; return | |
126 ; | |
127 ;customview_1min_view1: | |
128 ;customview_1min_view2: | |
129 ;customview_1min_view3: | |
130 ;customview_1min_view4: | |
131 ;customview_1min_view5: | |
132 ;customview_1min_view6: | |
133 ;customview_1min_view7: | |
134 ;customview_1min_view8: | |
135 ;customview_1min_view9: | |
136 ;customview_1min_view10: | |
137 ;customview_1min_view11: | |
582 | 138 ;return |
0 | 139 |
582 | 140 global surf_customview_toggle |
0 | 141 surf_customview_toggle: |
142 bcf switch_right | |
582 | 143 incf menupos3,F ; Number of customview to show |
144 movlw d'9' ; Max number of customsviews in surface mode | |
145 cpfsgt menupos3 ; Max reached? | |
146 bra surf_customview_mask ; No, show | |
147 movlw .1 | |
148 movwf menupos3 ; Reset to one (Always one custom view visible) | |
0 | 149 |
582 | 150 global surf_customview_mask |
0 | 151 surf_customview_mask: |
582 | 152 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right |
153 ; Prepare title | |
154 WIN_TINY surf_customview_title_column,surf_customview_title_row | |
155 WIN_COLOR color_greenish | |
156 movff menupos3,WREG ; Menupos3 holds number of customview function | |
0 | 157 dcfsnz WREG,F |
582 | 158 bra surf_customview_init_view1 ; OC Gas list |
0 | 159 dcfsnz WREG,F |
582 | 160 bra surf_customview_init_view2 ; CC Dil list |
0 | 161 dcfsnz WREG,F |
582 | 162 bra surf_customview_init_view3 ; CC SP list |
0 | 163 dcfsnz WREG,F |
582 | 164 bra surf_customview_init_view4 ; Custom Text |
0 | 165 dcfsnz WREG,F |
582 | 166 bra surf_customview_init_view5 ; Tissue Diagram |
503
4542d03f748a
NEW: Last Dive customviews in surface mode with divetime, depth and interval
heinrichsweikamp
parents:
502
diff
changeset
|
167 dcfsnz WREG,F |
582 | 168 bra surf_customview_init_view6 ; Compass |
503
4542d03f748a
NEW: Last Dive customviews in surface mode with divetime, depth and interval
heinrichsweikamp
parents:
502
diff
changeset
|
169 dcfsnz WREG,F |
582 | 170 bra surf_customview_init_view7 ; Deco settings |
503
4542d03f748a
NEW: Last Dive customviews in surface mode with divetime, depth and interval
heinrichsweikamp
parents:
502
diff
changeset
|
171 dcfsnz WREG,F |
582 | 172 bra surf_customview_init_view8 ; Last Dive info |
530 | 173 dcfsnz WREG,F |
582 | 174 bra surf_customview_init_view9 ; Sensor mV readings |
0 | 175 |
582 | 176 call I2C_sleep_accelerometer ; Stop accelerometer |
177 call I2C_sleep_compass ; Stop compass | |
0 | 178 |
582 | 179 movlw .1 |
180 movwf menupos3 ; Reset to one (Always one custom view visible) | |
0 | 181 |
582 | 182 surf_customview_init_view1: ; View1: OC Gas list |
183 btfsc FLAG_gauge_mode | |
184 bra surf_customview_toggle | |
185 btfsc FLAG_apnoe_mode | |
186 bra surf_customview_toggle | |
187 btfsc FLAG_ccr_mode | |
188 bra surf_customview_init_view1_bail ; Bailout version of "OC Gas List" | |
189 btfsc FLAG_pscr_mode | |
190 bra surf_customview_init_view1_bail ; Bailout version of "OC Gas List" | |
191 STRCPY_TEXT_PRINT tGaslist ; Title of customview | |
192 call TFT_standard_color | |
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 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
184
diff
changeset
|
196 surf_customview_init_view1_bail: |
582 | 197 STRCPY_TEXT_PRINT tDiveBailout ; Title of customview |
198 call TFT_standard_color | |
199 call TFT_gaslist_surfmode ; Show gas list | |
200 bra customview_toggle_exit ; Done. | |
0 | 201 |
582 | 202 surf_customview_init_view2: ; View2: CC Dil list |
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. | |
0 | 228 |
582 | 229 surf_customview_init_view9: ; View 9: Sensor mV on the surface |
230 btfsc FLAG_ccr_mode | |
231 bra surf_customview_init_view9a ; we are in CCR mode | |
232 btfsc FLAG_pscr_mode | |
233 bra surf_customview_init_view9a ; we are in PSCR mode | |
234 bra surf_customview_toggle ; we are not in any rebreather mode, so skip | |
530 | 235 surf_customview_init_view9a: |
582 | 236 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
237 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | |
238 bnz surf_customview_toggle ; sorry, no sensors, skip again | |
239 STRCPY_TEXT_PRINT tSensorMilliVolt ; Title of customview | |
240 call TFT_standard_color | |
241 call TFT_sensor_mV ; write sensor mV readings to screen | |
242 bra customview_toggle_exit ; Done. | |
0 | 243 |
582 | 244 surf_customview_init_view4: ; View4: Custom text |
245 call TFT_standard_color | |
246 call TFT_custom_text ; Show the custom text | |
247 bra customview_toggle_exit ; Done. | |
0 | 248 |
582 | 249 surf_customview_init_view5: ; View5: Tissue Diagram |
250 btfsc FLAG_gauge_mode | |
251 bra surf_customview_toggle | |
252 btfsc FLAG_apnoe_mode | |
253 bra surf_customview_toggle | |
254 call TFT_standard_color | |
255 call TFT_surface_tissues ; Show Tissue diagram | |
256 bra customview_toggle_exit ; Done. | |
0 | 257 |
582 | 258 surf_customview_init_view6: ; View6: Compass |
259 call I2C_init_accelerometer ; Start accelerometer | |
260 call I2C_init_compass ; Start compass | |
261 call TFT_surface_compass_mask ; Show compass | |
262 bra customview_toggle_exit ; Done. | |
263 | |
41 | 264 surf_customview_init_view7: |
582 | 265 btfsc FLAG_gauge_mode ; View7: Deco settings |
266 bra surf_customview_toggle | |
267 btfsc FLAG_apnoe_mode | |
268 bra surf_customview_toggle | |
269 | |
270 call TFT_surface_decosettings ; Show all deco settings | |
271 bra customview_toggle_exit ; Done. | |
272 | |
273 surf_customview_init_view8: ; View8: Last dive info | |
274 call TFT_surface_lastdive ; Show last dive interval | |
275 bra customview_toggle_exit ; Done. | |
276 | |
0 | 277 |
582 | 278 global menuview_toggle |
279 menuview_toggle: ; Show Menu or the simulator tasks | |
280 btfss alternative_divelayout ; In alternative layout mode? | |
281 bra menuview_toggle2 ; No | |
282 ; Switch back to normal mode for any menu tasks | |
283 bcf alternative_divelayout ; clear flag | |
284 bsf FLAG_TFT_divemode_mask ; Set flag for mask | |
285 bsf FLAG_TFT_max_depth ; set flag | |
286 btfss decostop_active ; deco? | |
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 | |
560 | 293 menuview_toggle2: |
582 | 294 movlw divemode_menuview_timeout |
295 movwf timeout_counter2 | |
296 bsf menuview | |
297 bcf switch_left | |
298 incf menupos2,F ; Number of options to show | |
299 movlw d'10' ; Max number of options in divemode | |
300 cpfsgt menupos2 ; Max reached? | |
301 bra menuview_mask ; No, show | |
302 global menuview_toggle_reset | |
303 menuview_toggle_reset: ; Timeout occurred | |
304 clrf menupos2 | |
305 bcf menuview | |
0 | 306 menuview_mask: |
582 | 307 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column, dm_simtext_column+.49 ; top, bottom, left, right |
308 btfss FLAG_gauge_mode | |
309 bra menuview_mask2 | |
310 ; Clear some more in gauge mode -- "Reset Avg." text is longer than normal simtext | |
311 WIN_BOX_BLACK dm_simtext_row, dm_simtext_row+.23, dm_simtext_column+.50, 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
|
312 menuview_mask2: |
582 | 313 call TFT_draw_gassep_line |
314 movlw color_yellow | |
315 call TFT_set_color | |
316 bsf win_invert ; Set invert flag | |
317 WIN_SMALL dm_simtext_column,dm_simtext_row | |
318 movff menupos2,WREG ; Menupos2 holds number of menu option to show | |
0 | 319 dcfsnz WREG,F |
582 | 320 bra menuview_view_gaschange ; If a better gas is indicated |
137 | 321 dcfsnz WREG,F |
582 | 322 bra menuview_view1 ; "Menu?" (Not in Gauge and Anpnoe) |
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
323 dcfsnz WREG,F |
582 | 324 bra menuview_view2 ; "Quit Simulation?" (Sim only) |
0 | 325 dcfsnz WREG,F |
582 | 326 bra menuview_view3 ; "Descent 1m" (Sim only) |
0 | 327 dcfsnz WREG,F |
582 | 328 bra menuview_view4 ; "Ascend 1m" (Sim only) |
0 | 329 dcfsnz WREG,F |
582 | 330 bra menuview_view5 ; "Quit Apnea mode?" (Apnea only) |
0 | 331 dcfsnz WREG,F |
582 | 332 bra menuview_view6 ; "Reset Avr." (Gauge only) |
0 | 333 dcfsnz WREG,F |
582 | 334 bra menuview_view7 ; "Sim:+5mins" (Sim only) |
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
335 dcfsnz WREG,F |
582 | 336 bra menuview_view8 ; "Heading" (When compass is shown) |
560 | 337 dcfsnz WREG,F |
582 | 338 bra menuview_view9 ; "Layout" (Alternative Layout, aka Blind mode) |
339 | |
0 | 340 menuview_exit: |
582 | 341 call TFT_standard_color |
342 bcf win_invert ; Reset invert flag | |
343 return ; Menupos2 = 0, Show nothing | |
137 | 344 |
345 | |
346 menuview_view_gaschange: | |
582 | 347 btfss better_gas_available ; =1: A better gas is available |
348 bra menuview_toggle ; No, call next option | |
349 btfsc divemode_gaschange ; Skip if the last gas change is not done yet. | |
350 bra menuview_toggle | |
351 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
352 movff better_gas_number,PRODL ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
353 decf PRODL,F | |
354 call gaslist_strcat_gas_mod ; Append gas description of gas #PRODL (0-4) to current string | |
355 movlw .5 | |
356 movwf FSR2L ; Point to char 6 (5 chars gas description only) | |
357 STRCAT_PRINT "?" | |
358 bra menuview_exit ; Done. | |
0 | 359 menuview_view1: |
582 | 360 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
361 bra menuview_toggle ; Call next option | |
362 btfsc FLAG_gauge_mode ; In Gauge mode? | |
363 bra menuview_toggle ; Call next option | |
364 STRCPY_TEXT_PRINT tDivePreMenu ; "Menu?" | |
365 bra menuview_exit ; Done. | |
0 | 366 menuview_view2: |
582 | 367 btfss simulatormode_active ; View only for simulator mode |
368 bra menuview_toggle ; Call next option | |
369 STRCPY_TEXT_PRINT tQuitSim ; "Quit Simulation?" | |
370 bra menuview_exit ; Done. | |
0 | 371 menuview_view3: |
582 | 372 btfss simulatormode_active ; View only for simulator mode |
373 bra menuview_toggle ; Call next option | |
374 STRCPY_PRINT "Sim-1m" ; "-" for going down | |
375 bra menuview_exit ; Done. | |
0 | 376 menuview_view4: |
582 | 377 btfss simulatormode_active ; View only for simulator mode |
378 bra menuview_toggle ; Call next option | |
379 STRCPY_PRINT "Sim+1m" ; "+" for going up | |
380 bra menuview_exit ; Done. | |
0 | 381 menuview_view5: |
582 | 382 btfss FLAG_apnoe_mode ; In Apnoe mode? |
383 bra menuview_toggle ; No, call next option | |
384 btfss FLAG_active_descent ; Are we descending? | |
385 bra menuview_toggle ; Yes | |
0 | 386 ; We are at the surface: |
582 | 387 STRCPY_TEXT_PRINT tQuitSim ; "Quit Apnea mode?" |
388 bra menuview_exit ; Done. | |
0 | 389 menuview_view6: |
582 | 390 btfss FLAG_gauge_mode ; In Gauge mode? |
391 bra menuview_toggle ; No, call next option | |
392 STRCPY_TEXT_PRINT tDivemenu_ResetAvg; "Reset Avg." | |
393 bra menuview_exit ; Done. | |
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
394 menuview_view7: |
582 | 395 btfss simulatormode_active ; View only for simulator mode |
396 bra menuview_toggle ; Call next option | |
397 btfsc FLAG_gauge_mode ; In Gauge mode? | |
398 bra menuview_toggle ; Yes, call next option | |
399 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
400 bra menuview_toggle ; Yes, call next option | |
401 STRCPY_PRINT "Sim+5'" | |
402 bra menuview_exit ; Done. | |
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
403 menuview_view8: |
582 | 404 movlw .6 |
405 cpfseq menupos3 ; in compass view? | |
406 bra menuview_toggle ; No, call next option | |
407 STRCPY_TEXT_PRINT tSetHeading ; "Heading" | |
408 bra menuview_exit ; Done. | |
560 | 409 menuview_view9: |
582 | 410 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
411 bra menuview_toggle ; Yes, call next option | |
412 btfsc FLAG_gauge_mode ; In Gauge mode? | |
413 bra menuview_toggle ; Yes, call next option | |
414 STRCPY_PRINT "Layout" | |
415 bra menuview_exit ; Done. | |
416 | |
417 ;============================================================================= | |
418 | |
419 customview_toggle_alternative: | |
420 movlw d'1' ; Max number of customviews in divemode, alternative layout | |
421 cpfsgt menupos3 ; Max reached? | |
422 bra customview_mask_alternative ; No, show | |
423 movlw .1 | |
424 movwf menupos3 ; Reset to one, always one customview visible in alternative layout | |
425 customview_mask_alternative: | |
426 ; Clear custom view area in divemode | |
427 WIN_BOX_BLACK dm_customview_row, .239, .0, .159 ; top, bottom, left, right | |
428 call TFT_standard_color | |
429 movff menupos3,WREG ; Menupos3 holds number of customview function | |
430 dcfsnz WREG,F | |
431 bra customview_alt_init_view1 ; View 1: Big deco/ndl and max. depth | |
432 dcfsnz WREG,F | |
433 bra customview_alt_init_view2 ; View 2: | |
434 | |
435 ;bra customview_alternative_toggle_exit ; No view (menupos3=0) | |
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 | |
444 call TFT_big_deco_alt | |
445 bra customview_alt_toggle_exit | |
446 | |
447 customview_alt_init_view2: | |
448 ; /* Just for test... | |
449 call TFT_mask_avr_stopwatch ; Show mask 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 | |
0 | 453 |
454 | |
455 ; Show next customview (and delete this flag) | |
560 | 456 global customview_toggle |
457 customview_toggle: | |
458 bcf switch_right | |
582 | 459 incf menupos3,F ; Number of customview to show |
460 | |
461 btfsc alternative_divelayout ; In alternative layout mode? | |
560 | 462 bra customview_toggle_alternative ; Yes, use the big ones instead |
463 | |
582 | 464 movlw d'13' ; Max number of customviews in divemode |
465 cpfsgt menupos3 ; Max reached? | |
466 bra customview_mask ; No, show | |
467 clrf menupos3 ; Reset to zero (Zero=no custom view) | |
468 | |
469 global customview_mask | |
0 | 470 customview_mask: |
582 | 471 ; 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 | |
473 WIN_SMALL dm_customview_column,dm_customview_row | |
0 | 474 call TFT_standard_color |
582 | 475 movff menupos3,WREG ; Menupos3 holds number of customview function |
0 | 476 dcfsnz WREG,F |
582 | 477 bra customview_init_view1 ; Update Sensor data |
0 | 478 dcfsnz WREG,F |
582 | 479 bra customview_init_view2 ; average depth and stopwatch |
0 | 480 dcfsnz WREG,F |
582 | 481 bra customview_init_view3 ; Decoplan |
0 | 482 dcfsnz WREG,F |
582 | 483 bra customview_init_view4 ; Battery info, Tissues and clock |
0 | 484 dcfsnz WREG,F |
582 | 485 bra customview_init_view5 ; GF informations |
0 | 486 dcfsnz WREG,F |
582 | 487 bra customview_init_view6 ; Compass |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
488 dcfsnz WREG,F |
582 | 489 bra customview_init_view7 ; Dynamic gaslist |
105 | 490 dcfsnz WREG,F |
582 | 491 bra customview_init_view8 ; CNS |
123 | 492 dcfsnz WREG,F |
582 | 493 bra customview_init_view9 ; ppO2, Ceiling and current GF |
413
12e85930d95c
NEW: New Customview shows ppO2(O2) and ppO2(Diluent) during CCR mode
heinrichsweikamp
parents:
376
diff
changeset
|
494 dcfsnz WREG,F |
582 | 495 bra customview_init_view10 ; Sensor check |
471
9edb1359ce43
NEW: New Customview 11 in dive mode shows ppO2, EAD/END and CNS
heinrichsweikamp
parents:
437
diff
changeset
|
496 dcfsnz WREG,F |
582 | 497 bra customview_init_view11 ; ppO2, END/EAD and CNS |
482
c0ee33f1f399
New customview #12 for PSCR mode shows ppO2, O2 drop and lung ratio
heinrichsweikamp
parents:
476
diff
changeset
|
498 dcfsnz WREG,F |
582 | 499 bra customview_init_view12 ; PSCR Info |
560 | 500 dcfsnz WREG,F |
582 | 501 bra customview_init_view13 ; Gas needs |
502 | |
0 | 503 customview_init_nocustomview: |
582 | 504 call I2C_sleep_accelerometer ; Stop accelerometer |
505 call I2C_sleep_compass ; Stop compass | |
506 bra customview_toggle_exit | |
0 | 507 |
508 customview_init_view1: | |
582 | 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... | |
0 | 515 |
582 | 516 customview_init_view1a: |
517 btfsc analog_o2_input ; do we have an analog input? | |
518 bra customview_init_view1b ; YES - show this view | |
583 | 519 btfsc s8_digital ; NO - do we have a digital input? |
520 bra customview_init_view1b ; YES - show this view | |
521 btfss optical_input ; NO - do we have an optical input? | |
522 bra customview_toggle ; NO - call next view... | |
523 | |
524 ; YES - show this view | |
582 | 525 customview_init_view1b: |
526 call TFT_hud_mask ; Setup HUD mask | |
527 call TFT_update_ppo2_sensors ; Update Sensor data | |
528 bra customview_toggle_exit | |
0 | 529 |
530 customview_init_view2: | |
582 | 531 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
532 bra customview_toggle ; Yes, Call next view... | |
533 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch | |
534 call TFT_update_avr_stopwatch ; Update average depth and stopwatch | |
535 bra customview_toggle_exit | |
0 | 536 |
537 customview_init_view3: | |
582 | 538 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
539 bra customview_toggle ; Yes, Call next view... | |
540 btfsc FLAG_gauge_mode ; In Gauge mode? | |
541 bra customview_toggle ; Yes, Call next view... | |
542 call TFT_decoplan ; Show decoplan | |
543 bra customview_toggle_exit | |
0 | 544 |
545 customview_init_view4: | |
582 | 546 call TFT_battinfo_tissues_clock_mask ; Setup Mask |
547 call TFT_battinfo_tissues_clock ; Show Battery info, Tissues and clock | |
548 bra customview_toggle_exit | |
0 | 549 |
550 customview_init_view5: | |
582 | 551 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
552 bra customview_toggle ; Yes, Call next view... | |
553 btfsc FLAG_gauge_mode ; In Gauge mode? | |
554 bra customview_toggle ; Yes, Call next view... | |
119 | 555 |
582 | 556 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF |
557 bra customview_toggle ; No GF info for non-GF modes | |
0 | 558 |
582 | 559 call TFT_gf_mask ; Setup Mask |
560 call TFT_gf_info ; Show GF informations | |
561 bra customview_toggle_exit | |
0 | 562 |
582 | 563 customview_init_view6: ; Compass (View 6) |
564 call I2C_init_accelerometer ; Start accelerometer | |
565 call I2C_init_compass ; Start compass | |
566 call TFT_dive_compass_mask ; Show compass | |
567 bra customview_toggle_exit | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
568 |
582 | 569 customview_init_view7: ; view disabled |
570 bra customview_toggle | |
571 | |
572 customview_init_view8: ; CNS at end of dive | |
573 btfsc FLAG_gauge_mode ; In Gauge mode? | |
574 bra customview_toggle ; Yes, Call next view... | |
575 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
576 bra customview_toggle ; yes, Call next view... | |
560 | 577 call TFT_CNS_mask |
578 call TFT_CNS | |
582 | 579 goto customview_toggle_exit |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
53
diff
changeset
|
580 |
582 | 581 customview_init_view9: ; ppO2, Ceiling and current GF |
582 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
583 bra customview_toggle ; yes, Call next view... | |
584 btfsc FLAG_gauge_mode ; In Gauge mode? | |
585 bra customview_toggle ; Yes, Call next view... | |
586 call TFT_ceiling_mask ; Setup mask | |
587 call TFT_ceiling ; Show Ceiling | |
333
14b466f66a7f
Extend the Ceiling custom-view with ppO2 and current GF
Janos Kovacs <kovjanos@gmail.com>
parents:
327
diff
changeset
|
588 |
582 | 589 ; ppO2 value |
590 call TFT_mask_ppo2 | |
591 call TFT_display_pure_ppo2 | |
333
14b466f66a7f
Extend the Ceiling custom-view with ppO2 and current GF
Janos Kovacs <kovjanos@gmail.com>
parents:
327
diff
changeset
|
592 |
582 | 593 ; current GF value |
594 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF | |
595 bra customview_toggle_exit ; No GF info for non-GF modes | |
596 ; current GF value | |
597 call TFT_gf_mask_cGF ; Setup Mask - current GF only | |
598 call TFT_gf_info ; Show GF informations | |
599 bra customview_toggle_exit | |
525
00df86a5ac01
BUGFIX: Do not show GF in divemode for non-GF deco mode
heinrichsweikamp
parents:
517
diff
changeset
|
600 |
582 | 601 customview_init_view10: ; Sensor check |
602 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
603 bra customview_toggle ; yes, Call next view... | |
604 btfsc FLAG_gauge_mode ; In Gauge mode? | |
605 bra customview_toggle ; Yes, Call next view... | |
606 btfss FLAG_ccr_mode ; In CC mode? | |
607 bra customview_toggle ; no, Call next view... | |
413
12e85930d95c
NEW: New Customview shows ppO2(O2) and ppO2(Diluent) during CCR mode
heinrichsweikamp
parents:
376
diff
changeset
|
608 |
582 | 609 call TFT_sensor_check_mask ; Show ppO2 of O2 and Diluent mask |
610 call TFT_sensor_check ; Show ppO2 of O2 and Diluent | |
611 bra customview_toggle_exit | |
123 | 612 |
582 | 613 customview_init_view11: ; ppO2, END/EAD and CNS |
614 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
615 bra customview_toggle ; yes, Call next view... | |
616 btfsc FLAG_gauge_mode ; In Gauge mode? | |
617 bra customview_toggle ; Yes, Call next view... | |
471
9edb1359ce43
NEW: New Customview 11 in dive mode shows ppO2, EAD/END and CNS
heinrichsweikamp
parents:
437
diff
changeset
|
618 |
582 | 619 call TFT_ppo2_ead_end_cns_mask ; Show ppO2, END/EAD and CNS mask |
620 call TFT_ppo2_ead_end_cns ; Show ppO2, END/EAD and CNS | |
621 goto customview_toggle_exit | |
482
c0ee33f1f399
New customview #12 for PSCR mode shows ppO2, O2 drop and lung ratio
heinrichsweikamp
parents:
476
diff
changeset
|
622 |
582 | 623 customview_init_view12: ; PSCR Info |
624 btfss FLAG_pscr_mode ; In PSCR mode? | |
625 bra customview_toggle ; No, Call next view... | |
626 | |
627 call TFT_pscr_info_mask ; Show ppO2, drop and lung ratio | |
628 call TFT_pscr_info ; Show ppO2, drop and lung ratio | |
629 bra customview_toggle_exit | |
560 | 630 |
582 | 631 customview_init_view13: ; Gas Needs |
632 TSTOSS opt_calc_asc_gasvolume ; check if gas volume calculations is switched on | |
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 | |
637 | |
0 | 638 customview_toggle_exit: |
582 | 639 btfsc divemode ; In Dive Mode? |
640 bsf FLAG_TFT_temp_divemode ; Set flag to redraw temp | |
641 call TFT_standard_color | |
642 bcf toggle_customview ; Clear flag | |
643 return | |
0 | 644 |
582 | 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 | |
0 | 649 bra customview_show_mix_metric |
582 | 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 | |
0 | 660 customview_show_mix_metric: |
582 | 661 output_99 ; Change depth in lo |
662 STRCAT_TEXT tMeters | |
663 return | |
0 | 664 |
665 | |
582 | 666 global customview_show_mix |
667 customview_show_mix: ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
668 tstfsz hi ; He=0? | |
669 bra customview_show_mix5 ; No, Show a TX | |
0 | 670 movlw .21 |
582 | 671 cpfseq lo ; Air? |
672 bra customview_show_mix2 ; No | |
673 STRCAT_TEXT tSelectAir ; Yes, show "Air" | |
674 bra customview_show_mix4b | |
0 | 675 customview_show_mix2: |
676 movlw .100 | |
582 | 677 cpfseq lo ; O2? |
678 bra customview_show_mix3 ; No | |
679 STRCAT_TEXT tSelectO2 ; Yes, show "O2" | |
680 bra customview_show_mix4b | |
0 | 681 |
682 customview_show_mix3: | |
683 movlw .21 | |
582 | 684 cpfslt lo ; < Nx21? |
685 bra customview_show_mix4 ; No | |
686 STRCAT_TEXT tGasErr ; Yes, show "Err" | |
687 output_99 ; O2 ratio is still in "lo" | |
688 bra customview_show_mix4c | |
0 | 689 |
690 customview_show_mix4: | |
582 | 691 STRCAT_TEXT tSelectNx ; Show "Nx" |
692 output_99 ; O2 ratio is still in "lo" | |
0 | 693 customview_show_mix4b: |
582 | 694 STRCAT " " |
0 | 695 customview_show_mix4c: |
582 | 696 btfsc divemode ; In divemode |
697 return ; Yes | |
698 STRCAT " " | |
699 return | |
0 | 700 |
701 customview_show_mix5: | |
582 | 702 btfsc divemode |
703 bra customview_show_mix6 | |
704 STRCAT_TEXT tSelectTx ; Show "Tx" | |
0 | 705 customview_show_mix6: |
582 | 706 output_99 ; O2 ratio is still in "lo" |
707 PUTC "/" | |
708 movff hi,lo | |
709 output_99 ; He ratio | |
710 return | |
0 | 711 |
712 END |