diff src/menu_tree.asm @ 560:b7eb98dbd800

bump to 2.96beta (REFACTORED VERSION)
author heinrichsweikamp
date Wed, 31 Jan 2018 19:39:37 +0100
parents 7e6df19264b6
children 8b7ea27ea1fa
line wrap: on
line diff
--- a/src/menu_tree.asm	Wed Dec 27 14:34:11 2017 +0100
+++ b/src/menu_tree.asm	Wed Jan 31 19:39:37 2018 +0100
@@ -1,6 +1,6 @@
 ;=============================================================================
 ;
-;   File menu_tree.asm
+;   File menu_tree.asm								REFACTORED VERSION V2.95
 ;
 ;   OSTC menus
 ;
@@ -9,7 +9,7 @@
 ; HISTORY
 ;   2011-07-11 : [jDG] Creation.
 
-#include    "hwos.inc"                  ; Mandatory header
+#include    "hwos.inc"					; Mandatory header
 #include    "gaslist.inc"
 #include    "menu_processor.inc"
 #include    "start.inc"
@@ -18,18 +18,18 @@
 #include    "tft.inc"
 #include    "eeprom_rs232.inc"
 #include    "external_flash.inc"
-#include    "shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include    "shared_definitions.h"		; Mailbox from/to p2_deco.c
 #include    "isr.inc"
 #include    "ghostwriter.inc"
 #include    "adc_lightsensor.inc"
 #include    "wait.inc"
 #include    "i2c.inc"
 
-        CBLOCK  tmp+0x40                ; Keep space for menu processor
-            gaslist_gas ; Check ram position in gaslist.asm, too!
-        ENDC
+	CBLOCK  tmp+0x40					; Keep space for menu processor
+		gaslist_gas						; Check ram position in gaslist.asm, too!
+	ENDC
 
-gui     CODE
+gui		CODE
 ;=============================================================================
 ; Main Menu
         global  do_main_menu,do_main_menu2
@@ -58,9 +58,9 @@
 	MENU_BEGIN  tInfoMenu, .6
 	    MENU_DYNAMIC    info_menu_serial,       0
 	    MENU_DYNAMIC    info_menu_firmware,     0
-	    MENU_DYNAMIC    info_menu_total_dives,  0
-        MENU_DYNAMIC    info_menu_battery_volts,0
-	MENU_DYNAMIC    info_menu_uptime,0
+	    MENU_DYNAMIC    info_menu_battery_volts,0
+		MENU_DYNAMIC    info_menu_uptime,		0
+		MENU_DYNAMIC    info_menu_total_dives,  0
         MENU_CALL       tExit,                  do_return_settings
     MENU_END
 
@@ -71,47 +71,50 @@
     	rcall	menu_tree_double_pop	; drop exit line and back to last line
 
 do_ccr_menu:
-    bcf     menu_show_sensors           ; Clear flag
     bcf     menu_show_sensors2          ; Clear flag
     btfsc   analog_o2_input
     bra     do_ccr_menu_cR
-    btfss   optical_input
-    bra     do_ccr_menu_ostc2
+
+	; COMMENT OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu
+	; btfss   optical_input
+    ; bra     do_ccr_menu_ostc2
 
-    MENU_BEGIN  tCCRSetup, .6          ; OSTC3 menu
-        MENU_OPTION     tCCRMode,    oCCRMode,    0
-        MENU_CALL       tCCRSensor,             do_ccr_sensor
-        MENU_CALL       tDiluentSetup,          do_diluent_setup
-        MENU_CALL       tFixedSetpoints,        do_fixed_setpoints
-	MENU_CALL	tPSCRMenu,		do_PSCR_menu
-        MENU_CALL       tExit,                  do_continue_main_menu
+    MENU_BEGIN  tCCRSetup, .6          ; OSTC3 menu (and currently also the OSTC2 menu)
+        MENU_OPTION     tCCRMode,				oCCRMode,		0
+        MENU_CALL       tDiluentSetup,			do_diluent_setup
+        MENU_CALL       tFixedSetpoints,		do_fixed_setpoints
+		MENU_CALL		tPSCRMenu,				do_PSCR_menu
+		MENU_OPTION     tCCmaxFracO2,			oCCmaxFracO2,	0		
+        MENU_CALL       tExit,					do_continue_main_menu
     MENU_END
 
 do_ccr_menu_cR:                         ; cR menu
     MENU_BEGIN  tCCRSetup, .7
