mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Start to read/write and present some OSTC4 settings
This is mostly copy-paste from the ostc3 case, but there are some minor differences. Some minor things have different meaning, and there's a slightly different command set, but I couldn't figure out a sane way of joining them. Signed-off-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
		
							parent
							
								
									4cbf64bf99
								
							
						
					
					
						commit
						527763f306
					
				
					 2 changed files with 708 additions and 2 deletions
				
			
		|  | @ -363,23 +363,459 @@ static dc_status_t write_suunto_vyper_settings(dc_device_t *device, DeviceDetail | ||||||
| 
 | 
 | ||||||
| static dc_status_t read_ostc4_settings(dc_device_t *device, DeviceDetails *m_deviceDetails, dc_event_callback_t progress_cb, void *userdata) | static dc_status_t read_ostc4_settings(dc_device_t *device, DeviceDetails *m_deviceDetails, dc_event_callback_t progress_cb, void *userdata) | ||||||
| { | { | ||||||
|  | 	// This code is really similar to the OSTC3 code, but there are minor
 | ||||||
|  | 	// differences in what the data means, and how to communicate with the
 | ||||||
|  | 	// device. If anyone can find a good way to harmonize the two, be my guest.
 | ||||||
| 	dc_status_t rc = DC_STATUS_SUCCESS; | 	dc_status_t rc = DC_STATUS_SUCCESS; | ||||||
| 	dc_event_progress_t progress; | 	dc_event_progress_t progress; | ||||||
| 	progress.current = 0; | 	progress.current = 0; | ||||||
| 	progress.maximum = 1; | 	progress.maximum = 19; | ||||||
| 	unsigned char hardware[1]; | 	unsigned char hardware[1]; | ||||||
| 
 | 
 | ||||||
| 	EMIT_PROGRESS(); | 	EMIT_PROGRESS(); | ||||||
| 
 | 
 | ||||||
|  | 	//Read gas mixes
 | ||||||
|  | 	gas gas1; | ||||||
|  | 	gas gas2; | ||||||
|  | 	gas gas3; | ||||||
|  | 	gas gas4; | ||||||
|  | 	gas gas5; | ||||||
|  | 	unsigned char gasData[4] = { 0, 0, 0, 0 }; | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_GAS1, gasData, sizeof(gasData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	gas1.oxygen = gasData[0]; | ||||||
|  | 	gas1.helium = gasData[1]; | ||||||
|  | 	gas1.type = gasData[2]; | ||||||
|  | 	gas1.depth = gasData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_GAS2, gasData, sizeof(gasData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	gas2.oxygen = gasData[0]; | ||||||
|  | 	gas2.helium = gasData[1]; | ||||||
|  | 	gas2.type = gasData[2]; | ||||||
|  | 	gas2.depth = gasData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_GAS3, gasData, sizeof(gasData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	gas3.oxygen = gasData[0]; | ||||||
|  | 	gas3.helium = gasData[1]; | ||||||
|  | 	gas3.type = gasData[2]; | ||||||
|  | 	gas3.depth = gasData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_GAS4, gasData, sizeof(gasData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	gas4.oxygen = gasData[0]; | ||||||
|  | 	gas4.helium = gasData[1]; | ||||||
|  | 	gas4.type = gasData[2]; | ||||||
|  | 	gas4.depth = gasData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_GAS5, gasData, sizeof(gasData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	gas5.oxygen = gasData[0]; | ||||||
|  | 	gas5.helium = gasData[1]; | ||||||
|  | 	gas5.type = gasData[2]; | ||||||
|  | 	gas5.depth = gasData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	m_deviceDetails->gas1 = gas1; | ||||||
|  | 	m_deviceDetails->gas2 = gas2; | ||||||
|  | 	m_deviceDetails->gas3 = gas3; | ||||||
|  | 	m_deviceDetails->gas4 = gas4; | ||||||
|  | 	m_deviceDetails->gas5 = gas5; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	//Read Dil Values
 | ||||||
|  | 	gas dil1; | ||||||
|  | 	gas dil2; | ||||||
|  | 	gas dil3; | ||||||
|  | 	gas dil4; | ||||||
|  | 	gas dil5; | ||||||
|  | 	unsigned char dilData[4] = { 0, 0, 0, 0 }; | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_DIL1, dilData, sizeof(dilData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	dil1.oxygen = dilData[0]; | ||||||
|  | 	dil1.helium = dilData[1]; | ||||||
|  | 	dil1.type = dilData[2]; | ||||||
|  | 	dil1.depth = dilData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_DIL2, dilData, sizeof(dilData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	dil2.oxygen = dilData[0]; | ||||||
|  | 	dil2.helium = dilData[1]; | ||||||
|  | 	dil2.type = dilData[2]; | ||||||
|  | 	dil2.depth = dilData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_DIL3, dilData, sizeof(dilData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	dil3.oxygen = dilData[0]; | ||||||
|  | 	dil3.helium = dilData[1]; | ||||||
|  | 	dil3.type = dilData[2]; | ||||||
|  | 	dil3.depth = dilData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_DIL4, dilData, sizeof(dilData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	dil4.oxygen = dilData[0]; | ||||||
|  | 	dil4.helium = dilData[1]; | ||||||
|  | 	dil4.type = dilData[2]; | ||||||
|  | 	dil4.depth = dilData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_DIL5, dilData, sizeof(dilData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	dil5.oxygen = dilData[0]; | ||||||
|  | 	dil5.helium = dilData[1]; | ||||||
|  | 	dil5.type = dilData[2]; | ||||||
|  | 	dil5.depth = dilData[3]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	m_deviceDetails->dil1 = dil1; | ||||||
|  | 	m_deviceDetails->dil2 = dil2; | ||||||
|  | 	m_deviceDetails->dil3 = dil3; | ||||||
|  | 	m_deviceDetails->dil4 = dil4; | ||||||
|  | 	m_deviceDetails->dil5 = dil5; | ||||||
|  | 
 | ||||||
|  | 	//Read setpoint Values
 | ||||||
|  | 	setpoint sp1; | ||||||
|  | 	setpoint sp2; | ||||||
|  | 	setpoint sp3; | ||||||
|  | 	setpoint sp4; | ||||||
|  | 	setpoint sp5; | ||||||
|  | 	unsigned char spData[4] = { 0, 0, 0, 0}; | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_SP1, spData, sizeof(spData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	sp1.sp = spData[0]; | ||||||
|  | 	sp1.depth = spData[1]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_SP2, spData, sizeof(spData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	sp2.sp = spData[0]; | ||||||
|  | 	sp2.depth = spData[1]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_SP3, spData, sizeof(spData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	sp3.sp = spData[0]; | ||||||
|  | 	sp3.depth = spData[1]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_SP4, spData, sizeof(spData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	sp4.sp = spData[0]; | ||||||
|  | 	sp4.depth = spData[1]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_SP5, spData, sizeof(spData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	sp5.sp = spData[0]; | ||||||
|  | 	sp5.depth = spData[1]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	m_deviceDetails->sp1 = sp1; | ||||||
|  | 	m_deviceDetails->sp2 = sp2; | ||||||
|  | 	m_deviceDetails->sp3 = sp3; | ||||||
|  | 	m_deviceDetails->sp4 = sp4; | ||||||
|  | 	m_deviceDetails->sp5 = sp5; | ||||||
|  | 
 | ||||||
|  | 	//Read other settings
 | ||||||
|  | 	unsigned char uData[4] = { 0 }; | ||||||
|  | 
 | ||||||
|  | #define READ_SETTING(_OSTC4_SETTING, _DEVICE_DETAIL)                                            \ | ||||||
|  | 	do {                                                                                    \ | ||||||
|  | 		rc = hw_ostc3_device_config_read(device, _OSTC4_SETTING, uData, sizeof(uData)); \ | ||||||
|  | 		if (rc != DC_STATUS_SUCCESS)                                                    \ | ||||||
|  | 			return rc;                                                              \ | ||||||
|  | 		m_deviceDetails->_DEVICE_DETAIL = uData[0];                                     \ | ||||||
|  | 		EMIT_PROGRESS();                                                                \ | ||||||
|  | 	} while (0) | ||||||
|  | 
 | ||||||
|  | #undef READ_SETTING | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_PRESSURE_SENSOR_OFFSET, uData, sizeof(uData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	// OSTC3 stores the pressureSensorOffset in two-complement
 | ||||||
|  | 	m_deviceDetails->pressureSensorOffset = (signed char)uData[0]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	rc = hw_ostc3_device_config_read(device, OSTC3_TEMP_SENSOR_OFFSET, uData, sizeof(uData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	// OSTC3 stores the tempSensorOffset in two-complement
 | ||||||
|  | 	m_deviceDetails->tempSensorOffset = (signed char)uData[0]; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	//read firmware settings
 | ||||||
|  | 	unsigned char fData[64] = { 0 }; | ||||||
|  | 	rc = hw_ostc3_device_version(device, fData, sizeof(fData)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	int serial = fData[0] + (fData[1] << 8); | ||||||
|  | 	m_deviceDetails->serialNo = QString::number(serial); | ||||||
|  | 	unsigned char X, Y, Z, beta; | ||||||
|  | 	unsigned int firmwareOnDevice = (fData[3] << 8) + fData[2]; | ||||||
|  | 	X = (firmwareOnDevice & 0xF800) >> 11; | ||||||
|  | 	Y = (firmwareOnDevice & 0x07C0) >> 6; | ||||||
|  | 	Z = (firmwareOnDevice & 0x003E) >> 1; | ||||||
|  | 	beta = firmwareOnDevice & 0x0001; | ||||||
|  | 	m_deviceDetails->firmwareVersion = QString("%1.%2.%3%4").arg(X).arg(Y).arg(Z).arg(beta?" beta":""); | ||||||
|  | 	QByteArray ar((char *)fData + 4, 60); | ||||||
|  | 	m_deviceDetails->customText = ar.trimmed(); | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
| 	return rc; | 	return rc; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_deviceDetails, dc_event_callback_t progress_cb, void *userdata) | static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_deviceDetails, dc_event_callback_t progress_cb, void *userdata) | ||||||
| { | { | ||||||
|  | 	// This code is really similar to the OSTC3 code, but there are minor
 | ||||||
|  | 	// differences in what the data means, and how to communicate with the
 | ||||||
|  | 	// device. If anyone can find a good way to harmonize the two, be my guest.
 | ||||||
| 	dc_status_t rc = DC_STATUS_SUCCESS; | 	dc_status_t rc = DC_STATUS_SUCCESS; | ||||||
| 	dc_event_progress_t progress; | 	dc_event_progress_t progress; | ||||||
| 	progress.current = 0; | 	progress.current = 0; | ||||||
| 	progress.maximum = 1; | 	progress.maximum = 18; | ||||||
|  | 
 | ||||||
|  | 	//write gas values
 | ||||||
|  | 	unsigned char gas1Data[4] = { | ||||||
|  | 		m_deviceDetails->gas1.oxygen, | ||||||
|  | 		m_deviceDetails->gas1.helium, | ||||||
|  | 		m_deviceDetails->gas1.type, | ||||||
|  | 		m_deviceDetails->gas1.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char gas2Data[4] = { | ||||||
|  | 		m_deviceDetails->gas2.oxygen, | ||||||
|  | 		m_deviceDetails->gas2.helium, | ||||||
|  | 		m_deviceDetails->gas2.type, | ||||||
|  | 		m_deviceDetails->gas2.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char gas3Data[4] = { | ||||||
|  | 		m_deviceDetails->gas3.oxygen, | ||||||
|  | 		m_deviceDetails->gas3.helium, | ||||||
|  | 		m_deviceDetails->gas3.type, | ||||||
|  | 		m_deviceDetails->gas3.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char gas4Data[4] = { | ||||||
|  | 		m_deviceDetails->gas4.oxygen, | ||||||
|  | 		m_deviceDetails->gas4.helium, | ||||||
|  | 		m_deviceDetails->gas4.type, | ||||||
|  | 		m_deviceDetails->gas4.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char gas5Data[4] = { | ||||||
|  | 		m_deviceDetails->gas5.oxygen, | ||||||
|  | 		m_deviceDetails->gas5.helium, | ||||||
|  | 		m_deviceDetails->gas5.type, | ||||||
|  | 		m_deviceDetails->gas5.depth | ||||||
|  | 	}; | ||||||
|  | 	//gas 1
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_GAS1, gas1Data, sizeof(gas1Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//gas 2
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_GAS2, gas2Data, sizeof(gas2Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//gas 3
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_GAS3, gas3Data, sizeof(gas3Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//gas 4
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_GAS4, gas4Data, sizeof(gas4Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//gas 5
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_GAS5, gas5Data, sizeof(gas5Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	//write setpoint values
 | ||||||
|  | 	unsigned char sp1Data[4] = { | ||||||
|  | 		m_deviceDetails->sp1.sp, | ||||||
|  | 		m_deviceDetails->sp1.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char sp2Data[4] = { | ||||||
|  | 		m_deviceDetails->sp2.sp, | ||||||
|  | 		m_deviceDetails->sp2.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char sp3Data[4] = { | ||||||
|  | 		m_deviceDetails->sp3.sp, | ||||||
|  | 		m_deviceDetails->sp3.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char sp4Data[4] = { | ||||||
|  | 		m_deviceDetails->sp4.sp, | ||||||
|  | 		m_deviceDetails->sp4.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char sp5Data[4] = { | ||||||
|  | 		m_deviceDetails->sp5.sp, | ||||||
|  | 		m_deviceDetails->sp5.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	//sp 1
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_SP1, sp1Data, sizeof(sp1Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//sp 2
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_SP2, sp2Data, sizeof(sp2Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//sp 3
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_SP3, sp3Data, sizeof(sp3Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//sp 4
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_SP4, sp4Data, sizeof(sp4Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//sp 5
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_SP5, sp5Data, sizeof(sp5Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	//write dil values
 | ||||||
|  | 	unsigned char dil1Data[4] = { | ||||||
|  | 		m_deviceDetails->dil1.oxygen, | ||||||
|  | 		m_deviceDetails->dil1.helium, | ||||||
|  | 		m_deviceDetails->dil1.type, | ||||||
|  | 		m_deviceDetails->dil1.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char dil2Data[4] = { | ||||||
|  | 		m_deviceDetails->dil2.oxygen, | ||||||
|  | 		m_deviceDetails->dil2.helium, | ||||||
|  | 		m_deviceDetails->dil2.type, | ||||||
|  | 		m_deviceDetails->dil2.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char dil3Data[4] = { | ||||||
|  | 		m_deviceDetails->dil3.oxygen, | ||||||
|  | 		m_deviceDetails->dil3.helium, | ||||||
|  | 		m_deviceDetails->dil3.type, | ||||||
|  | 		m_deviceDetails->dil3.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char dil4Data[4] = { | ||||||
|  | 		m_deviceDetails->dil4.oxygen, | ||||||
|  | 		m_deviceDetails->dil4.helium, | ||||||
|  | 		m_deviceDetails->dil4.type, | ||||||
|  | 		m_deviceDetails->dil4.depth | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	unsigned char dil5Data[4] = { | ||||||
|  | 		m_deviceDetails->dil5.oxygen, | ||||||
|  | 		m_deviceDetails->dil5.helium, | ||||||
|  | 		m_deviceDetails->dil5.type, | ||||||
|  | 		m_deviceDetails->dil5.depth | ||||||
|  | 	}; | ||||||
|  | 	//dil 1
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_DIL1, dil1Data, sizeof(gas1Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//dil 2
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_DIL2, dil2Data, sizeof(dil2Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//dil 3
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_DIL3, dil3Data, sizeof(dil3Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//dil 4
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_DIL4, dil4Data, sizeof(dil4Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 	//dil 5
 | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_DIL5, dil5Data, sizeof(dil5Data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	//write general settings
 | ||||||
|  | 	//custom text
 | ||||||
|  | 	rc = hw_ostc3_device_customtext(device, m_deviceDetails->customText.toUtf8().data()); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	unsigned char data[4] = { 0 }; | ||||||
|  | #define WRITE_SETTING(_OSTC4_SETTING, _DEVICE_DETAIL)                                          \ | ||||||
|  | 	do {                                                                                   \ | ||||||
|  | 		data[0] = m_deviceDetails->_DEVICE_DETAIL;                                     \ | ||||||
|  | 		rc = hw_ostc3_device_config_write(device, _OSTC4_SETTING, data, sizeof(data)); \ | ||||||
|  | 		if (rc != DC_STATUS_SUCCESS)                                                   \ | ||||||
|  | 			return rc;                                                             \ | ||||||
|  | 		EMIT_PROGRESS();                                                               \ | ||||||
|  | 	} while (0) | ||||||
|  | 
 | ||||||
|  | #undef WRITE_SETTING | ||||||
|  | 
 | ||||||
|  | 	// OSTC3 stores the pressureSensorOffset in two-complement
 | ||||||
|  | 	data[0] = (unsigned char)m_deviceDetails->pressureSensorOffset; | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 	// OSTC3 stores the tempSensorOffset in two-complement
 | ||||||
|  | 	data[0] = (unsigned char)m_deviceDetails->tempSensorOffset; | ||||||
|  | 	rc = hw_ostc3_device_config_write(device, OSTC3_TEMP_SENSOR_OFFSET, data, sizeof(data)); | ||||||
|  | 	if (rc != DC_STATUS_SUCCESS) | ||||||
|  | 		return rc; | ||||||
|  | 	EMIT_PROGRESS(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	//sync date and time
 | ||||||
|  | 	if (m_deviceDetails->syncTime) { | ||||||
|  | 		dc_datetime_t now; | ||||||
|  | 		dc_datetime_localtime(&now, dc_datetime_now()); | ||||||
|  | 
 | ||||||
|  | 		rc = hw_ostc3_device_clock(device, &now); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	EMIT_PROGRESS(); | 	EMIT_PROGRESS(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -790,6 +790,152 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper() | ||||||
| 
 | 
 | ||||||
| void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC4() | void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC4() | ||||||
| { | { | ||||||
|  | 	deviceDetails->customText = ui.customTextLlineEdit_4->text(); | ||||||
|  | 	deviceDetails->diveMode = ui.diveModeComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->saturation = ui.saturationSpinBox_4->value(); | ||||||
|  | 	deviceDetails->desaturation = ui.desaturationSpinBox_4->value(); | ||||||
|  | 	deviceDetails->lastDeco = ui.lastDecoSpinBox_4->value(); | ||||||
|  | 	deviceDetails->brightness = ui.brightnessComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->units = ui.unitsComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->samplingRate = ui.samplingRateComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->salinity = ui.salinitySpinBox_4->value(); | ||||||
|  | 	deviceDetails->diveModeColor = ui.diveModeColour_4->currentIndex(); | ||||||
|  | 	deviceDetails->language = ui.languageComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->dateFormat = ui.dateFormatComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->compassGain = ui.compassGainComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->syncTime = ui.dateTimeSyncCheckBox_4->isChecked(); | ||||||
|  | 	deviceDetails->safetyStop = ui.safetyStopCheckBox_4->isChecked(); | ||||||
|  | 	deviceDetails->gfHigh = ui.gfHighSpinBox_4->value(); | ||||||
|  | 	deviceDetails->gfLow = ui.gfLowSpinBox_4->value(); | ||||||
|  | 	deviceDetails->pressureSensorOffset = ui.pressureSensorOffsetSpinBox_4->value(); | ||||||
|  | 	deviceDetails->ppO2Min = ui.ppO2MinSpinBox_4->value(); | ||||||
|  | 	deviceDetails->ppO2Max = ui.ppO2MaxSpinBox_4->value(); | ||||||
|  | 	deviceDetails->futureTTS = ui.futureTTSSpinBox_4->value(); | ||||||
|  | 	deviceDetails->ccrMode = ui.ccrModeComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->decoType = ui.decoTypeComboBox_4->currentIndex(); | ||||||
|  | 	deviceDetails->aGFSelectable = ui.aGFSelectableCheckBox_4->isChecked(); | ||||||
|  | 	deviceDetails->aGFHigh = ui.aGFHighSpinBox_4->value(); | ||||||
|  | 	deviceDetails->aGFLow = ui.aGFLowSpinBox_4->value(); | ||||||
|  | 	deviceDetails->calibrationGas = ui.calibrationGasSpinBox_4->value(); | ||||||
|  | 	deviceDetails->flipScreen = ui.flipScreenCheckBox_4->isChecked(); | ||||||
|  | 	deviceDetails->setPointFallback = ui.setPointFallbackCheckBox_4->isChecked(); | ||||||
|  | 	deviceDetails->leftButtonSensitivity = ui.leftButtonSensitivity_4->value(); | ||||||
|  | 	deviceDetails->rightButtonSensitivity = ui.rightButtonSensitivity_4->value(); | ||||||
|  | 	deviceDetails->bottomGasConsumption = ui.bottomGasConsumption_4->value(); | ||||||
|  | 	deviceDetails->decoGasConsumption = ui.decoGasConsumption_4->value(); | ||||||
|  | 	deviceDetails->modWarning = ui.modWarning_4->isChecked(); | ||||||
|  | 	deviceDetails->dynamicAscendRate = ui.dynamicAscendRate_4->isChecked(); | ||||||
|  | 	deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator_4->isChecked(); | ||||||
|  | 	deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2_4->isChecked(); | ||||||
|  | 	deviceDetails->tempSensorOffset = lrint(ui.tempSensorOffsetDoubleSpinBox_4->value() * 10); | ||||||
|  | 	deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox_4->value(); | ||||||
|  | 	deviceDetails->safetyStopStartDepth = lrint(ui.safetyStopStartDepthDoubleSpinBox_4->value() * 10); | ||||||
|  | 	deviceDetails->safetyStopEndDepth = lrint(ui.safetyStopEndDepthDoubleSpinBox_4->value() * 10); | ||||||
|  | 	deviceDetails->safetyStopResetDepth = lrint(ui.safetyStopResetDepthDoubleSpinBox_4->value() * 10); | ||||||
|  | 
 | ||||||
|  | 	//set gas values
 | ||||||
|  | 	gas gas1; | ||||||
|  | 	gas gas2; | ||||||
|  | 	gas gas3; | ||||||
|  | 	gas gas4; | ||||||
|  | 	gas gas5; | ||||||
|  | 
 | ||||||
|  | 	gas1.oxygen = GET_INT_FROM(ui.ostc4GasTable->item(0, 1), 21); | ||||||
|  | 	gas1.helium = GET_INT_FROM(ui.ostc4GasTable->item(0, 2), 0); | ||||||
|  | 	gas1.type = GET_INT_FROM(ui.ostc4GasTable->item(0, 3), 0); | ||||||
|  | 	gas1.depth = GET_INT_FROM(ui.ostc4GasTable->item(0, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	gas2.oxygen = GET_INT_FROM(ui.ostc4GasTable->item(1, 1), 21); | ||||||
|  | 	gas2.helium = GET_INT_FROM(ui.ostc4GasTable->item(1, 2), 0); | ||||||
|  | 	gas2.type = GET_INT_FROM(ui.ostc4GasTable->item(1, 3), 0); | ||||||
|  | 	gas2.depth = GET_INT_FROM(ui.ostc4GasTable->item(1, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	gas3.oxygen = GET_INT_FROM(ui.ostc4GasTable->item(2, 1), 21); | ||||||
|  | 	gas3.helium = GET_INT_FROM(ui.ostc4GasTable->item(2, 2), 0); | ||||||
|  | 	gas3.type = GET_INT_FROM(ui.ostc4GasTable->item(2, 3), 0); | ||||||
|  | 	gas3.depth = GET_INT_FROM(ui.ostc4GasTable->item(2, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	gas4.oxygen = GET_INT_FROM(ui.ostc4GasTable->item(3, 1), 21); | ||||||
|  | 	gas4.helium = GET_INT_FROM(ui.ostc4GasTable->item(3, 2), 0); | ||||||
|  | 	gas4.type = GET_INT_FROM(ui.ostc4GasTable->item(3, 3), 0); | ||||||
|  | 	gas4.depth = GET_INT_FROM(ui.ostc4GasTable->item(3, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	gas5.oxygen = GET_INT_FROM(ui.ostc4GasTable->item(4, 1), 21); | ||||||
|  | 	gas5.helium = GET_INT_FROM(ui.ostc4GasTable->item(4, 2), 0); | ||||||
|  | 	gas5.type = GET_INT_FROM(ui.ostc4GasTable->item(4, 3), 0); | ||||||
|  | 	gas5.depth = GET_INT_FROM(ui.ostc4GasTable->item(4, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	deviceDetails->gas1 = gas1; | ||||||
|  | 	deviceDetails->gas2 = gas2; | ||||||
|  | 	deviceDetails->gas3 = gas3; | ||||||
|  | 	deviceDetails->gas4 = gas4; | ||||||
|  | 	deviceDetails->gas5 = gas5; | ||||||
|  | 
 | ||||||
|  | 	//set dil values
 | ||||||
|  | 	gas dil1; | ||||||
|  | 	gas dil2; | ||||||
|  | 	gas dil3; | ||||||
|  | 	gas dil4; | ||||||
|  | 	gas dil5; | ||||||
|  | 
 | ||||||
|  | 	dil1.oxygen = GET_INT_FROM(ui.ostc4DilTable->item(0, 1), 21); | ||||||
|  | 	dil1.helium = GET_INT_FROM(ui.ostc4DilTable->item(0, 2), 0); | ||||||
|  | 	dil1.type = GET_INT_FROM(ui.ostc4DilTable->item(0, 3), 0); | ||||||
|  | 	dil1.depth = GET_INT_FROM(ui.ostc4DilTable->item(0, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	dil2.oxygen = GET_INT_FROM(ui.ostc4DilTable->item(1, 1), 21); | ||||||
|  | 	dil2.helium = GET_INT_FROM(ui.ostc4DilTable->item(1, 2), 0); | ||||||
|  | 	dil2.type = GET_INT_FROM(ui.ostc4DilTable->item(1, 3), 0); | ||||||
|  | 	dil2.depth = GET_INT_FROM(ui.ostc4DilTable->item(1, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	dil3.oxygen = GET_INT_FROM(ui.ostc4DilTable->item(2, 1), 21); | ||||||
|  | 	dil3.helium = GET_INT_FROM(ui.ostc4DilTable->item(2, 2), 0); | ||||||
|  | 	dil3.type = GET_INT_FROM(ui.ostc4DilTable->item(2, 4), 0); | ||||||
|  | 	dil3.depth = GET_INT_FROM(ui.ostc4DilTable->item(2, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	dil4.oxygen = GET_INT_FROM(ui.ostc4DilTable->item(3, 1), 21); | ||||||
|  | 	dil4.helium = GET_INT_FROM(ui.ostc4DilTable->item(3, 2), 0); | ||||||
|  | 	dil4.type = GET_INT_FROM(ui.ostc4DilTable->item(3, 3), 0); | ||||||
|  | 	dil4.depth = GET_INT_FROM(ui.ostc4DilTable->item(3, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	dil5.oxygen = GET_INT_FROM(ui.ostc4DilTable->item(4, 1), 21); | ||||||
|  | 	dil5.helium = GET_INT_FROM(ui.ostc4DilTable->item(4, 2), 0); | ||||||
|  | 	dil5.type = GET_INT_FROM(ui.ostc4DilTable->item(4, 3), 0); | ||||||
|  | 	dil5.depth = GET_INT_FROM(ui.ostc4DilTable->item(4, 4), 0); | ||||||
|  | 
 | ||||||
|  | 	deviceDetails->dil1 = dil1; | ||||||
|  | 	deviceDetails->dil2 = dil2; | ||||||
|  | 	deviceDetails->dil3 = dil3; | ||||||
|  | 	deviceDetails->dil4 = dil4; | ||||||
|  | 	deviceDetails->dil5 = dil5; | ||||||
|  | 
 | ||||||
|  | 	//set setpoint details
 | ||||||
|  | 	setpoint sp1; | ||||||
|  | 	setpoint sp2; | ||||||
|  | 	setpoint sp3; | ||||||
|  | 	setpoint sp4; | ||||||
|  | 	setpoint sp5; | ||||||
|  | 
 | ||||||
|  | 	sp1.sp = GET_INT_FROM(ui.ostc4SetPointTable->item(0, 1), 70); | ||||||
|  | 	sp1.depth = GET_INT_FROM(ui.ostc4SetPointTable->item(0, 2), 0); | ||||||
|  | 
 | ||||||
|  | 	sp2.sp = GET_INT_FROM(ui.ostc4SetPointTable->item(1, 1), 90); | ||||||
|  | 	sp2.depth = GET_INT_FROM(ui.ostc4SetPointTable->item(1, 2), 20); | ||||||
|  | 
 | ||||||
|  | 	sp3.sp = GET_INT_FROM(ui.ostc4SetPointTable->item(2, 1), 100); | ||||||
|  | 	sp3.depth = GET_INT_FROM(ui.ostc4SetPointTable->item(2, 2), 44); | ||||||
|  | 
 | ||||||
|  | 	sp4.sp = GET_INT_FROM(ui.ostc4SetPointTable->item(3, 1), 120); | ||||||
|  | 	sp4.depth = GET_INT_FROM(ui.ostc4SetPointTable->item(3, 2), 50); | ||||||
|  | 
 | ||||||
|  | 	sp5.sp = GET_INT_FROM(ui.ostc4SetPointTable->item(4, 1), 140); | ||||||
|  | 	sp5.depth = GET_INT_FROM(ui.ostc4SetPointTable->item(4, 2), 70); | ||||||
|  | 
 | ||||||
|  | 	deviceDetails->sp1 = sp1; | ||||||
|  | 	deviceDetails->sp2 = sp2; | ||||||
|  | 	deviceDetails->sp3 = sp3; | ||||||
|  | 	deviceDetails->sp4 = sp4; | ||||||
|  | 	deviceDetails->sp5 = sp5; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfigureDiveComputerDialog::readSettings() | void ConfigureDiveComputerDialog::readSettings() | ||||||
|  | @ -1161,6 +1307,130 @@ void ConfigureDiveComputerDialog::reloadValuesSuuntoVyper() | ||||||
| 
 | 
 | ||||||
| void ConfigureDiveComputerDialog::reloadValuesOSTC4() | void ConfigureDiveComputerDialog::reloadValuesOSTC4() | ||||||
| { | { | ||||||
|  | 	ui.serialNoLineEdit_4->setText(deviceDetails->serialNo); | ||||||
|  | 	ui.firmwareVersionLineEdit_4->setText(deviceDetails->firmwareVersion); | ||||||
|  | 	ui.customTextLlineEdit_4->setText(deviceDetails->customText); | ||||||
|  | 	ui.modelLineEdit_4->setText(deviceDetails->model); | ||||||
|  | 	ui.diveModeComboBox_4->setCurrentIndex(deviceDetails->diveMode); | ||||||
|  | 	ui.saturationSpinBox_4->setValue(deviceDetails->saturation); | ||||||
|  | 	ui.desaturationSpinBox_4->setValue(deviceDetails->desaturation); | ||||||
|  | 	ui.lastDecoSpinBox_4->setValue(deviceDetails->lastDeco); | ||||||
|  | 	ui.brightnessComboBox_4->setCurrentIndex(deviceDetails->brightness); | ||||||
|  | 	ui.unitsComboBox_4->setCurrentIndex(deviceDetails->units); | ||||||
|  | 	ui.samplingRateComboBox_4->setCurrentIndex(deviceDetails->samplingRate); | ||||||
|  | 	ui.salinitySpinBox_4->setValue(deviceDetails->salinity); | ||||||
|  | 	ui.diveModeColour_4->setCurrentIndex(deviceDetails->diveModeColor); | ||||||
|  | 	ui.languageComboBox_4->setCurrentIndex(deviceDetails->language); | ||||||
|  | 	ui.dateFormatComboBox_4->setCurrentIndex(deviceDetails->dateFormat); | ||||||
|  | 	ui.compassGainComboBox_4->setCurrentIndex(deviceDetails->compassGain); | ||||||
|  | 	ui.safetyStopCheckBox_4->setChecked(deviceDetails->safetyStop); | ||||||
|  | 	ui.gfHighSpinBox_4->setValue(deviceDetails->gfHigh); | ||||||
|  | 	ui.gfLowSpinBox_4->setValue(deviceDetails->gfLow); | ||||||
|  | 	ui.pressureSensorOffsetSpinBox_4->setValue(deviceDetails->pressureSensorOffset); | ||||||
|  | 	ui.ppO2MinSpinBox_4->setValue(deviceDetails->ppO2Min); | ||||||
|  | 	ui.ppO2MaxSpinBox_4->setValue(deviceDetails->ppO2Max); | ||||||
|  | 	ui.futureTTSSpinBox_4->setValue(deviceDetails->futureTTS); | ||||||
|  | 	ui.ccrModeComboBox_4->setCurrentIndex(deviceDetails->ccrMode); | ||||||
|  | 	ui.decoTypeComboBox_4->setCurrentIndex(deviceDetails->decoType); | ||||||
|  | 	ui.aGFSelectableCheckBox_4->setChecked(deviceDetails->aGFSelectable); | ||||||
|  | 	ui.aGFHighSpinBox_4->setValue(deviceDetails->aGFHigh); | ||||||
|  | 	ui.aGFLowSpinBox_4->setValue(deviceDetails->aGFLow); | ||||||
|  | 	ui.calibrationGasSpinBox_4->setValue(deviceDetails->calibrationGas); | ||||||
|  | 	ui.flipScreenCheckBox_4->setChecked(deviceDetails->flipScreen); | ||||||
|  | 	ui.setPointFallbackCheckBox_4->setChecked(deviceDetails->setPointFallback); | ||||||
|  | 	ui.leftButtonSensitivity_4->setValue(deviceDetails->leftButtonSensitivity); | ||||||
|  | 	ui.rightButtonSensitivity_4->setValue(deviceDetails->rightButtonSensitivity); | ||||||
|  | 	ui.bottomGasConsumption_4->setValue(deviceDetails->bottomGasConsumption); | ||||||
|  | 	ui.decoGasConsumption_4->setValue(deviceDetails->decoGasConsumption); | ||||||
|  | 	ui.modWarning_4->setChecked(deviceDetails->modWarning); | ||||||
|  | 	ui.dynamicAscendRate_4->setChecked(deviceDetails->dynamicAscendRate); | ||||||
|  | 	ui.graphicalSpeedIndicator_4->setChecked(deviceDetails->graphicalSpeedIndicator); | ||||||
|  | 	ui.alwaysShowppO2_4->setChecked(deviceDetails->alwaysShowppO2); | ||||||
|  | 	ui.tempSensorOffsetDoubleSpinBox_4->setValue((double)deviceDetails->tempSensorOffset / 10.0); | ||||||
|  | 	ui.safetyStopLengthSpinBox_4->setValue(deviceDetails->safetyStopLength); | ||||||
|  | 	ui.safetyStopStartDepthDoubleSpinBox_4->setValue(deviceDetails->safetyStopStartDepth / 10.0); | ||||||
|  | 	ui.safetyStopEndDepthDoubleSpinBox_4->setValue(deviceDetails->safetyStopEndDepth / 10.0); | ||||||
|  | 	ui.safetyStopResetDepthDoubleSpinBox_4->setValue(deviceDetails->safetyStopResetDepth / 10.0); | ||||||
|  | 
 | ||||||
|  | 	//load gas 1 values
 | ||||||
|  | 	ui.ostc4GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen))); | ||||||
|  | 	ui.ostc4GasTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->gas1.helium))); | ||||||
|  | 	ui.ostc4GasTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1.type))); | ||||||
|  | 	ui.ostc4GasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load gas 2 values
 | ||||||
|  | 	ui.ostc4GasTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->gas2.oxygen))); | ||||||
|  | 	ui.ostc4GasTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2.helium))); | ||||||
|  | 	ui.ostc4GasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2.type))); | ||||||
|  | 	ui.ostc4GasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load gas 3 values
 | ||||||
|  | 	ui.ostc4GasTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->gas3.oxygen))); | ||||||
|  | 	ui.ostc4GasTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3.helium))); | ||||||
|  | 	ui.ostc4GasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3.type))); | ||||||
|  | 	ui.ostc4GasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load gas 4 values
 | ||||||
|  | 	ui.ostc4GasTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->gas4.oxygen))); | ||||||
|  | 	ui.ostc4GasTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4.helium))); | ||||||
|  | 	ui.ostc4GasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4.type))); | ||||||
|  | 	ui.ostc4GasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load gas 5 values
 | ||||||
|  | 	ui.ostc4GasTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->gas5.oxygen))); | ||||||
|  | 	ui.ostc4GasTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5.helium))); | ||||||
|  | 	ui.ostc4GasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5.type))); | ||||||
|  | 	ui.ostc4GasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load dil 1 values
 | ||||||
|  | 	ui.ostc4DilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1.oxygen))); | ||||||
|  | 	ui.ostc4DilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1.helium))); | ||||||
|  | 	ui.ostc4DilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1.type))); | ||||||
|  | 	ui.ostc4DilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load dil 2 values
 | ||||||
|  | 	ui.ostc4DilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2.oxygen))); | ||||||
|  | 	ui.ostc4DilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2.helium))); | ||||||
|  | 	ui.ostc4DilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2.type))); | ||||||
|  | 	ui.ostc4DilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load dil 3 values
 | ||||||
|  | 	ui.ostc4DilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3.oxygen))); | ||||||
|  | 	ui.ostc4DilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3.helium))); | ||||||
|  | 	ui.ostc4DilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3.type))); | ||||||
|  | 	ui.ostc4DilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load dil 4 values
 | ||||||
|  | 	ui.ostc4DilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4.oxygen))); | ||||||
|  | 	ui.ostc4DilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4.helium))); | ||||||
|  | 	ui.ostc4DilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4.type))); | ||||||
|  | 	ui.ostc4DilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load dil 5 values
 | ||||||
