annotate code_part1/OSTC_code_asm_part1/menu_battery.asm @ 396:0386c7e1374a

BUGFIX display hypoxic air in divemode (bug #41)
author JeanDo
date Thu, 23 Jun 2011 01:41:39 +0200
parents f2d5d93b4ca3
children 6e57b5bb98ce
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
382
f2d5d93b4ca3 negative temperature in logbook and battery info menu
heinrichsweikamp
parents: 297
diff changeset
99 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 bcf leftbind
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
105 STRCAT "° ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 read_int_eeprom d'56' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 read_int_eeprom d'57' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 read_int_eeprom d'58' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 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
113 STRCAT_PRINT ") "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 WIN_TOP .185
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 OUTPUTTEXT .121 ; Temp max:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 read_int_eeprom d'59' ; TEMP_max LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 read_int_eeprom d'60' ; TEMP_max HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movff EEDATA,hi
382
f2d5d93b4ca3 negative temperature in logbook and battery info menu
heinrichsweikamp
parents: 297
diff changeset
122 call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 bcf leftbind
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 0
diff changeset
128 STRCAT "° ("
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 read_int_eeprom d'61' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 read_int_eeprom d'62' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 read_int_eeprom d'63' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 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
136 STRCAT_PRINT ") "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 menu_battery_state_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 bra menu_battery_state_exit ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 goto restart ; dive started!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 bcf onesecupdate ; 1 sec. functions done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 bra menu_battery_state_exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 bra menu_battery_state_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 menu_battery_state_exit: ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 goto more_menu2