annotate code_part1/OSTC_code_asm_part1/menu_reset.asm @ 79:69c462400279

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