-        MENU_OPTION     tCCRMode,    oCCRMode,    0
-        MENU_CALL       tCCRSensor,             do_ccr_sensor
-        MENU_CALL       tCalibrateMenu,         do_calibrate_menu
-        MENU_CALL       tDiluentSetup,          do_diluent_setup
-        MENU_CALL       tFixedSetpoints,        do_fixed_setpoints
-	MENU_CALL	tPSCRMenu,		do_PSCR_menu
-        MENU_CALL       tExit,                  do_continue_main_menu
+        MENU_OPTION     tCCRMode,				oCCRMode,		0
+        MENU_CALL       tCalibrateMenu,			do_calibrate_menu
+        MENU_CALL       tDiluentSetup,			do_diluent_setup
+        MENU_CALL       tFixedSetpoints,		do_fixed_setpoints
+		MENU_CALL		tPSCRMenu,				do_PSCR_menu
+		MENU_OPTION     tCCmaxFracO2,			oCCmaxFracO2,	0
+        MENU_CALL       tExit,					do_continue_main_menu
     MENU_END
 
-do_ccr_menu_ostc2:
-    MENU_BEGIN  tCCRSetup, .5           ; ostc2 menu
-        MENU_OPTION     tCCRMode,    oCCRMode,    0
-        MENU_CALL       tDiluentSetup,          do_diluent_setup
-        MENU_CALL       tFixedSetpoints,        do_fixed_setpoints
-	MENU_CALL	tPSCRMenu,		do_PSCR_menu
-        MENU_CALL       tExit,                  do_continue_main_menu
-    MENU_END
+; COMMENT OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu
+;do_ccr_menu_ostc2:
+;    MENU_BEGIN  tCCRSetup, .6           ; ostc2 menu
+;        MENU_OPTION     tCCRMode,				oCCRMode,		0
+;        MENU_CALL       tDiluentSetup,			do_diluent_setup
+;        MENU_CALL       tFixedSetpoints,		do_fixed_setpoints
+;        MENU_CALL       tPSCRMenu,				do_PSCR_menu
+;        MENU_OPTION     tCCmaxFracO2,			oCCmaxFracO2,	0
+;        MENU_CALL       tExit,					do_continue_main_menu
+;    MENU_END
 
 do_PSCR_menu:
-    MENU_BEGIN  tPSCRMenu, .3	; PSCR Menu
-	MENU_OPTION     tPSCR_O2_drop,	oPSCR_drop,	    0
-	MENU_OPTION     tPSCR_lungratio,oPSCR_lungratio,    0
-	MENU_CALL       tExit,          return_ccr_menu
+    MENU_BEGIN  tPSCRMenu, .3			; PSCR Menu
+		MENU_OPTION     tPSCR_O2_drop,			oPSCR_drop,			0
+		MENU_OPTION     tPSCR_lungratio,		oPSCR_lungratio,	0
+		MENU_CALL       tExit,					return_ccr_menu
     MENU_END
 
 do_calibrate_menu:
@@ -119,12 +122,12 @@
     bsf     menu_show_sensors2          ; Set flag
 do_calibrate_menu2:
 	MENU_BEGIN  tCalibrateMenu, .6
-	    MENU_CALL       tDiveHudMask1,       0
-        MENU_CALL       tDiveHudMask2,       0
-        MENU_CALL       tDiveHudMask3,       0
-        MENU_OPTION     tCalibrationGas,oCalGasO2,  0
-        MENU_CALL       tCalibrate,                 do_calibrate_mix
-        MENU_CALL       tExit,                      return_ccr_menu
+	    MENU_CALL       tDiveHudMask1,				0
+        MENU_CALL       tDiveHudMask2,				0
+        MENU_CALL       tDiveHudMask3,				0
+        MENU_OPTION     tCalibrationGas,oCalGasO2,	0
+        MENU_CALL       tCalibrate,				do_calibrate_mix
+        MENU_CALL       tExit,					return_ccr_menu
     MENU_END
 
 do_calibrate_mix:
@@ -132,19 +135,9 @@
     call    calibrate_mix               ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected
     WAITMS  d'250'                      ; Wait for HUD v3
     movlw   .9 
-    movwf   customview_surfmode		; show sensor mV custom view after restart
+    movwf   customview_surfmode			; show sensor mV custom view after restart
     goto    restart                     ; Restart into surface mode
 
-do_ccr_sensor:
-    call    enable_ir_s8                ; Enable IR/S8-Port
-    bsf     menu_show_sensors           ; Set flag
-	MENU_BEGIN  tCCRSensor, .5
-	    MENU_CALL       tDiveHudMask1,       0
-        MENU_CALL       tDiveHudMask2,       0
-        MENU_CALL       tDiveHudMask3,       0
-        MENU_OPTION     tSensorFallback,oSensorFallback,  0
-        MENU_CALL       tExit,               return_ccr_menu
-    MENU_END
 
 do_diluent_setup:
        bsf     ccr_diluent_setup       ; =1: Setting up Diluents ("Gas6-10")
