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