 //////////
 // Dive //
 //////////
+
+void calculateMinMaxValues(float depthInMeter, float temperatureInCelsius)
+{
+	//Calculate minimum and maximum values during the dive
+	if (maxDepthInMeter < depthInMeter) {
+		maxDepthInMeter = depthInMeter;
+		view.drawMaximumDepth(maxDepthInMeter);
+	}
+	if (maxTemperatureInCelsius < temperatureInCelsius) {
+		maxTemperatureInCelsius = temperatureInCelsius;
+	}
+	if (minTemperatureInCelsius > temperatureInCelsius) {
+		minTemperatureInCelsius = temperatureInCelsius;
+	}
+}
 
 void diveSurface()
 {

		diveDurationInSeconds = Serial.parseInt();
		float temperatureInCelsius = Serial.parseFloat();

		if (testModeSetting) {
			Serial.print("Pressure: ");
			Serial.print(pressureInMillibar, 2);
			Serial.print(" Depth: ");
			Serial.print(depthInMeter, 2);
			Serial.print(" Temperature: ");
			Serial.print(temperatureInCelsius, 2);
			Serial.print(" Duration: ");
			Serial.println(diveDurationInSeconds);
		}
		view.drawBatteryStateOfCharge(batterySoc);

		view.drawCurrentPressure(pressureInMillibar);
		view.drawDepth(depthInMeter);
		view.drawCurrentTemperature(temperatureInCelsius);
		view.drawDiveDuration(diveDurationInSeconds);

		//Calculate minimum and maximum values during the dive
		if (maxDepthInMeter < depthInMeter) {
			maxDepthInMeter = depthInMeter;
			view.drawMaximumDepth(maxDepthInMeter);
		}
		if (maxTemperatureInCelsius < temperatureInCelsius) {
			maxTemperatureInCelsius = temperatureInCelsius;
		}
		if (minTemperatureInCelsius > temperatureInCelsius) {
			minTemperatureInCelsius = temperatureInCelsius;
		}

		switch (currentScreen) {
			case GAUGE_SCREEN: {


void diveUnderWater() // Called in every second on the GAUGE and DIVE screens
{
	view.drawBatteryStateOfCharge(batterySoc);

	float pressureInMillibar = sensor.getPressure(ADC_4096);
