Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu.asm @ 560:3a863016cb40
2.21 release
author | heinrichsweikamp |
---|---|
date | Wed, 22 Feb 2012 13:20:36 +0100 |
parents | 2ac77db9c150 |
children | 101fec6a6137 |
rev | line source |
---|---|
0 | 1 |
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 ; Main Menu and Setup menu | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 11/1/05 | |
22 ; last updated: 05/15/80 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 wait_switches: | |
27 bcf switch_left | |
28 bcf switch_right | |
41 | 29 return |
0 | 30 |
31 menu: | |
32 bcf deco_mode_changed ; Clear flag (Description is only showed once) | |
41 | 33 bcf LED_blue |
0 | 34 movlw d'1' |
35 movwf menupos | |
36 menu2: | |
37 | |
38 bcf leftbind | |
39 call PLED_ClearScreen | |
40 clrf timeout_counter2 | |
41 bcf sleepmode | |
42 bcf menubit2 | |
43 bcf menubit3 | |
44 bsf menubit | |
45 bsf cursor | |
46 call PLED_menu_mask | |
47 call PLED_menu_cursor | |
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:
188
diff
changeset
|
48 rcall wait_switches |
0 | 49 |
50 menu_loop: | |
51 call check_switches_menu | |
52 | |
53 btfsc menubit2 | |
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:
188
diff
changeset
|
54 bra do_menu ; call submenu |
0 | 55 |
56 btfss menubit | |
57 goto restart ; exit menu, restart | |
58 | |
59 btfsc onesecupdate | |
60 call timeout_surfmode | |
61 | |
62 btfsc onesecupdate | |
63 call set_dive_modes | |
64 | |
65 btfsc onesecupdate | |
66 call test_charger ; check if charger IC is active | |
67 | |
68 btfsc onesecupdate | |
69 call get_battery_voltage ; get battery voltage | |
70 | |
71 bcf onesecupdate ; End of one second tasks | |
72 | |
73 btfsc sleepmode | |
74 goto restart | |
75 | |
76 btfsc divemode | |
77 goto restart ; exit menu, restart and enter divemode | |
78 | |
79 bra menu_loop | |
80 | |
337 | 81 check_switches_menu: ; checks switches |
82 btfsc uart_dump_screen ; Asked to dump screen contains ? | |
83 call dump_screen ; Yes! | |
84 | |
0 | 85 btfss switch_right |
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:
188
diff
changeset
|
86 bra check_switches_menu2 |
0 | 87 bsf menubit3 |
88 incf menupos,F | |
89 movlw d'6' | |
90 cpfsgt menupos | |
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:
188
diff
changeset
|
91 bra refresh_cursor |
0 | 92 movlw d'1' |
93 movwf menupos | |
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:
188
diff
changeset
|
94 bra refresh_cursor |
0 | 95 check_switches_menu2: |
96 btfsc switch_left | |
97 bsf menubit2 ; Enter! | |
98 return | |
99 | |
100 | |
101 do_menu: ; calls submenu | |
102 dcfsnz menupos,F | |
103 goto menu_logbook | |
104 dcfsnz menupos,F | |
105 goto menu_gassetup | |
106 dcfsnz menupos,F | |
107 goto menu_reset | |
108 dcfsnz menupos,F | |
109 goto setup_menu | |
110 dcfsnz menupos,F | |
111 goto more_menu | |
112 dcfsnz menupos,F | |
113 goto restart ; exit... | |
114 | |
115 refresh_cursor: | |
116 clrf timeout_counter2 | |
117 btfsc cursor | |
118 call PLED_menu_cursor | |
119 bcf switch_right | |
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:
188
diff
changeset
|
120 bcf switch_left |
0 | 121 return |
122 | |
123 more_menu: | |
124 movlw d'1' | |
125 movwf menupos | |
126 more_menu2: | |
127 bcf leftbind | |
128 call PLED_ClearScreen | |
129 more_menu3: | |
130 clrf timeout_counter2 | |
131 bcf sleepmode | |
132 bcf menubit2 | |
133 bcf menubit3 | |
134 bsf menubit | |
135 bsf cursor | |
136 call PLED_more_menu_mask | |
137 call PLED_menu_cursor | |
138 bcf switch_left | |
139 bcf switch_right | |
140 more_menu_loop: | |
141 call check_switches_menu | |
142 | |
125 | 143 ; movlw d'5' ; 5 items in "More Menu" |
144 ; cpfseq menupos | |
145 ; bra more_menu_loop2 | |
146 ; movlw d'6' | |
147 ; movwf menupos | |
148 ; call PLED_menu_cursor | |
149 | |
150 ;more_menu_loop2: | |
0 | 151 btfsc menubit2 |
152 bra do_more_menu ; call submenu | |
153 | |
154 btfss menubit | |
155 bra menu ; exit setup menu and return to main menu | |
156 | |
157 btfsc onesecupdate | |
158 call timeout_surfmode | |
159 | |
160 btfsc onesecupdate | |
161 call set_dive_modes | |
162 | |
163 btfsc onesecupdate | |
164 call test_charger ; check if charger IC is active | |
165 | |
166 btfsc onesecupdate | |
167 call get_battery_voltage ; get battery voltage | |
168 | |
169 bcf onesecupdate ; End of one second tasks | |
170 | |
171 btfsc sleepmode | |
172 bra menu | |
173 | |
174 btfsc divemode | |
175 goto restart ; exit menu, restart and enter divemode | |
176 | |
177 bra more_menu_loop | |
178 | |
179 do_more_menu: ; calls submenu | |
180 dcfsnz menupos,F | |
181 goto menu_settime | |
182 dcfsnz menupos,F | |
183 goto menu_const_ppO2 | |
184 dcfsnz menupos,F | |
185 goto menu_battery_state | |
186 dcfsnz menupos,F | |
187 goto menu_simulator | |
188 dcfsnz menupos,F | |
125 | 189 goto altimeter_menu |
0 | 190 movlw d'5' |
191 movwf menupos | |
192 bra menu2 ; exit... | |
193 | |
194 setup_menu: | |
195 bcf deco_mode_changed ; Clear flag | |
196 movlw d'1' | |
197 movwf menupos | |
198 setup_menu2: | |
199 bcf leftbind | |
200 call PLED_ClearScreen | |
201 call PLED_setup_menu_mask | |
202 setup_menu3a: | |
203 clrf timeout_counter2 | |
204 bcf sleepmode | |
205 bcf menubit2 | |
206 bcf menubit3 | |
207 bsf menubit | |
208 bsf cursor | |
209 call show_decotype | |
210 call show_salinity_value | |
211 call PLED_menu_cursor | |
212 bcf switch_left | |
213 bcf switch_right | |
214 | |
215 setup_menu_loop: | |
216 call check_switches_menu | |
217 | |
218 btfsc menubit2 | |
219 bra do_setup_menu ; call submenu | |
220 | |
221 btfss menubit | |
222 goto restart ; exit menu, restart and enter surfmode | |
223 btfsc onesecupdate | |
224 call timeout_surfmode | |
225 btfsc onesecupdate | |
226 call set_dive_modes | |
227 btfsc onesecupdate | |
228 call test_charger ; check if charger IC is active | |
229 btfsc onesecupdate | |
230 call get_battery_voltage ; get battery voltage | |
231 | |
232 bcf onesecupdate ; End of one second tasks | |
233 | |
234 btfsc sleepmode | |
235 goto restart ; exit menu, restart and enter surfmode | |
236 | |
237 btfsc divemode | |
238 goto restart ; exit menu, restart and enter divemode | |
239 | |
240 bra setup_menu_loop | |
241 | |
242 | |
243 do_setup_menu: ; calls submenu | |
244 dcfsnz menupos,F | |
245 goto menu_custom_functions | |
246 dcfsnz menupos,F | |
247 goto menu_custom_functions_page2 | |
248 dcfsnz menupos,F | |
249 bra toggle_salinity | |
250 dcfsnz menupos,F | |
251 bra toggle_decotype | |
252 dcfsnz menupos,F | |
253 bra more_setup_menu | |
254 bra exit_setup_menu ; exit... | |
255 | |
256 toggle_decotype: | |
257 bsf deco_mode_changed ; Set flag | |
258 read_int_eeprom d'34' ; Read deco data | |
259 incf EEDATA,F | |
260 | |
261 toggle_decotype0: | |
262 movlw d'6' ; number of different modes | |
263 cpfseq EEDATA | |
264 bra toggle_decotype1 | |
265 clrf EEDATA | |
266 | |
267 toggle_decotype1: | |
268 call write_eeprom ; save new mode | |
269 movlw d'4' | |
270 movwf menupos | |
271 bcf switch_right | |
272 bra setup_menu3a ; return to manu loop | |
273 | |
274 show_decotype: | |
275 read_int_eeprom d'34' ; Read deco data | |
276 tstfsz EEDATA | |
277 bra show_decotype2 | |
278 DISPLAYTEXT .101 ; ZH-L16 OC =0 | |
279 return | |
280 show_decotype2: | |
281 decfsz EEDATA,F | |
282 bra show_decotype3 | |
283 DISPLAYTEXT .102 ; Gauge =1 | |
284 return | |
285 show_decotype3: | |
286 decfsz EEDATA,F | |
287 bra show_decotype4 | |
288 DISPLAYTEXT .104 ; ZH-L16 CC =2 | |
289 return | |
290 show_decotype4: | |
291 decfsz EEDATA,F | |
292 bra show_decotype5 | |
293 DISPLAYTEXT .138 ; Apnoe =3 | |
294 return | |
295 show_decotype5: | |
296 decfsz EEDATA,F | |
297 bra show_decotype6 | |
298 DISPLAYTEXT .152 ; L16-GF OC =4 | |
299 return | |
300 show_decotype6: | |
301 decfsz EEDATA,F | |
302 return | |
303 DISPLAYTEXT .236 ; L16-GF CC =5 | |
304 return | |
305 | |
306 exit_setup_menu: | |
307 btfss deco_mode_changed ; Was the decomode changed in Setup menu? | |
308 goto restart ; No, restart to surfacemode | |
309 | |
310 call PLED_ClearScreen | |
311 | |
312 deco_info_screen1: | |
313 call PLED_topline_box | |
314 WIN_INVERT .1 ; Init new Wordprocessor | |
315 DISPLAYTEXT .235 ;Decomode changed! | |
316 WIN_INVERT .0 ; Init new Wordprocessor | |
317 | |
318 read_int_eeprom d'34' ; Read deco data | |
319 | |
320 movlw d'7' ; length of description text | |
321 mulwf EEDATA ; Multiply with Decomode 0-5 (5=Spare) | |
322 | |
323 movf PRODL,W | |
324 addlw d'193' ; Description text offset | |
325 movwf menupos ; Used as loop counter temp | |
326 | |
327 movlw d'7' | |
328 movwf temp1 ; Loop 7 times | |
329 | |
330 menu0: | |
331 movf menupos,W | |
174 | 332 call displaytext_1_low ; Display text! |
0 | 333 incf menupos,F |
334 | |
335 decfsz temp1,F | |
336 bra menu0 ; loop 7 times | |
337 | |
338 movlw d'30' | |
339 call startup_screen3a | |
340 goto restart ; Restart to surfacemode | |
341 | |
342 more_setup_menu: | |
343 movlw d'1' | |
344 movwf menupos | |
345 more_setup_menu2: | |
346 bcf leftbind | |
347 call PLED_ClearScreen | |
348 call PLED_more_setup_menu_mask | |
349 more_setup_menu3a: | |
350 clrf timeout_counter2 | |
351 bcf sleepmode | |
352 bcf menubit2 | |
353 bcf menubit3 | |
354 bsf menubit | |
355 bsf cursor | |
356 call show_debugstate | |
357 call show_dateformat | |
358 call PLED_menu_cursor | |
499
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
359 call toggle_brightness_show |
0 | 360 bcf switch_left |
361 bcf switch_right | |
362 | |
363 more_setup_menu_loop: | |
364 call check_switches_menu | |
365 | |
499
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
366 ; movlw d'5' ; x-1 menu entries |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
367 ; cpfseq menupos |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
368 ; bra more_setup_menu_loop2 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
369 ; movlw d'6' |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
370 ; movwf menupos |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
371 ; call PLED_menu_cursor |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
372 ;more_setup_menu_loop2: |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
373 ; |
0 | 374 btfsc menubit2 |
375 bra do_more_setup_menu ; call submenu | |
376 | |
377 btfss menubit | |
378 goto restart ; exit menu, restart and enter surfmode | |
379 | |
380 btfsc onesecupdate | |
381 call timeout_surfmode | |
382 btfsc onesecupdate | |
383 call set_dive_modes | |
384 btfsc onesecupdate | |
385 call test_charger ; check if charger IC is active | |
386 btfsc onesecupdate | |
387 call get_battery_voltage ; get battery voltage | |
388 | |
389 bcf onesecupdate ; End of one second tasks | |
390 | |
391 btfsc sleepmode | |
392 goto setup_menu ; exit menu | |
393 | |
394 btfsc divemode | |
395 goto restart ; exit menu, restart and enter divemode | |
396 | |
397 bra more_setup_menu_loop | |
398 | |
399 do_more_setup_menu: ; calls submenu | |
400 dcfsnz menupos,F | |
401 bra toggle_datemode | |
402 dcfsnz menupos,F | |
403 bra toggle_debugmode | |
404 dcfsnz menupos,F | |
12 | 405 bra show_license |
0 | 406 dcfsnz menupos,F |
188 | 407 bra show_rawdata |
0 | 408 dcfsnz menupos,F |
499
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
409 bra toggle_brightness ; toggle between ECO and HIGH |
0 | 410 movlw d'5' ; set cursor to "More again" |
411 movwf menupos | |
412 bra setup_menu2 ; exit... | |
413 | |
188 | 414 show_rawdata: ; Displays Sensor raw data |
415 call PLED_ClearScreen | |
416 call PLED_topline_box | |
417 WIN_INVERT .1 ; Init new Wordprocessor | |
418 DISPLAYTEXTH .296 ; Raw Data: | |
419 WIN_INVERT .0 ; Init new Wordprocessor | |
420 | |
421 call PLED_static_raw_data | |
422 | |
432 | 423 |
188 | 424 clrf timeout_counter2 |
425 bcf sleepmode | |
426 bcf menubit3 | |
427 bsf menubit | |
432 | 428 |
429 show_rawdata_loop: | |
430 rcall show_rawdata_wait | |
431 | |
432 btfsc menubit2 | |
433 bra show_rawdata_next | |
434 | |
435 btfsc onesecupdate | |
436 call PLED_update_raw_data | |
437 | |
438 bcf onesecupdate ; End of one second tasks, if any. | |
439 | |
440 goto show_rawdata_loop | |
441 | |
442 show_rawdata_wait: | |
443 bcf menubit2 | |
188 | 444 bcf switch_left |
445 bcf switch_right | |
432 | 446 |
447 show_rawdata_wait_1: | |
337 | 448 btfsc uart_dump_screen ; Asked to dump screen contains ? |
449 call dump_screen ; Yes! | |
450 | |
188 | 451 btfsc switch_left ; Ack? |
452 bsf menubit2 | |
453 btfsc switch_right ; Ack? | |
454 bsf menubit2 | |
455 | |
456 btfsc menubit2 | |
432 | 457 return |
188 | 458 |
459 btfss menubit | |
460 goto restart ; exit menu, restart and enter surfmode | |
461 | |
462 btfsc onesecupdate | |
463 call timeout_surfmode | |
464 | |
465 btfsc onesecupdate | |
466 call set_dive_modes | |
467 | |
468 btfsc sleepmode | |
469 bra show_rawdata_exit ; Exit | |
470 | |
471 btfsc divemode | |
472 goto restart ; exit menu, restart and enter divemode | |
473 | |
432 | 474 btfsc onesecupdate |
475 return | |
476 | |
477 bra show_rawdata_wait_1 | |
478 | |
479 ; Display blank/red/green/blue screens until click, to test OLED ageing. | |
480 show_rawdata_next: | |
444 | 481 ; display test draws more power then allowed -> potential hardware risk! |
482 #ifndef DISPLAY_TEST | |
483 bra show_rawdata_exit | |
484 #endif | |
485 | |
432 | 486 setf WREG |
487 WIN_BOX_COLOR .0,.240,.0,.160 | |
488 rcall show_rawdata_screen_wait | |
489 movlw color_red | |
490 WIN_BOX_COLOR .0,.240,.0,.160 | |
491 rcall show_rawdata_screen_wait | |
492 movlw color_green | |
493 WIN_BOX_COLOR .0,.240,.0,.160 | |
494 rcall show_rawdata_screen_wait | |
495 movlw color_blue | |
496 WIN_BOX_COLOR .0,.240,.0,.160 | |
497 rcall show_rawdata_screen_wait | |
498 bra show_rawdata_exit | |
499 | |
500 show_rawdata_screen_wait: | |
501 rcall show_rawdata_wait | |
502 bcf onesecupdate ; No dynamic update here... | |
503 | |
504 btfsc menubit2 | |
505 return | |
506 | |
507 bra show_rawdata_screen_wait | |
188 | 508 |
509 show_rawdata_exit: | |
510 movlw d'4' | |
511 movwf menupos | |
512 bcf switch_right | |
513 bra more_setup_menu2 ; return to "more menu" loop | |
514 | |
12 | 515 show_license: |
516 call startup_screen1 ;1/2 | |
517 call startup_screen2 ;1/2 | |
518 movlw d'3' | |
519 movwf menupos | |
520 bcf switch_right | |
521 bra more_setup_menu2 ; return to "more menu" loop | |
522 | |
0 | 523 toggle_salinity: |
524 ; Toggles between 1.00 and 1.04 | |
525 read_int_eeprom d'26' ; Read Salinity from EEPROM | |
526 incf EEDATA,F ; Increase value | |
527 | |
528 movlw d'99' ; 99% ? | |
529 cpfsgt EEDATA ; Salinity lower limit | |
530 bra toggle_salinity_reset ; Out of limit, reset value to 1.00 | |
531 movlw d'105' ; 105% ? | |
532 cpfslt EEDATA ; Salinity higher limit | |
533 bra toggle_salinity_reset ; Out of limit, reset value to 1.00 | |
534 | |
535 toggle_salinity2: | |
536 write_int_eeprom d'26' ; Store salinity | |
537 movlw d'3' | |
538 movwf menupos | |
539 bcf switch_right | |
540 bra setup_menu3a ; return to manu loop | |
541 | |
542 toggle_salinity_reset: | |
543 movlw d'100' | |
544 movwf EEDATA | |
545 bra toggle_salinity2 ; back | |
546 | |
547 show_salinity_value: | |
548 read_int_eeprom d'26' ; Read Salinity from EEPROM | |
549 movlw d'99' ; 99% ? | |
550 cpfsgt EEDATA ; Salinity lower limit | |
551 rcall toggle_salinity_reset2 ; Reset before display! | |
552 movlw d'105' ; 105% ? | |
553 cpfslt EEDATA ; Salinity higher limit | |
554 rcall toggle_salinity_reset2 ; Reset before display! | |
555 WIN_TOP .95 | |
183 | 556 WIN_LEFT .90 ; +7 for spanish |
0 | 557 WIN_FONT FT_SMALL |
558 lfsr FSR2,letter | |
559 movff EEDATA,lo | |
560 clrf hi | |
561 bsf leftbind | |
562 output_16dp d'3' | |
563 bcf leftbind | |
445 | 564 STRCAT_PRINT TXT_KGL4 |
0 | 565 return |
566 | |
567 toggle_salinity_reset2: | |
568 movlw d'100' | |
569 movwf EEDATA | |
570 write_int_eeprom d'26' ; Store salinity | |
571 return | |
572 | |
573 toggle_datemode: | |
574 ; Toggles setting for | |
575 ; MM/DD/YY =0, Default | |
576 ; DD/MM/YY =1 | |
577 ; YY/MM/DD =2 | |
578 read_int_eeprom d'91' ; Read date format | |
579 incf EEDATA,F | |
580 movlw d'2' | |
581 cpfsgt EEDATA | |
582 bra toggle_datemode1 | |
583 clrf EEDATA | |
584 toggle_datemode1: | |
585 write_int_eeprom d'91' ; Store date format | |
586 movlw d'1' | |
587 movwf menupos | |
588 bcf switch_right | |
589 bra more_setup_menu3a ; return to manu loop | |
590 | |
591 show_dateformat: | |
592 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) | |
593 tstfsz EEDATA | |
594 bra show_dateformat2 | |
595 DISPLAYTEXTH .259 ; MM/DD/YY = 0 | |
596 return | |
597 show_dateformat2: | |
598 decfsz EEDATA,F | |
599 bra show_dateformat3 | |
600 DISPLAYTEXTH .260 ; DD/MM/YY = 1 | |
601 return | |
602 show_dateformat3: | |
603 DISPLAYTEXTH .261 ; YY/MM/DD = 2 | |
604 return | |
605 | |
499
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
606 toggle_brightness: |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
607 movlw LOW 0x104 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
608 movwf EEADR |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
609 movlw HIGH 0x104 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
610 movwf EEADRH ; OLED brightness (=0: Eco, =1: High) |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
611 call read_eeprom ; read byte |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
612 bcf oled_brightness_high ; Eco mode |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
613 movlw .0 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
614 cpfseq EEDATA ; High? |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
615 bsf oled_brightness_high ; Yes! |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
616 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
617 ; Value loaded, now toggle it... |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
618 btg oled_brightness_high |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
619 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
620 ; ...Display it... |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
621 rcall toggle_brightness_show |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
622 call PLED_brightness_full ; Set OLED |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
623 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
624 ; ...and write it again to EEPROM |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
625 movlw LOW 0x104 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
626 movwf EEADR |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
627 movlw HIGH 0x104 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
628 movwf EEADRH ; OLED brightness (=0: Eco, =1: High) |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
629 movlw .0 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
630 btfsc oled_brightness_high |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
631 movlw .1 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
632 movwf EEDATA |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
633 call write_eeprom ; write byte |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
634 clrf EEADRH ; Reset EEADRH |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
635 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
636 movlw d'5' |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
637 movwf menupos |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
638 bcf switch_right |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
639 bra more_setup_menu3a ; return to menu loop |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
640 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
641 toggle_brightness_show: |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
642 btfsc oled_brightness_high |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
643 bra toggle_brightness_show2 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
644 DISPLAYTEXTH .312 ; Eco |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
645 return |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
646 toggle_brightness_show2: |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
647 DISPLAYTEXTH .313 ; High |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
648 return |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
649 |
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
650 |
0 | 651 toggle_debugmode: |
652 read_int_eeprom d'39' ; Read status | |
653 incf EEDATA,F | |
654 movlw d'1' | |
655 cpfsgt EEDATA | |
656 bra toggle_debugmode1 | |
657 clrf EEDATA | |
658 toggle_debugmode1: | |
659 write_int_eeprom d'39' ; Store status | |
660 bsf debug_mode ; set flag | |
661 movlw d'1' | |
662 cpfseq EEDATA | |
663 bcf debug_mode ; clear flag | |
664 movlw d'2' | |
665 movwf menupos | |
666 bcf switch_right | |
499
2ac77db9c150
Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents:
445
diff
changeset
|
667 bra more_setup_menu3a ; return to menu loop |
0 | 668 |
669 show_debugstate: | |
670 read_int_eeprom d'39' | |
671 tstfsz EEDATA | |
672 bra show_debugstate2 | |
673 DISPLAYTEXT .131 ; OFF | |
674 show_debugstate2: | |
675 decf EEDATA,F | |
676 tstfsz EEDATA | |
677 bra show_decotype3 | |
678 DISPLAYTEXT .130 ; ON | |
679 return |