@@ -164,7 +157,7 @@
 
 do_fixed_setpoints:
         bcf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
-     MENU_BEGIN  tFixedSetpoints, .6
+	MENU_BEGIN  tFixedSetpoints, .6
         MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
         MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
         MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
@@ -211,7 +204,7 @@
 do_edit_gas_menu:
     call    gaslist_setgas              ; Save current item.
 do_edit_gas_menu_1:                     ; Keep current gas.
-    MENU_BEGIN          tGasEdit, .6
+	MENU_BEGIN          tGasEdit, .6
         MENU_DYNAMIC    gaslist_gastitle,       0
         MENU_DYNAMIC    gaslist_MOD_END,        0
         MENU_DYNAMIC    gaslist_show_type,      gaslist_toggle_type
@@ -235,7 +228,7 @@
         call    menu_processor_pop      ; drop exit line.
         goto	menu_processor_pop      ; back to last gas and return
 
-    
+
     global  do_gas_depth_menu
 do_gas_depth_menu:
     movff   gaslist_gas,WREG
@@ -257,6 +250,7 @@
         MENU_CALL       tExit,                  return_gas_depth
     MENU_END
 
+	
 ;=============================================================================
 ; Simulator menus
 
@@ -278,20 +272,21 @@
 do_planner_menu:
     extern  do_demo_planner
     MENU_BEGIN  tPlan, .7
+        MENU_OPTION     tIntvl, odiveInterval,  0
+        MENU_OPTION     tBtDep, obottomDepth,   0
 		MENU_CALL       tInter,                 do_demo_divemode
-        MENU_OPTION     tIntvl, odiveInterval,  0
         MENU_OPTION     tBtTm,  obottomTime,    0
-        MENU_OPTION     tMxDep, obottomDepth,   0
+        MENU_CALL       tDecoSetup,             do_planner_config
         MENU_CALL       tDeco,                  do_demo_planner
-        MENU_CALL       tSystSets,              do_planner_config
         MENU_CALL       tExit,                  do_continue_main_menu
     MENU_END
 
+
 do_planner_config:
     MENU_BEGIN  tPlan, .3
-        MENU_OPTION     tSetBotUse, obottom_usage,  0
-        MENU_OPTION     tSetDecoUse,  odeco_usage,  0
-        MENU_CALL       tExit,                      do_planner_menu
+		MENU_OPTION		tSelectSetpoint,oSimSetpoint,	0
+		MENU_OPTION		tuseAGF, 		oSimAGF,		0
+        MENU_CALL       tExit,							do_planner_menu
     MENU_END
 
 
@@ -306,17 +301,19 @@
         MENU_OPTION  tDvMode,    oDiveMode,     0
         MENU_OPTION  tDkMode,    oDecoMode,     0
         MENU_CALL    tppO2settings,          	do_ppo2_menu
-        MENU_OPTION  tsafetystopmenu,oSafetyStop,    0
-        MENU_OPTION  tFTTSMenu,                 oExtraTime,0
+        MENU_OPTION	 tsafetystopmenu,oSafetyStop,    0
+		MENU_CALL    t2ndDecoPlanMenu,			do_2nd_deco_plan_menu
         MENU_CALL    tDecoparameters,          	do_decoparameters_menu
         MENU_CALL    tExit,                  	do_continue_main_menu
     MENU_END
 
 do_ppo2_menu:
-    MENU_BEGIN  tppO2settings, .5
-	MENU_DYNAMIC divesets_ppo2_max,         do_toggle_ppo2_max
-	MENU_DYNAMIC divesets_ppo2_max_deco,    do_toggle_ppo2_max_deco
-	MENU_DYNAMIC divesets_ppo2_min,         do_toggle_ppo2_min
+	MENU_BEGIN  tppO2settings, .6
+	
+		MENU_DYNAMIC divesets_ppo2_max,         do_toggle_ppo2_max
+		MENU_DYNAMIC divesets_ppo2_max_deco,    do_toggle_ppo2_max_deco
+		MENU_DYNAMIC divesets_ppo2_min,         do_toggle_ppo2_min
+		MENU_DYNAMIC divesets_ppo2_min_cc,      do_toggle_ppo2_min_cc
         MENU_OPTION  tShowppO2, oShowppO2,      0
         MENU_CALL    tExit,                  	do_return_divemode_menu
     MENU_END
@@ -334,6 +331,47 @@
         MENU_CALL    tExit,                  	do_return_divemode_menu
     MENU_END
 
