Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/surfmode.asm @ 482:8e1fb9cdd62a
lock sensor for surfacemode until value is stable
author | heinrichsweikamp |
---|---|
date | Thu, 13 Oct 2011 08:37:26 +0200 |
parents | c083f5b9168c |
children | c7b663939737 |
comparison
equal
deleted
inserted
replaced
481:a863fd56189c | 482:8e1fb9cdd62a |
---|---|
22 ; known bugs: | 22 ; known bugs: |
23 ; ToDo: | 23 ; ToDo: |
24 | 24 |
25 surfloop: | 25 surfloop: |
26 ; Boot tasks for all modes | 26 ; Boot tasks for all modes |
27 call restart_set_modes_and_flags ; Sets decomode flags | 27 bcf s_unlock_after_sleep ; Lock sensor results |
28 call restart_set_modes_and_flags ; Sets decomode flags | |
28 clrf lo | 29 clrf lo |
29 movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface! | 30 movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface! |
30 | 31 |
31 call PLED_brightness_full ;max. brightness | 32 call PLED_brightness_full ;max. brightness |
32 | 33 |
69 clrf timeout_counter2 | 70 clrf timeout_counter2 |
70 clrf timeout_counter3 | 71 clrf timeout_counter3 |
71 bcf premenu ; clear premenu flag | 72 bcf premenu ; clear premenu flag |
72 bcf menubit ; clear menu flag | 73 bcf menubit ; clear menu flag |
73 clrf timer1int_counter2 ; reset state counter | 74 clrf timer1int_counter2 ; reset state counter |
74 bcf pressure_refresh | 75 bcf pressure_refresh ; Start new sensor run |
75 clrf last_pressure+0 | 76 clrf last_pressure+0 |
76 clrf last_pressure+1 | 77 clrf last_pressure+1 |
77 clrf last_temperature+0 | 78 clrf last_temperature+0 |
78 clrf last_temperature+1 | 79 clrf last_temperature+1 |
79 | 80 |
124 surfloop_loop1: | 125 surfloop_loop1: |
125 ; One Second tasks for all modes | 126 ; One Second tasks for all modes |
126 call PLED_clock ; update clock | 127 call PLED_clock ; update clock |
127 call test_charger ; check if charger IC is active | 128 call test_charger ; check if charger IC is active |
128 call timeout_surfmode ; check timeout | 129 call timeout_surfmode ; check timeout |
129 call get_battery_voltage ; get battery voltage | |
130 call update_batt_voltage ; display battery voltage | 130 call update_batt_voltage ; display battery voltage |
131 call timeout_premenu ; timeout premenu | 131 call timeout_premenu ; timeout premenu |
132 call set_leds_surfmode ; Sets Warning and No-Fly LEDs | 132 call set_leds_surfmode ; Sets Warning and No-Fly LEDs |
133 call check_customfunctions ; Checks CF functions and displays warning symbol if something critical is wrong | 133 call check_customfunctions ; Checks CF functions and displays warning symbol if something critical is wrong |
134 call PLED_display_decotype_surface ; Show deco mode | 134 call PLED_display_decotype_surface ; Show deco mode |
141 surfloop_loop2: | 141 surfloop_loop2: |
142 ; Tasks approx. every 50ms for all modes | 142 ; Tasks approx. every 50ms for all modes |
143 call test_switches_surfmode ; check switches | 143 call test_switches_surfmode ; check switches |
144 | 144 |
145 ; Sensor tasks for all modes | 145 ; Sensor tasks for all modes |
146 btfsc pressure_refresh ; new pressure available? | 146 btfss pressure_refresh ; new pressure available? |
147 bra surfloop_loop2a ; no | |
148 | |
149 btfss s_unlock_after_sleep ; sensor results locked? | |
150 bra surfloop_loop3 ; Yes, ignore | |
151 | |
152 ; New sensor value available | |
147 call update_surf_press ; display surface pressure | 153 call update_surf_press ; display surface pressure |
148 btfsc pressure_refresh ; new temperature available? | |
149 call PLED_temp_surfmode ; Displays temperature | 154 call PLED_temp_surfmode ; Displays temperature |
150 btfsc pressure_refresh ; new pressure available? | |
151 call set_dive_modes ; tests if depth>threshold | 155 call set_dive_modes ; tests if depth>threshold |
152 | |
153 ; jDG TESTS ========================= | |
154 btfss pressure_refresh ; new pressure available? | |
155 bra surfloop_loop3 | |
156 call altimeter_calc | 156 call altimeter_calc |
157 movf menupos3,W ; Get customview status. | 157 movf menupos3,W ; Get customview status. |
158 bnz surfloop_loop3 ; Already used ? | 158 bnz surfloop_loop3 ; Already used ? |
159 call altimeter_display | 159 call altimeter_display |
160 call get_battery_voltage ; get battery voltage | |
161 | |
160 surfloop_loop3: | 162 surfloop_loop3: |
161 ; jDG TESTS ========================= | 163 bsf s_unlock_after_sleep ; unlock sensor results |
162 | |
163 bcf pressure_refresh ; until new pressure is available | 164 bcf pressure_refresh ; until new pressure is available |
164 | 165 |
166 surfloop_loop2a: | |
165 ; One minute tasks for all modes | 167 ; One minute tasks for all modes |
166 btfsc oneminupdate ; do every minute tasks | 168 btfsc oneminupdate ; do every minute tasks |
167 call update_surfloop60 ; yes, e.g. update time and date | 169 call update_surfloop60 ; yes, e.g. update time and date |
168 | 170 |
169 ; Mode tasks | 171 ; Mode tasks |