Skip to content

Commit

Permalink
Record sign of slope, only check abs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurrayufo committed Dec 15, 2017
1 parent f12cbf7 commit d0b4dea
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions InGenStation/code/Sensors/Si7021.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def _conv_temp(self, value):
return (175.72 * value / 65536) - 46.85



@property
def humidity(self):
return (125 * self._humidity / 65536) - 6
Expand All @@ -87,10 +86,10 @@ async def update(self):

# Check the slope of the temperature for sudden changes
delta_t_update = (datetime.datetime.now() - self.last_update).total_seconds()/60
t_slope = abs(self._conv_temp(measured_temperature) - self._conv_temp(self._temperature))/delta_t_update
t_slope = self._conv_temp(measured_temperature) - self._conv_temp(self._temperature)/delta_t_update

self.log.debug(f"Slope measured to be {t_slope:.3f} C/min")
if t_slope > 1:
if abs(t_slope) > 1:
# Slope exceeded 1deg/minute!
self.log.warning(f"Saw excessive slope in temperature. Slope was {t_slope:.3f} C/min. Taking 5 measures and using the median.")

Expand Down

0 comments on commit d0b4dea

Please sign in to comment.