sdr/decode: improve decoding thanks to aaronsp777

This commit is contained in:
King Kévin 2021-08-28 13:03:10 +02:00
parent 157a8ee41f
commit 6ca62453ee
1 changed files with 5 additions and 3 deletions

View File

@ -137,8 +137,10 @@ puts "# values: #{values.size}"
unless values.empty? then
puts "values: "
values.each do |value|
data_bits = (value & 0x07)
system_code = ((value & 0x7fffff) >> 3)
puts "- value: #{value} (0x#{value.to_s(16).rjust(6,'0')}), system code: #{system_code} (0x#{system_code.to_s(16)}), databits: #{data_bits} (0x#{data_bits.to_s(16)})"
button = value & 7
code = (value >> 3) & 65535
facility = (value >> 19) & 15
printf("- value: 0X%06x, code: %05d, facility: %d, button: %d\n", value, code, facility, button)
end
end
end