somfy_sdn 2.1.4 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 636b137221c1ccd49cd089e38447f59625be071352da630a61bb3b85c73a9b93
4
- data.tar.gz: cd9bd4040fe5b209d56c7e1a7c70ee98f068b3da044e3f82ac3680fceafac781
3
+ metadata.gz: 83eab2a162518795d82296d471608e8b9a300d34e6b81897630a06e81456ed40
4
+ data.tar.gz: d8bfc48d510c2a5b97663326bb893d5abc09fd5a4b1876a70e03a408ad446e15
5
5
  SHA512:
6
- metadata.gz: 612535efe5bb8cbe7191e8b8ac318a4192def9689743f0387df25e7c75a86856457ba97dc8693b6329bdbc45024f66068c5838b651b0af834eddc075d98f62a5
7
- data.tar.gz: 81eaced8fc720b9ba2b3a11b9578d13691038fc2962a4a4940fecc5fc710488860ea1bc04293ebcb0ea7f56c4851f833992fea6f00f40d6b366132e2fcebb527
6
+ metadata.gz: c523da782a69732baf2d114fe412125d0406b96764b9119e97cfea221808c6cff702b6a3f7f8b487afba5f85c919f9a554f707405f15f175682a0072512e9ecd
7
+ data.tar.gz: 56a628ec9e87aab0667c67ad379194bb67c2f5bd0a26c9995ac5b164f4173c296566b3b749fc5823ec7d1151a2e6083add55eef4fe7bcc521a2f11c0812d29bb
@@ -70,6 +70,7 @@ module SDN
70
70
  win.keypad = true
71
71
  print_help
72
72
  refresh
73
+ wait_for_stop
73
74
 
74
75
  loop do
75
76
  char = win.getch
@@ -170,18 +171,29 @@ r reverse motor
170
171
  def wait_for_stop
171
172
  win.setpos(13, 0)
172
173
  win.addstr("Moving...\n")
174
+
173
175
  loop do
174
176
  win.nodelay = true
175
177
  stop if win.getch == 27 # Esc
178
+
176
179
  sdn.send(ns::GetMotorPosition.new(addr))
177
- sdn.receive do |message|
178
- next unless message.is_a?(ns::PostMotorPosition)
179
- last_pos = @pos
180
- @pos = message.position_pulses
181
- win.setpos(14, 0)
182
- win.addstr("Position: #{@pos}\n")
183
-
184
- if last_pos == @pos
180
+ unless ilt2?
181
+ sleep 0.1
182
+ sdn.send(ns::GetMotorStatus.new(addr))
183
+ end
184
+
185
+ sdn.receive(0.1) do |message|
186
+
187
+ if message.is_a?(ns::PostMotorPosition)
188
+ last_pos = @pos
189
+ @pos = message.position_pulses
190
+ win.setpos(14, 0)
191
+ win.addstr("Position: #{@pos}\n")
192
+ end
193
+
194
+ if (ilt2? && last_pos == @pos) ||
195
+ (message.is_a?(Message::PostMotorStatus) &&
196
+ message.state != :running)
185
197
  win.setpos(13, 0)
186
198
  win.addstr("\n")
187
199
  win.nodelay = false
@@ -190,7 +202,6 @@ r reverse motor
190
202
  end
191
203
  end
192
204
  sleep 0.1
193
-
194
205
  end
195
206
  end
196
207
 
data/lib/sdn/client.rb CHANGED
@@ -79,6 +79,7 @@ module SDN
79
79
  # timed out; just discard everything
80
80
  SDN.logger.debug "discarding #{@buffer.unpack("H*").first.gsub(/\h{2}/, "\\0 ")} due to timeout"
81
81
  @buffer = ""
82
+ return messages if timeout
82
83
  end
83
84
 
84
85
  retry
data/lib/sdn/message.rb CHANGED
@@ -111,6 +111,7 @@ module SDN
111
111
  def inspect
112
112
  "#<%s @node_type=%s, @ack_requested=%s, @src=%s, @dest=%s%s>" % [self.class.name, node_type_to_string(node_type), ack_requested, print_address(src), print_address(dest), class_inspect]
113
113
  end
114
+ alias_method :to_s, :inspect
114
115
 
115
116
  def class_inspect
116
117
  ivars = instance_variables - [:@node_type, :@ack_requested, :@src, :@dest, :@params]
data/lib/sdn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SDN
2
- VERSION = '2.1.4'
2
+ VERSION = '2.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: somfy_sdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mqtt-ccutrer
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.1.2
160
+ rubygems_version: 3.3.7
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Library for communication with Somfy SDN RS-485 motorized shades