comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 517:a73a452ca155

Backed out changeset: b498245da3f1
author heinrichsweikamp
date Mon, 05 Dec 2011 20:58:10 +0100
parents b498245da3f1
children 154b1d1c489e
comparison
equal deleted inserted replaced
516:b498245da3f1 517:a73a452ca155
461 btfsc menubit ; Divemode menu active? 461 btfsc menubit ; Divemode menu active?
462 bra PLED_display_deko1 ; Yes, do not display deco, only GF (if required) 462 bra PLED_display_deko1 ; Yes, do not display deco, only GF (if required)
463 463
464 ostc_debug 'y' ; Sends debug-information to screen if debugmode active 464 ostc_debug 'y' ; Sends debug-information to screen if debugmode active
465 WIN_TOP .80 465 WIN_TOP .80
466 WIN_LEFT .94
466 WIN_FONT FT_MEDIUM 467 WIN_FONT FT_MEDIUM
467 WIN_INVERT .0 ; Init new Wordprocessor 468 WIN_INVERT .0 ; Init new Wordprocessor
468 PLED_color_code warn_ceiling ; Color-code Output 469 PLED_color_code warn_ceiling ; Color-code Output
469 lfsr FSR2,letter 470 lfsr FSR2,letter
470 movff char_O_first_deco_depth,lo ; Ceiling in m 471 movff char_O_first_deco_depth,lo ; Ceiling in m
471 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
472 btfss WREG,0 ; Enabled ?
473 bra PLED_display_deko3 ; NO
474 WIN_LEFT .80
475 clrf hi
476 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
477 output_16_3
478 call word_processor
479
480 WIN_TOP .91
481 WIN_LEFT .115
482 WIN_FONT FT_SMALL
483 lfsr FSR2,letter
484 STRCPY_PRINT TXT_FOOT2 ; Print 'ft' in small font
485
486 WIN_TOP .80
487 WIN_LEFT .130
488 WIN_FONT FT_MEDIUM
489 lfsr FSR2,letter
490 bra PLED_display_deko4
491
492 PLED_display_deko3:
493 WIN_LEFT .94
494 output_99 472 output_99
495 PUTC TXT_METER_C 473 PUTC TXT_METER_C
496 474 movff char_O_first_deco_time,lo ; length of first stop in m
497 PLED_display_deko4:
498 movff char_O_first_deco_time,lo ; length of first stop in min
499 output_99 475 output_99
500 STRCAT_PRINT "'" 476 STRCAT_PRINT "'"
501 WIN_FONT FT_SMALL 477 WIN_FONT FT_SMALL
502 478
503 ;PLED_display_deko1: 479 ;PLED_display_deko1:
504 ostc_debug 'x' ; Sends debug-information to screen if debugmode active 480 ostc_debug 'x' ; Sends debug-information to screen if debugmode active
505 481
506 WIN_TOP .136 482 WIN_TOP .136
507 WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + ' 483 WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + '
583 lfsr FSR2,letter 559 lfsr FSR2,letter
584 OUTPUTTEXTH .278 ; Max. Depth: 560 OUTPUTTEXTH .278 ; Max. Depth:
585 561
586 movff sim_btm_depth,lo 562 movff sim_btm_depth,lo
587 bsf leftbind 563 bsf leftbind
588 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
589 btfss WREG,0 ; Enabled ?
590 bra PLED_simulator_data_3 ; NO
591 clrf hi
592 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
593 output_16_3
594 STRCAT_PRINT TXT_FOOT4
595 bcf leftbind
596 return
597
598 PLED_simulator_data_3:
599 output_8 564 output_8
600 STRCAT_PRINT TXT_METER3 565 STRCAT_PRINT TXT_METER3
601 566
602 bcf leftbind 567 bcf leftbind
603 return 568 return
732 movlw '-' 697 movlw '-'
733 btfsc neg_flag 698 btfsc neg_flag
734 movlw '+' 699 movlw '+'
735 movwf POSTINC2 700 movwf POSTINC2
736 movff divA+0,lo 701 movff divA+0,lo
737 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
738 btfss WREG,0 ; Enabled ?
739 bra PLED_display_velocity2 ; NO
740 clrf hi
741 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
742 output_16_3
743 OUTPUTTEXTH d'318' ; ft/min
744 bra PLED_display_velocity3
745
746 PLED_display_velocity2:
747 output_99 702 output_99
748 OUTPUTTEXT d'83' ; m/min 703 OUTPUTTEXT d'83' ; m/min
749 704 call word_processor
750 PLED_display_velocity3:
751 call word_processor
752 call PLED_standard_color 705 call PLED_standard_color
753 bsf pled_velocity_display 706 bsf pled_velocity_display
754 return 707 return
755 708
756 PLED_display_velocity_clear: 709 PLED_display_velocity_clear:
760 cpfseq lo ; =1? 713 cpfseq lo ; =1?
761 bra PLED_display_velocity_clear1 ; No, clear text display 714 bra PLED_display_velocity_clear1 ; No, clear text display
762 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display 715 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display
763 716
764 PLED_display_velocity_clear1: 717 PLED_display_velocity_clear1:
765 movlw d'10' 718 movlw d'8'
766 movwf temp1 719 movwf temp1
767 WIN_TOP .90 720 WIN_TOP .90
768 WIN_LEFT .0 721 WIN_LEFT .0
769 bcf pled_velocity_display 722 bcf pled_velocity_display
770 bra PLED_display_clear_common_y1 723 bra PLED_display_clear_common_y1
879 WIN_TOP .75 832 WIN_TOP .75
880 STRCPY TXT_LAST5 833 STRCPY TXT_LAST5
881 GETCUSTOM8 d'29' 834 GETCUSTOM8 d'29'
882 movwf lo 835 movwf lo
883 bsf leftbind 836 bsf leftbind
884 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
885 btfss WREG,0 ; Enabled ?
886 bra PLED_show_cf11_cf12_cf29_3 ; NO
887 clrf hi
888 call convert_meters_to_feet2
889 output_16
890 STRCAT_PRINT TXT_FOOT2
891 bcf leftbind
892 return
893
894 PLED_show_cf11_cf12_cf29_3:
895 output_8 837 output_8
896 STRCAT_PRINT TXT_METER1 838 STRCAT_PRINT TXT_METER1
897 839
898 bcf leftbind 840 bcf leftbind
899 return 841 return
1053 call word_processor 995 call word_processor
1054 WIN_LEFT .80 996 WIN_LEFT .80
1055 WIN_TOP .177 997 WIN_TOP .177
1056 STRCPY "temp:" 998 STRCPY "temp:"
1057 SAFE_2BYTE_COPY temperature, lo 999 SAFE_2BYTE_COPY temperature, lo
1058 call convert_celsius_to_fahrenheit
1059 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1000 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1060 output_16 1001 output_16
1061 call word_processor 1002 call word_processor
1062 1003
1063 call get_battery_voltage ; get battery voltage 1004 call get_battery_voltage ; get battery voltage
1165 call PLED_standard_color 1106 call PLED_standard_color
1166 1107
1167 movff last_temperature+1,hi 1108 movff last_temperature+1,hi
1168 movff last_temperature+0,lo 1109 movff last_temperature+0,lo
1169 lfsr FSR2,letter 1110 lfsr FSR2,letter
1170 call convert_celsius_to_fahrenheit
1171 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1111 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1172 movlw d'3' 1112 movlw d'3'
1173 movwf ignore_digits 1113 movwf ignore_digits
1174 bsf leftbind ; left orientated output 1114 bsf leftbind ; left orientated output
1175 output_16dp d'2' 1115 output_16dp d'2'
1176 bcf leftbind 1116 bcf leftbind
1177 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
1178 btfss WREG,0 ; Enabled ?
1179 bra PLED_show_C ; NO
1180 STRCAT_PRINT "°F "
1181 return
1182 PLED_show_C:
1183 STRCAT_PRINT "°C " 1117 STRCAT_PRINT "°C "
1184 return 1118 return
1185 1119
1186 PLED_temp_divemode: 1120 PLED_temp_divemode:
1187 ostc_debug 'u' ; Sends debug-information to screen if debugmode active 1121 ostc_debug 'u' ; Sends debug-information to screen if debugmode active
1197 1131
1198 movff last_temperature+1,hi 1132 movff last_temperature+1,hi
1199 movff last_temperature+0,lo 1133 movff last_temperature+0,lo
1200 1134
1201 lfsr FSR2,letter 1135 lfsr FSR2,letter
1202 call convert_celsius_to_fahrenheit
1203 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required 1136 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1204 movlw d'3' 1137 movlw d'3'
1205 movwf ignore_digits 1138 movwf ignore_digits
1206 bsf leftbind ; left orientated output 1139 bsf leftbind ; left orientated output
1207 output_16dp d'2' 1140 output_16dp d'2'
1761 1694
1762 1695
1763 PLED_depth: 1696 PLED_depth:
1764 ostc_debug 'r' ; Sends debug-information to screen if debugmode active 1697 ostc_debug 'r' ; Sends debug-information to screen if debugmode active
1765 SAFE_2BYTE_COPY rel_pressure, lo 1698 SAFE_2BYTE_COPY rel_pressure, lo
1766 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1699 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1767 call convert_meters_to_feet ; converts meters to feet
1768 1700
1769 movlw .039 1701 movlw .039
1770 cpfslt hi 1702 cpfslt hi
1771 bra pled_depth_full_units_only 1703 bra depth_greater_99_84mtr
1772 1704
1773 btfsc depth_greater_100 ; Was depth>100 during last call 1705 btfsc depth_greater_100m ; Was depth>100m during last call
1774 call PLED_clear_depth ; Yes, clear depth area 1706 call PLED_clear_depth ; Yes, clear depth area
1775 bcf depth_greater_100 ; Do this once only... 1707 bcf depth_greater_100m ; Do this once only...
1776 1708
1777 lfsr FSR2,letter 1709 lfsr FSR2,letter
1778 1710
1779 movlw HIGH d'1000' 1711 movlw HIGH d'1000'
1780 movwf sub_a+1 1712 movwf sub_a+1
1784 movff lo,sub_b+0 1716 movff lo,sub_b+0
1785 incf sub_b+0,F 1717 incf sub_b+0,F
1786 movlw d'0' 1718 movlw d'0'
1787 addwfc sub_b+1,F ; Add 1mbar offset 1719 addwfc sub_b+1,F ; Add 1mbar offset
1788 call sub16 ; sub_c = sub_a - sub_b 1720 call sub16 ; sub_c = sub_a - sub_b
1789 btfss neg_flag ; Depth lower then 10? 1721 btfss neg_flag ; Depth lower then 10m?
1790 rcall depth_less_10 ; Yes, add extra space 1722 rcall depth_less_10mtr ; Yes, add extra space
1791 1723
1792 WIN_TOP .24 1724 WIN_TOP .24
1793 WIN_LEFT .0 1725 WIN_LEFT .0
1794 WIN_FONT FT_LARGE 1726 WIN_FONT FT_LARGE
1795 WIN_INVERT .0 ; Init new Wordprocessor 1727 WIN_INVERT .0 ; Init new Wordprocessor
1800 movlw LOW d'99' 1732 movlw LOW d'99'
1801 movwf sub_a+0 1733 movwf sub_a+0
1802 movff hi,sub_b+1 1734 movff hi,sub_b+1
1803 movff lo,sub_b+0 1735 movff lo,sub_b+0
1804 call sub16 ; sub_c = sub_a - sub_b 1736 call sub16 ; sub_c = sub_a - sub_b
1805 btfss neg_flag ; Depth lower then 1? 1737 btfss neg_flag ; Depth lower then 1m?
1806 bra pled_depth2 ; Yes, display manual Zero 1738 bra pled_depth2 ; Yes, display manual Zero
1807 1739
1808 bsf leftbind 1740 bsf leftbind
1809 bsf ignore_digit4 1741 bsf ignore_digit4
1810 output_16 ; Full meters in Big font 1742 output_16 ; Full meters in Big font
1815 PUTC '0' 1747 PUTC '0'
1816 1748
1817 pled_depth3: 1749 pled_depth3:
1818 call word_processor 1750 call word_processor
1819 bcf ignore_digit4 1751 bcf ignore_digit4
1820
1821 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
1822 btfsc WREG,0 ; Enabled ?
1823 bra pled_depth6 ; YES, don't print any fractions
1824 1752
1825 WIN_FONT FT_MEDIUM 1753 WIN_FONT FT_MEDIUM
1826 WIN_TOP .50 1754 WIN_TOP .50
1827 WIN_LEFT .40 1755 WIN_LEFT .40
1828 PLED_color_code warn_depth ; Color-code the output 1756 PLED_color_code warn_depth ; Color-code the output
1852 PUTC '0' 1780 PUTC '0'
1853 1781
1854 pled_depth5: 1782 pled_depth5:
1855 call word_processor ; decimeters in medium font 1783 call word_processor ; decimeters in medium font
1856 bcf ignore_digit5 1784 bcf ignore_digit5
1857
1858 pled_depth6:
1859 WIN_FONT FT_SMALL 1785 WIN_FONT FT_SMALL
1860 return 1786 return
1861 1787
1862 pled_depth_full_units_only: ; Display only in full meters or feet 1788 depth_greater_99_84mtr: ; Display only in full meters
1863 btfss depth_greater_100 ; Is depth>100 already? 1789 btfss depth_greater_100m ; Is depth>100m already?
1864 call PLED_clear_depth ; No, clear depth area and set flag 1790 call PLED_clear_depth ; No, clear depth area and set flag
1865 ; Depth is already in hi:lo 1791 ; Depth is already in hi:lo
1866 ; Show depth in Full units 1792 ; Show depth in Full meters
1867 ; That means ignore figure 4 and 5 1793 ; That means ignore figure 4 and 5
1868 lfsr FSR2,letter 1794 lfsr FSR2,letter
1869 WIN_TOP .24 1795 WIN_TOP .24
1870 WIN_LEFT .0 1796 WIN_LEFT .0
1871 WIN_FONT FT_LARGE 1797 WIN_FONT FT_LARGE
1879 call word_processor 1805 call word_processor
1880 bcf ignore_digit4 1806 bcf ignore_digit4
1881 WIN_FONT FT_SMALL 1807 WIN_FONT FT_SMALL
1882 return 1808 return
1883 1809
1884 depth_less_10: 1810 depth_less_10mtr:
1885 PUTC ' ' 1811 PUTC ' '
1886 return 1812 return
1887 1813
1888 PLED_clear_depth ; No, clear depth area and set flag 1814 PLED_clear_depth ; No, clear depth area and set flag
1889 WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right 1815 WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right
1890 bsf depth_greater_100 ; Set Flag 1816 bsf depth_greater_100m ; Set Flag
1891 return 1817 return
1892 1818
1893 PLED_desaturation_time: 1819 PLED_desaturation_time:
1894 movff int_O_desaturation_time+0,lo 1820 movff int_O_desaturation_time+0,lo
1895 movff int_O_desaturation_time+1,hi ; Copy 1821 movff int_O_desaturation_time+1,hi ; Copy
2249 PLED_max_pressure: 2175 PLED_max_pressure:
2250 ostc_debug 'p' ; Sends debug-information to screen if debugmode active 2176 ostc_debug 'p' ; Sends debug-information to screen if debugmode active
2251 movff max_pressure+0,lo 2177 movff max_pressure+0,lo
2252 movff max_pressure+1,hi 2178 movff max_pressure+1,hi
2253 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2179 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2254 call convert_meters_to_feet ; converts meters to feet
2255
2256 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
2257 btfsc WREG,0 ; Enabled ?
2258 bra PLED_maxdepth_full_units_only ; YES, don't print any feet fractions
2259 2180
2260 movlw .039 2181 movlw .039
2261 cpfslt hi 2182 cpfslt hi
2262 bra PLED_maxdepth_full_units_only 2183 bra maxdepth_greater_99_84mtr
2263 2184
2264 ; Display normal "xx.y" 2185 ; Display normal "xx.y"
2265 lfsr FSR2,letter 2186 lfsr FSR2,letter
2266 call PLED_standard_color 2187 call PLED_standard_color
2267 WIN_TOP .184 2188 WIN_TOP .184
2275 bcf show_last3 2196 bcf show_last3
2276 call word_processor 2197 call word_processor
2277 WIN_FONT FT_SMALL 2198 WIN_FONT FT_SMALL
2278 return 2199 return
2279 2200
2280 PLED_maxdepth_full_units_only: ; Display only in full units (meters or feet) 2201 maxdepth_greater_99_84mtr: ; Display only in full meters
2281 btfss maxdepth_greater_100 ; Is max.depth>100 already? 2202 btfss maxdepth_greater_100m ; Is max.depth>100m already?
2282 call PLED_clear_maxdepth ; No, clear maxdepth area and set flag 2203 call PLED_clear_maxdepth ; No, clear maxdepth area and set flag
2283 ; max Depth is already in hi:lo 2204 ; max Depth is already in hi:lo
2284 ; Show max depth in Full units 2205 ; Show max depth in Full meters
2285 ; That means ignore figure 4 and 5 2206 ; That means ignore figure 4 and 5
2286 lfsr FSR2,letter 2207 lfsr FSR2,letter
2287 call PLED_standard_color 2208 call PLED_standard_color
2288 WIN_TOP .184 2209 WIN_TOP .184
2289 WIN_LEFT .0 2210 WIN_LEFT .0
2299 WIN_FONT FT_SMALL 2220 WIN_FONT FT_SMALL
2300 return 2221 return
2301 2222
2302 PLED_clear_maxdepth: 2223 PLED_clear_maxdepth:
2303 WIN_BOX_BLACK .184, .215, .0, .41 ;top, bottom, left, right 2224 WIN_BOX_BLACK .184, .215, .0, .41 ;top, bottom, left, right
2304 bsf maxdepth_greater_100 ; Set Flag 2225 bsf maxdepth_greater_100m ; Set Flag
2305 return 2226 return
2306 2227
2307 PLED_divemins: 2228 PLED_divemins:
2308 btfsc menubit ; Divemode menu active? 2229 btfsc menubit ; Divemode menu active?
2309 return ; Yes, do not update divetime 2230 return ; Yes, do not update divetime
2453 call word_processor 2374 call word_processor
2454 2375
2455 ostc_debug 'U' ; Sends debug-information to screen if debugmode active 2376 ostc_debug 'U' ; Sends debug-information to screen if debugmode active
2456 2377
2457 WIN_TOP .216 2378 WIN_TOP .216
2379 WIN_LEFT .110
2458 WIN_FONT FT_SMALL 2380 WIN_FONT FT_SMALL
2459 call PLED_standard_color 2381 call PLED_standard_color
2460 2382
2461 lfsr FSR2,letter 2383 lfsr FSR2,letter
2462 movff avr_rel_pressure+0,lo 2384 movff avr_rel_pressure+0,lo
2463 movff avr_rel_pressure+1,hi 2385 movff avr_rel_pressure+1,hi
2464 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2386 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2465 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
2466 btfss WREG,0 ; Enabled ?
2467 bra PLED_stopwatch_show3 ; NO
2468 WIN_LEFT .124
2469 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
2470 bsf ignore_digit4 ; do not display feet fractions
2471 output_16
2472 bcf ignore_digit4
2473 bcf leftbind
2474 STRCAT_PRINT TXT_FOOT2
2475 return
2476
2477 PLED_stopwatch_show3:
2478 WIN_LEFT .110
2479 bsf ignore_digit5 ; do not display 1cm depth 2387 bsf ignore_digit5 ; do not display 1cm depth
2480 output_16dp d'3' 2388 output_16dp d'3'
2481 bcf leftbind 2389 bcf leftbind
2482 STRCAT_PRINT TXT_METER1 2390 STRCAT_PRINT TXT_METER1
2483 return 2391 return
2515 movff wait_temp,lo 2423 movff wait_temp,lo
2516 output_99x 2424 output_99x
2517 call word_processor 2425 call word_processor
2518 2426
2519 ostc_debug 'U' ; Sends debug-information to screen if debugmode active 2427 ostc_debug 'U' ; Sends debug-information to screen if debugmode active
2520 WIN_TOP .137 2428 WIN_TOP .136
2429 WIN_LEFT .90
2521 WIN_FONT FT_MEDIUM 2430 WIN_FONT FT_MEDIUM
2522 call PLED_standard_color 2431 call PLED_standard_color
2523 lfsr FSR2,letter 2432 lfsr FSR2,letter
2524 movff avr_rel_pressure+0,lo 2433 movff avr_rel_pressure+0,lo
2525 movff avr_rel_pressure+1,hi 2434 movff avr_rel_pressure+1,hi
2526 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2435 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2527 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
2528 btfss WREG,0 ; Enabled ?
2529 bra PLED_stopwatch_show_gauge2 ; NO
2530 WIN_LEFT .110
2531 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
2532 bsf ignore_digit4 ; do not display feet fractions
2533 output_16
2534 bcf ignore_digit4
2535 bcf leftbind
2536 call word_processor
2537
2538 WIN_TOP .149
2539 WIN_LEFT .145
2540 WIN_FONT FT_SMALL
2541 lfsr FSR2,letter
2542 STRCPY_PRINT TXT_FOOT2
2543 return
2544
2545 PLED_stopwatch_show_gauge2:
2546 WIN_LEFT .90
2547 bsf ignore_digit5 ; do not display 1cm depth 2436 bsf ignore_digit5 ; do not display 1cm depth
2548 output_16dp d'3' 2437 output_16dp d'3'
2549 bcf leftbind 2438 bcf leftbind
2550 STRCAT_PRINT TXT_METER1 2439 STRCAT_PRINT TXT_METER1
2551 WIN_FONT FT_SMALL ; Reset... 2440 WIN_FONT FT_SMALL ; Reset...
2556 ; Non-Resettable Average 2445 ; Non-Resettable Average
2557 call PLED_divemask_color ; Set Color for Divemode mask 2446 call PLED_divemask_color ; Set Color for Divemode mask
2558 DISPLAYTEXTH d'281' ; Avr.Depth 2447 DISPLAYTEXTH d'281' ; Avr.Depth
2559 2448
2560 PLED_total_average_show2: 2449 PLED_total_average_show2:
2561 WIN_TOP .193 2450 WIN_TOP .192
2451 WIN_LEFT .110
2562 WIN_FONT FT_SMALL 2452 WIN_FONT FT_SMALL
2563 call PLED_standard_color 2453 call PLED_standard_color
2564 2454
2565 lfsr FSR2,letter 2455 lfsr FSR2,letter
2566 movff avr_rel_pressure_total+0,lo 2456 movff avr_rel_pressure_total+0,lo
2567 movff avr_rel_pressure_total+1,hi 2457 movff avr_rel_pressure_total+1,hi
2568 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2458 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2569 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
2570 btfss WREG,0 ; Enabled ?
2571 bra PLED_total_average_show3 ; NO
2572 WIN_LEFT .124
2573 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
2574 bsf ignore_digit4 ; do not display feet fractions
2575 bcf leftbind
2576 output_16
2577 bcf ignore_digit4
2578 STRCAT_PRINT TXT_FOOT2
2579 return
2580
2581 PLED_total_average_show3:
2582 WIN_LEFT .110
2583 bsf ignore_digit5 ; do not display 1cm depth 2459 bsf ignore_digit5 ; do not display 1cm depth
2584 bcf leftbind 2460 bcf leftbind
2585 output_16dp d'3' 2461 output_16dp d'3'
2586 STRCAT_PRINT TXT_METER1 2462 STRCAT_PRINT TXT_METER1
2587 return 2463 return
2694 return 2570 return
2695 2571
2696 PLED_divemode_simulator_mask: 2572 PLED_divemode_simulator_mask:
2697 call PLED_standard_color 2573 call PLED_standard_color
2698 DISPLAYTEXT .254 ; Close 2574 DISPLAYTEXT .254 ; Close
2699 GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units
2700 btfss WREG,0 ; Enabled ?
2701 bra PLED_divemode_simulator_mask2 ; NO
2702 DISPLAYTEXTH .314 ; + 1ft
2703 DISPLAYTEXTH .315 ; - 1ft
2704 DISPLAYTEXTH .316 ; + 10ft
2705 DISPLAYTEXTH .317 ; - 10ft
2706 DISPLAYTEXTH .306 ; Quit Sim
2707 return
2708
2709 PLED_divemode_simulator_mask2:
2710 DISPLAYTEXT .250 ; + 1m 2575 DISPLAYTEXT .250 ; + 1m
2711 DISPLAYTEXT .251 ; - 1m 2576 DISPLAYTEXT .251 ; - 1m
2712 DISPLAYTEXT .252 ; +10m 2577 DISPLAYTEXT .252 ; +10m
2713 DISPLAYTEXT .253 ; -10m 2578 DISPLAYTEXT .253 ; -10m
2714 DISPLAYTEXTH .306 ; Quit Sim 2579 DISPLAYTEXTH .306 ; Quit Sim
2724 ; WREG, PROD, TBLPTR TABLAT. 2589 ; WREG, PROD, TBLPTR TABLAT.
2725 ; 2590 ;
2726 PLED_decoplan_show_stop: 2591 PLED_decoplan_show_stop:
2727 ;---- Print depth ---------------------------------------------------- 2592 ;---- Print depth ----------------------------------------------------
2728 WIN_LEFT .100 2593 WIN_LEFT .100
2729 2594
2730 btfss lo,7 ; Bit set ? 2595 btfss lo,7 ; Bit set ?
2731 bra PLED_decoplan_std_stop ; No : Just an usual stop. 2596 bra PLED_decoplan_std_stop ; No : Just an usual stop.
2732 2597
2733 movlw b'11111101' ; Yellow. 2598 movlw b'11111101' ; Yellow.
2734 call PLED_set_color 2599 call PLED_set_color
2739 call PLED_standard_color 2604 call PLED_standard_color
2740 2605
2741 PLED_decoplan_nstd_stop: 2606 PLED_decoplan_nstd_stop:
2742 lfsr FSR2,letter 2607 lfsr FSR2,letter
2743 bsf leftbind 2608 bsf leftbind
2744 GETCUSTOM8 d'63' ; Check CF#63
2745 btfss WREG,0 ; Enabled ?
2746 bra PLED_decoplan_nstd_stop2 ; NO
2747 movff hi,temp11 ; save hi
2748 clrf hi ;
2749 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
2750 output_16_3
2751 STRCAT_PRINT " "
2752 movff temp11,hi ; restore hi
2753 bra PLED_decoplan_nstd_stop3
2754
2755 PLED_decoplan_nstd_stop2:
2756 output_8 ; outputs into Postinc2! 2609 output_8 ; outputs into Postinc2!
2757 STRCAT_PRINT TXT_METER2 2610 STRCAT_PRINT TXT_METER2
2758 2611
2759 PLED_decoplan_nstd_stop3:
2760 ;---- Print duration ------------------------------------------------- 2612 ;---- Print duration -------------------------------------------------
2761 WIN_LEFT .140 2613 WIN_LEFT .140
2762 lfsr FSR2,letter 2614 lfsr FSR2,letter
2763 2615
2764 movf lo,W ; Swap hi & lo 2616 movf lo,W ; Swap hi & lo
3096 2948
3097 bcf leftbind 2949 bcf leftbind
3098 return ; no, return 2950 return ; no, return
3099 2951
3100 PLED_clear_divemode_menu: 2952 PLED_clear_divemode_menu:
3101 WIN_BOX_BLACK .0, .168, .82, .160 ;top, bottom, left, right 2953 WIN_BOX_BLACK .0, .168, .85, .160 ;top, bottom, left, right
3102 return 2954 return
3103 2955
3104 PLED_divemenu_cursor: 2956 PLED_divemenu_cursor:
3105 ostc_debug 'l' ; Sends debug-information to screen if debugmode active 2957 ostc_debug 'l' ; Sends debug-information to screen if debugmode active
3106 2958
3483 WIN_LEFT .125 3335 WIN_LEFT .125
3484 WIN_TOP .192 3336 WIN_TOP .192
3485 lfsr FSR2,letter 3337 lfsr FSR2,letter
3486 movff char_O_EAD,lo 3338 movff char_O_EAD,lo
3487 bsf leftbind 3339 bsf leftbind
3488 GETCUSTOM8 d'63' ; Check CF#63
3489 btfss WREG,0 ; Enabled ?
3490 bra PLED_show_end_ead_divemode2 ; NO: return
3491 clrf hi ; clear hi
3492 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
3493 output_16 ; Print EAD w/o leading space.
3494 bcf leftbind
3495 STRCAT_PRINT TXT_FOOT2
3496
3497 WIN_TOP .216
3498 lfsr FSR2,letter
3499 movff char_O_END,lo
3500 clrf hi ; clear hi
3501 call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63
3502 bsf leftbind
3503 output_16 ; Print END w/o leading space.
3504 bcf leftbind
3505 STRCAT_PRINT TXT_FOOT2
3506 bra PLED_show_end_ead_divemode3
3507
3508 PLED_show_end_ead_divemode2:
3509 output_8 ; Print EAD w/o leading space. 3340 output_8 ; Print EAD w/o leading space.
3510 STRCAT_PRINT TXT_METER2 3341 STRCAT_PRINT TXT_METER2
3511 3342
3512 WIN_TOP .216 3343 WIN_TOP .216
3513 lfsr FSR2,letter 3344 lfsr FSR2,letter
3514 movff char_O_END,lo 3345 movff char_O_END,lo
3515 output_8 ; Print END w/o leading space. 3346 output_8 ; Print END w/o leading space.
3516 bcf leftbind 3347 bcf leftbind
3517 STRCAT_PRINT TXT_METER2 3348 STRCAT_PRINT TXT_METER2
3518 3349
3519 PLED_show_end_ead_divemode3:
3520 ; Show ppO2[Flush] iff in CCR mode & not in Bailout: 3350 ; Show ppO2[Flush] iff in CCR mode & not in Bailout:
3521 btfsc is_bailout ; In bailout mode? 3351 btfsc is_bailout ; In bailout mode?
3522 return ; Yes: done. 3352 return ; Yes: done.
3523 3353
3524 btfss FLAG_const_ppO2_mode ; In (true) CCR mode ? 3354 btfss FLAG_const_ppO2_mode ; In (true) CCR mode ?
4028 3858
4029 movff xC+0,lo 3859 movff xC+0,lo
4030 movff xC+1,hi ; restore lo and hi with updated value 3860 movff xC+1,hi ; restore lo and hi with updated value
4031 3861
4032 return 3862 return
4033
4034
4035 convert_meters_to_feet: ; convert value in lo:hi from meters to feet
4036
4037 GETCUSTOM8 d'63' ; Check CF#63
4038 btfss WREG,0 ; Enabled ?
4039 return ; NO: return
4040
4041 convert_meters_to_feet2:
4042 movff lo,xA+0
4043 movff hi,xA+1
4044
4045 movlw LOW d'328' ; 328feet/100m
4046 movwf xB+0
4047 movlw HIGH d'328'
4048 movwf xB+1
4049
4050 call mult16x16 ; xA*xB=xC (lo:hi * 328)
4051
4052 movlw d'50' ; round up
4053 addwf xC+0,F
4054 movlw 0
4055 addwfc xC+1,F
4056 addwfc xC+2,F
4057 addwfc xC+3,F
4058
4059 movlw d'100'
4060 movwf xB+0
4061 clrf xB+1
4062
4063 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
4064
4065 movff xC+0,lo
4066 movff xC+1,hi ; restore lo and hi with updated value
4067
4068 return
4069
4070 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit
4071
4072 GETCUSTOM8 d'63' ; Check CF#63
4073 btfss WREG,0 ; Enabled ?
4074 return ; NO: return
4075
4076 movff lo,xA+0
4077 movff hi,xA+1
4078
4079 movlw d'18' ; 1C = 1.8F
4080 movwf xB+0
4081 clrf xB+1
4082
4083 call mult16x16 ;xA*xB=xC (lo:hi * 18)
4084
4085 movlw d'10'
4086 movwf xB+0
4087 clrf xB+1
4088
4089 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
4090
4091 movlw LOW d'320' ; 0C = 32F
4092 addwf xC+0,F
4093 movlw HIGH d'320'
4094 addwfc xC+1,F
4095
4096 movff xC+0,lo
4097 movff xC+1,hi ; restore lo and hi with updated value
4098
4099 return