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