Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/surfmode.asm @ 371:160b3216b335 64kByte Logbook
x-scale in logbook fixed
author | Heinrichsweikamp |
---|---|
date | Fri, 10 Jun 2011 13:57:28 +0200 |
parents | b5b030c1ae7e |
children | 6f7965ec5f49 |
rev | line source |
---|---|
254 | 1 f |
0 | 2 ; OSTC - diving computer code |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; routines for Surface mode | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 10/01/05 | |
22 ; last updated: 080905 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 surfloop: | |
27 ; Boot tasks for all modes | |
28 call restart_set_modes_and_flags ; Sets decomode flags | |
29 clrf lo | |
30 movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface! | |
31 | |
32 call PLED_brightness_full ;max. brightness | |
33 | |
34 call I2CReset | |
35 call enable_rs232 | |
36 call PLED_boot | |
37 call PLED_serial ; Show OSTC serial and firmware version | |
38 call PLED_clock ; display time | |
39 call update_date ; display date | |
40 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine | |
41 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values | |
42 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine | |
43 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; 30min old values | |
44 | |
156 | 45 clrf menupos3 ; Reset Custom views (Default: No custom view) |
46 | |
0 | 47 btfsc gauge_mode ; Ignore in gauge mode |
48 bra surfloop1 | |
49 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
50 bra surfloop1 | |
51 | |
52 ; Startup tasks for decompression modes | |
43 | 53 call PLED_display_cns_surface ; Update surface CNS display (If allowed by CF15) |
0 | 54 call PLED_desaturation_time ; display desaturation time |
55 call PLED_nofly_time ; display nofly time | |
13 | 56 |
0 | 57 call PLED_active_gas_surfmode ; Show start gas |
58 call PLED_display_decotype_surface ; Show deco mode (ZH-L16, const. ppO2 or Multi-GF) | |
59 | |
60 surfloop1: | |
61 btfss gauge_mode ; Display only in gauge mode | |
62 bra surfloop2 | |
63 DISPLAYTEXT d'103' ; Gauge mode | |
64 surfloop2: | |
65 btfss FLAG_apnoe_mode ; Display only in Apnoe mode | |
66 bra surfloop3 | |
67 DISPLAYTEXT d'116' ; Apnoe mode | |
68 | |
69 surfloop3: | |
70 ; Startup tasks for all modes | |
71 clrf timeout_counter2 | |
72 clrf timeout_counter3 | |
73 bcf premenu ; clear premenu flag | |
74 bcf menubit ; clear menu flag | |
75 bcf pressure_refresh | |
76 clrf last_pressure+0 | |
77 clrf last_pressure+1 | |
78 clrf last_temperature+0 | |
79 clrf last_temperature+1 | |
80 | |
81 movlw d'5' | |
82 movwf timeout_counter ; reload counter | |
83 | |
21 | 84 bcf LED_blue |
85 bcf LED_red | |
0 | 86 bcf simulatormode_active ; Quit simulator mode (if active) |
87 bcf standalone_simulator ; Quit simulator mode (if active) | |
88 WIN_TOP .0 | |
89 WIN_LEFT .0 | |
90 WIN_FONT FT_SMALL | |
91 WIN_INVERT .0 ; Init new Wordprocessor | |
3 | 92 call PLED_standard_color |
93 | |
0 | 94 bcf switch_left |
95 bcf switch_right | |
4 | 96 call PLED_active_gas_surfmode ; Show start gas / SetPoint |
0 | 97 call PLED_custom_text ; Displays custom text |
100 | 98 clrf cf_checker_counter ; next cf to check |
0 | 99 ostc_debug 'G' ; Sends debug-information to screen if debugmode active |
233 | 100 |
101 ; Desaturation time needs: | |
102 ; int_I_pres_surface | |
103 ; char_I_desaturation_multiplier | |
0 | 104 GETCUSTOM8 d'12' ; Desaturation multiplier % |
233 | 105 movff WREG,char_I_desaturation_multiplier |
106 | |
116 | 107 call deco_calc_desaturation_time ; calculate desaturation time |
0 | 108 movlb b'00000001' ; select ram bank 1 |
109 ostc_debug 'H' ; Sends debug-information to screen if debugmode active | |
110 | |
111 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
112 | |
113 surfloop_loop: | |
114 btfss onesecupdate ; do every second tasks? | |
115 bra surfloop_loop2 ; no, loop | |
116 | |
117 btfss FLAG_const_ppO2_mode ; are we in const. ppO2 mode? | |
118 bra surfloop_loop1 ; No | |
119 ; One Second tasks for ppO2 modes | |
120 | |
285 | 121 bra surfloop_loop1 ; |
0 | 122 |
123 surfloop_loop1: | |
124 ; One Second tasks for all modes | |
125 call PLED_clock ; update clock | |
126 call test_charger ; check if charger IC is active | |
127 call timeout_surfmode ; check timeout | |
128 call get_battery_voltage ; get battery voltage | |
129 call update_batt_voltage ; display battery voltage | |
130 call timeout_premenu ; timeout premenu | |
131 call set_leds_surfmode ; Sets Warning and No-Fly LEDs | |
94 | 132 call check_customfunctions ; Checks CF functions and displays warning symbol if something critical is wrong |
0 | 133 call PLED_display_decotype_surface ; Show deco mode |
107 | 134 call surfcustomview_second ; Do every-second tasks for the custom view area |
110 | 135 call dive_type_icons ; Draw Air/Nitrox/Trimix color icon. |
0 | 136 btfsc enter_error_sleep ; Enter Fatal Error Routine? |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
70
diff
changeset
|
137 call fatal_error_sleep ; Yes (In Sleepmode.asm!) |
0 | 138 bcf onesecupdate ; every second tasks done |
139 | |
140 surfloop_loop2: | |
141 ; Tasks approx. every 50ms for all modes | |
142 call test_switches_surfmode ; check switches | |
143 | |
144 ; Sensor tasks for all modes | |
145 btfsc pressure_refresh ; new pressure available? | |
146 call update_surf_press ; display surface pressure | |
147 btfsc pressure_refresh ; new temperature available? | |
148 call PLED_temp_surfmode ; Displays temperature | |
149 btfsc pressure_refresh ; new pressure available? | |
150 call set_dive_modes ; tests if depth>threshold | |
125 | 151 |
152 ; jDG TESTS ========================= | |
153 btfss pressure_refresh ; new pressure available? | |
154 bra surfloop_loop3 | |
155 call altimeter_calc | |
156 movf menupos3,W ; Get customview status. | |
157 bnz surfloop_loop3 ; Already used ? | |
158 call altimeter_display | |
159 surfloop_loop3: | |
160 ; jDG TESTS ========================= | |
161 | |
0 | 162 bcf pressure_refresh ; until new pressure is available |
163 | |
164 ; One minute tasks for all modes | |
165 btfsc oneminupdate ; do every minute tasks | |
166 call update_surfloop60 ; yes, e.g. update time and date | |
167 | |
168 ; Mode tasks | |
169 btfsc menubit ; Menu? | |
170 goto menu ; Menu! | |
171 btfsc divemode ; Divemode active? | |
172 goto diveloop ; Yes, switch into Divemode! | |
173 btfsc sleepmode ; Sleepmode active? | |
174 goto sleeploop ; Yes, switch into sleepmode! | |
107 | 175 |
176 btfsc toggle_customview ; Next view? | |
177 call surfcustomview_toggle ; Yes, show next customview (and delete this flag) | |
178 | |
0 | 179 ; Check for the different UART flags |
180 btfsc dump_external_eeprom ; Start interface (dumps EEPROM BANK 0 + additional data)? | |
181 goto menu_interface ; Yes! | |
182 btfsc uart_settime ; Sync clock with PC? | |
183 goto sync_clock ; Yes! | |
184 btfsc internal_eeprom_write ; Access internal EEPROM BANK 0 via UART module | |
185 goto internal_eeprom_access_b0 ; Yes! | |
186 btfsc internal_eeprom_write2 ; Access internal EEPROM BANK 1 via UART module | |
187 goto internal_eeprom_access_b1 ; Yes! | |
188 btfsc uart_send_hash ; Send MD2 hash values | |
189 goto send_md2_hash ; Yes! | |
190 btfsc uart_send_int_eeprom ; Send internal EEPROM BANK 0 | |
191 goto send_int_eeprom_b0 ; Yes! | |
192 btfsc uart_reset_decodata ; Reset Deco Data? | |
193 goto reset_decodata ; Yes! | |
194 btfsc uart_send_int_eeprom2 ; Send internal EEPROM BANK 1 | |
195 goto send_int_eeprom_b1 ; Yes! | |
283
4ec488f046f4
Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents:
257
diff
changeset
|
196 btfsc uart_store_tissue_data ; Store tissue data? |
0 | 197 goto uart_store_tissues ; Yes! |
283
4ec488f046f4
Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents:
257
diff
changeset
|
198 btfsc uart_115200_bootloader ; Look for 115200Baud bootloader? |
4ec488f046f4
Battery sign color coded, work on new uart-started 115200Baud bootloader (Do NOT use yet!)
heinrichsweikamp
parents:
257
diff
changeset
|
199 goto uart_115k_bootloader ; Yes! |
297
ceedf078b2d8
Gas Setup page 2 reworked, Texts 107, 108, 109,150, 149, 168, 42, 43, 53,54,55, 165 need update in french, spanish and german
Heinrichsweikamp
parents:
285
diff
changeset
|
200 btfsc uart_reset_battery_stats ; Reset Battery stats? |
ceedf078b2d8
Gas Setup page 2 reworked, Texts 107, 108, 109,150, 149, 168, 42, 43, 53,54,55, 165 need update in french, spanish and german
Heinrichsweikamp
parents:
285
diff
changeset
|
201 goto reset_battery_stats ; Yes! |
0 | 202 |
330 | 203 btfsc uart_dump_screen ; Dumps screen contains ? |
331 | 204 call dump_screen ; Yes! |
0 | 205 |
206 bra surfloop_loop ; loop surfacemode | |
207 | |
208 | |
209 update_surfloop60: | |
210 ; One minute tasks for all modes | |
4 | 211 ; call PLED_active_gas_surfmode ; Show start gas / SetPoint |
0 | 212 call update_date ; and date in divemode |
213 call calc_deko_surfmode ; calculate desaturation every minute | |
214 call check_temp_extrema ; check for new temperature extremas | |
215 call PLED_custom_text ; Displays custom text | |
216 call calc_surface_interval ; Increases Surface-Interval time | |
107 | 217 call surfcustomview_minute ; Do every-minute tasks for the custom view area |
0 | 218 |
219 btfsc gauge_mode ; Ignore in gauge mode | |
220 bra update_surfloop60_2 | |
221 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
222 bra update_surfloop60_2 | |
223 | |
224 ; One Minute tasks for deco modes | |
43 | 225 call PLED_display_cns_surface ; Update surface CNS display (If allowed by CF15) |
0 | 226 call PLED_nofly_time ; display nofly time |
227 call PLED_desaturation_time ; display desaturation time | |
13 | 228 btfsc premenu ; Not when "Menu?" is displayed! |
229 bra update_surfloop60_2 | |
230 | |
0 | 231 update_surfloop60_2: |
232 call nofly_timeout60 ; checks if nofly time is > 0 | |
233 bcf oneminupdate | |
234 return | |
235 | |
236 nofly_timeout60: | |
229
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
237 movf nofly_time+0,W ; Is nofly null ? |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
238 iorwf nofly_time+1,W |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
239 bnz nofly_timeout60_1 ; No... |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
240 |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
241 bcf nofly_active ; Clear flag |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
242 bcf LED_blue ; Clear led. |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
243 return |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
244 |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
245 nofly_timeout60_1: |
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
246 bsf nofly_active ; Set flag |
0 | 247 movlw d'1' |
248 subwf nofly_time+0,F | |
249 movlw d'0' | |
229
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
156
diff
changeset
|
250 subwfb nofly_time+1,F ; reduce by one |
0 | 251 return |
252 | |
253 calc_surface_interval: | |
254 movff int_O_desaturation_time+0,lo ; divide by 60... | |
255 movff int_O_desaturation_time+1,hi | |
256 tstfsz lo ;=0? | |
257 bra calc_surface_interval2 ; No | |
258 tstfsz hi ;=0? | |
259 bra calc_surface_interval2 ; No | |
260 clrf surface_interval+0 | |
261 clrf surface_interval+1 ; Clear surface interval timer | |
262 return | |
263 | |
264 calc_surface_interval2: ; Increase surface interval timer | |
265 movlw d'1' | |
266 addwf surface_interval+0,F | |
267 movlw d'0' | |
268 addwfc surface_interval+1,F | |
269 return | |
270 | |
271 set_leds_surfmode: | |
272 btfsc nofly_active | |
21 | 273 btg LED_blue |
0 | 274 return |
275 | |
353
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
276 ;============================================================================= |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
277 |
0 | 278 calc_deko_surfmode: |
279 ostc_debug 'I' ; Sends debug-information to screen if debugmode active | |
280 | |
281 movff last_surfpressure+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine | |
282 movff last_surfpressure+1,int_I_pres_surface+1 | |
353
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
283 clrf WREG ; Use as buffer |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
284 movff WREG,char_I_He_ratio ; No He at the Surface |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
285 movlw d'79' ; 79% N2 |
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
286 movff WREG,char_I_N2_ratio ; Air at the Surface |
0 | 287 |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
297
diff
changeset
|
288 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine |
0 | 289 GETCUSTOM8 d'11' ; Saturation multiplier % |
236 | 290 movff WREG,char_I_saturation_multiplier |
0 | 291 GETCUSTOM8 d'12' ; Desaturation multiplier % |
236 | 292 movff WREG,char_I_desaturation_multiplier |
0 | 293 |
116 | 294 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode |
0 | 295 movlb b'00000001' ; select ram bank 1 |
296 ostc_debug 'J' ; Sends debug-information to screen if debugmode active | |
254 | 297 |
257
f8f869bafd92
Use timer TMR3 to limit loops in calc_hauptroutine_calc_deco()
JeanDo
parents:
254
diff
changeset
|
298 movff int_O_desaturation_time+0,desaturation_time_buffer+0 |
f8f869bafd92
Use timer TMR3 to limit loops in calc_hauptroutine_calc_deco()
JeanDo
parents:
254
diff
changeset
|
299 movff int_O_desaturation_time+1,desaturation_time_buffer+1 |
254 | 300 |
0 | 301 return |
302 | |
353
b5b030c1ae7e
Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents:
344
diff
changeset
|
303 ;============================================================================= |
0 | 304 |
305 test_charger: | |
306 bcf TRISC,1 ; CHRG_OUT output | |
307 bsf CHRG_OUT | |
308 | |
309 bcf cc_active ; Constant Current mode active? | |
310 btfss CHRG_IN ; If CHRG_IN=0 -> CC active | |
311 bsf cc_active ; Constant Current mode Active! | |
312 | |
313 bcf CHRG_OUT | |
314 bsf TRISC,1 ; CHRG_OUT high impedance | |
315 | |
316 WAIT10US d'10' | |
317 | |
318 bcf cv_active ; Constant Voltage mode Active? | |
319 btfss CHRG_IN ; If CHRG_IN=0 -> CV active | |
320 bsf cv_active ; Constant Voltage mode active! | |
321 | |
322 bcf TRISC,1 ; CHRG_OUT output | |
323 bcf CHRG_OUT | |
324 | |
325 btfsc cc_active | |
326 bra show_cc_active | |
327 btfsc cv_active | |
328 bra show_cv_active | |
329 | |
330 bsf TRISC,1 ; CHRG_OUT high impedance | |
331 | |
332 ; Charger inactive or ready | |
333 btfss charge_done ; charge done? | |
334 bra test_charger2 ; No, add incomplete cycle! | |
335 | |
336 ; Yes, store all data for complete cycle | |
337 bcf charge_started ; Clear flag | |
338 bcf charge_done ; Clear flag | |
339 ; Store incomplete/total cycles | |
340 read_int_eeprom d'50' ; Read byte (stored in EEDATA) | |
341 movff EEDATA,temp1 ; Low byte | |
342 read_int_eeprom d'51' ; Read byte (stored in EEDATA) | |
343 movff EEDATA,temp2 ; high byte | |
344 bcf STATUS,C | |
345 movlw d'1' | |
346 addwf temp1 | |
347 movlw d'0' | |
348 addwfc temp2 | |
349 movff temp1,EEDATA | |
350 write_int_eeprom d'50' ; write byte stored in EEDATA | |
351 movff temp2,EEDATA | |
352 write_int_eeprom d'51' ; write byte stored in EEDATA | |
353 | |
354 ; Store complete cycles | |
355 read_int_eeprom d'52' ; Read byte (stored in EEDATA) | |
356 movff EEDATA,temp1 ; Low byte | |
357 read_int_eeprom d'53' ; Read byte (stored in EEDATA) | |
358 movff EEDATA,temp2 ; high byte | |
359 bcf STATUS,C | |
360 movlw d'1' | |
361 addwf temp1 | |
362 movlw d'0' | |
363 addwfc temp2 | |
364 movff temp1,EEDATA | |
365 write_int_eeprom d'52' ; write byte stored in EEDATA | |
366 movff temp2,EEDATA | |
367 write_int_eeprom d'53' ; write byte stored in EEDATA | |
368 ; Store date of complete cycle | |
369 movff month,EEDATA | |
370 write_int_eeprom d'47' | |
371 movff day,EEDATA | |
372 write_int_eeprom d'48' | |
373 movff year,EEDATA | |
374 write_int_eeprom d'49' | |
375 | |
376 return | |
377 | |
378 test_charger2: | |
379 btfss charge_started ; Did the charger ever start? | |
380 return ; No, quit! | |
381 | |
382 bcf charge_started ; Clear flag | |
383 ; Store incomplete/total cycles | |
384 read_int_eeprom d'50' ; Read byte (stored in EEDATA) | |
385 movff EEDATA,temp1 ; Low byte | |
386 read_int_eeprom d'51' ; Read byte (stored in EEDATA) | |
387 movff EEDATA,temp2 ; high byte | |
388 bcf STATUS,C | |
389 movlw d'1' | |
390 addwf temp1 | |
391 movlw d'0' | |
392 addwfc temp2 | |
393 movff temp1,EEDATA | |
394 write_int_eeprom d'50' ; write byte stored in EEDATA | |
395 movff temp2,EEDATA | |
396 write_int_eeprom d'51' ; write byte stored in EEDATA | |
397 return | |
398 | |
399 show_cv_active: ; CV mode | |
21 | 400 bsf LED_red |
0 | 401 WAITMS d'100' |
21 | 402 bcf LED_red |
0 | 403 WAITMS d'100' |
21 | 404 bsf LED_red |
0 | 405 bsf charge_done ; Charge cycle finished |
406 return | |
407 | |
408 show_cc_active: ; CC mode | |
21 | 409 bsf LED_red |
0 | 410 bsf charge_started ; Charger started in CC mode |
411 bcf charge_done ; Charge cycle not finished | |
412 return | |
413 | |
414 | |
415 timeout_premenu: | |
416 btfss premenu ; is "Menu?" displayed? | |
417 return ; No | |
418 incf timeout_counter3,F ; Yes... | |
419 GETCUSTOM8 d'4' ; loads premenu_timeout into WREG | |
420 cpfsgt timeout_counter3 ; ... longer then premenu_timeout | |
421 return ; No! | |
422 bcf premenu ; Yes, so clear "Menu?" and clear pre_menu bit | |
423 | |
424 call PLED_topline_box_clear ; Clears Bar at the top | |
425 | |
426 btfsc gauge_mode | |
427 bra timeout_premenu2 ; Skip in Gauge mode | |
428 btfsc FLAG_apnoe_mode | |
429 bra timeout_premenu2 ; Skip in Apnoe mode | |
13 | 430 |
0 | 431 timeout_premenu2: |
432 call update_surf_press ; rewrite serial number | |
433 call PLED_serial ; rewrite serial number | |
434 clrf timeout_counter3 ; Also clear timeout | |
435 bcf switch_left ; and debounce switches | |
436 bcf switch_right | |
437 return | |
438 | |
439 test_switches_surfmode: ; checks switches in surfacemode | |
440 btfsc switch_left | |
441 bra test_switches_surfmode2 | |
442 btfsc switch_right | |
443 bra test_switches_surfmode3 | |
444 | |
445 ; No button press, reset timer0 | |
446 bcf T0CON,TMR0ON ; Stop Timer 0 | |
447 bcf INTCON,TMR0IF ; Clear flag | |
448 clrf TMR0H | |
449 clrf TMR0L | |
450 bcf INTCON,INT0IF ; Clear flag | |
451 bcf INTCON3,INT1IF ; Clear flag | |
452 return | |
453 | |
454 test_switches_surfmode3: | |
455 bcf switch_right | |
456 call PLED_topline_box ; Write a filled bar at the top | |
457 WIN_INVERT .1 ; Init new Wordprocessor | |
458 DISPLAYTEXT .4 ;Menu? | |
459 WIN_INVERT .0 ; Init new Wordprocessor | |
460 bsf premenu | |
461 clrf timeout_counter2 | |
462 return | |
463 | |
464 test_switches_surfmode2: | |
465 bcf switch_left | |
466 btfss premenu | |
13 | 467 bra test_switches_surfmode4 |
0 | 468 bsf menubit ; Enter Menu! |
469 return | |
470 | |
13 | 471 test_switches_surfmode4: |
107 | 472 bsf toggle_customview ; Toggle customview (Cleared in customview.asm) |
13 | 473 return |
0 | 474 |
475 timeout_surfmode: | |
476 incf timeout_counter2,F ; increase timeout counter | |
477 GETCUSTOM8 d'3' ; loads surfloop_timeout into WREG | |
478 addlw d'5' ; adds five seconds in case timout=zero! | |
479 btfsc STATUS,C ; > 255? | |
480 movlw d'255' ; Set to 255... | |
481 decf WREG,F ; Limit to 254 | |
482 cpfsgt timeout_counter2 ; Compare with timeout_counter2 | |
483 return ; return, no timeout | |
484 bsf sleepmode ; Set Flag | |
485 return ; Return |