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