Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_reset.asm @ 230:9406a5b0ba5e
BUGFIX Clear bottom stops when display gas usage (bug BB23)
author | JeanDo |
---|---|
date | Tue, 15 Mar 2011 18:44:16 +0100 |
parents | 85ea09d3b9d8 |
children | 1efd59d689f8 |
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 "Reset all" | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 10/30/05 | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
22 ; last updated: 10/12/08 by JD Gascuel at free.fr |
0 | 23 ; known bugs: |
24 ; ToDo: | |
25 | |
26 ; routines to reset external EEPROM (currently inactvated!) | |
27 ; routines to reset custom function, gases and decompression values | |
28 ; does not reset clock | |
29 | |
79 | 30 ;============================================================================= |
31 ; CF default values | |
32 ; | |
33 | |
34 ; Macro to check values, and construct PROM CF default table. | |
35 ; If in types mode, set flags into hi. If not, clear it. | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
36 CF_DEFAULT macro type, default, min, max |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
37 noexpand |
99 | 38 CFn set 1+CFn |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
39 if (type) == CF_INT15 |
99 | 40 if HIGH (default) > .127 |
41 error CF#v(CFn) "15bit default too big: ", default | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
42 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
43 if (min)>0 && (max>min) |
99 | 44 error CF#v(CFn) "15bit defaults cannot have both MIN & MAX flags" |
45 endif | |
46 if HIGH(min) > .127 | |
47 error CF#v(CFn) "15bit MIN value too big: ", min | |
48 endif | |
49 if HIGH(max) > .127 | |
50 error CF#v(CFn) "15bit MAX value too big: ", max | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
51 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
52 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
53 ifdef NO_CF_TYPES |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
54 DB LOW (default), HIGH(default) + 0x80 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
55 else |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
56 DB LOW (default), HIGH(default) + 0x80 |
99 | 57 if (max) > (min) |
58 DB LOW(max), HIGH(max) + 0x80 | |
59 else | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
60 DB LOW(min), HIGH(min) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
61 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
62 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
63 else |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
64 ; Basic sanity check for 8bit values: |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
65 if HIGH(default) > 0 |
99 | 66 error CF#v(CFn) "8bit default too big: ", default |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
67 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
68 if HIGH(min) > 0 |
99 | 69 error CF#v(CFn) "8bit min too big: ", min |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
70 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
71 if HIGH(max) > 0 |
99 | 72 error CF#v(CFn) "8bit max too big: ", max |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
73 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
74 if ((type)==CF_BOOL) && ( (default)>1 ) |
99 | 75 error CF#v(CFn) "BOOL default too big: ", default |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
76 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
77 if ((type)==CF_BOOL) && ( (min)>0 || (max)>0 ) |
99 | 78 error CF#v(CFn) "BOOL cannot have min/max" |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
79 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
80 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
81 ifdef NO_CF_TYPES |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
82 DB LOW(default), 0 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
83 else |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
84 local typeFlags |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
85 typeFlags set type |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
86 if (min)>0 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
87 typeFlags set type + CF_MIN |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
88 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
89 if (max)>(min) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
90 typeFlags set typeFlags + CF_MAX |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
91 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
92 DB LOW(default), (typeFlags), LOW(min), LOW(max) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
93 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
94 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
95 expand |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
96 endm |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
97 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
98 ; Starting at CF0 |
99 | 99 CFn set -1 |
79 | 100 |
101 ; resets all customfunctions to the following default values | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
102 cf_default_table0: |
79 | 103 ;---- BANK0 custom function defaults ------------------------------------- |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
104 ; DEFAULT MIN MAX |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
105 CF_DEFAULT CF_CENTI, d'100', d'50', d'250' ; dive_threshold 100cm |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
106 CF_DEFAULT CF_CENTI, d'30', d'10', d'100' ; surf_threshold 30cm |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
107 CF_DEFAULT CF_SEC, d'240', d'30', d'240' ; diveloop_timeout 240s |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
108 CF_DEFAULT CF_SEC, d'120', d'30', d'240' ; surfloop_timeout 120s |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
109 CF_DEFAULT CF_SEC, d'5', d'1', d'30' ; premenu_timeout 5s |
79 | 110 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
111 CF_DEFAULT CF_INT8, d'7', d'3', d'18' ; minimum_velocity 7min/min |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
112 CF_DEFAULT CF_INT15, d'1160',d'950', 0 ; pressure_offset_divemode 1160mBar |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
113 CF_DEFAULT CF_INT15, d'1100',d'1100', 0 ; max_surfpressure 1100mBar |
105 | 114 CF_DEFAULT CF_PERCENT, d'20', d'1', d'99' ; min_gradient_factor 20% |
173 | 115 CF_DEFAULT CF_PERCENT, d'20', d'1', d'22' ; oxygen_threshold 22% |
79 | 116 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
117 CF_DEFAULT CF_SEC, d'30', d'5', d'30' ; dive_menu_timeout 30s |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
118 CF_DEFAULT CF_PERCENT, d'110', d'110', d'200' ; saturation_multiplier x1.10 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
119 CF_DEFAULT CF_PERCENT, d'90', d'50', d'90' ; desaturation_multiplier x0.90 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
120 CF_DEFAULT CF_PERCENT, d'60', d'60', d'100' ; nofly_time_ratio 60% |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
121 CF_DEFAULT CF_PERCENT, d'100', d'50', d'100' ; gradient_factor_alarm1 100% |
79 | 122 |
105 | 123 CF_DEFAULT CF_PERCENT, d'10', d'0', d'100' ; cns_display_surface 10% |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
86
diff
changeset
|
124 CF_DEFAULT CF_DECI, d'10', d'0', d'10' ; deco_distance_for_sim 1m |
105 | 125 CF_DEFAULT CF_CENTI, d'019', d'19', d'021' ; ppo2_warning_low 0.19 Bar |
126 CF_DEFAULT CF_CENTI, d'160', d'0', d'160' ; ppo2_warning_high 1.60 Bar | |
127 CF_DEFAULT CF_CENTI, d'150', d'0', d'150' ; ppo2_display_high 1.50 Bar | |
79 | 128 |
105 | 129 CF_DEFAULT CF_INT8, d'10', d'1', d'120' ; sampling_rate 10s |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
130 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_temp /6 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
131 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_deco /6 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
132 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_tank never |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
133 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_ppo2 never |
79 | 134 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
135 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_deco2 never |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
136 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_nyu2 never |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
137 CF_DEFAULT CF_PERCENT, d'20', d'5', d'75' ; cns_display_high 20% |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
138 CF_DEFAULT CF_INT15, d'0', d'0', 0 ; logbook_offset No Offset, but 15Bit value |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
139 CF_DEFAULT CF_INT8, d'3', d'2', d'6' ; last_deco_depth 3m |
79 | 140 |
128 | 141 CF_DEFAULT CF_SEC, d'10', d'1', d'15' ; timeout_apnoe_mode 10min |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
142 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_voltage_value =1 Show value instead of symbol, =0 Show Symbol |
79 | 143 |
144 ;---- BANK1 custom function defaults ------------------------------------- | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
145 cf_default_table1: |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
146 ; DEFAULT MIN MAX |
157 | 147 CF_DEFAULT CF_PERCENT, d'30', d'5', d'90' ; GF_low_default 30% |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
148 CF_DEFAULT CF_PERCENT, d'90', d'30', d'95' ; GF_high_default 90% |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
149 CF_DEFAULT CF_COLOR, d'199', 0, 0 ; color_battery_surface Color Battery sign: Deep blue |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
150 CF_DEFAULT CF_COLOR, d'255', 0, 0 ; color_standard1 Color Standard: White |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
151 CF_DEFAULT CF_COLOR, d'62', 0, 0 ; color_divemask Color Divemask: Light green |
99 | 152 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
153 CF_DEFAULT CF_COLOR, d'224', 0, 0 ; color_warnings Color Warnings: Red |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
154 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_seconds_divemode =1 Show the seconds in Divemode |
138 | 155 CF_DEFAULT CF_BOOL, 0, 0, 0 ; Adjust SetPoint if Diluent ppO2 > SetPoint |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
156 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; warn_ceiling_divemode =1 Warn ceiling violation in divemode |
121
e0f29e20bd24
Mix-type icons: check apnoe/gauge/CF#41, depth=0, and first gas. Changed colors.
JeanDo
parents:
116
diff
changeset
|
157 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; Show mix type is surfmode |
128 | 158 |
115 | 159 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; blink_gas_divemode =1 blink better gas |
100 | 160 CF_DEFAULT CF_INT15, d'13000', 0, d'13000' ; color_warn_depth_mBar Warn depths |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
161 CF_DEFAULT CF_PERCENT, d'101', d'50', d'101' ; color_warn_cns_percent Warn-% |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
162 CF_DEFAULT CF_PERCENT, d'101', d'50', d'101' ; color_warn_gf_percent Warn-% |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
163 CF_DEFAULT CF_CENTI, d'161', d'100', d'161' ; color_warn_ppo2_cbar ppO2 warn |
128 | 164 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
165 CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; color_warn_celocity_mmin warn at xx m/min |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
166 CF_DEFAULT CF_SEC, d'42', d'0', d'240' ; time_correction_value_default Adds to Seconds on Midnight |
157 | 167 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF#49 Show Altimeter in surface mode |
129
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
125
diff
changeset
|
168 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF50 Show Log-Marker |
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
125
diff
changeset
|
169 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF51 Show Stopwatch |
79 | 170 |
129
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
125
diff
changeset
|
171 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF52 Show Tissue Graph in Divemode |
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
125
diff
changeset
|
172 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF53 Show Laeding Tissue in Divemode |
197 | 173 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF54 Display shallowest stop first |
174 CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; GF55 Gas switch additional delay | |
224 | 175 CF_DEFAULT CF_DECI, d'200', d'5', 0 ; CF56 Bottom gas usage (l/min or bar/min) |
176 | |
177 CF_DEFAULT CF_DECI, d'200', d'5', 0 ; CF57 Ascent/deco gas usage (l/min or bar/min) | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
178 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
179 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
180 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
181 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
79 | 182 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
183 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
184 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
99 | 185 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
186 cf_default_table2: |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
187 |
79 | 188 ;============================================================================= |
189 | |
0 | 190 menu_reset: |
191 movlw d'1' | |
192 movwf menupos | |
193 | |
194 call PLED_ClearScreen | |
195 call PLED_reset_menu_mask | |
196 | |
197 menu_reset2: | |
198 clrf timeout_counter2 | |
199 bcf sleepmode | |
200 bcf menubit2 | |
201 bcf menubit3 | |
202 bsf menubit | |
203 bsf cursor | |
204 call PLED_reset_menu_mask | |
205 call PLED_menu_cursor | |
206 bcf switch_left | |
207 bcf switch_right | |
208 menu_reset_loop: | |
209 call check_switches_menu | |
210 btfsc menubit2 | |
211 bra do_menu_reset ; call submenu | |
212 btfss menubit | |
213 bra menu ; exit setup menu and return to main menu | |
214 btfsc onesecupdate | |
215 call timeout_surfmode | |
216 btfsc onesecupdate | |
217 call set_dive_modes | |
218 btfsc onesecupdate | |
219 call test_charger ; check if charger IC is active | |
220 btfsc onesecupdate | |
221 call get_battery_voltage ; get battery voltage | |
222 bcf onesecupdate ; End of one second tasks | |
223 btfsc sleepmode | |
224 goto menu | |
225 btfsc divemode | |
226 goto restart ; exit menu, restart and enter divemode | |
227 bra menu_reset_loop | |
228 do_menu_reset: ; calls submenu | |
229 dcfsnz menupos,F | |
230 bra do_menu_reset_exit ; Cancel, exit | |
231 dcfsnz menupos,F | |
232 bra do_menu_reset_all ; Reset all settings | |
233 dcfsnz menupos,F | |
234 bra do_menu_reset_logbook ; Reset Logbook Memory! | |
235 dcfsnz menupos,F | |
236 bra do_menu_reset_reboot ; Reboot OSTC | |
237 dcfsnz menupos,F | |
238 bra do_menu_reset_decodata ; Reset Decodata | |
239 do_menu_reset_exit: | |
240 movlw d'3' | |
241 movwf menupos | |
242 bra menu2 ; exit... | |
243 | |
244 | |
245 do_menu_reset_reboot: | |
246 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
247 movwf menupos ; Used as temp | |
248 tstfsz menupos | |
249 bra do_menu_reset_reboot2 ; Delete now! | |
250 bra do_menu_reset_exit ; Cancel! | |
251 | |
252 do_menu_reset_reboot2: | |
253 call PLED_DisplayOff ; Power-down OLED | |
254 movlw b'00000000' ; Bit6: PPL Disable | |
255 movwf OSCTUNE | |
256 movlw b'01111110' ; 8MHz | |
257 movwf OSCCON | |
258 reset | |
259 goto 0x00000 ; restart to 0x00000 | |
260 | |
261 do_menu_reset_logbook: | |
262 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
263 movwf menupos ; Used as temp | |
264 tstfsz menupos | |
265 bra do_menu_reset_logbook2 ; Delete Logbook now! | |
266 bra do_menu_reset_exit ; Cancel! | |
267 | |
268 do_menu_reset_logbook2: | |
269 call PLED_ClearScreen | |
123 | 270 setf win_color1 ; Make sure to display in white color. |
271 setf win_color2 | |
272 DISPLAYTEXT .25 ; "Reset..." | |
0 | 273 call reset_external_eeprom ; delete profile memory |
274 bra do_menu_reset_exit | |
275 | |
276 do_menu_reset_decodata: | |
277 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
278 movwf menupos ; Used as temp | |
279 tstfsz menupos | |
280 bra do_menu_reset_decodata2 ; Reset Deco Data now! | |
281 bra do_menu_reset_exit ; Cancel! | |
282 | |
283 do_menu_reset_decodata2: | |
284 ; reset deco data | |
285 call PLED_ClearScreen | |
286 DISPLAYTEXT .25 ; "Reset..." | |
287 movff amb_pressure+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine | |
288 movff amb_pressure+1,int_I_pres_respiration+1 | |
116 | 289 call deco_clear_tissue |
0 | 290 movlb b'00000001' ; RAM Bank1 selected |
291 goto restart ; done. quit to surfmode | |
292 | |
293 do_menu_reset_all: | |
294 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
295 movwf menupos ; Used as temp | |
296 tstfsz menupos | |
297 bra do_menu_reset_all2 ; Reset all now! | |
298 bra do_menu_reset_exit ; Cancel! | |
299 | |
300 do_menu_reset_all2: | |
301 call PLED_ClearScreen | |
302 DISPLAYTEXT .25 ; "Reset..." | |
303 | |
304 reset_start: | |
305 ; reset deco data | |
306 movff amb_pressure+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine | |
307 movff amb_pressure+1,int_I_pres_respiration+1 | |
116 | 308 call deco_clear_tissue |
0 | 309 movlb b'00000001' ; RAM Bank1 selected |
310 | |
311 ; reset gases | |
312 clrf EEADRH ; EEPROM BANK 0 ! | |
313 | |
314 movlw d'3' ; address of first gas-1 | |
315 movwf EEADR | |
316 clrf hi ; He part (default for all gases: 0%) | |
317 movlw d'21' ; O2 part (21%) | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
318 rcall reset_gas ; saves default and current value for gas #1 |
0 | 319 movlw d'21' ; O2 part (21%) |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
320 rcall reset_gas ; saves default and current value for gas #2 |
0 | 321 movlw d'21' ; O2 part (21%) |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
322 rcall reset_gas ; saves default and current value for gas #3 |
0 | 323 movlw d'21' ; O2 part (21%) |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
324 rcall reset_gas ; saves default and current value for gas #4 |
0 | 325 movlw d'21' ; O2 part (21%) |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
326 rcall reset_gas ; saves default and current value for gas #5 |
0 | 327 movlw d'21' ; O2 part (21%) |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
328 rcall reset_gas ; saves default and current value for gas #6 |
0 | 329 |
330 reset_all_cf: | |
331 movlw d'1' | |
332 movwf EEDATA | |
333 write_int_eeprom d'33' ; reset start gas | |
334 clrf EEDATA | |
335 write_int_eeprom d'34' ; reset deco model to ZH-L16 | |
336 clrf EEDATA | |
337 write_int_eeprom d'35' ; Do not use O2 Sensor in CC Modes | |
338 | |
339 clrf EEDATA | |
340 write_int_eeprom d'39' ; Disable Debugbode | |
341 clrf EEDATA | |
342 write_int_eeprom d'90' ; Disable Brightness offset? (Dim=1, Normal = 0) | |
140 | 343 |
344 movlw d'1' | |
157 | 345 movwf EEDATA |
140 | 346 write_int_eeprom d'91' ; Reset Date format to DD.MM.YY |
0 | 347 |
348 movlw d'100' | |
157 | 349 movwf EEDATA |
0 | 350 write_int_eeprom d'26' ; Salinity default: 1.00 kg/l |
351 | |
352 movlw b'00011111' | |
353 movwf EEDATA | |
354 write_int_eeprom d'27' ; reset active gas flags | |
355 | |
356 clrf EEDATA | |
357 write_int_eeprom d'28' ; reset change depth gas #1 | |
358 clrf EEDATA | |
359 write_int_eeprom d'29' ; reset change depth gas #2 | |
360 clrf EEDATA | |
361 write_int_eeprom d'30' ; reset change depth gas #3 | |
362 clrf EEDATA | |
363 write_int_eeprom d'31' ; reset change depth gas #4 | |
364 clrf EEDATA | |
365 write_int_eeprom d'32' ; reset change depth gas #5 | |
366 | |
367 movlw d'100' | |
368 movwf EEDATA | |
369 write_int_eeprom d'36' ; reset mix1 to ppO2=1.00Bar | |
370 write_int_eeprom d'37' ; reset mix2 to ppO2=1.00Bar | |
371 write_int_eeprom d'38' ; reset mix3 to ppO2=1.00Bar | |
372 | |
229
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
224
diff
changeset
|
373 clrf nofly_time+0 ; Clear nofly time |
0 | 374 clrf nofly_time+1 ; Clear nofly time |
375 | |
79 | 376 reset_all_cf_bank0: |
377 clrf EEADRH | |
0 | 378 movlw d'127' ; address of low byte of first custom function |
379 movwf EEADR | |
380 | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
381 movlw LOW cf_default_table0 ; Load PROM pointer. |
79 | 382 movwf TBLPTRL,A |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
383 movlw HIGH cf_default_table0 |
79 | 384 movwf TBLPTRH,A |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
385 movlw UPPER cf_default_table0 |
79 | 386 movwf TBLPTRU,A |
0 | 387 |
79 | 388 cf_bank0_loop: |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
389 ; Did we already read 32 (decimal) words or double-words (with types) ? |
79 | 390 movf TBLPTRL,W |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
391 sublw LOW (cf_default_table1) |
79 | 392 bz reset_all_cf_bank1 |
0 | 393 |
394 rcall reset_customfunction ; saves default and current value | |
79 | 395 bra cf_bank0_loop |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
79
diff
changeset
|
396 |
0 | 397 reset_all_cf_bank1: |
398 movlw d'1' | |
399 movwf EEADRH ; EEPROM BANK 1 !! | |
400 movlw d'127' ; address of low byte of first custom function | |
401 movwf EEADR | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
402 |
79 | 403 cf_bank1_loop: |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
404 ; Did we already read another 32 (decimal) words or double-words ? |
79 | 405 movf TBLPTRL,W |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
406 sublw LOW (cf_default_table2) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
407 bz cf_bank1_end |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
408 |
0 | 409 rcall reset_customfunction ; saves default and current value |
79 | 410 bra cf_bank1_loop |
0 | 411 |
79 | 412 cf_bank1_end: |
0 | 413 clrf EEADRH ; EEPROM BANK 0 ! |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
79
diff
changeset
|
414 |
0 | 415 ;call reset_external_eeprom ; delete profile memory |
416 goto restart ; all reset, quit to surfmode | |
417 | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
418 ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
419 reset_gas: |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
420 movwf lo |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
421 rcall reset_eeprom_value ; First pair |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
422 goto reset_eeprom_value ; Second pair. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
423 |
0 | 424 reset_customfunction: |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
425 tblrd*+ |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
426 movff TABLAT, lo ; Low byte in lo, |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
427 tblrd*+ |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
428 movff TABLAT, hi ; High byte in hi |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
429 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
430 ifndef NO_CF_TYPES |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
431 tblrd*+ ; Skip advanced min/max values. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
432 tblrd*+ |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
433 btfss hi,7 ; In EEPROM, just clear all types, |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
434 clrf hi ; to keep external program compat (jdivelog etc.) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
435 bcf hi,7 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
436 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
437 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
438 ; Manage the default/value tuple |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
439 rcall reset_eeprom_value ; First pair, untouched. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
440 bcf hi,7 ; Just clear type bit. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
441 bra reset_eeprom_value ; Second pair, cleared |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
442 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
443 ; Write the two bytes lo:hi into EEPROM |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
444 reset_eeprom_value: |
0 | 445 incf EEADR,F |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
446 movff lo, EEDATA ; Lowbyte Defaul value |
0 | 447 call write_eeprom |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
448 |
0 | 449 incf EEADR,F |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
450 movff hi, EEDATA ; Highbyte default value |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
451 goto write_eeprom |
0 | 452 |
453 reset_external_eeprom: ; deletes complete external eeprom! | |
454 clrf eeprom_address+0 | |
455 clrf eeprom_address+1 | |
456 | |
457 movlw d'2' | |
458 movwf temp3 | |
459 reset_eeprom02: | |
460 clrf temp4 | |
461 reset_eeprom01: | |
462 movlw d'64' | |
463 movwf temp2 | |
464 bcf eeprom_blockwrite ; Blockwrite start | |
465 reset_eeprom1: | |
466 setf ext_ee_temp1 ; byte for Blockwrite.... | |
467 movf ext_ee_temp1,W ; So, 1st. Byte of block is fine, too | |
468 call write_external_eeprom_block | |
469 decfsz temp2,F ; 64 Byte done | |
470 bra reset_eeprom1 | |
471 bsf SSPCON2,PEN ; Stop condition | |
472 call WaitMSSP | |
473 WAITMS d'7' | |
474 decfsz temp4,F | |
475 bra reset_eeprom01 ; do this 256 times | |
476 decfsz temp3,F | |
477 bra reset_eeprom02 ; and this all 2 times -> 512 *64Bytes = 32KB | |
478 | |
479 bcf eeprom_blockwrite ; clear blockwrite flag | |
480 | |
481 clrf eeprom_address+0 | |
482 clrf eeprom_address+1 | |
483 | |
484 movlw 0xFD ; With these three bytes the OSTC will find the free area in the EEPROM faster | |
485 call write_external_eeprom | |
486 movlw 0xFD | |
487 call write_external_eeprom | |
488 movlw 0xFE | |
489 call write_external_eeprom | |
490 | |
491 clrf eeprom_address+0 | |
492 clrf eeprom_address+1 | |
493 return | |
494 |