Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/menu_reset.asm @ 86:b40a0a6284da
adding custom functions with limits (jeando)
author | heinrichsweikamp |
---|---|
date | Thu, 09 Dec 2010 20:41:56 +0100 |
parents | 3e351e25f5d1 |
children | 6f8e3a08011e |
comparison
equal
deleted
inserted
replaced
85:8b813f67220f | 86:b40a0a6284da |
---|---|
17 | 17 |
18 | 18 |
19 ; Menu "Reset all" | 19 ; Menu "Reset all" |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | 20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com |
21 ; written: 10/30/05 | 21 ; written: 10/30/05 |
22 ; last updated: 08/08/31 | 22 ; last updated: 10/12/08 by JD Gascuel at free.fr |
23 ; known bugs: | 23 ; known bugs: |
24 ; ToDo: | 24 ; ToDo: |
25 | 25 |
26 ; routines to reset external EEPROM (currently inactvated!) | 26 ; routines to reset external EEPROM (currently inactvated!) |
27 ; routines to reset custom function, gases and decompression values | 27 ; routines to reset custom function, gases and decompression values |
31 ; CF default values | 31 ; CF default values |
32 ; | 32 ; |
33 | 33 |
34 ; Macro to check values, and construct PROM CF default table. | 34 ; Macro to check values, and construct PROM CF default table. |
35 ; If in types mode, set flags into hi. If not, clear it. | 35 ; If in types mode, set flags into hi. If not, clear it. |
36 CF_DEFAULT macro type, value | 36 CF_DEFAULT macro type, default, min, max |
37 if ( type == CF_INT15 ) | 37 noexpand |
38 if (HIGH value) > .127 | 38 if (type) == CF_INT15 |
39 error "15bit default too big:", value | 39 if (HIGH (default)) > .127 |
40 endif | 40 error "CF# 15bit default too big:", value |
41 DB LOW value, 0x80 + (HIGH value) | 41 endif |
42 else | 42 if (min)>0 && (max>min) |
43 ; Basic sanity check for 8bit values: | 43 error "CF# 15bit defaults cannot have both MIN & MAX flags" |
44 if ( HIGH value ) > 0 | 44 endif |
45 error "8bit default too big:", value | 45 |
46 endif | 46 ifdef NO_CF_TYPES |
47 if (type==CF_BOOL) && (value > 1) | 47 DB LOW (default), HIGH(default) + 0x80 |
48 error "BOOL default too big:", value | 48 else |
49 endif | 49 DB LOW (default), HIGH(default) + 0x80 |
50 ifdef NO_CF_TYPES | 50 if (min) > 0 |
51 DB LOW value, HIGH value | 51 DB LOW(min), HIGH(min) |
52 else | 52 else |
53 DB LOW value, type | 53 DB LOW(min), HIGH(min) + 0x80 |
54 endif | 54 endif |
55 endif | 55 endif |
56 endm | 56 else |
57 ; Basic sanity check for 8bit values: | |
58 if HIGH(default) > 0 | |
59 error "CF# 8bit default too big:", (default) | |
60 endif | |
61 if HIGH(min) > 0 | |
62 error "CF# 8bit min too big:", (min) | |
63 endif | |
64 if HIGH(max) > 0 | |
65 error "CF# 8bit max too big:", (max) | |
66 endif | |
67 if ((type)==CF_BOOL) && ( (default)>1 ) | |
68 error "CF# BOOL default too big:", (default) | |
69 endif | |
70 if ((type)==CF_BOOL) && ( (min)>0 || (max)>0 ) | |
71 error "CF# BOOL cannot have min/max" | |
72 endif | |
73 | |
74 ifdef NO_CF_TYPES | |
75 DB LOW(default), 0 | |
76 else | |
77 local typeFlags | |
78 typeFlags set type | |
79 if (min)>0 | |
80 typeFlags set type + CF_MIN | |
81 endif | |
82 if (max)>(min) | |
83 typeFlags set typeFlags + CF_MAX | |
84 endif | |
85 DB LOW(default), (typeFlags), LOW(min), LOW(max) | |
86 endif | |
87 endif | |
88 expand | |
89 endm | |
90 | |
91 ; Starting at CF0 | |
92 CF_NUMBER set -1 | |
57 | 93 |
58 ; resets all customfunctions to the following default values | 94 ; resets all customfunctions to the following default values |
59 cf_default_table: | 95 cf_default_table0: |
60 ;---- BANK0 custom function defaults ------------------------------------- | 96 ;---- BANK0 custom function defaults ------------------------------------- |
61 CF_DEFAULT CF_CENTI, d'100' ; dive_threshold 100cm | 97 ; DEFAULT MIN MAX |
62 CF_DEFAULT CF_CENTI, d'30' ; surf_threshold 30cm | 98 CF_DEFAULT CF_CENTI, d'100', d'50', d'250' ; dive_threshold 100cm |
63 CF_DEFAULT CF_SEC, d'240' ; diveloop_timeout 240s | 99 CF_DEFAULT CF_CENTI, d'30', d'10', d'100' ; surf_threshold 30cm |
64 CF_DEFAULT CF_SEC, d'120' ; surfloop_timeout 120s | 100 CF_DEFAULT CF_SEC, d'240', d'30', d'240' ; diveloop_timeout 240s |
65 CF_DEFAULT CF_SEC, d'5' ; premenu_timeout 5s | 101 CF_DEFAULT CF_SEC, d'120', d'30', d'240' ; surfloop_timeout 120s |
66 | 102 CF_DEFAULT CF_SEC, d'5', d'1', d'30' ; premenu_timeout 5s |
67 CF_DEFAULT CF_INT8, d'7' ; minimum_velocity 7min/min | 103 |
68 CF_DEFAULT CF_INT15, d'1160' ; pressure_offset_divemode 1160mBar | 104 CF_DEFAULT CF_INT8, d'7', d'3', d'18' ; minimum_velocity 7min/min |
69 CF_DEFAULT CF_INT15, d'1100' ; max_surfpressure 1100mBar | 105 CF_DEFAULT CF_INT15, d'1160',d'950', 0 ; pressure_offset_divemode 1160mBar |
70 CF_DEFAULT CF_PERCENT, d'20' ; min_gradient_factor 20% | 106 CF_DEFAULT CF_INT15, d'1100',d'1100', 0 ; max_surfpressure 1100mBar |
71 CF_DEFAULT CF_PERCENT, d'20' ; oxygen_threshold 20% | 107 CF_DEFAULT CF_PERCENT, d'20', d'1', d'99' ; min_gradient_factor 20% |
72 | 108 CF_DEFAULT CF_PERCENT, d'20', d'1', d'20' ; oxygen_threshold 20% |
73 CF_DEFAULT CF_SEC, d'30' ; dive_menu_timeout 30s | 109 |
74 CF_DEFAULT CF_PERCENT, d'110' ; saturation_multiplier x1.10 | 110 CF_DEFAULT CF_SEC, d'30', d'5', d'30' ; dive_menu_timeout 30s |
75 CF_DEFAULT CF_PERCENT, d'90' ; desaturation_multiplier x0.90 | 111 CF_DEFAULT CF_PERCENT, d'110', d'110', d'200' ; saturation_multiplier x1.10 |
76 CF_DEFAULT CF_PERCENT, d'60' ; nofly_time_ratio 60% | 112 CF_DEFAULT CF_PERCENT, d'90', d'50', d'90' ; desaturation_multiplier x0.90 |
77 CF_DEFAULT CF_PERCENT, d'100' ; gradient_factor_alarm1 100% | 113 CF_DEFAULT CF_PERCENT, d'60', d'60', d'100' ; nofly_time_ratio 60% |
78 | 114 CF_DEFAULT CF_PERCENT, d'100', d'50', d'100' ; gradient_factor_alarm1 100% |
79 CF_DEFAULT CF_PERCENT, d'10' ; cns_display_surface 10% | 115 |
80 CF_DEFAULT CF_INT8, d'10' ; deco_distance_for_sim 1m | 116 CF_DEFAULT CF_PERCENT, d'10', d'01', d'100' ; cns_display_surface 10% |
81 CF_DEFAULT CF_CENTI, d'019' ; ppo2_warning_low 0.19 Bar | 117 CF_DEFAULT CF_DECI, d'10', d'10', d'100' ; deco_distance_for_sim 1m |
82 CF_DEFAULT CF_CENTI, d'160' ; ppo2_warning_high 1.60 Bar | 118 CF_DEFAULT CF_CENTI, d'019', d'019', d'021' ; ppo2_warning_low 0.19 Bar |
83 CF_DEFAULT CF_CENTI, d'150' ; ppo2_display_high 1.50 Bar | 119 CF_DEFAULT CF_CENTI, d'160', d'100', d'160' ; ppo2_warning_high 1.60 Bar |
84 | 120 CF_DEFAULT CF_CENTI, d'150', d'100', d'150' ; ppo2_display_high 1.50 Bar |
85 CF_DEFAULT CF_INT8, d'10' ; sampling_rate 10s | 121 |
86 CF_DEFAULT CF_INT8, d'6' ; sampling_divisor_temp /6 | 122 CF_DEFAULT CF_INT8, d'10', d'1', d'120' ; sampling_rate 10s |
87 CF_DEFAULT CF_INT8, d'6' ; sampling_divisor_deco /6 | 123 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_temp /6 |
88 CF_DEFAULT CF_INT8, d'0' ; sampling_divisor_tank never | 124 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_deco /6 |
89 CF_DEFAULT CF_INT8, d'0' ; sampling_divisor_ppo2 never | 125 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_tank never |
90 | 126 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_ppo2 never |
91 CF_DEFAULT CF_INT8, d'0' ; sampling_divisor_deco2 never | 127 |
92 CF_DEFAULT CF_INT8, d'0' ; sampling_divisor_nyu2 never | 128 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_deco2 never |
93 CF_DEFAULT CF_PERCENT, d'20' ; cns_display_high 20% | 129 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_nyu2 never |
94 CF_DEFAULT CF_INT8, d'0' ; logbook_offset No Offset, but 15Bit value | 130 CF_DEFAULT CF_PERCENT, d'20', d'5', d'75' ; cns_display_high 20% |
95 CF_DEFAULT CF_INT8, d'3' ; last_deco_depth 3m | 131 CF_DEFAULT CF_INT15, d'0', d'0', 0 ; logbook_offset No Offset, but 15Bit value |
96 | 132 CF_DEFAULT CF_INT8, d'3', d'2', d'6' ; last_deco_depth 3m |
97 CF_DEFAULT CF_SEC, d'10' ; timeout_apnoe_mode 10min | 133 |
98 CF_DEFAULT CF_BOOL, d'0' ; show_voltage_value =1 Show value instead of symbol, =0 Show Symbol | 134 CF_DEFAULT CF_SEC, d'10', d'1', d'15' ; timeout_apnoe_mode 10min |
135 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_voltage_value =1 Show value instead of symbol, =0 Show Symbol | |
99 | 136 |
100 ;---- BANK1 custom function defaults ------------------------------------- | 137 ;---- BANK1 custom function defaults ------------------------------------- |
101 CF_DEFAULT CF_PERCENT, d'30' ; GF_low_default 30% | 138 cf_default_table1: |
102 CF_DEFAULT CF_PERCENT, d'90' ; GF_high_default 90% | 139 ; DEFAULT MIN MAX |
103 CF_DEFAULT CF_COLOR, d'199' ; color_battery_surface Color Battery sign: Deep blue | 140 CF_DEFAULT CF_PERCENT, d'30', d'10', d'90' ; GF_low_default 30% |
104 CF_DEFAULT CF_COLOR, d'255' ; color_standard1 Color Standard: White | 141 CF_DEFAULT CF_PERCENT, d'90', d'30', d'95' ; GF_high_default 90% |
105 CF_DEFAULT CF_COLOR, d'62' ; color_divemask Color Divemask: Light green | 142 CF_DEFAULT CF_COLOR, d'199', 0, 0 ; color_battery_surface Color Battery sign: Deep blue |
106 CF_DEFAULT CF_COLOR, d'224' ; color_warnings Color Warnings: Red | 143 CF_DEFAULT CF_COLOR, d'255', 0, 0 ; color_standard1 Color Standard: White |
107 | 144 CF_DEFAULT CF_COLOR, d'62', 0, 0 ; color_divemask Color Divemask: Light green |
108 CF_DEFAULT CF_BOOL, d'0' ; show_seconds_divemode =1 Show the seconds in Divemode | 145 CF_DEFAULT CF_COLOR, d'224', 0, 0 ; color_warnings Color Warnings: Red |
109 CF_DEFAULT CF_BOOL, d'0' ; show_clock_divemode =1 Show the clock in Divemode | 146 |
110 CF_DEFAULT CF_BOOL, d'1' ; warn_ceiling_divemode =1 Warn ceiling violation in divemode | 147 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_seconds_divemode =1 Show the seconds in Divemode |
111 CF_DEFAULT CF_BOOL, d'0' ; start_with_stopwatch =1 start with stopwatch | 148 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; show_clock_divemode =1 Show the clock in Divemode |
112 CF_DEFAULT CF_BOOL, d'0' ; blink_gas_divemode =1 Show (resetable) average Depth instead of temperature | 149 CF_DEFAULT CF_BOOL, d'1', 0, 0 ; warn_ceiling_divemode =1 Warn ceiling violation in divemode |
113 | 150 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; start_with_stopwatch =1 start with stopwatch |
114 CF_DEFAULT CF_INT15, d'13000' ; color_warn_depth_mBar Warn depths | 151 CF_DEFAULT CF_BOOL, d'0', 0, 0 ; blink_gas_divemode =1 Show (resetable) average Depth instead of temperature |
115 CF_DEFAULT CF_PERCENT, d'101' ; color_warn_cns_percent Warn-% | 152 |
116 CF_DEFAULT CF_PERCENT, d'101' ; color_warn_gf_percent Warn-% | 153 CF_DEFAULT CF_INT15, d'13000', 0, d'13000'; color_warn_depth_mBar Warn depths |
117 CF_DEFAULT CF_CENTI, d'161' ; color_warn_ppo2_cbar ppO2 warn | 154 CF_DEFAULT CF_PERCENT, d'101', d'50', d'101' ; color_warn_cns_percent Warn-% |
118 CF_DEFAULT CF_INT8, d'15' ; color_warn_celocity_mmin warn at xx m/min | 155 CF_DEFAULT CF_PERCENT, d'101', d'50', d'101' ; color_warn_gf_percent Warn-% |
119 | 156 CF_DEFAULT CF_CENTI, d'161', d'100', d'161' ; color_warn_ppo2_cbar ppO2 warn |
120 CF_DEFAULT CF_SEC, d'42' ; time_correction_value_default Adds to Seconds on Midnight | 157 CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; color_warn_celocity_mmin warn at xx m/min |
121 CF_DEFAULT CF_INT15, 0 ; UNUSED | 158 |
122 CF_DEFAULT CF_INT15, 0 ; UNUSED | 159 CF_DEFAULT CF_SEC, d'42', d'0', d'240' ; time_correction_value_default Adds to Seconds on Midnight |
123 CF_DEFAULT CF_INT15, 0 ; UNUSED | 160 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
124 CF_DEFAULT CF_INT15, 0 ; UNUSED | 161 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
162 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED | |
163 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED | |
125 | 164 |
126 CF_DEFAULT CF_INT15, 0 ; UNUSED | 165 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
127 CF_DEFAULT CF_INT15, 0 ; UNUSED | 166 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
128 CF_DEFAULT CF_INT15, 0 ; UNUSED | 167 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
129 CF_DEFAULT CF_INT15, 0 ; UNUSED | 168 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
130 CF_DEFAULT CF_INT15, 0 ; UNUSED | 169 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
131 | 170 |
132 CF_DEFAULT CF_INT15, 0 ; UNUSED | 171 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
133 CF_DEFAULT CF_INT15, 0 ; UNUSED | 172 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
134 CF_DEFAULT CF_INT15, 0 ; UNUSED | 173 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
135 CF_DEFAULT CF_INT15, 0 ; UNUSED | 174 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
136 CF_DEFAULT CF_INT15, 0 ; UNUSED | 175 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
137 | 176 |
138 CF_DEFAULT CF_INT15, 0 ; UNUSED | 177 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
139 CF_DEFAULT CF_INT15, 0 ; UNUSED | 178 CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED |
179 cf_default_table2: | |
180 | |
140 ;============================================================================= | 181 ;============================================================================= |
141 | 182 |
142 menu_reset: | 183 menu_reset: |
143 movlw d'1' | 184 movlw d'1' |
144 movwf menupos | 185 movwf menupos |
263 | 304 |
264 movlw d'3' ; address of first gas-1 | 305 movlw d'3' ; address of first gas-1 |
265 movwf EEADR | 306 movwf EEADR |
266 clrf hi ; He part (default for all gases: 0%) | 307 clrf hi ; He part (default for all gases: 0%) |
267 movlw d'21' ; O2 part (21%) | 308 movlw d'21' ; O2 part (21%) |
268 rcall reset_customfunction ; saves default and current value for gas #1 | 309 rcall reset_gas ; saves default and current value for gas #1 |
269 movlw d'21' ; O2 part (21%) | 310 movlw d'21' ; O2 part (21%) |
270 rcall reset_customfunction ; saves default and current value for gas #2 | 311 rcall reset_gas ; saves default and current value for gas #2 |
271 movlw d'21' ; O2 part (21%) | 312 movlw d'21' ; O2 part (21%) |
272 rcall reset_customfunction ; saves default and current value for gas #3 | 313 rcall reset_gas ; saves default and current value for gas #3 |
273 movlw d'21' ; O2 part (21%) | 314 movlw d'21' ; O2 part (21%) |
274 rcall reset_customfunction ; saves default and current value for gas #4 | 315 rcall reset_gas ; saves default and current value for gas #4 |
275 movlw d'21' ; O2 part (21%) | 316 movlw d'21' ; O2 part (21%) |
276 rcall reset_customfunction ; saves default and current value for gas #5 | 317 rcall reset_gas ; saves default and current value for gas #5 |
277 movlw d'21' ; O2 part (21%) | 318 movlw d'21' ; O2 part (21%) |
278 rcall reset_customfunction ; saves default and current value for gas #6 | 319 rcall reset_gas ; saves default and current value for gas #6 |
279 | 320 |
280 reset_all_cf: | 321 reset_all_cf: |
281 movlw d'1' | 322 movlw d'1' |
282 movwf EEDATA | 323 movwf EEDATA |
283 write_int_eeprom d'33' ; reset start gas | 324 write_int_eeprom d'33' ; reset start gas |
325 reset_all_cf_bank0: | 366 reset_all_cf_bank0: |
326 clrf EEADRH | 367 clrf EEADRH |
327 movlw d'127' ; address of low byte of first custom function | 368 movlw d'127' ; address of low byte of first custom function |
328 movwf EEADR | 369 movwf EEADR |
329 | 370 |
330 movlw LOW cf_default_table ; Load PROM pointer. | 371 movlw LOW cf_default_table0 ; Load PROM pointer. |
331 movwf TBLPTRL,A | 372 movwf TBLPTRL,A |
332 movlw HIGH cf_default_table | 373 movlw HIGH cf_default_table0 |
333 movwf TBLPTRH,A | 374 movwf TBLPTRH,A |
334 movlw UPPER cf_default_table | 375 movlw UPPER cf_default_table0 |
335 movwf TBLPTRU,A | 376 movwf TBLPTRU,A |
336 | 377 |
337 cf_bank0_loop: | 378 cf_bank0_loop: |
338 ; Did we already read 32 (decimal) bytes ? | 379 ; Did we already read 32 (decimal) words or double-words (with types) ? |
339 movf TBLPTRL,W | 380 movf TBLPTRL,W |
340 sublw LOW (cf_default_table+.64) | 381 sublw LOW (cf_default_table1) |
341 bz reset_all_cf_bank1 | 382 bz reset_all_cf_bank1 |
342 | 383 |
343 tblrd*+ | |
344 movf TABLAT, W ; Low byte in WREG, | |
345 tblrd*+ | |
346 movff TABLAT, hi ; High byte in hi | |
347 rcall reset_customfunction ; saves default and current value | 384 rcall reset_customfunction ; saves default and current value |
348 bra cf_bank0_loop | 385 bra cf_bank0_loop |
349 | 386 |
350 reset_all_cf_bank1: | 387 reset_all_cf_bank1: |
351 movlw d'1' | 388 movlw d'1' |
352 movwf EEADRH ; EEPROM BANK 1 !! | 389 movwf EEADRH ; EEPROM BANK 1 !! |
353 movlw d'127' ; address of low byte of first custom function | 390 movlw d'127' ; address of low byte of first custom function |
354 movwf EEADR | 391 movwf EEADR |
355 | 392 |
356 cf_bank1_loop: | 393 cf_bank1_loop: |
357 ; Did we already read another 32 (decimal) bytes ? | 394 ; Did we already read another 32 (decimal) words or double-words ? |
358 movf TBLPTRL,W | 395 movf TBLPTRL,W |
359 sublw LOW (cf_default_table+.128) | 396 sublw LOW (cf_default_table2) |
360 bz cf_bank1_end | 397 bz cf_bank1_end |
361 | 398 |
399 rcall reset_customfunction ; saves default and current value | |
400 bra cf_bank1_loop | |
401 | |
402 cf_bank1_end: | |
403 clrf EEADRH ; EEPROM BANK 0 ! | |
404 | |
405 ;call reset_external_eeprom ; delete profile memory | |
406 goto restart ; all reset, quit to surfmode | |
407 | |
408 ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR | |
409 reset_gas: | |
410 movwf lo | |
411 rcall reset_eeprom_value ; First pair | |
412 goto reset_eeprom_value ; Second pair. | |
413 | |
414 reset_customfunction: | |
362 tblrd*+ | 415 tblrd*+ |
363 movf TABLAT, W ; Low byte in WREG, | 416 movff TABLAT, lo ; Low byte in lo, |
364 tblrd*+ | 417 tblrd*+ |
365 movff TABLAT, hi ; High byte in hi | 418 movff TABLAT, hi ; High byte in hi |
366 rcall reset_customfunction ; saves default and current value | 419 |
367 bra cf_bank1_loop | 420 ifndef NO_CF_TYPES |
368 | 421 tblrd*+ ; Skip advanced min/max values. |
369 cf_bank1_end: | 422 tblrd*+ |
370 clrf EEADRH ; EEPROM BANK 0 ! | 423 btfss hi,7 ; In EEPROM, just clear all types, |
371 | 424 clrf hi ; to keep external program compat (jdivelog etc.) |
372 ;call reset_external_eeprom ; delete profile memory | 425 bcf hi,7 |
373 goto restart ; all reset, quit to surfmode | 426 endif |
374 | 427 |
375 ; Write the four bytes lo:hi:lo:(hi w/o type flags) into EEPROM | 428 ; Manage the default/value tuple |
376 ; Don't change hi:lo values... | 429 rcall reset_eeprom_value ; First pair, untouched. |
377 reset_customfunction: | 430 bcf hi,7 ; Just clear type bit. |
378 movwf lo | 431 bra reset_eeprom_value ; Second pair, cleared |
432 | |
433 ; Write the two bytes lo:hi into EEPROM | |
434 reset_eeprom_value: | |
379 incf EEADR,F | 435 incf EEADR,F |
380 movff lo, EEDATA ; Lowbyte Defaul value | 436 movff lo, EEDATA ; Lowbyte Defaul value |
381 call write_eeprom | 437 call write_eeprom |
438 | |
382 incf EEADR,F | 439 incf EEADR,F |
383 movff hi, EEDATA ; Highbyte default value | 440 movff hi, EEDATA ; Highbyte default value |
384 call write_eeprom | 441 goto write_eeprom |
385 incf EEADR,F | |
386 movff lo, EEDATA ; Lowbyte current value | |
387 call write_eeprom | |
388 incf EEADR,F | |
389 movff hi, EEDATA ; Highbyte current value | |
390 #ifdef NO_CF_TYPES | |
391 bcf EEDATA,7 ; This bit will only be written for the default value | |
392 #else | |
393 btfss EEDATA,7 ; A 15bit value ? | |
394 clrf EEDATA ; Nope: clear type flag. | |
395 #endif | |
396 call write_eeprom | |
397 return | |
398 | |
399 | 442 |
400 reset_external_eeprom: ; deletes complete external eeprom! | 443 reset_external_eeprom: ; deletes complete external eeprom! |
401 clrf eeprom_address+0 | 444 clrf eeprom_address+0 |
402 clrf eeprom_address+1 | 445 clrf eeprom_address+1 |
403 | 446 |