comparison src/tft_outputs.asm @ 654:75e90cd0c2c3

hwOS sport 10.77 release
author heinrichsweikamp
date Thu, 14 Mar 2024 16:56:46 +0100
parents bc214815deb2
children
comparison
equal deleted inserted replaced
653:8bcd138ab744 654:75e90cd0c2c3
2 ; 2 ;
3 ; File tft_outputs.asm * combined next generation V3.12.3 3 ; File tft_outputs.asm * combined next generation V3.12.3
4 ; 4 ;
5 ; high-level Display Outputs 5 ; high-level Display Outputs
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
9 ; HISTORY 9 ; HISTORY
10 ; 2011-08-07 : [mH] moving from OSTC code 10 ; 2011-08-07 : [mH] moving from OSTC code
11 11
12 #include "hwos.inc" ; mandatory header 12 #include "hwos.inc" ; mandatory header
585 ;----------------------------------------------------------------------------- 585 ;-----------------------------------------------------------------------------
586 ; Surface Mode Screen - current Time 586 ; Surface Mode Screen - current Time
587 ; 587 ;
588 global TFT_surfmode_time 588 global TFT_surfmode_time
589 TFT_surfmode_time: 589 TFT_surfmode_time:
590 TSTOSS opt_timeformat ; =1: Use 12h format
591 bra TFT_surfmode_time24 ; <>1: Use 24h format
592 ; 12h Format
593 WIN_SMALL surf_clock_column,surf_clock_row
594 FONT_COLOR_MEMO ; set color
595 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time
596 movff rtc_latched_hour,lo ; get hours
597 call TFT_convert_lo_into_12h_format ; converts lo (0-23h) into lo (1-12) and sets aux_flag for PM/AM
598 output_99 ; print hours (0-99)
599 movlw ':' ; load a ":"
600 movff rtc_latched_secs,lo ; get seconds
601 btfss lo,0 ; on even second?
602 movlw ' ' ; NO - load a space char
603 movwf POSTINC2 ; print ":" or space char
604 movff rtc_latched_mins,lo ; get minutes
605 output_99x ; print minutes (00-99)
606 btfsc aux_flag ; =1 for PM
607 bra TFT_surfmode_time_PM
608 STRCAT_PRINT "AM"
609 return ; done
610 TFT_surfmode_time_PM:
611 STRCAT_PRINT "PM"
612 return ; done
613
614 TFT_surfmode_time24:
590 WIN_SMALL surf_clock_column+.7,surf_clock_row 615 WIN_SMALL surf_clock_column+.7,surf_clock_row
591 FONT_COLOR_MEMO ; set color 616 FONT_COLOR_MEMO ; set color
592 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time 617 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time
593 movff rtc_latched_hour,lo ; get hours 618 movff rtc_latched_hour,lo ; get hours
594 output_99 ; print hours (0-99) 619 output_99 ; print hours (0-99)
1065 ;----------------------------------------------------------------------------- 1090 ;-----------------------------------------------------------------------------
1066 ; Surface Menu - Imprint Time & Date - fast Updating 1091 ; Surface Menu - Imprint Time & Date - fast Updating
1067 ; 1092 ;
1068 global TFT_imprint_time_date_fast 1093 global TFT_imprint_time_date_fast
1069 TFT_imprint_time_date_fast: 1094 TFT_imprint_time_date_fast:
1070 WIN_SMALL .20,.40 ; column, row - keep clear of the cursor area on the left! 1095 WIN_SMALL .20,.35 ; column, row - keep clear of the cursor area on the left!
1071 FONT_COLOR_MEMO ; select color 1096 FONT_COLOR_MEMO ; set color
1097 TSTOSS opt_timeformat ; =1: Use 12h format
1098 bra TFT_imprint_time_date_fast24 ; <>1: Use 24h format
1099 ; 12h Format
1100 movff rtc_latched_hour,lo ; get hours
1101 rcall TFT_convert_lo_into_12h_format ; converts lo (0-23h) into lo (1-12) and sets aux_flag for PM/AM
1102 output_99 ; print hours (0-99)
1103 movlw ':' ; load a ":"
1104 movff rtc_latched_secs,lo ; get seconds
1105 btfss lo,0 ; on even second?
1106 movlw ' ' ; NO - load a space char
1107 movwf POSTINC2 ; print ":" or space char
1108 movff rtc_latched_mins,lo ; get minutes
1109 output_99x ; print minutes (00-99)
1110 PUTC ':' ; print ":"
1111 movff rtc_latched_secs,lo ; get seconds
1112 output_99x ; print seconds (00-99)
1113 btfsc aux_flag ; =1 for PM
1114 bra TFT_surfmode_time_PM_fast
1115 STRCAT "AM "
1116 bra TFT_imprint_time_date_fast_date ; done
1117 TFT_surfmode_time_PM_fast:
1118 STRCAT "PM "
1119 bra TFT_imprint_time_date_fast_date ; done
1120 TFT_imprint_time_date_fast24:
1072 movff rtc_latched_hour,lo ; get hours 1121 movff rtc_latched_hour,lo ; get hours
1073 output_99 ; print hours (0-99) 1122 output_99 ; print hours (0-99)
1074 PUTC ':' ; print ":" 1123 PUTC ':' ; print ":"
1075 movff rtc_latched_mins,lo ; get minutes 1124 movff rtc_latched_mins,lo ; get minutes
1076 output_99x ; print minutes (00-99) 1125 output_99x ; print minutes (00-99)
1077 PUTC ':' ; print ":" 1126 PUTC ':' ; print ":"
1078 movff rtc_latched_secs,lo ; get seconds 1127 movff rtc_latched_secs,lo ; get seconds
1079 output_99x ; print seconds (00-99) 1128 output_99x ; print seconds (00-99)
1080 STRCAT " " ; append two spaces 1129 STRCAT " " ; append two spaces
1130 TFT_imprint_time_date_fast_date:
1081 movff rtc_latched_year, lo ; get date 1131 movff rtc_latched_year, lo ; get date
1082 movff rtc_latched_month,hi ; ... 1132 movff rtc_latched_month,hi ; ...
1083 movff rtc_latched_day, up ; ... 1133 movff rtc_latched_day, up ; ...
1084 call output_date ; print date 1134 call output_date ; print date
1085 PUTC_PRINT " " ; append a space and dump to screen 1135 PUTC_PRINT " " ; append a space and dump to screen
1086 return ; done 1136 return ; done
1087 1137
1088 1138 global TFT_convert_lo_into_12h_format
1139 TFT_convert_lo_into_12h_format: ; converts lo (0-23h) into lo (1-12) with PM/AM flag in aux_flag
1140 tstfsz lo
1141 bra TFT_convert_lo_into_12h_format1
1142 ; 0 -> 12AM
1143 movlw .12
1144 movwf lo
1145 bcf aux_flag ; PM/AM Bit
1146 return
1147 TFT_convert_lo_into_12h_format1:
1148 movlw .13
1149 cpfslt lo ; >12h?
1150 bra TFT_convert_lo_into_12h_format2 ; yes
1151 ; lo stays the same
1152 bsf aux_flag ; PM/AM Bit
1153 movlw .12 ; 12:00 is 12:00 PM...
1154 cpfseq lo
1155 bcf aux_flag
1156 return
1157 TFT_convert_lo_into_12h_format2:
1158 movlw .12
1159 subwf lo,F
1160 bsf aux_flag ; PM/AM Bit
1161 return
1162
1089 IFDEF _external_sensor 1163 IFDEF _external_sensor
1090 1164
1091 ;----------------------------------------------------------------------------- 1165 ;-----------------------------------------------------------------------------
1092 ; Surface Mode - Imprint ppO2 from Sensors 1166 ; Surface Mode - Imprint ppO2 from Sensors
1093 ; 1167 ;
1413 STRCPY_TEXT_PRINT tNDL ; - print "NDL" 1487 STRCPY_TEXT_PRINT tNDL ; - print "NDL"
1414 btfss deco_region ; - was the dive within deco stops region? 1488 btfss deco_region ; - was the dive within deco stops region?
1415 return ; NO - done 1489 return ; NO - done
1416 btfsc safety_stop_active ; YES - safety stop shown? 1490 btfsc safety_stop_active ; YES - safety stop shown?
1417 return ; YES - done 1491 return ; YES - done
1492 btfsc alt_layout_active ; In alternative layout?
1493 return ; YES - DONE.
1418 goto TFT_show_slow_reminder ; NO - show "slow" reminder 1494 goto TFT_show_slow_reminder ; NO - show "slow" reminder
1419 1495
1420 1496
1421 ;----------------------------------------------------------------------------- 1497 ;-----------------------------------------------------------------------------
1422 ; Dive Mode - Deco Layout Add-on 1498 ; Dive Mode - Deco Layout Add-on
2104 TFT_show_ndl: 2180 TFT_show_ndl:
2105 btfsc dive_main_menu ; is the dive mode menu shown? 2181 btfsc dive_main_menu ; is the dive mode menu shown?
2106 return ; YES - abort 2182 return ; YES - abort
2107 MOVII int_O_NDL_norm,mpr ; NO - get NDL time in normal plan 2183 MOVII int_O_NDL_norm,mpr ; NO - get NDL time in normal plan
2108 rcall TFT_show_ndl_tts_set_color ; - set color 2184 rcall TFT_show_ndl_tts_set_color ; - set color
2109 btfsc deco_locked ; - was the dive in deco? 2185 ; btfsc deco_locked ; - was the dive in deco?
2110 bra TFT_show_ndl_norm ; YES - use normal layout 2186 ; bra TFT_show_ndl_norm ; YES - use normal layout
2111 btfsc alt_layout_active ; NO - alternative layout active? 2187 btfsc alt_layout_active ; NO - alternative layout active?
2112 bra TFT_show_ndl_alt ; YES - use alternative layout 2188 bra TFT_show_ndl_alt ; YES - use alternative layout
2113 ;bra TFT_show_ndl_norm ; NO - use normal layout 2189 ;bra TFT_show_ndl_norm ; NO - use normal layout
2114 2190
2115 TFT_show_ndl_norm: 2191 TFT_show_ndl_norm:
2289 ; Dive Mode - clear Apnoe Surface Time 2365 ; Dive Mode - clear Apnoe Surface Time
2290 ; 2366 ;
2291 global TFT_clear_apnoe_surface 2367 global TFT_clear_apnoe_surface
2292 TFT_clear_apnoe_surface: 2368 TFT_clear_apnoe_surface:
2293 WIN_BOX_BLACK dm_apnoe_last_max_depth_text_row, .239, dm_apnoe_last_max_depth_column, .159 2369 WIN_BOX_BLACK dm_apnoe_last_max_depth_text_row, .239, dm_apnoe_last_max_depth_column, .159
2294 return ; done 2370 WIN_BOX_BLACK dm_customview_bot, dm_apnoe_last_max_depth_text_row, dm_apnoe_surface_dive_text_col, .159
2295 2371 return ; done
2372
2373 ;-----------------------------------------------------------------------------
2374 ; Dive Mode - show apnoe #dive counter
2375 ;
2376 global TFT_apnoe_divecounter
2377 TFT_apnoe_divecounter:
2378 FONT_COLOR_MASK ; select mask color
2379 WIN_TINY dm_apnoe_surface_dive_text_col, dm_apnoe_surface_dive_text_row
2380 STRCPY_TEXT_PRINT tTotalDives ; print label
2381 FONT_COLOR_MEMO ; select memo color
2382 WIN_STD dm_apnoe_surface_divecnt_col, dm_apnoe_surface_divecnt_row
2383 movff apnoe_dive_counter,lo
2384 output_256 ; print #dives (0-255)
2385 PRINT ; dump to screen
2386 return ; done
2296 2387
2297 ;============================================================================= 2388 ;=============================================================================
2298 tft_out8 CODE 2389 tft_out8 CODE
2299 ;============================================================================= 2390 ;=============================================================================
2300 2391
2780 return ; NO - done, nothing to do 2871 return ; NO - done, nothing to do
2781 ; YES - clear safety stop area 2872 ; YES - clear safety stop area
2782 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, dm_safetystop_rgt ; top, bottom, left, right 2873 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, dm_safetystop_rgt ; top, bottom, left, right
2783 bcf safety_stop_active ; - safety stop not shown any more 2874 bcf safety_stop_active ; - safety stop not shown any more
2784 btfss deco_region ; - was the dive within deco stops region? 2875 btfss deco_region ; - was the dive within deco stops region?
2785 return ; NO - done 2876 return
2877 btfsc alt_layout_active ; In alternative layout?
2878 return ; YES - DONE.
2786 ;bra TFT_show_slow_reminder ; YES - show "SLOW" reminder 2879 ;bra TFT_show_slow_reminder ; YES - show "SLOW" reminder
2787 2880
2788 2881
2789 ;----------------------------------------------------------------------------- 2882 ;-----------------------------------------------------------------------------
2790 ; Dive Mode - show "slow" Reminder 2883 ; Dive Mode - show "slow" Reminder
2860 ;----------------------------------------------------------------------------- 2953 ;-----------------------------------------------------------------------------
2861 ; Surface Mode - Message - Desaturation 2954 ; Surface Mode - Message - Desaturation
2862 ; 2955 ;
2863 global TFT_surf_mesg_desat 2956 global TFT_surf_mesg_desat
2864 TFT_surf_mesg_desat: 2957 TFT_surf_mesg_desat:
2958 movlw .11
2959 cpfseq active_customview ; custom view 11 (DSAT/NOFLY/CNS) shown?
2960 bra TFT_surf_mesg_desat1 ; No, continue
2961 return ; Yes. Skip the warning then
2962 TFT_surf_mesg_desat1:
2865 rcall TFT_message_open ; set row and column for the message 2963 rcall TFT_message_open ; set row and column for the message
2866 tstfsz WREG ; is there room for the message? 2964 tstfsz WREG ; is there room for the message?
2867 return ; NO - skip message in this cycle 2965 return ; NO - skip message in this cycle
2868 2966
2967 TFT_surf_mesg_desat2:
2869 FONT_COLOR_MEMO ; select color 2968 FONT_COLOR_MEMO ; select color
2870 STRCPY "Desat:" ; print label 2969 STRCPY "Desat:" ; print label
2871 MOVII int_O_desaturation_time,mpr ; get desaturation time in minutes 2970 MOVII int_O_desaturation_time,mpr ; get desaturation time in minutes
2872 bra TFT_dsat_nofly_common ; continue with common part 2971 bra TFT_dsat_nofly_common ; continue with common part
2873 2972
2875 ;----------------------------------------------------------------------------- 2974 ;-----------------------------------------------------------------------------
2876 ; Surface Mode - Message - No-Fly / NO-Altitude 2975 ; Surface Mode - Message - No-Fly / NO-Altitude
2877 ; 2976 ;
2878 global TFT_surf_mesg_nofly 2977 global TFT_surf_mesg_nofly
2879 TFT_surf_mesg_nofly: 2978 TFT_surf_mesg_nofly:
2979 movlw .11
2980 cpfseq active_customview ; custom view 11 (DSAT/NOFLY/CNS) shown?
2981 bra TFT_surf_mesg_nofly1 ; No, continue
2982 return ; Yes. Skip the warning then
2983 TFT_surf_mesg_nofly1:
2880 rcall TFT_message_open ; set row and column for the message 2984 rcall TFT_message_open ; set row and column for the message
2881 tstfsz WREG ; is there room for the message? 2985 tstfsz WREG ; is there room for the message?
2882 return ; NO - skip message in this cycle 2986 return ; NO - skip message in this cycle
2883 2987
2884 FONT_COLOR_MEMO ; select color 2988 FONT_COLOR_MEMO ; select color
3515 3619
3516 ;============================================================================= 3620 ;=============================================================================
3517 tft_out13 CODE 3621 tft_out13 CODE
3518 ;============================================================================= 3622 ;=============================================================================
3519 3623
3520 3624 ;-----------------------------------------------------------------------------
3625 ; Surface Custom View - DESAT, NoFly, CNS
3626 ;
3627
3628 global TFT_surf_desat_nofly_cns
3629 TFT_surf_desat_nofly_cns:
3630 WIN_SMALL surf_gaslist_column+.10,surf_gaslist_row+.5
3631 call TFT_surf_mesg_desat2
3632 WIN_SMALL surf_gaslist_column+.10,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5
3633 call TFT_nofly_time_fly
3634 WIN_SMALL surf_gaslist_column+.10,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5
3635 bra TFT_surface_tissues_5 ; continue
3636
3637
3521 ;----------------------------------------------------------------------------- 3638 ;-----------------------------------------------------------------------------
3522 ; Surface Custom View - Last Dive Summery 3639 ; Surface Custom View - Last Dive Summery
3523 ; 3640 ;
3524 global TFT_surf_cv_lastdive 3641 global TFT_surf_cv_lastdive
3525 TFT_surf_cv_lastdive: 3642 TFT_surf_cv_lastdive:
3859 btfss tissue_graphic_cns ; shall show CNS value? 3976 btfss tissue_graphic_cns ; shall show CNS value?
3860 return ; NO - done 3977 return ; NO - done
3861 3978
3862 ; draw CNS% in-between tissue bars 3979 ; draw CNS% in-between tissue bars
3863 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row 3980 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row
3981 TFT_surface_tissues_5:
3864 MOVII int_O_CNS_current,mpr ; get current CNS 3982 MOVII int_O_CNS_current,mpr ; get current CNS
3865 call TFT_color_code_cns ; color-code CNS value 3983 call TFT_color_code_cns ; color-code CNS value
3866 STRCPY_TEXT tCNS2 ; "CNS: " 3984 STRCPY_TEXT tCNS2 ; "CNS: "
3867 bsf leftbind ; print left-aligned 3985 bsf leftbind ; print left-aligned
3868 output_999 ; print (0-999) 3986 output_999 ; print (0-999)
5099 TFT_clock_batt_surfpress: 5217 TFT_clock_batt_surfpress:
5100 ; update clock 5218 ; update clock
5101 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row 5219 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row
5102 FONT_COLOR_MEMO ; select color 5220 FONT_COLOR_MEMO ; select color
5103 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time 5221 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time
5222 TSTOSS opt_timeformat ; =1: Use 12h format
5223 bra TFT_clock_batt_surfpress24 ; <>1: Use 24h format
5224 ; 12h Format
5225 movff rtc_latched_hour,lo ; get hours
5226 call TFT_convert_lo_into_12h_format ; converts lo (0-23h) into lo (1-12) and sets aux_flag for PM/AM
5227 output_99 ; print hours (0-99)
5228 movlw ':' ; load a ":"
5229 movff rtc_latched_secs,lo ; get seconds
5230 btfss lo,0 ; on even second?
5231 movlw ' ' ; NO - load a space char
5232 movwf POSTINC2 ; print ":" or space char
5233 movff rtc_latched_mins,lo ; get minutes
5234 output_99x ; print minutes (00-99)
5235 btfsc aux_flag ; =1 for PM
5236 bra TFT_clock_batt_surfpress_PM
5237 STRCAT_PRINT "AM"
5238 bra TFT_clock_batt_surfpress_batt ; done
5239 TFT_clock_batt_surfpress_PM:
5240 STRCAT_PRINT "PM"
5241 bra TFT_clock_batt_surfpress_batt ; done
5242 TFT_clock_batt_surfpress24:
5104 movff rtc_latched_hour,lo ; get hours 5243 movff rtc_latched_hour,lo ; get hours
5105 output_99 ; print hours (0-99) 5244 output_99 ; print hours (0-99)
5106 PUTC ':' ; print ":" 5245 PUTC ':' ; print ":"
5107 movff rtc_latched_mins,lo ; get minutes 5246 movff rtc_latched_mins,lo ; get minutes
5108 output_99x ; print minutes (00-99) 5247 output_99x ; print minutes (00-99)
5109 PUTC ":" ; print ":" 5248 PUTC ":" ; print ":"
5110 movff rtc_latched_secs,lo ; get seconds 5249 movff rtc_latched_secs,lo ; get seconds
5111 output_99x ; print seconds (00-99) 5250 output_99x ; print seconds (00-99)
5112 PRINT ; dump to screen 5251 PRINT ; dump to screen
5113 5252 TFT_clock_batt_surfpress_batt:
5114 ; show battery voltage 5253 ; show battery voltage
5115 WIN_SMALL dm_custom_battery_column, dm_custom_battery_volt_row 5254 WIN_SMALL dm_custom_battery_column, dm_custom_battery_volt_row
5116 ;FONT_COLOR_MEMO ; select color 5255 ;FONT_COLOR_MEMO ; select color
5117 MOVII batt_voltage,mpr ; get voltage 5256 MOVII batt_voltage,mpr ; get voltage
5118 bsf decimal_digit3 ; place a decimal point in front of digit 3 5257 bsf decimal_digit3 ; place a decimal point in front of digit 3