annotate code_part1/OSTC_code_asm_part1/menu_battery.asm @ 154:a52ba692ad7f

charger test
author heinrichsweikamp
date Fri, 14 Jan 2011 17:54:41 +0100
parents 6a94f96e9cea
children ba109a7948df
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:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 DISPLAYTEXT .114 ; Battery Information
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 WIN_LEFT .0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 WIN_FONT FT_SMALL
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 OUTPUTTEXT .115 ; Cycles:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 read_int_eeprom d'50' ; Get charge cycles
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 read_int_eeprom d'51'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 output_16
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
45 STRCAT " ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 read_int_eeprom d'52' ; Get complete cycles
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 read_int_eeprom d'53'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 output_16
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
52 STRCAT_PRINT ")"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 OUTPUTTEXT .117 ; Last Complete at:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 read_int_eeprom d'47' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 read_int_eeprom d'48' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 read_int_eeprom d'49' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 OUTPUTTEXT .118 ; Lowest Battery:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 read_int_eeprom d'40' ; Batt LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 read_int_eeprom d'41' ; Batt HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 bcf leftbind
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
78 STRCAT_PRINT "V"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 OUTPUTTEXT .119 ; Lowest Battery at:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 read_int_eeprom d'42' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 read_int_eeprom d'43' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 read_int_eeprom d'44' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 OUTPUTTEXT .120 ; Temp min:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 read_int_eeprom d'54' ; TEMP_min LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 read_int_eeprom d'55' ; TEMP_min HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 bcf leftbind
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
104 STRCAT "° ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 read_int_eeprom d'56' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 read_int_eeprom d'57' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 read_int_eeprom d'58' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 call PLED_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
112 STRCAT_PRINT ") "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 WIN_TOP .185
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 OUTPUTTEXT .121 ; Temp max:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 read_int_eeprom d'59' ; TEMP_max LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 read_int_eeprom d'60' ; TEMP_max HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 movff EEDATA,hi
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
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 call PLED_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 ") "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 menu_battery_state5:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 btfss SWITCH2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 bra menu_battery_state5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 menu_battery_state_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 bra menu_battery_state_exit ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 goto restart ; dive started!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 call set_dive_modes
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