changeset 573:77c8ff191cd7

Preparations for third bank of Custom Functions
author heinrichsweikamp
date Sat, 21 Apr 2012 12:09:37 +0200
parents 80a1d2d5a9ee
children 101fec6a6137
files code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/i2c_eeprom.asm code_part1/OSTC_code_asm_part1/isr.asm code_part1/OSTC_code_asm_part1/menu_custom.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_c_part2/changes_log.txt
diffstat 6 files changed, 194 insertions(+), 155 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Fri Apr 20 21:32:03 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sat Apr 21 12:09:37 2012 +0200
@@ -346,8 +346,7 @@
 apnoe_timeout_counter   res 1   ; counts minutes for apnoe timeout
 apnoe_surface_mins      res 1   ; Surface interval mins for Apnoe mode
 apnoe_surface_secs      res 1   ; Surface interval secs for Apnoe mode
-customfunction_temp1    res 1   ; start of custom function descriptors 
-customfunction_temp2    res 1   ; used in GETCUSTOM8 and GETCUSTOM15
+customfunction_temp1    res 1   ; used in GETCUSTOM8 and GETCUSTOM15
 
 decoplan_page           res 1   ; used in PLED_MultiGF,...
 temp10                  res 2   ; used in customview
@@ -537,7 +536,7 @@
 #DEFINE	neg_flag_isr			flag12,3	;=1: ISR Negative flag (Math)
 #DEFINE	select_bailoutgas		flag12,4	;=1: Select Bailout instead of Setpoint in Gaslist
 #DEFINE	FLAG_apnoe_mode			flag12,5	;=1: Apnoe mode selected
-#DEFINE	customfunction_page		flag12,6	;=1: Use 2nd Page of Custom Functions
+;#DEFINE	unused		flag12,6	;=1: 
 #DEFINE	uart_send_int_eeprom2	flag12,7	;=1: Send internal EEPROM BANK 1
 
 #DEFINE	internal_eeprom_write2	flag13,0	;=1: start routine to access internal EEPROM BANK 1 via the UART
--- a/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm	Fri Apr 20 21:32:03 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm	Sat Apr 21 12:09:37 2012 +0200
@@ -13,10 +13,10 @@
 ;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ; provides routines for external EEPROM via I2C
 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
-; written: 10/30/05
-; last updated: 08/21/06
+; written: 051030
+; last updated: 120421
 ; known bugs:
-; ToDo: use 2nd 32KB from external EEPROM for something
+; ToDo: 
 
 incf_eeprom_address	macro	ext_ee_temp1	; Will increase eeprom_address:2 with the 8Bit value "ext_ee_temp1"
     	movlw	ext_ee_temp1                
@@ -60,13 +60,7 @@
 	movlw		d'0'
 	addwfc		eeprom_address+1,F
 	return
-;	btfss		eeprom_address+1,7		; at address 8000?
-;	return								; no, return
-;
-;	clrf		eeprom_address+0		; Clear eeprom address
-;	clrf		eeprom_address+1
-;	return
-;
+
 write_external_eeprom_block:			; Writes a block of 64Byte (one page in external EEPROM without stop condition
 #ifdef TESTING
 	; When Simulating with MPLabSIM, there is no way to emulate external EEPROM...
@@ -84,12 +78,6 @@
 	addwfc		eeprom_address+1,F
 	return
 
-;	btfss		eeprom_address+1,7	; at address 8000
-;	return						; no, return
-;	
-;	clrf		eeprom_address+0		; Clear eeprom address
-;	clrf		eeprom_address+1
-;	return
 I2CWRITE_BLOCK:
 	movwf		ext_ee_temp1				; Data byte in WREG
 	bsf			SSPCON2,SEN			; Start condition
@@ -240,13 +228,6 @@
 	movlw		d'0'
 	addwfc		eeprom_address+1,F
 	return
-;	btfss		eeprom_address+1,7	; at 0x8000?
-;	return		; no, return
-;	
-;	clrf		eeprom_address+0	; Yes, clear address
-;	clrf		eeprom_address+1
-;	return
-;
 I2CREAD3:						; block read start with automatic address increase 
 	rcall		I2CREAD_COMMON
 	; no Stop condition here
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Fri Apr 20 21:32:03 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Sat Apr 21 12:09:37 2012 +0200
@@ -309,7 +309,6 @@
 		return
 
 sensor_int_state1_plus_restart:
-;;;		bcf			pressure_refresh    ; clear flags
 		clrf		amb_pressure_avg+0  ; pressure average registers
 		clrf		amb_pressure_avg+1
 		clrf		temperature_avg+0
--- a/code_part1/OSTC_code_asm_part1/menu_custom.asm	Fri Apr 20 21:32:03 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_custom.asm	Sat Apr 21 12:09:37 2012 +0200
@@ -17,8 +17,8 @@
 
 ; Menu "Custom Functions", Custom Functions checker (Displays permanent warning if critical custom functions are altered)
 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
-; written: 05/10/30
-; last updated: 2010/12/11
+; written: 051030
+; last updated: 120421
 ; known bugs:
 ; ToDo: 
 
@@ -42,6 +42,16 @@
 ; get values with GETCUSTOM8	.x with x=0...32 for 8 Bit values (stored in WREG)
 ; or with GETCUSTOM15	.x with x=0...32 for 15 Bit values (stored in lo and hi)
 
+;Third Bank of Custom Functions:
+; The custom functions are stored in the internal EEPROM after 0x280
+; any custom function occupies 4 byte:
+; 2 byte (low:high) store the default value, reset from menu "reset"
+; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
+; 2 byte (low:high) store the actual value
+; defaults for custom functions are in menu "reset"
+; get values with GETCUSTOM8	.x with x=0...32 for 8 Bit values (stored in WREG)
+; or with GETCUSTOM15	.x with x=0...32 for 15 Bit values (stored in lo and hi)
+
 ; [jDG] 2010-11-30 More fancy displsy of the various CF types
 ; data types. When we do have a 8bit data (bit16=0), the high byte serves to
 ; define the display format. Also stores min/max bounds into the PROM table.
@@ -68,7 +78,7 @@
 
 ;=============================================================================
 ; Overlay our tmp data in ACCESS0 bank
-    CBLOCK  0x010           ; Keep space for aa_wordprocessor module.
+    CBLOCK tmp                  ; Into safe (from C library) area.
         cf32_x4             ; CF# modulus 32, time 4.
         cf_type             ; Type of the edited CF
         cf_default:2
@@ -76,6 +86,9 @@
         cf_min     
         cf_max     
         cf_step             ; Value ad add/substract: 1, 10, 100
+		cf_page_number		; CF page number (0: 0-31, 1: 32-63)
+		cf_title_text		; # of text for title
+		cf_descriptor_text	; # of descriptor text offset
     ENDC
 
 ;=============================================================================
@@ -87,22 +100,27 @@
 
 getcustom8_1:
 	; # number of requested custom function in wreg
-	movwf	customfunction_temp2
-	
+	movwf	customfunction_temp1
+
+	clrf	EEADRH	
 	movlw	d'31'
-	cpfsgt	customfunction_temp2
-	bra		getcustom8_2			; Lower bank
-	
-	movlw	d'1'					; Upper Bank
-	movwf	EEADRH
+	cpfsgt	customfunction_temp1
+	bra		getcustom8_3			; bank 0
+
+	movlw	d'1'
+	movwf	EEADRH					; bank 1
 	movlw	d'32'
-	subwf	customfunction_temp2,F
-	bra		getcustom8_3
+	subwf	customfunction_temp1,F
+	movlw	d'63'
+	cpfsgt	customfunction_temp1
+	bra		getcustom8_3			; bank 1
 
-getcustom8_2:
-	clrf	EEADRH
+	movlw	d'2'
+	movwf	EEADRH					; bank 2
+	movlw	d'64'
+	subwf	customfunction_temp1,F
 getcustom8_3:
-	movf	customfunction_temp2,W
+	movf	customfunction_temp1,W
 	mullw	d'4'
 	movf	PRODL,W			; x4 for adress
 	addlw	d'130'
@@ -120,21 +138,27 @@
     global  getcustom15
 getcustom15:
 	; # number of requested custom function in wreg
-	movwf	customfunction_temp2
-	
-	movlw	d'31'
-	cpfsgt	customfunction_temp2
-	bra		getcustom15_2			; Lower bank
+	movwf	customfunction_temp1
 	
-	movlw	d'1'					; Upper Bank
-	movwf	EEADRH
+	clrf	EEADRH	
+	movlw	d'31'
+	cpfsgt	customfunction_temp1
+	bra		getcustom15_3			; bank 0
+
+	movlw	d'1'
+	movwf	EEADRH					; bank 1
 	movlw	d'32'
-	subwf	customfunction_temp2,F
-	bra		getcustom15_3
-getcustom15_2:
-	clrf	EEADRH
+	subwf	customfunction_temp1,F
+	movlw	d'63'
+	cpfsgt	customfunction_temp1
+	bra		getcustom15_3			; bank 1
+
+	movlw	d'2'
+	movwf	EEADRH					; bank 2
+	movlw	d'64'
+	subwf	customfunction_temp1,F
 getcustom15_3:
-	movf	customfunction_temp2,W
+	movf	customfunction_temp1,W
 	mullw	d'4'
 	movf	PRODL,W			; x4 for adress
 	addlw	d'130'
@@ -148,15 +172,22 @@
 	return					; return
 
 menu_custom_functions_page2:
-	movlw	d'154'			; start of custom function descriptors		
-	movwf	customfunction_temp1
-	bsf		customfunction_page	; Use Page II...
+	movlw	.1
+	movff	WREG,cf_page_number		; CF page number (0: 0-31, 1: 32-63)
+	movlw	.186
+	movff	WREG,cf_title_text		; # of text for title
+	movlw	.154
+	movff	WREG,cf_descriptor_text	; # of descriptor text offset
 	bra		menu_custom_functions0
 
 menu_custom_functions:
-	movlw	d'36'			; start of custom function descriptors		
-	movwf	customfunction_temp1
-	bcf		customfunction_page	; Use Page I...
+	movlw	.36
+	movff	WREG,cf_descriptor_text	; # of descriptor text offset
+	movlw	.27
+	movff	WREG,cf_title_text		; # of text for title
+	movlw	.0
+	movff	WREG,cf_page_number		; CF page number (0: 0-31, 1: 32-63)
+
 	
 menu_custom_functions0:
 	bsf		leftbind
@@ -175,25 +206,14 @@
 
 	call	PLED_topline_box
 	WIN_INVERT	.1	; Init new Wordprocessor	
-
-	btfss	customfunction_page		;
-	bra		menu_custom_functions10
-	DISPLAYTEXT	.186				; Custom FunctionsII
-	bra		menu_custom_functions11
-	
-menu_custom_functions10:
-	DISPLAYTEXT	.27					; Custom FunctionsI
-	
-menu_custom_functions11:
+	movff	cf_title_text,WREG		; Title text in low bank
+	call	displaytext_1_low
 	WIN_INVERT	.0	; Init new Wordprocessor	
 
 menu_custom_functions1:
 	call	PLED_standard_color         ; Trash EEADRH...
 
-	movlw	d'1'                        ; So restore it !
-	btfss	customfunction_page	        ; Use Page II ?
-	movlw	d'0'                        ; NO: this is page 1.
-	movwf	EEADRH
+	movff	cf_page_number,EEADRH		; CF page number (0: 0-31, 1: 32-63)
 
 	clrf	timeout_counter2
 	bcf		menubit2
@@ -203,15 +223,14 @@
 	lfsr	FSR2,letter
 	movff	decodata+0,lo               ; decodata == CF number % 32
 
-	movlw	d'0'
-	btfsc	customfunction_page			; Add offset for display in CF menu II
-	movlw	d'32'
-	addwf	lo,F
+	movff	cf_page_number,WREG			; CF page number (0: 0-31, 1: 32-63)
+	mullw	.32							; CF page number * 32 -> PRODL:PRODH
+	movf	PRODL,W
+	addwf	lo,F						; Add offset for display in CF menu
 
 	output_99x
 	STRCAT_PRINT ": "
-
-	movf	customfunction_temp1,W		; start of custom function descriptors		
+	movff	cf_descriptor_text,WREG		; start of custom function descriptors		
 	addwf	decodata+0,W				; add # of current custom function, place result in wreg
 	call	displaytext_1_low           ; shows descriptor
 
@@ -345,7 +364,7 @@
 ;-----------------------------------------------------------------------------
 ; Read default value, type, and constraints
 ;
-; Input: customfunction_page, cf32_x4
+; Input: cf32_x4
 ; Output: cf_default, cf_type, cf_min, cf_max.
 ; Trashes: TBLPTR
 
@@ -357,12 +376,13 @@
     movlw   UPPER(cf_default_table0)
     movwf   TBLPTRU
 
-    movlw   0
-	btfsc	customfunction_page	        ; Page II CF# ?
-	movlw   0x80                        ; YES: add 128 to ptr.
+	movff	cf_page_number,WREG			; CF page number (0: 0-31, 1: 32-63)
+	mullw	0x80						; CF page number * 0x80 -> PRODL:PRODH
+
+	movf	PRODL,W
 	addwf   cf32_x4,W                   ; Add 4 x (CF index modulus 32)
     addwf   TBLPTRL,F                   ; And to a 8+16 add into TBLPTR
-    movlw   0                           ; (keep carry)
+	movf	PRODH,W
     addwfc  TBLPTRH,F                   ; Propagate to 16bit (but not 24bits).
 
     tblrd*+
@@ -649,10 +669,7 @@
 ;-----------------------------------------------------------------------------
 
 do_customfunction:
-	CLRF	EEADRH					
-	movlw	d'1'
-	btfsc	customfunction_page
-	movwf	EEADRH					; Reset EEADRH correct (Was adjusted in check_timeout...)
+	movff	cf_page_number,EEADRH		; CF page number (0: 0-31, 1: 32-63)
 
 	dcfsnz	menupos,F
 	bra		next_customfunction
@@ -668,10 +685,8 @@
 ;-----------------------------------------------------------------------------
 
 exit_customfunctions:
-	movlw	d'2'					; Return to correct list entry
-	btfss	customfunction_page
-	movlw	d'1'
-	movwf	menupos					; 
+	movff	cf_page_number,menupos	; CF page number (0: 0-31, 1: 32-63)
+	incf	menupos,F
 	clrf	EEADRH					; Clear EEADRH !
 	goto	setup_menu2				; exit...
 
@@ -822,17 +837,34 @@
 ;       they are all ok.
 
 check_customfunctions:
-    ; Did we finished the two sweeps ?
-    btfsc   cf_checker_counter,7        ; Already at position 128 ?
-    return                              ; YES: just do nothing.
+	movlw	max_custom_number+1			; Defined in definitions.asm
+	cpfseq	cf_checker_counter			; All tested?
+	bra		check_customfunctions1		; No, continue
+	clrf	cf_checker_counter			; clear counter
+	return								; YES: just do nothing.
 
-    ; Setup cf32_x4 and cf page bit:
+check_customfunctions1:
+	; Setup cf_page_number
+	movlw	.0
+	movff	WREG,cf_page_number
+	movlw	d'31'
+	cpfsgt	cf_checker_counter
+	bra		check_customfunctions2	; CF I
+
+	movlw	.1
+	movff	WREG,cf_page_number
+	movlw	d'63'
+	cpfsgt	cf_checker_counter
+	bra		check_customfunctions2	; CF II
+
+	movlw	.2
+	movff	WREG,cf_page_number		; CF III
+	
+check_customfunctions2:
+    ; Setup cf32_x4
     movf    cf_checker_counter,W
     rlcf    WREG                        ; x4
     rlcf    WREG
-    bcf     customfunction_page
-    btfsc   WREG,7   
-    bsf     customfunction_page         ; Setup CF page bit.
     andlw   4*.31
     movwf   cf32_x4
     
@@ -842,7 +874,7 @@
     bz      check_failed                ; 0 == FAILED.
     
     ; Passed: Simple loop until 128 is reached:
-    incf    cf_checker_counter          ; Next CF to check.
+    incf    cf_checker_counter,F        ; Next CF to check.
     bra     check_customfunctions       ; And loop until 128 reached (ie twice)
     
 check_failed:
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Fri Apr 20 21:32:03 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sat Apr 21 12:09:37 2012 +0200
@@ -108,65 +108,65 @@
 cf_default_table0:
     ;---- BANK0 custom function defaults -------------------------------------
     ;                          DEFAULT   MIN     MAX
-	CF_DEFAULT    CF_CENTI,	    d'100', d'50',  d'250'  ; dive_threshold	        100cm
-	CF_DEFAULT    CF_CENTI,	    d'30',  d'10',  d'100'  ; surf_threshold        	30cm
-	CF_DEFAULT    CF_INT15,	    d'240', d'0',   d'600'  ; diveloop_timeout      	240s
-	CF_DEFAULT    CF_SEC,	    d'120', d'30',  d'240'  ; surfloop_timeout	        120s
-	CF_DEFAULT    CF_SEC,	    d'5',   d'1',   d'30'   ; premenu_timeout	        5s
+	CF_DEFAULT    CF_CENTI,	    d'100', d'50',  d'250'  ; CF00 dive_threshold	        100cm
+	CF_DEFAULT    CF_CENTI,	    d'30',  d'10',  d'100'  ; CF01 surf_threshold        	30cm
+	CF_DEFAULT    CF_INT15,	    d'240', d'0',   d'600'  ; CF02 diveloop_timeout      	240s
+	CF_DEFAULT    CF_SEC,	    d'120', d'30',  d'240'  ; CF03 surfloop_timeout	        120s
+	CF_DEFAULT    CF_SEC,	    d'5',   d'1',   d'30'   ; CF04 premenu_timeout	        5s
 
-	CF_DEFAULT    CF_INT8, 	    d'7',   d'3',   d'18'   ; minimum_velocity		    7min/min
+	CF_DEFAULT    CF_INT8, 	    d'7',   d'3',   d'18'   ; CF05 minimum_velocity		    7min/min
 	CF_DEFAULT    CF_INT15,	    d'1160',d'950', 0    	; pressure_offset_divemode	1160mbar
 	CF_DEFAULT    CF_INT15,	    d'1080',d'1080', 0   	; max_surfpressure		    1080mbar
 	CF_DEFAULT    CF_PERCENT,	d'20',  d'1',  d'99'   	; min_gradient_factor		20%
 	CF_DEFAULT    CF_PERCENT,	d'20',  d'1',  d'22'	; oxygen_threshold			22%
 
-	CF_DEFAULT    CF_SEC,	    d'45',  d'5',   d'60'   ; dive_menu_timeout		    45s
+	CF_DEFAULT    CF_SEC,	    d'45',  d'5',   d'60'   ; CF10 dive_menu_timeout		    45s
 	CF_DEFAULT    CF_PERCENT,   d'110', d'110', d'200' 	; saturation_multiplier		x1.10
 	CF_DEFAULT    CF_PERCENT,   d'90',  d'50',  d'90'   ; desaturation_multiplier	x0.90
 	CF_DEFAULT    CF_PERCENT,	d'60',  d'60',  d'100'	; nofly_time_ratio			60%
 	CF_DEFAULT    CF_PERCENT,	d'100', d'50',  d'100'  ; gradient_factor_alarm1	100%
 
-	CF_DEFAULT    CF_PERCENT,	d'10',  d'0',  	d'100'  ; cns_display_surface		10%
+	CF_DEFAULT    CF_PERCENT,	d'10',  d'0',  	d'100'  ; CF15 cns_display_surface		10%
 	CF_DEFAULT    CF_DECI,	    d'10',  d'0',  	d'10'	; deco_distance_for_sim		1m
 	CF_DEFAULT    CF_CENTI,     d'019', d'19', 	d'021'	; ppo2_warning_low			0.19 bar
 	CF_DEFAULT    CF_CENTI,     d'160', d'0', 	d'160'  ; ppo2_warning_high			1.60 bar
 	CF_DEFAULT    CF_CENTI,     d'140', d'0', 	d'150'	; ppo2_display_high			1.40 bar
     
-	CF_DEFAULT    CF_INT8,	    d'10',  d'1',   d'120'  ; sampling_rate				10s
+	CF_DEFAULT    CF_INT8,	    d'10',  d'1',   d'120'  ; CF20 sampling_rate				10s
 	CF_DEFAULT    CF_INT8,	    d'6',   d'0',   d'15'   ; sampling_divisor_temp		/6
 	CF_DEFAULT    CF_INT8,	    d'6',   d'0',   d'15'   ; sampling_divisor_deco		/6
 	CF_DEFAULT    CF_INT8,	    d'6',   d'0',   d'15'   ; sampling_divisor_gf		/6
 	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; sampling_divisor_ppo2		never
 
-	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; sampling_divisor_deco2	never
+	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; CF25 sampling_divisor_deco2	never
 	CF_DEFAULT    CF_INT8,	    d'12',  d'0',   d'15'   ; sampling_divisor_cns		/12
 	CF_DEFAULT    CF_PERCENT,	d'20',  d'5',   d'75'   ; cns_display_high			20%
 	CF_DEFAULT    CF_INT15,	    d'0',   d'0',   0 		; logbook_offset			No Offset, but 15Bit value
 	CF_DEFAULT    CF_INT8,	    d'3',   d'2',   d'6'	; last_deco_depth			3m
 
-	CF_DEFAULT    CF_SEC,	    d'10',  d'1',   d'15'   ; timeout_apnoe_mode		10min
-	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; show_voltage_value		=1 Show value instead of symbol, =0 Show Symbol
+	CF_DEFAULT    CF_SEC,	    d'10',  d'1',   d'15'   ; CF30 timeout_apnoe_mode		10min
+	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; CF31 show_voltage_value		=1 Show value instead of symbol, =0 Show Symbol
 
     ;---- BANK1 custom function defaults -------------------------------------
 cf_default_table1:
     ;                          DEFAULT   MIN     MAX
-	CF_DEFAULT    CF_PERCENT,   d'30',  d'5',  	d'90'   ; GF_low_default			30%
-	CF_DEFAULT    CF_PERCENT,   d'90', 	d'30',  d'95'   ; GF_high_default			90%
-	CF_DEFAULT    CF_COLOR,     d'199', 0,      0 		; color_battery_surface		Color Battery sign: Deep blue
-	CF_DEFAULT    CF_COLOR,     d'255', 0,      0 		; color_standard1			Color Standard: White
-	CF_DEFAULT    CF_COLOR,     d'62',  0,      0 		; color_divemask			Color Divemask: Light green
+	CF_DEFAULT    CF_PERCENT,   d'30',  d'5',  	d'90'   ; CF32 GF_low_default			30%
+	CF_DEFAULT    CF_PERCENT,   d'90', 	d'30',  d'95'   ; CF33 GF_high_default			90%
+	CF_DEFAULT    CF_COLOR,     d'199', 0,      0 		; CF34 color_battery_surface	Color Battery sign: Deep blue
+	CF_DEFAULT    CF_COLOR,     d'255', 0,      0 		; CF35 color_standard1			Color Standard: White
+	CF_DEFAULT    CF_COLOR,     d'62',  0,      0 		; CF36 color_divemask			Color Divemask: Light green
     
 	CF_DEFAULT    CF_COLOR,     d'224', 0,      0 		; CF37 color_warnings			Color Warnings: Red
-	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; show_seconds_divemode		=1 Show the seconds in Divemode
-	CF_DEFAULT    CF_BOOL,     	0,      0,      0 		; Adjust SetPoint if Diluent ppO2 > SetPoint
-	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; warn_ceiling_divemode		=1 Warn ceiling violation in divemode
-	CF_DEFAULT    CF_BOOL,      d'1',   0,      0 		; Show mix type is surfmode
+	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; CF38 show_seconds_divemode		=1 Show the seconds in Divemode
+	CF_DEFAULT    CF_BOOL,     	0,      0,      0 		; CF39 Adjust SetPoint if Diluent ppO2 > SetPoint
+	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; CF40 warn_ceiling_divemode		=1 Warn ceiling violation in divemode
+	CF_DEFAULT    CF_BOOL,      d'1',   0,      0 		; CF41 Show mix type is surfmode
 
-	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; blink_gas_divemode 		=1 blink better gas
-	CF_DEFAULT    CF_INT15,     d'13000', 0,   d'13000' ; color_warn_depth_mbar		Warn depths
-	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'	; color_warn_cns_percent    Warn-%
-	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'  ; color_warn_gf_percent		Warn-%
-	CF_DEFAULT    CF_CENTI,     d'161', d'100', d'161'  ; color_warn_ppo2_cbar		ppO2 warn
+	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; CF42 blink_gas_divemode 		=1 blink better gas
+	CF_DEFAULT    CF_INT15,     d'13000', 0,   d'13000' ; CF43 color_warn_depth_mbar		Warn depths
+	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'	; CF44 color_warn_cns_percent    Warn-%
+	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'  ; CF45 color_warn_gf_percent		Warn-%
+	CF_DEFAULT    CF_CENTI,     d'161', d'100', d'161'  ; CF46 color_warn_ppo2_cbar		ppO2 warn
 
 	CF_DEFAULT    CF_INT8,	    d'15',  d'7',   d'20'	; CF47 color_warn_celocity_mmin	warn at xx m/min
 	CF_DEFAULT    CF_SEC+CF_NEG,d'0',  -d'120' ,d'120'  ; CF48 time_correction_value_default	Adds to Seconds on Midnight
@@ -188,9 +188,45 @@
 	                
 	CF_DEFAULT    CF_PERCENT,   .4,     .0,     .100	; CF62 pSCR O2 Drop
 	CF_DEFAULT    CF_INT8,      .10,    .0,     .100 	; CF63 pSCR counterlung ratio
-;	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
 cf_default_table2:
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF64 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF65 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF66 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF67 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF68 unused
 
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF69 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF70 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF71 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF72 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF73 unused
+
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF74 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF75 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF76 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF77 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF78 unused
+
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF79 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF80 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF81 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF82 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF83 unused
+
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF84 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF85 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF87 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF88 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF89 unused
+
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF90 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF91 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF92 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF93 unused
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF94 unused
+	
+	CF_DEFAULT    CF_INT8,      d'0',   d'0',   d'0'    ; GF95 unused	
+cf_default_table3:
 ;=============================================================================
 
 menu_reset:
@@ -395,13 +431,12 @@
 	movf    TBLPTRL,W
 	sublw   LOW (cf_default_table1)
 	bz      reset_all_cf_bank1
-
 	rcall	reset_customfunction	; saves default and current value
 	bra     cf_bank0_loop
 	
 reset_all_cf_bank1:
 	movlw	d'1'
-	movwf	EEADRH					; EEPROM BANK 1 !!
+	movwf	EEADRH					; EEPROM BANK 1
 	movlw	d'127'					; address of low byte of first custom function
 	movwf	EEADR
 	
@@ -409,19 +444,32 @@
 	; Did we already read another 32 (decimal) words or double-words ?
 	movf    TBLPTRL,W
 	sublw   LOW (cf_default_table2)
-	bz      cf_bank1_end
-
+	bz      reset_all_cf_bank2
 	rcall	reset_customfunction	; saves default and current value
 	bra     cf_bank1_loop
 
-cf_bank1_end:
-	clrf	EEADRH					; EEPROM BANK 0 !
+reset_all_cf_bank2:
+	movlw	d'2'
+	movwf	EEADRH					; EEPROM BANK 2
+	movlw	d'127'					; address of low byte of first custom function
+	movwf	EEADR
+	
+cf_bank2_loop:
+	; Did we already read another 32 (decimal) words or double-words ?
+	movf    TBLPTRL,W
+	sublw   LOW (cf_default_table3)
+	bz      cf_bank2_end
+	rcall	reset_customfunction	; saves default and current value
+	bra     cf_bank2_loop
+
+cf_bank2_end:
+	clrf	EEADRH					; EEPROM BANK 0
 
 ;call	reset_external_eeprom	; delete profile memory
     return
 
 reset_gases:
-	clrf	EEADRH					; EEPROM BANK 0 !
+	clrf	EEADRH					; EEPROM BANK 0
 
 	movlw	d'3'					; address of first gas-1
 	movwf	EEADR
--- a/code_part1/OSTC_code_c_part2/changes_log.txt	Fri Apr 20 21:32:03 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-changes for v.101_C last deco:
-
-text_table_v111.asm : line 249
-	DA	"Last Deco   [m]}"		;65 (entspricht CF29)
-
-menu_reset_v111.asm : 
-line 153
-#DEFINE	last_deco_depth				d'3'		; 8Bit		3m
-line 253f
-	movlw	LOW		last_deco_depth				
-
-divemode_v111.asm
-line 421ff
-	GETCUSTOM8	d'29'				; Depth Last Deco in meter for simulation
-	movwf	wait_temp
-	movff	wait_temp,char_I_depth_last_deco
-
-definitions_v111.asm
-line 302
- char_I_depth_last_deco;			; 0x51E	new in v.101