Mercurial > public > mk2
changeset 575:cbdcbbc91877
some code cleaning
author | heinrichsweikamp |
---|---|
date | Sat, 21 Apr 2012 15:08:09 +0200 |
parents | 101fec6a6137 |
children | ab2686087bce |
files | code_part1/OSTC_code_asm_part1/menu.asm code_part1/OSTC_code_asm_part1/menu_battery.asm code_part1/OSTC_code_asm_part1/menu_gassetup.asm code_part1/OSTC_code_asm_part1/menu_logbook.asm code_part1/OSTC_code_asm_part1/menu_ppO2.asm code_part1/OSTC_code_asm_part1/simulator.asm |
diffstat | 6 files changed, 35 insertions(+), 133 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/menu.asm Sat Apr 21 13:58:30 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu.asm Sat Apr 21 15:08:09 2012 +0200 @@ -57,25 +57,13 @@ goto restart ; exit menu, restart btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes - - btfsc onesecupdate - call test_charger ; check if charger IC is active - - btfsc onesecupdate - call get_battery_voltage ; get battery voltage + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; End of one second tasks btfsc sleepmode goto restart - btfsc divemode - goto restart ; exit menu, restart and enter divemode - bra menu_loop check_switches_menu: ; checks switches @@ -155,25 +143,13 @@ bra menu ; exit setup menu and return to main menu btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes - - btfsc onesecupdate - call test_charger ; check if charger IC is active - - btfsc onesecupdate - call get_battery_voltage ; get battery voltage + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; End of one second tasks btfsc sleepmode bra menu - btfsc divemode - goto restart ; exit menu, restart and enter divemode - bra more_menu_loop do_more_menu: ; calls submenu @@ -219,23 +195,15 @@ btfss menubit goto restart ; exit menu, restart and enter surfmode - btfsc onesecupdate - call timeout_surfmode + btfsc onesecupdate - call set_dive_modes - btfsc onesecupdate - call test_charger ; check if charger IC is active - btfsc onesecupdate - call get_battery_voltage ; get battery voltage + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; End of one second tasks btfsc sleepmode goto restart ; exit menu, restart and enter surfmode - btfsc divemode - goto restart ; exit menu, restart and enter divemode - bra setup_menu_loop @@ -378,22 +346,13 @@ goto restart ; exit menu, restart and enter surfmode btfsc onesecupdate - call timeout_surfmode - btfsc onesecupdate - call set_dive_modes - btfsc onesecupdate - call test_charger ; check if charger IC is active - btfsc onesecupdate - call get_battery_voltage ; get battery voltage + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; End of one second tasks btfsc sleepmode goto setup_menu ; exit menu - btfsc divemode - goto restart ; exit menu, restart and enter divemode - bra more_setup_menu_loop do_more_setup_menu: ; calls submenu @@ -576,3 +535,10 @@ bra show_decotype3 DISPLAYTEXT .130 ; ON return + +menu_check_dive_and_timeout: + call set_dive_modes ; Check thresholds + call timeout_surfmode ; Sets sleepmode flag if timeout + btfsc divemode + goto restart ; dive started! + return
--- a/code_part1/OSTC_code_asm_part1/menu_battery.asm Sat Apr 21 13:58:30 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_battery.asm Sat Apr 21 15:08:09 2012 +0200 @@ -144,14 +144,8 @@ btfsc menubit2 bra menu_battery_state_exit ; Exit - btfsc divemode - goto restart ; dive started! - btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; 1 sec. functions done
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Sat Apr 21 13:58:30 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Sat Apr 21 15:08:09 2012 +0200 @@ -192,14 +192,8 @@ btfsc menubit2 bra do_gassetup_list ; call gas-specific submenu - btfsc divemode - goto restart ; dive started! - btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; 1 sec. functions done @@ -425,14 +419,8 @@ btfsc menubit2 bra do_gassetup ; call submenu - btfsc divemode - goto restart ; dive started! - btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; 1 sec. functions done @@ -770,14 +758,8 @@ btfsc menubit2 bra do_next_gas_page ; call submenu - btfsc divemode - goto restart ; dive started! - btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; 1 sec. functions done
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Sat Apr 21 13:58:30 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Sat Apr 21 15:08:09 2012 +0200 @@ -233,19 +233,13 @@ bra display_profile_or_exit ; view details/profile or exit logbook btfsc onesecupdate - call timeout_surfmode ; Timeout - - btfsc onesecupdate - call set_dive_modes ; Check, if divemode must be entered + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; one second update btfsc sleepmode ; Timeout? goto menu ; Yes - btfsc divemode - goto restart ; Enter Divemode if required - goto menu_logbook_loop ; Wait for something to do display_profile_or_exit: @@ -844,15 +838,13 @@ bra exit_profileview ; back to list btfsc menubit3 ; ENTER? bra profileview_page2 ; Switch to Page2 of profile view - btfsc onesecupdate - call timeout_surfmode ; timeout + btfsc onesecupdate - call set_dive_modes ; check, if divemode must be entered + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; one second update + btfsc sleepmode ; Timeout? bra exit_profileview ; back to list - btfsc divemode - goto restart ; Enter Divemode if required bra display_profile_loop ; wait for something to do ;============================================================================= @@ -1020,14 +1012,10 @@ btfsc menubit3 ; ENTER? bra profileview_page3 ; Switch to Page3 of profile view btfsc onesecupdate - call timeout_surfmode ; timeout - btfsc onesecupdate - call set_dive_modes ; check, if divemode must be entered + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; one second update btfsc sleepmode ; Timeout? bra exit_profileview ; back to list - btfsc divemode - goto restart ; Enter Divemode if required bra display_profile2_loop ; wait for something to do profileview_page3: @@ -1148,14 +1136,10 @@ btfsc menubit3 ; ENTER? bra exit_profileview ; back to list btfsc onesecupdate - call timeout_surfmode ; timeout - btfsc onesecupdate - call set_dive_modes ; check, if divemode must be entered + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; one second update btfsc sleepmode ; Timeout? bra exit_profileview ; back to list - btfsc divemode - goto restart ; Enter Divemode if required bra display_profile3_loop ; wait for something to do ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/menu_ppO2.asm Sat Apr 21 13:58:30 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_ppO2.asm Sat Apr 21 15:08:09 2012 +0200 @@ -136,26 +136,20 @@ call check_switches_logbook btfsc menubit3 - bra menu_const_ppO22 ; move cursor + bra menu_const_ppO22 ; move cursor btfsc menubit2 - bra do_menu_const_ppO2 ; call submenu - - btfsc divemode - goto restart ; dive started! + bra do_menu_const_ppO2 ; call submenu btfsc onesecupdate - call timeout_surfmode - - btfsc onesecupdate - call set_dive_modes + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; 1 sec. functions done btfsc sleepmode - bra exit_menu_const_ppO2 + bra exit_menu_const_ppO2 - bra menu_const_ppO2_loop + bra menu_const_ppO2_loop menu_const_ppO22: incf menupos,F
--- a/code_part1/OSTC_code_asm_part1/simulator.asm Sat Apr 21 13:58:30 2012 +0200 +++ b/code_part1/OSTC_code_asm_part1/simulator.asm Sat Apr 21 15:08:09 2012 +0200 @@ -63,17 +63,10 @@ menu_simulator_loop: call check_switches_menu menu_simulator_loop2: - btfss onesecupdate - bra menu_simulator_loop3 - - call timeout_surfmode - call set_dive_modes - call test_charger ; check if charger IC is active - call get_battery_voltage ; get battery voltage - + btfsc onesecupdate + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag bcf onesecupdate ; End of one second tasks -menu_simulator_loop3: btfsc menubit2 goto menu_simulator_do ; call submenu @@ -83,9 +76,6 @@ btfsc sleepmode goto menu_simulator_exit - btfsc divemode - goto restart ; exit menu, restart and enter divemode - bra menu_simulator_loop menu_simulator_do: ; calls submenu @@ -248,18 +238,13 @@ bcf switch_left bcf switch_right simulator_show_decoplan2: - btfsc uart_dump_screen ; Asked to dump screen contains ? - call dump_screen ; Yes! - - btfss onesecupdate - bra simulator_show_decoplan3 + btfsc uart_dump_screen ; Asked to dump screen contains ? + call dump_screen ; Yes! - call timeout_surfmode - call set_dive_modes - call test_charger ; check if charger IC is active - call get_battery_voltage ; get battery voltage - - bcf onesecupdate ; End of one second tasks + btfsc onesecupdate + call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag + + bcf onesecupdate ; End of one second tasks simulator_show_decoplan3: btfsc switch_right @@ -271,9 +256,6 @@ btfsc sleepmode goto more_menu - btfsc divemode - goto restart ; exit menu, restart and enter divemode - bra simulator_show_decoplan2 simulator_show_decoplan5: