Mercurial > public > hwos_code
annotate src/options.asm @ 106:bc7c022d2c74
minor
author | heinrichsweikamp |
---|---|
date | Tue, 03 Jun 2014 13:20:44 +0200 |
parents | 223579e905c3 |
children | d39493c786a2 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File options.asm | |
4 ; | |
5 ; Manage all options data. | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-07-12 : [jDG] Creation. | |
11 ; | |
12 ; RATIONALS: | |
13 ; | |
14 ; Provides a centralized file with | |
15 | |
16 #include "ostc3.inc" ; Mandatory header | |
17 #include "strings.inc" | |
18 #include "convert.inc" | |
19 #include "ghostwriter.inc" | |
20 #include "eeprom_rs232.inc" | |
21 #include "external_flash.inc" | |
21
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
22 #include "wait.inc" |
0 | 23 |
24 extern write_eeprom | |
25 extern read_eeprom | |
26 extern eeprom_serial_save,eeprom_opt_backup | |
27 | |
28 global option_reset_all ; Reset all options to factory default. | |
21
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
29 global option_check_all ; Check all option and reset option if out of min/max boundary |
0 | 30 global option_reset ; Reset FSR0 option to factory default. |
31 global option_save_all ; Save options to EEPROM. | |
32 global option_restore_all ; Restore options from EEPROM. | |
33 global option_inc ; Increment FSR0 option. | |
34 global option_draw ; STRCAT FRS0 option. | |
35 | |
21
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
36 |
0 | 37 ;============================================================================= |
38 CBLOCK tmp+0x10 ; Reserve space for wordprocessor & convert | |
39 opt_type | |
40 opt_default | |
41 opt_inc ; Also default+1 (string), and enum low | |
42 opt_min ; also enum high | |
43 opt_max | |
44 opt_unit:2 ; Multi-lingual unit text. | |
45 opt_eeprom | |
46 opt_backup_tbl:3 | |
47 ; Reserved to tmp+0x1F... | |
48 ENDC | |
49 | |
50 gui CODE ; Appends to other GUI segment | |
51 ;============================================================================= | |
52 ; Reset all options to factory defauts. | |
53 ; | |
54 ; INPUT: none | |
55 ; OUTPUT: none | |
56 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1, FSR2 | |
57 | |
58 option_reset_all: | |
59 clrf EEADRH | |
60 read_int_eeprom .2 | |
61 movff EEDATA,lo | |
62 read_int_eeprom .3 | |
63 movff EEDATA,hi | |
64 tstfsz lo ; Total dives=0? | |
65 bra option_reset_all2 ; No, skip resetting logbook | |
66 tstfsz hi ; Total dives=0? | |
67 bra option_reset_all2 ; No, skip resetting logbook | |
68 | |
69 clrf EEADRH ; Make sure to select eeprom bank 0 | |
70 clrf EEDATA | |
71 write_int_eeprom .4 | |
72 write_int_eeprom .5 | |
73 write_int_eeprom .6 | |
74 write_int_eeprom .2 ; Also, delete total dive counter | |
75 write_int_eeprom .3 | |
76 call ext_flash_erase_logbook ; And complete logbook (!) | |
77 | |
78 option_reset_all2: | |
79 clrf lo | |
80 clrf hi | |
81 call do_logoffset_common_write ; reset Logbook offset | |
21
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
82 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
83 ; Point to option table begin |
0 | 84 movlw LOW(option_table_begin) |
85 movwf FSR0L | |
86 movlw HIGH(option_table_begin) | |
87 movwf FSR0H | |
88 option_reset_all_1: | |
89 movf FSR0L,W ; Reached end of table ? | |
90 xorlw LOW(option_table_end) ; (8bit test -> 10 bytes x 128 options max) | |
91 btfsc STATUS,Z ; YES: done. | |
92 return | |
93 | |
94 rcall option_reset ; Reset one option. | |
95 bra option_reset_all_1 ; and loop. | |
96 | |
97 ;============================================================================= | |
21
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
98 ; Check all option and reset option if out of min/max boundary |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
99 ; |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
100 ; INPUT: none |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
101 ; OUTPUT: none |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
102 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1, FSR2 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
103 option_check_all: |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
104 ; Point to option table begin |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
105 movlw LOW(option_table_begin) |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
106 movwf FSR0L |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
107 movlw HIGH(option_table_begin) |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
108 movwf FSR0H |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
109 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
110 option_check_all_1: |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
111 movf FSR0L,W ; Reached end of table ? |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
112 xorlw LOW(option_table_end) ; (8bit test -> 10 bytes x 128 options max) |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
113 btfsc STATUS,Z ; YES: done. |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
114 return |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
115 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
116 rcall option_check ; check one option. |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
117 bra option_check_all_1 ; and loop |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
118 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
119 ;============================================================================= |
0 | 120 ; Read option handle |
121 ; INPUT: FSR0 = option handle | |
122 ; OUTPUT: FSR1 = address of variable. | |
123 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1 | |
124 option_read: | |
125 movff FSR0L,TBLPTRL | |
126 movlw HIGH(option_table_begin); Get 8 high bits. | |
127 andlw 0xF0 ; Keep only the 4 highest ones. | |
128 iorwf FSR0H,W ; Cat with the known 4 lower ones. | |
129 movwf TBLPTRH ; And we have the high byte. | |
130 movlw UPPER(option_table_begin) | |
131 movwf TBLPTRU | |
132 | |
133 ; Read type, default and register from table | |
134 tblrd*+ | |
135 movff TABLAT,opt_type | |
136 tblrd*+ | |
137 movff TABLAT,opt_default | |
138 tblrd*+ | |
139 movff TABLAT,opt_inc | |
140 tblrd*+ | |
141 movff TABLAT,opt_min | |
142 tblrd*+ | |
143 movff TABLAT,opt_max | |
144 tblrd*+ | |
145 movff TABLAT,opt_eeprom | |
146 tblrd*+ | |
147 movff TABLAT,opt_unit+0 | |
148 tblrd*+ | |
149 movff TABLAT,opt_unit+1 | |
150 tblrd*+ | |
151 movff TABLAT,FSR1L | |
152 tblrd*+ | |
153 movff TABLAT,FSR1H | |
154 movff TBLPTRL,FSR0L ; Advance handle too, for reset_all | |
155 movff TBLPTRH,FSR0H | |
156 return | |
21
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
157 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
158 ;============================================================================= |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
159 ; Check one option and reset if it's out of it's min/max boundaries |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
160 ; INPUT: FSR0 = option handle |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
161 ; OUTPUT: none |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
162 ; TRASH: TBLPTR, TABLAT, WREG, FSR1, FSR2, lo |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
163 ; |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
164 option_check: |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
165 ; Read type, default and register from table |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
166 rcall option_read |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
167 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
168 ; Switch on type |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
169 movf opt_type,W ; Type == STRING ? |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
170 xorlw 2 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
171 bz option_check_string ; String: Do not reset strings |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
172 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
173 movf opt_min,W |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
174 cpfsgt INDF1 ; bigger then opt_min? |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
175 bra option_check_reset ; No, reset option |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
176 movf INDF1,W |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
177 cpfsgt opt_max ; bigger then INDF1? |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
178 bra option_check_reset ; No, reset option |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
179 return ; in range, return |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
180 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
181 option_check_reset: |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
182 movff opt_default,INDF1 ; reset option to default |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
183 return ; Done. |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
184 |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
185 option_check_string: |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
186 return |
79b2084fd75a
Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents:
18
diff
changeset
|
187 |
0 | 188 ;============================================================================= |
189 ; Reset an option to its default value. | |
190 ; INPUT: FSR0 = option handle | |
191 ; OUTPUT: none | |
192 ; TRASH: TBLPTR, TABLAT, WREG, FSR1, FSR2 | |
193 ; | |
194 option_reset: | |
195 ; Read type, default and register from table | |
196 rcall option_read | |
197 | |
198 ; Switch on type | |
199 movf opt_type,W ; Type == STRING ? | |
200 xorlw 2 | |
201 bz opt_reset_string ; YES: special copy | |
202 | |
203 movff opt_default,INDF1 ; NO: just a 8bit indirect copy | |
204 return | |
205 | |
206 opt_reset_string: | |
207 movff FSR1L,FSR2L ; set string destination address. | |
208 movff FSR1H,FSR2H | |
209 | |
210 movff opt_default+0,FSR1L ; Get handle to multi-lingual text in FSR1 | |
211 movff opt_default+1,FSR1H | |
212 | |
213 movff TBLPTRL,opt_backup_tbl+0; TBLPTR trashed by text routine... | |
214 movff TBLPTRH,opt_backup_tbl+1 | |
215 movff TBLPTRU,opt_backup_tbl+2 | |
216 | |
217 call strcat_text ; Copy translated text to FSR2 | |
218 | |
219 movff opt_backup_tbl+0,TBLPTRL | |
220 movff opt_backup_tbl+1,TBLPTRH | |
221 movff opt_backup_tbl+2,TBLPTRU | |
222 | |
223 return | |
224 | |
225 ;============================================================================= | |
226 ; Save all options to EEPROM | |
227 option_save_all: | |
228 ;---- Save option serial into EEPROM to detect reset and new version | |
229 movlw LOW(eeprom_serial_save) | |
230 movwf EEADR | |
231 movlw HIGH(eeprom_serial_save) | |
232 movf EEADRH | |
233 movlw LOW(eeprom_opt_serial) | |
234 movwf EEDATA | |
235 call write_eeprom | |
236 incf EEADR,F | |
237 movlw HIGH(eeprom_opt_serial) | |
238 movwf EEDATA | |
239 call write_eeprom | |
240 | |
241 ;---- Save all options | |
242 movlw LOW(option_table_begin) | |
243 movwf FSR0L | |
244 movlw HIGH(option_table_begin) | |
245 movwf FSR0H | |
246 | |
247 option_save_all_1: | |
248 movf FSR0L,W ; Reached end of table ? | |
249 xorlw LOW(option_table_end) ; (8bit test -> 10 bytes x 128 options max) | |
250 btfsc STATUS,Z ; YES: done. | |
251 return | |
252 | |
253 rcall option_save ; Save one option. | |
254 bra option_save_all_1 ; and loop. | |
255 | |
93
5e1ef9bf32ec
clear pressure sensor compensation upon update
heinrichsweikamp
parents:
92
diff
changeset
|
256 global option_save |
0 | 257 option_save: |
258 rcall option_read | |
259 incf opt_eeprom,W ; Should we save it ? | |
260 btfsc STATUS,Z ; eeprom address is FFh ? | |
261 return ; YES: nothing to do. | |
262 | |
263 movf opt_eeprom,W ; Compute backup address in EEPROM | |
264 addlw LOW(eeprom_opt_backup) ; Add offset | |
265 movwf EEADR | |
266 movlw HIGH(eeprom_opt_backup) | |
267 movwf EEADRH | |
268 | |
269 movf opt_type,W ; Option type is string ? | |
270 xorlw 2 | |
271 bz option_save_string | |
272 | |
273 ; One byte to save to eeprom | |
274 movff INDF1,EEDATA | |
275 goto write_eeprom | |
276 | |
277 option_save_string: | |
278 movff POSTINC1,EEDATA ; Write one byte | |
279 call write_eeprom | |
280 infsnz EEADR,F | |
281 incf EEADRH,F | |
282 | |
283 decfsz opt_max ; Decrement string length | |
284 bra option_save_string ; And loop while not finished | |
285 | |
286 return | |
287 ;============================================================================= | |
288 | |
289 option_restore_all: | |
290 ;---- Read option serial from EEPROM | |
291 movlw LOW(eeprom_serial_save) | |
292 movwf EEADR | |
293 movlw HIGH(eeprom_serial_save) | |
294 movf EEADRH | |
295 call read_eeprom | |
296 movlw LOW(eeprom_opt_serial) | |
297 xorwf EEDATA,W | |
298 bnz option_restore_bad ; Auto reset if changed. | |
299 incf EEADR,F | |
300 call read_eeprom | |
301 movlw HIGH(eeprom_opt_serial) | |
302 xorwf EEDATA,W | |
303 bz option_restore_ok ; Auto reset if changed. | |
304 | |
305 option_restore_bad: | |
306 call option_reset_all ; Reset RAM contains | |
307 goto option_save_all ; Then save to EEPROM | |
308 | |
309 ;---- Proper restore | |
310 option_restore_ok: | |
311 movlw LOW(option_table_begin) | |
312 movwf FSR0L | |
313 movlw HIGH(option_table_begin) | |
314 movwf FSR0H | |
315 | |
316 option_restore_all_1: | |
317 movf FSR0L,W ; Reached end of table ? | |
318 xorlw LOW(option_table_end) ; (8bit test -> 10 bytes x 128 options max) | |
319 btfsc STATUS,Z ; YES: done. | |
320 return | |
321 | |
322 rcall option_restore ; Restore one option. | |
323 bra option_restore_all_1 ; and loop. | |
324 return | |
325 | |
326 option_restore: | |
327 rcall option_read | |
328 incf opt_eeprom,W ; Should we save it ? | |
329 btfsc STATUS,Z ; eeprom address is FFh ? | |
330 return ; YES: nothing to do. | |
331 | |
332 movf opt_eeprom,W ; Compute backup address in EEPROM | |
333 addlw LOW(eeprom_opt_backup) ; Add offset | |
334 movwf EEADR | |
335 movlw HIGH(eeprom_opt_backup) | |
336 movwf EEADRH | |
337 | |
338 movf opt_type,W ; Option type is string ? | |
339 xorlw 2 | |
340 bz option_restore_string | |
341 | |
342 ; Read one byte from eeprom | |
343 call read_eeprom | |
344 movff EEDATA, INDF1 ; And restore option register. | |
345 return | |
346 | |
347 option_restore_string: | |
348 call read_eeprom ; Read one byte, and | |
349 movff EEDATA,POSTINC1 ; restore it | |
350 infsnz EEADR,F | |
351 incf EEADRH,F | |
352 | |
353 decfsz opt_max ; Decrement string length | |
354 bra option_restore_string ; And loop while not finished | |
355 return | |
356 | |
357 ;============================================================================= | |
358 ; Increment an option, based on type, and boundary. | |
359 ; INPUT: FSR0 = option handle | |
360 ; OUTPUT: none | |
361 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1 | |
362 option_inc: | |
363 ; Read type, default and register from table | |
364 rcall option_read | |
365 | |
366 ; Switch on type | |
367 movf opt_type,W | |
368 bz option_inc_uint8 | |
369 dcfsnz WREG | |
370 bra option_inc_enum8 | |
371 dcfsnz WREG | |
372 bra option_inc_string | |
373 | |
374 option_inc_uint8: ; Defaults type too... | |
375 movf INDF1,W | |
376 addwf opt_inc,W | |
377 cpfslt opt_max | |
378 bra option_inc_1 | |
379 movf opt_min,W | |
380 option_inc_1: | |
381 movwf INDF1 | |
382 return | |
383 | |
384 option_inc_enum8: ; Always +1 | |
385 incf INDF1,W | |
386 cpfsgt opt_max | |
387 clrf WREG | |
388 movwf INDF1 | |
389 return | |
390 | |
391 option_inc_string: ; No edition yet... | |
392 return | |
393 | |
394 ;============================================================================= | |
395 ; Strcat option into FSR2 buffer. | |
396 option_draw: | |
397 ; Read type, default and register from table | |
398 rcall option_read | |
399 | |
400 ; Switch on type | |
401 movf opt_type,W | |
402 bz option_draw_uint8 | |
403 dcfsnz WREG | |
404 bra option_draw_enum8 | |
405 dcfsnz WREG | |
406 bra option_draw_string | |
407 return ; Unknown: return... | |
408 | |
409 option_draw_uint8: | |
410 movff INDF1,lo ; Draw value. | |
411 output_8 | |
412 clrf INDF2 ; Make sure to close string... | |
413 | |
414 movf opt_unit+0,W ; Is there a unit to append ? | |
415 iorwf opt_unit+1,W | |
416 rcall option_draw_unit | |
417 | |
418 movf opt_default,W ; Default value | |
419 cpfseq lo ; Current value | |
420 bra option_draw_uint8_2 ; Not default, add * | |
421 return ; Default, Done. | |
422 option_draw_uint8_2: | |
423 PUTC "*" | |
424 return ; Done. | |
425 | |
426 option_draw_unit: | |
427 movff opt_unit+0,FSR1L | |
428 movff opt_unit+1,FSR1H | |
429 goto strcat_text | |
430 | |
431 | |
432 | |
433 ;---- Draw an enumerated value (set of translated strings) | |
434 option_draw_enum8: | |
435 movf INDF1,W ; Get current value. | |
436 cpfsgt opt_max ; Bound value | |
437 clrf WREG | |
438 addwf WREG ; *= 2 | |
439 addwf opt_inc,W ; Base text + 2 * value | |
440 movwf FSR1L | |
441 movlw 0 | |
442 addwfc opt_min,W ; Propagate carry | |
443 movwf FSR1H ; Into FSR1 | |
444 | |
445 goto strcat_text | |
446 | |
447 option_draw_string: | |
448 movff POSTINC1,POSTINC2 | |
449 decfsz opt_max | |
450 bra option_draw_string | |
451 return | |
452 | |
453 ;============================================================================= | |
454 ; Options Tables | |
455 | |
456 OPTION_UINT8 MACRO lbl, min, max, default, unit, eeprom, register | |
457 global lbl | |
458 lbl: db 0, default ; Type0 = INT8 | |
459 db 1, min | |
460 db max, eeprom | |
461 dw unit | |
462 dw register | |
463 ENDM | |
464 | |
465 OPTION_UINT8p2 MACRO lbl, min, max, default, unit, eeprom, register | |
466 global lbl | |
467 lbl: db 0, default ; Type0 = INT8 | |
468 db 2, min | |
469 db max, eeprom | |
470 dw unit | |
471 dw register | |
472 ENDM | |
473 | |
474 OPTION_UINT8p3 MACRO lbl, min, max, default, unit, eeprom, register | |
475 global lbl | |
476 lbl: db 0, default ; Type0 = INT8 | |
477 db 3, min | |
478 db max, eeprom | |
479 dw unit | |
480 dw register | |
481 ENDM | |
482 | |
483 OPTION_UINT8p10 MACRO lbl, min, max, default, unit, eeprom, register | |
484 global lbl | |
485 lbl: db 0, default ; Type0 = INT8 | |
486 db .10, min | |
487 db max, eeprom | |
488 dw unit | |
489 dw register | |
490 ENDM | |
491 | |
492 OPTION_ENUM8 MACRO lbl, max, default, tValue, eeprom, register | |
493 global lbl | |
494 extern tValue | |
495 lbl: db 1, default ; Type1 = ENUM | |
496 db LOW(tValue), HIGH(tValue) | |
497 db max, eeprom | |
498 dw 0 ; No unit | |
499 dw register | |
500 ENDM | |
501 | |
502 OPTION_BOOL MACRO lbl, default, eeprom, register | |
503 OPTION_ENUM8 lbl, 2, default, tNo, eeprom, register | |
504 ENDM | |
505 | |
506 | |
507 OPTION_STRING MACRO lbl, length, defText, eeprom, register | |
508 global lbl | |
509 lbl: db 2, LOW(defText) ; Type2 = STRING | |
510 db HIGH(defText), 0 | |
511 db length, eeprom | |
512 dw 0 ; No unit | |
513 dw register | |
514 ENDM | |
515 | |
516 ;============================================================================= | |
517 ; Option table | |
518 ; OPTION_UINT8 Label, min, max, default, text-string, EEPROM location (-1 for RAM only), RAM location | |
519 | |
520 ; Manage Gas List. | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
521 extern tPercent, tMeters, tMinutes, tGasDisabled, tbar, tcharx |
0 | 522 |
523 option_table_begin: | |
524 extern char_I_deco_gas_change, char_I_setpoint_change, char_I_setpoint_cbar, char_I_dil_change | |
525 ;============================================================================= | |
526 ; Manage Decoplaner & Dive parameters | |
527 | |
528 extern char_I_dive_interval, char_I_bottom_time, char_I_bottom_depth | |
529 OPTION_UINT8p10 odiveInterval, .0, .240, .0, tMinutes, -1, char_I_dive_interval | |
530 OPTION_UINT8p2 obottomTime, .1, .60, .5, tMinutes, -1, char_I_bottom_time | |
531 OPTION_UINT8p3 obottomDepth, .12,.120, .21, tMeters, -1, char_I_bottom_depth | |
532 | |
533 extern char_I_deco_model, char_I_saturation_multiplier, char_I_desaturation_multiplier | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
534 OPTION_ENUM8 oDiveMode, 4, 0, tDvOC, .8, opt_dive_mode ; 0=OC, 1=CC, 2=Gauge, 3=Apnea |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
535 OPTION_ENUM8 oDecoMode, 2, 1, tZHL16, .9, char_I_deco_model ; 0 = ZH-L16, 1 = ZH-L16-GF |
0 | 536 OPTION_UINT8p10 oPPO2Max, .120, ppo2_warning_high, .160, 0, .10, opt_ppO2_max |
537 OPTION_UINT8 oLastDeco, .3, .6, .3, tMeters, .11, opt_last_stop | |
22 | 538 OPTION_UINT8 oGF_low, .10, .100, .30, tPercent, .12, opt_GF_low |
32 | 539 OPTION_UINT8 oGF_high, .60, .110, .85, tPercent, .13, opt_GF_high |
0 | 540 OPTION_UINT8p10 osatmult, .100, .140, .110,tPercent, .14, char_I_saturation_multiplier |
541 OPTION_UINT8p10 odesatmult, .60, .100, .90,tPercent, .15, char_I_desaturation_multiplier | |
542 OPTION_UINT8p10 oPPO2Min, .16, ppo2_warning_low, .19, 0, .16, opt_ppO2_min | |
543 OPTION_UINT8 oaGF_low, .60, .100, .60, tPercent, .17, opt_aGF_low | |
32 | 544 OPTION_UINT8 oaGF_high, .70, .120, .85, tPercent, .18, opt_aGF_high |
69 | 545 OPTION_BOOL oEnable_aGF, 0, .19, opt_enable_aGF ; =1: aGF can be selected underwater |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
546 OPTION_UINT8 oCompassGain, 0, 7, 6, tcharx, .20, opt_compass_gain ; 0-7 (230LSB/Gauss to 1370LSB/Gauss) |
24 | 547 OPTION_ENUM8 oSamplingRate, 2, 0, tSampling2s, .21, opt_sampling_rate ; =1: 10s, =0: 2s |
0 | 548 |
549 ;============================================================================= | |
550 ; Managing Settings | |
551 extern char_I_extra_time | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
552 OPTION_UINT8 oExtraTime, 0, .9, 0,tMinutes, .22, char_I_extra_time ; Future TTS |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
553 OPTION_ENUM8 oBrightness, 3, 0, tEco, .23, opt_brightness ; =0: Eco, =1:Medium, =2:Full |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
554 OPTION_UINT8 oDiveSalinity, 0, 4, 0, tPercent, .24, opt_salinity ; 0-5% |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
555 OPTION_ENUM8 oCCRMode, 2, 0, tCCRModeFixedSP, .25, opt_ccr_mode ; =0: Fixed SP, =1: Sensor |
0 | 556 extern tDefName |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
557 OPTION_ENUM8 oLanguage, 4, 0, tEnglish, .26, opt_language ; 0=EN, 1=DE, 2=FR, 3=SP |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
558 OPTION_ENUM8 oDateFormat, 3, 1, tDateformat,.27, opt_dateformat ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
559 OPTION_ENUM8 oUnits, 2, 0, tMetric, .28, opt_units ; 0=Meters, 1=Feets |
0 | 560 |
561 ;============================================================================= | |
562 ; Compass calibration data | |
563 OPTION_UINT8 oCalx0, 0,.255,.0, 0, .29, compass_CX_f+0 | |
564 OPTION_UINT8 oCalx1, 0,.255,.0, 0, .30, compass_CX_f+1 | |
565 OPTION_UINT8 oCaly0, 0,.255,.0, 0, .31, compass_CY_f+0 | |
566 OPTION_UINT8 oCaly1, 0,.255,.0, 0, .32, compass_CY_f+1 | |
567 OPTION_UINT8 oCalz0, 0,.255,.0, 0, .33, compass_CZ_f+0 | |
568 OPTION_UINT8 oCalz1, 0,.255,.0, 0, .34, compass_CZ_f+1 | |
569 | |
570 OPTION_ENUM8 oGas1, 3, 1, tGasDisabled, .35, opt_gas_type+0; 0=Disabled, 1=First, 2=Travel, 3=Deco | |
571 OPTION_ENUM8 oGas2, 3, 0, tGasDisabled, .36, opt_gas_type+1 | |
572 OPTION_ENUM8 oGas3, 3, 0, tGasDisabled, .37, opt_gas_type+2 | |
573 OPTION_ENUM8 oGas4, 3, 0, tGasDisabled, .38, opt_gas_type+3 | |
574 OPTION_ENUM8 oGas5, 3, 0, tGasDisabled, .39, opt_gas_type+4 | |
575 OPTION_UINT8 oGas1O2, .21,.100, .21, tPercent, .40, opt_gas_O2_ratio+0 | |
576 OPTION_UINT8 oGas1He, .1, .100, .0, tPercent, .41, opt_gas_He_ratio+0 | |
577 OPTION_UINT8 oGas2O2, .21,.100, .21, tPercent, .42, opt_gas_O2_ratio+1 | |
578 OPTION_UINT8 oGas2He, .1, .100, .0, tPercent, .43, opt_gas_He_ratio+1 | |
579 OPTION_UINT8 oGas3O2, .21,.100, .21, tPercent, .44, opt_gas_O2_ratio+2 | |
580 OPTION_UINT8 oGas3He, .1, .100, .0, tPercent, .45, opt_gas_He_ratio+2 | |
581 OPTION_UINT8 oGas4O2, .21,.100, .21, tPercent, .46, opt_gas_O2_ratio+3 | |
582 OPTION_UINT8 oGas4He, .1, .100, .0, tPercent, .47, opt_gas_He_ratio+3 | |
583 OPTION_UINT8 oGas5O2, .21,.100, .21, tPercent, .48, opt_gas_O2_ratio+4 | |
584 OPTION_UINT8 oGas5He, .1, .100, .0, tPercent, .49, opt_gas_He_ratio+4 | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
93
diff
changeset
|
585 OPTION_UINT8 oGas1Depth, .0, .100, .0, tMeters, .50, opt_OC_bail_gas_change+0 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
93
diff
changeset
|
586 OPTION_UINT8 oGas2Depth, .0, .100, .0, tMeters, .51, opt_OC_bail_gas_change+1 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
93
diff
changeset
|
587 OPTION_UINT8 oGas3Depth, .0, .100, .0, tMeters, .52, opt_OC_bail_gas_change+2 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
93
diff
changeset
|
588 OPTION_UINT8 oGas4Depth, .0, .100, .0, tMeters, .53, opt_OC_bail_gas_change+3 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
93
diff
changeset
|
589 OPTION_UINT8 oGas5Depth, .0, .100, .0, tMeters, .54, opt_OC_bail_gas_change+4 |
0 | 590 OPTION_UINT8 oDil1O2, .21,.100, .21, tPercent, .55, opt_dil_O2_ratio+0 |
591 OPTION_UINT8 oDil1He, .1, .100, .0, tPercent, .56, opt_dil_He_ratio+0 | |
592 OPTION_UINT8 oDil2O2, .21,.100, .21, tPercent, .57, opt_dil_O2_ratio+1 | |
593 OPTION_UINT8 oDil2He, .1, .100, .0, tPercent, .58, opt_dil_He_ratio+1 | |
594 OPTION_UINT8 oDil3O2, .21,.100, .21, tPercent, .59, opt_dil_O2_ratio+2 | |
595 OPTION_UINT8 oDil3He, .1, .100, .0, tPercent, .60, opt_dil_He_ratio+2 | |
596 OPTION_UINT8 oDil4O2, .21,.100, .21, tPercent, .61, opt_dil_O2_ratio+3 | |
597 OPTION_UINT8 oDil4He, .1, .100, .0, tPercent, .62, opt_dil_He_ratio+3 | |
598 OPTION_UINT8 oDil5O2, .21,.100, .21, tPercent, .63, opt_dil_O2_ratio+4 | |
599 OPTION_UINT8 oDil5He, .1, .100, .0, tPercent, .64, opt_dil_He_ratio+4 | |
600 OPTION_UINT8 oSetPoint1, .20, .160, .70, tbar, .65, char_I_setpoint_cbar+0 | |
601 OPTION_UINT8 oSetPoint2, .20, .160, .90, tbar, .66, char_I_setpoint_cbar+1 | |
602 OPTION_UINT8 oSetPoint3, .20, .160, .100, tbar, .67, char_I_setpoint_cbar+2 | |
603 OPTION_UINT8 oSetPoint4, .20, .160, .120, tbar, .68, char_I_setpoint_cbar+3 | |
604 OPTION_UINT8 oSetPoint5, .20, .160, .140, tbar, .69, char_I_setpoint_cbar+4 | |
605 OPTION_UINT8 oSP1Depth, .0, .100, .0, tMeters, .70, char_I_setpoint_change+0 | |
606 OPTION_UINT8 oSP2Depth, .0, .100, .0, tMeters, .71, char_I_setpoint_change+1 | |
607 OPTION_UINT8 oSP3Depth, .0, .100, .0, tMeters, .72, char_I_setpoint_change+2 | |
608 OPTION_UINT8 oSP4Depth, .0, .100, .0, tMeters, .73, char_I_setpoint_change+3 | |
609 OPTION_UINT8 oSP5Depth, .0, .100, .0, tMeters, .74, char_I_setpoint_change+4 | |
610 OPTION_ENUM8 oDil1, 2, 1, tDilDisabled, .75, opt_dil_type+0 ; 0=Disabled, 1=First, 2=Normal | |
611 OPTION_ENUM8 oDil2, 2, 0, tDilDisabled, .76, opt_dil_type+1 | |
612 OPTION_ENUM8 oDil3, 2, 0, tDilDisabled, .77, opt_dil_type+2 | |
613 OPTION_ENUM8 oDil4, 2, 0, tDilDisabled, .78, opt_dil_type+3 | |
614 OPTION_ENUM8 oDil5, 2, 0, tDilDisabled, .79, opt_dil_type+4 | |
615 OPTION_UINT8 oDil1Depth, .0, .100, .0, tMeters, .80, char_I_dil_change+0 | |
616 OPTION_UINT8 oDil2Depth, .0, .100, .0, tMeters, .81, char_I_dil_change+1 | |
617 OPTION_UINT8 oDil3Depth, .0, .100, .0, tMeters, .82, char_I_dil_change+2 | |
618 OPTION_UINT8 oDil4Depth, .0, .100, .0, tMeters, .83, char_I_dil_change+3 | |
619 OPTION_UINT8 oDil5Depth, .0, .100, .0, tMeters, .84, char_I_dil_change+4 | |
620 OPTION_STRING oName, opt_name_length, tDefName, .85, opt_name | |
621 ; opt_name from 85 to 145 | |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
79
diff
changeset
|
622 OPTION_ENUM8 oColorSetDive, 4, 0, tColorSetName0, .146, opt_dive_color_scheme ; Color scheme divemode |
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
79
diff
changeset
|
623 OPTION_UINT8 oPressureAdjust, .0,.255, .0, -1, .147, opt_pressure_adjust ; SIGNED int (-20/+20mbar max.) |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
97
diff
changeset
|
624 OPTION_BOOL oSafetyStop, 0, .148, opt_enable_safetystop ; =1: A safety stop is shown |
0 | 625 |
626 ; Set Time/Set Date | |
627 OPTION_UINT8 oSetHours, .0, .23, .0, 0, -1, hours | |
628 OPTION_UINT8 oSetMinutes, .0, .59, .0, 0, -1, mins | |
629 OPTION_UINT8 oSetDay, .1, .31, .0, 0, -1, day | |
630 OPTION_UINT8 oSetMonth, .1, .12, .0, 0, -1, month | |
631 OPTION_UINT8 oSetYear, .13,.20, .0, 0, -1, year | |
632 | |
633 option_table_end: | |
634 END |