+
+do_return_2nd_deco_plan_menu:
+    	rcall	menu_tree_double_pop	; drop exit line and back to last line
+
+
+do_2nd_deco_plan_menu
+    MENU_BEGIN  t2ndDecoPlanMenu, .7
+        MENU_OPTION  tFTTSMenu,		oExtraTime,		0
+		MENU_OPTION  tCalcAscGas,	oCalcAscGas,	0
+        MENU_OPTION  tSetBotUse,	obottom_usage,	0
+        MENU_OPTION  tSetDecoUse,	odeco_usage,	0
+		MENU_CALL	 tTankSizes,				do_tank_sizes_menu
+		MENU_CALL	 tTankFillPress,			do_tank_fill_press_menu
+		MENU_CALL    tExit,                  	do_return_divemode_menu
+    MENU_END
+
+	
+
+do_tank_sizes_menu:
+    MENU_BEGIN  tTankSizes, .6
+        MENU_OPTION  tGas1,	oTankSize1,			0
+        MENU_OPTION  tGas2,	oTankSize2,			0
+        MENU_OPTION  tGas3,	oTankSize3,			0
+        MENU_OPTION  tGas4,	oTankSize4,			0
+        MENU_OPTION  tGas5,	oTankSize5,			0
+        MENU_CALL    tExit,                  	do_return_2nd_deco_plan_menu
+    MENU_END
+
+	
+
+do_tank_fill_press_menu:
+    MENU_BEGIN  tTankFillPress, .6
+        MENU_OPTION  tGas1,	oTankFillPres1,		0
+        MENU_OPTION  tGas2,	oTankFillPres2,		0
+        MENU_OPTION  tGas3,	oTankFillPres3,		0
+        MENU_OPTION  tGas4,	oTankFillPres4,		0
+        MENU_OPTION  tGas5,	oTankFillPres5,		0
+        MENU_CALL    tExit,                  	do_return_2nd_deco_plan_menu
+    MENU_END
+
+	
 do_aGF_menu:
     MENU_BEGIN  taGFMenu, .4
         MENU_OPTION  taGF_enable,oEnable_aGF,    0
@@ -341,14 +379,16 @@
         MENU_OPTION  taGF_high,  oaGF_high,      0
         MENU_CALL    tExit,                  	do_return_decoparameters_menu
     MENU_END
+
+
 ;=============================================================================
 ; Setup Menu
 
 do_return_settings:
-		bcf		settime_setdate					; Clear flag
+	bcf		settime_setdate			; Clear flag
 	rcall	menu_tree_double_pop	; drop exit line and back to last line
         
-        extern  compass_calibration_loop
+	extern  compass_calibration_loop
 do_settings_menu:
     btfsc   ble_available           ; ble available
     bra     do_settings_menu_ble    ; Yes.
@@ -356,18 +396,18 @@
         MENU_CALL   tInfoMenu,      do_info_menu
         MENU_CALL   tSetTimeDate,   do_date_time_menu
         MENU_CALL   tDispSets,      do_dispsets_menu
-        MENU_OPTION tLanguage,      oLanguage,       0
+	MENU_OPTION tAltMode,	    oAltMode,	    0		
         MENU_CALL   tMore,          do_settings_menu_more
         MENU_CALL   tExit,          do_continue_main_menu
     MENU_END
 
 do_settings_menu_ble:
-    MENU_BEGIN  tSystSets, .7
+	MENU_BEGIN  tSystSets, .7
         MENU_CALL   tInfoMenu,      do_info_menu
         MENU_CALL   tBleTitle,      comm_mode0
         MENU_CALL   tSetTimeDate,   do_date_time_menu
         MENU_CALL   tDispSets,      do_dispsets_menu
-        MENU_OPTION tLanguage,      oLanguage,       0
+	MENU_OPTION tAltMode,	    oAltMode,	    0		
         MENU_CALL   tMore,          do_settings_menu_more
         MENU_CALL   tExit,          do_continue_main_menu
     MENU_END
@@ -376,18 +416,18 @@
     	rcall	menu_tree_double_pop	; drop exit line and back to last line
     
 do_settings_menu_more:
-    btfsc   battery_gauge_available            ; piezo buttons available
+    btfsc   battery_gauge_available		; piezo buttons available
     bra     do_settings_menu_more_piezo
-    btfsc   ble_available           ; ble available
+    btfsc   ble_available				; ble available
     bra     do_settings_menu_more_ostc3p
     MENU_BEGIN  tSystSets, .7
