Superp Geschrieben December 24, 2020 at 08:27 Geschrieben December 24, 2020 at 08:27 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 Zitieren
rtrbt Geschrieben January 4, 2021 at 10:12 Geschrieben January 4, 2021 at 10:12 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 Zitieren
Superp Geschrieben January 4, 2021 at 10:35 Autor Geschrieben January 4, 2021 at 10:35 Hello Erik, The above version appears to fix this bug. The debug code I supplied above reports a correct answer. Cheers, Zitieren
Superp Geschrieben January 5, 2021 at 08:02 Autor Geschrieben January 5, 2021 at 08:02 For the record: This bug was fixed with commit c10086f8ca1223715261fa3c4362f6a5e578305a ruby: Fix bool array unpacking. Zitieren
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.