Skip to content

Commit 532a052

Browse files
committed
add extra debug stats
1 parent 0db55cd commit 532a052

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/nagelier/application.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def start
1313
while true
1414
byte = query.output_byte_for_arduino
1515
io.write byte
16+
puts query.debug_stats
1617
puts "Wrote: #{byte.ord}"
1718
sleep 60
1819
end
@@ -24,7 +25,7 @@ def demo(io)
2425
# IO#write calls #to_s on its input
2526
io.write i.chr
2627
puts "read: " + io.read_nonblock(1024).inspect rescue Errno::EAGAIN
27-
sleep 0.5
28+
sleep 0.1
2829
end
2930
end
3031

lib/nagelier/arduino_statistics_query.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def initialize activity
1414
@activity = activity
1515
end
1616

17+
def debug_stats
18+
"#{current_steps} of #{step_goal} steps, #{(percentage_of_step_goal_for_time_of_day * 100).round}% for time of day"
19+
end
20+
1721
def output_byte_for_arduino
1822
percentage = percentage_of_step_goal_for_time_of_day
1923
if current_steps >= step_goal

0 commit comments

Comments
 (0)