Mercurial > public > hwos_code
comparison src/tft_outputs.asm @ 526:0d1cda9f2d43
BUGFIX: Skip MOD Test for CCR in Sensor modes (OSTC cR and OSTC3 only)
CHANGE: Swap positions of ppO2(O2) and ppO2(Dil) in customview 10 on screen. "left = lean" and "right = rich"
BUGFIX: A wrong configured gas was suggested as "Better gas" on the configured depth even if this resulted in a ppO2 high or low condition
author | heinrichsweikamp |
---|---|
date | Sat, 05 Aug 2017 16:50:28 +0200 |
parents | d339c9e1175d |
children | d36f9fca10ae |
comparison
equal
deleted
inserted
replaced
525:00df86a5ac01 | 526:0d1cda9f2d43 |
---|---|
137 call div16x16 ; xC=p_amb/10 | 137 call div16x16 ; xC=p_amb/10 |
138 movff xC+0,xA+0 | 138 movff xC+0,xA+0 |
139 movff xC+1,xA+1 | 139 movff xC+1,xA+1 |
140 movff hi,xB+0 | 140 movff hi,xB+0 |
141 clrf xB+1 | 141 clrf xB+1 |
142 call mult16x16 ; lo * p_amb/10 | 142 call mult16x16 ; hi * p_amb/10 |
143 ; Check if ppO2>6,55bar | 143 ; Check if ppO2>6,55bar |
144 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | 144 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? |
145 bra TFT_warnings_color ; Yes, warn in warning color | 145 bra TFT_warnings_color ; Yes, warn in warning color |
146 ; Check if ppO2>3,30bar | 146 ; Check if ppO2>3,30bar |
147 btfsc xC+1,7 | 147 btfsc xC+1,7 |
166 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here | 166 movff opt_ppO2_max_deco,xB+1 ; xB+1 used as temp here |
167 movlw .3 | 167 movlw .3 |
168 cpfseq xA+0 ; Deco? | 168 cpfseq xA+0 ; Deco? |
169 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max | 169 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max |
170 movf xB+1,W ; Result in WREG | 170 movf xB+1,W ; Result in WREG |
171 mullw d'100' ; opt_ppO2_max*100 | 171 mullw d'100' ; opt_ppO2_max*100 |
172 movff PRODL,sub_b+0 | 172 movff PRODL,sub_b+0 |
173 movff PRODH,sub_b+1 | 173 movff PRODH,sub_b+1 |
174 call subU16 ; sub_c = sub_a - sub_b | 174 infsnz sub_a+0,F |
175 btfss neg_flag | 175 incf sub_a+1,F ; add 1mbar to avoid warning on equal |
176 bra TFT_warnings_color ; too high -> Warning Color! | 176 call subU16 ; sub_c = sub_a - sub_b |
177 return | 177 btfss neg_flag |
178 | 178 bra TFT_warnings_color ; too high -> Warning Color! |
179 return | |
180 | |
179 TFT_color_code_ceiling: | 181 TFT_color_code_ceiling: |
180 SAFE_2BYTE_COPY rel_pressure, lo | 182 SAFE_2BYTE_COPY rel_pressure, lo |
181 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 183 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
182 movff hi,xA+1 | 184 movff hi,xA+1 |
183 movff lo,xA+0 | 185 movff lo,xA+0 |
224 bra TFT_warnings_color ; Set to warning color | 226 bra TFT_warnings_color ; Set to warning color |
225 bra TFT_standard_color ; and return... | 227 bra TFT_standard_color ; and return... |
226 | 228 |
227 | 229 |
228 TFT_color_code_ppo2_depth: | 230 TFT_color_code_ppo2_depth: |
231 movff opt_dive_mode,WREG ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR | |
232 decfsz WREG,F | |
233 bra TFT_color_code_ppo2_depth_no_ccr ; Not CCR... | |
234 | |
235 btfsc is_bailout | |
236 bra TFT_color_code_ppo2_depth_no_ccr ; Is bailout -> Test for MOD warning | |
237 | |
238 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
239 decfsz WREG,F | |
240 bra TFT_color_code_ppo2_depth_no_ccr ; Not Sensor | |
241 ; -> CCR and Sensor: Skip this test | |
242 return | |
243 TFT_color_code_ppo2_depth_no_ccr: | |
229 SAFE_2BYTE_COPY amb_pressure, xA | 244 SAFE_2BYTE_COPY amb_pressure, xA |
230 movlw d'10' | 245 movlw d'10' |
231 movwf xB+0 | 246 movwf xB+0 |
232 clrf xB+1 | 247 clrf xB+1 |
233 call div16x16 ; xC=p_amb/10 | 248 call div16x16 ; xC=p_amb/10 |
256 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max | 271 movff opt_ppO2_max,xB+1 ; No, overwrite with travel/bottom max |
257 movf xB+1,W ; Result in WREG | 272 movf xB+1,W ; Result in WREG |
258 mullw d'100' | 273 mullw d'100' |
259 movff PRODL,sub_b+0 | 274 movff PRODL,sub_b+0 |
260 movff PRODH,sub_b+1 | 275 movff PRODH,sub_b+1 |
261 call subU16 ; sub_c = sub_a - sub_b | 276 infsnz sub_a+0,F |
277 incf sub_a+1,F ; add 1mbar to avoid warning on equal | |
278 call subU16 ; sub_c = sub_a - sub_b | |
262 btfss neg_flag | 279 btfss neg_flag |
263 bra TFT_color_code_depth_warn | 280 bra TFT_color_code_depth_warn |
264 | 281 |
265 movff xC+0,sub_a+0 | 282 movff xC+0,sub_a+0 |
266 movff xC+1,sub_a+1 | 283 movff xC+1,sub_a+1 |
323 movf xB+1,W ; Result in WREG | 340 movf xB+1,W ; Result in WREG |
324 | 341 |
325 mullw d'100' | 342 mullw d'100' |
326 movff PRODL,sub_b+0 | 343 movff PRODL,sub_b+0 |
327 movff PRODH,sub_b+1 | 344 movff PRODH,sub_b+1 |
345 infsnz sub_a+0,F | |
346 incf sub_a+1,F ; add 1mbar to avoid warning on equal | |
328 call subU16 ; sub_c = sub_a - sub_b | 347 call subU16 ; sub_c = sub_a - sub_b |
329 btfss neg_flag | 348 btfss neg_flag |
330 bra TFT_warnings_color ; Set to warning color | 349 bra TFT_warnings_color ; Set to warning color |
331 | 350 |
332 movff xC+0,sub_a+0 | 351 movff xC+0,sub_a+0 |
907 movff char_O_first_deco_depth,lo ; Ceiling in m | 926 movff char_O_first_deco_depth,lo ; Ceiling in m |
908 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | 927 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) |
909 movff char_O_first_deco_time,lo ; length of first stop in min | 928 movff char_O_first_deco_time,lo ; length of first stop in min |
910 output_99 | 929 output_99 |
911 STRCAT_PRINT "'" | 930 STRCAT_PRINT "'" |
912 bra TFT_standard_color ; and return... | 931 goto TFT_standard_color ; and return... |
913 | 932 |
914 global TFT_decoplan | 933 global TFT_decoplan |
915 TFT_decoplan: | 934 TFT_decoplan: |
916 call TFT_divemask_color | 935 call TFT_divemask_color |
917 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row | 936 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row |
918 STRCPY_TEXT_PRINT tDiveDecoplan | 937 STRCPY_TEXT_PRINT tDiveDecoplan |
919 rcall TFT_standard_color | 938 call TFT_standard_color |
920 | 939 |
921 movff char_O_deco_depth+1,lo | 940 movff char_O_deco_depth+1,lo |
922 tstfsz lo ; Show another stop? | 941 tstfsz lo ; Show another stop? |
923 bra TFT_display_deko2 ; Yes | 942 bra TFT_display_deko2 ; Yes |
924 ; No, clear output and return | 943 ; No, clear output and return |