domotics-arduino 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -33,7 +33,6 @@ task :major, :commit_message do |t, args|
33
33
  update(args[:commit_message]){ |sv,i| i == MAJOR ? sv.succ : "0" }
34
34
  end
35
35
 
36
-
37
36
  def update(msg)
38
37
  # Update version
39
38
  File.open "lib/domotics/arduino/version.rb", "r+" do |f|
@@ -46,7 +46,7 @@ module Domotics
46
46
  TIMER_5 = 5
47
47
  def initialize(args = {})
48
48
  # grab args from hash
49
- case @type = args[:type] || :mega
49
+ case @board_type = args[:board] || :mega
50
50
  when :nano
51
51
  @port_str = args[:port] || "/dev/ttyUSB0"
52
52
  @number_of_pins = 22
@@ -117,7 +117,7 @@ module Domotics
117
117
 
118
118
  # ---9--- SETPWMFREQ
119
119
  def set_pwm_frequency(pin, divisor = 5)
120
- case @type
120
+ case @board_type
121
121
  when :nano
122
122
  case pin
123
123
  when 9,10
@@ -235,8 +235,8 @@ module Domotics
235
235
  @reply.push(FAILREPRLY) if @command_lock.locked?
236
236
  # Close board connection
237
237
  @board.close
238
- @logger.info "Try to restart board[#{@port_str}] in 5 seconds..."
239
- sleep 5
238
+ @logger.info "Try to restart board[#{@port_str}] in 2 seconds..."
239
+ sleep 2
240
240
  connect
241
241
  end
242
242
  # Exit errored thread
@@ -281,8 +281,8 @@ module Domotics
281
281
  tries = tries || 0
282
282
  tries += 1
283
283
  if tries <= 3
284
- @logger.info { "Attempt #{tries}: try to reconnect in #{5**tries} seconds." }
285
- sleep 5**tries
284
+ @logger.info { "Attempt #{tries}: try to reconnect in #{2**tries} seconds." }
285
+ sleep 2**tries
286
286
  retry
287
287
  end
288
288
  @logger.error { "Board[#{@port_str}] malfunction. Automatic restart failed." }
@@ -1,5 +1,5 @@
1
1
  module Domotics
2
2
  module Arduino
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domotics-arduino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: