Mercurial > public > hwos_code
comparison src/tft_outputs.asm @ 631:185ba2f91f59
3.09 beta 1 release
author | heinrichsweikamp |
---|---|
date | Fri, 28 Feb 2020 15:45:07 +0100 |
parents | 237931377539 |
children | 690c48db7b5b |
comparison
equal
deleted
inserted
replaced
630:4cd81bdbf15c | 631:185ba2f91f59 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File tft_outputs.asm next combined generation V3.06.2 | 3 ; File tft_outputs.asm next combined generation V3.08.7 |
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, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
27 #include "i2c.inc" | 27 #include "i2c.inc" |
28 #include "colorschemes.inc" | 28 #include "colorschemes.inc" |
29 #include "calibrate.inc" | 29 #include "calibrate.inc" |
30 #include "gaslist.inc" | 30 #include "gaslist.inc" |
31 #include "rx_ops.inc" | 31 #include "rx_ops.inc" |
32 #include "logbook.inc" | |
32 | 33 |
33 | 34 |
34 ;---- external Functions ----------------------------------------------------- | 35 ;---- external Functions ----------------------------------------------------- |
35 | 36 |
36 extern aa_wordprocessor | 37 extern aa_wordprocessor |
38 | 39 |
39 | 40 |
40 ;---- external Texts --------------------------------------------------------- | 41 ;---- external Texts --------------------------------------------------------- |
41 | 42 |
42 extern tFirmware | 43 extern tFirmware |
44 extern tFirmwareDate | |
43 extern tHardware | 45 extern tHardware |
44 extern tSerial | 46 extern tSerial |
45 extern tTotalDives | 47 extern tTotalDives |
46 extern tBatteryV | 48 extern tBatteryV |
49 extern tSensorC | |
50 extern tSensorD | |
47 extern tUptime | 51 extern tUptime |
48 extern tPPO2MIN | 52 extern tPPO2MIN |
49 extern tPPO2Max | 53 extern tPPO2Max |
50 extern tPPO2DECO | 54 extern tPPO2DECO |
51 extern tbar | 55 extern tbar |
78 ; WIN_TINY .100,.30 ; surface mode: fits under the textual logo in the upper right corner | 82 ; WIN_TINY .100,.30 ; surface mode: fits under the textual logo in the upper right corner |
79 ; WIN_TINY .35, .0 ; dive mode: fits to the right side of the depth label | 83 ; WIN_TINY .35, .0 ; dive mode: fits to the right side of the depth label |
80 WIN_TINY .0, .0 ; dive mode: overwrites depth label | 84 WIN_TINY .0, .0 ; dive mode: overwrites depth label |
81 call TFT_standard_color | 85 call TFT_standard_color |
82 lfsr FSR2,buffer | 86 lfsr FSR2,buffer |
87 | |
88 ; print an 16 bit integer as x.yy | |
89 ;MOVII int_O_profiling_overrun,mpr | |
90 ;output_16dp .3 | |
91 ;STRCAT_PRINT "" | |
92 ;return | |
83 | 93 |
84 ; deco engine scheduling performance | 94 ; deco engine scheduling performance |
85 MOVII int_O_profiling_overrun,mpr ; runtime +/- versus target | 95 MOVII int_O_profiling_overrun,mpr ; runtime +/- versus target |
86 btfss mpr+1,7 | 96 btfss mpr+1,7 |
87 bra TFT_debug_output_1 | 97 bra TFT_debug_output_1 |
318 bsf win_invert ; YES - give ascent advice, ... | 328 bsf win_invert ; YES - give ascent advice, ... |
319 bra TFT_advice_color ; - ... and return | 329 bra TFT_advice_color ; - ... and return |
320 | 330 |
321 | 331 |
322 TFT_color_code_depth: | 332 TFT_color_code_depth: |
323 TSTOSS opt_modwarning ; MOD warning switched on? | 333 TSTOSS opt_depth_warn ; depth warning switched on? |
324 bra TFT_color_code_depth_no_mod ; NO | 334 bra TFT_color_code_depth_no_mod ; NO |
325 btfsc depth_limit_exceeded ; YES - deeper than depth limit? | 335 btfsc depth_limit_exceeded ; YES - deeper than depth limit? |
326 bra TFT_color_code_depth_warn ; YES - set to warning color | 336 bra TFT_color_code_depth_warn ; YES - set to warning color |
327 bra TFT_color_code_depth_mod ; NO - check depth against MOD and return... | 337 bra TFT_color_code_depth_mod ; NO - check depth against MOD and return... |
328 TFT_color_code_depth_no_mod: | 338 TFT_color_code_depth_no_mod: |
445 ENDIF ; _ccr_pscr | 455 ENDIF ; _ccr_pscr |
446 | 456 |
447 ;============================================================================= | 457 ;============================================================================= |
448 | 458 |
449 TFT_color_code_battery: ; color-code the battery display, with battery percent in lo | 459 TFT_color_code_battery: ; color-code the battery display, with battery percent in lo |
450 movlw battery_warn_level_36+1 ; get threshold for 3.6 Volt battery warning, incremented by 1 | 460 btfsc battery_low_condition ; battery low condition detected? |
451 btfss battery_is_36v ; actually a 3.6 Volt battery detected? | |
452 movlw battery_warn_level_15+1 ; NO - replace with 1.5 Volt battery warning, incremented by 1 | |
453 cpfsgt batt_percent ; is battery percent < threshold? | |
454 bra TFT_warning_color ; YES - set to warning color and return | 461 bra TFT_warning_color ; YES - set to warning color and return |
455 bra TFT_memo_color ; NO - set to memo color and return | 462 bra TFT_memo_color ; NO - set to memo color and return |
456 | 463 |
457 | 464 |
458 global TFT_color_code_gas | 465 global TFT_color_code_gas |
567 MOVLI .5172,mpr | 574 MOVLI .5172,mpr |
568 PUTC "." | 575 PUTC "." |
569 movlw d'4' | 576 movlw d'4' |
570 movwf ignore_digits | 577 movwf ignore_digits |
571 bsf ignore_digit5 ; (flag will be cleared by output_16) | 578 bsf ignore_digit5 ; (flag will be cleared by output_16) |
572 output_16dp d'0' ; .1m in SMALL font | 579 output_16dp d'0' ; .1m in SMALL font |
573 STRCAT_PRINT "" ; display decimeters | 580 STRCAT_PRINT "" ; display decimeters |
574 | 581 |
575 ; Max. Depth demo | 582 ; Max. Depth demo |
576 WIN_MEDIUM .64,.54 | 583 WIN_MEDIUM .64,.54 |
577 bsf ignore_digit4 ; no 0.1m | 584 bsf ignore_digit4 ; no 0.1 m |
578 bsf leftbind | 585 bsf leftbind |
579 MOVLI .6349,mpr | 586 MOVLI .6349,mpr |
580 output_16 | 587 output_16 |
581 STRCAT_PRINT "" ; display full meters | 588 STRCAT_PRINT "" ; display full meters |
582 bcf leftbind | 589 bcf leftbind |
586 movlw d'4' | 593 movlw d'4' |
587 movwf ignore_digits | 594 movwf ignore_digits |
588 bsf ignore_digit5 ; (flag will be cleared by output_16) | 595 bsf ignore_digit5 ; (flag will be cleared by output_16) |
589 bsf leftbind | 596 bsf leftbind |
590 MOVLI .6349,mpr | 597 MOVLI .6349,mpr |
591 output_16dp d'0' | 598 output_16dp d'0' |
592 STRCAT_PRINT "" ; display decimeters | 599 STRCAT_PRINT "" ; display decimeters |
593 bcf leftbind | 600 bcf leftbind |
594 | 601 |
595 ; Divetime demo | 602 ; Divetime demo |
596 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | 603 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time |
697 DB .200,.20,.15,.0 | 704 DB .200,.20,.15,.0 |
698 | 705 |
699 TFT_velocity_set_color: ; set color based on speed table or use static thresholds, with divA+0 = m/min | 706 TFT_velocity_set_color: ; set color based on speed table or use static thresholds, with divA+0 = m/min |
700 bsf aux_flag ; for alternative layout: default is to show numerical VSI | 707 bsf aux_flag ; for alternative layout: default is to show numerical VSI |
701 ; check if old/new ascend logic is used | 708 ; check if old/new ascend logic is used |
702 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic | 709 TSTOSS opt_vsitext ; 0=standard, 1=dynamic |
703 bra TFT_velocity_set_color_static ; static ascend rate limit | 710 bra TFT_velocity_set_color_static ; static ascend rate limit |
704 | 711 |
705 ; point to speed table | 712 ; point to speed table |
706 movlw LOW (TFT_speed_table-.3) | 713 movlw LOW (TFT_speed_table-.3) |
707 movwf TBLPTRL | 714 movwf TBLPTRL |
755 | 762 |
756 TFT_velocity_num_imperial: | 763 TFT_velocity_num_imperial: |
757 movff divA+0,WREG ; divA+0 = m/min | 764 movff divA+0,WREG ; divA+0 = m/min |
758 mullw .100 ; PROD = mbar/min | 765 mullw .100 ; PROD = mbar/min |
759 MOVII PRODL,mpr ; copy to hi:lo | 766 MOVII PRODL,mpr ; copy to hi:lo |
760 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 767 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
761 tstfsz hi ; > 255 ? | 768 tstfsz hi ; > 255 ? |
762 setf lo ; YES - set lo to 255 | 769 setf lo ; YES - set lo to 255 |
763 movlw '-' ; load coding for minus sign | 770 movlw '-' ; load coding for minus sign |
764 btfsc neg_flag_velocity ; ascending? | 771 btfsc neg_flag_velocity ; ascending? |
765 movlw '+' ; YES - replace with coding for plus sign | 772 movlw '+' ; YES - replace with coding for plus sign |
988 return ; YES - abort | 995 return ; YES - abort |
989 call TFT_memo_color ; NO - default to memo color | 996 call TFT_memo_color ; NO - default to memo color |
990 MOVII int_O_TTS_norm,mpr ; - get the TTS | 997 MOVII int_O_TTS_norm,mpr ; - get the TTS |
991 btfsc hi,int_invalid_flag ; - is the invalid flag set? | 998 btfsc hi,int_invalid_flag ; - is the invalid flag set? |
992 call TFT_disabled_color ; YES - use disabled color | 999 call TFT_disabled_color ; YES - use disabled color |
993 bcf hi,int_invalid_flag ; - eventually clear the invalid flag | 1000 bcf hi,int_invalid_flag ; - clear the invalid flag if applicable |
994 btfss alt_layout_active ; - in alternative layout? | 1001 btfss alt_layout_active ; - in alternative layout? |
995 bra TFT_display_tts_999x ; NO | 1002 bra TFT_display_tts_999x ; NO |
996 MOVII mpr, sub_a ; YES - copy TTS to sub_a | 1003 MOVII mpr, sub_a ; YES - copy TTS to sub_a |
997 MOVLI .100,sub_b ; - load 100 into sub_b | 1004 MOVLI .100,sub_b ; - load 100 into sub_b |
998 call cmpU16 ; - sub_a - sub_b = TTS - 100 | 1005 call cmpU16 ; - sub_a - sub_b = TTS - 100 |
1034 | 1041 |
1035 global TFT_show_ndl | 1042 global TFT_show_ndl |
1036 TFT_show_ndl: | 1043 TFT_show_ndl: |
1037 btfsc dive_main_menu ; is the dive mode menu shown? | 1044 btfsc dive_main_menu ; is the dive mode menu shown? |
1038 return ; YES - abort | 1045 return ; YES - abort |
1039 movff char_O_NDL_norm,lo ; NO - get NDL time in normal plan | 1046 call TFT_memo_color ; NO - set color |
1047 movff int_O_NDL_norm+1,lo ; - get high byte of NDL time in normal plan | |
1048 btfsc lo,int_invalid_flag ; - is the invalid flag set? | |
1049 call TFT_disabled_color ; YES - switch to disabled color | |
1050 movff int_O_NDL_norm+0,lo ; - get low byte of NDL time in normal plan | |
1040 btfsc deco_locked ; - was the dive in deco? | 1051 btfsc deco_locked ; - was the dive in deco? |
1041 bra TFT_show_ndl_norm ; YES - use normal layout | 1052 bra TFT_show_ndl_norm ; YES - use normal layout |
1042 btfsc alt_layout_active ; NO - alternative layout active? | 1053 btfsc alt_layout_active ; NO - alternative layout active? |
1043 bra TFT_show_ndl_alt ; YES - use alternative layout | 1054 bra TFT_show_ndl_alt ; YES - use alternative layout |
1044 ;bra TFT_show_ndl_norm ; NO - use normal layout | 1055 ;bra TFT_show_ndl_norm ; NO - use normal layout |
1045 | 1056 |
1046 TFT_show_ndl_norm: ; set position | 1057 TFT_show_ndl_norm: ; set position |
1047 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm | 1058 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm |
1048 call TFT_memo_color ; set color | |
1049 output_8 ; display 0...240 | 1059 output_8 ; display 0...240 |
1050 TFT_show_ndl_exit_1: | 1060 TFT_show_ndl_exit_1: |
1051 STRCAT_PRINT "'" ; print minutes symbol | 1061 STRCAT_PRINT "'" ; print minutes symbol |
1052 TFT_show_ndl_exit_2: | 1062 TFT_show_ndl_exit_2: |
1053 goto TFT_standard_color ; done | 1063 goto TFT_standard_color ; done |
1056 btfsc safety_stop_active ; is the safety stop active? | 1066 btfsc safety_stop_active ; is the safety stop active? |
1057 bra TFT_show_ndl_alt_safety ; YES | 1067 bra TFT_show_ndl_alt_safety ; YES |
1058 ; clear potential remains from NDL normal and set position | 1068 ; clear potential remains from NDL normal and set position |
1059 WIN_BOX_BLACK dm_ndl_value_row_norm, dm_3rdrow_bot, dm_ndl_value_col_norm, dm_ndl_value_col_alt ; top, bottom, left, right | 1069 WIN_BOX_BLACK dm_ndl_value_row_norm, dm_3rdrow_bot, dm_ndl_value_col_norm, dm_ndl_value_col_alt ; top, bottom, left, right |
1060 WIN_LARGE dm_ndl_value_col_alt, dm_ndl_value_row_alt | 1070 WIN_LARGE dm_ndl_value_col_alt, dm_ndl_value_row_alt |
1061 call TFT_memo_color ; set color | |
1062 output_99 ; display 0...99 | 1071 output_99 ; display 0...99 |
1063 STRCAT_PRINT "" ; finalize output | 1072 STRCAT_PRINT "" ; finalize output |
1064 bra TFT_show_ndl_exit_2 ; done | 1073 bra TFT_show_ndl_exit_2 ; done |
1065 | 1074 |
1066 TFT_show_ndl_alt_safety: | 1075 TFT_show_ndl_alt_safety: |
1067 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm | 1076 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm |
1068 call TFT_memo_color ; set color | |
1069 PUTC " " ; fill first digit position | 1077 PUTC " " ; fill first digit position |
1070 output_99 ; display 0...99 | 1078 output_99 ; display 0...99 |
1071 bra TFT_show_ndl_exit_1 ; print minutes symbol and done | 1079 bra TFT_show_ndl_exit_1 ; print minutes symbol and done |
1072 | 1080 |
1073 | 1081 |
1087 return ; YES - abort | 1095 return ; YES - abort |
1088 btfsc sign_shown ; NO - sign already shown? | 1096 btfsc sign_shown ; NO - sign already shown? |
1089 bra TFT_divemode_sign_show_alt_1; YES - no need to clear area again | 1097 bra TFT_divemode_sign_show_alt_1; YES - no need to clear area again |
1090 btfsc bailout_mode ; NO - in bailout? | 1098 btfsc bailout_mode ; NO - in bailout? |
1091 bra TFT_divemode_sign_show_alt_1; YES - no need to clear the area | 1099 bra TFT_divemode_sign_show_alt_1; YES - no need to clear the area |
1092 ; NO - eventually clear area from "bar" label and loop mode | 1100 ; NO - clear area from "bar" label and loop mode if applicable |
1093 WIN_BOX_BLACK dm_active_dil_row, dm_3rdrow_bot, dm_active_sp_label_col, dm_sign_rgt_alt ; top, bottom, left, right | 1101 WIN_BOX_BLACK dm_active_dil_row, dm_3rdrow_bot, dm_active_sp_label_col, dm_sign_rgt_alt ; top, bottom, left, right |
1094 TFT_divemode_sign_show_alt_1: | 1102 TFT_divemode_sign_show_alt_1: |
1095 WIN_TOP dm_sign_row_alt ; - set row position | 1103 WIN_TOP dm_sign_row_alt ; - set row position |
1096 WIN_LEFT dm_sign_col_alt ; - set column position | 1104 WIN_LEFT dm_sign_col_alt ; - set column position |
1097 ;bra TFT_divemode_sign_show_com ; - continue with common part | 1105 ;bra TFT_divemode_sign_show_com ; - continue with common part |
1386 bra TFT_display_exit_1 | 1394 bra TFT_display_exit_1 |
1387 | 1395 |
1388 ENDIF | 1396 ENDIF |
1389 | 1397 |
1390 | 1398 |
1391 global TFT_avr_stopwatch ; data for average depth and stopwatch | 1399 global TFT_avr_stopwatch ; dive mode custom view: average depth and stopwatch |
1392 TFT_avr_stopwatch: | 1400 TFT_avr_stopwatch: |
1393 call TFT_memo_color | 1401 call TFT_memo_color |
1394 bsf leftbind | |
1395 | 1402 |
1396 IFNDEF _min_depth_option | 1403 IFNDEF _min_depth_option |
1397 | 1404 |
1398 ; total average depth or max depth | 1405 ; total average depth or max depth |
1399 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | 1406 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row |
1402 bra TFT_avr_stopwatch_1 ; NO - draw avg depth in custom view then | 1409 bra TFT_avr_stopwatch_1 ; NO - draw avg depth in custom view then |
1403 btfss alt_layout_active ; YES - in alternative layout? | 1410 btfss alt_layout_active ; YES - in alternative layout? |
1404 bra TFT_avr_stopwatch_max ; NO - show max depth | 1411 bra TFT_avr_stopwatch_max ; NO - show max depth |
1405 ;bra TFT_avr_stopwatch_avg ; YES - show avg depth | 1412 ;bra TFT_avr_stopwatch_avg ; YES - show avg depth |
1406 TFT_avr_stopwatch_avg: | 1413 TFT_avr_stopwatch_avg: |
1407 MOVII pressure_rel_avg_total,mpr ; get total dive average depth into hi:lo | 1414 MOVII pressure_rel_avg_total,mpr ; get total dive average pressure into hi:lo |
1408 bra TFT_avr_stopwatch_2 ; continue | 1415 bra TFT_avr_stopwatch_2 ; continue |
1409 TFT_avr_stopwatch_1: | 1416 TFT_avr_stopwatch_1: |
1410 btfss alt_layout_active ; YES - in alternative layout? | 1417 btfss alt_layout_active ; YES - in alternative layout? |
1411 bra TFT_avr_stopwatch_avg ; NO - show avg depth | 1418 bra TFT_avr_stopwatch_avg ; NO - show avg depth |
1412 ;bra TFT_avr_stopwatch_max ; YES - show max depth | 1419 ;bra TFT_avr_stopwatch_max ; YES - show max depth |
1413 TFT_avr_stopwatch_max: | 1420 TFT_avr_stopwatch_max: |
1414 MOVII pressure_rel_max_cached,mpr ; get maximum depth into hi:lo | 1421 MOVII pressure_rel_max_cached,mpr ; get maximum pressure into hi:lo |
1415 ;bra TFT_avr_stopwatch_2 ; continue | 1422 ;bra TFT_avr_stopwatch_2 ; continue |
1416 TFT_avr_stopwatch_2: | 1423 TFT_avr_stopwatch_2: |
1417 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 1424 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
1418 TSTOSS opt_units ; 0=m, 1=ft | 1425 TSTOSS opt_units ; 0=m, 1=ft |
1419 bra TFT_update_avr_stopwatch1_metric ; 0 - metric | 1426 bra TFT_update_avr_stopwatch1_metric ; 0 - metric |
1420 TFT_update_avr_stopwatch1_imp: ; 1 - imperial | 1427 TFT_update_avr_stopwatch1_imp: ; 1 - imperial |
1421 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 1428 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
1422 output_16 ; yxz | 1429 output_16_3 ; yxz |
1423 STRCAT " " ; wipe out remains from last output | |
1424 clrf WREG | |
1425 movff WREG,buffer+.3 ; limit string length to 3 digits | |
1426 bra TFT_update_avr_stopwatch2 | 1430 bra TFT_update_avr_stopwatch2 |
1427 TFT_update_avr_stopwatch1_metric: | 1431 TFT_update_avr_stopwatch1_metric: |
1432 bsf leftbind | |
1428 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) | 1433 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) |
1429 output_16dp .3 ; yxz.a | 1434 output_16dp .3 ; yxz.a |
1430 PUTC " " ; wipe out remains from last output | 1435 PUTC " " ; wipe out remains from last output |
1431 clrf WREG | 1436 clrf WREG |
1432 movff WREG,buffer+.4 ; limit string length to 4 = 3 digits + 1 half-size decimal dot | 1437 movff WREG,buffer+.4 ; limit string length to 4 = 3 digits + 1 half-size decimal dot |
1433 TFT_update_avr_stopwatch2: | 1438 TFT_update_avr_stopwatch2: |
1434 STRCAT_PRINT "" | 1439 STRCAT_PRINT "" |
1435 | 1440 |
1436 ; stopped average depth | 1441 ; stopped average depth |
1437 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row | 1442 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row |
1438 MOVII pressure_rel_avg_trip,mpr ; get the resettable average depth | 1443 MOVII pressure_rel_avg_trip,mpr ; get the resettable average pressure |
1439 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 1444 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
1440 TSTOSS opt_units ; 0=m, 1=ft | 1445 TSTOSS opt_units ; 0=m, 1=ft |
1441 bra TFT_update_avr_stopwatch2_metric ; 0 - metric | 1446 bra TFT_update_avr_stopwatch2_metric ; 0 - metric |
1442 TFT_update_avr_stopwatch2_imp: ; 1 - imperial | 1447 TFT_update_avr_stopwatch2_imp: ; 1 - imperial |
1443 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 1448 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
1444 output_16 ; yxz | 1449 output_16_3 ; yxz |
1445 STRCAT " " ; wipe out remains from last output | |
1446 clrf WREG | |
1447 movff WREG,buffer+.3 ; limit string length to 3 digits/characters | |
1448 bra TFT_update_avr_stopwatch3 | 1450 bra TFT_update_avr_stopwatch3 |
1449 TFT_update_avr_stopwatch2_metric: | 1451 TFT_update_avr_stopwatch2_metric: |
1452 bsf leftbind | |
1450 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) | 1453 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) |
1451 output_16dp .3 ; yxz.a | 1454 output_16dp .3 ; yxz.a |
1452 PUTC " " ; wipe out remains from last output | 1455 PUTC " " ; wipe out remains from last output |
1453 clrf WREG | 1456 clrf WREG |
1454 movff WREG,buffer+.4 ; limit string length to 4 = 3 digits + 1 half-size decimal dot | 1457 movff WREG,buffer+.4 ; limit string length to 4 = 3 digits + 1 half-size decimal dot |
1458 ELSE | 1461 ELSE |
1459 | 1462 |
1460 ; resettable maximum depth - needs ISR-safe copy! | 1463 ; resettable maximum depth - needs ISR-safe copy! |
1461 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row ; column 0 | 1464 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row ; column 0 |
1462 call TFT_memo_color | 1465 call TFT_memo_color |
1463 SMOVII pressure_rel_max_trip,mpr | 1466 SMOVII pressure_rel_max_trip,mpr ; get resettable maximum pressure |
1464 rcall TFT_avr_stopwatch_helper | 1467 rcall TFT_avr_stopwatch_helper |
1465 | 1468 |
1466 ; resettable average depth | 1469 ; resettable average depth |
1467 WIN_MEDIUM dm_custom_avr_stop_column2-.1,dm_custom_avr_stop_row ; column 54 - 1 = 53 | 1470 WIN_MEDIUM dm_custom_avr_stop_column2-.1,dm_custom_avr_stop_row ; column 54 - 1 = 53 |
1468 call TFT_attention_color | 1471 call TFT_attention_color |
1469 MOVII pressure_rel_avg_trip,mpr | 1472 MOVII pressure_rel_avg_trip,mpr ; get resettable average pressure |
1470 rcall TFT_avr_stopwatch_helper | 1473 rcall TFT_avr_stopwatch_helper |
1471 | 1474 |
1472 ; resettable minimum depth - needs ISR safe copy! | 1475 ; resettable minimum depth - needs ISR safe copy! |
1473 WIN_MEDIUM dm_custom_avr_stop_column3-.12,dm_custom_avr_stop_row ; column 118 - 12 = 106 | 1476 WIN_MEDIUM dm_custom_avr_stop_column3-.12,dm_custom_avr_stop_row ; column 118 - 12 = 106 |
1474 call TFT_memo_color | 1477 call TFT_memo_color |
1475 SMOVII pressure_rel_min_trip,mpr | 1478 SMOVII pressure_rel_min_trip,mpr ; get resettable minimum pressure |
1476 rcall TFT_avr_stopwatch_helper | 1479 rcall TFT_avr_stopwatch_helper |
1477 | 1480 |
1478 ; done | 1481 ; done |
1479 bra TFT_display_exit_2 | 1482 bra TFT_display_exit_2 |
1480 | 1483 |
1481 TFT_avr_stopwatch_helper: | 1484 TFT_avr_stopwatch_helper: |
1482 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 1485 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
1483 output_16dp .3 ; yxz.ab | 1486 output_16dp .3 ; yxz.ab |
1484 PUTC " " ; wipe out remains from last output | 1487 PUTC " " ; wipe out remains from last output |
1485 clrf WREG | 1488 clrf WREG |
1486 movff WREG,buffer+.5 ; limit string length to 5 = 4 digits + 1 half-size decimal dot | 1489 movff WREG,buffer+.5 ; limit string length to 5 = 4 digits + 1 half-size decimal dot |
1487 STRCAT_PRINT "" | 1490 STRCAT_PRINT "" |
1513 movlw .5 | 1516 movlw .5 |
1514 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 1517 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
1515 clrf WREG | 1518 clrf WREG |
1516 movff WREG,buffer+.5 ; limit to 5 chars | 1519 movff WREG,buffer+.5 ; limit to 5 chars |
1517 STRCAT_PRINT "" | 1520 STRCAT_PRINT "" |
1518 bra TFT_display_exit_2 | 1521 bra TFT_display_exit_2 ; clear leftbind and return |
1519 TFT_update_stopwatch_2: | 1522 TFT_update_stopwatch_2: |
1520 movff hi,lo ; transfer minutes (low byte) to lo | 1523 movff hi,lo ; transfer minutes (low byte) to lo |
1521 movff up,hi ; transfer minutes (high byte) to hi | 1524 movff up,hi ; transfer minutes (high byte) to hi |
1522 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | 1525 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) |
1523 bsf aux_flag ; will print hours : minutes | 1526 bsf aux_flag ; will print hours : minutes |
1528 TFT_CNS_mask: | 1531 TFT_CNS_mask: |
1529 call TFT_divemask_color | 1532 call TFT_divemask_color |
1530 WIN_TINY dm_custom_cns3_column1, dm_custom_cns3_title_row | 1533 WIN_TINY dm_custom_cns3_column1, dm_custom_cns3_title_row |
1531 STRCPY_TEXT_PRINT tCNSsurf | 1534 STRCPY_TEXT_PRINT tCNSsurf |
1532 WIN_TINY dm_custom_cns3_column2, dm_custom_cns3_title_row | 1535 WIN_TINY dm_custom_cns3_column2, dm_custom_cns3_title_row |
1536 | |
1537 IFDEF _cave_mode | |
1538 btfss cave_mode ; cave mode switched on? | |
1539 bra TFT_CNS_mask_1 ; NO | |
1540 STRCPY_TEXT_PRINT tCNScave ; YES - print cave TTS label | |
1541 bra TFT_CNS_mask_3 ; - continue with 3rd column | |
1542 ENDIF | |
1543 | |
1544 TFT_CNS_mask_1: | |
1533 btfsc FLAG_oc_mode ; in OC mode? | 1545 btfsc FLAG_oc_mode ; in OC mode? |
1534 bra TFT_CNS_mask_1 ; YES - print fTTS label | 1546 bra TFT_CNS_mask_2 ; YES - print fTTS label |
1535 btfsc bailout_mode ; in bailout? | 1547 btfsc bailout_mode ; in bailout? |
1536 bra TFT_CNS_mask_1 ; YES - print fTTS label (label will be printed, but a fTTS will actually not be calculated) | 1548 bra TFT_CNS_mask_2 ; YES - print fTTS label (label will be printed, but a fTTS will actually not be calculated) |
1537 TSTOSS opt_calc_asc_gasvolume ; bailout volume calculation requested? | 1549 TSTOSS opt_calc_gasvolume ; bailout volume calculation requested? |
1538 bra TFT_CNS_mask_1 ; NO - print fTTS label | 1550 bra TFT_CNS_mask_2 ; NO - print fTTS label |
1539 STRCPY_TEXT_PRINT tCNSBO ; YES - print bailout label | 1551 STRCPY_TEXT_PRINT tCNSBO ; YES - print bailout label |
1540 bra TFT_CNS_mask_2 | 1552 bra TFT_CNS_mask_3 ; - continue with 3rd column |
1541 TFT_CNS_mask_1: ; OC or bailout | 1553 TFT_CNS_mask_2: ; OC or bailout |
1542 STRCPY_TEXT_PRINT tCNSfTTS ; print fTTS label | 1554 STRCPY_TEXT_PRINT tCNSfTTS ; print fTTS label |
1543 TFT_CNS_mask_2: | 1555 TFT_CNS_mask_3: |
1544 WIN_TINY dm_custom_cns3_column3, dm_custom_cns3_title_row | 1556 WIN_TINY dm_custom_cns3_column3, dm_custom_cns3_title_row |
1545 STRCPY_TEXT_PRINT tCNSnow | 1557 STRCPY_TEXT_PRINT tCNSnow ; print CNS now label |
1546 bra TFT_display_exit_2 | 1558 bra TFT_display_exit_2 |
1547 | 1559 |
1548 | 1560 |
1549 global TFT_CNS | 1561 global TFT_CNS |
1550 TFT_CNS: | 1562 TFT_CNS: |
1557 STRCAT_PRINT "% " | 1569 STRCAT_PRINT "% " |
1558 ; fTTS / Bailout CNS, if enabled | 1570 ; fTTS / Bailout CNS, if enabled |
1559 WIN_STD dm_custom_cns3_column2+.2,dm_custom_cns3_row | 1571 WIN_STD dm_custom_cns3_column2+.2,dm_custom_cns3_row |
1560 btfsc bailout_mode ; in bailout? | 1572 btfsc bailout_mode ; in bailout? |
1561 bra TFT_CNS_3 ; YES - show "---" | 1573 bra TFT_CNS_3 ; YES - show "---" |
1562 TSTOSS opt_calc_asc_gasvolume ; NO - bailout volume calculation requested? | 1574 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? |
1563 bra TFT_CNS_1 ; NO - continue checking fTTS extra time | 1575 bra TFT_CNS_1 ; NO - continue checking fTTS extra time |
1564 btfss FLAG_oc_mode ; YES - in OC mode? | 1576 btfss FLAG_oc_mode ; YES - in OC mode? |
1565 bra TFT_CNS_2 ; NO - show CNS% | 1577 bra TFT_CNS_2 ; NO - show CNS% |
1566 TFT_CNS_1: ; not in bailout, no volume calculation, and/or in OC mode | 1578 TFT_CNS_1: ; not in bailout, no volume calculation, and/or in OC mode |
1567 TSTOSS char_I_extra_time ; fTTS extra time configured? | 1579 TSTOSS char_I_extra_time ; fTTS extra time configured? |
1571 call TFT_color_code_cns ; color-code the CNS value | 1583 call TFT_color_code_cns ; color-code the CNS value |
1572 output_16_3 ; output as xxx | 1584 output_16_3 ; output as xxx |
1573 STRCAT_PRINT "% " | 1585 STRCAT_PRINT "% " |
1574 bra TFT_CNS_4 | 1586 bra TFT_CNS_4 |
1575 TFT_CNS_3: | 1587 TFT_CNS_3: |
1588 IFDEF _cave_mode | |
1589 btfss cave_mode ; cave mode switched on? | |
1590 bra TFT_CNS_3a ; NO - show dashes | |
1591 btfsc backtrack_entire_full ; YES - cave mode shut down due to storage fully used up? | |
1592 bra TFT_CNS_3a ; YES - show dashes | |
1593 btfss dive_turned ; NO - dive turned? | |
1594 bra TFT_CNS_2 ; NO - show cave CNS | |
1595 ;bra TFT_CNS_3a ; YES - show dashes | |
1596 ENDIF | |
1597 TFT_CNS_3a: | |
1576 call TFT_memo_color | 1598 call TFT_memo_color |
1577 STRCPY_PRINT "--- " | 1599 STRCPY_PRINT "--- " |
1578 TFT_CNS_4: | 1600 TFT_CNS_4: |
1579 ; current CNS | 1601 ; current CNS |
1580 WIN_STD dm_custom_cns3_column3+.3,dm_custom_cns3_row | 1602 WIN_STD dm_custom_cns3_column3+.3,dm_custom_cns3_row |
1584 STRCAT_PRINT "%" | 1606 STRCAT_PRINT "%" |
1585 TFT_display_exit_2: | 1607 TFT_display_exit_2: |
1586 bcf leftbind | 1608 bcf leftbind |
1587 goto TFT_standard_color ; and return... | 1609 goto TFT_standard_color ; and return... |
1588 | 1610 |
1611 ;============================================================================= | |
1612 | |
1613 IFDEF _cave_mode | |
1614 | |
1615 global TFT_cave_tts_mask ; mask for cave mode data | |
1616 TFT_cave_tts_mask: | |
1617 call TFT_divemask_color | |
1618 WIN_TINY dm_custom_cave_title_column1,dm_custom_cave_title_row | |
1619 STRCPY_TEXT_PRINT tCaveStops | |
1620 WIN_TINY dm_custom_cave_title_column2,dm_custom_cave_title_row | |
1621 STRCPY_TEXT_PRINT tCaveTTS | |
1622 WIN_TINY dm_custom_cave_title_column3,dm_custom_cave_title_row | |
1623 STRCPY_TEXT_PRINT tCaveRuntime | |
1624 bra TFT_display_exit_2 | |
1625 | |
1626 | |
1627 global TFT_cave_tts ; dive mode custom view: cave TTS | |
1628 TFT_cave_tts: | |
1629 ; total time of all stops | |
1630 WIN_MEDIUM dm_custom_cave_data_column1,dm_custom_cave_data_row ; column 8 | |
1631 call TFT_memo_color ; set default color | |
1632 btfss cave_mode ; cave mode switched on? | |
1633 bra TFT_cave_1b ; NO - print dashes | |
1634 MOVII int_O_TST_norm,mpr ; YES - get normal plan total stops time | |
1635 btfss mpr+1,int_not_yet_computed ; - not yet computed? | |
1636 bra TFT_cave_1a ; NO - continue | |
1637 call TFT_disabled_color ; YES - switch to disabled color | |
1638 bra TFT_cave_1b ; - print dashes | |
1639 TFT_cave_1a: | |
1640 btfsc mpr+1,int_invalid_flag ; stops time invalid? | |
1641 call TFT_disabled_color ; YES - switch to disabled color | |
1642 bcf mpr+1,int_invalid_flag ; clear invalid flag if applicable | |
1643 movf mpr+0,W ; copy low byte of stops time to WREG | |
1644 iorwf mpr+1,W ; ior with high byte of stops time | |
1645 bz TFT_cave_1b ; print dashes if stops time is zero | |
1646 output_16_3 ; output as xxx | |
1647 STRCAT_PRINT "'" ; print minutes symbol | |
1648 bra TFT_cave_2 ; continue | |
1649 TFT_cave_1b: | |
1650 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
1651 TFT_cave_2: | |
1652 ; cave TTS | |
1653 WIN_MEDIUM dm_custom_cave_data_column2,dm_custom_cave_data_row ; column 60 | |
1654 call TFT_memo_color ; set default color | |
1655 btfsS cave_mode ; cave mode switched on? | |
1656 bra TFT_cave_2b ; NO - print dashes | |
1657 MOVII int_O_TTS_norm,mpr ; YES - get normal plan total time to surface | |
1658 btfss mpr+1,int_not_yet_computed ; - not yet computed? | |
1659 bra TFT_cave_2a ; NO - continue | |
1660 call TFT_disabled_color ; YES - switch to disabled color | |
1661 bra TFT_cave_2b ; - print dashes | |
1662 TFT_cave_2a: | |
1663 btfsc mpr+1,int_invalid_flag ; TTS invalid? | |
1664 call TFT_disabled_color ; YES - switch to disabled color | |
1665 bcf mpr+1,int_invalid_flag ; clear invalid flag if applicable | |
1666 output_16_3 ; output as xxx | |
1667 STRCAT_PRINT "'" ; print minutes symbol | |
1668 bra TFT_cave_3 ; continue | |
1669 TFT_cave_2b: | |
1670 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
1671 TFT_cave_3: | |
1672 ; estimated total runtime | |
1673 WIN_MEDIUM dm_custom_cave_data_column3,dm_custom_cave_data_row ; column 114 | |
1674 ; ; keep color from cave TTS | |
1675 btfss cave_mode ; cave mode switched on? | |
1676 bra TFT_cave_3b ; NO - print dashes | |
1677 SMOVII counted_divetime_mins,mpr ; YES - ISR safe copy of counted dive time to MPR | |
1678 movff int_O_TTS_norm+0,WREG ; - get TTS, low byte, into WREG | |
1679 addwf mpr+0,F ; - add TTS, low byte, to dive time in MPR | |
1680 movff int_O_TTS_norm+1,WREG ; - get TTS, high byte, into WREG | |
1681 btfsc WREG,int_not_yet_computed ; - not yet computed? | |
1682 bra TFT_cave_3b ; YES - print dashes | |
1683 bcf WREG,int_invalid_flag ; NO - clear invalid flag if applicable | |
1684 addwfc mpr+1,F ; - add TTS, high byte, to dive time in MPR | |
1685 output_16_3 ; - output as xxx | |
1686 STRCAT_PRINT "'" ; - print minutes symbol | |
1687 bra TFT_display_exit_2 ; - done | |
1688 TFT_cave_3b: | |
1689 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
1690 bra TFT_display_exit_2 ; done | |
1691 | |
1692 | |
1693 global TFT_cave_waypoints | |
1694 TFT_cave_waypoints: | |
1695 ; title row | |
1696 WIN_TINY .70,dm_custom_cave_title_row;adjust column to display position of current waypoint | |
1697 call TFT_divemask_color ; select color | |
1698 btfss cave_mode ; cave mode switched on? | |
1699 bra TFT_cave_waypoints_3 ; NO - do not show any marker (any more) | |
1700 btfss dive_turned ; YES - dive turned? | |
1701 bra TFT_cave_waypoints_1 ; NO - print marker on right side | |
1702 bra TFT_cave_waypoints_2 ; YES - print marker in the middle | |
1703 TFT_cave_waypoints_1: | |
1704 movlw .12 ; start with 12 space chars | |
1705 call TFT_fillup_with_spaces ; fill buffer with space chars | |
1706 TFT_cave_waypoints_2: | |
1707 STRCAT "<=====" ; print marker symbol | |
1708 TFT_cave_waypoints_3: | |
1709 movlw .18 ; set overall number of chars | |
1710 call TFT_fillup_with_spaces ; fill buffer with space chars | |
1711 STRCAT_PRINT "" ; finalize output | |
1712 ; data row | |
1713 btfsc cave_mode ; cave mode switched on? | |
1714 bra TFT_cave_waypoints_4 ; YES - show graphics | |
1715 WIN_STD .0,dm_custom_cave_data_row ; NO - show "Cave Mode off" text | |
1716 call TFT_attention_color ; - select attention color | |
1717 STRCPY " " ; - print 2 space chars | |
1718 STRCAT_TEXT tCaveMode ; - print "Cave Mode" | |
1719 PUTC " " ; - print a space char | |
1720 STRCAT_TEXT tOff ; - print "off" | |
1721 movlw .17 ; - set max number of chars | |
1722 call TFT_fillup_with_spaces ; - fill up FSR2 with spaces (total string length in #WREG) | |
1723 STRCAT_PRINT "" ; - finalize output | |
1724 return ; - done | |
1725 TFT_cave_waypoints_4: | |
1726 WIN_MEDIUM .0,dm_custom_cave_data_row; start in column 0 | |
1727 call TFT_memo_color ; select default color | |
1728 tstfsz DM_flags_cavereq ; any pending cave mode requests? | |
1729 call TFT_disabled_color ; YES - switch to disabled color | |
1730 ; 1st section: previous waypoint number or beginning line | |
1731 movlw .1 ; load a one into WREG | |
1732 cpfsgt backtrack_waypoint_num ; current waypoint number > 1 ? | |
1733 bra TFT_cave_waypoints_5 ; NO - print line segment only | |
1734 STRCAT ",-," ; YES - print one dash | |
1735 movff backtrack_waypoint_num,lo ; - copy current waypoint number to lo | |
1736 decf lo,F ; - create previous waypoint number | |
1737 output_99 ; - print previous waypoint number in two digit format | |
1738 STRCAT "," ; - print a half-space | |
1739 bra TFT_cave_waypoints_6 ; - continue with next section | |
1740 TFT_cave_waypoints_5: | |
1741 STRCAT ",-,-----" ; print line segment | |
1742 TFT_cave_waypoints_6: | |
1743 ; 2nd section: solid line | |
1744 STRCAT "---" ; print a solid line | |
1745 ; 3rd section: current waypoint number, turn point symbol or line segment | |
1746 tstfsz backtrack_waypoint_num ; does a current waypoint exist? | |
1747 bra TFT_cave_waypoints_8 ; YES - print its number or the turn point symbol | |
1748 btfss dive_turned ; NO - dive turned? | |
1749 bra TFT_cave_waypoints_7 ; NO - print a separated line segment | |
1750 STRCAT "------" ; YES - print a continuous line | |
1751 bra TFT_cave_waypoints_10 ; - continue with next section | |
1752 TFT_cave_waypoints_7: | |
1753 STRCAT ",----," ; print a separated line segment | |
1754 bra TFT_cave_waypoints_10 ; continue with next section | |
1755 TFT_cave_waypoints_8: | |
1756 STRCAT "," ; print a half-width space | |
1757 movff backtrack_waypoint_num,lo ; copy current waypoint number to lo | |
1758 movf backtrack_waypoint_turn,W ; copy turn point number to WREG | |
1759 cpfseq lo ; current waypoint = turn point ? | |
1760 bra TFT_cave_waypoints_9 ; NO - show waypoint number | |
1761 STRCAT_PRINT "--|, " ; YES - print end-of-line symbol, clear remaining output and finalize output | |
1762 return ; - done | |
1763 TFT_cave_waypoints_9: | |
1764 movff backtrack_waypoint_num,lo ; copy current waypoint number to lo | |
1765 output_99 ; print current waypoint number in two digit format | |
1766 STRCAT "," ; print a half-space | |
1767 TFT_cave_waypoints_10: | |
1768 ; 4th section: solid line | |
1769 STRCAT "---" ; print a solid line | |
1770 ; 5th section: next waypoint number or end of line symbol | |
1771 incf backtrack_waypoint_num,W ; load WREG with next waypoint number | |
1772 cpfseq backtrack_waypoint_turn ; next waypoint number = turn point number ? | |
1773 btfsc waypoint_reached_last ; NO - is the current waypoint the last waypoint? | |
1774 bra TFT_cave_waypoints_11 ; YES / YES - print end-of-line symbol | |
1775 STRCAT "," ; NO - print a half-space | |
1776 incf backtrack_waypoint_num,W ; - (re)load WREG with next waypoint number | |
1777 movwf lo ; NO - copy next waypoint number to lo | |
1778 output_99 ; - print next waypoint number in two digit format | |
1779 STRCAT_PRINT "" ; - finalize output | |
1780 return ; - done | |
1781 TFT_cave_waypoints_11: | |
1782 STRCAT_PRINT "---|," ; print end-of-line symbol and finalize output | |
1783 return ; done | |
1784 | |
1785 ENDIF | |
1589 | 1786 |
1590 ;============================================================================= | 1787 ;============================================================================= |
1591 | 1788 |
1592 IFDEF _external_sensor | 1789 IFDEF _external_sensor |
1593 | 1790 |
1897 STRCAT_PRINT "mV " | 2094 STRCAT_PRINT "mV " |
1898 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row | 2095 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row |
1899 SMOVII sensor3_mv,mpr ; in 0.1mV steps | 2096 SMOVII sensor3_mv,mpr ; in 0.1mV steps |
1900 output_16dp .4 ; xxx.y mV | 2097 output_16dp .4 ; xxx.y mV |
1901 STRCAT_PRINT "mV " | 2098 STRCAT_PRINT "mV " |
1902 bra TFT_display_exit_3 | 2099 TSTOSS opt_s8_mode ; =0: analog, =1: digital RS232 |
2100 bra TFT_display_exit_3 ; analog - done | |
2101 ; also imprint HUD battery voltage | |
2102 WIN_TINY .20,.209 ; digital | |
2103 STRCPY "HUD Batt: " ; print label | |
2104 SMOVII hud_battery_mv,mpr ; get HUD battery voltage | |
2105 output_16dp .2 ; print as -x.yyy | |
2106 STRCAT_PRINT "V " ; finalize output | |
2107 bra TFT_display_exit_3 ; done | |
1903 | 2108 |
1904 ENDIF ; _external_sensor | 2109 ENDIF ; _external_sensor |
1905 | 2110 |
1906 ;============================================================================= | 2111 ;============================================================================= |
1907 | 2112 |
1938 output_99x | 2143 output_99x |
1939 PUTC ':' | 2144 PUTC ':' |
1940 movff rtc_latched_secs,lo | 2145 movff rtc_latched_secs,lo |
1941 output_99x | 2146 output_99x |
1942 STRCAT " " | 2147 STRCAT " " |
1943 movff rtc_latched_day,lo | 2148 movff rtc_latched_year, lo |
1944 movff rtc_latched_month,hi | 2149 movff rtc_latched_month,hi |
1945 movff rtc_latched_year,up | 2150 movff rtc_latched_day, up |
1946 call TFT_convert_date ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 2151 call TFT_convert_date ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
1947 STRCAT_PRINT " " | 2152 STRCAT_PRINT " " |
1948 return | 2153 return |
1949 | 2154 |
1950 ;============================================================================= | 2155 ;============================================================================= |
1953 TFT_surface_decosettings: | 2158 TFT_surface_decosettings: |
1954 ; Deco Mode | 2159 ; Deco Mode |
1955 call TFT_standard_color | 2160 call TFT_standard_color |
1956 WIN_SMALL surf_gaslist_column,surf_gaslist_row | 2161 WIN_SMALL surf_gaslist_column,surf_gaslist_row |
1957 STRCAT_PRINT "ZH-L16" | 2162 STRCAT_PRINT "ZH-L16" |
1958 movff char_I_deco_model,WREG | 2163 movff char_I_model,WREG |
1959 iorwf WREG | 2164 iorwf WREG |
1960 bnz TFT_surface_decosettings1 | 2165 bnz TFT_surface_decosettings1 |
1961 ; Display ZH-L16 sat/desat model | 2166 ; Display ZH-L16 sat/desat model |
1962 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | 2167 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) |
1963 lfsr FSR2,buffer | 2168 lfsr FSR2,buffer |
1980 movff opt_GF_high,lo | 2185 movff opt_GF_high,lo |
1981 output_99x | 2186 output_99x |
1982 STRCAT_PRINT "" | 2187 STRCAT_PRINT "" |
1983 TFT_surface_decosettings2: ; fTTS | 2188 TFT_surface_decosettings2: ; fTTS |
1984 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | 2189 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) |
1985 STRCPY_TEXT tFTTSMenu | 2190 STRCPY_TEXT tFTTSSurf |
1986 movff char_I_extra_time,lo | 2191 movff char_I_extra_time,lo |
1987 bsf leftbind | 2192 bsf leftbind |
1988 output_8 | 2193 output_8 |
1989 STRCAT_TEXT_PRINT tMinutes | 2194 STRCAT_TEXT_PRINT tMinutes |
1990 ; Last Stop | 2195 ; Last Stop |
1993 movff opt_last_stop,lo | 2198 movff opt_last_stop,lo |
1994 output_8 | 2199 output_8 |
1995 STRCAT_TEXT_PRINT tMeters | 2200 STRCAT_TEXT_PRINT tMeters |
1996 ; Salinity | 2201 ; Salinity |
1997 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | 2202 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) |
1998 STRCPY_TEXT tDvSalinity | 2203 STRCPY_TEXT tDvSalinitySurf |
1999 movff opt_salinity,lo | 2204 movff opt_salinity,lo |
2000 output_8 | 2205 output_8 |
2001 bcf leftbind | 2206 bcf leftbind |
2002 STRCAT_TEXT_PRINT tPercent | 2207 STRCAT_TEXT_PRINT tPercent |
2003 return | 2208 return |
2004 | 2209 |
2005 | 2210 |
2006 global TFT_divetimeout ; show timeout counter | 2211 global TFT_divetimeout |
2007 TFT_divetimeout: | 2212 TFT_divetimeout: |
2008 call TFT_set_message_window ; set the row and column for the current message | 2213 call TFT_set_message_window ; set row and column for the message |
2009 tstfsz WREG ; is there room for the message? | 2214 tstfsz WREG ; is there room for the message? |
2010 return ; NO | 2215 return ; NO - skip message in this cycle |
2011 call TFT_memo_color | 2216 call TFT_memo_color |
2012 STRCPY 0x94 ; "End of dive" symbol | 2217 STRCPY 0x94 ; "End of dive" symbol |
2013 movff opt_diveTimeout,WREG ; in [min] | 2218 movff opt_diveTimeout,WREG ; in [min] |
2014 mullw .60 | 2219 mullw .60 |
2015 MOVII PRODL, sub_a ; in seconds | 2220 MOVII PRODL, sub_a ; in seconds |
2031 return | 2236 return |
2032 | 2237 |
2033 | 2238 |
2034 global TFT_show_ftts | 2239 global TFT_show_ftts |
2035 TFT_show_ftts: | 2240 TFT_show_ftts: |
2036 call TFT_set_message_window ; sets the row and column for the current warning | 2241 call TFT_set_message_window ; set row and column for the message |
2037 tstfsz WREG ; is there room for the message? | 2242 tstfsz WREG ; is there room for the message? |
2038 return ; NO - done | 2243 return ; NO - skip message in this cycle |
2039 btfsc FLAG_oc_mode ; YES - in OC mode? | 2244 bsf leftbind ; print with alignment to the left |
2040 bra TFT_display_ftts_1 ; YES - print fTTS label | 2245 IFDEF _cave_mode |
2041 TSTOSS opt_calc_asc_gasvolume ; NO - bailout volume calculation requested? | 2246 btfss cave_mode ; cave mode switched on? |
2042 bra TFT_display_ftts_1 ; NO - print fTTS label | 2247 bra TFT_display_ftts_2 ; NO - classic open water TTS |
2043 STRCPY "B/O" ; YES - print bailout label | 2248 btfss dive_turned ; YES - dive turned? |
2044 bra TFT_display_ftts_2 | 2249 bra TFT_display_ftts_1 ; NO - cTTS from current position |
2045 TFT_display_ftts_1: ; OC or CCR/pSCR but no bailout volume calculation | 2250 STRCPY "WP" ; YES - print waypoint mark |
2251 movf backtrack_waypoint_num,W ; - copy current waypoint number to WREG | |
2252 cpfseq backtrack_waypoint_turn ; - current waypoint = turn point ? | |
2253 bra TFT_display_ftts_0 ; NO - print waypoint number | |
2254 STRCAT "-| " ; YES - print turn point symbol | |
2255 bra TFT_display_ftts_5 ; - continue with TTS | |
2256 TFT_display_ftts_0: | |
2257 movwf lo ; copy current waypoint number to lo | |
2258 output_99 ; print waypoint number | |
2259 PUTC " " ; append a space char | |
2260 bra TFT_display_ftts_5 ; continue with TTS | |
2261 TFT_display_ftts_1: | |
2262 STRCPY "cTTS " ; print cave TTS label followed by a space | |
2263 bra TFT_display_ftts_5 ; continue with TTS | |
2264 ENDIF ; _cave_mode | |
2265 TFT_display_ftts_2: | |
2266 btfsc FLAG_oc_mode ; in OC mode? | |
2267 bra TFT_display_ftts_3 ; YES - print fTTS label | |
2268 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
2269 bra TFT_display_ftts_3 ; NO - print fTTS label | |
2270 STRCPY "B/O" ; YES - print bailout label | |
2271 bra TFT_display_ftts_4 ; - continue | |
2272 TFT_display_ftts_3: ; OC or CCR/pSCR but no bailout volume calculation | |
2046 STRCPY "@+" ; print fTTS label | 2273 STRCPY "@+" ; print fTTS label |
2047 TFT_display_ftts_2: | 2274 TFT_display_ftts_4: |
2048 movff char_I_extra_time,lo ; get fTTS delay time | 2275 movff char_I_extra_time,lo ; get fTTS delay time |
2049 bsf leftbind ; print with alignment to the left | |
2050 output_8 ; print fTTS delay time | 2276 output_8 ; print fTTS delay time |
2051 PUTC ":" ; ":" | 2277 PUTC ":" ; ":" |
2278 TFT_display_ftts_5: | |
2052 MOVII int_O_TTS_alt,mpr ; get alternative TTS | 2279 MOVII int_O_TTS_alt,mpr ; get alternative TTS |
2053 call TFT_memo_color ; set memo color | 2280 call TFT_memo_color ; set memo color |
2054 btfss hi,int_invalid_flag ; is the invalid flag set? | 2281 btfss hi,int_invalid_flag ; is the invalid flag set? |
2055 bra TFT_display_ftts_3 ; NO - keep memo color | 2282 bra TFT_display_ftts_6 ; NO - keep memo color |
2056 bcf hi,int_invalid_flag ; YES - clear flag | 2283 bcf hi,int_invalid_flag ; YES - clear flag |
2057 call TFT_disabled_color ; - switch to disabled color | 2284 call TFT_disabled_color ; - switch to disabled color |
2058 TFT_display_ftts_3: | 2285 TFT_display_ftts_6: |
2059 btfsc hi,int_not_yet_computed ; is the not-computed-yet flag set? | 2286 btfsc hi,int_not_yet_computed ; is the not-yet-computed flag set? |
2060 bra TFT_display_ftts_4 ; YES - show dashes | 2287 bra TFT_display_ftts_8 ; YES - show dashes |
2061 movf lo,W | 2288 IFDEF _cave_mode |
2062 iorwf hi,W ; extra_ascenttime = 0 ? | 2289 btfsc cave_mode ; cave mode switched on? |
2063 bz TFT_display_ftts_5 ; YES - show "NDL" | 2290 bra TFT_display_ftts_7 ; YES - take shortcut |
2064 movff char_O_deco_info,up ; get deco info vector | 2291 ENDIF |
2065 btfsc up,deco_zone ; fTTS <= TTS ? | 2292 movff int_O_TST_alt+1,WREG ; get high byte of the alternative total stops time |
2066 call TFT_advice_color ; YES - set to advice color (green) | 2293 btfsc WREG,int_is_zero ; total stops time = zero ? |
2294 bra TFT_display_ftts_9 ; YES - show "NDL" | |
2295 btfsc WREG,deco_zone ; NO - fTTS <= TTS ? | |
2296 call TFT_advice_color ; YES - set to advice color (green) | |
2297 TFT_display_ftts_7: | |
2067 output_16 ; print ascent time | 2298 output_16 ; print ascent time |
2068 PUTC "'" ; print minutes symbol | 2299 PUTC "'" ; print minutes symbol |
2069 bra TFT_display_ftts_6 | 2300 bra TFT_display_ftts_10 ; continue |
2070 TFT_display_ftts_4: | 2301 TFT_display_ftts_8: |
2071 STRCAT "---" ; "---" for not computed | 2302 STRCAT "---" ; print "---" for not computed |
2072 bra TFT_display_ftts_6 | 2303 bra TFT_display_ftts_10 ; continue |
2073 TFT_display_ftts_5: | 2304 TFT_display_ftts_9: |
2074 STRCAT_TEXT tNDL ; "NDL" | 2305 STRCAT_TEXT tNDL ; print "NDL" |
2075 TFT_display_ftts_6: | 2306 TFT_display_ftts_10: |
2076 movlw dm_warning_length ; dive mode string length | 2307 movlw dm_warning_length ; dive mode string length |
2077 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 2308 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
2078 STRCAT_PRINT "" | 2309 STRCAT_PRINT "" ; finalize output |
2079 bcf leftbind ; clear left alignment | 2310 bcf leftbind ; clear left alignment |
2080 goto TFT_standard_color ; ...and return | 2311 goto TFT_standard_color ; ...and return |
2081 | 2312 |
2082 | 2313 |
2083 ;============================================================================= | 2314 ;============================================================================= |
2113 WIN_SMALL dm_temp_column,dm_temp_row ; set position | 2344 WIN_SMALL dm_temp_column,dm_temp_row ; set position |
2114 call TFT_memo_color ; set color | 2345 call TFT_memo_color ; set color |
2115 movlw index_compass_dm ; index of compass custom view | 2346 movlw index_compass_dm ; index of compass custom view |
2116 cpfseq active_customview ; compass shown in custom view? | 2347 cpfseq active_customview ; compass shown in custom view? |
2117 bra TFT_temp_common ; NO - proceed with temperature | 2348 bra TFT_temp_common ; NO - proceed with temperature |
2118 bra TFT_update_stopwatch ; YES - show resettable dive time instead of temperature | 2349 goto TFT_update_stopwatch ; YES - show resettable dive time instead of temperature |
2119 TFT_temp_common: | 2350 TFT_temp_common: |
2120 SMOVII temperature_cur,mpr ; ISR-safe 2 byte copy of current temperature to hi:lo | 2351 SMOVII temperature_cur,mpr ; ISR-safe 2 byte copy of current temperature to hi:lo |
2121 TSTOSC opt_units ; 0=°C, 1=°F | 2352 TSTOSC opt_units ; 0=°C, 1=°F |
2122 call convert_celsius_to_fahrenheit ; 1 - convert value in lo:hi from Celsius to Fahrenheit | 2353 call convert_celsius_to_fahrenheit ; 1 - convert value in lo:hi from Celsius to Fahrenheit |
2123 rcall TFT_convert_signed_16bit ; convert lo:hi into signed-short and adds '-' to POSTINC2 if required | 2354 rcall TFT_convert_signed_16bit ; convert lo:hi into signed-short and adds '-' to POSTINC2 if required |
2128 bra TFT_temp_common_1 ; > 25.5°C, skip here | 2359 bra TFT_temp_common_1 ; > 25.5°C, skip here |
2129 movlw .100 | 2360 movlw .100 |
2130 cpfslt lo | 2361 cpfslt lo |
2131 bra TFT_temp_common_1 ; > 10.0°C, skip here | 2362 bra TFT_temp_common_1 ; > 10.0°C, skip here |
2132 bsf leftbind | 2363 bsf leftbind |
2133 output_16dp d'4' ; x.y°C | 2364 output_16dp d'4' ; x.y°C |
2134 bcf leftbind | 2365 bcf leftbind |
2135 bra TFT_temp_common_3 ; done | 2366 bra TFT_temp_common_3 ; done |
2136 TFT_temp_common_1: | 2367 TFT_temp_common_1: |
2137 PUTC " " ; NO - write a space instead of the minus sign | 2368 PUTC " " ; NO - write a space instead of the minus sign |
2138 TFT_temp_common_2: | 2369 TFT_temp_common_2: |
2494 | 2725 |
2495 ;================================================================== | 2726 ;================================================================== |
2496 | 2727 |
2497 global TFT_show_depth | 2728 global TFT_show_depth |
2498 TFT_show_depth: | 2729 TFT_show_depth: |
2499 MOVII pressure_rel_cur_cached,mpr ; copy relative pressure to hi:lo | 2730 MOVII pressure_rel_cur_cached,mpr ; copy relative pressure to MPR |
2500 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 2731 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
2501 call TFT_color_code_depth ; set warning / attention flags and color-code the output | 2732 call TFT_color_code_depth ; set warning / attention flags and color-code the output |
2502 rcall TFT_depth_blink ; control animation (blinking) | 2733 rcall TFT_depth_blink ; control animation (blinking) |
2503 rcall TFT_depth_position_m_ft ; set output position | 2734 rcall TFT_depth_position_m_ft ; set output position |
2504 | 2735 |
2505 TSTOSS opt_units ; 0=m, 1=ft ? | 2736 TSTOSS opt_units ; 0=m, 1=ft ? |
2510 MOVLI .30,sub_a ; display 0 ft if shallower than 30 cm | 2741 MOVLI .30,sub_a ; display 0 ft if shallower than 30 cm |
2511 MOVII mpr,sub_b | 2742 MOVII mpr,sub_b |
2512 call cmpU16 ; compare (sub_a - sub_b) | 2743 call cmpU16 ; compare (sub_a - sub_b) |
2513 btfss neg_flag ; depth shallower than 30 cm ? | 2744 btfss neg_flag ; depth shallower than 30 cm ? |
2514 bra depth_0_feet ; YES - print a zero directly | 2745 bra depth_0_feet ; YES - print a zero directly |
2515 call convert_mbar_to_feet ; NO - convert value in hi:lo from mbar to feet | 2746 call convert_cm_to_feet ; NO - convert value in hi:lo from [cm] to [feet] |
2516 bsf leftbind ; - print left-aligned | 2747 output_16_3 ; - feet in large or huge font |
2517 output_16 ; - feet in large or huge font | |
2518 bcf leftbind ; - reset alignment | |
2519 movlw .3 ; - limit to three chars | |
2520 call TFT_fillup_with_spaces ; - fill up FSR2 with spaces | |
2521 STRCAT_PRINT "" ; - finalize output | 2748 STRCAT_PRINT "" ; - finalize output |
2522 TFT_depth_imperial_1: | 2749 TFT_depth_imperial_1: |
2523 bcf win_invert ; - reset invert flag | 2750 bcf win_invert ; - reset invert flag |
2524 bra TFT_depth_exit ; - show target depth if in simulator mode and return | 2751 bra TFT_depth_exit ; - show target depth if in simulator mode and return |
2525 | 2752 |
2526 depth_0_feet: | 2753 depth_0_feet: |
2527 STRCAT_PRINT "0 " ; print a zero directly | 2754 STRCAT_PRINT " 0" ; print a zero directly |
2528 bra TFT_depth_imperial_1 ; continue with common part | 2755 bra TFT_depth_imperial_1 ; continue with common part |
2529 | 2756 |
2530 TFT_depth_metric: | 2757 TFT_depth_metric: |
2531 ; full meters | 2758 ; full meters |
2532 MOVLI .9999,sub_a ; 9999 mbar = 99.99 m | 2759 MOVLI .9999,sub_a ; 9999 mbar = 99.99 m |
2589 bsf leftbind ; print left-aligned | 2816 bsf leftbind ; print left-aligned |
2590 output_16 ; print depth | 2817 output_16 ; print depth |
2591 bcf leftbind ; reset alignment | 2818 bcf leftbind ; reset alignment |
2592 STRCAT_PRINT "" ; finalize output | 2819 STRCAT_PRINT "" ; finalize output |
2593 bcf win_invert ; reset invert flag | 2820 bcf win_invert ; reset invert flag |
2594 bra TFT_depth_exit ; show target depth if in simulator mode and return | 2821 bra TFT_depth_exit ; show target depth if in simulator mode and return |
2595 | 2822 |
2596 TFT_depth_blink: | 2823 TFT_depth_blink: |
2597 TSTOSS opt_modwarning ; 0=standard, 1=blink | 2824 TSTOSS opt_depth_warn ; 0=standard, 1=blink |
2598 return ; standard, done | 2825 return ; standard, done |
2599 btfsc depth_warn_att_last ; was there a warning or attention on the depth in the previous cycle? | 2826 btfsc depth_warn_att_last ; was there a warning or attention on the depth in the previous cycle? |
2600 bra TFT_depth_blink_prev ; YES | 2827 bra TFT_depth_blink_prev ; YES |
2601 btfsc depth_warning ; NO - do we have a depth warning now? | 2828 btfsc depth_warning ; NO - do we have a depth warning now? |
2602 bra TFT_depth_blink_new ; YES - so we have a warning now but not previously | 2829 bra TFT_depth_blink_new ; YES - so we have a warning now but not previously |
2856 PUTC "T" | 3083 PUTC "T" |
2857 bsf leftbind | 3084 bsf leftbind |
2858 output_8 | 3085 output_8 |
2859 PUTC ":" | 3086 PUTC ":" |
2860 MOVII batt_voltage,mpr | 3087 MOVII batt_voltage,mpr |
2861 output_16dp .2 | 3088 output_16dp .2 ; print as -x.yyy |
2862 bcf leftbind | 3089 bcf leftbind |
2863 PUTC 'V' | 3090 PUTC 'V' |
2864 movff buffer+8,buffer+6 | 3091 movff buffer+8,buffer+6 |
2865 movlw 0x00 | 3092 movlw 0x00 |
2866 movff WREG,buffer+7 ; only "x.yV" | 3093 movff WREG,buffer+7 ; only "x.yV" |
2902 btfsc STATUS,C | 3129 btfsc STATUS,C |
2903 incf hi | 3130 incf hi |
2904 return ; done | 3131 return ; done |
2905 | 3132 |
2906 ;============================================================================= | 3133 ;============================================================================= |
2907 | 3134 ; input: lo year |
3135 ; hi month | |
3136 ; up day | |
3137 ; | |
3138 ; output format by option opt_dateformat: | |
3139 ; 0: MMDDYY | |
3140 ; 1: DDMMYY | |
3141 ; 2: YYMMDD | |
3142 ; | |
2908 global TFT_convert_date | 3143 global TFT_convert_date |
2909 TFT_convert_date: ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 3144 TFT_convert_date: ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in output buffer |
2910 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | 3145 movff opt_dateformat,EEDATA ; get format (EEDATA used as temp here) |
2911 movwf EEDATA ; used as temp here | 3146 tstfsz EEDATA ; shall use format 0 ? |
2912 tstfsz EEDATA | 3147 bra TFT_convert_date_1 ; NO - check for format 1 or 2 |
2913 bra TFT_convert_date_1 ; opt_dateformat is 1 or 2 | 3148 ; YES - use format 0: MMDDYY |
2914 ; opt_dateformat is 0 | 3149 movff lo,hy ; - backup year to hy |
2915 ; use MMDDYY | 3150 movff hi,lo ; - copy month to lo |
2916 movff lo,hy ; incoming: lo = day, hi = month | 3151 movff up,hi ; - copy day to hi |
2917 movff hi,lo ; swap | 3152 movff hy,up ; - copy year to up |
2918 movff hy,hi ; now: lo = month, hi = day | 3153 bra TFT_convert_date_common ; - start output |
2919 bra TFT_convert_date_common | |
2920 | |
2921 TFT_convert_date_1: | 3154 TFT_convert_date_1: |
2922 decfsz EEDATA,F | 3155 decfsz EEDATA,F ; shall use format 1 ? |
2923 bra TFT_convert_date_2 ; opt_dateformat is 2 | 3156 bra TFT_convert_date_common ; NO - use format 2: YYMMDD - can print directly |
2924 ; opt_dateformat is 1 | 3157 ; YES - use format 1: DDMMYY |
2925 ; use DDMMYY | 3158 movff lo,hy ; - backup year to hy |
3159 movff up,lo ; - copy day to lo | |
3160 movff hy,up ; - copy year to up | |
3161 | |
2926 TFT_convert_date_common: | 3162 TFT_convert_date_common: |
2927 bsf leftbind | 3163 bsf leftbind ; start left-alignment |
2928 output_99x ; with lo = month or day or year | 3164 output_99x ; print lo |
2929 PUTC '.' | 3165 PUTC '.' ; print spacing dot |
2930 movff hi,lo ; now lo = day or month or month | 3166 movff hi,lo ; print hi |
2931 output_99x | 3167 output_99x ; ... |
2932 PUTC '.' | 3168 PUTC '.' ; print spacing dot |
2933 movff up,lo ; now lo = year or year or day | 3169 movff up,lo ; print up |
2934 output_99x | 3170 output_99x ; ... |
2935 bcf leftbind | 3171 bcf leftbind ; end left-alignment |
2936 return | 3172 return ; done |
2937 | 3173 |
2938 TFT_convert_date_2: | |
2939 ; opt_dateformat is 2 | |
2940 ; use YYMMDD | |
2941 movff lo,hy ; incoming: lo = day, up = year | |
2942 movff up,lo ; swap | |
2943 movff hy,up ; now : lo = year, up = day | |
2944 bra TFT_convert_date_common | |
2945 | 3174 |
2946 ;============================================================================= | 3175 ;============================================================================= |
2947 | 3176 ; show date by month & day |
3177 ; | |
3178 ; input: lo year (not used here) | |
3179 ; hi month | |
3180 ; up day | |
3181 ; | |
3182 ; output format by option opt_dateformat: | |
3183 ; 0: MMDD(YY) | |
3184 ; 1: DDMM(YY) | |
3185 ; 2: (YY)MMDD | |
3186 ; | |
2948 global TFT_convert_date_short | 3187 global TFT_convert_date_short |
2949 TFT_convert_date_short: ; convert into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | 3188 TFT_convert_date_short: ; convert into "DD/MM" or "MM/DD" or "MM/DD" into output buffer |
2950 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | 3189 movff opt_dateformat,EEDATA ; get format (EEDATA used as temp here) |
2951 movwf EEDATA ; used as temp here | 3190 tstfsz EEDATA ; shall use format 0 ? |
2952 tstfsz EEDATA | 3191 bra TFT_convert_date_short2 ; NO - check for format 1 or 2 |
2953 bra TFT_convert_date_short_1 | 3192 TFT_convert_date_short1: ; YES - use format 0: MMDD |
2954 ; opt_dateformat is 0 | 3193 movff hi,lo ; - copy month to lo |
2955 ; use MMDD(YY) | 3194 movff up,hi ; - copy day to hi |
2956 TFT_convert_date_short_0: | 3195 bra TFT_convert_date_short3 ; - start output |
2957 movff lo,hy ; incoming: lo = day, hi = month | 3196 TFT_convert_date_short2: |
2958 movff hi,lo ; swap | 3197 decfsz EEDATA,F ; format 1 ? |
2959 movff hy,hi ; now: lo = month, hi = day | 3198 bra TFT_convert_date_short1 ; NO - use format 2: MMDD (here its like format 0) |
2960 bra TFT_convert_date_short_common | 3199 ; YES - use format 1: DDMM |
2961 | 3200 movff up,lo ; - copy day to lo, |
2962 TFT_convert_date_short_1: | 3201 ; - month is already in hi |
2963 decfsz EEDATA,F | 3202 TFT_convert_date_short3: |
2964 bra TFT_convert_date_short_0; opt_dateformat is 2 -> use (YY)MMDD | 3203 bsf leftbind ; start left-alignment |
2965 ; opt_dateformat is 1 | 3204 output_99x ; print lo |
2966 ; use DDMM(YY) | 3205 PUTC '.' ; print spacing dot |
2967 TFT_convert_date_short_common: | 3206 movff hi,lo ; print hi |
2968 bsf leftbind | 3207 output_99x ; ... |
2969 output_99x ; with lo = month or day | 3208 bcf leftbind ; end left-alignment |
2970 PUTC '.' | 3209 return ; done |
2971 movff hi,lo ; now lo = day or month | |
2972 output_99x | |
2973 bcf leftbind | |
2974 return | |
2975 | 3210 |
2976 ;============================================================================= | 3211 ;============================================================================= |
2977 | 3212 |
2978 global TFT_date_surfmode | 3213 global TFT_date_surfmode |
2979 TFT_date_surfmode: | 3214 TFT_date_surfmode: |
2980 WIN_SMALL surf_date_column,surf_date_row | 3215 WIN_SMALL surf_date_column,surf_date_row |
2981 call TFT_standard_color | 3216 call TFT_standard_color |
2982 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | 3217 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time |
2983 movff rtc_latched_day,lo | 3218 movff rtc_latched_year, lo |
2984 movff rtc_latched_month,hi | 3219 movff rtc_latched_month,hi |
2985 movff rtc_latched_year,up | 3220 movff rtc_latched_day, up |
2986 call TFT_convert_date ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | 3221 call TFT_convert_date ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
2987 STRCAT_PRINT "" | 3222 STRCAT_PRINT "" |
2988 return | 3223 return |
2989 | 3224 |
2990 ;============================================================================= | 3225 ;============================================================================= |
3007 TSTOSS opt_2ndDepthDisp ; show average depth instead of max depth? | 3242 TSTOSS opt_2ndDepthDisp ; show average depth instead of max depth? |
3008 bra TFT_max_depth_current ; NO - show max depth | 3243 bra TFT_max_depth_current ; NO - show max depth |
3009 ;bra TFT_avg_depth_current ; YES - show avg depth | 3244 ;bra TFT_avg_depth_current ; YES - show avg depth |
3010 | 3245 |
3011 TFT_avg_depth_current: | 3246 TFT_avg_depth_current: |
3012 MOVII pressure_rel_avg_total,mpr ; YES - get total dive average depth | 3247 MOVII pressure_rel_avg_total,mpr ; YES - get total dive average pressure |
3013 bra TFT_max_depth_common ; - continue with common part | 3248 bra TFT_max_depth_common ; - continue with common part |
3014 | 3249 |
3015 TFT_max_depth_apnoe: | 3250 TFT_max_depth_apnoe: |
3016 btfss apnoe_at_surface ; apnoe mode, at the surface? | 3251 btfss apnoe_at_surface ; apnoe mode, at the surface? |
3017 bra TFT_max_depth_current ; NO - show max depth of current dive | 3252 bra TFT_max_depth_current ; NO - show max depth of current dive |
3018 MOVII apnoe_max_pressure,mpr ; YES - show max depth of all dives so far | 3253 MOVII apnoe_max_pressure,mpr ; YES - get max pressure of all dives so far |
3019 bra TFT_max_depth_common ; - continue with common part | 3254 bra TFT_max_depth_common ; - continue with common part |
3020 | 3255 |
3021 TFT_max_depth_current: | 3256 TFT_max_depth_current: |
3022 MOVII pressure_rel_max_cached,mpr ; get the "normal" max depth in mbar = cm | 3257 MOVII pressure_rel_max_cached,mpr ; get the "normal" max pressure |
3023 ;bra TFT_max_depth_common ; continue with common part | 3258 ;bra TFT_max_depth_common ; continue with common part |
3024 | 3259 |
3025 TFT_max_depth_common: | 3260 TFT_max_depth_common: |
3026 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 3261 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
3027 TSTOSS opt_units ; 0=m or 1=ft ? | 3262 TSTOSS opt_units ; 0=m or 1=ft ? |
3028 bra TFT_max_depth_metric ; 0 - use metric version | 3263 bra TFT_max_depth_metric ; 0 - use metric version |
3029 ;bra TFT_max_depth_imperial ; 1 - use imperial version | 3264 ;bra TFT_max_depth_imperial ; 1 - use imperial version |
3030 | 3265 |
3031 TFT_max_depth_imperial: | 3266 TFT_max_depth_imperial: |
3032 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 3267 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
3033 call TFT_memo_color ; set output color | 3268 call TFT_memo_color ; set output color |
3034 output_16_3 ; print depth | 3269 output_16_3 ; print depth |
3035 bra TFT_max_depth_finish ; finish output | 3270 bra TFT_max_depth_finish ; finish output |
3036 | 3271 |
3037 TFT_max_depth_metric: | 3272 TFT_max_depth_metric: |
3118 call TFT_memo_color ; set color | 3353 call TFT_memo_color ; set color |
3119 WIN_MEDIUM dm_gauge_max_depth_col, dm_gauge_max_depth_row ; set position for max depth | 3354 WIN_MEDIUM dm_gauge_max_depth_col, dm_gauge_max_depth_row ; set position for max depth |
3120 rcall TFT_show_gauge_max_depth ; show max depth | 3355 rcall TFT_show_gauge_max_depth ; show max depth |
3121 call TFT_memo_color ; set color | 3356 call TFT_memo_color ; set color |
3122 WIN_MEDIUM dm_gauge_avg_depth_col, dm_gauge_avg_depth_row ; set position for avg depth | 3357 WIN_MEDIUM dm_gauge_avg_depth_col, dm_gauge_avg_depth_row ; set position for avg depth |
3123 MOVII pressure_rel_avg_total,mpr ; get average depth into hi:lo | 3358 MOVII pressure_rel_avg_total,mpr ; get average pressure into hi:lo |
3124 bra TFT_show_gauge_depth ; show avg depth and return | 3359 bra TFT_show_gauge_depth ; show avg depth and return |
3125 | 3360 |
3126 | 3361 |
3127 global TFT_show_apnoe_max_depth | 3362 global TFT_show_apnoe_max_depth |
3128 TFT_show_apnoe_max_depth: | 3363 TFT_show_apnoe_max_depth: |
3138 TFT_show_apnoe_max_depth_com: | 3373 TFT_show_apnoe_max_depth_com: |
3139 ; value | 3374 ; value |
3140 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row | 3375 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row |
3141 call TFT_memo_color | 3376 call TFT_memo_color |
3142 TFT_show_gauge_max_depth: | 3377 TFT_show_gauge_max_depth: |
3143 MOVII pressure_rel_max_cached,mpr ; get max depth into hi:lo | 3378 MOVII pressure_rel_max_cached,mpr ; get max pressure into hi:lo |
3379 ;bra TFT_show_gauge_depth ; show max depth and return | |
3380 | |
3144 TFT_show_gauge_depth: | 3381 TFT_show_gauge_depth: |
3145 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 3382 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
3146 TSTOSS opt_units ; 0=m, 1=ft | 3383 TSTOSS opt_units ; 0=m, 1=ft |
3147 bra TFT_display_apnoe_last_m_metric ; 0 - metric | 3384 bra TFT_display_apnoe_last_m_metric ; 0 - metric |
3148 TFT_display_apnoe_last_max_imp: ; 1 - imperial | 3385 TFT_display_apnoe_last_max_imp: ; 1 - imperial |
3149 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 3386 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
3150 output_16 | 3387 output_16 |
3151 bra TFT_max_depth_finish ; finish output | 3388 bra TFT_max_depth_finish ; finish output |
3152 TFT_display_apnoe_last_m_metric: | 3389 TFT_display_apnoe_last_m_metric: |
3153 bsf ignore_digit5 ; do not display centimeters (flag will be cleared by output_16) | 3390 bsf ignore_digit5 ; do not display centimeters (flag will be cleared by output_16) |
3154 output_16dp d'3' | 3391 output_16dp d'3' |
3294 | 3531 |
3295 ;----------------------------------------------------------------------------- | 3532 ;----------------------------------------------------------------------------- |
3296 ; check if firmware is within expiry period, will return aux_flag set if not | 3533 ; check if firmware is within expiry period, will return aux_flag set if not |
3297 | 3534 |
3298 check_expiry: ; check if it is time for a firmware update | 3535 check_expiry: ; check if it is time for a firmware update |
3299 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | 3536 SMOVSS rtc_year,rtc_latched_year; ISR-safe 6 byte copy of date and time |
3300 movff rtc_latched_day,lo ; get current day | 3537 movff rtc_latched_day,lo ; get current day |
3301 movff rtc_latched_month,hi ; get current month | 3538 movff rtc_latched_month,hi ; get current month |
3302 movff rtc_latched_year,up ; get current year | 3539 movff rtc_latched_year,up ; get current year |
3303 bsf aux_flag ; set firmware as expired by default | 3540 bsf aux_flag ; set firmware as expired by default |
3304 movlw firmware_expire_year ; start with checking year | 3541 movlw firmware_expire_year ; start with checking year |
3340 goto TFT_warning_color ; - set color | 3577 goto TFT_warning_color ; - set color |
3341 TFT_cat_debug_short: | 3578 TFT_cat_debug_short: |
3342 STRCAT "DBG." ; show short version | 3579 STRCAT "DBG." ; show short version |
3343 goto TFT_warning_color ; set color | 3580 goto TFT_warning_color ; set color |
3344 ELSE | 3581 ELSE |
3345 movlw softwareversion_beta ; =0: release, =1: beta 1, =2: beta 2, ... | 3582 movlw fw_version_beta ; =0: release, =1: beta 1, =2: beta 2, ... |
3346 movwf lo ; copy to lo | 3583 movwf lo ; copy to lo |
3347 tstfsz lo ; release version? | 3584 tstfsz lo ; release version? |
3348 bra TFT_cat_beta_1 ; NO - must be beta version then | 3585 bra TFT_cat_beta_1 ; NO - must be beta version then |
3349 btfss aux_flag ; YES - shall show long version? | 3586 btfss aux_flag ; YES - shall show long version? |
3350 bra TFT_cat_beta_2 ; NO - show short version | 3587 bra TFT_cat_beta_2 ; NO - show short version |
3430 ;----------------------------------------------------------------------------- | 3667 ;----------------------------------------------------------------------------- |
3431 ; For the Information menu: append total dives | 3668 ; For the Information menu: append total dives |
3432 | 3669 |
3433 global info_menu_total_dives | 3670 global info_menu_total_dives |
3434 info_menu_total_dives: | 3671 info_menu_total_dives: |
3435 lfsr FSR1,tTotalDives | 3672 lfsr FSR1,tTotalDives ; locate text |
3436 call strcat_text | 3673 call strcat_text ; print text |
3437 TFT_cat_total_dives: | 3674 TFT_cat_total_dives: |
3438 read_int_eeprom .2 | 3675 call eeprom_total_dives_read ; read total number of dives |
3439 movff EEDATA,lo | 3676 bsf leftbind ; print left-aligned |
3440 read_int_eeprom .3 | 3677 output_16 ; print number of total dives |
3441 movff EEDATA,hi | 3678 bcf leftbind ; quit left-aligned |
3442 bsf leftbind | 3679 return ; done |
3443 output_16 | 3680 |
3444 bcf leftbind | |
3445 return | |
3446 | |
3447 ;----------------------------------------------------------------------------- | 3681 ;----------------------------------------------------------------------------- |
3448 ; append firmware version to current string, including color-coding | 3682 ; append firmware version to current string, including color-coding |
3449 | 3683 |
3450 global TFT_cat_firmware | 3684 global TFT_cat_firmware |
3451 TFT_cat_firmware: | 3685 TFT_cat_firmware: |
3452 movlw softwareversion_x | 3686 movlw fw_version_major |
3453 movwf lo | 3687 movwf lo |
3454 bsf leftbind | 3688 bsf leftbind |
3455 output_8 ; print major in 1 or 2 digit format | 3689 output_8 ; print major in 1 or 2 digit format |
3456 PUTC '.' | 3690 PUTC '.' |
3457 movlw softwareversion_y | 3691 movlw fw_version_minor |
3458 movwf lo | 3692 movwf lo |
3459 output_99x ; print minor in two digit format | 3693 output_99x ; print minor in two digit format |
3460 bcf leftbind | 3694 bcf leftbind |
3461 rcall check_expiry ; sets aux_flag if expired | 3695 rcall check_expiry ; sets aux_flag if expired |
3462 btfss aux_flag ; expired? | 3696 btfss aux_flag ; expired? |
3463 return ; NO | 3697 return ; NO |
3464 bsf win_invert ; YES - print in inverse | 3698 bsf win_invert ; YES - print in inverse |
3465 goto TFT_attention_color ; - print in attention color (and return) | 3699 goto TFT_attention_color ; - print in attention color (and return) |
3466 | 3700 |
3467 ;----------------------------------------------------------------------------- | 3701 ;----------------------------------------------------------------------------- |
3468 ; For the Information menu: firmware version | 3702 ; For the Information menu: firmware version and creation date |
3469 | 3703 |
3470 global info_menu_firmware | 3704 global info_menu_firmware |
3471 info_menu_firmware: | 3705 info_menu_firmware: |
3472 lfsr FSR1,tFirmware | 3706 lfsr FSR1,tFirmware ; select label text |
3473 call strcat_text | 3707 call strcat_text ; print label |
3474 rcall TFT_cat_firmware | 3708 rcall TFT_cat_firmware ; print firmware version |
3475 PUTC " " | 3709 PUTC " " ; print a dot |
3476 rcall TFT_cat_beta_rel | 3710 rcall TFT_cat_beta_rel ; print beta/release |
3477 STRCAT_PRINT "" | 3711 STRCAT_PRINT "" ; finalize output |
3478 return | 3712 return ; done |
3713 | |
3714 global info_menu_fw_cration_date | |
3715 info_menu_fw_cration_date: | |
3716 lfsr FSR1,tFirmwareDate ; select label text | |
3717 call strcat_text ; print label | |
3718 movlw firmware_creation_year ; get firmware creation year | |
3719 movwf lo ; copy to lo | |
3720 movlw firmware_creation_month ; get firmware creation month | |
3721 movwf hi ; copy to hi | |
3722 movlw firmware_creation_day ; get firmware creation day | |
3723 movwf up ; copy to up | |
3724 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
3725 return ; done | |
3479 | 3726 |
3480 ;----------------------------------------------------------------------------- | 3727 ;----------------------------------------------------------------------------- |
3481 ; For the Information menu: firmware version of the RX processor | 3728 ; For the Information menu: firmware version of the RX processor |
3482 | 3729 |
3483 IFDEF _rx_functions | 3730 IFDEF _rx_functions |
3503 ; For the Information menu: serial number | 3750 ; For the Information menu: serial number |
3504 | 3751 |
3505 global info_menu_serial | 3752 global info_menu_serial |
3506 global TFT_cat_serial | 3753 global TFT_cat_serial |
3507 info_menu_serial: | 3754 info_menu_serial: |
3508 lfsr FSR1,tSerial | 3755 lfsr FSR1,tSerial ; locate text |
3509 call strcat_text | 3756 call strcat_text ; print text |
3510 TFT_cat_serial: | 3757 TFT_cat_serial: |
3511 clrf EEADRH | 3758 call eeprom_serial_number_read ; read OSTC serial number |
3512 clrf EEADR ; get serial number LOW | 3759 bsf leftbind ; start left-alignment |
3513 call read_eeprom ; read byte | 3760 output_16 ; print serial number |
3514 movff EEDATA,lo | 3761 bcf leftbind ; end left-alignment |
3515 incf EEADR,F ; get serial number HIGH | 3762 return ; done |
3516 call read_eeprom ; read byte | |
3517 movff EEDATA,hi | |
3518 | |
3519 bsf leftbind | |
3520 output_16 | |
3521 bcf leftbind | |
3522 return | |
3523 | 3763 |
3524 ;----------------------------------------------------------------------------- | 3764 ;----------------------------------------------------------------------------- |
3525 ; For the Information menu: hardware / software configuration | 3765 ; For the Information menu: hardware / software configuration |
3526 | 3766 |
3527 global info_menu_config | 3767 global info_menu_config |
3528 info_menu_config: | 3768 info_menu_config: |
3529 lfsr FSR1,tHardware | 3769 lfsr FSR1,tHardware ; locate text |
3530 call strcat_text | 3770 call strcat_text ; print text |
3531 call I2C_init_compass ; start compass | 3771 call I2C_init_compass ; start compass |
3532 movf HW_descriptor,W ; copy hardware descriptor to WREG | 3772 movf HW_descriptor,W ; copy hardware descriptor to WREG |
3533 output_hex ; print as hex | 3773 output_hex ; print as hex |
3534 PUTC "-" ; print a separator | 3774 PUTC "-" ; print a separator |
3535 movf HW_variants,W ; copy hardware variants to WREG | 3775 movf HW_variants,W ; copy hardware variants to WREG |
3536 output_hex ; print as hex | 3776 output_hex ; print as hex |
3537 PUTC "-" ; print a separator | 3777 PUTC "-" ; print a separator |
3538 movlw SW_CONF ; get software configuration | 3778 movlw SW_CONF ; get software configuration |
3539 output_hex ; print as hex | 3779 output_hex ; print as hex |
3540 return | 3780 return |
3541 | 3781 |
3542 | 3782 |
3543 ;----------------------------------------------------------------------------- | 3783 ;----------------------------------------------------------------------------- |
3544 ; For the Information menu: battery voltage | 3784 ; For the Information menu: battery voltage |
3547 info_menu_battery_volts: | 3787 info_menu_battery_volts: |
3548 lfsr FSR1,tBatteryV | 3788 lfsr FSR1,tBatteryV |
3549 call strcat_text | 3789 call strcat_text |
3550 MOVII batt_voltage,mpr | 3790 MOVII batt_voltage,mpr |
3551 bsf leftbind | 3791 bsf leftbind |
3552 output_16dp .2 ; x.xxx | 3792 output_16dp .2 ; print as -x.yyy |
3553 STRCAT "V(T" | 3793 STRCAT "V(T" |
3554 movff battery_type,lo ; =0:1.5V, =1:3.6V Saft, =2:LiIon 3.7V/0.8Ah, =3:LiIon 3.7V/3.1Ah, =4: LiIon 3.7V/2.3Ah | 3794 movff battery_type,lo ; =0:1.5V, =1:3.6V Saft, =2:LiIon 3.7V/0.8Ah, =3:LiIon 3.7V/3.1Ah, =4: LiIon 3.7V/2.3Ah |
3555 output_8 | 3795 output_8 |
3556 bcf leftbind | 3796 bcf leftbind |
3557 PUTC ")" | 3797 PUTC ")" |
3558 return | 3798 return |
3559 | 3799 |
3800 | |
3801 ;----------------------------------------------------------------------------- | |
3802 ; For the Information menu: sensor C1 and C5 values | |
3803 | |
3804 global info_menu_sensor_calib | |
3805 info_menu_sensor_calib: | |
3806 lfsr FSR1,tSensorC ; locate label | |
3807 call strcat_text ; print label | |
3808 movff C1+1,WREG ; get C1, high byte | |
3809 output_hex ; print C1, high byte | |
3810 movff C1+0,WREG ; get C1, low byte | |
3811 output_hex ; print C1, low byte | |
3812 PUTC "-" ; print a separator | |
3813 movff C5+1,WREG ; get C5, high byte | |
3814 output_hex ; print C5, high byte | |
3815 movff C5+0,WREG ; get C5, low byte | |
3816 output_hex ; print C5, low byte | |
3817 return ; done | |
3818 | |
3819 | |
3820 ;----------------------------------------------------------------------------- | |
3821 ; For the Information menu: sensor depth correction | |
3822 | |
3823 global info_menu_sensor_offset | |
3824 info_menu_sensor_offset: | |
3825 lfsr FSR1,tSensorD ; locate label | |
3826 call strcat_text ; print label | |
3827 movff opt_pressure_adjust,WREG ; get pressure sensor offset | |
3828 btfsc WREG,7 ; value negative? | |
3829 bra info_menu_sensor_offset_1 ; YES | |
3830 PUTC "+" ; NO - print plus sign | |
3831 bra info_menu_sensor_offset_2 ; - continue with common part | |
3832 info_menu_sensor_offset_1: | |
3833 PUTC "-" ; print a minus sign | |
3834 negf WREG ; negate WREG | |
3835 info_menu_sensor_offset_2: | |
3836 PUTC " " ; print a space | |
3837 bsf leftbind ; start left-bind printing | |
3838 output_8 ; print value | |
3839 bcf leftbind ; end left-bind printing | |
3840 PUTC " " ; print a space | |
3841 lfsr FSR1,tMBAR ; locate unit | |
3842 call strcat_text ; print unit | |
3843 return ; done | |
3844 | |
3845 | |
3560 ;----------------------------------------------------------------------------- | 3846 ;----------------------------------------------------------------------------- |
3561 ; For the Information menu: uptime | 3847 ; For the Information menu: uptime |
3562 | 3848 |
3563 global info_menu_uptime | 3849 global info_menu_uptime |
3564 info_menu_uptime: | 3850 info_menu_uptime: |
3565 lfsr FSR1,tUptime | 3851 lfsr FSR1,tUptime |
3566 call strcat_text | 3852 call strcat_text |
3567 SMOVFF uptime,xC ; ISR-safe copy of uptime:4 to xC:4 | 3853 SMOVQQ uptime,xC ; ISR-safe copy of uptime:4 to xC:4 |
3568 | 3854 |
3569 info_menu_uptime_com: | 3855 info_menu_uptime_com: |
3570 MOVLI .3600,xB ; one hour = 3600s | 3856 MOVLI .3600,xB ; one hour = 3600s |
3571 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder -> xC+1:xC+0 holds full hours | 3857 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder -> xC+1:xC+0 holds full hours |
3572 MOVII xC,xA | 3858 MOVII xC,xA |
3573 MOVLI .24,xB ; one day = 24 hours | 3859 MOVLI .24,xB ; one day = 24 hours |
3574 call div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder -> xC+1:xC+0 holds full days, xA holds full hours | 3860 call div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder -> xC+1:xC+0 holds full days, xA holds full hours |
3575 MOVII xC,mpr ; copy full days into hi:lo | 3861 MOVII xC,mpr ; copy full days into hi:lo |
3576 bsf leftbind | 3862 bsf leftbind |
3577 output_16 | 3863 output_16 |
3578 PUTC "d" | 3864 PUTC "d" |
3579 movff xA+0,lo ; full hours | 3865 movff xA+0,lo ; full hours |
3580 output_8 | 3866 output_8 |
3581 PUTC "h" | 3867 PUTC "h" |
3582 bcf leftbind | 3868 bcf leftbind |
3583 return ; done | 3869 return ; done |
3584 | 3870 |
3585 ;----------------------------------------------------------------------------- | 3871 ;----------------------------------------------------------------------------- |
3586 | 3872 |
3587 IFDEF _compass | 3873 IFDEF _compass |
3588 | 3874 |
3728 | 4014 |
3729 ;============================================================================= | 4015 ;============================================================================= |
3730 | 4016 |
3731 global TFT_desaturation_time | 4017 global TFT_desaturation_time |
3732 TFT_desaturation_time: | 4018 TFT_desaturation_time: |
3733 rcall TFT_set_message_window ; set the row and column for the current message | 4019 rcall TFT_set_message_window ; set row and column for the message |
3734 tstfsz WREG ; is there room for the message? | 4020 tstfsz WREG ; is there room for the message? |
3735 return ; NO | 4021 return ; NO - skip message in this cycle |
3736 call TFT_memo_color | 4022 call TFT_memo_color |
3737 STRCPY "Desat:" | 4023 STRCPY "Desat:" |
3738 MOVII int_O_desaturation_time,mpr | 4024 MOVII int_O_desaturation_time,mpr |
3739 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | 4025 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) |
3740 movf lo,W ; swap hi and lo | 4026 movf lo,W ; swap hi and lo |
3741 movff hi,lo ; ... | 4027 movff hi,lo ; ... |
3742 movwf hi ; ... | 4028 movwf hi ; ... |
3743 output_99x ; hours | 4029 output_99x ; print hours |
3744 PUTC ':' | 4030 PUTC ':' ; print ":" |
3745 movff hi,lo ; minutes | 4031 movff hi,lo ; print minutes... |
3746 output_99x | 4032 output_99x ; ... in two digits, leading zero |
3747 movlw surf_warning_length ; only use surface string length | 4033 movlw surf_warning_length ; only use surface string length |
3748 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4034 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
3749 STRCAT_PRINT "" | 4035 STRCAT_PRINT "" |
3750 return | 4036 return |
3751 | 4037 |
3752 | 4038 |
3753 global TFT_nofly_time | 4039 global TFT_nofly_time |
3754 TFT_nofly_time: | 4040 TFT_nofly_time: |
3755 rcall TFT_set_message_window ; set the row and column for the current message | 4041 rcall TFT_set_message_window ; set row and column for the message |
3756 tstfsz WREG ; is there room for the message? | 4042 tstfsz WREG ; is there room for the message? |
3757 return ; NO | 4043 return ; NO - skip message in this cycle |
3758 call TFT_memo_color | 4044 call TFT_memo_color |
3759 movff char_I_altitude_wait,WREG | 4045 movff char_I_altitude_wait,WREG |
3760 tstfsz WREG | 4046 tstfsz WREG |
3761 bra TFT_nofly_time_1 | 4047 bra TFT_nofly_time_1 |
3762 STRCPY "NoFly:" | 4048 STRCPY "NoFly:" |
3780 | 4066 |
3781 ;============================================================================= | 4067 ;============================================================================= |
3782 | 4068 |
3783 global TFT_warning_agf | 4069 global TFT_warning_agf |
3784 TFT_warning_agf: | 4070 TFT_warning_agf: |
3785 rcall TFT_set_message_window ; set the row and column for the current message | 4071 rcall TFT_set_message_window ; set row and column for the message |
3786 tstfsz WREG ; is there room for the message? | 4072 tstfsz WREG ; is there room for the message? |
3787 return ; NO | 4073 return ; NO - skip message in this cycle |
3788 call TFT_attention_color | 4074 call TFT_attention_color |
3789 STRCPY_TEXT tDiveaGF_active ; "aGF!" | 4075 STRCPY_TEXT tDiveaGF_active ; "aGF!" |
3790 movlw dm_warning_length ; dive mode string length | 4076 movlw dm_warning_length ; dive mode string length |
3791 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4077 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
3792 STRCAT_PRINT "" | 4078 STRCAT_PRINT "" |
3793 bra TFT_warn_att_info_exit ; and return... | 4079 bra TFT_warn_att_info_exit ; and return... |
3794 | 4080 |
3795 | 4081 |
3796 global TFT_warning_fallback | 4082 global TFT_warning_fallback |
3797 TFT_warning_fallback: ; show fallback warning | 4083 TFT_warning_fallback: ; show fallback warning |
3798 rcall TFT_set_message_window ; set the row and column for the current message | 4084 rcall TFT_set_message_window ; set row and column for the message |
3799 tstfsz WREG ; is there room for the message? | 4085 tstfsz WREG ; is there room for the message? |
3800 return ; NO | 4086 return ; NO - skip message in this cycle |
3801 call TFT_warning_color | 4087 call TFT_warning_color |
3802 STRCPY_TEXT tDiveFallback ; "Fallback!" | 4088 STRCPY_TEXT tDiveFallback ; "Fallback!" |
3803 movlw dm_warning_length ; dive mode string length | 4089 movlw dm_warning_length ; dive mode string length |
3804 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4090 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
3805 STRCAT_PRINT "" | 4091 STRCAT_PRINT "" |
3809 | 4095 |
3810 IFDEF _rx_functions | 4096 IFDEF _rx_functions |
3811 | 4097 |
3812 global TFT_advice_switch | 4098 global TFT_advice_switch |
3813 TFT_advice_switch: | 4099 TFT_advice_switch: |
3814 rcall TFT_set_message_window ; set the row and column for the current message | 4100 rcall TFT_set_message_window ; set row and column for the message |
3815 tstfsz WREG ; is there room for the message? | 4101 tstfsz WREG ; is there room for the message? |
3816 return ; NO | 4102 return ; NO - skip message in this cycle |
3817 call TFT_advice_color | 4103 call TFT_advice_color |
3818 STRCPY_TEXT tswap ; "Swap Tank" | 4104 STRCPY_TEXT tswap ; "Swap Tank" |
3819 movlw dm_warning_length ; dive mode string length | 4105 movlw dm_warning_length ; dive mode string length |
3820 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4106 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
3821 STRCAT_PRINT "" | 4107 STRCAT_PRINT "" |
3822 bra TFT_warn_att_info_exit ; and return... | 4108 bra TFT_warn_att_info_exit ; and return... |
3823 | 4109 |
3824 global TFT_attention_transmitter | 4110 global TFT_attention_transmitter |
3825 TFT_attention_transmitter: | 4111 TFT_attention_transmitter: |
3826 rcall TFT_set_message_window ; set the row and column for the current message | 4112 rcall TFT_set_message_window ; set row and column for the message |
3827 tstfsz WREG ; is there room for the message? | 4113 tstfsz WREG ; is there room for the message? |
3828 return ; NO | 4114 return ; NO - skip message in this cycle |
3829 call TFT_attention_color | 4115 call TFT_attention_color |
3830 STRCPY_TEXT tTransmitter ; "P.Transm." | 4116 STRCPY_TEXT tTransmitter ; "P.Transm." |
3831 movlw dm_warning_length ; dive mode string length | 4117 movlw dm_warning_length ; dive mode string length |
3832 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4118 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
3833 STRCAT_PRINT "" | 4119 STRCAT_PRINT "" |
3840 bra TFT_common_pres_reading ; continue with common code | 4126 bra TFT_common_pres_reading ; continue with common code |
3841 TFT_warning_pres_reading: ; entry point for warning | 4127 TFT_warning_pres_reading: ; entry point for warning |
3842 call TFT_warning_color ; use warnings color | 4128 call TFT_warning_color ; use warnings color |
3843 ;bra TFT_common_pres_reading ; continue with common code | 4129 ;bra TFT_common_pres_reading ; continue with common code |
3844 TFT_common_pres_reading: | 4130 TFT_common_pres_reading: |
3845 rcall TFT_set_message_window ; set the row and column for the current message | 4131 rcall TFT_set_message_window ; set row and column for the message |
3846 tstfsz WREG ; is there room for the message? | 4132 tstfsz WREG ; is there room for the message? |
3847 return ; NO - done | 4133 return ; NO - skip message in this cycle |
3848 STRCPY_TEXT tPressure ; "Tank Pres" | 4134 STRCPY_TEXT tPressure ; "Tank Pres" |
3849 movlw dm_warning_length ; dive mode string length | 4135 movlw dm_warning_length ; dive mode string length |
3850 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4136 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) |
3851 STRCAT_PRINT "" | 4137 STRCAT_PRINT "" |
3852 bra TFT_warn_att_info_exit ; and return... | 4138 bra TFT_warn_att_info_exit ; and return... |
3853 | 4139 |
3854 global TFT_attention_sac | 4140 global TFT_attention_sac |
3855 TFT_attention_sac: | 4141 TFT_attention_sac: |
3856 rcall TFT_set_message_window ; set the row and column for the current message | 4142 rcall TFT_set_message_window ; set row and column for the message |
3857 tstfsz WREG ; is there room for the message? | 4143 tstfsz WREG ; is there room for the message? |
3858 return ; NO | 4144 return ; NO - skip message in this cycle |
3859 MOVII int_O_SAC_measured,mpr ; copy measured SAC rate to hi:lo | 4145 MOVII int_O_SAC_measured,mpr ; copy measured SAC rate to hi:lo |
3860 call TFT_color_code_tank_pres_sac; color-code the output | 4146 call TFT_color_code_tank_pres_sac; color-code the output |
3861 STRCPY_TEXT tSAC ; "SAC", needs to be exactly 3 chars long | 4147 STRCPY_TEXT tSAC ; "SAC", needs to be exactly 3 chars long |
3862 STRCAT ": " ; ": " | 4148 STRCAT ": " ; ": " |
3863 output_16_3 ; print as xxx | 4149 output_16_3 ; print as xxx |
3872 | 4158 |
3873 ;============================================================================= | 4159 ;============================================================================= |
3874 | 4160 |
3875 global TFT_info_deco | 4161 global TFT_info_deco |
3876 TFT_info_deco ; show info when decompression obligation is steady or decreasing | 4162 TFT_info_deco ; show info when decompression obligation is steady or decreasing |
3877 rcall TFT_set_message_window ; set the row and column for the current message | 4163 rcall TFT_set_message_window ; set row and column for the message |
3878 tstfsz WREG ; is there room for the message? | 4164 tstfsz WREG ; is there room for the message? |
3879 return ; NO - return | 4165 return ; NO - skip message in this cycle |
3880 call TFT_advice_color ; YES - actually it is a memo, but we break the rules here and display in advice color (green) | 4166 call TFT_advice_color ; YES - actually it is a memo, but we break the rules here and display in advice color (green) |
3881 STRCPY_TEXT tDecoInfo ; - write "Deco Zone" | 4167 STRCPY_TEXT tDecoInfo ; - write "Deco Zone" |
3882 movlw dm_warning_length ; - select dive mode string length | 4168 movlw dm_warning_length ; - select dive mode string length |
3883 rcall TFT_fillup_with_spaces ; - fill up FSR2 with spaces (total string length in #WREG) | 4169 rcall TFT_fillup_with_spaces ; - fill up FSR2 with spaces (total string length in #WREG) |
3884 STRCAT_PRINT "" ; - print buffer | 4170 STRCAT_PRINT "" ; - print buffer |
3888 | 4174 |
3889 IFDEF _cave_mode | 4175 IFDEF _cave_mode |
3890 | 4176 |
3891 global TFT_info_cave_mode | 4177 global TFT_info_cave_mode |
3892 TFT_info_cave_mode: | 4178 TFT_info_cave_mode: |
3893 rcall TFT_set_message_window ; sets the row and column for the current warning | 4179 rcall TFT_set_message_window ; set row and column for the message |
3894 tstfsz WREG ; is there room for the message? | 4180 tstfsz WREG ; is there room for the message? |
3895 return ; NO - return | 4181 return ; NO - skip message in this cycle |
3896 call TFT_memo_color ; YES - set memo color | 4182 call TFT_memo_color ; YES - set memo color |
3897 STRCPY_TEXT tCaveMode ; write "Cave Mode" | 4183 bsf win_invert ; - print in inverse |
3898 movlw dm_warning_length ; select dive mode string length | 4184 STRCPY_TEXT tCaveMode ; - write "Cave Mode" |
3899 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | 4185 movlw dm_warning_length ; - select dive mode string length |
3900 STRCAT_PRINT "" ; print buffer | 4186 rcall TFT_fillup_with_spaces ; - fill up FSR2 with spaces (total string length in #WREG) |
4187 STRCAT_PRINT "" ; - print buffer | |
4188 bcf win_invert ; - end inverse printing | |
4189 bra TFT_warn_att_info_exit ; - and return... | |
4190 | |
4191 | |
4192 global TFT_cave_shutdown_attention | |
4193 TFT_cave_shutdown_attention: | |
4194 rcall TFT_set_message_window ; set row and column for the message | |
4195 tstfsz WREG ; is there room for the message? | |
4196 return ; NO - skip message in this cycle | |
4197 call TFT_attention_color ; YES - set warning color | |
4198 bra TFT_cave_shutdown_common ; - continue with common part | |
4199 | |
4200 | |
4201 global TFT_cave_shutdown_warning | |
4202 TFT_cave_shutdown_warning: | |
4203 rcall TFT_set_message_window ; set row and column for the message | |
4204 tstfsz WREG ; is there room for the message? | |
4205 return ; NO - skip message in this cycle | |
4206 call TFT_warning_color ; YES - set warning color | |
4207 ;bra TFT_cave_shutdown_common ; - continue with common part | |
4208 | |
4209 TFT_cave_shutdown_common: | |
4210 STRCPY_TEXT tCaveModeShutdown ; write "X-Cave-X" | |
4211 movlw dm_warning_length ; select dive mode string length | |
4212 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | |
4213 STRCAT_PRINT "" ; print buffer | |
3901 bra TFT_warn_att_info_exit ; and return... | 4214 bra TFT_warn_att_info_exit ; and return... |
3902 | 4215 |
3903 global TFT_info_dive_turned | 4216 ENDIF ; _cave_mode |
3904 TFT_info_dive_turned: | 4217 |
3905 rcall TFT_set_message_window ; sets the row and column for the current warning | 4218 ;============================================================================= |
4219 | |
4220 global TFT_warning_saturation | |
4221 TFT_warning_saturation | |
4222 rcall TFT_set_message_window ; set row and column for the message | |
3906 tstfsz WREG ; is there room for the message? | 4223 tstfsz WREG ; is there room for the message? |
3907 return ; NO - return | 4224 return ; NO - skip message in this cycle |
3908 call TFT_attention_color ; YES - set attention color | |
3909 STRCPY_TEXT tDiveTurned ; write "Dv.turned" | |
3910 movlw dm_warning_length ; select dive mode string length | |
3911 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | |
3912 STRCAT_PRINT "" ; print buffer | |
3913 bra TFT_warn_att_info_exit ; and return... | |
3914 | |
3915 global TFT_warn_cave_shutdown | |
3916 TFT_warn_cave_shutdown: | |
3917 rcall TFT_set_message_window ; sets the row and column for the current warning | |
3918 tstfsz WREG ; is there room for the message? | |
3919 return ; NO - return | |
3920 call TFT_warning_color ; YES - set warning color | |
3921 STRCPY_TEXT tCaveModeShutdown ; write "X-Cave-X" | |
3922 movlw dm_warning_length ; select dive mode string length | |
3923 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | |
3924 STRCAT_PRINT "" ; print buffer | |
3925 bra TFT_warn_att_info_exit ; and return... | |
3926 | |
3927 ENDIF ; _cave_mode | |
3928 | |
3929 ;============================================================================= | |
3930 | |
3931 global TFT_warning_sat | |
3932 TFT_warning_sat ; Saturation | |
3933 rcall TFT_set_message_window ; set the row and column for the current message | |
3934 tstfsz WREG ; is there room for the message? | |
3935 return ; NO | |
3936 MOVII int_O_lead_supersat,mpr ; bank-safe copy of leading tissue's supersaturation | 4225 MOVII int_O_lead_supersat,mpr ; bank-safe copy of leading tissue's supersaturation |
3937 call TFT_color_code_gf ; color-code output | 4226 call TFT_color_code_gf ; color-code output |
3938 ; STRCPY "GF: " ; the two spaces are on purpose to align the output with other warnings' outputs | 4227 ; STRCPY "GF: " ; the two spaces are on purpose to align the output with other warnings' outputs |
3939 STRCPY_TEXT tSAT ; print "Sat:" | 4228 STRCPY_TEXT tSAT ; print "Sat:" |
3940 PUTC " " ; add a space to align the output with other warnings' outputs | 4229 PUTC " " ; add a space to align the output with other warnings' outputs |
3952 goto TFT_standard_color ; and return... | 4241 goto TFT_standard_color ; and return... |
3953 | 4242 |
3954 | 4243 |
3955 global TFT_warning_mbubbles | 4244 global TFT_warning_mbubbles |
3956 TFT_warning_mbubbles: | 4245 TFT_warning_mbubbles: |
3957 rcall TFT_set_message_window ; sets the row and column for the current warning | 4246 rcall TFT_set_message_window ; set row and column for the message |
3958 tstfsz WREG ; is there room for the message? | 4247 tstfsz WREG ; is there room for the message? |
3959 return ; NO | 4248 return ; NO - skip message in this cycle |
3960 call TFT_attention_color ; set attention color as default | 4249 call TFT_attention_color ; set attention color as default |
3961 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | 4250 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings |
3962 btfsc WREG,mbubble_warning ; are we in the microbubbles zone right now? | 4251 btfsc WREG,mbubble_warning ; are we in the micro bubbles zone right now? |
3963 call TFT_warning_color ; YES - reconfigure to warning color | 4252 call TFT_warning_color ; YES - reconfigure to warning color |
3964 STRCPY_TEXT tMicroBubbles | 4253 STRCPY_TEXT tMicroBubbles |
3965 movlw dm_warning_length ; dive mode string length | 4254 movlw dm_warning_length ; dive mode string length |
3966 btfss divemode ; in dive mode? | 4255 btfss divemode ; in dive mode? |
3967 movlw surf_warning_length ; NO - use surface string length | 4256 movlw surf_warning_length ; NO - use surface string length |
3970 bra TFT_warn_att_info_exit ; and return... | 4259 bra TFT_warn_att_info_exit ; and return... |
3971 | 4260 |
3972 | 4261 |
3973 global TFT_warning_outside | 4262 global TFT_warning_outside |
3974 TFT_warning_outside: | 4263 TFT_warning_outside: |
3975 rcall TFT_set_message_window ; sets the row and column for the current warning | 4264 rcall TFT_set_message_window ; set row and column for the message |
3976 tstfsz WREG ; is there room for the message? | 4265 tstfsz WREG ; is there room for the message? |
3977 return ; NO | 4266 return ; NO - skip message in this cycle |
3978 call TFT_attention_color | 4267 call TFT_attention_color |
3979 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | 4268 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings |
3980 btfsc WREG,outside_warning ; are we outside the ZH-L16 model right now? | 4269 btfsc WREG,outside_warning ; are we outside the ZH-L16 model right now? |
3981 call TFT_warning_color ; YES - reconfigure to warning color | 4270 call TFT_warning_color ; YES - reconfigure to warning color |
3982 STRCPY "X-ZHL16-X" | 4271 STRCPY "X-ZHL16-X" |
3988 bra TFT_warn_att_info_exit ; and return... | 4277 bra TFT_warn_att_info_exit ; and return... |
3989 | 4278 |
3990 | 4279 |
3991 global TFT_warning_depth | 4280 global TFT_warning_depth |
3992 TFT_warning_depth: | 4281 TFT_warning_depth: |
3993 rcall TFT_set_message_window ; sets the row and column for the current warning | 4282 rcall TFT_set_message_window ; set row and column for the message |
3994 tstfsz WREG ; is there room for the message? | 4283 tstfsz WREG ; is there room for the message? |
3995 return ; NO | 4284 return ; NO - skip message in this cycle |
3996 call TFT_warning_color | 4285 call TFT_warning_color |
3997 STRCPY_TEXT tMaxDepth ; "max.Depth" | 4286 STRCPY_TEXT tMaxDepth ; "max.Depth" |
3998 movlw dm_warning_length ; dive mode string length | 4287 movlw dm_warning_length ; dive mode string length |
3999 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) | 4288 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) |
4000 STRCAT_PRINT "" | 4289 STRCAT_PRINT "" |
4001 bra TFT_warn_att_info_exit ; and return... | 4290 bra TFT_warn_att_info_exit ; and return... |
4002 | 4291 |
4003 | 4292 |
4004 global TFT_warning_gas_needs_warn | 4293 global TFT_warning_gas_needs |
4005 TFT_warning_gas_needs_warn: | 4294 TFT_warning_gas_needs: |
4006 rcall TFT_set_message_window ; set the row and column for the current message | 4295 rcall TFT_set_message_window ; set row and column for the message |
4007 tstfsz WREG ; is there room for the message? | 4296 tstfsz WREG ; is there room for the message? |
4008 return ; NO | 4297 return ; NO - skip message in this cycle |
4009 call TFT_warning_color ; YES - set warning color | 4298 call TFT_warning_color ; YES - set warning color |
4010 bra TFT_warning_gas_needs_com ; - continue with common part | 4299 bra TFT_warning_gas_needs_com ; - continue with common part |
4011 | 4300 |
4012 global TFT_warning_gas_needs_att | 4301 global TFT_attention_gas_needs |
4013 TFT_warning_gas_needs_att: | 4302 TFT_attention_gas_needs: |
4014 rcall TFT_set_message_window ; set the row and column for the current message | 4303 rcall TFT_set_message_window ; set row and column for the message |
4015 tstfsz WREG ; is there room for the message? | 4304 tstfsz WREG ; is there room for the message? |
4016 return ; NO | 4305 return ; NO - skip message in this cycle |
4017 call TFT_attention_color ; YES - set attention color | 4306 call TFT_attention_color ; YES - set attention color |
4018 ;bra TFT_warning_gas_needs_com ; - continue with common part | 4307 ;bra TFT_warning_gas_needs_com ; - continue with common part |
4019 | 4308 |
4020 TFT_warning_gas_needs_com: | 4309 TFT_warning_gas_needs_com: |
4021 STRCPY_TEXT tGasNeedsWarn ; print "Gas Needs" | 4310 STRCPY_TEXT tGasNeedsWarn ; print "Gas Needs" |
4028 | 4317 |
4029 IFDEF _helium | 4318 IFDEF _helium |
4030 | 4319 |
4031 global TFT_warning_IBCD | 4320 global TFT_warning_IBCD |
4032 TFT_warning_IBCD: | 4321 TFT_warning_IBCD: |
4033 rcall TFT_set_message_window ; set the row and column for the current message | 4322 rcall TFT_set_message_window ; set row and column for the message |
4034 tstfsz WREG ; is there room for the message? | 4323 tstfsz WREG ; is there room for the message? |
4035 return ; NO | 4324 return ; NO - skip message in this cycle |
4036 call TFT_attention_color ; select attention color as default | 4325 call TFT_attention_color ; select attention color as default |
4037 STRCPY_TEXT tIBCD ; "IBCD N2He" | 4326 STRCPY_TEXT tIBCD ; "IBCD N2He" |
4038 movlw dm_warning_length ; dive mode string length | 4327 movlw dm_warning_length ; dive mode string length |
4039 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) | 4328 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) |
4040 STRCAT_PRINT "" | 4329 STRCAT_PRINT "" |
4044 | 4333 |
4045 ;============================================================================= | 4334 ;============================================================================= |
4046 | 4335 |
4047 global TFT_warning_no_BO_gas | 4336 global TFT_warning_no_BO_gas |
4048 TFT_warning_no_BO_gas: | 4337 TFT_warning_no_BO_gas: |
4049 rcall TFT_set_message_window ; set the row and column for the current message | 4338 rcall TFT_set_message_window ; set row and column for the message |
4050 tstfsz WREG ; is there room for the message? | 4339 tstfsz WREG ; is there room for the message? |
4051 return ; NO | 4340 return ; NO - skip message in this cycle |
4052 call TFT_warning_color ; select warning color | 4341 call TFT_warning_color ; select warning color |
4053 STRCPY_TEXT tnoBOgas ; print "-B/O-Gas-" | 4342 STRCPY_TEXT tnoBOgas ; print "-B/O-Gas-" |
4054 movlw dm_warning_length ; dive mode string length | 4343 movlw dm_warning_length ; dive mode string length |
4055 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) | 4344 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) |
4056 STRCAT_PRINT "" ; finalize output | 4345 STRCAT_PRINT "" ; finalize output |
4057 bra TFT_warn_att_info_exit ; and return... | 4346 bra TFT_warn_att_info_exit ; and return... |
4058 | 4347 |
4059 | 4348 |
4060 global TFT_advice_gas_change | 4349 global TFT_advice_gas_change |
4061 TFT_advice_gas_change: | 4350 TFT_advice_gas_change: |
4062 rcall TFT_set_message_window ; set the row and column for the current message | 4351 rcall TFT_set_message_window ; set row and column for the message |
4063 tstfsz WREG ; is there room for the message? | 4352 tstfsz WREG ; is there room for the message? |
4064 return ; NO | 4353 return ; NO - skip message in this cycle |
4065 call TFT_advice_color ; set advice color | 4354 call TFT_advice_color ; set advice color |
4066 STRCPY_TEXT tgaschange ; "Change?" | 4355 STRCPY_TEXT tgaschange ; "Change?" |
4067 movlw dm_warning_length ; dive mode string length | 4356 movlw dm_warning_length ; dive mode string length |
4068 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) | 4357 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) |
4069 STRCAT_PRINT "" | 4358 STRCAT_PRINT "" |
4072 ;============================================================================= | 4361 ;============================================================================= |
4073 | 4362 |
4074 IFDEF _external_sensor | 4363 IFDEF _external_sensor |
4075 | 4364 |
4076 global TFT_warning_sensor_disagree | 4365 global TFT_warning_sensor_disagree |
4077 TFT_warning_sensor_disagree: ; show sensor disagree warning | 4366 TFT_warning_sensor_disagree: |
4078 rcall TFT_set_message_window ; set the row and column for the current message | 4367 rcall TFT_set_message_window ; set row and column for the message |
4079 tstfsz WREG ; is there room for the message? | 4368 tstfsz WREG ; is there room for the message? |
4080 return ; NO | 4369 return ; NO - skip message in this cycle |
4081 call TFT_warning_color | 4370 call TFT_warning_color |
4082 STRCPY_TEXT tSensorDisagree ; "Sensors<>" | 4371 STRCPY_TEXT tSensorDisagree ; "Sensors<>" |
4083 movlw dm_warning_length ; dive mode string length | 4372 movlw dm_warning_length ; dive mode string length |
4084 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) | 4373 rcall TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) |
4085 STRCAT_PRINT "" | 4374 STRCAT_PRINT "" |
4087 | 4376 |
4088 ENDIF ; _external_sensor | 4377 ENDIF ; _external_sensor |
4089 | 4378 |
4090 ;============================================================================= | 4379 ;============================================================================= |
4091 | 4380 |
4092 TFT_set_message_window: ; set the row and column for the current message | 4381 TFT_set_message_window: ; sets the row and column for the current message |
4093 ; ignore warning (now)? | 4382 ; ignore warning (now)? |
4094 decf message_counter,W ; load (message counter - 1) into WREG | 4383 decf message_counter,W ; load (message counter - 1) into WREG |
4095 bcf STATUS,C ; clear carry bit | 4384 bcf STATUS,C ; clear carry bit |
4096 btfss alt_layout_active ; in alternative layout? | 4385 btfss alt_layout_active ; in alternative layout? |
4097 rrcf WREG,W ; NO - divide (message_counter-1) by 2 to get the page of the message | 4386 rrcf WREG,W ; NO - divide (message_counter-1) by 2 to get the page of the message |
4136 retlw .0 ; show in this cycle (message window is defined) | 4425 retlw .0 ; show in this cycle (message window is defined) |
4137 | 4426 |
4138 | 4427 |
4139 global TFT_msg_batt_percent_divemode | 4428 global TFT_msg_batt_percent_divemode |
4140 TFT_msg_batt_percent_divemode: | 4429 TFT_msg_batt_percent_divemode: |
4141 rcall TFT_set_message_window ; set the row and column for the current message | 4430 rcall TFT_set_message_window ; set row and column for the message |
4142 tstfsz WREG ; is there room for the message? | 4431 tstfsz WREG ; is there room for the message? |
4143 return ; NO | 4432 return ; NO - skip message in this cycle |
4144 movff batt_percent,lo ; get battery percent | 4433 movff batt_percent,lo ; get battery percent |
4145 call TFT_color_code_battery ; color-code battery percent | 4434 call TFT_color_code_battery ; color-code battery percent |
4146 STRCPY "Batt:" | 4435 STRCPY "Batt:" |
4147 bsf leftbind | 4436 bsf leftbind |
4148 output_8 | 4437 output_8 |
4218 | 4507 |
4219 | 4508 |
4220 global TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues | 4509 global TFT_ceiling_GF_tissue ; data for ceiling, current GF and tissues |
4221 TFT_ceiling_GF_tissue: | 4510 TFT_ceiling_GF_tissue: |
4222 WIN_MEDIUM dm_custom_ceiling_column,dm_custom_ceiling_row | 4511 WIN_MEDIUM dm_custom_ceiling_column,dm_custom_ceiling_row |
4223 MOVII int_O_ceiling,mpr | 4512 MOVII int_O_ceiling,mpr ; get ceiling in [mbar] relative pressure |
4224 call TFT_color_code_ceiling ; color-code the output | 4513 call TFT_color_code_ceiling ; color-code the output (also strips off flags) |
4225 call adjust_depth_with_salinity ; compute salinity setting into hi:lo [mbar] | 4514 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
4226 bsf leftbind | |
4227 TSTOSS opt_units ; 0=m, 1=ft | 4515 TSTOSS opt_units ; 0=m, 1=ft |
4228 bra TFT_ceiling_tissue_cGF_m | 4516 bra TFT_ceiling_tissue_cGF_m |
4229 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 4517 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
4230 output_16 ; yxz | 4518 output_16_3 ; yxz |
4231 bra TFT_ceiling_tissue_cGF0 | 4519 bra TFT_ceiling_tissue_cGF0 |
4232 TFT_ceiling_tissue_cGF_m: | 4520 TFT_ceiling_tissue_cGF_m: |
4521 bsf leftbind | |
4233 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) | 4522 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) |
4234 output_16dp .3 ; yxz.a | 4523 output_16dp .3 ; yxz.a |
4524 bcf leftbind | |
4235 TFT_ceiling_tissue_cGF0: | 4525 TFT_ceiling_tissue_cGF0: |
4236 bcf leftbind | |
4237 STRCAT_PRINT " " | 4526 STRCAT_PRINT " " |
4238 ; Show tissue diagram | 4527 ; Show tissue diagram |
4239 call TFT_dive_tissues ; show tissue pressure diagram | 4528 call TFT_dive_tissues ; show tissue pressure diagram |
4240 ; Show current supersaturation | 4529 ; Show current supersaturation |
4241 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row | 4530 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row |
4287 ; Show Battery Volt | 4576 ; Show Battery Volt |
4288 call TFT_memo_color | 4577 call TFT_memo_color |
4289 WIN_SMALL dm_custom_battery_column, dm_custom_battery_volt_row | 4578 WIN_SMALL dm_custom_battery_column, dm_custom_battery_volt_row |
4290 MOVII batt_voltage,mpr | 4579 MOVII batt_voltage,mpr |
4291 bsf leftbind | 4580 bsf leftbind |
4292 output_16dp .2 | 4581 output_16dp .2 ; print as -x.yyy |
4293 PUTC 'V' | 4582 PUTC 'V' |
4294 movff buffer+5,buffer+4 | 4583 movff buffer+5,buffer+4 |
4295 movlw 0x00 | 4584 movlw 0x00 |
4296 movff WREG,buffer+5 ; only "x.yzV" | 4585 movff WREG,buffer+5 ; only "x.yzV" |
4297 STRCAT_PRINT "" | 4586 STRCAT_PRINT "" |
4350 | 4639 |
4351 ENDIF ; _ccr_psrc | 4640 ENDIF ; _ccr_psrc |
4352 | 4641 |
4353 ;============================================================================= | 4642 ;============================================================================= |
4354 | 4643 |
4355 global TFT_gas_needs_ascent_mask ; mask for gas needs ascent | 4644 global TFT_gas_needs_mask ; mask for gas needs ascent |
4356 TFT_gas_needs_ascent_mask: | 4645 TFT_gas_needs_mask: |
4357 WIN_TINY dm_custom_gas_column_title, dm_custom_gas_mask_row | 4646 WIN_TINY dm_custom_gas_column_title, dm_custom_gas_mask_row |
4358 call TFT_divemask_color | 4647 call TFT_divemask_color |
4359 IFDEF _cave_mode | 4648 IFDEF _cave_mode |
4360 movff char_O_deco_info,WREG ; get the deco info vector | 4649 movff char_O_deco_info,WREG ; get the deco info vector |
4361 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? | 4650 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? |
4368 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" | 4657 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" |
4369 TFT_gas_needs_mask_ascent_2: | 4658 TFT_gas_needs_mask_ascent_2: |
4370 ELSE | 4659 ELSE |
4371 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" | 4660 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" |
4372 ENDIF | 4661 ENDIF |
4662 movff char_O_deco_info,WREG ; get the deco info vector | |
4663 btfss WREG,gas_needs_fTTS ; are the gas needs calculated for fTTS? | |
4664 bra TFT_gas_needs_mask_ascent_3 ; NO - continue | |
4665 STRCAT " fTTS" ; YES - append fTTS marking | |
4666 TFT_gas_needs_mask_ascent_3: | |
4373 STRCAT_PRINT " (bar)" ; " (bar)" | 4667 STRCAT_PRINT " (bar)" ; " (bar)" |
4374 bra TFT_custview_exit1 ; and return... | 4668 bra TFT_custview_exit1 ; and return... |
4375 | 4669 |
4376 | 4670 |
4377 global TFT_gas_needs_ascent ; data for gas needs ascent | 4671 global TFT_gas_needs ; data for gas needs ascent |
4378 TFT_gas_needs_ascent: ; LIMITATION: there is only space for 4 gases on the screen - if 5 gases have a pres_need > 0, then only the first 4 will be shown! | 4672 TFT_gas_needs: ; LIMITATION: there is only space for 4 gases on the screen - if 5 gases have a pres_need > 0, then only the first 4 will be shown! |
4379 IFDEF _cave_mode | 4673 IFDEF _cave_mode |
4380 movff char_O_deco_info,WREG ; get deco info vector | 4674 movff char_O_deco_info,WREG ; get deco info vector |
4381 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? | 4675 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? |
4382 bra TFT_gas_needs_ascent_1 ; NO - continue below... | 4676 bra TFT_gas_needs_ascent_1 ; NO - continue below... |
4383 btfsc gas_needs_mode_last ; YES - were the last results calculated for cave mode? | 4677 btfsc gas_needs_mode_last ; YES - were the last results calculated for cave mode? |
4386 TFT_gas_needs_ascent_1: | 4680 TFT_gas_needs_ascent_1: |
4387 btfss gas_needs_mode_last ; NO - were the last results calculated for direct ascent? | 4681 btfss gas_needs_mode_last ; NO - were the last results calculated for direct ascent? |
4388 bra TFT_gas_needs_ascent_3 ; YES - mask still valid | 4682 bra TFT_gas_needs_ascent_3 ; YES - mask still valid |
4389 ;bra TFT_gas_needs_ascent_2 ; NO - redraw mask | 4683 ;bra TFT_gas_needs_ascent_2 ; NO - redraw mask |
4390 TFT_gas_needs_ascent_2: | 4684 TFT_gas_needs_ascent_2: |
4391 rcall TFT_gas_needs_ascent_mask ; redraw mask | 4685 rcall TFT_gas_needs_mask ; redraw mask |
4392 TFT_gas_needs_ascent_3: | 4686 TFT_gas_needs_ascent_3: |
4393 ENDIF | 4687 ENDIF |
4394 clrf up ; initialize gas index (0-4) | 4688 clrf up ; initialize gas index (0-4) |
4395 WIN_SMALL dm_custom_gas_column1+.5,dm_custom_gas_row1 | 4689 WIN_SMALL dm_custom_gas_column1+.5,dm_custom_gas_row1 |
4396 rcall TFT_gas_needs_helper | 4690 rcall TFT_gas_needs_helper |
4398 rcall TFT_gas_needs_helper | 4692 rcall TFT_gas_needs_helper |
4399 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row1 | 4693 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row1 |
4400 rcall TFT_gas_needs_helper | 4694 rcall TFT_gas_needs_helper |
4401 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row2 | 4695 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row2 |
4402 rcall TFT_gas_needs_helper | 4696 rcall TFT_gas_needs_helper |
4403 return | 4697 bra TFT_custview_exit2 ; and return... |
4404 | 4698 |
4405 TFT_gas_needs_helper: | 4699 TFT_gas_needs_helper: |
4406 call TFT_memo_color | 4700 call TFT_memo_color |
4407 movlw .5 ; number of gases | 4701 movlw .5 ; number of gases |
4408 cpfslt up ; check if all gases have been processed | 4702 cpfslt up ; check if all gases have been processed |
4445 bcf hi,int_high_flag ; clear flag for > 999 bar | 4739 bcf hi,int_high_flag ; clear flag for > 999 bar |
4446 bcf hi,int_invalid_flag ; clear flag for invalid data (will actually only be set with 1st gas) | 4740 bcf hi,int_invalid_flag ; clear flag for invalid data (will actually only be set with 1st gas) |
4447 output_16_3 ; limit to 999 and display only (0-999) | 4741 output_16_3 ; limit to 999 and display only (0-999) |
4448 STRCAT_PRINT " " ; adds a space to overwrite any potential remains of earlier outputs | 4742 STRCAT_PRINT " " ; adds a space to overwrite any potential remains of earlier outputs |
4449 incf up,F ; increment to next gas | 4743 incf up,F ; increment to next gas |
4450 bra TFT_custview_exit2 ; and return... | 4744 return ; done |
4451 | 4745 |
4452 | 4746 |
4453 global TFT_show_ppo2_mask ; helper function for several custom views | 4747 global TFT_show_ppo2_mask ; helper function for several custom views |
4454 TFT_show_ppo2_mask: | 4748 TFT_show_ppo2_mask: |
4455 call TFT_divemask_color | 4749 call TFT_divemask_color |
4505 STRCAT_PRINT "" | 4799 STRCAT_PRINT "" |
4506 call TFT_standard_color | 4800 call TFT_standard_color |
4507 ; Show END/EAD | 4801 ; Show END/EAD |
4508 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row | 4802 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row |
4509 STRCPY_TEXT tEAD ; EAD: | 4803 STRCPY_TEXT tEAD ; EAD: |
4510 movff char_O_EAD,lo | 4804 MOVII int_O_EAD_pres,mpr ; copy EAD in [mbar] to MPR |
4511 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | 4805 rcall TFT_end_ead_common ; convert to depth, print and limit to 8 chars |
4512 WIN_SMALL dm_custom_end_column, dm_custom_end_row | 4806 WIN_SMALL dm_custom_end_column, dm_custom_end_row |
4513 STRCPY_TEXT tEND ; END: | 4807 STRCPY_TEXT tEND ; END: |
4514 movff char_O_END,lo | 4808 MOVII int_O_END_pres,mpr ; copy END in [mbar] to MPR |
4515 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | 4809 rcall TFT_end_ead_common ; convert to depth, print and limit to 8 chars |
4516 IFDEF _helium | 4810 IFDEF _helium |
4517 ; Show Gas Density | 4811 ; Show Gas Density |
4518 WIN_MEDIUM dm_custom_cns_column-.5, dm_custom_cns_row | 4812 WIN_MEDIUM dm_custom_cns_column-.5, dm_custom_cns_row |
4519 MOVII int_O_gas_density,mpr ; get current gas density | 4813 MOVII int_O_gas_density,mpr ; get current gas density |
4520 call TFT_color_code_cns_1 ; color-code output | 4814 call TFT_color_code_cns_1 ; color-code output |
4521 bsf leftbind ; print left-aligned | 4815 bsf leftbind ; print left-aligned |
4522 movlw .2 ; suppress first and second digit | 4816 movlw .2 ; suppress first and second digit |
4523 movwf ignore_digits ; ... | 4817 movwf ignore_digits ; ... |
4524 output_16dp .2 ; print as --x.yy | 4818 output_16dp .2 ; print as -x.yyy |
4525 bcf leftbind ; back to normal alignment | 4819 bcf leftbind ; back to normal alignment |
4526 STRCAT_PRINT "" ; finalize output | 4820 STRCAT_PRINT "" ; finalize output |
4527 ELSE | 4821 ELSE |
4528 ; Show CNS | 4822 ; Show CNS |
4529 WIN_STD dm_custom_cns_column+.3, dm_custom_cns_row | 4823 WIN_STD dm_custom_cns_column+.3, dm_custom_cns_row |
4535 STRCAT_PRINT "%" | 4829 STRCAT_PRINT "%" |
4536 ENDIF | 4830 ENDIF |
4537 TFT_custview_exit2: | 4831 TFT_custview_exit2: |
4538 goto TFT_standard_color ; and return... | 4832 goto TFT_standard_color ; and return... |
4539 | 4833 |
4540 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | 4834 TFT_end_ead_common: |
4541 bsf leftbind | 4835 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] |
4542 TSTOSS opt_units ; 0=Meter, 1=Feet | 4836 TSTOSS opt_units ; 0=Meter, 1=Feet |
4543 bra TFT_end_ead_common_metric | 4837 bra TFT_end_ead_common_metric ; 0: meter |
4838 ;bra TFT_end_ead_common_imperial ; 1: feet | |
4839 | |
4544 TFT_end_ead_common_imperial: | 4840 TFT_end_ead_common_imperial: |
4545 movf lo,W ; with lo in m | 4841 call convert_cm_to_feet ; convert depth in [cm] to depth in [feet] |
4546 mullw .100 ; PRODL:PRODH = mbar/min | 4842 output_16_3 ; print as xyz |
4547 MOVII PRODL,mpr | |
4548 call convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | |
4549 output_16_3 | |
4550 STRCAT_TEXT tFeets | |
4551 clrf WREG | |
4552 movff WREG,buffer+.8 ; limit string length to 8 | |
4553 bra TFT_end_ead_common_exit | 4843 bra TFT_end_ead_common_exit |
4844 | |
4554 TFT_end_ead_common_metric: | 4845 TFT_end_ead_common_metric: |
4555 output_8 | 4846 bsf ignore_digit4 ; no decimals (flag will be cleared by output_16) |
4556 STRCAT_TEXT tMeters | 4847 output_16dp .3 ; print as yxz.-- |
4848 movlw 'm' ; hard-coded unit | |
4849 movff WREG,buffer+.7 ; place the unit onto the decimal point | |
4850 ;bra TFT_end_ead_common_exit | |
4851 | |
4557 TFT_end_ead_common_exit: | 4852 TFT_end_ead_common_exit: |
4558 bcf leftbind | 4853 STRCAT_PRINT "" ; finalize output |
4559 movlw .8 | 4854 return ; done |
4560 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in #WREG) | |
4561 STRCAT_PRINT "" | |
4562 return | |
4563 | 4855 |
4564 ;============================================================================= | 4856 ;============================================================================= |
4565 | 4857 |
4566 IFDEF _ccr_pscr | 4858 IFDEF _ccr_pscr |
4567 | 4859 |
4630 movff hi,lo ; | 4922 movff hi,lo ; |
4631 output_99x ; | 4923 output_99x ; |
4632 STRCAT_PRINT "m " ; | 4924 STRCAT_PRINT "m " ; |
4633 bra TFT_surface_lastdive_2 ; | 4925 bra TFT_surface_lastdive_2 ; |
4634 TFT_surface_lastdive_1: | 4926 TFT_surface_lastdive_1: |
4635 SMOVFF surface_interval_secs,xC ; ISR-safe copy of surface_interval_secs:4 to xC:4 | 4927 SMOVQQ surface_interval_secs,xC ; ISR-safe copy of surface_interval_secs:4 to xC:4 |
4636 call info_menu_uptime_com ; use part of info_menu_uptime to convert and display in days and hours | 4928 call info_menu_uptime_com ; use part of info_menu_uptime to convert and display in days and hours |
4929 STRCAT_PRINT "" ; finalize output | |
4637 TFT_surface_lastdive_2: | 4930 TFT_surface_lastdive_2: |
4638 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) | 4931 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) |
4639 MOVII lastdive_duration,mpr ; get duration of last dive, minutes | 4932 MOVII lastdive_duration,mpr ; get duration of last dive, minutes |
4640 bsf leftbind ; print without leading spaces | 4933 bsf leftbind ; print without leading spaces |
4641 output_16 ; dive time minutes | 4934 output_16 ; dive time minutes |
4643 movff lastdive_duration+2,lo ; get duration of last dive, seconds | 4936 movff lastdive_duration+2,lo ; get duration of last dive, seconds |
4644 output_99x ; print seconds | 4937 output_99x ; print seconds |
4645 rcall TFT_surface_common ; finalize output | 4938 rcall TFT_surface_common ; finalize output |
4646 TFT_surface_lastdive_3: | 4939 TFT_surface_lastdive_3: |
4647 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) | 4940 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) |
4648 MOVII lastdive_maxdepth,mpr | 4941 MOVII lastdive_maxdepth,mpr ; get max depth of last dive |
4649 call adjust_depth_with_salinity ; compute (current) salinity setting into hi:lo [mbar] | |
4650 bsf leftbind ; print without leading spaces | 4942 bsf leftbind ; print without leading spaces |
4651 TSTOSS opt_units ; 0=Meter, 1=Feet | 4943 TSTOSS opt_units ; 0=Meter, 1=Feet |
4652 bra TFT_surface_lastdive_metric ; 0 - metric | 4944 bra TFT_surface_lastdive_metric ; 0 - metric |
4653 rcall TFT_surface_imperial ; 1 - imperial | 4945 rcall TFT_surface_imperial ; 1 - imperial |
4654 bra TFT_surface_lastdive_4 ; - continue | 4946 bra TFT_surface_lastdive_4 ; - continue |
4655 TFT_surface_lastdive_metric: | 4947 TFT_surface_lastdive_metric: |
4656 rcall TFT_surface_metric ; print depth in meters | 4948 rcall TFT_surface_metric ; print depth in meters |
4657 TFT_surface_lastdive_4: | 4949 TFT_surface_lastdive_4: |
4658 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.3) | 4950 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.3) |
4659 MOVII lastdive_avgdepth,mpr | 4951 MOVII lastdive_avgdepth,mpr ; get avg depth of last dive |
4660 call adjust_depth_with_salinity ; compute (current) salinity setting into hi:lo [mbar] | |
4661 bsf leftbind ; print without leading spaces | 4952 bsf leftbind ; print without leading spaces |
4662 TSTOSS opt_units ; 0=Meter, 1=Feet | 4953 TSTOSS opt_units ; 0=Meter, 1=Feet |
4663 bra TFT_surface_metric ; 0 - metric and return | 4954 bra TFT_surface_metric ; 0 - metric and return |
4664 ;bra TFT_surface_imperial ; 1 - imperial and return | 4955 ;bra TFT_surface_imperial ; 1 - imperial and return |
4665 | 4956 |
4666 TFT_surface_imperial: | 4957 TFT_surface_imperial: |
4667 rcall convert_mbar_to_feet ; convert value in hi:lo from mbar to feet | 4958 rcall convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] |
4668 output_16_3 ; limit to 999 and display only (0-999) | 4959 output_16_3 ; limit to 999 and display only (0-999) |
4669 STRCAT_TEXT tFeets1 ; "ft" | 4960 STRCAT_TEXT tFeets1 ; "ft" |
4670 bra TFT_surface_common ; finalize output | 4961 bra TFT_surface_common ; finalize output |
4962 | |
4671 TFT_surface_metric: | 4963 TFT_surface_metric: |
4672 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) | 4964 bsf ignore_digit5 ; no cm (flag will be cleared by output_16) |
4673 movlw .1 ; no 1000 meters | 4965 movlw .1 ; no 1000 meters |
4674 movwf ignore_digits ; ... | 4966 movwf ignore_digits ; ... |
4675 output_16dp .3 ; xxx.y | 4967 output_16dp .3 ; xxx.y |
4676 STRCAT_TEXT tMeters ; "m" | 4968 STRCAT_TEXT tMeters ; "m" |
4969 ;bra TFT_surface_common ; finalize output | |
4970 | |
4677 TFT_surface_common: | 4971 TFT_surface_common: |
4678 STRCAT_PRINT "" ; finalize output | 4972 STRCAT_PRINT "" ; finalize output |
4679 bcf leftbind ; clear left-alignment | 4973 bcf leftbind ; clear left-alignment |
4680 return ; done | 4974 return ; done |
4681 | 4975 |
4690 ;---- draw labels --------------------------------- ; | 4984 ;---- draw labels --------------------------------- ; |
4691 | 4985 |
4692 call TFT_standard_color | 4986 call TFT_standard_color |
4693 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | 4987 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row |
4694 IFDEF _helium | 4988 IFDEF _helium |
4695 TSTOSS opt_tissue_graphics ; shall show N2+He or pressure and saturation? | 4989 btfss tissue_graphic_layout ; shall N2 and He? |
4696 bra TFT_surface_tissues_1 ; =0: show pressures and saturations | 4990 bra TFT_surface_tissues_1 ; NO - print "Tissues" |
4697 ; =1: show N2 and He pressures | 4991 STRCPY_TEXT_PRINT tN2 ; YES - print "N2" |
4698 STRCPY_TEXT_PRINT tN2 ; print "N2" | |
4699 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | 4992 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row |
4700 STRCPY_TEXT_PRINT tHe ; print "He" | 4993 STRCPY_TEXT_PRINT tHe ; - print "He" |
4701 bra TFT_surface_tissues_2 ; continue with common part | 4994 bra TFT_surface_tissues_2 ; - continue with common part |
4702 ENDIF | 4995 ENDIF |
4996 | |
4703 TFT_surface_tissues_1: | 4997 TFT_surface_tissues_1: |
4704 STRCPY_TEXT_PRINT tDiveTissues ; print "Tissues" | 4998 STRCPY_TEXT_PRINT tDiveTissues ; print "Tissues" |
4999 | |
4705 TFT_surface_tissues_2: | 5000 TFT_surface_tissues_2: |
4706 ;---- draw scale ---------------------------------- ; | 5001 ;---- draw scale ---------------------------------- ; |
4707 movlw color_deepblue | 5002 movlw color_deepblue |
4708 call TFT_set_color | 5003 call TFT_set_color |
4709 | 5004 |
4738 bcf aux_flag ; draw tissue pressures by default | 5033 bcf aux_flag ; draw tissue pressures by default |
4739 | 5034 |
4740 ;---- Draw combined or N2 Tissue Pressures--------- ; | 5035 ;---- Draw combined or N2 Tissue Pressures--------- ; |
4741 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default | 5036 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default |
4742 IFDEF _helium | 5037 IFDEF _helium |
4743 TSTOSC opt_tissue_graphics ; shall show N2+He or pressure and saturation? | 5038 btfsc tissue_graphic_layout ; shall show N2+He ? |
4744 lfsr FSR2,char_O_tissue_pres_N2 ; =1: load base address of N2 pressures | 5039 lfsr FSR2,char_O_tissue_pres_N2 ; YES - replace with base address of N2 pressures |
4745 ENDIF | 5040 ENDIF |
5041 btfsc tissue_graphic_mode ; in logbook mode? | |
5042 lfsr FSR2,header_buffer+index_tissue_pres_total ; YES - replace with base address from logbook | |
4746 movlw d'16' | 5043 movlw d'16' |
4747 movwf lo ; tissue counter, 16 tissues | 5044 movwf lo ; tissue counter, 16 tissues |
4748 clrf hi ; row counter | 5045 clrf hi ; row counter |
4749 TFT_surf_tissues_N2_loop: | 5046 TFT_surf_tissues_N2_loop: |
4750 movlw surf_tissue_diagram_top+.23 ; surface mode top start position N2 | 5047 movlw surf_tissue_diagram_top+.23 ; surface mode top start position N2 |
4752 movlw .2 ; bargraph spacing | 5049 movlw .2 ; bargraph spacing |
4753 addwf hi,F ; increment row counter | 5050 addwf hi,F ; increment row counter |
4754 decfsz lo,F ; decrement tissue counter, done? | 5051 decfsz lo,F ; decrement tissue counter, done? |
4755 bra TFT_surf_tissues_N2_loop ; NO - loop | 5052 bra TFT_surf_tissues_N2_loop ; NO - loop |
4756 IFDEF _helium | 5053 IFDEF _helium |
4757 TSTOSC opt_tissue_graphics ; shall show N2+He or pressure and saturation? | 5054 btfsc tissue_graphic_layout ; shall show N2+He ? |
4758 bra TFT_surface_tissues_3 ; =1: show He tissue pressures | 5055 bra TFT_surface_tissues_3 ; YES - show He tissue pressures |
4759 ENDIF | 5056 ENDIF |
4760 | 5057 |
4761 ;---- Draw Tissue Saturations --------------------- ; | 5058 ;---- Draw Tissue Saturations --------------------- ; |
4762 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation | 5059 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation |
5060 btfsc tissue_graphic_mode ; in logbook mode? | |
5061 lfsr FSR2,header_buffer+index_tissue_supersat ; YES - replace with base address from logbook | |
4763 movlw d'16' | 5062 movlw d'16' |
4764 movwf lo ; tissue counter, 16 tissues | 5063 movwf lo ; tissue counter, 16 tissues |
4765 clrf hi ; row counter | 5064 clrf hi ; row counter |
4766 movlw color_grey ; color for tissue saturation | 5065 movlw color_grey ; color for tissue saturation |
4767 movwf ex ; store in ex | 5066 movwf ex ; store in ex |
4791 movlw color_red ; color for 100% line | 5090 movlw color_red ; color for 100% line |
4792 call TFT_set_color ; set color | 5091 call TFT_set_color ; set color |
4793 call TFT_box ; draw line | 5092 call TFT_box ; draw line |
4794 | 5093 |
4795 ; GF factors enabled? | 5094 ; GF factors enabled? |
4796 TSTOSS char_I_deco_model ; GF factors enabled? | 5095 btfss tissue_graphic_gf ; GF factors enabled? |
4797 bra TFT_surface_tissues_4 ; NO - continue with CNS | 5096 bra TFT_surface_tissues_4 ; NO - continue with CNS |
4798 | 5097 |
4799 ;---- Print GF low Line -------------------------- ; | 5098 ;---- Print GF low Line -------------------------- ; |
4800 movlw surf_tissue_diagram_left+.4 ; get left base position | 5099 movlw surf_tissue_diagram_left+.4 ; get left base position |
4801 movwf win_leftx2 ; set left base position (0-159) | 5100 movwf win_leftx2 ; set left base position (0-159) |
4802 movff opt_GF_low,WREG ; get GF low in 0.01 % | 5101 movff opt_GF_low,WREG ; get GF low in 0.01 % |
5102 btfsc tissue_graphic_mode ; in logbook mode? | |
5103 movff header_buffer+index_gf_lo_hi+0,WREG ; YES - replace by GF low from logbook | |
4803 mullw .164 ; multiply with 164 | 5104 mullw .164 ; multiply with 164 |
4804 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 | 5105 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 |
4805 addwf win_leftx2,F ; add to base position | 5106 addwf win_leftx2,F ; add to base position |
4806 movlw color_green ; color for 100% line | 5107 movlw color_green ; color for 100% line |
4807 call TFT_set_color ; set color | 5108 call TFT_set_color ; set color |
4809 | 5110 |
4810 ;---- Print GF high Line -------------------------- ; | 5111 ;---- Print GF high Line -------------------------- ; |
4811 movlw surf_tissue_diagram_left+.4 ; get left base position | 5112 movlw surf_tissue_diagram_left+.4 ; get left base position |
4812 movwf win_leftx2 ; set left base position (0-159) | 5113 movwf win_leftx2 ; set left base position (0-159) |
4813 movff opt_GF_high,WREG ; get GF high in 0.01 % | 5114 movff opt_GF_high,WREG ; get GF high in 0.01 % |
5115 btfsc tissue_graphic_mode ; in logbook mode? | |
5116 movff header_buffer+index_gf_lo_hi+1,WREG ; YES - replace by GF high from logbook | |
4814 mullw .164 ; multiply with 164 | 5117 mullw .164 ; multiply with 164 |
4815 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 | 5118 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 |
4816 addwf win_leftx2,F ; add to base position | 5119 addwf win_leftx2,F ; add to base position |
4817 movlw color_yellow ; color for 100% line | 5120 movlw color_yellow ; color for 100% line |
4818 call TFT_set_color ; set color | 5121 call TFT_set_color ; set color |
4839 decfsz lo,F ; decrement tissue counter, done? | 5142 decfsz lo,F ; decrement tissue counter, done? |
4840 bra TFT_surf_tissues_He_loop ; NO - loop | 5143 bra TFT_surf_tissues_He_loop ; NO - loop |
4841 ENDIF | 5144 ENDIF |
4842 | 5145 |
4843 TFT_surface_tissues_4: | 5146 TFT_surface_tissues_4: |
5147 btfss tissue_graphic_cns ; shall show CNS value? | |
5148 goto TFT_standard_color ; NO - done | |
5149 | |
4844 ; ---- Draw CNS% ---------------------------------- ; | 5150 ; ---- Draw CNS% ---------------------------------- ; |
4845 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row ; position in-between tissue bars | 5151 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row ; position in-between tissue bars |
4846 MOVII int_O_CNS_current,mpr ; get current CNS | 5152 MOVII int_O_CNS_current,mpr ; get current CNS |
4847 call TFT_color_code_cns ; color-code CNS value | 5153 call TFT_color_code_cns ; color-code CNS value |
4848 STRCPY_TEXT tCNS2 ; "CNS:" | 5154 STRCPY_TEXT tCNS2 ; "CNS:" |
4867 movwf win_bargraph ; set length of the bargraph | 5173 movwf win_bargraph ; set length of the bargraph |
4868 goto TFT_box ; draw bargraph and return | 5174 goto TFT_box ; draw bargraph and return |
4869 | 5175 |
4870 | 5176 |
4871 ;============================================================================= | 5177 ;============================================================================= |
4872 ; Draw saturation graph in dive mode | 5178 ; Draw saturation graph in dive mode custom view |
4873 | 5179 ; |
4874 TFT_dive_tissues: | 5180 TFT_dive_tissues: |
4875 ;---- Draw Frame | 5181 |
5182 ;---- draw outer frame | |
4876 call TFT_standard_color | 5183 call TFT_standard_color |
4877 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame | 5184 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame |
4878 | 5185 |
4879 ;---- clear area showing leading tissue number as it may not be printed over | 5186 ;---- clear area showing leading tissue number as it may not be printed over |
4880 WIN_BOX_BLACK dm_custom_tissue_diagram_top+.16, dm_custom_tissue_diagram_top+.16+.10, dm_custom_tissue_diagram_left+.32, dm_custom_tissue_diagram_left+.32+.8 ; top, bottom, left, right | 5187 WIN_BOX_BLACK dm_custom_tissue_diagram_top+.16, dm_custom_tissue_diagram_top+.16+.10, dm_custom_tissue_diagram_left+.32, dm_custom_tissue_diagram_left+.32+.8 ; top, bottom, left, right |
4881 | 5188 |
5189 TFT_dive_tissues_1: | |
4882 ;---- common initialization for Tissue Pressures and Saturation ---------- | 5190 ;---- common initialization for Tissue Pressures and Saturation ---------- |
4883 movlw .1 | 5191 movlw .1 |
4884 movwf win_height ; hight of the bargraph (0-239) | 5192 movwf win_height ; hight of the bargraph (0-239) |
4885 movlw dm_custom_tissue_diagram_left+.3 ; get dive mode left start position | 5193 movlw dm_custom_tissue_diagram_left+.3 ; get dive mode left start position |
4886 movwf win_leftx2 ; set column left (0-159) | 5194 movwf win_leftx2 ; set column left (0-159) |
4893 movwf ul ; store in ul | 5201 movwf ul ; store in ul |
4894 | 5202 |
4895 ;---- Draw combined or N2 Tissue Pressures -------- ; | 5203 ;---- Draw combined or N2 Tissue Pressures -------- ; |
4896 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default | 5204 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default |
4897 IFDEF _helium | 5205 IFDEF _helium |
4898 TSTOSC opt_tissue_graphics ; shall show N2+He or pressure and saturation? | 5206 btfsc tissue_graphic_layout ; shall show N2+He ? |
4899 lfsr FSR2,char_O_tissue_pres_N2 ; =1: load base address of N2 pressures | 5207 lfsr FSR2,char_O_tissue_pres_N2 ; YES - load base address of N2 pressures |
4900 ENDIF | 5208 ENDIF |
4901 movlw d'16' | 5209 movlw d'16' |
4902 movwf lo ; tissue counter, 16 tissues | 5210 movwf lo ; tissue counter, 16 tissues |
4903 clrf hi ; row counter | 5211 clrf hi ; row counter |
4904 TFT_dive_tissues_N2_loop: | 5212 TFT_dive_tissues_N2_loop: |
4906 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | 5214 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph |
4907 incf hi,F ; increment row counter | 5215 incf hi,F ; increment row counter |
4908 decfsz lo,F ; decrement tissue counter, done? | 5216 decfsz lo,F ; decrement tissue counter, done? |
4909 bra TFT_dive_tissues_N2_loop ; NO - loop | 5217 bra TFT_dive_tissues_N2_loop ; NO - loop |
4910 IFDEF _helium | 5218 IFDEF _helium |
4911 TSTOSC opt_tissue_graphics ; shall show N2+He or pressure and saturation? | 5219 btfsc tissue_graphic_layout ; shall show N2+He ? |
4912 bra TFT_dive_tissues_3 ; =1: show He tissue pressures | 5220 bra TFT_dive_tissues_3 ; YES - show He tissue pressures |
4913 ENDIF | 5221 ENDIF |
4914 | 5222 |
4915 ;---- Draw Tissue Saturations --------------------- ; | 5223 ;---- Draw Tissue Saturations --------------------- ; |
4916 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation | 5224 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation |
4917 movlw d'16' | 5225 movlw d'16' |
4943 movlw color_red ; color for 100% line | 5251 movlw color_red ; color for 100% line |
4944 call TFT_set_color ; set color | 5252 call TFT_set_color ; set color |
4945 call TFT_box ; draw line | 5253 call TFT_box ; draw line |
4946 | 5254 |
4947 ; GF factors enabled? | 5255 ; GF factors enabled? |
4948 TSTOSS char_I_deco_model ; GF factors enabled? | 5256 btfss tissue_graphic_gf ; shall show GF lines? |
4949 bra TFT_dive_tissues_4 ; NO - continue with number of leading tissue | 5257 bra TFT_dive_tissues_4 ; NO - continue with number of leading tissue |
4950 | 5258 |
4951 ;---- Print GF low Line -------------------------- ; | 5259 ;---- Print GF low Line -------------------------- ; |
4952 movlw dm_custom_tissue_diagram_left+.3 ; get left base position | 5260 movlw dm_custom_tissue_diagram_left+.3 ; get left base position |
4953 movwf win_leftx2 ; set left base position (0-159) | 5261 movwf win_leftx2 ; set left base position (0-159) |
4972 bra TFT_dive_tissues_4 ; continue with number of leading tissue | 5280 bra TFT_dive_tissues_4 ; continue with number of leading tissue |
4973 | 5281 |
4974 IFDEF _helium | 5282 IFDEF _helium |
4975 TFT_dive_tissues_3: | 5283 TFT_dive_tissues_3: |
4976 ;---- Draw He Tissues Pressures ------------------- ; | 5284 ;---- Draw He Tissues Pressures ------------------- ; |
5285 lfsr FSR2,char_O_tissue_pres_He ; load base address of He pressures | |
4977 movlw dm_custom_tissue_diagram_left+.3+.4 ; get dive mode left start position for He bars | 5286 movlw dm_custom_tissue_diagram_left+.3+.4 ; get dive mode left start position for He bars |
4978 movwf win_leftx2 ; set column left (0-159) | 5287 movwf win_leftx2 ; set column left (0-159) |
4979 movlw .159-dm_custom_tissue_diagram_left-.4-.4 ; get max width for He bars | 5288 movlw .159-dm_custom_tissue_diagram_left-.4-.4 ; get max width for He bars |
4980 movwf win_width+0 ; set width (low byte) | 5289 movwf win_width+0 ; set width (low byte) |
4981 clrf win_width+1 ; ... | 5290 clrf win_width+1 ; ... |
4982 lfsr FSR2,char_O_tissue_pres_He ; load base address of He pressures | |
4983 movlw d'16' | 5291 movlw d'16' |
4984 movwf lo ; tissue counter, 16 tissues | 5292 movwf lo ; tissue counter, 16 tissues |
4985 clrf hi ; row counter | 5293 clrf hi ; row counter |
4986 TFT_dive_tissues_He_loop: | 5294 TFT_dive_tissues_He_loop: |
4987 movlw dm_custom_tissue_diagram_top+.3+.22 ; dive mode top start position H2 | 5295 movlw dm_custom_tissue_diagram_top+.3+.22 ; dive mode top start position H2 |
4988 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | 5296 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph |
4989 incf hi,F ; increment row counter | 5297 incf hi,F ; increment row counter |
4990 decfsz lo,F ; decrement tissue counter, done? | 5298 decfsz lo,F ; decrement tissue counter, done? |
4991 bra TFT_dive_tissues_He_loop ; NO - loop | 5299 bra TFT_dive_tissues_He_loop ; NO - loop |
4992 ENDIF | 5300 ENDIF |
4993 | 5301 |
4994 TFT_dive_tissues_4: | 5302 TFT_dive_tissues_4: |
4995 ;---- Print Number of leading Tissue -------------- ; TODO: some flicker due to overwriting by tissue bars | 5303 ;---- Print Number of leading Tissue -------------- ; TODO: some flicker due to overwriting by tissue bars |
4996 movff int_O_lead_supersat+0,WREG ; get current leading tissue's supersaturation (only low byte used for value) | 5304 movff int_O_lead_supersat+0,WREG ; get current leading tissue's supersaturation (only low byte used for value) |
5037 | 5345 |
5038 ;============================================================================= | 5346 ;============================================================================= |
5039 | 5347 |
5040 global TFT_show_cns | 5348 global TFT_show_cns |
5041 TFT_show_cns: | 5349 TFT_show_cns: |
5042 call TFT_set_message_window ; set the row and column for the current message | 5350 call TFT_set_message_window ; set row and column for the message |
5043 tstfsz WREG ; is there room for the message? | 5351 tstfsz WREG ; is there room for the message? |
5044 return ; NO | 5352 return ; NO - skip message in this cycle |
5045 STRCPY_TEXT tCNS ; CNS: | 5353 STRCPY_TEXT tCNS ; CNS: |
5046 MOVII int_O_CNS_current,mpr ; get current CNS | 5354 MOVII int_O_CNS_current,mpr ; get current CNS |
5047 call TFT_color_code_cns ; color-code CNS output | 5355 call TFT_color_code_cns ; color-code CNS output |
5048 bsf leftbind | 5356 bsf leftbind |
5049 output_16_3 ; displays only 0...999 | 5357 output_16_3 ; displays only 0...999 |
5058 bra TFT_custview_exit3 ; and return... | 5366 bra TFT_custview_exit3 ; and return... |
5059 | 5367 |
5060 | 5368 |
5061 global TFT_warning_eod_cns | 5369 global TFT_warning_eod_cns |
5062 TFT_warning_eod_cns: | 5370 TFT_warning_eod_cns: |
5063 call TFT_set_message_window ; set the row and column for the current message | 5371 call TFT_set_message_window ; set row and column for the message |
5064 tstfsz WREG ; is there room for the message? | 5372 tstfsz WREG ; is there room for the message? |
5065 return ; NO | 5373 return ; NO - skip message in this cycle |
5066 call TFT_warning_color ; switch to warnings (red) text color | 5374 call TFT_warning_color ; switch to warnings (red) text color |
5067 STRCPY_TEXT tCNSeod ; end-of-dive CNS warning text | 5375 STRCPY_TEXT tCNSeod ; end-of-dive CNS warning text |
5068 movlw dm_warning_length ; dive mode string length | 5376 movlw dm_warning_length ; dive mode string length |
5069 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) | 5377 call TFT_fillup_with_spaces ; fill up FSR2 with spaces (total string length in WREG) |
5070 STRCAT_PRINT "" | 5378 STRCAT_PRINT "" |
5071 bra TFT_custview_exit3 ; and return... | 5379 bra TFT_custview_exit3 ; and return... |
5072 | 5380 |
5073 | 5381 |
5074 global TFT_show_ppo2_warning | 5382 global TFT_show_ppo2_warning |
5075 TFT_show_ppo2_warning: ; with ppO2 including attention/warning flags in hi:lo | 5383 TFT_show_ppo2_warning: |
5076 call TFT_set_message_window ; set the row and column for the current message | 5384 call TFT_set_message_window ; set row and column for the message |
5077 tstfsz WREG ; is there room for the message? | 5385 tstfsz WREG ; is there room for the message? |
5078 return ; NO | 5386 return ; NO - skip message in this cycle |
5079 call TFT_color_code_ppo2 ; color-code output | 5387 call TFT_color_code_ppo2 ; color-code output |
5080 btfsc bailout_mode ; in bailout? | 5388 btfsc bailout_mode ; in bailout? |
5081 bra TFT_display_diluent_2 ; YES | 5389 bra TFT_display_diluent_2 ; YES |
5082 btfss FLAG_ccr_mode ; in CCR mode? | 5390 btfss FLAG_ccr_mode ; in CCR mode? |
5083 bra TFT_display_diluent_1 ; NO - continue with pSCR or OC | 5391 bra TFT_display_diluent_1 ; NO - continue with pSCR or OC |
5121 ;============================================================================= | 5429 ;============================================================================= |
5122 | 5430 |
5123 global TFT_LogOffset | 5431 global TFT_LogOffset |
5124 TFT_LogOffset: | 5432 TFT_LogOffset: |
5125 STRCPY_TEXT tLogOffsetValue ; print "Offset" in selected language | 5433 STRCPY_TEXT tLogOffsetValue ; print "Offset" in selected language |
5126 call do_logoffset_common_read ; read offset into lo:hi | 5434 call eeprom_log_offset_read ; read offset into lo:hi |
5127 ; bsf leftbind | 5435 ; bsf leftbind |
5128 output_16_4 ; print offset in 4 digits | 5436 output_16_4 ; print offset in 4 digits |
5129 ; bcf leftbind | 5437 ; bcf leftbind |
5130 return ; no "_PRINT" here... | 5438 return ; no "_PRINT" here... |
5131 | 5439 |
5424 ; STRCAT_PRINT "" | 5732 ; STRCAT_PRINT "" |
5425 ; return | 5733 ; return |
5426 | 5734 |
5427 ENDIF ; _rx_functions | 5735 ENDIF ; _rx_functions |
5428 | 5736 |
5429 ;============================================================================= | 5737 ;============================================================================= |
5430 | 5738 |
5431 global adjust_depth_with_salinity | 5739 global convert_pres_to_depth |
5432 global adjust_depth_with_salinity_log | 5740 convert_pres_to_depth: ; converts pressure in [mbar] to depth in [cm] |
5433 adjust_depth_with_salinity: ; computes salinity setting into hi:lo [mbar] | 5741 btfsc sensor_override_active ; in pressure sensor override (simulator) mode? |
5434 btfsc sensor_override_active ; in pressure sensor override mode? | 5742 return ; YES - convert with factor 1.0, i.e. make [mbar] = [cm] |
5435 return ; YES - do not apply salinity in override mode | 5743 |
5436 movff opt_salinity,WREG ; 0-5% | 5744 movff opt_salinity,WREG ; get salinity setting (0 - 4 %, see option_table.asm) |
5437 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into hi:lo [mbar] | 5745 addlw d'100' ; add density of fresh water (1.00 kg/l) |
5438 addlw d'100' ; 1.00kg/l | 5746 movwf up ; store salinity factor in up |
5439 movwf up | 5747 |
5440 | 5748 movlw .101+salinity_max ; load (upper limit + 1) |
5441 movlw d'105' ; 105% ? | 5749 cpfslt up ; current setting > upper limit? |
5442 cpfslt up ; salinity upper limit | 5750 bra convert_fix_salinity ; YES - fix salinity setting |
5443 return ; out of limit, do not adjust hi:lo | 5751 |
5444 movlw d'99' ; 99% ? | 5752 movlw .99+salinity_min ; load (lower limit - 1) |
5445 cpfsgt up ; salinity lower limit | 5753 cpfsgt up ; current setting > lower limit? |
5446 return ; out of limit, do not adjust hi:lo | 5754 bra convert_fix_salinity ; YES - fix salinity setting |
5447 | 5755 |
5448 MOVII mpr, xA ; depth in mbar | 5756 convert_pres_to_depth_1: |
5449 MOVLI .102,xB ; 0.98 bar / 10 meter | 5757 MOVII mpr, xA ; get pressure in [mbar] |
5758 MOVLI .102,xB ; conversion factor x 100 for fresh water (1.02 cm per each 1 mbar) | |
5450 call mult16x16 ; xC:4 = xA:2 * xB:2 | 5759 call mult16x16 ; xC:4 = xA:2 * xB:2 |
5451 movff up,xB+0 ; salinity | 5760 movff up,xB+0 ; get salinity in [%] |
5452 clrf xB+1 | 5761 clrf xB+1 ; ... |
5453 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder | 5762 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder |
5454 MOVII xC,mpr ; copy corrected values back to hi:lo | 5763 MOVII xC,mpr ; copy back result as depth in [cm] |
5455 return | 5764 return |
5456 | 5765 |
5766 convert_fix_salinity: | |
5767 movlw .100 ; reset to 100%, i.e. set salinity to 0% | |
5768 movwf up ; fix value in up | |
5769 bra convert_pres_to_depth_1 ; continue | |
5770 | |
5457 ;============================================================================= | 5771 ;============================================================================= |
5458 | 5772 |
5459 global convert_mbar_to_feet | 5773 global convert_cm_to_feet |
5460 convert_mbar_to_feet: ; convert value in hi:lo from mbar to feet | 5774 convert_cm_to_feet: ; converts depth in [cm] to depth in [feet] |
5461 MOVII mpr, xA ; depth in mbar (multiples of 0.01 meter) | 5775 MOVII mpr, xA ; depth in [cm] |
5462 btfsc sensor_override_active ; in pressure sensor override mode? | 5776 btfsc sensor_override_active ; in pressure sensor override (simulator) mode? |
5463 bra convert_mbar_to_feet_1 ; YES | 5777 bra convert_meter_to_feet_1 ; YES - convert with 334feet/100m |
5464 MOVLI .328,xB ; NO - convert with 328feet/100m | 5778 MOVLI .328,xB ; NO - convert with 328feet/100m |
5465 bra convert_common_to_feet ; - continue with common part | 5779 bra convert_common_to_feet ; - continue with common part |
5466 convert_mbar_to_feet_1: | |
5467 MOVLI .334,xB ; YES - convert with 334feet/100m to be in sync with values shown in menu | |
5468 bra convert_common_to_feet ; - continue with common part | |
5469 | 5780 |
5470 | 5781 |
5471 global convert_meter_to_feet | 5782 global convert_meter_to_feet |
5472 convert_meter_to_feet: ; convert value in lo from meters to feet | 5783 convert_meter_to_feet: ; converts depth in [m] to depth in [feet] |
5473 movf lo,W ; depth in meter | 5784 movf lo,W ; depth in [m] |
5474 mullw .100 ; convert meter to mbar | 5785 mullw .100 ; factor to convert [m] to [cm] |
5475 MOVII PRODL,xA ; depth in mbar (multiples of 0.01 meter) | 5786 MOVII PRODL,xA ; copy depth in [cm] to xA |
5476 MOVLI .334,xB ; convert with 334feet/100m to have 10ft, 20ft, 30ft for stop depths | 5787 convert_meter_to_feet_1: |
5788 MOVLI .334, xB ; convert with 334feet/100m to have 10ft, 20ft, 30ft, ... for stop depths | |
5789 ;bra convert_common_to_feet ; continue with common part | |
5790 | |
5477 | 5791 |
5478 convert_common_to_feet: | 5792 convert_common_to_feet: |
5479 call mult16x16 ; xC = xA * xB = depth in 0.01 meter * xxx feet / 100 meter | 5793 call mult16x16 ; xC = xA * xB = depth in [cm] * 334 feet/100 m = depth in 0.0001 feet |
5480 movlw d'50' ; round up | 5794 MOVLI .10000,xB ; divide by 10000 to turn into full feet |
5481 addwf xC+0,F | |
5482 movlw .0 | |
5483 addwfc xC+1,F | |
5484 addwfc xC+2,F | |
5485 addwfc xC+3,F | |
5486 MOVLI .10000,xB ; 10000 = 100 for depth in 0.01 meter to full meter x 100 for feet factor is per 100 meter | |
5487 call div32x16 ; xC = xC / xB with xA as remainder | 5795 call div32x16 ; xC = xC / xB with xA as remainder |
5488 MOVII xC,mpr ; store result | 5796 MOVII xC,mpr ; store result |
5489 | 5797 |
5490 return | 5798 return |
5491 | 5799 |