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