dht-sensor-ffi 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 63663a39efba0de6467011544ca3d8499c5f1fa2
4
- data.tar.gz: 21385d4745a26aafc4d74f274b30a76938b19bde
2
+ SHA256:
3
+ metadata.gz: afa01bbaf4ac1f3140c5284f3b867697218fef7debcc0eb6c853c35268c82194
4
+ data.tar.gz: 7be56d2508caf4101a56fad6f61d4d6c3c3f7ea10cd1b69213b7918a3d272c62
5
5
  SHA512:
6
- metadata.gz: 855da19dac958998d0cbf31e6d0d8c08911dde129fde7b9832971ba38fb80ffc0cdb3573816fa8050b2b354f4d9a1c6a4d5997a46e6ec83ecaa6fba65cad7ff6
7
- data.tar.gz: ad2dedd47e1af15ab3ae2bde21379bc8fc846e588adbd62b4de57aa9d306ef6f02ef15902deb2f418e29fbdb01b1fab747106a7cb68f624c9b08f3daacc106aa
6
+ metadata.gz: 83dc527d879e5d26d0456a3de6e5cf9139b73166b90d11e66e1ab5a86d38517216c8e2a6b1fdb3a3bad9a1d1612cb32ef09a4883de5080c773d01c367716ecf4
7
+ data.tar.gz: 34f1e206ce12d39dfe43c85b123ad0df2d5fe46ffe67f820ac95367e4c3264fb2fc7ca78431690bdb20f1913e7c8d2788b48c7f560cc943b46c7beee2333e174
data/README.md CHANGED
@@ -27,6 +27,8 @@ val = DhtSensor.read(4, 22) # pin=4, sensor type=DHT-22
27
27
  puts val.temp # => 21.899999618530273 (temp in C)
28
28
  puts val.temp_f # => 71.4199993133545 (temp in F)
29
29
  puts val.humidity # => 22.700000762939453 (relative humidity %)
30
+
31
+ val = DhtSensor.read(4, 22, 10) # 10 retries
30
32
  ```
31
33
 
32
34
  There is also a simple binary for testing purposes
@@ -36,6 +38,8 @@ $ dht_sensor
36
38
  Temperature: 22.40 C Humidity: 26.70%
37
39
  ```
38
40
 
41
+ **Note**: Running as `root` _may_ be required, depending on your configuration. YMMV!
42
+
39
43
  ## Contributing to dht-sensor-ffi
40
44
 
41
45
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -2,21 +2,21 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: dht-sensor-ffi 0.2.0 ruby lib
5
+ # stub: dht-sensor-ffi 0.3.0 ruby lib
6
6
  # stub: ext/extconf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
- s.name = "dht-sensor-ffi"
10
- s.version = "0.2.0"
9
+ s.name = "dht-sensor-ffi".freeze
10
+ s.version = "0.3.0"
11
11
 
12
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
- s.require_paths = ["lib"]
14
- s.authors = ["Chetan Sarva"]
15
- s.date = "2017-01-04"
16
- s.description = "A library to use the DHT-XX type humidity/temperature sensors"
17
- s.email = "chetan@pixelcop.net"
18
- s.executables = ["dht_sensor"]
19
- s.extensions = ["ext/extconf.rb"]
12
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
13
+ s.require_paths = ["lib".freeze]
14
+ s.authors = ["Chetan Sarva".freeze]
15
+ s.date = "2019-11-07"
16
+ s.description = "A library to use the DHT-XX type humidity/temperature sensors".freeze
17
+ s.email = "chetan@pixelcop.net".freeze
18
+ s.executables = ["dht_sensor".freeze]
19
+ s.extensions = ["ext/extconf.rb".freeze]
20
20
  s.extra_rdoc_files = [
21
21
  "LICENSE.txt",
22
22
  "README.md"
@@ -38,36 +38,36 @@ Gem::Specification.new do |s|
38
38
  "test/helper.rb",
39
39
  "test/test_dht-sensor-ffi.rb"
40
40
  ]
