Mercurial > public > hwos_code
annotate src/customview.asm @ 41:5041477eee79
Surface customview with important deco settings
author | mh@mh-THINK |
---|---|
date | Thu, 15 Aug 2013 15:37:34 +0200 |
parents | e4e91fe8b09d |
children | 7c7d7644ca37 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File customview.asm | |
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 | |
14 #include "ostc3.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 | |
25 gui CODE | |
26 | |
27 ;============================================================================= | |
28 ; Do every-second tasks for the custom view area (Dive mode) | |
29 | |
30 global customview_second | |
31 customview_second: | |
32 movff menupos3,WREG ; copy | |
33 dcfsnz WREG,F | |
34 bra customview_1sec_view1 | |
35 dcfsnz WREG,F | |
36 bra customview_1sec_view2 | |
37 dcfsnz WREG,F | |
38 bra customview_1sec_view3 | |
39 dcfsnz WREG,F | |
40 bra customview_1sec_view4 | |
41 dcfsnz WREG,F | |
42 bra customview_1sec_view5 | |
43 ; Menupos3=0, do nothing | |
44 return | |
45 | |
46 customview_1sec_view3: | |
47 call TFT_decoplan ; Show decoplan | |
48 return | |
49 customview_1sec_view2: | |
50 call TFT_update_avr_stopwatch ; Update average depth and stopwatch | |
51 return | |
52 customview_1sec_view1: | |
53 call TFT_update_hud ; Update HUD data | |
54 return | |
55 customview_1sec_view4: | |
56 call TFT_ead_end_tissues_clock ; Update EAD/END, Tissues and clock | |
57 return | |
58 customview_1sec_view5: | |
59 call TFT_gf_info ; Update GF informations | |
60 return | |
61 | |
62 ;============================================================================= | |
63 ; Do every-minute tasks for the custom view area | |
64 | |
65 global customview_minute | |
66 customview_minute: | |
67 return | |
68 ; movff menupos3,WREG ; copy | |
69 ; dcfsnz WREG,F | |
70 ; bra customview_1min_view1 | |
71 ; dcfsnz WREG,F | |
72 ; bra customview_1min_view2 | |
73 ; dcfsnz WREG,F | |
74 ; bra customview_1min_view3 | |
75 ; dcfsnz WREG,F | |
76 ; bra customview_1min_view4 | |
77 ; dcfsnz WREG,F | |
78 ; bra customview_1min_view5 | |
79 ; dcfsnz WREG,F | |
80 ; bra customview_1min_view6 | |
81 ; dcfsnz WREG,F | |
82 ; bra customview_1min_view7 | |
83 ; dcfsnz WREG,F | |
84 ; bra customview_1min_view8 | |
85 ; dcfsnz WREG,F | |
86 ; bra customview_1min_view9 | |
87 ; dcfsnz WREG,F | |
88 ; bra customview_1min_view10 | |
89 ; dcfsnz WREG,F | |
90 ; bra customview_1min_view11 | |
91 ; ; Menupos3=0, do nothing | |
92 ; return | |
93 ; | |
94 ;customview_1min_view1: | |
95 ;customview_1min_view2: | |
96 ;customview_1min_view3: | |
97 ;customview_1min_view4: | |
98 ;customview_1min_view5: | |
99 ;customview_1min_view6: | |
100 ;customview_1min_view7: | |
101 ;customview_1min_view8: | |
102 ;customview_1min_view9: | |
103 ;customview_1min_view10: | |
104 ;customview_1min_view11: | |
105 ; return | |
106 | |
107 global surf_customview_toggle | |
108 surf_customview_toggle: | |
109 bcf switch_right | |
110 incf menupos3,F ; Number of customview to show | |
41 | 111 movlw d'7' ; Max number of customsviews in surface mode |
0 | 112 cpfsgt menupos3 ; Max reached? |
113 bra surf_customview_mask ; No, show | |
114 movlw .1 | |
115 movwf menupos3 ; Reset to one (Always one custom view visible) | |
116 | |
117 global surf_customview_mask | |
118 surf_customview_mask: | |
119 WIN_BOX_BLACK batt_voltage_row+.16,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right | |
120 call TFT_standard_color | |
121 movff menupos3,WREG ; Menupos3 holds number of customview function | |
122 dcfsnz WREG,F | |
123 bra surf_customview_init_view1 ; OC Gas list | |
124 dcfsnz WREG,F | |
125 bra surf_customview_init_view2 ; CC Dil list | |
126 dcfsnz WREG,F | |
127 bra surf_customview_init_view3 ; CC SP list | |
128 dcfsnz WREG,F | |
129 bra surf_customview_init_view4 ; Custom Text | |
130 dcfsnz WREG,F | |
131 bra surf_customview_init_view5 ; Tissue Diagram | |
41 | 132 dcfsnz WREG,F |
0 | 133 bra surf_customview_init_view6 ; Compass |
41 | 134 dcfsnz WREG,F |
135 bra surf_customview_init_view7 ; Deco settings | |
0 | 136 |
137 call I2C_sleep_accelerometer ; Stop accelerometer | |
138 call I2C_sleep_compass ; Stop compass | |
139 | |
140 movlw .1 | |
141 movwf menupos3 ; Reset to one (Always one custom view visible) | |
142 | |
143 surf_customview_init_view1: ; View1: OC Gas list | |
144 btfsc FLAG_ccr_mode | |
145 bra surf_customview_toggle | |
146 btfsc FLAG_gauge_mode | |
147 bra surf_customview_toggle | |
148 btfsc FLAG_apnoe_mode | |
149 bra surf_customview_toggle | |
150 call TFT_gaslist_surfmode ; Show gas list | |
151 bra customview_toggle_exit ; Done. | |
152 | |
153 surf_customview_init_view2: ; View2: CC Dil list | |
154 btfss FLAG_ccr_mode | |
155 bra surf_customview_toggle | |
156 btfsc FLAG_gauge_mode | |
157 bra surf_customview_toggle | |
158 btfsc FLAG_apnoe_mode | |
159 bra surf_customview_toggle | |
160 call TFT_dillist_surfmode ; Show diluent list | |
161 bra customview_toggle_exit ; Done. | |
162 | |
163 surf_customview_init_view3: ; View3: CC SP list | |
164 btfss FLAG_ccr_mode | |
165 bra surf_customview_toggle | |
166 btfsc FLAG_gauge_mode | |
167 bra surf_customview_toggle | |
168 btfsc FLAG_apnoe_mode | |
169 bra surf_customview_toggle | |
170 call TFT_splist_surfmode ; Show Setpoint list | |
171 bra customview_toggle_exit ; Done. | |
172 | |
173 surf_customview_init_view4: ; View4: Custom text | |
174 call TFT_custom_text ; Show the custom text | |
175 bra customview_toggle_exit ; Done. | |
176 | |
177 surf_customview_init_view5: ; View5: Tissue Diagram | |
178 btfsc FLAG_gauge_mode | |
179 bra surf_customview_toggle | |
180 btfsc FLAG_apnoe_mode | |
181 bra surf_customview_toggle | |
182 call TFT_surface_tissues ; Show Tissue diagram | |
183 bra customview_toggle_exit ; Done. | |
184 | |
185 surf_customview_init_view6: ; View6: Compass | |
186 call I2C_init_accelerometer ; Start accelerometer | |
187 call I2C_init_compass ; Start compass | |
188 call TFT_surface_compass_mask ; Show compass | |
189 bra customview_toggle_exit ; Done. | |
41 | 190 surf_customview_init_view7: |
191 btfsc FLAG_gauge_mode | |
192 bra surf_customview_toggle | |
193 btfsc FLAG_apnoe_mode | |
194 bra surf_customview_toggle | |
195 extern deco_setup_dive | |
196 call deco_setup_dive | |
197 call TFT_surface_decosettings ; Show all deco settings | |
198 bra customview_toggle_exit ; Done. | |
0 | 199 |
200 global menuview_toggle | |
201 menuview_toggle: ; Show Menu or the simulator tasks | |
202 movlw divemode_menuview_timeout | |
203 movwf timeout_counter3 | |
204 bsf menuview | |
205 bcf switch_left | |
206 incf menupos2,F ; Number of options to show | |
207 movlw d'6' ; Max number of options in divemode | |
208 cpfsgt menupos2 ; Max reached? | |
209 bra menuview_mask ; No, show | |
210 global menuview_toggle_reset | |
211 menuview_toggle_reset: ; Timeout occured | |
212 clrf menupos2 | |
213 bcf menuview | |
214 menuview_mask: | |
215 WIN_BOX_BLACK divemode_simtext_row, divemode_simtext_row+.24, divemode_simtext_column, divemode_simtext_column+.49 ; top, bottom, left, right | |
216 btfss FLAG_gauge_mode | |
217 bra menuview_mask2 | |
218 ; Clear some more in gauge mode | |
219 WIN_BOX_BLACK divemode_simtext_row, divemode_simtext_row+.24, divemode_simtext_column+.50, divemode_simtext_column+.70 ; top, bottom, left, right | |
220 menuview_mask2: | |
221 movlw color_yellow | |
222 call TFT_set_color | |
223 WIN_SMALL_INVERT divemode_simtext_column,divemode_simtext_row | |
224 movff menupos2,WREG ; Menupos2 holds number of menu option to show | |
225 dcfsnz WREG,F | |
226 bra menuview_view1 | |
227 dcfsnz WREG,F | |
228 bra menuview_view2 | |
229 dcfsnz WREG,F | |
230 bra menuview_view3 | |
231 dcfsnz WREG,F | |
232 bra menuview_view4 | |
233 dcfsnz WREG,F | |
234 bra menuview_view5 | |
235 dcfsnz WREG,F | |
236 bra menuview_view6 | |
237 menuview_exit: | |
238 call TFT_standard_color | |
239 WIN_INVERT .0 | |
240 return ; Menupos2 = 0, Show nothing | |
241 menuview_view1: | |
242 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
243 bra menuview_toggle ; Call next option | |
244 btfsc FLAG_gauge_mode ; In Gauge mode? | |
245 bra menuview_toggle ; Call next option | |
246 STRCPY_TEXT_PRINT tDivePreMenu ; "Menu?" | |
247 bra menuview_exit ; Done. | |
248 menuview_view2: | |
249 btfss simulatormode_active ; View only for simulator mode | |
250 bra menuview_toggle ; Call next option | |
251 STRCPY_TEXT_PRINT tQuitSim ;"Quit Simulation?" | |
252 bra menuview_exit ; Done. | |
253 menuview_view3: | |
254 btfss simulatormode_active ; View only for simulator mode | |
255 bra menuview_toggle ; Call next option | |
256 STRCPY_TEXT_PRINT tDescent1m ; "Descent 1m" | |
257 bra menuview_exit ; Done. | |
258 menuview_view4: | |
259 btfss simulatormode_active ; View only for simulator mode | |
260 bra menuview_toggle ; Call next option | |
261 STRCPY_TEXT_PRINT tAscent1m ; "Ascend 1m" | |
262 bra menuview_exit ; Done. | |
263 menuview_view5: | |
264 btfss FLAG_apnoe_mode ; In Apnoe mode? | |
265 bra menuview_toggle ; No, call next option | |
266 btfsc FLAG_active_descent ; Are we descending? | |
267 bra menuview_toggle ; Yes | |
268 ; We are at the surface: | |
269 STRCPY_TEXT_PRINT tQuitApnea ; "Quit Apnea mode?" | |
270 bra menuview_exit ; Done. | |
271 menuview_view6: | |
272 btfss FLAG_gauge_mode ; In Gauge mode? | |
273 bra menuview_toggle ; No, call next option | |
274 STRCPY_TEXT_PRINT tDivemenu_ResetAvr ; "Reset Avr." | |
275 bra menuview_exit ; Done. | |
276 | |
277 | |
278 ;============================================================================= | |
279 ; Show next customview (and delete this flag) | |
280 global customview_toggle | |
281 customview_toggle: | |
282 bcf switch_right | |
283 incf menupos3,F ; Number of customview to show | |
284 movlw d'6' ; Max number of customsviews in divemode | |
285 cpfsgt menupos3 ; Max reached? | |
286 bra customview_mask ; No, show | |
287 customview_toggle_reset: ; Timeout occured | |
288 clrf menupos3 ; Reset to zero (Zero=no custom view) | |
39
e4e91fe8b09d
remember last customview in dive and surface mode
mh@mh-THINK.fritz.box
parents:
0
diff
changeset
|
289 global customview_mask |
0 | 290 customview_mask: |
291 call TFT_clear_customview_divemode | |
292 WIN_SMALL divemode_customview_column,divemode_customview_row | |
293 call TFT_standard_color | |
294 movff menupos3,WREG ; Menupos3 holds number of customview function | |
295 dcfsnz WREG,F | |
296 bra customview_init_view1 | |
297 dcfsnz WREG,F | |
298 bra customview_init_view2 | |
299 dcfsnz WREG,F | |
300 bra customview_init_view3 | |
301 dcfsnz WREG,F | |
302 bra customview_init_view4 | |
303 dcfsnz WREG,F | |
304 bra customview_init_view5 ; GF informations | |
305 dcfsnz WREG,F | |
306 bra customview_init_view6 ; Compass | |
307 customview_init_nocustomview: | |
308 call I2C_sleep_accelerometer ; Stop accelerometer | |
309 call I2C_sleep_compass ; Stop compass | |
310 bra customview_toggle_exit | |
311 | |
312 customview_init_view1: | |
313 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
314 bra customview_toggle ; yes, Call next view... | |
315 btfss FLAG_ccr_mode ; In CC mode? | |
316 bra customview_toggle ; no, Call next view... | |
317 | |
318 bsf dive_hud1_displayed ; Set display flag | |
319 bsf dive_hud2_displayed ; Set display flag | |
320 bsf dive_hud3_displayed ; Set display flag | |
321 call TFT_hud_mask ; Setup HUD mask | |
322 call TFT_update_hud ; Update HUD data | |
323 bra customview_toggle_exit | |
324 | |
325 customview_init_view2: | |
326 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
327 bra customview_toggle ; Yes, Call next view... | |
328 call TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch | |
329 call TFT_update_avr_stopwatch ; Update average depth and stopwatch | |
330 bra customview_toggle_exit | |
331 | |
332 customview_init_view3: | |
333 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
334 bra customview_toggle ; Yes, Call next view... | |
335 btfsc FLAG_gauge_mode ; In Gauge mode? | |
336 bra customview_toggle ; Yes, Call next view... | |
337 call TFT_decoplan ; Show decoplan | |
338 bra customview_toggle_exit | |
339 | |
340 customview_init_view4: | |
341 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
342 bra customview_toggle ; Yes, Call next view... | |
343 btfsc FLAG_gauge_mode ; In Gauge mode? | |
344 bra customview_toggle ; Yes, Call next view... | |
345 call TFT_ead_end_tissues_clock_mask ; Setup Mask | |
346 call TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
347 bra customview_toggle_exit | |
348 | |
349 customview_init_view5: | |
350 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
351 bra customview_toggle ; Yes, Call next view... | |
352 btfsc FLAG_gauge_mode ; In Gauge mode? | |
353 bra customview_toggle ; Yes, Call next view... | |
354 call TFT_gf_mask ; Setup Mask | |
355 call TFT_gf_info ; Show GF informations | |
356 bra customview_toggle_exit | |
357 | |
358 customview_init_view6: ; Compass (View 6) | |
359 call I2C_init_accelerometer ; Start accelerometer | |
360 call I2C_init_compass ; Start compass | |
361 call TFT_dive_compass_mask ; Show compass | |
362 bra customview_toggle_exit | |
363 | |
364 customview_toggle_exit: | |
365 call TFT_standard_color | |
366 bcf toggle_customview ; Clear flag | |
367 return | |
368 | |
369 global customview_show_change_depth | |
370 customview_show_change_depth: ; Put " lom" or " loft" into Postinc2 | |
371 PUTC " " | |
372 TSTOSS opt_units ; 0=m, 1=ft | |
373 bra customview_show_mix_metric | |
374 movf lo,W | |
375 mullw .100 ; convert meters to mbar | |
376 movff PRODL,lo | |
377 movff PRODH,hi | |
378 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
379 bsf leftbind | |
380 output_16 ; Change depth in lo:hi | |
381 bcf leftbind | |
382 STRCAT_TEXT tFeets | |
383 return | |
384 customview_show_mix_metric: | |
385 output_99 ; Change depth in lo | |
386 STRCAT_TEXT tMeters | |
387 return | |
388 | |
389 | |
390 global customview_show_mix | |
391 customview_show_mix: ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
392 tstfsz hi ; He=0? | |
393 bra customview_show_mix5 ; No, Show a TX | |
394 movlw .21 | |
395 cpfseq lo ; Air? | |
396 bra customview_show_mix2 ; No | |
397 STRCAT_TEXT tSelectAir ; Yes, show "Air" | |
398 bra customview_show_mix4b | |
399 customview_show_mix2: | |
400 movlw .100 | |
401 cpfseq lo ; O2? | |
402 bra customview_show_mix3 ; No | |
403 STRCAT_TEXT tSelectO2 ; Yes, show "O2" | |
404 bra customview_show_mix4b | |
405 | |
406 customview_show_mix3: | |
407 movlw .21 | |
408 cpfslt lo ; < Nx21? | |
409 bra customview_show_mix4 ; No | |
410 STRCAT_TEXT tGasErr ; Yes, show "Err" | |
411 output_99 ; O2 ratio is still in "lo" | |
412 bra customview_show_mix4c | |
413 | |
414 customview_show_mix4: | |
415 STRCAT_TEXT tSelectNx ; Show "Nx" | |
416 output_99 ; O2 ratio is still in "lo" | |
417 customview_show_mix4b: | |
418 STRCAT " " | |
419 customview_show_mix4c: | |
420 btfsc divemode ; In divemode | |
421 return ; Yes | |
422 STRCAT " " | |
423 return | |
424 | |
425 customview_show_mix5: | |
426 btfsc divemode | |
427 bra customview_show_mix6 | |
428 STRCAT_TEXT tSelectTx ; Show "Tx" | |
429 customview_show_mix6: | |
430 output_99 ; O2 ratio is still in "lo" | |
431 PUTC "/" | |
432 movff hi,lo | |
433 output_99 ; He ratio | |
434 return | |
435 | |
436 END |