annotate src/options.asm @ 133:939f1e83c4c2

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