Fix issue with pin_write() flipping mode <--> value

pull/82/head
Rick Carlino 2015-04-14 10:53:53 -05:00
parent c161563b85
commit ad56526187
3 changed files with 5 additions and 7 deletions

View File

@ -9,7 +9,7 @@ gem 'sqlite3'
# Use bson for database functionality
gem 'bson'
gem 'farmbot-serial', '0.2.3'
gem 'farmbot-serial', '0.2.4'
gem 'meshruby', '0.0.3'
gem 'polyglot'
gem 'httparty'

View File

@ -18,16 +18,13 @@ class FarmBotPi
end
def start
mesh.toggle_debug!
EM.run do
mesh.connect
mesh.onmessage { |msg| handler.call(msg, bot, mesh) }
FB::ArduinoEventMachine.connect(bot)
0.upto(14) { |num| bot.commands.read_parameter(num) }
bot.onmessage { |msg| bot.log "BOT MSG: #{msg}"}
bot.onmessage { |msg| bot.log "BOT MSG: #{msg}" unless msg.name == :idle}
bot.onclose { puts 'Disconnected'; EM.stop }
bot.onchange { |diff| bot.log "BOT DIF: #{diff}" }
end

View File

@ -18,6 +18,7 @@ class SingleCommandController < AbstractController
action = AVAILABLE_ACTIONS[cmd["action"].to_s.downcase] || :unknown
puts "Calling #{action}"
send(action)
reply "read_status", confirmation: true, command: cmd
end
def move_relative
@ -46,8 +47,8 @@ class SingleCommandController < AbstractController
def pin_write
bot.commands.pin_write pin: cmd['pin'],
value: cmd['mode'],
mode: cmd['value1']
value: cmd['value1'],
mode: cmd['mode'] || 0
end
def emergency_stop