arduino_firmata 0.3.1 → 0.3.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: 853c807f3157df2f77825a02c46383ccd28f4674
4
- data.tar.gz: b31c697d222788972e348d1aa197e148b5c98a1e
3
+ metadata.gz: d68b7048e7a2ee534ed8316df91d9a9f9a54257c
4
+ data.tar.gz: 34544b4a01613ef1367d751170edb216d1064c39
5
5
  SHA512:
6
- metadata.gz: 1629ae02d373d9dca4bd4d40c7776351a952d68389e853748f4dfc2260f4e75bfe1a652fa8328eab5671e6114cb3682be2d25d8b27941ebbb383de8d6d397ba0
7
- data.tar.gz: b50a24cdae0fb6908070d4d8ea2a101928f6d0275971b01e601ea14b85d353ecf408853b78894f679af3b9c1af87aaef38d11bb9822e351a09ab45e125ebbd97
6
+ metadata.gz: 706ff76370523d0ece421d5f501e92c395d4d9f35498ba4adbcfd77f07d4fa1341e42aad529d0e29451714268409fdbe5b3fdeb8b0b09c5cb5d03171b6bf1b7b
7
+ data.tar.gz: 31a9715f5760ed4a82070fe49dc6cffe71064da6186df152db2554f124f23f5fae85aa9cc85a6aa10aaac90b5f790463a8468ec2e261e70b2dcf7e433b338c2d
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  vendor
6
6
  .sass-cache
7
7
  .bundle
8
+ .ruby-version
8
9
  config.yml
9
10
  *.gem
10
11
  *.rbc
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in arduino_firmata.gemspec
4
4
  gemspec
5
- gem 'backports'
6
- gem 'minitest'
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.3.2 2013-08-28
2
+
3
+ * use "Object#at_exit" insteadof trap "SIHUP/SIGINT"
4
+ * speed up initialization phase by detecting device-name
5
+ * thank you for suggestion and pull-request @odarriba
6
+
1
7
  === 0.3.1 2013-08-05
2
8
 
3
9
  * fix sample's magick comment
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Sho Hashimoto
1
+ Copyright (c) 2012-2013 Sho Hashimoto
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -10,12 +10,18 @@ Gem::Specification.new do |gem|
10
10
  gem.description = %q{Arduino Firmata protocol (http://firmata.org) implementation on Ruby.}
11
11
  gem.summary = gem.description
12
12
  gem.homepage = "http://shokai.github.com/arduino_firmata"
13
+ gem.license = "MIT"
13
14
 
14
15
  gem.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
15
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
18
  gem.require_paths = ["lib"]
18
19
 
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'bundler', '~> 1.3'
22
+ gem.add_development_dependency 'minitest'
23
+ gem.add_development_dependency 'backports'
24
+
19
25
  gem.add_dependency 'serialport', '>= 1.1.0'
20
26
  gem.add_dependency 'args_parser', '>= 0.1.4'
21
27
  gem.add_dependency 'event_emitter', '>= 0.2.4'
@@ -5,7 +5,8 @@ module ArduinoFirmata
5
5
 
6
6
  attr_reader :version, :status, :nonblock_io, :eventmachine
7
7
 
8
- def initialize(serial_name, params)
8
+ def initialize(serialport_name, params)
9
+ @serialport_name = serialport_name
9
10
  @nonblock_io = !!params[:nonblock_io]
10
11
  @eventmachine = !!params[:eventmachine]
11
12
  @read_byte_size = eventmachine ? 256 : 9600
@@ -24,26 +25,13 @@ module ArduinoFirmata
24
25
 
25
26
  @version = nil
26
27
 
27
- @serial = SerialPort.new(serial_name, params[:bps], params[:bit], params[:stopbit], params[:parity])
28
- @serial.read_timeout = 3
29
- sleep 3
28
+ @serial = SerialPort.new(@serialport_name, params[:bps], params[:bit], params[:stopbit], params[:parity])
29
+ @serial.read_timeout = 10
30
+ sleep 3 if old_arduino_device?
30
31
  @status = Status::OPEN
31
32
 
32
- trap 'SIGHUP' do
33
+ at_exit do
33
34
  close
34
- exit
35
- end
36
- trap 'SIGINT' do
37
- close
38
- exit
39
- end
40
- trap 'SIGKILL' do
41
- close
42
- exit
43
- end
44
- trap 'SIGTERM' do
45
- close
46
- exit
47
35
  end
48
36
 
49
37
  @thread_status = false
@@ -70,7 +58,7 @@ module ArduinoFirmata
70
58
  sleep 0.5
71
59
  break if @version
72
60
  end
73
- sleep 0.5
61
+ sleep 0.5 if old_arduino_device?
74
62
  end
75
63
 
76
64
  def run(&block)
@@ -82,6 +70,10 @@ module ArduinoFirmata
82
70
  end
83
71
  end
84
72
 
73
+ def old_arduino_device?
74
+ File.basename(@serialport_name) !~ /^tty\.usbmodem/
75
+ end
76
+
85
77
  def close
86
78
  return if status == Status::CLOSE
87
79
  @status = Status::CLOSE
@@ -1,3 +1,3 @@
1
1
  module ArduinoFirmata
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'rubygems'
2
- require 'bundler/setup'
3
- require 'backports'
4
2
  require 'minitest/autorun'
3
+ require 'backports'
5
4
 
6
5
  $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
7
6
  require 'arduino_firmata'
metadata CHANGED
@@ -1,15 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arduino_firmata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: backports
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
13
69
  - !ruby/object:Gem::Dependency
14
70
  name: serialport
15
71
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +154,8 @@ files:
98
154
  - test/test_helper.rb
99
155
  - test/test_sysex.rb
100
156
  homepage: http://shokai.github.com/arduino_firmata
101
- licenses: []
157
+ licenses:
158
+ - MIT
102
159
  metadata: {}
103
160
  post_install_message:
104
161
  rdoc_options: []