Permalink
Browse files

Trigger the Unplugged notification on app start

... rather than waiting for a device to be added or removed.

This should have been implemented as part of the Celluloid conversion, but I forgot.
I removed the relevant comment that was intended to remind me.

Fixes #57.
  • Loading branch information...
1 parent 8e1b4de commit c164995292743f85e9617b89be3ce9adde9bdce9 @nilbus committed Feb 11, 2015
Showing with 2 additions and 6 deletions.
  1. +2 −5 app/models/sensor_watch.rb
  2. +0 −1 lib/track_sensor/base.rb
@@ -34,11 +34,7 @@ def record_race_results(_, results)
end
def handle_device_change(_)
- if @sensor.plugged_in?
- initialize_state
- else
- self.state = :unplugged
- end
+ initialize_state
end
def start_race
@@ -58,6 +54,7 @@ def quit
private
def initialize_state
+ return self.state = :unplugged unless @sensor.plugged_in?
if @heat.current.any?
start_race
else
@@ -83,7 +83,6 @@ def initialize_device(device_path)
def scan_for_device_changes
initialize_new_devices
- # raise IOError.new('The sensor is not plugged in') unless plugged_in?
end
def initialize_new_devices

0 comments on commit c164995

Please sign in to comment.