# HG changeset patch # User heinrichsweikamp # Date 1318487846 -7200 # Node ID 8e1fb9cdd62a45c2731822f35289c336e9d8beb0 # Parent a863fd56189c9bc5d4d36ffd1f5b7773d3d2c26d lock sensor for surfacemode until value is stable diff -r a863fd56189c -r 8e1fb9cdd62a code_part1/OSTC_code_asm_part1/MAIN.ASM --- a/code_part1/OSTC_code_asm_part1/MAIN.ASM Thu Oct 13 08:20:58 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM Thu Oct 13 08:37:26 2011 +0200 @@ -1,6 +1,6 @@ ; OSTC - diving computer code -; Copyright (C) 2008 HeinrichsWeikamp GbR +; Copyright (C) 2008-2011 HeinrichsWeikamp GbR ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by @@ -16,8 +16,6 @@ ; along with this program. If not, see . -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either versio ; includes and isr ; written by: Matthias Heinrichs, info@heinrichsweikamp.com ; written: 041013 diff -r a863fd56189c -r 8e1fb9cdd62a code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Thu Oct 13 08:20:58 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Thu Oct 13 08:37:26 2011 +0200 @@ -110,7 +110,7 @@ ;============================================================================= -#include "../OSTC_code_c_part2/shared_definitions.h" +;#include "../OSTC_code_c_part2/shared_definitions.h" #include "ostc2_code/code_part1/OSTC_code_c_part2/shared_definitions.h" ;============================================================================= @@ -541,7 +541,7 @@ #DEFINE display_set_simulator flag14,4 ;=1: Show Divemode simulator menu #DEFINE displaytext_high flag14,5 ;=1: Show/Use Texts 255-511 in Texttable #DEFINE better_gas_available flag14,6 ;=1: A better gas is available and a gas change is advised in divemode -#DEFINE Flag_5 flag14,7 ;=1: unused +#DEFINE s_unlock_after_sleep flag14,7 ;=1: Sensor unlocked for divemode and battery history #DEFINE restore_deco_data flag15,0 ;=1: Restore Decodata after the dive from 0x380 buffer #DEFINE uart_store_tissue_data flag15,1 ;=1: Store tissue data for next simualted dive! diff -r a863fd56189c -r 8e1fb9cdd62a code_part1/OSTC_code_asm_part1/surfmode.asm --- a/code_part1/OSTC_code_asm_part1/surfmode.asm Thu Oct 13 08:20:58 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/surfmode.asm Thu Oct 13 08:37:26 2011 +0200 @@ -24,7 +24,8 @@ surfloop: ; Boot tasks for all modes - call restart_set_modes_and_flags ; Sets decomode flags + bcf s_unlock_after_sleep ; Lock sensor results + call restart_set_modes_and_flags ; Sets decomode flags clrf lo movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface! @@ -71,7 +72,7 @@ bcf premenu ; clear premenu flag bcf menubit ; clear menu flag clrf timer1int_counter2 ; reset state counter - bcf pressure_refresh + bcf pressure_refresh ; Start new sensor run clrf last_pressure+0 clrf last_pressure+1 clrf last_temperature+0 @@ -126,7 +127,6 @@ call PLED_clock ; update clock call test_charger ; check if charger IC is active call timeout_surfmode ; check timeout - call get_battery_voltage ; get battery voltage call update_batt_voltage ; display battery voltage call timeout_premenu ; timeout premenu call set_leds_surfmode ; Sets Warning and No-Fly LEDs @@ -143,25 +143,27 @@ call test_switches_surfmode ; check switches ; Sensor tasks for all modes - btfsc pressure_refresh ; new pressure available? + btfss pressure_refresh ; new pressure available? + bra surfloop_loop2a ; no + + btfss s_unlock_after_sleep ; sensor results locked? + bra surfloop_loop3 ; Yes, ignore + +; New sensor value available call update_surf_press ; display surface pressure - btfsc pressure_refresh ; new temperature available? call PLED_temp_surfmode ; Displays temperature - btfsc pressure_refresh ; new pressure available? call set_dive_modes ; tests if depth>threshold - - ; jDG TESTS ========================= - btfss pressure_refresh ; new pressure available? - bra surfloop_loop3 call altimeter_calc movf menupos3,W ; Get customview status. bnz surfloop_loop3 ; Already used ? call altimeter_display + call get_battery_voltage ; get battery voltage + surfloop_loop3: - ; jDG TESTS ========================= - + bsf s_unlock_after_sleep ; unlock sensor results bcf pressure_refresh ; until new pressure is available +surfloop_loop2a: ; One minute tasks for all modes btfsc oneminupdate ; do every minute tasks call update_surfloop60 ; yes, e.g. update time and date