mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Cochran import: Removed long tail of 0 depth from profile
The Cochran logs the first 10 to 20 minutes (configurable) of surface interval in case the diver re-submerges. Signed-off-by: John Van Ostrand <john@vanostrand.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									3ca1191251
								
							
						
					
					
						commit
						40f5e2e30c
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		|  | @ -644,6 +644,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod, | ||||||
| 
 | 
 | ||||||
| 	unsigned int sample_size = size - 0x4914 - config.logbook_size; | 	unsigned int sample_size = size - 0x4914 - config.logbook_size; | ||||||
| 	int g; | 	int g; | ||||||
|  | 	unsigned int sample_pre_offset = 0, sample_end_offset = 0; | ||||||
| 
 | 
 | ||||||
| 	// Decode sample data
 | 	// Decode sample data
 | ||||||
| 	partial_decode(0x4914 + config.logbook_size, size, decode, | 	partial_decode(0x4914 + config.logbook_size, size, decode, | ||||||
|  | @ -715,6 +716,9 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod, | ||||||
| 		if (log[CMD_MAX_DEPTH] == 0xff && log[CMD_MAX_DEPTH + 1] == 0xff) | 		if (log[CMD_MAX_DEPTH] == 0xff && log[CMD_MAX_DEPTH + 1] == 0xff) | ||||||
| 			corrupt_dive = 1; | 			corrupt_dive = 1; | ||||||
| 
 | 
 | ||||||
|  | 		sample_pre_offset = array_uint32_le(log + CMD_PREDIVE_OFFSET); | ||||||
|  | 		sample_end_offset = array_uint32_le(log + CMD_END_OFFSET); | ||||||
|  | 
 | ||||||
| 		break; | 		break; | ||||||
| 	case TYPE_EMC: | 	case TYPE_EMC: | ||||||
| 		dc->model = "EMC"; | 		dc->model = "EMC"; | ||||||
|  | @ -756,9 +760,17 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod, | ||||||
| 		if (log[EMC_MAX_DEPTH] == 0xff && log[EMC_MAX_DEPTH + 1] == 0xff) | 		if (log[EMC_MAX_DEPTH] == 0xff && log[EMC_MAX_DEPTH + 1] == 0xff) | ||||||
| 			corrupt_dive = 1; | 			corrupt_dive = 1; | ||||||
| 
 | 
 | ||||||
|  | 		sample_pre_offset = array_uint32_le(log + EMC_PREDIVE_OFFSET); | ||||||
|  | 		sample_end_offset = array_uint32_le(log + EMC_END_OFFSET); | ||||||
|  | 
 | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// Use the log information to determine actual profile sample size
 | ||||||
|  | 	// Otherwise we will get surface time at end of dive.
 | ||||||
|  | 	if (sample_pre_offset < sample_end_offset && sample_end_offset != 0xffffffff) | ||||||
|  | 		sample_size = sample_end_offset - sample_pre_offset; | ||||||
|  | 
 | ||||||
| 	cochran_parse_samples(dive, buf + 0x4914, buf + 0x4914 | 	cochran_parse_samples(dive, buf + 0x4914, buf + 0x4914 | ||||||
| 		+ config.logbook_size, sample_size, | 		+ config.logbook_size, sample_size, | ||||||
| 		&duration, &max_depth, &avg_depth, &min_temp); | 		&duration, &max_depth, &avg_depth, &min_temp); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue