comparison src/logbook.asm @ 620:cd986267a5ca

potential compass bug "fixed"
author heinrichsweikamp
date Fri, 22 Feb 2019 16:30:05 +0100
parents ca4556fb60b9
children c40025d8e750
comparison
equal deleted inserted replaced
619:e76a87e087ef 620:cd986267a5ca
1705 movlw color_lightblue 1705 movlw color_lightblue
1706 call TFT_set_color 1706 call TFT_set_color
1707 WIN_FRAME_COLOR16 .63,.220,.2,.105 ; Top, Bottom, Left, Right 1707 WIN_FRAME_COLOR16 .63,.220,.2,.105 ; Top, Bottom, Left, Right
1708 1708
1709 ; Firmware 1709 ; Firmware
1710 call TFT_standard_color 1710 call TFT_standard_color
1711 WIN_SMALL .110,.65 1711 WIN_SMALL .110,.65
1712 STRCAT "V:" 1712 STRCAT "V:"
1713 LOG_POINT_TO log_firmware 1713 LOG_POINT_TO log_firmware
1714 call ext_flash_byte_read_plus ; read firmware xx 1714 call ext_flash_byte_read_plus ; read firmware major number
1715 movff ext_flash_rw,lo 1715 movf ext_flash_rw,W ; copy to WREG
1716 bsf neg_flag ; set flag for 2.15 or newer 1716 movwf hi ; copy from WREG to hi
1717 movlw .1 1717 movwf lo ; copy from WREG to lo, too
1718 cpfsgt lo ; >1? 1718 bsf leftbind ; print left-aligned
1719 bcf neg_flag ; NO - clear flag 1719 output_8 ; print major number
1720 movlw .9 1720 PUTC "." ; print "."
1721 cpfslt lo ; <9 ? 1721 call ext_flash_byte_read_plus ; read firmware minor number
1722 bcf neg_flag ; NO - clear flag (When unit was upgraded from hwOS Sport (10.xx)) 1722 movff ext_flash_rw,lo ; store in lo
1723 bsf leftbind 1723 output_99x ; print minor version in 2 digit format
1724 output_8 1724 STRCAT_PRINT "" ; finalize output
1725 PUTC "." 1725
1726 call ext_flash_byte_read_plus ; read firmware yy 1726 movf hi,W ; get major into WREG
1727 movff ext_flash_rw,lo 1727 xorlw .3 ; major == 3 ?
1728 movlw .14 1728 bz logbook_battery_percent ; YES - show battery %
1729 cpfsgt lo ; >14 ? 1729
1730 bcf neg_flag ; NO - clear flag 1730 movf hi,W ; get major into WREG (again)
1731 output_99x 1731 xorlw .2 ; major == 2 ?
1732 STRCAT_PRINT "" 1732 bnz logbook_battery_voltage ; NO - skip battery %
1733 1733 movlw .14 ; YES - check minor version
1734 btfss neg_flag ; set flag for 2.15 or newer 1734 cpfsgt lo ; - minor > 14 ?
1735 bra logbook_no_batt_info 1735 bra logbook_battery_voltage ; NO - skip battery %
1736 1736 ;bra logbook_battery_percent ; YES - show battery %
1737 ; Battery percent (for dives with 2.15 or newer) 1737
1738 WIN_SMALL .110,.140 1738 ; Battery %
1739 LOG_POINT_TO log_batt_info ; battery percent 1739 logbook_battery_percent:
1740 call ext_flash_byte_read_plus ; read battery low 1740 WIN_SMALL .110,.140 ; show battery percent
1741 movff ext_flash_rw,lo 1741 LOG_POINT_TO log_batt_info ; address battery percent
1742 output_8 1742 call ext_flash_byte_read_plus ; read battery percent
1743 STRCAT_PRINT "%" 1743 movff ext_flash_rw,lo ; copy battery percent to lo
1744 1744 output_8 ; print battery percent
1745 logbook_no_batt_info: ; dives with firmware <2.15 1745 STRCAT_PRINT "%" ; print "%" and finalize output
1746 1746
1747 ; Battery voltage 1747 ; Battery Voltage
1748 logbook_battery_voltage:
1748 WIN_SMALL .110,.90 1749 WIN_SMALL .110,.90
1749 STRCAT_PRINT "Batt:" 1750 STRCAT_PRINT "Batt:"
1750 WIN_SMALL .110,.115 1751 WIN_SMALL .110,.115
1751 LOG_POINT_TO log_battery ; battery voltage 1752 LOG_POINT_TO log_battery ; battery voltage
1752 call ext_flash_byte_read_plus ; read battery low 1753 call ext_flash_byte_read_plus ; read battery low