comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 397:6f7965ec5f49

BUGFIX Color coding ppO2 > 4.9 (bug #50)
author JeanDo
date Sat, 25 Jun 2011 23:48:40 +0200
parents 0386c7e1374a
children 1677453fbbe3
comparison
equal deleted inserted replaced
396:0386c7e1374a 397:6f7965ec5f49
114 movff xC+1,xA+1 114 movff xC+1,xA+1
115 movff EEDATA,xB+0 115 movff EEDATA,xB+0
116 clrf xB+1 116 clrf xB+1
117 call mult16x16 ; EEDATA * p_amb/10 117 call mult16x16 ; EEDATA * p_amb/10
118 118
119 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar? 119 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar?
120 bra PLED_color_code_gaslist1 ; Yes, warn in warning color 120 bra PLED_color_code_gaslist1; Yes, warn in warning color
121 btfsc xC+1,7 ; > 32767, ppO2>3,276Bar?
122 bra PLED_color_code_gaslist1; Yes, warn in warning color
121 123
122 movff xC+0,sub_a+0 124 movff xC+0,sub_a+0
123 movff xC+1,sub_a+1 125 movff xC+1,sub_a+1
124 GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar] 126 GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar]
125 mullw d'100' ; ppo2_warning_high*100 127 mullw d'100' ; ppo2_warning_high*100
197 PLED_color_code_cns2: 199 PLED_color_code_cns2:
198 call PLED_warnings_color 200 call PLED_warnings_color
199 return 201 return
200 202
201 PLED_color_code_gf: 203 PLED_color_code_gf:
202 movff char_O_gradient_factor,lo ; gradient factor 204 f movff char_O_gradient_factor,lo ; gradient factor
203 GETCUSTOM8 d'45' ; GF Warn [%] 205 GETCUSTOM8 d'45' ; GF Warn [%]
204 subwf lo,W 206 subwf lo,W
205 btfsc STATUS,C 207 btfsc STATUS,C
206 bra PLED_color_code_gf2 ; Set to warning color 208 bra PLED_color_code_gf2 ; Set to warning color
207 call PLED_standard_color 209 call PLED_standard_color
208 return 210 return
209 PLED_color_code_gf2: 211 PLED_color_code_gf2:
210 call PLED_warnings_color 212 call PLED_warnings_color
211 return 213 return
212 214
213 PLED_color_code_ppo2: 215 ;-----------------------------------------------------------------------------
214 ; Check very high ppO2 manually 216 ; Set color to red if ppO2 to high (and white if not).
215 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar? 217 ; Inputs: xC:3 = ppO2 (computed from divemode and O2_ratio).
216 bra PLED_color_code_ppo22 ; Yes, warn in warning color 218 ;
217 219 PLED_color_code_ppo2: ; ppO2 in xC:3 (in 160*100 = 1.6000, ie. in 0.1 mbar)
220 ; Check very high ppO2 manually:
221 tstfsz xC+2 ; xC > 65535 ?
222 bra PLED_color_code_ppo22 ; Yes, warn in warning color
223 btfsc xC+1,7 ; xC > 32767, ie. ppO2>3,276Bar?
224 bra PLED_color_code_ppo22 ; Yes, warn in warning color
225
226 ; Normal checks: CF46
218 movff xC+0,sub_a+0 227 movff xC+0,sub_a+0
219 movff xC+1,sub_a+1 228 movff xC+1,sub_a+1
220 GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar] 229 GETCUSTOM8 d'46' ; color-code ppO2 warning, eg. 160 cBar = 1.60 bar.
221 mullw d'100' 230 mullw d'100'
222 movff PRODL,sub_b+0 231 movff PRODL,sub_b+0
223 movff PRODH,sub_b+1 232 movff PRODH,sub_b+1
224 call sub16 ; sub_c = sub_a - sub_b 233 call sub16 ; sub_c = sub_a - sub_b
225 btfss neg_flag 234 btfss neg_flag
226 bra PLED_color_code_ppo22; Set to warning color 235 bra PLED_color_code_ppo22 ; Set to warning color
227 call PLED_standard_color 236 goto PLED_standard_color
228 return 237
229 PLED_color_code_ppo22: 238 PLED_color_code_ppo22:
230 call PLED_warnings_color 239 goto PLED_warnings_color
231 return 240
232 241 ;-----------------------------------------------------------------------------
233 PLED_color_code_velocity: 242 PLED_color_code_velocity:
234 btfss neg_flag ; Ignore for ascend! 243 btfss neg_flag ; Ignore for ascend!
235 bra PLED_color_code_velocity1 ; Skip check! 244 bra PLED_color_code_velocity1 ; Skip check!
236 movff divA+0,lo 245 movff divA+0,lo
237 GETCUSTOM8 d'47' ; Velocity warn [m/min] 246 GETCUSTOM8 d'47' ; Velocity warn [m/min]
1016 PLED_show_ppO2: ; Show ppO2 (ppO2 stored in xC) 1025 PLED_show_ppO2: ; Show ppO2 (ppO2 stored in xC)
1017 ostc_debug 't' ; Sends debug-information to screen if debugmode active 1026 ostc_debug 't' ; Sends debug-information to screen if debugmode active
1018 WIN_TOP .119 1027 WIN_TOP .119
1019 WIN_LEFT .0 1028 WIN_LEFT .0
1020 WIN_FONT FT_SMALL 1029 WIN_FONT FT_SMALL
1021 PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) 1030 call PLED_color_code_ppo2 ; Color-code output (ppO2 stored in xC:3)
1022 1031
1023 STRCPY "ppO2:" 1032 STRCPY "ppO2:"
1024 1033
1025 ; Check very high ppO2 manually 1034 ; Check very high ppO2 manually
1026 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar? 1035 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar?
3122 PLED_const_ppO2_value1a: 3131 PLED_const_ppO2_value1a:
3123 movff char_I_const_ppO2,lo 3132 movff char_I_const_ppO2,lo
3124 3133
3125 movff lo,WREG ; copy to WREG 3134 movff lo,WREG ; copy to WREG
3126 mullw .100 3135 mullw .100
3136 clrf xC+2
3127 movff PRODH,xC+1 3137 movff PRODH,xC+1
3128 movff PRODL,xC+0 ; For color code 3138 movff PRODL,xC+0 ; For color code
3129 PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) 3139 call PLED_color_code_ppo2 ; Color-code output (ppO2 stored in xC:3)
3130 3140
3131 tstfsz hi ; >2,55bar? 3141 tstfsz hi ; >2,55bar?
3132 rcall PLED_const_ppO2_too_hi ; Yes 3142 rcall PLED_const_ppO2_too_hi ; Yes
3133 3143
3134 bsf leftbind 3144 bsf leftbind
3191 call PLED_divemask_color ; Set Color for Divemode mask 3201 call PLED_divemask_color ; Set Color for Divemode mask
3192 STRCPY_PRINT "ppO2:" ; ppO2 of diluent 3202 STRCPY_PRINT "ppO2:" ; ppO2 of diluent
3193 3203
3194 movff char_O_flush_ppO2,WREG ; copy to WREG 3204 movff char_O_flush_ppO2,WREG ; copy to WREG
3195 mullw .100 3205 mullw .100
3206 clrf xC+2
3196 movff PRODH,xC+1 3207 movff PRODH,xC+1
3197 movff PRODL,xC+0 ; For color code 3208 movff PRODL,xC+0 ; For color code
3198 PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) 3209 call PLED_color_code_ppo2 ; Color-code output (ppO2 stored in xC:3)
3199 3210
3200 WIN_LEFT .130 3211 WIN_LEFT .130
3201 WIN_TOP .168 3212 WIN_TOP .168
3202 3213
3203 movff char_O_flush_ppO2, lo 3214 movff char_O_flush_ppO2, lo