Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_battery.asm @ 816:df8cd5ffd993
BUGFIX: Load first diluent if <> 1 correctly
Auto-SP change work...
author | heinrichsweikamp |
---|---|
date | Sat, 16 May 2015 14:48:26 +0200 |
parents | 2a0e5d884fc3 |
children |
rev | line source |
---|---|
0 | 1 |
815 | 2 ; OSTC Mk.2, 2N and 2C - diving computer code |
807
c50296c3059e
BUGFIX: Divetime had unwanted "." behind the minutes
heinrichsweikamp
parents:
790
diff
changeset
|
3 ; Copyright (C) 2015 HeinrichsWeikamp GbR |
0 | 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 |
790
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
80 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
81 STRCPY "On-Time: " ; On-Time in minutes:seconds |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
82 movff on_time_seconds+0,xC+0 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
83 movff on_time_seconds+1,xC+1 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
84 movff on_time_seconds+2,xC+2 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
85 clrf xC+4 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
86 movlw .60 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
87 movwf xB+0 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
88 clrf xB+1 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
89 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
90 movff xC+1,hi |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
91 movff xC+0,lo |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
92 bsf leftbind |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
93 output_16 ; full minutes |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
94 PUTC " " |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
95 OUTPUTTEXT .90 ; Minutes |
0 | 96 call word_processor |
97 | |
790
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
98 ; OUTPUTTEXT .119 ; Lowest Battery at: |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
99 ; read_int_eeprom d'42' ; Month |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
100 ; movff EEDATA,convert_value_temp+0 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
101 ; read_int_eeprom d'43' ; Day |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
102 ; movff EEDATA,convert_value_temp+1 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
103 ; read_int_eeprom d'44' ; Year |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
104 ; movff EEDATA,convert_value_temp+2 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
105 ; call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
106 ; call word_processor |
53425d598585
NEW: Store useage timer in logbook header (Byte 54)
heinrichsweikamp
parents:
717
diff
changeset
|
107 |
621 | 108 WIN_TOP .147 |
0 | 109 lfsr FSR2,letter |
110 OUTPUTTEXT .120 ; Temp min: | |
111 read_int_eeprom d'54' ; TEMP_min LOW | |
112 movff EEDATA,lo | |
113 read_int_eeprom d'55' ; TEMP_min HIGH | |
114 movff EEDATA,hi | |
681 | 115 call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 116 movlw d'3' |
117 movwf ignore_digits | |
118 bsf leftbind ; left orientated output | |
119 output_16dp d'2' | |
120 bcf leftbind | |
123 | 121 STRCAT "° (" |
0 | 122 read_int_eeprom d'56' ; Month |
123 movff EEDATA,convert_value_temp+0 | |
124 read_int_eeprom d'57' ; Day | |
125 movff EEDATA,convert_value_temp+1 | |
126 read_int_eeprom d'58' ; Year | |
127 movff EEDATA,convert_value_temp+2 | |
681 | 128 call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
123 | 129 STRCAT_PRINT ") " |
0 | 130 |
621 | 131 WIN_TOP .175 |
0 | 132 lfsr FSR2,letter |
133 OUTPUTTEXT .121 ; Temp max: | |
134 read_int_eeprom d'59' ; TEMP_max LOW | |
135 movff EEDATA,lo | |
136 read_int_eeprom d'60' ; TEMP_max HIGH | |
137 movff EEDATA,hi | |
681 | 138 call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 139 movlw d'3' |
140 movwf ignore_digits | |
141 bsf leftbind ; left orientated output | |
142 output_16dp d'2' | |
143 bcf leftbind | |
123 | 144 STRCAT "° (" |
0 | 145 read_int_eeprom d'61' ; Month |
146 movff EEDATA,convert_value_temp+0 | |
147 read_int_eeprom d'62' ; Day | |
148 movff EEDATA,convert_value_temp+1 | |
149 read_int_eeprom d'63' ; Year | |
150 movff EEDATA,convert_value_temp+2 | |
681 | 151 call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
123 | 152 STRCAT_PRINT ") " |
576 | 153 |
621 | 154 WIN_TOP .203 |
155 lfsr FSR2,letter | |
156 OUTPUTTEXT .228 ; Total Dives: | |
157 read_int_eeprom d'2' ; Total dives low | |
158 movff EEDATA,lo | |
159 read_int_eeprom d'3' ; Total dives high | |
160 movff EEDATA,hi | |
161 bsf leftbind ; left orientated output | |
162 output_16 | |
163 STRCAT_PRINT "" | |
164 | |
576 | 165 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! |
0 | 166 bcf menubit2 |
167 menu_battery_state_loop: | |
168 call check_switches_logbook | |
169 | |
170 btfsc menubit2 | |
171 bra menu_battery_state_exit ; Exit | |
172 | |
173 btfsc onesecupdate | |
575 | 174 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag |
0 | 175 |
176 bcf onesecupdate ; 1 sec. functions done | |
177 | |
178 btfsc sleepmode | |
179 bra menu_battery_state_exit | |
180 | |
181 bra menu_battery_state_loop | |
182 | |
183 menu_battery_state_exit: ; exit... | |
184 movlw d'3' | |
185 movwf menupos | |
186 goto more_menu2 |