Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_settime.asm @ 436:8c0bb701b925
Merge
author | heinrichsweikamp |
---|---|
date | Sat, 06 Aug 2011 08:28:44 +0200 |
parents | 1efd59d689f8 |
children | ab2686087bce |
rev | line source |
---|---|
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 ; menu "Set Time" | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 5/19/06 | |
22 ; last updated: 080904 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 | |
27 menu_settime: | |
28 call PLED_ClearScreen | |
29 | |
30 bcf set_minutes | |
31 bcf menubit4 | |
32 bcf cursor | |
33 clrf timeout_counter2 | |
34 bcf menubit2 | |
35 bcf menubit3 | |
36 bcf sleepmode | |
37 bcf set_year | |
38 bcf set_day | |
39 bcf set_month | |
40 clrf menupos2 | |
41 | |
42 call PLED_topline_box | |
43 WIN_INVERT .1 ; Init new Wordprocessor | |
44 DISPLAYTEXT .29 ; Set Time | |
45 WIN_INVERT .0 ; Init new Wordprocessor | |
46 DISPLAYTEXT .22 ; Time: | |
47 DISPLAYTEXT .23 ; Date: | |
48 | |
49 call set_time_refresh | |
50 | |
51 DISPLAYTEXT .24 ; Set Hours | |
52 | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
53 bcf switch_right |
0 | 54 bcf switch_left |
55 | |
56 settime_loop: | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
57 btfsc switch_right |
0 | 58 call add_hours_or_minutes_or_date |
59 | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
60 btfsc switch_left |
0 | 61 call set_time_next_or_exit |
62 | |
63 btfsc menubit4 | |
64 bra set_time_done | |
65 | |
66 btfsc onesecupdate | |
67 call timeout_surfmode | |
68 | |
69 btfsc onesecupdate | |
70 call set_dive_modes | |
71 | |
72 bcf onesecupdate | |
73 | |
74 btfsc sleepmode | |
75 bra exit_settime | |
76 | |
77 btfsc divemode | |
78 goto restart | |
79 | |
80 bra settime_loop | |
81 | |
82 set_time_refresh: | |
199 | 83 WIN_LEFT .32 |
0 | 84 WIN_TOP .65 |
85 lfsr FSR2,letter | |
199 | 86 OUTPUTTEXT .22 ; "Hours:" (actual length depends on translation) |
87 | |
0 | 88 movff hours,lo |
89 output_99x | |
123 | 90 PUTC ':' |
0 | 91 movff mins,lo |
92 output_99x | |
123 | 93 STRCAT_PRINT " " |
0 | 94 |
95 set_date_refresh: | |
199 | 96 WIN_LEFT .32 |
0 | 97 WIN_TOP .95 |
98 lfsr FSR2,letter | |
199 | 99 OUTPUTTEXT .23 ; "Date: " (actual length depends on translation) |
100 | |
0 | 101 movff month,convert_value_temp+0 |
102 movff day,convert_value_temp+1 | |
103 movff year,convert_value_temp+2 | |
104 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
123 | 105 STRCAT_PRINT " " |
106 return | |
0 | 107 |
108 set_time_done: ; Check date | |
109 movff month,lo ; new month | |
110 dcfsnz lo,F | |
111 movlw .31 | |
112 dcfsnz lo,F | |
113 movlw .28 | |
114 dcfsnz lo,F | |
115 movlw .31 | |
116 dcfsnz lo,F | |
117 movlw .30 | |
118 dcfsnz lo,F | |
119 movlw .31 | |
120 dcfsnz lo,F | |
121 movlw .30 | |
122 dcfsnz lo,F | |
123 movlw .31 | |
124 dcfsnz lo,F | |
125 movlw .31 | |
126 dcfsnz lo,F | |
127 movlw .30 | |
128 dcfsnz lo,F | |
129 movlw .31 | |
130 dcfsnz lo,F | |
131 movlw .30 | |
132 dcfsnz lo,F | |
133 movlw .31 | |
199 | 134 cpfsgt day ; day ok? |
135 bra set_time_done2 ; OK | |
136 movlw .1 ; not OK, set to 1st | |
0 | 137 movwf day |
138 | |
139 set_time_done2: | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
140 WIN_LEFT .0 |
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
141 WIN_TOP .215 |
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
142 movlw (.160-.0)/7 ; full line length, for various translations. |
0 | 143 movwf temp1 |
144 call PLED_display_clear_common_y1 | |
145 | |
146 movlw d'5' | |
147 movwf wait_temp | |
148 clrf secs | |
149 bcf onesecupdate | |
150 | |
151 set_time_done_loop | |
152 btfss onesecupdate | |
50 | 153 bra set_time_done_loop |
0 | 154 bcf onesecupdate |
155 | |
156 call set_date_refresh | |
157 | |
199 | 158 WIN_LEFT .32 |
0 | 159 WIN_TOP .65 |
160 lfsr FSR2,letter | |
199 | 161 OUTPUTTEXT .22 ; "Hours:" (actual length depends on translation) |
162 | |
0 | 163 movff hours,lo |
164 output_99x | |
123 | 165 PUTC ':' |
0 | 166 movff mins,lo |
167 output_99x | |
123 | 168 PUTC ':' |
0 | 169 movff secs,lo |
170 output_99x | |
123 | 171 STRCAT_PRINT " " |
0 | 172 |
173 decfsz wait_temp,F | |
174 bra set_time_done_loop | |
175 exit_settime: ;Exit | |
176 movlw d'1' | |
177 movwf menupos | |
178 goto more_menu2 | |
179 | |
180 | |
181 set_time_next_or_exit: | |
182 btfsc set_year | |
183 bsf menubit4 ; quit settime | |
184 incf menupos2,F | |
185 movff menupos2,menupos3 | |
186 | |
187 dcfsnz menupos3,F | |
188 bsf set_minutes | |
189 dcfsnz menupos3,F | |
190 bsf set_month | |
191 dcfsnz menupos3,F | |
192 bsf set_day | |
193 dcfsnz menupos3,F | |
194 bsf set_year | |
195 | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
196 WIN_LEFT .0 |
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
197 WIN_TOP .215 |
123 | 198 call PLED_standard_color |
0 | 199 lfsr FSR2,letter |
199 | 200 OUTPUTTEXT .94 ; Set |
0 | 201 |
202 movff menupos2,menupos3 | |
203 decfsz menupos3,F | |
199 | 204 bra set_time_next_or_exit2 |
0 | 205 OUTPUTTEXT .90 ; Minutes |
199 | 206 bra set_time_next_or_exit5 |
0 | 207 set_time_next_or_exit2: |
208 decfsz menupos3,F | |
199 | 209 bra set_time_next_or_exit3 |
0 | 210 OUTPUTTEXT .91 ; Month |
199 | 211 bra set_time_next_or_exit5 |
0 | 212 set_time_next_or_exit3: |
213 decfsz menupos3,F | |
199 | 214 bra set_time_next_or_exit4 |
0 | 215 OUTPUTTEXT .92 ; Day |
199 | 216 bra set_time_next_or_exit5 |
0 | 217 set_time_next_or_exit4: |
218 OUTPUTTEXT .93 ; Year | |
219 | |
220 set_time_next_or_exit5: | |
221 call word_processor | |
222 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
223 return | |
224 | |
225 add_hours_or_minutes_or_date: | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
199
diff
changeset
|
226 bcf switch_left |
0 | 227 clrf secs |
228 | |
229 btfsc set_year | |
50 | 230 bra add_year |
0 | 231 |
232 btfsc set_day | |
50 | 233 bra add_day |
0 | 234 |
235 btfsc set_month | |
50 | 236 bra add_month |
0 | 237 |
238 btfsc set_minutes | |
50 | 239 bra add_minutes |
240 ; Increase hours | |
0 | 241 add_hours: |
242 incf hours,F | |
243 movlw d'23' | |
244 cpfsgt hours | |
245 bra set_time_refresh_x | |
246 clrf hours | |
247 bra set_time_refresh_x | |
248 add_minutes: | |
249 incf mins,F | |
250 movlw d'59' | |
251 cpfsgt mins | |
252 bra set_time_refresh_x | |
253 clrf mins | |
254 bra set_time_refresh_x | |
255 add_day: | |
256 incf day,F | |
257 movlw d'31' | |
258 cpfsgt day | |
259 bra set_time_refresh_x | |
260 movlw d'1' | |
261 movwf day | |
262 bra set_time_refresh_x | |
263 add_month: | |
264 incf month,F | |
265 movlw d'12' | |
266 cpfsgt month | |
267 bra set_time_refresh_x | |
268 movlw d'1' | |
269 movwf month | |
270 bra set_time_refresh_x | |
271 add_year: | |
272 incf year,F | |
273 movlw d'20' ; calendar until 2020 | |
274 cpfsgt year | |
275 bra set_time_refresh_x | |
53 | 276 movlw d'10' |
277 movwf year ; Set Year to 2010 | |
0 | 278 |
279 set_time_refresh_x: | |
280 call set_time_refresh | |
281 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
282 return |