comparison src/tft_outputs.asm @ 608:d866684249bd

work on 2.99 stable
author heinrichsweikamp
date Mon, 07 Jan 2019 21:13:43 +0100
parents 5ce603c29750
children b87f23fae743
comparison
equal deleted inserted replaced
607:c5151a490d88 608:d866684249bd
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File tft_outputs.asm REFACTORED VERSION V2.99e 3 ; File tft_outputs.asm REFACTORED VERSION V2.99f
4 ; 4 ;
5 ; Startup subroutines 5 ; Startup subroutines
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
353 btfss hi,int_attention_flag ; is the attention flag set? 353 btfss hi,int_attention_flag ; is the attention flag set?
354 bra TFT_color_code_ppo2_2 ; NO 354 bra TFT_color_code_ppo2_2 ; NO
355 bcf hi,int_attention_flag ; YES - clear attention flag (it may be set) 355 bcf hi,int_attention_flag ; YES - clear attention flag (it may be set)
356 bcf hi,int_high_flag ; clear high warning flag (it may be set) 356 bcf hi,int_high_flag ; clear high warning flag (it may be set)
357 bcf hi,int_low_flag ; clear low warning flag (it may be set) 357 bcf hi,int_low_flag ; clear low warning flag (it may be set)
358 bra TFT_attention_color ; set to standard color and return 358 bra TFT_attention_color ; set to attention color and return
359 TFT_color_code_ppo2_2: 359 TFT_color_code_ppo2_2:
360 bcf hi,int_high_flag ; clear high warning flag (it may be set) 360 bcf hi,int_high_flag ; clear high warning flag (it may be set)
361 bcf hi,int_low_flag ; clear low warning flag (it may be set) 361 bcf hi,int_low_flag ; clear low warning flag (it may be set)
362 bra TFT_memo_color ; set to memo color and return 362 bra TFT_memo_color ; set to memo color and return
363 363
1326 STRCAT_PRINT "" 1326 STRCAT_PRINT ""
1327 1327
1328 ; stopped dive time 1328 ; stopped dive time
1329 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row 1329 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row
1330 TFT_update_stopwatch: ; jump-in point for stopped dive time in compass custom view 1330 TFT_update_stopwatch: ; jump-in point for stopped dive time in compass custom view
1331 bsf leftbind ; print numbers without leading spaces
1331 movff average_divesecs+0,lo ; average_divesecs is incremented outside ISR 1332 movff average_divesecs+0,lo ; average_divesecs is incremented outside ISR
1332 movff average_divesecs+1,hi 1333 movff average_divesecs+1,hi
1333 call convert_time ; converts hi:lo in seconds to minutes (up:hi) and seconds (lo) 1334 call convert_time ; converts hi:lo in seconds to minutes (up:hi) and seconds (lo)
1334 movlw .100 ; display layout will change if minutes become >= 100 1335 movlw .100 ; display layout will change if minutes become >= 100
1335 cpfslt hi ; minutes < 100 ? 1336 cpfslt hi ; minutes < 100 ?
2443 btfsc blinking_depth_prev ; did we have warning previously? 2444 btfsc blinking_depth_prev ; did we have warning previously?
2444 bra TFT_depth_blink_prevwarn; YES 2445 bra TFT_depth_blink_prevwarn; YES
2445 2446
2446 ; NO - check if it's set now 2447 ; NO - check if it's set now
2447 btfsc blinking_depth_warning ; do we have warning set now? 2448 btfsc blinking_depth_warning ; do we have warning set now?
2448 bra TFT_depth_blink_warn ; Yes - so we have warning now but not previously 2449 bra TFT_depth_blink_warn ; YES - so we have warning now but not previously
2449 btfsc blinking_depth_attention; do we have attention set now? 2450 btfsc blinking_depth_attention; do we have attention set now?
2450 bra TFT_depth_blink_warn ; Yes - so we have attention now but not previously 2451 bra TFT_depth_blink_warn ; YES - so we have attention now but not previously
2451 2452
2452 ; no warning in previous cycle, no warning now, reset all flags 2453 ; no warning in previous cycle, no warning now, reset all flags
2453 bcf blinking_depth_prev ; reset previous flag 2454 bcf blinking_depth_prev ; reset previous flag
2454 bcf blinking_depth_toggle ; reset toggle 2455 bcf blinking_depth_toggle ; reset toggle
2455 bcf win_invert 2456 bcf win_invert
2477 bra TFT_depth_blink_reset ; clear inverse, do black box, reset flag 2478 bra TFT_depth_blink_reset ; clear inverse, do black box, reset flag
2478 2479
2479 TFT_depth_blink_warn: 2480 TFT_depth_blink_warn:
2480 ; new blinking warning activated (had no warning in previous cycle) 2481 ; new blinking warning activated (had no warning in previous cycle)
2481 bsf blinking_depth_prev ; set prev flag 2482 bsf blinking_depth_prev ; set prev flag
2482 ; set toggle and invert 2483 ;bra TFT_depth_blink_set ; set toggle and invert
2483 ;bra TFT_depth_blink_set
2484 2484
2485 TFT_depth_blink_set: 2485 TFT_depth_blink_set:
2486 ; clear the area with color 2486 ; clear the area with color
2487 call TFT_attention_color_dive ; default to attention color 2487 call TFT_attention_color_dive ; default background to attention color
2488 btfsc blinking_depth_warning ; in warning mode? 2488 btfsc blinking_depth_warning ; in warning mode?
2489 call TFT_warnings_color_dive ; overwrite with warning color 2489 call TFT_warnings_color_dive ; overwrite background color with warning color
2490 WIN_BOX_COLOR dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right 2490 WIN_BOX_COLOR dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2491 ;set the invert color 2491 bsf win_invert ;set the invert color
2492 bsf win_invert 2492 bsf blinking_depth_toggle ; set the toggle
2493 ; set the toggle 2493 return ; all done
2494 bsf blinking_depth_toggle
2495 ; all done
2496 return
2497 2494
2498 TFT_depth_blink_reset: 2495 TFT_depth_blink_reset:
2499 ; clear the area with black 2496 ; clear the area with black
2500 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right 2497 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2501 ;reset the invert color 2498 bcf win_invert ; reset the invert color
2502 bcf win_invert 2499 bcf blinking_depth_toggle ; reset the toggle
2503 ; reset the toggle 2500 call TFT_attention_color ; default to attention color
2504 bcf blinking_depth_toggle 2501 btfsc blinking_depth_warning ; do we have a warning?
2505 ; if it's still warning... 2502 call TFT_warnings_color ; YES - overwrite with warning color
2506 btfsc blinking_depth_warning 2503 return ; all done
2507 call TFT_warnings_color
2508 btfsc blinking_depth_attention
2509 call TFT_attention_color
2510 ; all done
2511 return
2512 2504
2513 ;============================================================================= 2505 ;=============================================================================
2514 2506
2515 global TFT_custom_text 2507 global TFT_custom_text
2516 TFT_custom_text: ; show the custom text 2508 TFT_custom_text: ; show the custom text
3833 3825
3834 3826
3835 global TFT_gf_factors_mask ; mask for GF factors 3827 global TFT_gf_factors_mask ; mask for GF factors
3836 TFT_gf_factors_mask: 3828 TFT_gf_factors_mask:
3837 call TFT_divemask_color 3829 call TFT_divemask_color
3838 WIN_TINY dm_custom_gf_column1+.4, dm_custom_gf_title_row 3830 WIN_TINY dm_custom_gf_column1,dm_custom_gf_title_row
3839 STRCPY_TEXT_PRINT tGFactors 3831 STRCPY_TEXT_PRINT tGFactors
3840 WIN_TINY dm_custom_gf_column2+.2, dm_custom_gf_title_row 3832 WIN_TINY dm_custom_gf_column3,dm_custom_gf_title_row
3841 STRCPY_TEXT_PRINT taGFactors 3833 STRCPY_TEXT_PRINT taGFactors
3842 WIN_TINY dm_custom_gf_column3-.3, dm_custom_gf_title_row 3834 ; Show GF (static)
3843 STRCPY_TEXT_PRINT tGFInfo 3835 call TFT_disabled_color ; default to disabled color
3844 ; Show GF (Static) 3836 btfss use_agf ; shall use alternative GF factors?
3845 call TFT_disabled_color 3837 call TFT_memo_color ; NO - switch to memo color
3846 btfss use_agf
3847 call TFT_memo_color
3848 WIN_STD dm_custom_gf_column1, dm_custom_gf_row 3838 WIN_STD dm_custom_gf_column1, dm_custom_gf_row
3849 bsf leftbind 3839 bsf leftbind
3850 movff opt_GF_low,lo 3840 movff opt_GF_low,lo ; get normal GF low
3851 output_8 3841 output_8 ; print normal GF low
3852 PUTC "/" 3842 PUTC "/" ; print "/"
3853 movff opt_GF_high,lo 3843 movff opt_GF_high,lo ; get normal GF high
3854 output_8 3844 output_8 ; print normal GF high
3855 STRCAT_PRINT "" 3845 STRCAT_PRINT "" ; finish output
3856 ; Show aGF (Static) 3846 ; Show aGF (static)
3857 call TFT_memo_color 3847 call TFT_memo_color ; default to memo color
3858 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater 3848 TSTOSS opt_enable_aGF ; are alternative GF factors enabled?
3859 bra TFT_gf_mask2 ; show "---" instead 3849 bra TFT_gf_factors_mask_3 ; NO - show "---" and return
3860 btfss use_agf 3850 ; YES - show aGF and which one is active
3861 call TFT_disabled_color
3862 WIN_STD dm_custom_gf_column2, dm_custom_gf_row 3851 WIN_STD dm_custom_gf_column2, dm_custom_gf_row
3863 movff opt_aGF_low,lo 3852 btfss use_agf ; shall use aGF?
3864 output_8 3853 bra TFT_gf_factors_mask_1 ; NO - print "<- "
3865 PUTC "/" 3854 STRCPY_PRINT " ->" ; YES - print " ->"
3866 movff opt_aGF_high,lo 3855 bra TFT_gf_factors_mask_2 ; - continue with common part
3867 output_8 3856 TFT_gf_factors_mask_1:
3868 STRCAT_PRINT "" 3857 STRCPY_PRINT "<- " ; (NO) - print "<- "
3869 bra TFT_custview_exit1 ; and return... 3858 TFT_gf_factors_mask_2: ; common part
3870 TFT_gf_mask2: 3859 btfss use_agf ; shall use aGF?
3871 WIN_STD dm_custom_gf_column2+.10, dm_custom_gf_row 3860 call TFT_disabled_color ; NO - switch to disabled color
3861 WIN_STD dm_custom_gf_column3, dm_custom_gf_row
3862 movff opt_aGF_low,lo ; get aGF low
3863 output_8 ; print
3864 PUTC "/" ; print "/"
3865 movff opt_aGF_high,lo ; get aGF high
3866 output_8 ; print
3867 STRCAT_PRINT "" ; finish output
3868 bra TFT_custview_exit1 ; done
3869 TFT_gf_factors_mask_3:
3870 WIN_STD dm_custom_gf_column3+.10, dm_custom_gf_row
3872 STRCPY_PRINT "---" 3871 STRCPY_PRINT "---"
3873 bra TFT_custview_exit1 ; and return... 3872 bra TFT_custview_exit1 ; done
3874 3873
3875 3874
3876 global TFT_ceiling_GF_tissue_mask ; mask for ceiling, current GF and tissues 3875 global TFT_ceiling_GF_tissue_mask ; mask for ceiling, current GF and tissues
3877 TFT_ceiling_GF_tissue_mask: 3876 TFT_ceiling_GF_tissue_mask:
3878 call TFT_divemask_color 3877 call TFT_divemask_color
3883 ; collides with ceiling output and not really needed, too 3882 ; collides with ceiling output and not really needed, too
3884 ; WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row 3883 ; WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row
3885 ; STRCPY_TEXT_PRINT tN2 3884 ; STRCPY_TEXT_PRINT tN2
3886 ; WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row 3885 ; WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row
3887 ; STRCPY_TEXT_PRINT tHe 3886 ; STRCPY_TEXT_PRINT tHe
3888 TSTOSS char_I_deco_model ; in GF mode (0 = ZH-L16, 1 = ZH-L16-GF)? 3887 WIN_TINY dm_custom_gf_column1+.5, dm_custom_gf_title_row
3889 bra TFT_custview_exit1 ; NO - no GF info in none-GF mode
3890 WIN_TINY dm_custom_gf_column1, dm_custom_gf_title_row
3891 STRCPY_TEXT_PRINT tGFInfo 3888 STRCPY_TEXT_PRINT tGFInfo
3892 bra TFT_custview_exit1 ; and return... 3889 bra TFT_custview_exit1 ; and return...
3893 3890
3894 3891
3895 global TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues 3892 global TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues
3911 TFT_ceiling_tissue_cGF0: 3908 TFT_ceiling_tissue_cGF0:
3912 bcf leftbind 3909 bcf leftbind
3913 STRCAT_PRINT " " 3910 STRCAT_PRINT " "
3914 ; Show tissue diagram 3911 ; Show tissue diagram
3915 call DISP_tissue_saturation_graph; show char_O_tissue_N2_saturation and char_O_tissue_He_saturation 3912 call DISP_tissue_saturation_graph; show char_O_tissue_N2_saturation and char_O_tissue_He_saturation
3916 ; Show current GF 3913 ; Show current tissue supersaturation
3917 TSTOSS char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF
3918 bra TFT_custview_exit1 ; no GF info for none-GF mode
3919 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row 3914 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row
3920 movff int_O_gradient_factor+0,lo ; gradient factor absolute, 100% = on M-line of straight Buhlmann 3915 movff int_O_gradient_factor+0,lo ; gradient factor absolute, 100% = on M-line of straight Buhlmann
3921 movff int_O_gradient_factor+1,hi ; hi byte holds flags 3916 movff int_O_gradient_factor+1,hi ; hi byte holds flags
3922 call TFT_color_code_gf ; color-code output 3917 call TFT_color_code_gf ; color-code output
3923 output_8 ; need to print lo only, int_O_gradient_factor value is limited to 255 3918 output_8 ; need to print lo only, int_O_gradient_factor value is limited to 255
3924 STRCAT_PRINT "" 3919 STRCAT_PRINT ""
3925 WIN_STD dm_custom_clock_column+.40, dm_custom_gf_row+.5 3920 WIN_STD dm_custom_clock_column+.40, dm_custom_gf_row+.5
3926 STRCAT_PRINT "%" ; % is printed in color set by TFT_color_code_gf, too 3921 STRCAT_PRINT "%" ; % is printed in color set by TFT_color_code_gf, too
3927 bra TFT_custview_exit1 ; and return...
3928
3929
3930 global TFT_gf_factors ; data for GF factors
3931 TFT_gf_factors:
3932 WIN_STD dm_custom_gf_column3, dm_custom_gf_row
3933 movff int_O_gradient_factor+0,lo ; gradient factor absolute (Non-GF model)
3934 movff int_O_gradient_factor+1,hi
3935 call TFT_color_code_gf ; color-code output
3936 output_8 ; print lo only, int_O_gradient_factor is limited to 255
3937 STRCAT_PRINT "%"
3938 TFT_custview_exit1: 3922 TFT_custview_exit1:
3939 bcf leftbind 3923 bcf leftbind
3940 goto TFT_standard_color ; and return... 3924 goto TFT_standard_color ; and return...
3941 3925
3942 3926
4158 WIN_TINY dm_custom_ppo2_column-.2, dm_custom_ppo2_title_row ; normal position 4142 WIN_TINY dm_custom_ppo2_column-.2, dm_custom_ppo2_title_row ; normal position
4159 STRCPY_TEXT_PRINT tppO2 ; in all other modes 4143 STRCPY_TEXT_PRINT tppO2 ; in all other modes
4160 bra TFT_custview_exit2 ; and return... 4144 bra TFT_custview_exit2 ; and return...
4161 4145
4162 4146
4163 global TFT_display_pure_ppo2 ; show ppO2 of the pure gas - helper function for several custom views
4164 TFT_display_pure_ppo2:
4165 WIN_MEDIUM dm_custom_ppo2_column, dm_custom_ppo2_row
4166 movff int_O_pure_ppO2+0,lo ; copy ppO2 of the pure gas to hi:lo
4167 movff int_O_pure_ppO2+1,hi
4168 call TFT_color_code_ppo2 ; color-code output
4169 bsf leftbind
4170 output_16dp .3 ; x.xx bar
4171 bcf leftbind
4172 STRCAT_PRINT ""
4173 bra TFT_custview_exit2 ; and return...
4174
4175
4176 global TFT_ppo2_ead_end_cns_mask ; mask for ppO2, END/EAD and CNS 4147 global TFT_ppo2_ead_end_cns_mask ; mask for ppO2, END/EAD and CNS
4177 TFT_ppo2_ead_end_cns_mask: 4148 TFT_ppo2_ead_end_cns_mask:
4178 rcall TFT_mask_ppo2 4149 rcall TFT_mask_ppo2
4179 call TFT_divemask_color 4150 call TFT_divemask_color
4180 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row 4151 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row
4184 bra TFT_custview_exit2 ; and return... 4155 bra TFT_custview_exit2 ; and return...
4185 4156
4186 4157
4187 global TFT_ppo2_ead_end_cns ; data for ppO2, END/EAD and CNS 4158 global TFT_ppo2_ead_end_cns ; data for ppO2, END/EAD and CNS
4188 TFT_ppo2_ead_end_cns: 4159 TFT_ppo2_ead_end_cns:
4189 ;show ppO2 4160 ; Show ppO2
4190 rcall TFT_display_pure_ppo2 ; show ppO2 of the pure gas 4161 WIN_MEDIUM dm_custom_ppo2_column, dm_custom_ppo2_row
4162 movff int_O_breathed_ppO2+0,lo ; copy ppO2 of the currently breathed gas to hi:lo
4163 movff int_O_breathed_ppO2+1,hi
4164 call TFT_color_code_ppo2 ; color-code output
4165 bsf leftbind
4166 output_16dp .3 ; x.xx bar
4167 bcf leftbind
4168 STRCAT_PRINT ""
4169 call TFT_standard_color
4191 ; Show END/EAD 4170 ; Show END/EAD
4192 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row 4171 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row
4193 STRCPY_TEXT tEAD ; EAD: 4172 STRCPY_TEXT tEAD ; EAD:
4194 movff char_O_EAD,lo 4173 movff char_O_EAD,lo
4195 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars 4174 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
4271 4250
4272 ;============================================================================= 4251 ;=============================================================================
4273 4252
4274 global TFT_surface_lastdive 4253 global TFT_surface_lastdive
4275 TFT_surface_lastdive: 4254 TFT_surface_lastdive:
4276 call TFT_standard_color 4255 call TFT_divemask_color
4277 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 4256 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5
4278 STRCAT_TEXT_PRINT tLastDive ; "Last Dive:" 4257 STRCAT_TEXT_PRINT tLastDive ; "Last Dive:"
4279 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5 4258 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5
4280 STRCAT_TEXT_PRINT tDivetime ; "Divetime:" 4259 STRCAT_TEXT_PRINT tDivetime ; "Divetime:"
4281 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 4260 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5
4282 STRCAT_TEXT_PRINT tMaxDepth ; "Max. Depth" 4261 STRCAT_TEXT_PRINT tMaxDepth ; "Max. Depth"
4283 4262 call TFT_standard_color
4284 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row 4263 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row
4285 movff int_O_desaturation_time+0,lo ; bank-safe copies 4264 movff int_O_desaturation_time+0,lo ; bank-safe copies
4286 movff int_O_desaturation_time+1,WREG 4265 movff int_O_desaturation_time+1,WREG
4287 iorwf lo,W ; check if desaturation time is zero 4266 iorwf lo,W ; check if desaturation time is zero
4288 bz TFT_surface_lastdive_1 ; YES - show last dive time 4267 bz TFT_surface_lastdive_1 ; YES - show last dive time