41
- s.homepage = "http://github.com/chetan/dht-sensor-ffi"
42
- s.licenses = ["MIT"]
43
- s.rubygems_version = "2.5.1"
44
- s.summary = "A library to use the DHT-XX type humidity/temperature sensors"
41
+ s.homepage = "http://github.com/chetan/dht-sensor-ffi".freeze
42
+ s.licenses = ["MIT".freeze]
43
+ s.rubygems_version = "3.0.2".freeze
44
+ s.summary = "A library to use the DHT-XX type humidity/temperature sensors".freeze
45
45
 
46
46
  if s.respond_to? :specification_version then
47
47
  s.specification_version = 4
48
48
 
49
49
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_runtime_dependency(%q<ffi>, ["~> 1.9"])
51
- s.add_development_dependency(%q<rake>, ["~> 10.3"])
52
- s.add_development_dependency(%q<rake-compiler>, ["~> 0.9"])
53
- s.add_development_dependency(%q<yard>, ["~> 0.8"])
54
- s.add_development_dependency(%q<bundler>, ["~> 1.7"])
55
- s.add_development_dependency(%q<jeweler>, ["~> 2.2"])
50
+ s.add_runtime_dependency(%q<ffi>.freeze, ["~> 1.9"])
51
+ s.add_development_dependency(%q<rake>.freeze, ["~> 10.3"])
52
+ s.add_development_dependency(%q<rake-compiler>.freeze, ["~> 0.9"])
53
+ s.add_development_dependency(%q<yard>.freeze, ["~> 0.8"])
54
+ s.add_development_dependency(%q<bundler>.freeze, ["~> 1.7"])
55
+ s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.2"])
56
56
  else
57
- s.add_dependency(%q<ffi>, ["~> 1.9"])
58
- s.add_dependency(%q<rake>, ["~> 10.3"])
59
- s.add_dependency(%q<rake-compiler>, ["~> 0.9"])
60
- s.add_dependency(%q<yard>, ["~> 0.8"])
61
- s.add_dependency(%q<bundler>, ["~> 1.7"])
62
- s.add_dependency(%q<jeweler>, ["~> 2.2"])
57
+ s.add_dependency(%q<ffi>.freeze, ["~> 1.9"])
58
+ s.add_dependency(%q<rake>.freeze, ["~> 10.3"])
59
+ s.add_dependency(%q<rake-compiler>.freeze, ["~> 0.9"])
60
+ s.add_dependency(%q<yard>.freeze, ["~> 0.8"])
61
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.7"])
62
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.2"])
63
63
  end
64
64
  else
65
- s.add_dependency(%q<ffi>, ["~> 1.9"])
66
- s.add_dependency(%q<rake>, ["~> 10.3"])
67
- s.add_dependency(%q<rake-compiler>, ["~> 0.9"])
68
- s.add_dependency(%q<yard>, ["~> 0.8"])
69
- s.add_dependency(%q<bundler>, ["~> 1.7"])
70
- s.add_dependency(%q<jeweler>, ["~> 2.2"])
65
+ s.add_dependency(%q<ffi>.freeze, ["~> 1.9"])
66
+ s.add_dependency(%q<rake>.freeze, ["~> 10.3"])
67
+ s.add_dependency(%q<rake-compiler>.freeze, ["~> 0.9"])
68
+ s.add_dependency(%q<yard>.freeze, ["~> 0.8"])
69
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.7"])
70
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.2"])
71
71
  end
72
72
  end
73
73
 
@@ -11,15 +11,13 @@ module DhtSensor
11
11
 
12
12
  attach_function :readDHT, [:int, :int, :pointer, :pointer], :long
13
13
 
14
- def self.read(pin, type=22)
14
+ def self.read(pin, type=22, tries=50)
15
15
 
16
16
  temperature = FFI::MemoryPointer.new(:float)
17
17
  humidity = FFI::MemoryPointer.new(:float)
18
18
 
19
- tries = 50
20
- ret = 0
21
- while tries > 0 do
22
- tries -= 1
19
+ ret = nil
20
+ 1.upto(tries) do
23
21
  ret = DhtSensor.readDHT(type, pin, temperature, humidity)
24
22
  break if ret == 0 && !(temperature.read_float == 0.0 && humidity.read_float == 0.0)
25
23
  sleep 0.1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dht-sensor-ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chetan Sarva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -138,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.5.1
141
+ rubygems_version: 3.0.2
143
142
  signing_key:
144
143
  specification_version: 4
145
144
  summary: A library to use the DHT-XX type humidity/temperature sensors