mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Implement saving of OSTC3 Gas Settings
Implements writing OSTC3 gas settings to the device. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
		
							parent
							
								
									8b39d2fc17
								
							
						
					
					
						commit
						a52beebbe9
					
				
					 2 changed files with 75 additions and 1 deletions
				
			
		|  | @ -185,8 +185,44 @@ void WriteSettingsThread::run() | |||
| 		switch (dc_device_get_type(m_data->device)) { | ||||
| 		case DC_FAMILY_HW_OSTC3: | ||||
| 			supported = true; | ||||
| 			//write general settings
 | ||||
| 			//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
 | ||||
| 			hw_ostc3_device_config_write(m_data->device, 0x10, gas1Data, sizeof(gas1Data)); | ||||
| 			//gas 2
 | ||||
| 			hw_ostc3_device_config_write(m_data->device, 0x11, gas2Data, sizeof(gas2Data)); | ||||
| 			//gas 3
 | ||||
| 			hw_ostc3_device_config_write(m_data->device, 0x12, gas3Data, sizeof(gas3Data)); | ||||
| 			//gas 4
 | ||||
| 			hw_ostc3_device_config_write(m_data->device, 0x13, gas4Data, sizeof(gas4Data)); | ||||
| 			//gas 5
 | ||||
| 			hw_ostc3_device_config_write(m_data->device, 0x14, gas5Data, sizeof(gas5Data)); | ||||
| 
 | ||||
| 
 | ||||
| 			//write general settings
 | ||||
| 			//custom text
 | ||||
| 			hw_ostc3_device_customtext(m_data->device, m_deviceDetails->customText().toUtf8().data()); | ||||
| 			unsigned char data[1] = {0}; | ||||
|  |  | |||
|  | @ -129,6 +129,44 @@ void ConfigureDiveComputerDialog::populateDeviceDetails() | |||
| 	deviceDetails->setDateFormat(ui->dateFormatComboBox->currentIndex()); | ||||
| 	deviceDetails->setCompassGain(ui->compassGainComboBox->currentIndex()); | ||||
| 	deviceDetails->setSyncTime(ui->dateTimeSyncCheckBox->isChecked()); | ||||
| 
 | ||||
| 	//set gas values
 | ||||
| 	gas gas1; | ||||
| 	gas gas2; | ||||
| 	gas gas3; | ||||
| 	gas gas4; | ||||
| 	gas gas5; | ||||
| 
 | ||||
| 	gas1.oxygen = ui->ostc3GasTable->item(0, 1)->text().toInt(); | ||||
| 	gas1.helium = ui->ostc3GasTable->item(0, 2)->text().toInt(); | ||||
| 	gas1.type = ui->ostc3GasTable->item(0, 3)->text().toInt(); | ||||
| 	gas1.depth = ui->ostc3GasTable->item(0, 4)->text().toInt(); | ||||
| 
 | ||||
| 	gas2.oxygen = ui->ostc3GasTable->item(1, 1)->text().toInt(); | ||||
| 	gas2.helium = ui->ostc3GasTable->item(1, 2)->text().toInt(); | ||||
| 	gas2.type = ui->ostc3GasTable->item(1, 3)->text().toInt(); | ||||
| 	gas2.depth = ui->ostc3GasTable->item(1, 4)->text().toInt(); | ||||
| 
 | ||||
| 	gas3.oxygen = ui->ostc3GasTable->item(2, 1)->text().toInt(); | ||||
| 	gas3.helium = ui->ostc3GasTable->item(2, 2)->text().toInt(); | ||||
| 	gas3.type = ui->ostc3GasTable->item(2, 3)->text().toInt(); | ||||
| 	gas3.depth = ui->ostc3GasTable->item(2, 4)->text().toInt(); | ||||
| 
 | ||||
| 	gas4.oxygen = ui->ostc3GasTable->item(3, 1)->text().toInt(); | ||||
| 	gas4.helium = ui->ostc3GasTable->item(3, 2)->text().toInt(); | ||||
| 	gas4.type = ui->ostc3GasTable->item(3, 3)->text().toInt(); | ||||
| 	gas4.depth = ui->ostc3GasTable->item(3, 4)->text().toInt(); | ||||
| 
 | ||||
| 	gas5.oxygen = ui->ostc3GasTable->item(4, 1)->text().toInt(); | ||||
| 	gas5.helium = ui->ostc3GasTable->item(4, 2)->text().toInt(); | ||||
| 	gas5.type = ui->ostc3GasTable->item(4, 3)->text().toInt(); | ||||
| 	gas5.depth = ui->ostc3GasTable->item(4, 4)->text().toInt(); | ||||
| 
 | ||||
| 	deviceDetails->setGas1(gas1); | ||||
| 	deviceDetails->setGas2(gas2); | ||||
| 	deviceDetails->setGas3(gas3); | ||||
| 	deviceDetails->setGas4(gas4); | ||||
| 	deviceDetails->setGas5(gas5); | ||||
| } | ||||
| 
 | ||||
| void ConfigureDiveComputerDialog::readSettings() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue