annotate src/customview.asm @ 88:2a992aba61ef

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