Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_reset.asm @ 573:77c8ff191cd7
Preparations for third bank of Custom Functions
author | heinrichsweikamp |
---|---|
date | Sat, 21 Apr 2012 12:09:37 +0200 |
parents | 44e9b961f156 |
children | 101fec6a6137 |
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 |
355 | 68 if type & CF_NEG |
69 if HIGH(-min) != 0 | |
70 error CF#v(CFn) "8bit negativ min too big: ", min | |
71 endif | |
72 else | |
73 if HIGH(min) != 0 | |
74 error CF#v(CFn) "8bit min too big: ", min | |
75 endif | |
76 endif | |
77 if HIGH(max) != 0 | |
99 | 78 error CF#v(CFn) "8bit max too big: ", 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 if ((type)==CF_BOOL) && ( (default)>1 ) |
99 | 81 error CF#v(CFn) "BOOL default too big: ", default |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
82 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
83 if ((type)==CF_BOOL) && ( (min)>0 || (max)>0 ) |
99 | 84 error CF#v(CFn) "BOOL cannot have min/max" |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
85 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
86 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
87 ifdef NO_CF_TYPES |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
88 DB LOW(default), 0 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
89 else |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
90 local typeFlags |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
91 typeFlags set type |
355 | 92 if (min)!=0 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
93 typeFlags set type + CF_MIN |
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 if (max)>(min) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
96 typeFlags set typeFlags + CF_MAX |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
97 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
98 DB LOW(default), (typeFlags), LOW(min), LOW(max) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
99 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
100 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
101 expand |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
102 endm |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
103 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
104 ; Starting at CF0 |
99 | 105 CFn set -1 |
79 | 106 |
107 ; resets all customfunctions to the following default values | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
108 cf_default_table0: |
79 | 109 ;---- BANK0 custom function defaults ------------------------------------- |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
110 ; DEFAULT MIN MAX |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
111 CF_DEFAULT CF_CENTI, d'100', d'50', d'250' ; CF00 dive_threshold 100cm |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
112 CF_DEFAULT CF_CENTI, d'30', d'10', d'100' ; CF01 surf_threshold 30cm |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
113 CF_DEFAULT CF_INT15, d'240', d'0', d'600' ; CF02 diveloop_timeout 240s |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
114 CF_DEFAULT CF_SEC, d'120', d'30', d'240' ; CF03 surfloop_timeout 120s |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
115 CF_DEFAULT CF_SEC, d'5', d'1', d'30' ; CF04 premenu_timeout 5s |
79 | 116 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
117 CF_DEFAULT CF_INT8, d'7', d'3', d'18' ; CF05 minimum_velocity 7min/min |
398
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
118 CF_DEFAULT CF_INT15, d'1160',d'950', 0 ; pressure_offset_divemode 1160mbar |
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
119 CF_DEFAULT CF_INT15, d'1080',d'1080', 0 ; max_surfpressure 1080mbar |
105 | 120 CF_DEFAULT CF_PERCENT, d'20', d'1', d'99' ; min_gradient_factor 20% |
173 | 121 CF_DEFAULT CF_PERCENT, d'20', d'1', d'22' ; oxygen_threshold 22% |
79 | 122 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
123 CF_DEFAULT CF_SEC, d'45', d'5', d'60' ; CF10 dive_menu_timeout 45s |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 CF_DEFAULT CF_PERCENT, d'100', d'50', d'100' ; gradient_factor_alarm1 100% |
79 | 128 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
129 CF_DEFAULT CF_PERCENT, d'10', d'0', d'100' ; CF15 cns_display_surface 10% |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
86
diff
changeset
|
130 CF_DEFAULT CF_DECI, d'10', d'0', d'10' ; deco_distance_for_sim 1m |
398
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
131 CF_DEFAULT CF_CENTI, d'019', d'19', d'021' ; ppo2_warning_low 0.19 bar |
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
132 CF_DEFAULT CF_CENTI, d'160', d'0', d'160' ; ppo2_warning_high 1.60 bar |
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
133 CF_DEFAULT CF_CENTI, d'140', d'0', d'150' ; ppo2_display_high 1.40 bar |
79 | 134 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
135 CF_DEFAULT CF_INT8, d'10', d'1', d'120' ; CF20 sampling_rate 10s |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
136 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
|
137 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_deco /6 |
374 | 138 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_gf /6 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
139 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_ppo2 never |
79 | 140 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
141 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; CF25 sampling_divisor_deco2 never |
374 | 142 CF_DEFAULT CF_INT8, d'12', d'0', d'15' ; sampling_divisor_cns /12 |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
143 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
|
144 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
|
145 CF_DEFAULT CF_INT8, d'3', d'2', d'6' ; last_deco_depth 3m |
79 | 146 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
147 CF_DEFAULT CF_SEC, d'10', d'1', d'15' ; CF30 timeout_apnoe_mode 10min |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
148 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF31 show_voltage_value =1 Show value instead of symbol, =0 Show Symbol |
79 | 149 |
150 ;---- BANK1 custom function defaults ------------------------------------- | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
151 cf_default_table1: |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
152 ; DEFAULT MIN MAX |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
153 CF_DEFAULT CF_PERCENT, d'30', d'5', d'90' ; CF32 GF_low_default 30% |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
154 CF_DEFAULT CF_PERCENT, d'90', d'30', d'95' ; CF33 GF_high_default 90% |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
155 CF_DEFAULT CF_COLOR, d'199', 0, 0 ; CF34 color_battery_surface Color Battery sign: Deep blue |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
156 CF_DEFAULT CF_COLOR, d'255', 0, 0 ; CF35 color_standard1 Color Standard: White |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
157 CF_DEFAULT CF_COLOR, d'62', 0, 0 ; CF36 color_divemask Color Divemask: Light green |
99 | 158 |
492
19b9e19ea4da
+CHANGE: Velocity display updated every second
heinrichsweikamp
parents:
478
diff
changeset
|
159 CF_DEFAULT CF_COLOR, d'224', 0, 0 ; CF37 color_warnings Color Warnings: Red |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
160 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF38 show_seconds_divemode =1 Show the seconds in Divemode |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
161 CF_DEFAULT CF_BOOL, 0, 0, 0 ; CF39 Adjust SetPoint if Diluent ppO2 > SetPoint |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
162 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF40 warn_ceiling_divemode =1 Warn ceiling violation in divemode |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
163 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF41 Show mix type is surfmode |
128 | 164 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
165 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF42 blink_gas_divemode =1 blink better gas |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
166 CF_DEFAULT CF_INT15, d'13000', 0, d'13000' ; CF43 color_warn_depth_mbar Warn depths |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
167 CF_DEFAULT CF_PERCENT, d'101', d'50', d'101' ; CF44 color_warn_cns_percent Warn-% |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
168 CF_DEFAULT CF_PERCENT, d'101', d'50', d'101' ; CF45 color_warn_gf_percent Warn-% |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
169 CF_DEFAULT CF_CENTI, d'161', d'100', d'161' ; CF46 color_warn_ppo2_cbar ppO2 warn |
128 | 170 |
492
19b9e19ea4da
+CHANGE: Velocity display updated every second
heinrichsweikamp
parents:
478
diff
changeset
|
171 CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; CF47 color_warn_celocity_mmin warn at xx m/min |
19b9e19ea4da
+CHANGE: Velocity display updated every second
heinrichsweikamp
parents:
478
diff
changeset
|
172 CF_DEFAULT CF_SEC+CF_NEG,d'0', -d'120' ,d'120' ; CF48 time_correction_value_default Adds to Seconds on Midnight |
476 | 173 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF49 Show Altimeter in surface mode |
129
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
125
diff
changeset
|
174 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
|
175 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF51 Show Stopwatch |
79 | 176 |
324 | 177 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF52 Show Tissue Graph in Divemode |
129
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
125
diff
changeset
|
178 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF53 Show Laeding Tissue in Divemode |
197 | 179 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF54 Display shallowest stop first |
180 CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; GF55 Gas switch additional delay | |
478
fd8266b511cc
New SAC (CF56/CF57) in 5..50 l/min range (no more decimal).
JeanDo
parents:
476
diff
changeset
|
181 CF_DEFAULT CF_INT8, d'20', d'5', d'50' ; CF56 Bottom gas usage (SAC l/min) |
224 | 182 |
478
fd8266b511cc
New SAC (CF56/CF57) in 5..50 l/min range (no more decimal).
JeanDo
parents:
476
diff
changeset
|
183 CF_DEFAULT CF_INT8, d'20', d'5', d'50' ; CF57 Ascent/deco gas usage (SAC l/min) |
312
b7e4e74c0e17
New @5 variant: compute TTS if staying some extra time (CF58) at current depth.
JeanDo
parents:
309
diff
changeset
|
184 CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; CF58 TTS for extra time at current depth [min] |
476 | 185 CF_DEFAULT CF_INT15, d'0', d'0', d'7000' ; CF59 Cave conso warning [l] |
492
19b9e19ea4da
+CHANGE: Velocity display updated every second
heinrichsweikamp
parents:
478
diff
changeset
|
186 CF_DEFAULT CF_BOOL, 0, 0, 0 ; CF60 Show Graphical ascend speed indicator |
552 | 187 CF_DEFAULT CF_BOOL, 0, 0, 0 ; CF61 Show pSCR ppO2 |
79 | 188 |
552 | 189 CF_DEFAULT CF_PERCENT, .4, .0, .100 ; CF62 pSCR O2 Drop |
190 CF_DEFAULT CF_INT8, .10, .0, .100 ; CF63 pSCR counterlung ratio | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
191 cf_default_table2: |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
192 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF64 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
193 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF65 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
194 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF66 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
195 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF67 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
196 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF68 unused |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
197 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
198 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF69 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
199 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF70 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
200 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF71 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
201 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF72 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
202 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF73 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
203 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
204 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF74 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
205 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF75 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
206 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF76 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
207 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF77 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
208 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF78 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
209 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
210 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF79 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
211 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF80 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
212 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF81 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
213 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF82 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
214 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF83 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
215 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
216 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF84 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
217 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF85 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
218 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF87 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
219 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF88 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
220 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF89 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
221 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
222 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF90 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
223 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF91 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
224 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF92 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
225 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF93 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
226 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF94 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
227 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
228 CF_DEFAULT CF_INT8, d'0', d'0', d'0' ; GF95 unused |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
229 cf_default_table3: |
79 | 230 ;============================================================================= |
231 | |
0 | 232 menu_reset: |
233 movlw d'1' | |
234 movwf menupos | |
235 | |
236 call PLED_ClearScreen | |
237 call PLED_reset_menu_mask | |
238 | |
239 menu_reset2: | |
240 clrf timeout_counter2 | |
241 bcf sleepmode | |
242 bcf menubit2 | |
243 bcf menubit3 | |
244 bsf menubit | |
245 bsf cursor | |
246 call PLED_reset_menu_mask | |
247 call PLED_menu_cursor | |
248 bcf switch_left | |
249 bcf switch_right | |
250 menu_reset_loop: | |
251 call check_switches_menu | |
252 btfsc menubit2 | |
253 bra do_menu_reset ; call submenu | |
254 btfss menubit | |
255 bra menu ; exit setup menu and return to main menu | |
256 btfsc onesecupdate | |
257 call timeout_surfmode | |
258 btfsc onesecupdate | |
259 call set_dive_modes | |
260 btfsc onesecupdate | |
261 call test_charger ; check if charger IC is active | |
262 btfsc onesecupdate | |
263 call get_battery_voltage ; get battery voltage | |
264 bcf onesecupdate ; End of one second tasks | |
265 btfsc sleepmode | |
266 goto menu | |
267 btfsc divemode | |
268 goto restart ; exit menu, restart and enter divemode | |
269 bra menu_reset_loop | |
270 do_menu_reset: ; calls submenu | |
271 dcfsnz menupos,F | |
272 bra do_menu_reset_exit ; Cancel, exit | |
273 dcfsnz menupos,F | |
274 bra do_menu_reset_all ; Reset all settings | |
275 dcfsnz menupos,F | |
276 bra do_menu_reset_logbook ; Reset Logbook Memory! | |
277 dcfsnz menupos,F | |
278 bra do_menu_reset_reboot ; Reboot OSTC | |
279 dcfsnz menupos,F | |
280 bra do_menu_reset_decodata ; Reset Decodata | |
281 do_menu_reset_exit: | |
282 movlw d'3' | |
283 movwf menupos | |
284 bra menu2 ; exit... | |
285 | |
286 | |
287 do_menu_reset_reboot: | |
288 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
289 movwf menupos ; Used as temp | |
290 tstfsz menupos | |
291 bra do_menu_reset_reboot2 ; Delete now! | |
292 bra do_menu_reset_exit ; Cancel! | |
293 | |
294 do_menu_reset_reboot2: | |
295 call PLED_DisplayOff ; Power-down OLED | |
296 movlw b'00000000' ; Bit6: PPL Disable | |
297 movwf OSCTUNE | |
298 movlw b'01111110' ; 8MHz | |
299 movwf OSCCON | |
300 reset | |
301 goto 0x00000 ; restart to 0x00000 | |
302 | |
303 do_menu_reset_logbook: | |
304 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
305 movwf menupos ; Used as temp | |
306 tstfsz menupos | |
307 bra do_menu_reset_logbook2 ; Delete Logbook now! | |
308 bra do_menu_reset_exit ; Cancel! | |
309 | |
310 do_menu_reset_logbook2: | |
311 call PLED_ClearScreen | |
123 | 312 setf win_color1 ; Make sure to display in white color. |
313 setf win_color2 | |
314 DISPLAYTEXT .25 ; "Reset..." | |
0 | 315 call reset_external_eeprom ; delete profile memory |
316 bra do_menu_reset_exit | |
317 | |
318 do_menu_reset_decodata: | |
319 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
320 movwf menupos ; Used as temp | |
321 tstfsz menupos | |
322 bra do_menu_reset_decodata2 ; Reset Deco Data now! | |
323 bra do_menu_reset_exit ; Cancel! | |
324 | |
325 do_menu_reset_decodata2: | |
326 ; reset deco data | |
327 call PLED_ClearScreen | |
425 | 328 DISPLAYTEXT .25 ; "Reset..." |
411
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
329 |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
324
diff
changeset
|
330 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine |
411
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
331 call deco_clear_tissue ; Reset Decodata |
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
332 call deco_calc_desaturation_time ; calculate desaturation time |
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
333 call deco_clear_CNS_fraction ; clear CNS |
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
334 movlb b'00000001' ; select ram bank 1 |
412 | 335 clrf nofly_time+0 ; Reset NoFly |
336 clrf nofly_time+1 ; Reset NoFly | |
337 bcf nofly_active ; Clear flag | |
422 | 338 goto restart ; done. quit to surfmode |
0 | 339 |
340 do_menu_reset_all: | |
341 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
342 movwf menupos ; Used as temp | |
343 tstfsz menupos | |
344 bra do_menu_reset_all2 ; Reset all now! | |
345 bra do_menu_reset_exit ; Cancel! | |
346 | |
347 do_menu_reset_all2: | |
348 call PLED_ClearScreen | |
507 | 349 DISPLAYTEXT .25 ; "Reset..." |
0 | 350 |
351 reset_start: | |
352 ; reset deco data | |
341
2144f19fa1eb
BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents:
324
diff
changeset
|
353 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine |
411
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
354 call deco_clear_tissue ; Reset Decodata |
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
355 call deco_calc_desaturation_time ; calculate desaturation time |
e6e1b89b7c3e
BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents:
398
diff
changeset
|
356 call deco_clear_CNS_fraction ; clear CNS |
422 | 357 movlb b'00000001' ; select ram bank 1 |
412 | 358 clrf nofly_time+0 ; Reset NoFly |
359 clrf nofly_time+1 ; Reset NoFly | |
360 bcf nofly_active ; Clear flag | |
0 | 361 |
362 ; reset gases | |
464 | 363 rcall reset_gases |
507 | 364 rcall reset_all_cf |
365 goto restart ; all reset, quit to surfmode | |
0 | 366 |
367 reset_all_cf: | |
368 movlw d'1' | |
369 movwf EEDATA | |
370 write_int_eeprom d'33' ; reset start gas | |
371 clrf EEDATA | |
372 write_int_eeprom d'34' ; reset deco model to ZH-L16 | |
373 clrf EEDATA | |
309 | 374 write_int_eeprom d'35' ; unused in Mk.2 |
0 | 375 |
376 clrf EEDATA | |
377 write_int_eeprom d'39' ; Disable Debugbode | |
378 clrf EEDATA | |
379 write_int_eeprom d'90' ; Disable Brightness offset? (Dim=1, Normal = 0) | |
140 | 380 |
381 movlw d'1' | |
157 | 382 movwf EEDATA |
140 | 383 write_int_eeprom d'91' ; Reset Date format to DD.MM.YY |
0 | 384 |
385 movlw d'100' | |
157 | 386 movwf EEDATA |
0 | 387 write_int_eeprom d'26' ; Salinity default: 1.00 kg/l |
388 | |
389 movlw b'00011111' | |
390 movwf EEDATA | |
391 write_int_eeprom d'27' ; reset active gas flags | |
392 | |
393 clrf EEDATA | |
394 write_int_eeprom d'28' ; reset change depth gas #1 | |
395 clrf EEDATA | |
396 write_int_eeprom d'29' ; reset change depth gas #2 | |
397 clrf EEDATA | |
398 write_int_eeprom d'30' ; reset change depth gas #3 | |
399 clrf EEDATA | |
400 write_int_eeprom d'31' ; reset change depth gas #4 | |
401 clrf EEDATA | |
402 write_int_eeprom d'32' ; reset change depth gas #5 | |
403 | |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
229
diff
changeset
|
404 movlw d'80' |
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
229
diff
changeset
|
405 movwf EEDATA |
398
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
406 write_int_eeprom d'36' ; reset mix1 to ppO2=0.80bar |
0 | 407 movlw d'100' |
408 movwf EEDATA | |
398
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
409 write_int_eeprom d'37' ; reset mix2 to ppO2=1.00bar |
255
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
229
diff
changeset
|
410 movlw d'120' |
1efd59d689f8
small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents:
229
diff
changeset
|
411 movwf EEDATA |
398
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
392
diff
changeset
|
412 write_int_eeprom d'38' ; reset mix3 to ppO2=1.20bar |
0 | 413 |
229
85ea09d3b9d8
Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents:
224
diff
changeset
|
414 clrf nofly_time+0 ; Clear nofly time |
0 | 415 clrf nofly_time+1 ; Clear nofly time |
416 | |
79 | 417 reset_all_cf_bank0: |
418 clrf EEADRH | |
0 | 419 movlw d'127' ; address of low byte of first custom function |
420 movwf EEADR | |
421 | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
422 movlw LOW cf_default_table0 ; Load PROM pointer. |
79 | 423 movwf TBLPTRL,A |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
424 movlw HIGH cf_default_table0 |
79 | 425 movwf TBLPTRH,A |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
426 movlw UPPER cf_default_table0 |
79 | 427 movwf TBLPTRU,A |
0 | 428 |
79 | 429 cf_bank0_loop: |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
430 ; Did we already read 32 (decimal) words or double-words (with types) ? |
79 | 431 movf TBLPTRL,W |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
432 sublw LOW (cf_default_table1) |
79 | 433 bz reset_all_cf_bank1 |
0 | 434 rcall reset_customfunction ; saves default and current value |
79 | 435 bra cf_bank0_loop |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
79
diff
changeset
|
436 |
0 | 437 reset_all_cf_bank1: |
438 movlw d'1' | |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
439 movwf EEADRH ; EEPROM BANK 1 |
0 | 440 movlw d'127' ; address of low byte of first custom function |
441 movwf EEADR | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
442 |
79 | 443 cf_bank1_loop: |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
444 ; Did we already read another 32 (decimal) words or double-words ? |
79 | 445 movf TBLPTRL,W |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
446 sublw LOW (cf_default_table2) |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
447 bz reset_all_cf_bank2 |
0 | 448 rcall reset_customfunction ; saves default and current value |
79 | 449 bra cf_bank1_loop |
0 | 450 |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
451 reset_all_cf_bank2: |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
452 movlw d'2' |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
453 movwf EEADRH ; EEPROM BANK 2 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
454 movlw d'127' ; address of low byte of first custom function |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
455 movwf EEADR |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
456 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
457 cf_bank2_loop: |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
458 ; Did we already read another 32 (decimal) words or double-words ? |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
459 movf TBLPTRL,W |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
460 sublw LOW (cf_default_table3) |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
461 bz cf_bank2_end |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
462 rcall reset_customfunction ; saves default and current value |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
463 bra cf_bank2_loop |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
464 |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
465 cf_bank2_end: |
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
466 clrf EEADRH ; EEPROM BANK 0 |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
79
diff
changeset
|
467 |
0 | 468 ;call reset_external_eeprom ; delete profile memory |
507 | 469 return |
0 | 470 |
464 | 471 reset_gases: |
573
77c8ff191cd7
Preparations for third bank of Custom Functions
heinrichsweikamp
parents:
552
diff
changeset
|
472 clrf EEADRH ; EEPROM BANK 0 |
464 | 473 |
474 movlw d'3' ; address of first gas-1 | |
475 movwf EEADR | |
476 clrf hi ; He part (default for all gases: 0%) | |
477 movlw d'21' ; O2 part (21%) | |
478 rcall reset_gas ; saves current value for gas #1 | |
479 movlw d'21' ; O2 part (21%) | |
480 rcall reset_gas ; saves default value for gas #1 | |
481 movlw d'21' ; O2 part (21%) | |
482 rcall reset_gas ; saves current value for gas #2 | |
483 movlw d'21' ; O2 part (21%) | |
484 rcall reset_gas ; saves default value for gas #2 | |
485 movlw d'21' ; O2 part (21%) | |
486 rcall reset_gas ; saves current value for gas #3 | |
487 movlw d'21' ; O2 part (21%) | |
488 rcall reset_gas ; saves default value for gas #3 | |
489 movlw d'21' ; O2 part (21%) | |
490 rcall reset_gas ; saves current value for gas #4 | |
491 movlw d'21' ; O2 part (21%) | |
492 rcall reset_gas ; saves default value for gas #4 | |
493 movlw d'21' ; O2 part (21%) | |
494 rcall reset_gas ; saves current value for gas #5 | |
495 movlw d'21' ; O2 part (21%) | |
496 rcall reset_gas ; saves default value for gas #5 | |
497 movlw d'21' ; O2 part (21%) | |
498 rcall reset_gas ; saves current value for gas #6 | |
499 return | |
500 | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
501 ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
502 reset_gas: |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
503 movwf lo |
459 | 504 incf EEADR,F |
464 | 505 movff lo, EEDATA ; O2 Default value |
459 | 506 call write_eeprom |
507 incf EEADR,F | |
464 | 508 movff hi, EEDATA ; He default value |
459 | 509 call write_eeprom |
510 return | |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
511 |
0 | 512 reset_customfunction: |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
513 tblrd*+ |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
514 movff TABLAT, lo ; Low byte in lo, |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
515 tblrd*+ |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
516 movff TABLAT, hi ; High byte in hi |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
517 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
518 ifndef NO_CF_TYPES |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
519 tblrd*+ ; Skip advanced min/max values. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
520 tblrd*+ |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
521 btfss hi,7 ; In EEPROM, just clear all types, |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
522 clrf hi ; to keep external program compat (jdivelog etc.) |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
523 bcf hi,7 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
524 endif |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
525 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
526 ; Manage the default/value tuple |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
527 rcall reset_eeprom_value ; First pair, untouched. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
528 bcf hi,7 ; Just clear type bit. |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
529 bra reset_eeprom_value ; Second pair, cleared |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
530 |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
531 ; Write the two bytes lo:hi into EEPROM |
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
532 reset_eeprom_value: |
0 | 533 incf EEADR,F |
384
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
534 movff lo, EEDATA ; Lowbyte Default value |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
535 |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
536 movlw d'127' ; Work-around to prevent writing at EEPROM 0x00 to 0x04 |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
537 cpfslt EEADR ; EEADR > 127? |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
538 call write_eeprom ; Yes, write! |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
539 |
0 | 540 incf EEADR,F |
86
b40a0a6284da
adding custom functions with limits (jeando)
heinrichsweikamp
parents:
83
diff
changeset
|
541 movff hi, EEDATA ; Highbyte default value |
384
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
542 |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
543 movlw d'127' ; Work-around to prevent writing at EEPROM 0x00 to 0x04 |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
544 cpfslt EEADR ; EEADR > 127? |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
545 call write_eeprom ; Yes, write! |
904863f96582
Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents:
374
diff
changeset
|
546 return |
0 | 547 |
548 reset_external_eeprom: ; deletes complete external eeprom! | |
549 clrf eeprom_address+0 | |
550 clrf eeprom_address+1 | |
551 | |
350
7250ca7c8d24
64kByte logbook (Still incompatible to existing PC software)
heinrichsweikamp
parents:
341
diff
changeset
|
552 movlw d'4' |
0 | 553 movwf temp3 |
554 reset_eeprom02: | |
555 clrf temp4 | |
556 reset_eeprom01: | |
557 movlw d'64' | |
558 movwf temp2 | |
559 bcf eeprom_blockwrite ; Blockwrite start | |
560 reset_eeprom1: | |
561 setf ext_ee_temp1 ; byte for Blockwrite.... | |
562 movf ext_ee_temp1,W ; So, 1st. Byte of block is fine, too | |
563 call write_external_eeprom_block | |
564 decfsz temp2,F ; 64 Byte done | |
565 bra reset_eeprom1 | |
566 bsf SSPCON2,PEN ; Stop condition | |
567 call WaitMSSP | |
568 WAITMS d'7' | |
569 decfsz temp4,F | |
570 bra reset_eeprom01 ; do this 256 times | |
571 decfsz temp3,F | |
350
7250ca7c8d24
64kByte logbook (Still incompatible to existing PC software)
heinrichsweikamp
parents:
341
diff
changeset
|
572 bra reset_eeprom02 ; and this all 4 times -> 1024 *64Bytes = 64KB |
0 | 573 |
574 bcf eeprom_blockwrite ; clear blockwrite flag | |
575 | |
576 clrf eeprom_address+0 | |
577 clrf eeprom_address+1 | |
578 | |
579 movlw 0xFD ; With these three bytes the OSTC will find the free area in the EEPROM faster | |
580 call write_external_eeprom | |
581 movlw 0xFD | |
582 call write_external_eeprom | |
583 movlw 0xFE | |
584 call write_external_eeprom | |
585 | |
586 clrf eeprom_address+0 | |
587 clrf eeprom_address+1 | |
588 return | |
589 |