Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_reset.asm @ 28:e01e6428d316
CHANGE: Change of color layout (OSTC Mk.2 Only)
author | heinrichsweikamp |
---|---|
date | Sun, 16 May 2010 15:38:50 +0200 |
parents | 29341afd2060 |
children | 65d5b0c8da41 |
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 | |
22 ; last updated: 08/08/31 | |
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 | |
30 menu_reset: | |
31 movlw d'1' | |
32 movwf menupos | |
33 | |
34 call PLED_ClearScreen | |
35 call PLED_reset_menu_mask | |
36 | |
37 menu_reset2: | |
38 clrf timeout_counter2 | |
39 bcf sleepmode | |
40 bcf menubit2 | |
41 bcf menubit3 | |
42 bsf menubit | |
43 bsf cursor | |
44 call PLED_reset_menu_mask | |
45 call PLED_menu_cursor | |
46 bcf switch_left | |
47 bcf switch_right | |
48 menu_reset_loop: | |
49 call check_switches_menu | |
50 btfsc menubit2 | |
51 bra do_menu_reset ; call submenu | |
52 btfss menubit | |
53 bra menu ; exit setup menu and return to main menu | |
54 btfsc onesecupdate | |
55 call timeout_surfmode | |
56 btfsc onesecupdate | |
57 call set_dive_modes | |
58 btfsc onesecupdate | |
59 call test_charger ; check if charger IC is active | |
60 btfsc onesecupdate | |
61 call get_battery_voltage ; get battery voltage | |
62 bcf onesecupdate ; End of one second tasks | |
63 btfsc sleepmode | |
64 goto menu | |
65 btfsc divemode | |
66 goto restart ; exit menu, restart and enter divemode | |
67 bra menu_reset_loop | |
68 do_menu_reset: ; calls submenu | |
69 dcfsnz menupos,F | |
70 bra do_menu_reset_exit ; Cancel, exit | |
71 dcfsnz menupos,F | |
72 bra do_menu_reset_all ; Reset all settings | |
73 dcfsnz menupos,F | |
74 bra do_menu_reset_logbook ; Reset Logbook Memory! | |
75 dcfsnz menupos,F | |
76 bra do_menu_reset_reboot ; Reboot OSTC | |
77 dcfsnz menupos,F | |
78 bra do_menu_reset_decodata ; Reset Decodata | |
79 do_menu_reset_exit: | |
80 movlw d'3' | |
81 movwf menupos | |
82 bra menu2 ; exit... | |
83 | |
84 | |
85 do_menu_reset_reboot: | |
86 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
87 movwf menupos ; Used as temp | |
88 tstfsz menupos | |
89 bra do_menu_reset_reboot2 ; Delete now! | |
90 bra do_menu_reset_exit ; Cancel! | |
91 | |
92 do_menu_reset_reboot2: | |
93 call PLED_DisplayOff ; Power-down OLED | |
94 movlw b'00000000' ; Bit6: PPL Disable | |
95 movwf OSCTUNE | |
96 movlw b'01111110' ; 8MHz | |
97 movwf OSCCON | |
98 reset | |
99 goto 0x00000 ; restart to 0x00000 | |
100 | |
101 do_menu_reset_logbook: | |
102 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
103 movwf menupos ; Used as temp | |
104 tstfsz menupos | |
105 bra do_menu_reset_logbook2 ; Delete Logbook now! | |
106 bra do_menu_reset_exit ; Cancel! | |
107 | |
108 do_menu_reset_logbook2: | |
109 call PLED_ClearScreen | |
110 DISPLAYTEXT .25 ; "Reset..." | |
111 call reset_external_eeprom ; delete profile memory | |
112 bra do_menu_reset_exit | |
113 | |
114 do_menu_reset_decodata: | |
115 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
116 movwf menupos ; Used as temp | |
117 tstfsz menupos | |
118 bra do_menu_reset_decodata2 ; Reset Deco Data now! | |
119 bra do_menu_reset_exit ; Cancel! | |
120 | |
121 do_menu_reset_decodata2: | |
122 ; reset deco data | |
123 call PLED_ClearScreen | |
124 DISPLAYTEXT .25 ; "Reset..." | |
125 movff amb_pressure+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine | |
126 movff amb_pressure+1,int_I_pres_respiration+1 | |
127 call deco_main_clear_tissue ; | |
128 movlb b'00000001' ; RAM Bank1 selected | |
129 goto restart ; done. quit to surfmode | |
130 | |
131 do_menu_reset_all: | |
132 call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! | |
133 movwf menupos ; Used as temp | |
134 tstfsz menupos | |
135 bra do_menu_reset_all2 ; Reset all now! | |
136 bra do_menu_reset_exit ; Cancel! | |
137 | |
138 do_menu_reset_all2: | |
139 call PLED_ClearScreen | |
140 DISPLAYTEXT .25 ; "Reset..." | |
141 | |
142 reset_start: | |
143 ; reset deco data | |
144 movff amb_pressure+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine | |
145 movff amb_pressure+1,int_I_pres_respiration+1 | |
146 call deco_main_clear_tissue ; | |
147 movlb b'00000001' ; RAM Bank1 selected | |
148 | |
149 ; reset gases | |
150 clrf EEADRH ; EEPROM BANK 0 ! | |
151 | |
152 movlw d'3' ; address of first gas-1 | |
153 movwf EEADR | |
154 clrf hi ; He part (default for all gases: 0%) | |
155 movlw d'21' ; O2 part (21%) | |
156 rcall reset_customfunction ; saves default and current value for gas #1 | |
157 movlw d'21' ; O2 part (21%) | |
158 rcall reset_customfunction ; saves default and current value for gas #2 | |
159 movlw d'21' ; O2 part (21%) | |
160 rcall reset_customfunction ; saves default and current value for gas #3 | |
161 movlw d'21' ; O2 part (21%) | |
162 rcall reset_customfunction ; saves default and current value for gas #4 | |
163 movlw d'21' ; O2 part (21%) | |
164 rcall reset_customfunction ; saves default and current value for gas #5 | |
165 movlw d'21' ; O2 part (21%) | |
166 rcall reset_customfunction ; saves default and current value for gas #6 | |
167 | |
168 reset_all_cf: | |
169 ; resets all customfunctions to the following default values | |
170 movlw d'1' | |
171 movwf EEDATA | |
172 write_int_eeprom d'33' ; reset start gas | |
173 clrf EEDATA | |
174 write_int_eeprom d'34' ; reset deco model to ZH-L16 | |
175 clrf EEDATA | |
176 write_int_eeprom d'35' ; Do not use O2 Sensor in CC Modes | |
177 | |
178 movlw d'0' | |
179 clrf EEDATA | |
180 write_int_eeprom d'39' ; Disable Debugbode | |
181 clrf EEDATA | |
182 write_int_eeprom d'90' ; Disable Brightness offset? (Dim=1, Normal = 0) | |
183 clrf EEDATA | |
184 write_int_eeprom d'91' ; Reset Date format to MM/DD/YY | |
185 | |
186 movlw d'100' | |
187 write_int_eeprom d'26' ; Salinity default: 1.00 kg/l | |
188 | |
189 movlw b'00011111' | |
190 movwf EEDATA | |
191 write_int_eeprom d'27' ; reset active gas flags | |
192 | |
193 clrf EEDATA | |
194 write_int_eeprom d'28' ; reset change depth gas #1 | |
195 clrf EEDATA | |
196 write_int_eeprom d'29' ; reset change depth gas #2 | |
197 clrf EEDATA | |
198 write_int_eeprom d'30' ; reset change depth gas #3 | |
199 clrf EEDATA | |
200 write_int_eeprom d'31' ; reset change depth gas #4 | |
201 clrf EEDATA | |
202 write_int_eeprom d'32' ; reset change depth gas #5 | |
203 | |
204 movlw d'100' | |
205 movwf EEDATA | |
206 write_int_eeprom d'36' ; reset mix1 to ppO2=1.00Bar | |
207 write_int_eeprom d'37' ; reset mix2 to ppO2=1.00Bar | |
208 write_int_eeprom d'38' ; reset mix3 to ppO2=1.00Bar | |
209 | |
210 movlw d'1' | |
211 movwf nofly_time+0 ; Clear nofly time | |
212 clrf nofly_time+1 ; Clear nofly time | |
213 | |
214 #DEFINE dive_threshold d'100' ; 8BIT 100cm | |
215 #DEFINE surf_threshold d'30' ; 8BIT 30cm | |
216 #DEFINE diveloop_timeout d'240' ; 8BIT 240s | |
217 #DEFINE surfloop_timeout d'120' ; 8BIT 120s | |
218 #DEFINE premenu_timeout d'5' ; 8BIT 5s | |
219 | |
220 #DEFINE minimum_velocity d'7' ; 8BIT 7min/min | |
221 #DEFINE pressure_offset_divemode d'1160' ; 15BIT 1160mBar | |
222 #DEFINE max_surfpressure d'1100' ; 15BIT 1100mBar | |
223 #DEFINE min_gradient_factor d'20' ; 8Bit 20% | |
224 #DEFINE oxygen_threshold d'20' ; 8Bit 20% | |
225 | |
226 #DEFINE dive_menu_timeout d'30' ; 8BIT 30s | |
227 #DEFINE saturation_multiplier d'110' ; 8BIT x1.1 | |
228 #DEFINE desaturation_multiplier d'90' ; 8BIT x0.9 | |
229 #DEFINE nofly_time_ratio d'60' ; 8BIT 60% | |
230 #DEFINE gradient_factor_alarm1 d'100' ; 8Bit 100% | |
231 | |
10 | 232 #DEFINE not_used_CF15 d'100' ; 8Bit |
0 | 233 #DEFINE deco_distance_for_sim d'10' ; 8Bit 1m |
234 #DEFINE ppo2_warning_low d'019' ; 8Bit 0.19 Bar | |
235 #DEFINE ppo2_warning_high d'160' ; 8Bit 1.60 Bar | |
236 #DEFINE ppo2_display_high d'150' ; 8Bit 1.50 Bar | |
237 | |
238 #DEFINE sampling_rate d'10' ; 8Bit 10s | |
239 #DEFINE sampling_divisor_temp d'6' ; 8Bit /6 | |
240 #DEFINE sampling_divisor_deco d'6' ; 8Bit /6 | |
241 #DEFINE sampling_divisor_tank d'0' ; 8Bit never | |
242 #DEFINE sampling_divisor_ppo2 d'0' ; 8Bit never | |
243 | |
244 #DEFINE sampling_divisor_deco2 d'12' ; 8Bit /12 | |
245 #DEFINE sampling_divisor_nyu2 d'0' ; 8Bit never | |
246 #DEFINE cns_display_high d'20' ; 8Bit 20% | |
247 #DEFINE logbook_offset d'0' ; 15Bit No Offset, but 15Bit value | |
248 #DEFINE last_deco_depth d'3' ; 8Bit 3m | |
249 #DEFINE timeout_apnoe_mode d'10' ; 8Bit 10min | |
250 #DEFINE show_voltage_value d'0' ; 1Bit =1 Show value instead of symbol, =0 Show Symbol | |
251 | |
252 #DEFINE GF_low_default d'30' ; 8Bit 30% | |
253 #DEFINE GF_high_default d'90' ; 8Bit 90% | |
28
e01e6428d316
CHANGE: Change of color layout (OSTC Mk.2 Only)
heinrichsweikamp
parents:
27
diff
changeset
|
254 #DEFINE color_battery_surface d'199' ; 8Bit Color Battery sign: Deep blue |
9 | 255 #DEFINE color_standard1 d'255' ; 8Bit Color Standard: White |
28
e01e6428d316
CHANGE: Change of color layout (OSTC Mk.2 Only)
heinrichsweikamp
parents:
27
diff
changeset
|
256 #DEFINE color_divemask d'62' ; 8Bit Color Divemask: Light green |
25 | 257 #DEFINE color_warnings d'224' ; 8Bit Color Warnings: Red |
0 | 258 |
259 #DEFINE show_seconds_divemode d'0' ; 1Bit =1 Show the seconds in Divemode | |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
260 #DEFINE not_used_cf39_binary d'0' ; 1Bit =1 Flip Display |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
261 #DEFINE not_used_cf40_binary d'0' ; 1Bit =1 Use alternative outputs for ppO2 sensor |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
262 #DEFINE start_with_stopwatch d'0' ; 1Bit =1 start with stopwatch |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
263 #DEFINE blink_gas_divemode d'0' ; 1Bit =1 Show (resetable) average Depth instead of temperature |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
264 |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
265 #DEFINE color_warn_depth_mBar d'13000' ; 15Bit Warn depths |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
266 #DEFINE color_warn_cns_percent d'101' ; 8Bit Warn-% |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
267 #DEFINE color_warn_gf_percent d'101' ; 8Bit Warn-% |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
268 #DEFINE color_warn_ppo2_cbar d'161' ; 8Bit ppO2 warn |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
269 #DEFINE color_warn_celocity_mmin d'15' ; 8Bit warn at xx m/min |
0 | 270 |
271 movlw d'127' ; address of low byte of first custom function | |
272 movwf EEADR | |
273 clrf hi ; only required once | |
274 movlw LOW dive_threshold ; 8Bit value | |
275 rcall reset_customfunction ; saves default and current value | |
276 | |
277 movlw LOW surf_threshold | |
278 rcall reset_customfunction ; saves default and current value | |
279 | |
280 movlw LOW diveloop_timeout | |
281 rcall reset_customfunction ; saves default and current value | |
282 | |
283 movlw LOW surfloop_timeout | |
284 rcall reset_customfunction ; saves default and current value | |
285 | |
286 movlw LOW premenu_timeout | |
287 rcall reset_customfunction ; saves default and current value | |
288 | |
289 movlw LOW minimum_velocity | |
290 rcall reset_customfunction ; saves default and current value | |
291 | |
292 movlw HIGH pressure_offset_divemode | |
293 movwf hi | |
294 bsf hi,7 ; 15Bit value | |
295 movlw LOW pressure_offset_divemode | |
296 rcall reset_customfunction ; saves default and current value | |
297 | |
298 movlw HIGH max_surfpressure | |
299 movwf hi | |
300 bsf hi,7 ; 15Bit value | |
301 movlw LOW max_surfpressure | |
302 rcall reset_customfunction ; saves default and current value | |
303 | |
304 movlw LOW min_gradient_factor | |
305 rcall reset_customfunction ; saves default and current value | |
306 | |
307 movlw LOW oxygen_threshold | |
308 rcall reset_customfunction ; saves default and current value | |
309 | |
310 movlw LOW dive_menu_timeout | |
311 rcall reset_customfunction ; saves default and current value | |
312 | |
313 movlw LOW saturation_multiplier | |
314 rcall reset_customfunction ; saves default and current value | |
315 | |
316 movlw LOW desaturation_multiplier | |
317 rcall reset_customfunction ; saves default and current value | |
318 | |
319 movlw LOW nofly_time_ratio | |
320 rcall reset_customfunction ; saves default and current value | |
321 | |
322 movlw LOW gradient_factor_alarm1 | |
323 rcall reset_customfunction ; saves default and current value | |
324 | |
10 | 325 movlw LOW not_used_CF15 |
0 | 326 rcall reset_customfunction ; saves default and current value |
327 | |
328 movlw LOW deco_distance_for_sim | |
329 rcall reset_customfunction ; saves default and current value | |
330 | |
331 movlw LOW ppo2_warning_low | |
332 rcall reset_customfunction ; saves default and current value | |
333 | |
334 movlw LOW ppo2_warning_high | |
335 rcall reset_customfunction ; saves default and current value | |
336 | |
337 movlw LOW ppo2_display_high | |
338 rcall reset_customfunction ; saves default and current value | |
339 | |
340 movlw LOW sampling_rate | |
341 rcall reset_customfunction ; saves default and current value | |
342 | |
343 movlw LOW sampling_divisor_temp | |
344 rcall reset_customfunction ; saves default and current value | |
345 | |
346 movlw LOW sampling_divisor_deco | |
347 rcall reset_customfunction ; saves default and current value | |
348 | |
349 movlw LOW sampling_divisor_tank | |
350 rcall reset_customfunction ; saves default and current value | |
351 | |
352 movlw LOW sampling_divisor_ppo2 | |
353 rcall reset_customfunction ; saves default and current value | |
354 | |
355 movlw LOW sampling_divisor_deco2 | |
356 rcall reset_customfunction ; saves default and current value | |
357 | |
358 movlw LOW sampling_divisor_nyu2 | |
359 rcall reset_customfunction ; saves default and current value | |
360 | |
361 movlw LOW cns_display_high | |
362 rcall reset_customfunction ; saves default and current value | |
363 | |
364 clrf hi | |
365 bsf hi,7 ; 15Bit value | |
366 movlw LOW logbook_offset | |
367 rcall reset_customfunction ; saves default and current value | |
368 | |
369 movlw LOW last_deco_depth | |
370 rcall reset_customfunction ; saves default and current value | |
371 | |
372 movlw LOW timeout_apnoe_mode | |
373 rcall reset_customfunction ; saves default and current value | |
374 | |
375 movlw LOW show_voltage_value | |
376 rcall reset_customfunction ; saves default and current value | |
377 | |
378 reset_all_cf_bank1: | |
379 movlw d'1' | |
380 movwf EEADRH ; EEPROM BANK 1 !! | |
381 movlw d'127' ; address of low byte of first custom function | |
382 movwf EEADR | |
383 clrf hi ; only required once/bank | |
384 | |
385 movlw LOW GF_low_default | |
386 rcall reset_customfunction ; saves default and current value | |
387 | |
388 movlw LOW GF_high_default | |
389 rcall reset_customfunction ; saves default and current value | |
390 | |
391 movlw color_battery_surface | |
392 rcall reset_customfunction ; saves default and current value | |
393 | |
3 | 394 movlw color_standard1 |
0 | 395 rcall reset_customfunction ; saves default and current value |
396 | |
9 | 397 movlw color_divemask |
0 | 398 rcall reset_customfunction ; saves default and current value |
399 | |
25 | 400 movlw color_warnings |
0 | 401 rcall reset_customfunction ; saves default and current value |
402 | |
403 movlw show_seconds_divemode | |
404 rcall reset_customfunction ; saves default and current value | |
405 | |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
406 movlw not_used_cf39_binary |
0 | 407 rcall reset_customfunction ; saves default and current value |
408 | |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
409 movlw not_used_cf40_binary |
0 | 410 rcall reset_customfunction ; saves default and current value |
411 | |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
412 movlw start_with_stopwatch |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
413 rcall reset_customfunction ; saves default and current value |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
414 |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
415 movlw blink_gas_divemode |
0 | 416 rcall reset_customfunction ; saves default and current value |
417 | |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
418 movlw HIGH color_warn_depth_mBar |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
419 movwf hi |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
420 bsf hi,7 ; 15Bit value |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
421 movlw LOW color_warn_depth_mBar |
0 | 422 rcall reset_customfunction ; saves default and current value |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
423 |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
424 movlw color_warn_cns_percent |
0 | 425 rcall reset_customfunction ; saves default and current value |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
426 |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
427 movlw color_warn_gf_percent |
0 | 428 rcall reset_customfunction ; saves default and current value |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
429 |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
430 movlw color_warn_ppo2_cbar |
0 | 431 rcall reset_customfunction ; saves default and current value |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
432 |
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
433 movlw color_warn_celocity_mmin |
0 | 434 rcall reset_customfunction ; saves default and current value |
27
29341afd2060
NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded
heinrichsweikamp
parents:
25
diff
changeset
|
435 |
0 | 436 movlw d'0' |
437 rcall reset_customfunction ; saves default and current value | |
438 movlw d'0' | |
439 rcall reset_customfunction ; saves default and current value | |
440 movlw d'0' | |
441 rcall reset_customfunction ; saves default and current value | |
442 movlw d'0' | |
443 rcall reset_customfunction ; saves default and current value | |
444 movlw d'0' | |
445 rcall reset_customfunction ; saves default and current value | |
446 movlw d'0' | |
447 rcall reset_customfunction ; saves default and current value | |
448 movlw d'0' | |
449 rcall reset_customfunction ; saves default and current value | |
450 movlw d'0' | |
451 rcall reset_customfunction ; saves default and current value | |
452 movlw d'0' | |
453 rcall reset_customfunction ; saves default and current value | |
454 movlw d'0' | |
455 rcall reset_customfunction ; saves default and current value | |
456 movlw d'0' | |
457 rcall reset_customfunction ; saves default and current value | |
458 movlw d'0' | |
459 rcall reset_customfunction ; saves default and current value | |
460 movlw d'0' | |
461 rcall reset_customfunction ; saves default and current value | |
462 movlw d'0' | |
463 rcall reset_customfunction ; saves default and current value | |
464 movlw d'0' | |
465 rcall reset_customfunction ; saves default and current value | |
466 movlw d'0' | |
467 rcall reset_customfunction ; saves default and current value | |
468 | |
469 clrf EEADRH ; EEPROM BANK 0 ! | |
470 | |
471 | |
472 ;call reset_external_eeprom ; delete profile memory | |
473 goto restart ; all reset, quit to surfmode | |
474 | |
475 reset_customfunction: | |
476 movwf lo | |
477 incf EEADR,F | |
478 movff lo, EEDATA ; Lowbyte Defaul value | |
479 call write_eeprom | |
480 incf EEADR,F | |
481 movff hi, EEDATA ; Highbyte default value | |
482 call write_eeprom | |
483 incf EEADR,F | |
484 movff lo, EEDATA ; Lowbyte current value | |
485 call write_eeprom | |
486 incf EEADR,F | |
487 bcf hi,7 ; This bit will only be written for the default value | |
488 movff hi, EEDATA ; Highbyte current value | |
489 call write_eeprom | |
490 clrf hi | |
491 return | |
492 | |
493 | |
494 reset_external_eeprom: ; deletes complete external eeprom! | |
495 clrf eeprom_address+0 | |
496 clrf eeprom_address+1 | |
497 | |
498 movlw d'2' | |
499 movwf temp3 | |
500 reset_eeprom02: | |
501 clrf temp4 | |
502 reset_eeprom01: | |
503 movlw d'64' | |
504 movwf temp2 | |
505 bcf eeprom_blockwrite ; Blockwrite start | |
506 reset_eeprom1: | |
507 setf ext_ee_temp1 ; byte for Blockwrite.... | |
508 movf ext_ee_temp1,W ; So, 1st. Byte of block is fine, too | |
509 call write_external_eeprom_block | |
510 decfsz temp2,F ; 64 Byte done | |
511 bra reset_eeprom1 | |
512 bsf SSPCON2,PEN ; Stop condition | |
513 call WaitMSSP | |
514 WAITMS d'7' | |
515 decfsz temp4,F | |
516 bra reset_eeprom01 ; do this 256 times | |
517 decfsz temp3,F | |
518 bra reset_eeprom02 ; and this all 2 times -> 512 *64Bytes = 32KB | |
519 | |
520 bcf eeprom_blockwrite ; clear blockwrite flag | |
521 | |
522 clrf eeprom_address+0 | |
523 clrf eeprom_address+1 | |
524 | |
525 movlw 0xFD ; With these three bytes the OSTC will find the free area in the EEPROM faster | |
526 call write_external_eeprom | |
527 movlw 0xFD | |
528 call write_external_eeprom | |
529 movlw 0xFE | |
530 call write_external_eeprom | |
531 | |
532 clrf eeprom_address+0 | |
533 clrf eeprom_address+1 | |
534 return | |
535 |