Superp Posted December 24, 2020 at 08:27 AM Share Posted December 24, 2020 at 08:27 AM Hello, Maybe I'm wrong, but I have a suspicion BrickletSegmentDisplay4x7V2#get_segments does not return correct values. I think the Bricklet responds with correct data, but the data is mangled when unpacked. To be precise, when data is unpacked for the first segment (8 values), too much data is slurped so nothing remains for the other 27 values. Here is a quick & dirty debug helper: module Tinkerforge class BrickletSegmentDisplay4x7V2 def debug_get_segments puts ' |.......|.......|.......|.......|.|' puts 'get_segments : ' + get_segments.flatten.map { |b| b ? '1' : '0' }.join puts 'actual response: ' + (send_request FUNCTION_GET_SEGMENTS, [], '', 14, '?35' ).map { |b| b ? '1' : '0' }.join puts '' end end end Quote Link to comment Share on other sites More sharing options...
rtrbt Posted January 4, 2021 at 10:12 AM Share Posted January 4, 2021 at 10:12 AM Hi, You are correct, this is a bug in the unpack logic of multiple boolean arrays. Can you please test the attached version? Erik tinkerforge_ruby_bindings_2_1_27.zip Quote Link to comment Share on other sites More sharing options...
Superp Posted January 4, 2021 at 10:35 AM Author Share Posted January 4, 2021 at 10:35 AM Hello Erik, The above version appears to fix this bug. The debug code I supplied above reports a correct answer. Cheers, Quote Link to comment Share on other sites More sharing options...
Superp Posted January 5, 2021 at 08:02 AM Author Share Posted January 5, 2021 at 08:02 AM For the record: This bug was fixed with commit c10086f8ca1223715261fa3c4362f6a5e578305a ruby: Fix bool array unpacking. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.