comparison code_part1/OSTC_code_asm_part1/menu.asm @ 499:2ac77db9c150

Added OLED brightness setting, texts 280, 312 and 313 need update
author heinrichsweikamp
date Tue, 15 Nov 2011 20:36:41 +0100
parents 6e57b5bb98ce
children 101fec6a6137
comparison
equal deleted inserted replaced
498:4c7f7807b250 499:2ac77db9c150
354 bsf menubit 354 bsf menubit
355 bsf cursor 355 bsf cursor
356 call show_debugstate 356 call show_debugstate
357 call show_dateformat 357 call show_dateformat
358 call PLED_menu_cursor 358 call PLED_menu_cursor
359 call toggle_brightness_show
359 bcf switch_left 360 bcf switch_left
360 bcf switch_right 361 bcf switch_right
361 362
362 more_setup_menu_loop: 363 more_setup_menu_loop:
363 call check_switches_menu 364 call check_switches_menu
364 365
365 movlw d'5' ; x-1 menu entries 366 ; movlw d'5' ; x-1 menu entries
366 cpfseq menupos 367 ; cpfseq menupos
367 bra more_setup_menu_loop2 368 ; bra more_setup_menu_loop2
368 movlw d'6' 369 ; movlw d'6'
369 movwf menupos 370 ; movwf menupos
370 call PLED_menu_cursor 371 ; call PLED_menu_cursor
371 more_setup_menu_loop2: 372 ;more_setup_menu_loop2:
372 373 ;
373 btfsc menubit2 374 btfsc menubit2
374 bra do_more_setup_menu ; call submenu 375 bra do_more_setup_menu ; call submenu
375 376
376 btfss menubit 377 btfss menubit
377 goto restart ; exit menu, restart and enter surfmode 378 goto restart ; exit menu, restart and enter surfmode
403 dcfsnz menupos,F 404 dcfsnz menupos,F
404 bra show_license 405 bra show_license
405 dcfsnz menupos,F 406 dcfsnz menupos,F
406 bra show_rawdata 407 bra show_rawdata
407 dcfsnz menupos,F 408 dcfsnz menupos,F
408 bra setup_menu ; spare 409 bra toggle_brightness ; toggle between ECO and HIGH
409 movlw d'5' ; set cursor to "More again" 410 movlw d'5' ; set cursor to "More again"
410 movwf menupos 411 movwf menupos
411 bra setup_menu2 ; exit... 412 bra setup_menu2 ; exit...
412 413
413 show_rawdata: ; Displays Sensor raw data 414 show_rawdata: ; Displays Sensor raw data
600 return 601 return
601 show_dateformat3: 602 show_dateformat3:
602 DISPLAYTEXTH .261 ; YY/MM/DD = 2 603 DISPLAYTEXTH .261 ; YY/MM/DD = 2
603 return 604 return
604 605
606 toggle_brightness:
607 movlw LOW 0x104
608 movwf EEADR
609 movlw HIGH 0x104
610 movwf EEADRH ; OLED brightness (=0: Eco, =1: High)
611 call read_eeprom ; read byte
612 bcf oled_brightness_high ; Eco mode
613 movlw .0
614 cpfseq EEDATA ; High?
615 bsf oled_brightness_high ; Yes!
616
617 ; Value loaded, now toggle it...
618 btg oled_brightness_high
619
620 ; ...Display it...
621 rcall toggle_brightness_show
622 call PLED_brightness_full ; Set OLED
623
624 ; ...and write it again to EEPROM
625 movlw LOW 0x104
626 movwf EEADR
627 movlw HIGH 0x104
628 movwf EEADRH ; OLED brightness (=0: Eco, =1: High)
629 movlw .0
630 btfsc oled_brightness_high
631 movlw .1
632 movwf EEDATA
633 call write_eeprom ; write byte
634 clrf EEADRH ; Reset EEADRH
635
636 movlw d'5'
637 movwf menupos
638 bcf switch_right
639 bra more_setup_menu3a ; return to menu loop
640
641 toggle_brightness_show:
642 btfsc oled_brightness_high
643 bra toggle_brightness_show2
644 DISPLAYTEXTH .312 ; Eco
645 return
646 toggle_brightness_show2:
647 DISPLAYTEXTH .313 ; High
648 return
649
650
605 toggle_debugmode: 651 toggle_debugmode:
606 read_int_eeprom d'39' ; Read status 652 read_int_eeprom d'39' ; Read status
607 incf EEDATA,F 653 incf EEDATA,F
608 movlw d'1' 654 movlw d'1'
609 cpfsgt EEDATA 655 cpfsgt EEDATA
616 cpfseq EEDATA 662 cpfseq EEDATA
617 bcf debug_mode ; clear flag 663 bcf debug_mode ; clear flag
618 movlw d'2' 664 movlw d'2'
619 movwf menupos 665 movwf menupos
620 bcf switch_right 666 bcf switch_right
621 bra more_setup_menu3a ; return to manu loop 667 bra more_setup_menu3a ; return to menu loop
622 668
623 show_debugstate: 669 show_debugstate:
624 read_int_eeprom d'39' 670 read_int_eeprom d'39'
625 tstfsz EEDATA 671 tstfsz EEDATA
626 bra show_debugstate2 672 bra show_debugstate2