-        MENU_CALL   tCompassMenu,   do_compass_menu
-		MENU_CALL	tLogOffset,					do_log_offset_menu
-        MENU_OPTION tUnits,    oUnits,          0
-        MENU_OPTION tSamplingrate,oSamplingRate,0
-        MENU_OPTION tDvSalinity,oDiveSalinity,  0
-        MENU_CALL   tResetMenu,     do_reset_menu
-        MENU_CALL   tExit,          do_return_settings
+		MENU_CALL   tCompassMenu,   do_compass_menu
+		MENU_CALL	tLogOffset,		do_log_offset_menu
+		MENU_OPTION tUnits,    		oUnits,				0
+		MENU_OPTION tLanguage,      oLanguage,			0        
+		MENU_OPTION tDvSalinity,	oDiveSalinity,		0
+		MENU_CALL   tResetMenu,     do_reset_menu
+		MENU_CALL   tExit,          do_return_settings
     MENU_END
 
 do_settings_menu_more_piezo_exit:
@@ -397,13 +437,13 @@
 
 do_settings_menu_more_piezo:
     MENU_BEGIN  tSystSets, .7
-        MENU_CALL   tCompassMenu,   do_compass_menu
-		MENU_CALL	tLogOffset,					do_log_offset_menu
-        MENU_OPTION tUnits,    oUnits,          0
-        MENU_OPTION tSamplingrate,oSamplingRate,0
-        MENU_OPTION tDvSalinity,oDiveSalinity,  0
-        MENU_CALL   tMore,          do_settings_piezo_menu
-        MENU_CALL   tExit,          do_return_settings
+        MENU_CALL   tCompassMenu,	do_compass_menu
+		MENU_CALL	tLogOffset,		do_log_offset_menu
+        MENU_OPTION tUnits,			oUnits,				0
+        MENU_OPTION tLanguage,      oLanguage,			0        
+        MENU_OPTION tDvSalinity,	oDiveSalinity,		0
+        MENU_CALL   tMore,			do_settings_piezo_menu
+        MENU_CALL   tExit,			do_return_settings
     MENU_END
 
     extern  comm_mode0
@@ -411,19 +451,19 @@
 do_settings_piezo_menu:
     ; Menu with features only available in piezo button hardware
     MENU_BEGIN  tSystSets, .4
-        MENU_CALL   tResetMenu,     do_reset_menu
-        MENU_OPTION tButtonleft,ocR_button_left  ,0  ; left button sensitivity
-        MENU_OPTION tButtonright,ocR_button_right,0  ; right button sensitivity
+        MENU_CALL   tResetMenu,		do_reset_menu
+        MENU_OPTION tButtonleft,	ocR_button_left,	0  ; left button sensitivity
+        MENU_OPTION tButtonright,	ocR_button_right,	0  ; right button sensitivity
         MENU_CALL   tExit,          do_settings_menu_more_piezo_exit
     MENU_END
 
 do_settings_menu_more_ostc3p:  ; Menu with BLE feature
     MENU_BEGIN  tSystSets, .7
-        MENU_CALL   tCompassMenu,   do_compass_menu
-		MENU_CALL	tLogOffset,					do_log_offset_menu
-        MENU_OPTION tUnits,    oUnits,          0
-        MENU_OPTION tSamplingrate,oSamplingRate,0
-        MENU_OPTION tDvSalinity,oDiveSalinity,  0
+        MENU_CALL   tCompassMenu,	do_compass_menu
+		MENU_CALL	tLogOffset,		do_log_offset_menu
+        MENU_OPTION tUnits,			oUnits,				0
+        MENU_OPTION tLanguage,      oLanguage,			0        
+        MENU_OPTION tDvSalinity,	oDiveSalinity,		0
         MENU_CALL   tResetMenu,     do_reset_menu
         MENU_CALL   tExit,          do_return_settings
     MENU_END
@@ -431,11 +471,11 @@
 do_compass_menu:
     MENU_BEGIN  tSystSets, .5
         MENU_CALL   tCompassMenu,   compass_calibration_loop
-;        MENU_OPTION tCompassGain,   oCompassGain,       0
-	MENU_DYNAMIC    menu_cal_x,       0
-	MENU_DYNAMIC    menu_cal_y,       0
-	MENU_DYNAMIC    menu_cal_z,       0
-        MENU_CALL   tExit,          do_return_settings_more
+;       MENU_OPTION		tCompassGain,   oCompassGain,	0
+		MENU_DYNAMIC    menu_cal_x,						0
+		MENU_DYNAMIC    menu_cal_y,						0
+		MENU_DYNAMIC    menu_cal_z,						0
+        MENU_CALL		tExit,			do_return_settings_more
     MENU_END
 
 ;=============================================================================
@@ -443,36 +483,36 @@
 
 do_reset_menu:
     MENU_BEGIN  tResetMenu, .6
