dht_sensor 0.0.1 → 0.0.2

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
2
  SHA1:
3
- metadata.gz: 4195274066348fe61c4ff857135100fc15439aee
4
- data.tar.gz: 0d3acc0a87ac1c235dd8f845e3091a410619869b
3
+ metadata.gz: ad3a01069bf8320671a24aac435901cf8909da59
4
+ data.tar.gz: 59ba9f246c2c976dad0f168efd6ddd85166c28b8
5
5
  SHA512:
6
- metadata.gz: 484f98da5da92cb28d3aa43ea5c0d887a8d7df7f9f29fb3bbe4a9dbed006f16338c47e10f2a7e941b0a13edc55e281a105b63b7b42b42fd77011fac07ab3d63b
7
- data.tar.gz: df1185ab78faa9deea047ea1356aea2408f2e776adbc632b8fd86eb1cbb84fb5ae45596133a77be74e997b6a27c1fcf2fc61e32dc497d548944633def04b5bfe
6
+ metadata.gz: b5773e8f17dc515b684459bdf33eaa3ede6a66764038f41f0c0151408d0899dcf5f13d7932419eff15901261b125cf696d9af5b4c5bfe3e7a378a447425de78a
7
+ data.tar.gz: 0e872362f11613d753cff49b23aff7c522ca4c2b48b4b6d7367d0a2497729bf18b0387b3e5321b2a29cfb054a4692e59e39908832f305bfd8f5165f0baad6005
data/README.md CHANGED
@@ -16,6 +16,10 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install dht_sensor
18
18
 
19
+ ### Dependencies
20
+
21
+ * http://www.airspayce.com/mikem/bcm2835/
22
+
19
23
  ## Usage
20
24
 
21
25
  TODO: Write usage instructions here
@@ -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 == 1000)
62
+ if (counter >= 1000)
59
63
  break;
60
64
  }
61
65
  laststate = bcm2835_gpio_lev(pin);
62
- if (counter == 1000) break;
66
+ if (counter >= 1000) break;
63
67
  #ifdef DEBUG
64
68
  bits[bitidx++] = counter;
65
69
  #endif
@@ -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)
@@ -1,3 +1,3 @@
1
1
  class DhtSensor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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: 2014-03-30 00:00:00.000000000 Z
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.2.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