|  | 	ui.ostc4DilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5.oxygen))); | ||||||
|  | 	ui.ostc4DilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5.helium))); | ||||||
|  | 	ui.ostc4DilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5.type))); | ||||||
|  | 	ui.ostc4DilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load setpoint 1 values
 | ||||||
|  | 	ui.ostc4SetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1.sp))); | ||||||
|  | 	ui.ostc4SetPointTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->sp1.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load setpoint 2 values
 | ||||||
|  | 	ui.ostc4SetPointTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->sp2.sp))); | ||||||
|  | 	ui.ostc4SetPointTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->sp2.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load setpoint 4 values
 | ||||||
|  | 	ui.ostc4SetPointTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->sp3.sp))); | ||||||
|  | 	ui.ostc4SetPointTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->sp3.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load setpoint 4 values
 | ||||||
|  | 	ui.ostc4SetPointTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->sp4.sp))); | ||||||
|  | 	ui.ostc4SetPointTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->sp4.depth))); | ||||||
|  | 
 | ||||||
|  | 	//load setpoint 5 values
 | ||||||
|  | 	ui.ostc4SetPointTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->sp5.sp))); | ||||||
|  | 	ui.ostc4SetPointTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->sp5.depth))); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfigureDiveComputerDialog::on_backupButton_clicked() | void ConfigureDiveComputerDialog::on_backupButton_clicked() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue