pi_sensor 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -102,12 +102,12 @@ module PiSensor
102
102
 
103
103
  io.mode(@data, INPUT)
104
104
  if io.read(@data) != LOW
105
- raise SensorError, "Sensor should be LOW but isn't"
105
+ raise SensorError, "Sensor measurement confirmation error: data pin should be LOW but isn't."
106
106
  end
107
107
 
108
108
  io.write(@clock, LOW)
109
109
  if io.read(@data) != HIGH
110
- raise SensorError, "Sensor should be HIGH but isn't"
110
+ raise SensorError, "Sensor measurement confirmation error: sensor should be HIGH but isn't."
111
111
  end
112
112
 
113
113
  end
@@ -120,19 +120,16 @@ module PiSensor
120
120
  io.mode(@data, INPUT)
121
121
 
122
122
  # Wait for measurement
123
- puts "Waiting for sensor to take measurement..."
124
123
  1.upto(10) do |i|
125
124
  sleep(0.1)
126
125
  if io.read(@data) == LOW
127
126
  break
128
127
  end
129
128
  end
130
- puts "Data pin LOW, ready to read measurement."
131
129
 
132
130
  # If pin is still high at this point, we've got a problem
133
131
  if io.read(@data) == HIGH
134
- puts "!! Ack Error 3"
135
- exit 0
132
+ raise SensorError, "Sensor measurement failure: sensor not completing measurement in a timely manner."
136
133
  end
137
134
 
138
135
  # Read first 8 bits
@@ -1,3 +1,3 @@
1
1
  module PiSensor
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pi_sensor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: