annotate code_part1/OSTC_code_asm_part1/menu_reset.asm @ 384:904863f96582 64kByte Logbook

Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
author heinrichsweikamp
date Sat, 18 Jun 2011 11:26:22 +0200
parents 6ee9c849ad92
children 8e272339fb68
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; Menu "Reset all"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
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
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 ; routines to reset external EEPROM (currently inactvated!)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 ; routines to reset custom function, gases and decompression values
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 ; does not reset clock
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
30 ;=============================================================================
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
31 ; CF default values
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
32 ;
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
33
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
34 ; Macro to check values, and construct PROM CF default table.
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
38 CFn set 1+CFn
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
39 if (type) == CF_INT15
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
40 if HIGH (default) > .127
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
44 error CF#v(CFn) "15bit defaults cannot have both MIN & MAX flags"
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
45 endif
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
46 if HIGH(min) > .127
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
47 error CF#v(CFn) "15bit MIN value too big: ", min
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
48 endif
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
49 if HIGH(max) > .127
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
57 if (max) > (min)
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
58 DB LOW(max), HIGH(max) + 0x80
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
68 if type & CF_NEG
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
69 if HIGH(-min) != 0
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
70 error CF#v(CFn) "8bit negativ min too big: ", min
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
71 endif
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
72 else
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
73 if HIGH(min) != 0
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
74 error CF#v(CFn) "8bit min too big: ", min
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
75 endif
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
76 endif
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
77 if HIGH(max) != 0
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
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
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
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
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
105 CFn set -1
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
106
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
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
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
109 ;---- BANK0 custom function defaults -------------------------------------
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
110 ; DEFAULT MIN MAX
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
111 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
112 CF_DEFAULT CF_CENTI, d'30', d'10', d'100' ; surf_threshold 30cm
352
544a96faa9f3 New "Quit sim" option in simulated dive mode, CF02 now allows more then 240seconds, Bugfix with runtime=1min in runtime simulator
Heinrichsweikamp
parents: 350
diff changeset
113 CF_DEFAULT CF_INT15, d'240', d'0', d'600' ; diveloop_timeout 240s
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
114 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
115 CF_DEFAULT CF_SEC, d'5', d'1', d'30' ; premenu_timeout 5s
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
116
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
117 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
118 CF_DEFAULT CF_INT15, d'1160',d'950', 0 ; pressure_offset_divemode 1160mBar
306
ab1678d98e46 some changes for cf defaults
heinrichsweikamp
parents: 255
diff changeset
119 CF_DEFAULT CF_INT15, d'1080',d'1080', 0 ; max_surfpressure 1080mBar
105
64109f6fb3d1 added END to GasSetup, small fixes
heinrichsweikamp
parents: 100
diff changeset
120 CF_DEFAULT CF_PERCENT, d'20', d'1', d'99' ; min_gradient_factor 20%
173
4a7a778d9e49 CF09 limits
heinrichsweikamp
parents: 169
diff changeset
121 CF_DEFAULT CF_PERCENT, d'20', d'1', d'22' ; oxygen_threshold 22%
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
122
306
ab1678d98e46 some changes for cf defaults
heinrichsweikamp
parents: 255
diff changeset
123 CF_DEFAULT CF_SEC, d'45', d'5', d'60' ; 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
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
128
105
64109f6fb3d1 added END to GasSetup, small fixes
heinrichsweikamp
parents: 100
diff changeset
129 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
130 CF_DEFAULT CF_DECI, d'10', d'0', d'10' ; deco_distance_for_sim 1m
105
64109f6fb3d1 added END to GasSetup, small fixes
heinrichsweikamp
parents: 100
diff changeset
131 CF_DEFAULT CF_CENTI, d'019', d'19', d'021' ; ppo2_warning_low 0.19 Bar
64109f6fb3d1 added END to GasSetup, small fixes
heinrichsweikamp
parents: 100
diff changeset
132 CF_DEFAULT CF_CENTI, d'160', d'0', d'160' ; ppo2_warning_high 1.60 Bar
64109f6fb3d1 added END to GasSetup, small fixes
heinrichsweikamp
parents: 100
diff changeset
133 CF_DEFAULT CF_CENTI, d'150', d'0', d'150' ; ppo2_display_high 1.50 Bar
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
134
105
64109f6fb3d1 added END to GasSetup, small fixes
heinrichsweikamp
parents: 100
diff changeset
135 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
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
6ee9c849ad92 GF profile. GF and Decotype in Logbok
Heinrichsweikamp
parents: 361
diff changeset
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
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
140
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
141 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_deco2 never
374
6ee9c849ad92 GF profile. GF and Decotype in Logbok
Heinrichsweikamp
parents: 361
diff changeset
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
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
146
128
4c588c3d1f12 Saturation graphs in customview divemode
JeanDo
parents: 125
diff changeset
147 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
148 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_voltage_value =1 Show value instead of symbol, =0 Show Symbol
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
149
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
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
157
heinrichsweikamp
parents: 140
diff changeset
153 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
154 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
155 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
156 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
157 CF_DEFAULT CF_COLOR, d'62', 0, 0 ; color_divemask Color Divemask: Light green
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
158
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
159 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
160 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_seconds_divemode =1 Show the seconds in Divemode
138
dd4b899c56c1 1.75beta released
heinrichsweikamp
parents: 131
diff changeset
161 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
162 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
163 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; Show mix type is surfmode
128
4c588c3d1f12 Saturation graphs in customview divemode
JeanDo
parents: 125
diff changeset
164
306
ab1678d98e46 some changes for cf defaults
heinrichsweikamp
parents: 255
diff changeset
165 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; blink_gas_divemode =1 blink better gas
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
166 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
167 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
168 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
169 CF_DEFAULT CF_CENTI, d'161', d'100', d'161' ; color_warn_ppo2_cbar ppO2 warn
128
4c588c3d1f12 Saturation graphs in customview divemode
JeanDo
parents: 125
diff changeset
170
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
171 CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; color_warn_celocity_mmin warn at xx m/min
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 341
diff changeset
172 CF_DEFAULT CF_SEC+CF_NEG,d'42', -d'120',d'120' ; time_correction_value_default Adds to Seconds on Midnight
157
heinrichsweikamp
parents: 140
diff changeset
173 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
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
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
176
324
a86c9d1219ce ppO2 diluent (flush) color coded
Heinrichsweikamp
parents: 312
diff changeset
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
f15e804ff67f Gas switch delay
JeanDo
parents: 173
diff changeset
179 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF54 Display shallowest stop first
f15e804ff67f Gas switch delay
JeanDo
parents: 173
diff changeset
180 CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; GF55 Gas switch additional delay
224
49c90c5d9603 Gas usage
JeanDo
parents: 197
diff changeset
181 CF_DEFAULT CF_DECI, d'200', d'5', 0 ; CF56 Bottom gas usage (l/min or bar/min)
49c90c5d9603 Gas usage
JeanDo
parents: 197
diff changeset
182
49c90c5d9603 Gas usage
JeanDo
parents: 197
diff changeset
183 CF_DEFAULT CF_DECI, d'200', d'5', 0 ; CF57 Ascent/deco gas usage (l/min or bar/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]
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
185 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
186 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
187 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
188
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
189 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
190 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
191 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
192 cf_default_table2:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
193
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
194 ;=============================================================================
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
195
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 menu_reset:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
198 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201 call PLED_reset_menu_mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
202
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203 menu_reset2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208 bsf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 bsf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
210 call PLED_reset_menu_mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
212 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
213 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214 menu_reset_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215 call check_switches_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
216 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
217 bra do_menu_reset ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
218 btfss menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 bra menu ; exit setup menu and return to main menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
220 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
221 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
222 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
223 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
224 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
225 call test_charger ; check if charger IC is active
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
226 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227 call get_battery_voltage ; get battery voltage
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228 bcf onesecupdate ; End of one second tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230 goto menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232 goto restart ; exit menu, restart and enter divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 bra menu_reset_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
234 do_menu_reset: ; calls submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 bra do_menu_reset_exit ; Cancel, exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
238 bra do_menu_reset_all ; Reset all settings
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
240 bra do_menu_reset_logbook ; Reset Logbook Memory!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 bra do_menu_reset_reboot ; Reboot OSTC
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244 bra do_menu_reset_decodata ; Reset Decodata
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245 do_menu_reset_exit:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
246 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 bra menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251 do_menu_reset_reboot:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253 movwf menupos ; Used as temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 tstfsz menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 bra do_menu_reset_reboot2 ; Delete now!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 bra do_menu_reset_exit ; Cancel!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258 do_menu_reset_reboot2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259 call PLED_DisplayOff ; Power-down OLED
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 movlw b'00000000' ; Bit6: PPL Disable
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 movwf OSCTUNE
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262 movlw b'01111110' ; 8MHz
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 movwf OSCCON
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264 reset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 goto 0x00000 ; restart to 0x00000
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 do_menu_reset_logbook:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 movwf menupos ; Used as temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 tstfsz menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
271 bra do_menu_reset_logbook2 ; Delete Logbook now!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
272 bra do_menu_reset_exit ; Cancel!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
273
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274 do_menu_reset_logbook2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275 call PLED_ClearScreen
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 121
diff changeset
276 setf win_color1 ; Make sure to display in white color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 121
diff changeset
277 setf win_color2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 121
diff changeset
278 DISPLAYTEXT .25 ; "Reset..."
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279 call reset_external_eeprom ; delete profile memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 bra do_menu_reset_exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282 do_menu_reset_decodata:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 movwf menupos ; Used as temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 tstfsz menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 bra do_menu_reset_decodata2 ; Reset Deco Data now!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 bra do_menu_reset_exit ; Cancel!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 do_menu_reset_decodata2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 ; reset deco data
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 DISPLAYTEXT .25 ; "Reset..."
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 324
diff changeset
293 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine
116
14a074e1a375 Split C code, and use direct linking.
JeanDo
parents: 115
diff changeset
294 call deco_clear_tissue
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 movlb b'00000001' ; RAM Bank1 selected
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296 goto restart ; done. quit to surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 do_menu_reset_all:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300 movwf menupos ; Used as temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301 tstfsz menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
302 bra do_menu_reset_all2 ; Reset all now!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 bra do_menu_reset_exit ; Cancel!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 do_menu_reset_all2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307 DISPLAYTEXT .25 ; "Reset..."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 reset_start:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 ; reset deco data
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 324
diff changeset
311 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine
116
14a074e1a375 Split C code, and use direct linking.
JeanDo
parents: 115
diff changeset
312 call deco_clear_tissue
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 movlb b'00000001' ; RAM Bank1 selected
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 ; reset gases
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316 clrf EEADRH ; EEPROM BANK 0 !
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 movlw d'3' ; address of first gas-1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 clrf hi ; He part (default for all gases: 0%)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
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 #1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
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 #2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
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 #3
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
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 #4
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 movlw d'21' ; O2 part (21%)
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
330 rcall reset_gas ; saves default and current value for gas #5
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 movlw d'21' ; O2 part (21%)
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
332 rcall reset_gas ; saves default and current value for gas #6
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 reset_all_cf:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336 movwf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 write_int_eeprom d'33' ; reset start gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 write_int_eeprom d'34' ; reset deco model to ZH-L16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
340 clrf EEDATA
309
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 306
diff changeset
341 write_int_eeprom d'35' ; unused in Mk.2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344 write_int_eeprom d'39' ; Disable Debugbode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 write_int_eeprom d'90' ; Disable Brightness offset? (Dim=1, Normal = 0)
140
87a53efbb5ba "beta" shown for beta versions
heinrichsweikamp
parents: 138
diff changeset
347
87a53efbb5ba "beta" shown for beta versions
heinrichsweikamp
parents: 138
diff changeset
348 movlw d'1'
157
heinrichsweikamp
parents: 140
diff changeset
349 movwf EEDATA
140
87a53efbb5ba "beta" shown for beta versions
heinrichsweikamp
parents: 138
diff changeset
350 write_int_eeprom d'91' ; Reset Date format to DD.MM.YY
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 movlw d'100'
157
heinrichsweikamp
parents: 140
diff changeset
353 movwf EEDATA
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
354 write_int_eeprom d'26' ; Salinity default: 1.00 kg/l
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356 movlw b'00011111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 movwf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358 write_int_eeprom d'27' ; reset active gas flags
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361 write_int_eeprom d'28' ; reset change depth gas #1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 write_int_eeprom d'29' ; reset change depth gas #2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 write_int_eeprom d'30' ; reset change depth gas #3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367 write_int_eeprom d'31' ; reset change depth gas #4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369 write_int_eeprom d'32' ; reset change depth gas #5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370
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
371 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
372 movwf EEDATA
1efd59d689f8 small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents: 229
diff changeset
373 write_int_eeprom d'36' ; reset mix1 to ppO2=0.80Bar
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374 movlw d'100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
375 movwf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376 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
377 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
378 movwf EEDATA
1efd59d689f8 small change in the set time menu, default setpoints set to 0.8, 1.0 and 1.2Bar
heinrichsweikamp
parents: 229
diff changeset
379 write_int_eeprom d'38' ; reset mix3 to ppO2=1.20Bar
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380
229
85ea09d3b9d8 Nofly should not be reset after dive simulation (bug BB18).
JeanDo
parents: 224
diff changeset
381 clrf nofly_time+0 ; Clear nofly time
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 clrf nofly_time+1 ; Clear nofly time
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
384 reset_all_cf_bank0:
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
385 clrf EEADRH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386 movlw d'127' ; address of low byte of first custom function
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
389 movlw LOW cf_default_table0 ; Load PROM pointer.
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
390 movwf TBLPTRL,A
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
391 movlw HIGH cf_default_table0
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
392 movwf TBLPTRH,A
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
393 movlw UPPER cf_default_table0
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
394 movwf TBLPTRU,A
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
395
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
396 cf_bank0_loop:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
397 ; Did we already read 32 (decimal) words or double-words (with types) ?
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
398 movf TBLPTRL,W
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
399 sublw LOW (cf_default_table1)
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
400 bz reset_all_cf_bank1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
401
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
402 rcall reset_customfunction ; saves default and current value
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
403 bra cf_bank0_loop
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
404
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
405 reset_all_cf_bank1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
407 movwf EEADRH ; EEPROM BANK 1 !!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
408 movlw d'127' ; address of low byte of first custom function
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
409 movwf EEADR
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
410
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
411 cf_bank1_loop:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
412 ; Did we already read another 32 (decimal) words or double-words ?
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
413 movf TBLPTRL,W
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
414 sublw LOW (cf_default_table2)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
415 bz cf_bank1_end
27
29341afd2060 NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents: 25
diff changeset
416
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
417 rcall reset_customfunction ; saves default and current value
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
418 bra cf_bank1_loop
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
419
79
69c462400279 Making CF edition esier
JeanDo
parents: 69
diff changeset
420 cf_bank1_end:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
421 clrf EEADRH ; EEPROM BANK 0 !
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
422
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
423 ;call reset_external_eeprom ; delete profile memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
424 goto restart ; all reset, quit to surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
425
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
426 ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
427 reset_gas:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
428 movwf lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
429 rcall reset_eeprom_value ; First pair
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
430 goto reset_eeprom_value ; Second pair.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
431
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
432 reset_customfunction:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
433 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
434 movff TABLAT, lo ; Low byte in lo,
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
435 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
436 movff TABLAT, hi ; High byte in hi
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 ifndef NO_CF_TYPES
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
439 tblrd*+ ; Skip advanced min/max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
440 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
441 btfss hi,7 ; In EEPROM, just clear all types,
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
442 clrf hi ; to keep external program compat (jdivelog etc.)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
443 bcf hi,7
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
444 endif
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
445
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
446 ; Manage the default/value tuple
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
447 rcall reset_eeprom_value ; First pair, untouched.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
448 bcf hi,7 ; Just clear type bit.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
449 bra reset_eeprom_value ; Second pair, cleared
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
450
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
451 ; Write the two bytes lo:hi into EEPROM
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
452 reset_eeprom_value:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
453 incf EEADR,F
384
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
454 movff lo, EEDATA ; Lowbyte Default value
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
455
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
456 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
457 cpfslt EEADR ; EEADR > 127?
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
458 call write_eeprom ; Yes, write!
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
459
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
460 incf EEADR,F
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 83
diff changeset
461 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
462
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
463 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
464 cpfslt EEADR ; EEADR > 127?
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
465 call write_eeprom ; Yes, write!
904863f96582 Work-Around for "Reset all" overwriting 0x00 to 0x04 in EEPROM Bank1
heinrichsweikamp
parents: 374
diff changeset
466 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
467
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
468 reset_external_eeprom: ; deletes complete external eeprom!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
469 clrf eeprom_address+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
470 clrf eeprom_address+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
471
350
7250ca7c8d24 64kByte logbook (Still incompatible to existing PC software)
heinrichsweikamp
parents: 341
diff changeset
472 movlw d'4'
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
473 movwf temp3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
474 reset_eeprom02:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
475 clrf temp4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
476 reset_eeprom01:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
477 movlw d'64'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
478 movwf temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
479 bcf eeprom_blockwrite ; Blockwrite start
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
480 reset_eeprom1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
481 setf ext_ee_temp1 ; byte for Blockwrite....
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
482 movf ext_ee_temp1,W ; So, 1st. Byte of block is fine, too
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
483 call write_external_eeprom_block
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
484 decfsz temp2,F ; 64 Byte done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
485 bra reset_eeprom1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
486 bsf SSPCON2,PEN ; Stop condition
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
487 call WaitMSSP
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
488 WAITMS d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
489 decfsz temp4,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
490 bra reset_eeprom01 ; do this 256 times
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
491 decfsz temp3,F
350
7250ca7c8d24 64kByte logbook (Still incompatible to existing PC software)
heinrichsweikamp
parents: 341
diff changeset
492 bra reset_eeprom02 ; and this all 4 times -> 1024 *64Bytes = 64KB
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
493
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
494 bcf eeprom_blockwrite ; clear blockwrite flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
495
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
496 clrf eeprom_address+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
497 clrf eeprom_address+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
498
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
499 movlw 0xFD ; With these three bytes the OSTC will find the free area in the EEPROM faster
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
500 call write_external_eeprom
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
501 movlw 0xFD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
502 call write_external_eeprom
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
503 movlw 0xFE
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
504 call write_external_eeprom
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
505
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
506 clrf eeprom_address+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
507 clrf eeprom_address+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
508 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
509