-        MENU_CALL       tExit,                  do_return_settings
-        MENU_CALL       tReboot,	        do_reset_menu2			; Confirm
-	MENU_CALL       tResetDeco,	        do_reset_menu3			; Confirm
-	MENU_CALL       tResetSettings,	        do_reset_menu4			; Confirm
-        MENU_CALL       tResetLogbook,	        do_reset_menu5			; Confirm
-        MENU_CALL       tResetBattery,          new_battery_menu        ; New Battery submenu
+        MENU_CALL       tExit,			do_return_settings
+        MENU_CALL       tReboot,		do_reset_menu2		; Confirm
+		MENU_CALL       tResetDeco,		do_reset_menu3		; Confirm
+		MENU_CALL       tResetSettings,	do_reset_menu4		; Confirm
+        MENU_CALL       tResetLogbook,	do_reset_menu5		; Confirm
+        MENU_CALL       tResetBattery,	new_battery_menu	; New Battery sub menu
     MENU_END
 
 do_reset_menu2:
     MENU_BEGIN  tResetMenu2, .2
-        MENU_CALL       tAbort,                 do_continue_menu_3stack
-        MENU_CALL       tReboot,                do_reboot               ; Reboot
+        MENU_CALL       tAbort,			do_continue_menu_3stack
+        MENU_CALL       tReboot,		do_reboot               ; Reboot
     MENU_END
 
 do_reset_menu3:
     MENU_BEGIN  tResetMenu2, .2
-        MENU_CALL       tAbort,                 do_continue_menu_3stack
-        MENU_CALL       tResetDeco,             do_reset_deco			; Reset Deco
+        MENU_CALL       tAbort,			do_continue_menu_3stack
+        MENU_CALL       tResetDeco,		do_reset_deco			; Reset Deco
     MENU_END
 
 do_reset_menu4:
     MENU_BEGIN  tResetMenu2, .2
-        MENU_CALL       tAbort,                 do_continue_menu_3stack
-        MENU_CALL       tResetSettings,         do_reset_settings		; Reset all settings
+        MENU_CALL       tAbort,			do_continue_menu_3stack
+        MENU_CALL       tResetSettings,	do_reset_settings		; Reset all settings
     MENU_END
 
 do_reset_menu5:
     MENU_BEGIN  tResetMenu2, .2
-        MENU_CALL       tAbort,                 do_continue_menu_3stack
-        MENU_CALL       tResetLogbook,          do_reset_logbook		; Reset logbook
+        MENU_CALL       tAbort,			do_continue_menu_3stack
+        MENU_CALL       tResetLogbook,	do_reset_logbook		; Reset logbook
     MENU_END
 
 do_reset_logbook:
@@ -493,39 +533,31 @@
 
 
 do_reset_deco:
-	movlw	d'79'							; 79% N2
-	movff	WREG,char_I_N2_ratio
-	movlw	d'0'
-	movff	WREG,char_I_step_is_1min		; 2 second deco mode
-    SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine
-	movff	int_I_pres_respiration+0,int_I_pres_surface+0     ; copy for desat routine
-	movff	int_I_pres_respiration+1,int_I_pres_surface+1		
-
-	extern	deco_reset
-	call	deco_reset
-	call	deco_calc_desaturation_time     ; calculate desaturation time
-	banksel common
-	call	deco_calc_wo_deco_step_1_min	; calculate deco in surface mode 
-	banksel common
-  	clrf	nofly_time+0	              	; Reset NoFly
-  	clrf	nofly_time+1
-	clrf	desaturation_time+0				; Reset Desat
-	clrf	desaturation_time+1
+	SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration	; copy surface pressure to deco routine
+	SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface		; copy surface pressure to deco routine
+	
+    call    deco_clear_tissue       		; set all tissues to Pamb * N2_ratio (C-Code)
+    banksel common							; back to bank 1, needed after every return from C code
+	
+	call	deco_calc_wo_deco_step_1_min	; calculate deco in surface mode
+	call	deco_calc_desaturation_time		; calculate desaturation and no-fly time
+	banksel	common	
+	
 	goto	do_return_settings				; back to menu
 
 do_reset_settings:
     call		TFT_ClearScreen				; Clear screen    
     banksel common
 	extern	option_reset_all
-    call	option_reset_all        	; Reset all options to factory default.
-	goto	restart                     ; Restart into surfacemode
+    call	option_reset_all				; Reset all options to factory default.
+	goto	restart							; Restart into surfacemode
 
-do_continue_menu_3stack:			; Return three levels deep
+do_continue_menu_3stack:					; Return three levels deep
     call    menu_processor_pop
 	goto	do_return_settings
 
 do_reboot:
-	call	ext_flash_enable_protection			; Enables write protection
+	call	ext_flash_enable_protection		; Enables write protection
 	reset
 
 
@@ -543,14 +575,14 @@
         MENU_OPTION tSetDay,	oSetDay,		0
 		MENU_OPTION	tSetMonth,	oSetMonth,  	0
         MENU_OPTION tSetYear,	oSetYear,		0
-        MENU_CALL   tExit,                      do_continue_menu_3stack
+        MENU_CALL   tExit,					do_continue_menu_3stack
     MENU_END
 
 
 do_reset_seconds:
 	clrf	secs
 	extern	rtc_set_rtc
-	call	rtc_set_rtc				; writes mins,sec,hours,day,month and year to rtc module
+	call	rtc_set_rtc			; writes mins,sec,hours,day,month and year to rtc module
 do_time_menu:
 	bsf		settime_setdate
     MENU_BEGIN  tSetTime, .4
@@ -561,8 +593,8 @@
     MENU_END
 
 
-do_toggle_ppo2_max:             ; add 0.1bar, with hard-coded max.
-    movff   opt_ppO2_max,lo     ; banksafe
+do_toggle_ppo2_max:				; add 0.1bar, with hard-coded max.
+    movff   char_I_ppO2_max,lo	; banksafe
     movlw	.10
 	addwf	lo,F
 	movlw	ppo2_highest_setting
@@ -571,11 +603,11 @@
 	movlw	.120
 	movwf	lo
 do_toggle_ppo2_max2:
-    movff   lo,opt_ppO2_max
+    movff   lo,char_I_ppO2_max
     return
 
-do_toggle_ppo2_max_deco:             ; add 0.1bar, with hard-coded max.
-    movff   opt_ppO2_max_deco,lo     ; banksafe
+do_toggle_ppo2_max_deco:		 ; add 0.1bar, with hard-coded max.
+    movff   char_I_ppO2_max_deco,lo ; banksafe
     movlw	.10
 	addwf	lo,F
 	movlw	ppo2_highest_setting_deco
@@ -584,11 +616,11 @@
 	movlw	.120
 	movwf	lo
 do_toggle_ppo2_max_deco2:
-    movff   lo,opt_ppO2_max_deco
+    movff   lo,char_I_ppO2_max_deco
     return
     
 do_toggle_ppo2_min:             ; sub 0.1bar, with hard-coded min.
-    movff   opt_ppO2_min,lo     ; banksafe
+    movff   char_I_ppO2_min,lo     ; banksafe
     incf    lo,F
 	movlw	.21
 	cpfsgt	lo
@@ -596,9 +628,21 @@
 	movlw	ppo2_lowest_setting
 	movwf	lo
 do_toggle_ppo2_min2:
-    movff   lo,opt_ppO2_min
+    movff   lo,char_I_ppO2_min
     return
 
+do_toggle_ppo2_min_cc:			; sub 0.1bar, with hard-coded min.
+    movff   char_I_ppO2_min_loop,lo	; banksafe
+    incf    lo,F
+	movlw	ppo2_warning_low_cc_max
+	cpfsgt	lo
+    bra     do_toggle_ppo2_min_cc2
+	movlw	ppo2_warning_low_cc_min
+	movwf	lo
+do_toggle_ppo2_min_cc2:
+    movff   lo,char_I_ppO2_min_loop
+    return
+	
 
 	; Logbook offset sub-menu
 do_log_offset_menu:
@@ -652,23 +696,25 @@
 
 do_dispsets_menu_3stack:
     bcf		in_color_menu
-    rcall	menu_tree_double_pop	; drop exit line and back to last line
+    call	menu_tree_double_pop	; drop exit line and back to last line
 
 do_dispsets_menu:
-    MENU_BEGIN  tDispSets, .5
+	MENU_BEGIN  tDispSets, .6
         MENU_OPTION tBright,       oBrightness,   0
         MENU_CALL   tColorScheme,                 do_color_scheme
+		MENU_OPTION tLanguage,     oLanguage,     0
         MENU_OPTION tFlip,         oFlipScreen,   0
         MENU_CALL   tMore,                        do_dispsets_menu_more
         MENU_CALL   tExit,                        do_return_settings
     MENU_END
 
 do_dispsets_menu_more:
-    MENU_BEGIN  tDispSets, .5
-        MENU_OPTION tMODwarning,   oMODwarning,   0
-        MENU_OPTION tVSItext2,     oVSItextv2,    0
-        MENU_OPTION tVSIgraph,     oVSIgraph,     0
-	MENU_OPTION tTimeoutDive,  oDiveTimeout,  0
+    MENU_BEGIN  tDispSets, .6
+        MENU_OPTION tMODwarning,   oMODwarning,   	0
+		MENU_OPTION tIBCDwarning,  oEnable_IBCD,	0
+        MENU_OPTION tVSItext2,     oVSItextv2,    	0
+        MENU_OPTION tVSIgraph,     oVSIgraph,     	0
+		MENU_OPTION tTimeoutDive,  oDiveTimeout,  	0
         MENU_CALL   tExit,                        do_dispsets_menu_3stack
     MENU_END
 
@@ -749,41 +795,41 @@
     
 menu_new_battery_AA_16650:
     MENU_BEGIN tNewBattTitle, .5
-	MENU_CALL   tNewBattOld,                 use_old_batteries
-        MENU_CALL   tNewBattNew36,               use_new_36V_batteries
-        MENU_CALL   tNewBattNew15,               use_new_15V_batteries
-	MENU_CALL   tNewBattAccu,		 use_36V_rechargeable
-	MENU_CALL   tNew16650,			 use_16650_battery
+		MENU_CALL   tNewBattOld,		use_old_batteries
+		MENU_CALL   tNewBattNew36,		use_new_36V_batteries
+		MENU_CALL   tNewBattNew15,		use_new_15V_batteries
+		MENU_CALL   tNewBattAccu,		use_36V_rechargeable
+		MENU_CALL   tNew16650,			use_16650_battery
     MENU_END
     
 menu_new_battery_AA:
     MENU_BEGIN tNewBattTitle, .4
-	MENU_CALL   tNewBattOld,                 use_old_batteries
-        MENU_CALL   tNewBattNew36,               use_new_36V_batteries
-        MENU_CALL   tNewBattNew15,               use_new_15V_batteries
-	MENU_CALL   tNewBattAccu,		 use_36V_rechargeable
+		MENU_CALL   tNewBattOld,		use_old_batteries
+		MENU_CALL   tNewBattNew36,		use_new_36V_batteries
+		MENU_CALL   tNewBattNew15,		use_new_15V_batteries
+		MENU_CALL   tNewBattAccu,		use_36V_rechargeable
     MENU_END
 
 menu_new_battery_18650:
     MENU_BEGIN tNewBattTitle, .2
-	MENU_CALL   tNewBattOld,                 use_old_batteries
-	MENU_CALL   tNew18650,			 use_18650_battery
+		MENU_CALL   tNewBattOld,		use_old_batteries
+		MENU_CALL   tNew18650,			use_18650_battery
     MENU_END
 
     
 	global	use_old_prior_209
 use_old_prior_209:
 	clrf	EEADRH
-	read_int_eeprom 0x0F	    ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
-	incfsz	EEDATA,F	    ; Was 0xFF?
-	return			    ; No, done.
+	read_int_eeprom 0x0F	    	; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
+	incfsz	EEDATA,F	    		; Was 0xFF?
+	return			    			; No, done.
 
-	call    lt2942_get_status       ; Check for gauge IC
-	movlw   .3			; Assume a 18650
+	call    lt2942_get_status   	; Check for gauge IC
+	movlw   .3						; Assume a 18650
 	btfss   battery_gauge_available ; cR/2 hardware?
-	movlw   .1			; Assume a Saft
+	movlw   .1						; Assume a Saft
         movwf	EEDATA
-	write_int_eeprom 0x0F		; Store the new battery type into EEPROM
+	write_int_eeprom 0x0F			; Store the new battery type into EEPROM
 	return
 	
 	global	use_old_batteries
@@ -802,10 +848,10 @@
 	read_int_eeprom 0x0C
 	movff	EEDATA,battery_gauge+5
 	read_int_eeprom 0x0F
-	movff	EEDATA,battery_type; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
+	movff	EEDATA,battery_type	; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
 
 	rcall	setup_new_saft	    ; Any other value
-	incf	EEDATA,F	    ; 1 ... 5
+	incf	EEDATA,F	    	; 1 ... 5
 	dcfsnz	EEDATA,F
 	rcall	setup_new_15v	    ;=0
 	dcfsnz	EEDATA,F
@@ -824,7 +870,7 @@
     bsf	    charge_disable
     bcf	    TRISE,2
     movlw   .100
-    movwf   batt_percent                ; To have 1,5V batteries right after firmware update
+    movwf   batt_percent		; To have 1,5V batteries right after firmware update
     movlw   .0
     movff   WREG,battery_type
     return
@@ -921,11 +967,11 @@
 use_new_15V_batteries:
     rcall   setup_new_15v
 use_new_36V_2:
-    call    reset_battery_pointer       ; Resets battery pointer 0x07-0x0C and battery_gauge:5
-    goto    surfloop				; Jump to Surfaceloop!
+    call    reset_battery_pointer	; Resets battery pointer 0x07-0x0C and battery_gauge:5
+    goto    surfloop				; Jump to Surface loop!
 use_36V_rechargeable:
     rcall   setup_new_panasonic
     call    reset_battery_internal_only
-    goto    surfloop				; Jump to Surfaceloop!
+    goto    surfloop				; Jump to Surface loop!
 
     END
\ No newline at end of file