tamashii-agent 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tamashii/agent/lcd.rb +9 -2
- data/lib/tamashii/agent/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc65b8a798b3b32a4c0e4beb3f694a63b02e2f8
|
4
|
+
data.tar.gz: 3d35b65bd94bef0cf5a118d790c023e93d3a9eff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba2d2285b63a61ad5f7cb172bab5d4563ae7b55c71852eabcf61b66baeb56d668886a4f3e3b14536b8a3bfd5a735c7c08136c1ab57b6de9d955f0d975ef338a
|
7
|
+
data.tar.gz: 1f405b76004e0288cf7d5320e93f002e7ef136956dbdc59d2ef30f407fe544ecbf637fdaf4ff51ac2057535f4f49ae3b5dded32e9818afa2aa4af37df405ed4b
|
data/lib/tamashii/agent/lcd.rb
CHANGED
@@ -25,6 +25,7 @@ module Tamashii
|
|
25
25
|
@line = line
|
26
26
|
@text = ""
|
27
27
|
@pos = -1
|
28
|
+
@stop_animation = false
|
28
29
|
end
|
29
30
|
|
30
31
|
def set_text(text)
|
@@ -48,6 +49,7 @@ module Tamashii
|
|
48
49
|
def start_animation
|
49
50
|
@pos = 0
|
50
51
|
@max_pos = @text.size - @@line_width
|
52
|
+
@stop_animation = false
|
51
53
|
logger.debug "Start animation for line #{@line}: #{@text}"
|
52
54
|
@animation_thread = Thread.new { animation_loop }
|
53
55
|
end
|
@@ -56,13 +58,18 @@ module Tamashii
|
|
56
58
|
loop do
|
57
59
|
sleep Config.lcd_animation_delay
|
58
60
|
animation_show_text
|
61
|
+
break if @stop_animation
|
59
62
|
sleep 1 if @pos == 0 || @pos == @max_pos
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
63
66
|
def stop_animation
|
64
|
-
@
|
65
|
-
@animation_thread
|
67
|
+
@stop_animation = true
|
68
|
+
if @animation_thread
|
69
|
+
@animation_thread.join(1)
|
70
|
+
@animation_thread.exit
|
71
|
+
@animation_thread = nil
|
72
|
+
end
|
66
73
|
end
|
67
74
|
|
68
75
|
def print_text(text)
|