annotate code_part1/OSTC_code_asm_part1/menu_battery.asm @ 751:a2c947c243a2

changelog
author heinrichsweikamp
date Mon, 23 Sep 2013 09:08:26 +0200
parents 91ae251d379f
children 53425d598585
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; Submenu battery state
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 05/15/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 05/15/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 menu_battery_state:
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
27 call DISP_ClearScreen
717
91ae251d379f "ostc3-style" menu titles
heinrichsweikamp
parents: 681
diff changeset
28 call DISP_divemask_color
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 DISPLAYTEXT .114 ; Battery Information
717
91ae251d379f "ostc3-style" menu titles
heinrichsweikamp
parents: 681
diff changeset
30 call DISP_standard_color
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 WIN_LEFT .0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 WIN_FONT FT_SMALL
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 OUTPUTTEXT .115 ; Cycles:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 read_int_eeprom d'50' ; Get charge cycles
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 read_int_eeprom d'51'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 output_16
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
43 STRCAT " ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 read_int_eeprom d'52' ; Get complete cycles
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 read_int_eeprom d'53'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 output_16
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
50 STRCAT_PRINT ")"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51
621
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
52 WIN_TOP .63
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 OUTPUTTEXT .117 ; Last Complete at:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 read_int_eeprom d'47' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 read_int_eeprom d'48' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 read_int_eeprom d'49' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 movff EEDATA,convert_value_temp+2
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
61 call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63
621
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
64 WIN_TOP .91
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 OUTPUTTEXT .118 ; Lowest Battery:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 read_int_eeprom d'40' ; Batt LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 read_int_eeprom d'41' ; Batt HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 bcf leftbind
445
6e57b5bb98ce localisation part 1 from Sergei
heinrichsweikamp
parents: 382
diff changeset
76 STRCAT_PRINT TXT_VOLT1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77
621
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
78 WIN_TOP .119
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 OUTPUTTEXT .119 ; Lowest Battery at:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 read_int_eeprom d'42' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 read_int_eeprom d'43' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 read_int_eeprom d'44' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 movff EEDATA,convert_value_temp+2
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
87 call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89
621
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
90 WIN_TOP .147
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 OUTPUTTEXT .120 ; Temp min:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 read_int_eeprom d'54' ; TEMP_min LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 read_int_eeprom d'55' ; TEMP_min HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 movff EEDATA,hi
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
97 call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 bcf leftbind
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
103 STRCAT "° ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 read_int_eeprom d'56' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 read_int_eeprom d'57' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 read_int_eeprom d'58' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 movff EEDATA,convert_value_temp+2
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
110 call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
111 STRCAT_PRINT ") "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112
621
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
113 WIN_TOP .175
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 OUTPUTTEXT .121 ; Temp max:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 read_int_eeprom d'59' ; TEMP_max LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 read_int_eeprom d'60' ; TEMP_max HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 movff EEDATA,hi
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
120 call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 bcf leftbind
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
126 STRCAT "° ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 read_int_eeprom d'61' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 read_int_eeprom d'62' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 read_int_eeprom d'63' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 movff EEDATA,convert_value_temp+2
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 621
diff changeset
133 call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
134 STRCAT_PRINT ") "
576
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 575
diff changeset
135
621
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
136 WIN_TOP .203
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
137 lfsr FSR2,letter
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
138 OUTPUTTEXT .228 ; Total Dives:
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
139 read_int_eeprom d'2' ; Total dives low
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
140 movff EEDATA,lo
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
141 read_int_eeprom d'3' ; Total dives high
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
142 movff EEDATA,hi
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
143 bsf leftbind ; left orientated output
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
144 output_16
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
145 STRCAT_PRINT ""
e7b675c28896 2.29beta release
heinrichsweikamp
parents: 576
diff changeset
146
576
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 575
diff changeset
147 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 menu_battery_state_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 bra menu_battery_state_exit ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 btfsc onesecupdate
575
cbdcbbc91877 some code cleaning
heinrichsweikamp
parents: 445
diff changeset
156 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 bcf onesecupdate ; 1 sec. functions done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 bra menu_battery_state_exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 bra menu_battery_state_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 menu_battery_state_exit: ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168 goto more_menu2