Skip to content

Commit

Permalink
Merge pull request #149 from RickCarlino/master
Browse files Browse the repository at this point in the history
April 13 Staging Deploy
  • Loading branch information
RickCarlino committed Apr 13, 2016
2 parents ec0d04d + f21f722 commit 655b2a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 1 addition & 3 deletions lib/bot_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ def log(message, priority = 'low')
end

def emit_changes
mesh.emit '*', method: 'read_status',
params: FBPi::ReportBotStatus.run!(bot: self),
id: nil
mesh.emit '*', id: nil, result: FBPi::ReportBotStatus.run!(bot: self)
end

# This method seems to be violating some sort of intergalactic law. I don't
Expand Down
10 changes: 6 additions & 4 deletions lib/command_objects/cold_start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,25 @@ def set_event_handlers

def pull_up_stored_parameters_from_disk
hash = bot.status_storage.to_h(:bot)
param_names = FB::Gcode::PARAMETER_DICTIONARY.invert
bot.status.transaction do |s|
hash.each { |k,v|
param_number = FB::Gcode::PARAMETER_DICTIONARY.invert.fetch(k, k)
param_number = param_names.fetch(k, k)
bot.commands.write_parameter(param_number, v) }
end
end

def botmessage(msg)
bot.log("#{msg.name} #{msg.to_s}") if msg.name != :idle
# Callbacks here, yo.
end

def diffmessage(diff)
bot.status_storage.update_attributes(:bot, diff)
# Broadcasting busy status changes result in too much network 'noise'.
if (diff.keys != [:BUSY])
# Broadcasting busy status changes result in too much network 'noise'.
# We could broadcast bot's busy status, but why?
bot.emit_changes
bot.log "BOT DIF: #{diff}"
bot.log diff
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/command_objects/fetch_auth_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FetchAuthToken < Mutations::Command
end

def execute
binding.pry
raise "TODO : Build this feature for when tokens expire!"
end
end
end
3 changes: 2 additions & 1 deletion lib/command_objects/report_bot_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def pi_info

def pin_info
[*0..13].inject({}) do |hsh, pin|
hsh["pin#{pin}".to_sym] = bot.status.get_pin(pin)
val = bot.status.get_pin(pin)
hsh["pin#{pin}".to_sym] = val
hsh
end
end
Expand Down

0 comments on commit 655b2a0

Please sign in to comment.