dht_sensor 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/ext/dht_sensor/dhtreader.c +6 -2
- data/ext/dht_sensor/extconf.rb +3 -2
- data/lib/dht_sensor/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad3a01069bf8320671a24aac435901cf8909da59
|
4
|
+
data.tar.gz: 59ba9f246c2c976dad0f168efd6ddd85166c28b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5773e8f17dc515b684459bdf33eaa3ede6a66764038f41f0c0151408d0899dcf5f13d7932419eff15901261b125cf696d9af5b4c5bfe3e7a378a447425de78a
|
7
|
+
data.tar.gz: 0e872362f11613d753cff49b23aff7c522ca4c2b48b4b6d7367d0a2497729bf18b0387b3e5321b2a29cfb054a4692e59e39908832f305bfd8f5165f0baad6005
|
data/README.md
CHANGED
data/ext/dht_sensor/dhtreader.c
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
int readDHT(int type, int pin, float *temp_p, float *hum_p)
|
23
23
|
{
|
24
24
|
int counter = 0;
|
25
|
+
int sleepCounter = 0;
|
25
26
|
int laststate = HIGH;
|
26
27
|
int i = 0;
|
27
28
|
int j = 0;
|
@@ -47,6 +48,9 @@ int readDHT(int type, int pin, float *temp_p, float *hum_p)
|
|
47
48
|
// wait for pin to drop?
|
48
49
|
while (bcm2835_gpio_lev(pin) == 1) {
|
49
50
|
usleep(1);
|
51
|
+
sleepCounter++;
|
52
|
+
if (sleepCounter >= 1000000)
|
53
|
+
return -1;
|
50
54
|
}
|
51
55
|
|
52
56
|
// read data!
|
@@ -55,11 +59,11 @@ int readDHT(int type, int pin, float *temp_p, float *hum_p)
|
|
55
59
|
while ( bcm2835_gpio_lev(pin) == laststate) {
|
56
60
|
counter++;
|
57
61
|
//nanosleep(1); // overclocking might change this?
|
58
|
-
if (counter
|
62
|
+
if (counter >= 1000)
|
59
63
|
break;
|
60
64
|
}
|
61
65
|
laststate = bcm2835_gpio_lev(pin);
|
62
|
-
if (counter
|
66
|
+
if (counter >= 1000) break;
|
63
67
|
#ifdef DEBUG
|
64
68
|
bits[bitidx++] = counter;
|
65
69
|
#endif
|
data/ext/dht_sensor/extconf.rb
CHANGED
@@ -33,12 +33,13 @@ LIB_DIRS = [
|
|
33
33
|
# Finally fall back to /usr
|
34
34
|
'/usr/lib',
|
35
35
|
]
|
36
|
+
|
36
37
|
unless find_header('bcm2835.h')
|
37
|
-
abort 'bcm2835 is missing'
|
38
|
+
abort 'bcm2835 is missing, for production you will need to install http://www.airspayce.com/mikem/bcm2835/'
|
38
39
|
end
|
39
40
|
|
40
41
|
unless have_library('bcm2835') && append_library($libs, 'bcm2835')
|
41
|
-
abort "Can't Appended Library bcm2835!"
|
42
|
+
abort "Can't Appended Library bcm2835! for production you will need to install http://www.airspayce.com/mikem/bcm2835/"
|
42
43
|
end
|
43
44
|
|
44
45
|
dir_config('bcm2835', HEADER_DIRS, LIB_DIRS)
|
data/lib/dht_sensor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dht_sensor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Guest
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.4.3
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Ruby C extension to use the DHT-XX type humidity/temperature sensors
|