annotate src/customview.asm @ 39:e4e91fe8b09d

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