mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix DM4/DM5 import
The implementation of import for DM5 removed the profileBlob from SQL query, thus breaking the backward compatibility on import of old dives. Need to have bot profile and sample blobs within the query... Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
aa22e0610c
commit
7bc5a62ca1
1 changed files with 2 additions and 2 deletions
|
@ -2081,7 +2081,7 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
|
|||
cur_dive->dc.surface_pressure.mbar = (atoi(data[14]) * 1000);
|
||||
|
||||
interval = data[16] ? atoi(data[16]) : 0;
|
||||
sampleBlob = (unsigned const char *)data[17];
|
||||
sampleBlob = (unsigned const char *)data[24];
|
||||
for (i = 0; interval && sampleBlob && i * interval < cur_dive->duration.seconds; i++) {
|
||||
float *depth = (float *)&sampleBlob[i * 16 + 3];
|
||||
int32_t temp = (sampleBlob[i * 16 + 10] << 8) + sampleBlob[i * 16 + 11];
|
||||
|
@ -2180,7 +2180,7 @@ int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buffer, int s
|
|||
|
||||
/* StartTime is converted from Suunto's nano seconds to standard
|
||||
* time. We also need epoch, not seconds since year 1. */
|
||||
char get_dives[] = "select D.DiveId,StartTime/10000000-62135596800,Note,Duration,SourceSerialNumber,Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,D.StartPressure,D.EndPressure,Size,CylinderWorkPressure,SurfacePressure,DiveTime,SampleInterval,SampleBlob,TemperatureBlob,PressureBlob,Oxygen,Helium,MIX.StartPressure,MIX.EndPressure FROM Dive AS D JOIN DiveMixture AS MIX ON D.DiveId=MIX.DiveId";
|
||||
char get_dives[] = "select D.DiveId,StartTime/10000000-62135596800,Note,Duration,SourceSerialNumber,Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,D.StartPressure,D.EndPressure,Size,CylinderWorkPressure,SurfacePressure,DiveTime,SampleInterval,ProfileBlob,TemperatureBlob,PressureBlob,Oxygen,Helium,MIX.StartPressure,MIX.EndPressure,SampleBlob FROM Dive AS D JOIN DiveMixture AS MIX ON D.DiveId=MIX.DiveId";
|
||||
|
||||
retval = sqlite3_exec(handle, get_dives, &dm5_dive, handle, &err);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue