mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Improve writing of date and time to dive computer
Improves writing of date and time to the dive computer. This has been tested using the Heinrichs Weikamp OSTC-3. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
		
							parent
							
								
									a08d239af5
								
							
						
					
					
						commit
						ee2403d63c
					
				
					 1 changed files with 16 additions and 3 deletions
				
			
		| 
						 | 
					@ -125,8 +125,7 @@ void WriteSettingsThread::run()
 | 
				
			||||||
				result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data());
 | 
									result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if ( dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3 && m_settingName == "DateTime" ) {
 | 
							if (m_settingName == "DateAndTime") {
 | 
				
			||||||
			supported = true;
 | 
					 | 
				
			||||||
			QDateTime timeToSet = m_settingValue.toDateTime();
 | 
								QDateTime timeToSet = m_settingValue.toDateTime();
 | 
				
			||||||
			dc_datetime_t time;
 | 
								dc_datetime_t time;
 | 
				
			||||||
			time.year = timeToSet.date().year();
 | 
								time.year = timeToSet.date().year();
 | 
				
			||||||
| 
						 | 
					@ -135,7 +134,21 @@ void WriteSettingsThread::run()
 | 
				
			||||||
			time.hour = timeToSet.time().hour();
 | 
								time.hour = timeToSet.time().hour();
 | 
				
			||||||
			time.minute = timeToSet.time().minute();
 | 
								time.minute = timeToSet.time().minute();
 | 
				
			||||||
			time.second = timeToSet.time().second();
 | 
								time.second = timeToSet.time().second();
 | 
				
			||||||
			result = hw_ostc_device_clock(data->device, &time); //Toto fix error here
 | 
					
 | 
				
			||||||
 | 
								switch (dc_device_get_type(data->device)) {
 | 
				
			||||||
 | 
								case DC_FAMILY_HW_OSTC3:
 | 
				
			||||||
 | 
									supported = true;
 | 
				
			||||||
 | 
									result = hw_ostc3_device_clock(data->device, &time);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case DC_FAMILY_HW_OSTC:
 | 
				
			||||||
 | 
									supported = true;
 | 
				
			||||||
 | 
									result = hw_ostc_device_clock(data->device, &time);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case DC_FAMILY_HW_FROG:
 | 
				
			||||||
 | 
									supported = true;
 | 
				
			||||||
 | 
									result = hw_frog_device_clock(data->device, &time);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (result !=  DC_STATUS_SUCCESS) {
 | 
							if (result !=  DC_STATUS_SUCCESS) {
 | 
				
			||||||
			qDebug() << result;
 | 
								qDebug() << result;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue