[PATCH 2/3] Changes to bring pO2 representation in line with CodingStyle

Anton Lundin glance at acc.umu.se
Sat Sep 5 01:25:17 PDT 2015


Sorry for top posting, on my cell on the run, but I'd NAK this one because it changes the format of the settings xml, making it incompatible with older saves.

The other parts of the patch I'm fine with.

//Anton

On September 5, 2015 12:25:34 AM GMT+02:00, Tim Wootton <tim at tee-jay.org.uk> wrote:
>Signed-off-by: Tim Wootton <tim at tee-jay.org.uk>
>---
> configuredivecomputer.cpp             | 14 +++++++-------
>configuredivecomputerthreads.cpp      | 28 ++++++++++++++--------------
> devicedetails.cpp                     |  6 +++---
> devicedetails.h                       |  6 +++---
>parse-xml.c                           | 30
>+++++++++++++++---------------
> qt-ui/configuredivecomputerdialog.cpp | 20 ++++++++++----------
> qt-ui/configuredivecomputerdialog.ui  | 12 ++++++------
> 7 files changed, 58 insertions(+), 58 deletions(-)
>
>diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp
>index 65cf3ce..0b74d01 100644
>--- a/configuredivecomputer.cpp
>+++ b/configuredivecomputer.cpp
>@@ -171,8 +171,8 @@ bool ConfigureDiveComputer::saveXMLBackup(QString
>fileName, DeviceDetails *detai
> 	writer.writeTextElement("GfHigh", QString::number(details->gfHigh));
> 	writer.writeTextElement("GfLow", QString::number(details->gfLow));
>	writer.writeTextElement("PressureSensorOffset",
>QString::number(details->pressureSensorOffset));
>-	writer.writeTextElement("PpO2Min",
>QString::number(details->ppO2Min));
>-	writer.writeTextElement("PpO2Max",
>QString::number(details->ppO2Max));
>+	writer.writeTextElement("PpO2Min", QString::number(details->pO2Min));
>+	writer.writeTextElement("PpO2Max", QString::number(details->pO2Max));
>	writer.writeTextElement("FutureTTS",
>QString::number(details->futureTTS));
>	writer.writeTextElement("CcrMode", QString::number(details->ccrMode));
>	writer.writeTextElement("DecoType",
>QString::number(details->decoType));
>@@ -189,7 +189,7 @@ bool ConfigureDiveComputer::saveXMLBackup(QString
>fileName, DeviceDetails *detai
>	writer.writeTextElement("ModWarning",
>QString::number(details->modWarning));
>	writer.writeTextElement("DynamicAscendRate",
>QString::number(details->dynamicAscendRate));
>	writer.writeTextElement("GraphicalSpeedIndicator",
>QString::number(details->graphicalSpeedIndicator));
>-	writer.writeTextElement("AlwaysShowppO2",
>QString::number(details->alwaysShowppO2));
>+	writer.writeTextElement("AlwaysShowpO2",
>QString::number(details->alwaysShowpO2));
> 
> 	// Suunto vyper settings.
>	writer.writeTextElement("Altitude",
>QString::number(details->altitude));
>@@ -439,10 +439,10 @@ bool
>ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails
>*de
> 				details->pressureSensorOffset = keyString.toInt();
> 
> 			if (settingName == "PpO2Min")
>-				details->ppO2Min = keyString.toInt();
>+				details->pO2Min = keyString.toInt();
> 
> 			if (settingName == "PpO2Max")
>-				details->ppO2Max = keyString.toInt();
>+				details->pO2Max = keyString.toInt();
> 
> 			if (settingName == "FutureTTS")
> 				details->futureTTS = keyString.toInt();
>@@ -492,8 +492,8 @@ bool
>ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails
>*de
> 			if (settingName == "GraphicalSpeedIndicator")
> 				details->graphicalSpeedIndicator = keyString.toInt();
> 
>-			if (settingName == "AlwaysShowppO2")
>-				details->alwaysShowppO2 = keyString.toInt();
>+			if (settingName == "AlwaysShowpO2")
>+				details->alwaysShowpO2 = keyString.toInt();
> 
> 			if (settingName == "Altitude")
> 				details->altitude = keyString.toInt();
>diff --git a/configuredivecomputerthreads.cpp
>b/configuredivecomputerthreads.cpp
>index f775b8b..19a83be 100644
>--- a/configuredivecomputerthreads.cpp
>+++ b/configuredivecomputerthreads.cpp
>@@ -598,8 +598,8 @@ static dc_status_t read_ostc3_settings(dc_device_t
>*device, DeviceDetails *m_dev
> 	READ_SETTING(OSTC3_SAFETY_STOP, safetyStop);
> 	READ_SETTING(OSTC3_GF_HIGH, gfHigh);
> 	READ_SETTING(OSTC3_GF_LOW, gfLow);
>-	READ_SETTING(OSTC3_PPO2_MIN, ppO2Min);
>-	READ_SETTING(OSTC3_PPO2_MAX, ppO2Max);
>+	READ_SETTING(OSTC3_PPO2_MIN, pO2Min);
>+	READ_SETTING(OSTC3_PPO2_MAX, pO2Max);
> 	READ_SETTING(OSTC3_FUTURE_TTS, futureTTS);
> 	READ_SETTING(OSTC3_CCR_MODE, ccrMode);
> 	READ_SETTING(OSTC3_DECO_TYPE, decoType);
>@@ -616,7 +616,7 @@ static dc_status_t read_ostc3_settings(dc_device_t
>*device, DeviceDetails *m_dev
> 	READ_SETTING(OSTC3_MOD_WARNING, modWarning);
> 	READ_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate);
>	READ_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR,
>graphicalSpeedIndicator);
>-	READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
>+	READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowpO2);
> 
> #undef READ_SETTING
> 
>@@ -854,8 +854,8 @@ static dc_status_t write_ostc3_settings(dc_device_t
>*device, DeviceDetails *m_de
> 	WRITE_SETTING(OSTC3_SAFETY_STOP, safetyStop);
> 	WRITE_SETTING(OSTC3_GF_HIGH, gfHigh);
> 	WRITE_SETTING(OSTC3_GF_LOW, gfLow);
>-	WRITE_SETTING(OSTC3_PPO2_MIN, ppO2Min);
>-	WRITE_SETTING(OSTC3_PPO2_MAX, ppO2Max);
>+	WRITE_SETTING(OSTC3_PPO2_MIN, pO2Min);
>+	WRITE_SETTING(OSTC3_PPO2_MAX, pO2Max);
> 	WRITE_SETTING(OSTC3_FUTURE_TTS, futureTTS);
> 	WRITE_SETTING(OSTC3_CCR_MODE, ccrMode);
> 	WRITE_SETTING(OSTC3_DECO_TYPE, decoType);
>@@ -872,7 +872,7 @@ static dc_status_t write_ostc3_settings(dc_device_t
>*device, DeviceDetails *m_de
> 	WRITE_SETTING(OSTC3_MOD_WARNING, modWarning);
> 	WRITE_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate);
>	WRITE_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR,
>graphicalSpeedIndicator);
>-	WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
>+	WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowpO2);
> 
> #undef WRITE_SETTING
> 
>@@ -1143,10 +1143,10 @@ static dc_status_t
>read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
> 	m_deviceDetails->saturation = read_ostc_cf(data, 11);
> 	// CF12: Factor for desaturation processes
> 	m_deviceDetails->desaturation = read_ostc_cf(data, 12);
>-	// CF17: Lower threshold for ppO2 warning
>-	m_deviceDetails->ppO2Min = read_ostc_cf(data, 17);
>-	// CF18: Upper threshold for ppO2 warning
>-	m_deviceDetails->ppO2Max = read_ostc_cf(data, 18);
>+	// CF17: Lower threshold for pO2 warning
>+	m_deviceDetails->pO2Min = read_ostc_cf(data, 17);
>+	// CF18: Upper threshold for pO2 warning
>+	m_deviceDetails->pO2Max = read_ostc_cf(data, 18);
> 	// CF20: Depth sampling rate for Profile storage
> 	m_deviceDetails->samplingRate = read_ostc_cf(data, 20);
> 	// CF29: Depth of last decompression stop
>@@ -1438,10 +1438,10 @@ static dc_status_t
>write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
> 	write_ostc_cf(data, 11, max_CF, m_deviceDetails->saturation);
> 	// CF12: Factor for desaturation processes
> 	write_ostc_cf(data, 12, max_CF, m_deviceDetails->desaturation);
>-	// CF17: Lower threshold for ppO2 warning
>-	write_ostc_cf(data, 17, max_CF, m_deviceDetails->ppO2Min);
>-	// CF18: Upper threshold for ppO2 warning
>-	write_ostc_cf(data, 18, max_CF, m_deviceDetails->ppO2Max);
>+	// CF17: Lower threshold for pO2 warning
>+	write_ostc_cf(data, 17, max_CF, m_deviceDetails->pO2Min);
>+	// CF18: Upper threshold for pO2 warning
>+	write_ostc_cf(data, 18, max_CF, m_deviceDetails->pO2Max);
> 	// CF20: Depth sampling rate for Profile storage
> 	write_ostc_cf(data, 20, max_CF, m_deviceDetails->samplingRate);
> 	// CF29: Depth of last decompression stop
>diff --git a/devicedetails.cpp b/devicedetails.cpp
>index 1ac5637..9994335 100644
>--- a/devicedetails.cpp
>+++ b/devicedetails.cpp
>@@ -32,8 +32,8 @@ DeviceDetails::DeviceDetails(QObject *parent) :
> 	calibrationGas(0),
> 	diveMode(0),
> 	decoType(0),
>-	ppO2Max(0),
>-	ppO2Min(0),
>+	pO2Max(0),
>+	pO2Min(0),
> 	futureTTS(0),
> 	gfLow(0),
> 	gfHigh(0),
>@@ -73,6 +73,6 @@ DeviceDetails::DeviceDetails(QObject *parent) :
> 	modWarning(false),
> 	dynamicAscendRate(false),
> 	graphicalSpeedIndicator(false),
>-	alwaysShowppO2(false)
>+	alwaysShowpO2(false)
> {
> }
>diff --git a/devicedetails.h b/devicedetails.h
>index 1ed9914..d70b281 100644
>--- a/devicedetails.h
>+++ b/devicedetails.h
>@@ -49,8 +49,8 @@ public:
> 	int calibrationGas;
> 	int diveMode;
> 	int decoType;
>-	int ppO2Max;
>-	int ppO2Min;
>+	int pO2Max;
>+	int pO2Min;
> 	int futureTTS;
> 	int gfLow;
> 	int gfHigh;
>@@ -90,7 +90,7 @@ public:
> 	bool modWarning;
> 	bool dynamicAscendRate;
> 	bool graphicalSpeedIndicator;
>-	bool alwaysShowppO2;
>+	bool alwaysShowpO2;
> };
> 
> 
>diff --git a/parse-xml.c b/parse-xml.c
>index 25693c4..3230154 100644
>--- a/parse-xml.c
>+++ b/parse-xml.c
>@@ -2900,7 +2900,7 @@ extern int divinglog_profile(void *handle, int
>columns, char **data, char **colu
> {
> 	int sinterval = 0;
> 	unsigned long i, len, lenprofile2 = 0;
>-	char *ptr, temp[4], pres[5], hbeat[4], stop[4], stime[4], ndl[4],
>ppo2_1[4], ppo2_2[4], ppo2_3[4], cns[5], setpoint[3];
>+	char *ptr, temp[4], pres[5], hbeat[4], stop[4], stime[4], ndl[4],
>pO2_1[4], pO2_2[4], pO2_3[4], cns[5], setpoint[3];
> 	short oldcyl = -1;
> 
> 	/* We do not have samples */
>@@ -2993,9 +2993,9 @@ extern int divinglog_profile(void *handle, int
>columns, char **data, char **colu
> 		/*
> 		 * AAABBBCCCOOOONNNNSS
> 		 *
>-		 * A = ppO2 cell 1 (measured)
>-		 * B = ppO2 cell 2 (measured)
>-		 * C = ppO2 cell 3 (measured)
>+		 * A = pO2 cell 1 (measured)
>+		 * B = pO2 cell 2 (measured)
>+		 * C = pO2 cell 3 (measured)
> 		 * O = OTU
> 		 * N = CNS
> 		 * S = Setpoint
>@@ -3005,18 +3005,18 @@ extern int divinglog_profile(void *handle, int
>columns, char **data, char **colu
> 		 */
> 
> 		if (data[5] && strlen(data[5])) {
>-			memcpy(ppo2_1, &data[5][i * 19 + 0], 3);
>-			memcpy(ppo2_2, &data[5][i * 19 + 3], 3);
>-			memcpy(ppo2_3, &data[5][i * 19 + 6], 3);
>+			memcpy(pO2_1, &data[5][i * 19 + 0], 3);
>+			memcpy(pO2_2, &data[5][i * 19 + 3], 3);
>+			memcpy(pO2_3, &data[5][i * 19 + 6], 3);
> 			memcpy(cns, &data[5][i * 19 + 13], 4);
> 			memcpy(setpoint, &data[5][i * 19 + 17], 2);
> 
>-			if (atoi(ppo2_1) > 0)
>-				cur_sample->o2sensor[0].mbar = atoi(ppo2_1) * 100;
>-			if (atoi(ppo2_2) > 0)
>-				cur_sample->o2sensor[1].mbar = atoi(ppo2_2) * 100;
>-			if (atoi(ppo2_3) > 0)
>-				cur_sample->o2sensor[2].mbar = atoi(ppo2_3) * 100;
>+			if (atoi(pO2_1) > 0)
>+				cur_sample->o2sensor[0].mbar = atoi(pO2_1) * 100;
>+			if (atoi(pO2_2) > 0)
>+				cur_sample->o2sensor[1].mbar = atoi(pO2_2) * 100;
>+			if (atoi(pO2_3) > 0)
>+				cur_sample->o2sensor[2].mbar = atoi(pO2_3) * 100;
> 			if (atoi(cns) > 0)
> 				cur_sample->cns = rint(atoi(cns) / 10);
> 			if (atoi(setpoint) > 0)
>@@ -3276,7 +3276,7 @@ int parse_dlf_buffer(unsigned char *buffer,
>size_t size)
> 	/* Done with parsing what we know about the dive header */
> 	ptr += 32;
> 
>-	// We're going to interpret ppO2 saved as a sensor value in these
>modes.
>+	// We're going to interpret pO2 saved as a sensor value in these
>modes.
> 	if (cur_dc->divemode == CCR || cur_dc->divemode == PSCR)
> 		cur_dc->no_o2sensors = 1;
> 
>@@ -3293,7 +3293,7 @@ int parse_dlf_buffer(unsigned char *buffer,
>size_t size)
> 			cur_sample->depth.mm = ((ptr[5] << 8) + ptr[4]) * 10;
> 			// Crazy precision on these stored values...
> 			// Only store value if we're in CCR/PSCR mode,
>-			// because we rather calculate ppo2 our selfs.
>+			// because we rather calculate pO2 ourselves.
> 			if (cur_dc->divemode == CCR || cur_dc->divemode == PSCR)
> 				cur_sample->o2sensor[0].mbar = ((ptr[7] << 8) + ptr[6]) / 10;
> 			// NDL in minutes, 10 bit
>diff --git a/qt-ui/configuredivecomputerdialog.cpp
>b/qt-ui/configuredivecomputerdialog.cpp
>index 04c15b1..1a83667 100644
>--- a/qt-ui/configuredivecomputerdialog.cpp
>+++ b/qt-ui/configuredivecomputerdialog.cpp
>@@ -421,8 +421,8 @@ void
>ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
> 	deviceDetails->gfHigh = ui.gfHighSpinBox->value();
> 	deviceDetails->gfLow = ui.gfLowSpinBox->value();
>	deviceDetails->pressureSensorOffset =
>ui.pressureSensorOffsetSpinBox->value();
>-	deviceDetails->ppO2Min = ui.ppO2MinSpinBox->value();
>-	deviceDetails->ppO2Max = ui.ppO2MaxSpinBox->value();
>+	deviceDetails->pO2Min = ui.pO2MinSpinBox->value();
>+	deviceDetails->pO2Max = ui.pO2MaxSpinBox->value();
> 	deviceDetails->futureTTS = ui.futureTTSSpinBox->value();
> 	deviceDetails->ccrMode = ui.ccrModeComboBox->currentIndex();
> 	deviceDetails->decoType = ui.decoTypeComboBox->currentIndex();
>@@ -439,7 +439,7 @@ void
>ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
> 	deviceDetails->modWarning = ui.modWarning->isChecked();
> 	deviceDetails->dynamicAscendRate = ui.dynamicAscendRate->isChecked();
>	deviceDetails->graphicalSpeedIndicator =
>ui.graphicalSpeedIndicator->isChecked();
>-	deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2->isChecked();
>+	deviceDetails->alwaysShowpO2 = ui.alwaysShowpO2->isChecked();
> 
> 	//set gas values
> 	gas gas1;
>@@ -559,8 +559,8 @@ void
>ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
> 	deviceDetails->safetyStop = ui.safetyStopCheckBox_3->isChecked();
> 	deviceDetails->gfHigh = ui.gfHighSpinBox_3->value();
> 	deviceDetails->gfLow = ui.gfLowSpinBox_3->value();
>-	deviceDetails->ppO2Min = ui.ppO2MinSpinBox_3->value();
>-	deviceDetails->ppO2Max = ui.ppO2MaxSpinBox_3->value();
>+	deviceDetails->pO2Min = ui.pO2MinSpinBox_3->value();
>+	deviceDetails->pO2Max = ui.pO2MaxSpinBox_3->value();
> 	deviceDetails->futureTTS = ui.futureTTSSpinBox_3->value();
> 	deviceDetails->decoType = ui.decoTypeComboBox_3->currentIndex();
>	deviceDetails->aGFSelectable =
>ui.aGFSelectableCheckBox_3->isChecked();
>@@ -796,8 +796,8 @@ void
>ConfigureDiveComputerDialog::reloadValuesOSTC3()
> 	ui.gfHighSpinBox->setValue(deviceDetails->gfHigh);
> 	ui.gfLowSpinBox->setValue(deviceDetails->gfLow);
>	ui.pressureSensorOffsetSpinBox->setValue(deviceDetails->pressureSensorOffset);
>-	ui.ppO2MinSpinBox->setValue(deviceDetails->ppO2Min);
>-	ui.ppO2MaxSpinBox->setValue(deviceDetails->ppO2Max);
>+	ui.pO2MinSpinBox->setValue(deviceDetails->pO2Min);
>+	ui.pO2MaxSpinBox->setValue(deviceDetails->pO2Max);
> 	ui.futureTTSSpinBox->setValue(deviceDetails->futureTTS);
> 	ui.ccrModeComboBox->setCurrentIndex(deviceDetails->ccrMode);
> 	ui.decoTypeComboBox->setCurrentIndex(deviceDetails->decoType);
>@@ -814,7 +814,7 @@ void
>ConfigureDiveComputerDialog::reloadValuesOSTC3()
> 	ui.modWarning->setChecked(deviceDetails->modWarning);
> 	ui.dynamicAscendRate->setChecked(deviceDetails->dynamicAscendRate);
>	ui.graphicalSpeedIndicator->setChecked(deviceDetails->graphicalSpeedIndicator);
>-	ui.alwaysShowppO2->setChecked(deviceDetails->alwaysShowppO2);
>+	ui.alwaysShowpO2->setChecked(deviceDetails->alwaysShowpO2);
> 
> 	//load gas 1 values
>	ui.ostc3GasTable->setItem(0, 1, new
>QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));
>@@ -927,8 +927,8 @@ setNumberOfDives
> 	ui.safetyStopCheckBox_3->setChecked(deviceDetails->safetyStop);
> 	ui.gfHighSpinBox_3->setValue(deviceDetails->gfHigh);
> 	ui.gfLowSpinBox_3->setValue(deviceDetails->gfLow);
>-	ui.ppO2MinSpinBox_3->setValue(deviceDetails->ppO2Min);
>-	ui.ppO2MaxSpinBox_3->setValue(deviceDetails->ppO2Max);
>+	ui.pO2MinSpinBox_3->setValue(deviceDetails->pO2Min);
>+	ui.pO2MaxSpinBox_3->setValue(deviceDetails->pO2Max);
> 	ui.futureTTSSpinBox_3->setValue(deviceDetails->futureTTS);
> 	ui.decoTypeComboBox_3->setCurrentIndex(deviceDetails->decoType);
> 	ui.aGFSelectableCheckBox_3->setChecked(deviceDetails->aGFSelectable);
>diff --git a/qt-ui/configuredivecomputerdialog.ui
>b/qt-ui/configuredivecomputerdialog.ui
>index d354602..d040849 100644
>--- a/qt-ui/configuredivecomputerdialog.ui
>+++ b/qt-ui/configuredivecomputerdialog.ui
>@@ -627,9 +627,9 @@
>              </widget>
>             </item>
>             <item row="11" column="0" colspan="2">
>-             <widget class="QCheckBox" name="alwaysShowppO2">
>+             <widget class="QCheckBox" name="alwaysShowpO2">
>               <property name="text">
>-               <string>Always show ppO2</string>
>+               <string>Always show pO₂</string>
>               </property>
>              </widget>
>             </item>
>@@ -1313,7 +1313,7 @@
>              </spacer>
>             </item>
>             <item row="4" column="3">
>-             <widget class="QSpinBox" name="ppO2MaxSpinBox">
>+             <widget class="QSpinBox" name="pO2MaxSpinBox">
>               <property name="suffix">
>                <string> cbar</string>
>               </property>
>@@ -1329,7 +1329,7 @@
>              </widget>
>             </item>
>             <item row="5" column="3">
>-             <widget class="QSpinBox" name="ppO2MinSpinBox">
>+             <widget class="QSpinBox" name="pO2MinSpinBox">
>               <property name="suffix">
>                <string> cbar</string>
>               </property>
>@@ -2505,7 +2505,7 @@
>              </spacer>
>             </item>
>             <item row="3" column="3">
>-             <widget class="QSpinBox" name="ppO2MaxSpinBox_3">
>+             <widget class="QSpinBox" name="pO2MaxSpinBox_3">
>               <property name="suffix">
>                <string> cbar</string>
>               </property>
>@@ -2521,7 +2521,7 @@
>              </widget>
>             </item>
>             <item row="4" column="3">
>-             <widget class="QSpinBox" name="ppO2MinSpinBox_3">
>+             <widget class="QSpinBox" name="pO2MinSpinBox_3">
>               <property name="suffix">
>                <string> cbar</string>
>               </property>
>-- 
>2.1.4
>
>_______________________________________________
>subsurface mailing list
>subsurface at subsurface-divelog.org
>http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface



More information about the subsurface mailing list