Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/sleepmode.asm @ 357:562f1bc79f3c 64kByte Logbook
Bugfix: Wake-up into divemode with 1.91alpha
author | Heinrichsweikamp |
---|---|
date | Tue, 07 Jun 2011 13:06:14 +0200 |
parents | 2144f19fa1eb |
children | 88660a400338 |
comparison
equal
deleted
inserted
replaced
352:544a96faa9f3 | 357:562f1bc79f3c |
---|---|
70 cpfsgt divemins+1 | 70 cpfsgt divemins+1 |
71 bra onemin_sleep2 ; 15 minutes not done! | 71 bra onemin_sleep2 ; 15 minutes not done! |
72 | 72 |
73 rcall pressuretest_sleep_fast ; Gets pressure without averaging (faster!) | 73 rcall pressuretest_sleep_fast ; Gets pressure without averaging (faster!) |
74 | 74 |
75 SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure ; copy for compatibility | |
76 | |
75 call check_temp_extrema ; Check for temperature extremas | 77 call check_temp_extrema ; Check for temperature extremas |
76 | 78 |
77 call deco_calc_CNS_decrease_15min ; compute CNS decay in sleep only | 79 call deco_calc_CNS_decrease_15min ; compute CNS decay in sleep only |
78 movlb b'00000001' | 80 movlb b'00000001' |
79 movff last_surfpressure_15min+0,last_surfpressure_30min+0 ; save older airpressure | 81 movff last_surfpressure_15min+0,last_surfpressure_30min+0 ; save older airpressure |
130 | 132 |
131 ; compare current ambient pressure with threshold | 133 ; compare current ambient pressure with threshold |
132 GETCUSTOM15 d'6' ; loads pressure threshold into lo,hi | 134 GETCUSTOM15 d'6' ; loads pressure threshold into lo,hi |
133 movff lo,sub_a+0 ; power on if ambient pressure is greater threshold | 135 movff lo,sub_a+0 ; power on if ambient pressure is greater threshold |
134 movff hi,sub_a+1 | 136 movff hi,sub_a+1 |
135 SAFE_2BYTE_COPY amb_pressure, sub_b | 137 SAFE_2BYTE_COPY amb_pressure_avg, sub_b |
136 call sub16 ; sub_c = sub_a - sub_b | 138 call sub16 ; sub_c = sub_a - sub_b |
137 bsf sleepmode | 139 bsf sleepmode |
138 btfsc neg_flag ; Wake up from Sleep? | 140 btfsc neg_flag ; Wake up from Sleep? |
139 bcf sleepmode ; amb_pressure>pressure_offset_divemode: wake up! | 141 bcf sleepmode ; amb_pressure>pressure_offset_divemode: wake up! |
140 clrf divemins+0 | 142 clrf divemins+0 |
177 nop | 179 nop |
178 sleep | 180 sleep |
179 nop | 181 nop |
180 sleep ; Wait at least 35ms (every 16.5ms Timer1 wakeup) | 182 sleep ; Wait at least 35ms (every 16.5ms Timer1 wakeup) |
181 call get_pressure_value ; State2: Get pressure (51us) | 183 call get_pressure_value ; State2: Get pressure (51us) |
184 clrf amb_pressure_avg+0 | |
185 clrf amb_pressure_avg+1 ; clear for sleep routine | |
182 call calculate_compensation ; calculate temperature compensated pressure (233us) | 186 call calculate_compensation ; calculate temperature compensated pressure (233us) |
183 return | 187 return |
184 | 188 |
185 fatal_error_sleep: | 189 fatal_error_sleep: |
186 WAITMS d'250' | 190 WAITMS d'250' |