mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Partial revert of commit 6cf3787a0e
				
					
				
			Commit 6cf3787a0e ("Remove code that zeroes out duplicate oxygen sensor
and temperature values") incorrectly removes the code that zeroes out the
temperatures.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
			
			
This commit is contained in:
		
							parent
							
								
									cef150d7dc
								
							
						
					
					
						commit
						d1af75357d
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		
							
								
								
									
										11
									
								
								dive.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								dive.c
									
										
									
									
									
								
							|  | @ -1183,6 +1183,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) | ||||||
| 	int maxdepth = dc->maxdepth.mm; | 	int maxdepth = dc->maxdepth.mm; | ||||||
| 	int mintemp = 0; | 	int mintemp = 0; | ||||||
| 	int lastdepth = 0; | 	int lastdepth = 0; | ||||||
|  | 	int lasttemp = 0; | ||||||
| 	int lastpressure = 0, lasto2pressure = 0; | 	int lastpressure = 0, lasto2pressure = 0; | ||||||
| 	int pressure_delta[MAX_CYLINDERS] = { INT_MAX, }; | 	int pressure_delta[MAX_CYLINDERS] = { INT_MAX, }; | ||||||
| 	int first_cylinder; | 	int first_cylinder; | ||||||
|  | @ -1247,6 +1248,16 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) | ||||||
| 			fixup_pressure(dive, sample, OXYGEN); | 			fixup_pressure(dive, sample, OXYGEN); | ||||||
| 
 | 
 | ||||||
| 		if (temp) { | 		if (temp) { | ||||||
|  | 			/*
 | ||||||
|  | 			 * If we have consecutive identical | ||||||
|  | 			 * temperature readings, throw away | ||||||
|  | 			 * the redundant ones. | ||||||
|  | 			 */ | ||||||
|  | 			if (lasttemp == temp) | ||||||
|  | 				sample->temperature.mkelvin = 0; | ||||||
|  | 			else | ||||||
|  | 				lasttemp = temp; | ||||||
|  | 
 | ||||||
| 			if (!mintemp || temp < mintemp) | 			if (!mintemp || temp < mintemp) | ||||||
| 				mintemp = temp; | 				mintemp = temp; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue