-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommand_compare.rb
79 lines (65 loc) · 8.4 KB
/
command_compare.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
commands = {
# two_of_three: [ # RM-CDF7L: displays volume level 0 with 2/3 subdivision dots to right of digit
# -1049, +33242,
# -1140, +1114, -3, +27, -185, +209, -3, +29, -185, +27, -186, +27, -185, +27, -185, +27, -185, +209, -3, +141, -207, +3, -209, +5, -208, +5, -208, +5, -208, +5, -207, +5, -208, +209, -4, +90, -209, +5, -207, +5, -208, +5, -207, +6, -207, +6, -208, +210, -3, +7, -208, +89, -207, +209, -3, +7, -208, +5, -208, +5, -207, +5, -208, +5, -208, +5, -208, +107, -209, +4, -207, +5, -208, +5, -209, +5, -209, +5, -208, +208, -4, +5, -208, +89, -208, +209, -3, +211, -3, +210, -3, +211, -2, +6, -208, +5, -209, +209, -3, +90, -208, +4, -209, +3, -209, +5, -209, +5, -208, +5, -208, +5, -208, +4, -210, +72, -208, +5, -209, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +6, -208, +89, -208, +4, -208, +5, -208, +5, -209, +5, -208, +5, -208, +5, -208, +3, -209, +73, -208, +5, -209, +5, -208, +5, -208, +5, -208, +4, -208, +5, -208, +5, -209, +91, -207, +5, -208, +5, -208, +5, -209, +5, -207, +5, -208, +5, -208, +5, -209, +90, -206, +5, -209, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +5, -209, +566, -207, +5, -208, +209, -3, +210, -3, +210, -3, +6, -208, +5, -208, +210, -2, +11275,
# ],
# zero_of_three: [ # RM-CDF7L: displays volume level 0 with 0/3 subdivision dots to right of digit
# -1049, +33242,
# -1128, +1046, -3, +21, -192, +209, -3, +20, -192, +18, -194, +21, -191, +20, -193, +19, -193, +208, -3, +143, -207, +5, -208, +4, -208, +5, -206, +5, -208, +5, -208, +4, -208, +209, -3, +244, -207, +5, -208, +5, -209, +5, -208, +5, -207, +5, -208, +210, -4, +6, -208, +90, -208, +5, -208, +5, -208, +5, -209, +5, -208, +5, -208, +4, -208, +5, -208, +73, -208, +5, -207, +5, -208, +5, -208, +5, -208, +5, -209, +208, -4, +5, -208, +90, -207, +210, -2, +211, -3, +211, -3, +210, -3, +5, -208, +5, -208, +210, -2, +91, -208, +5, -208, +4, -208, +5, -208, +5, -208, +4, -208, +5, -208, +6, -208, +89, -208, +5, -208, +5, -208, +5, -208, +5, -208, +6, -206, +5, -208, +5, -208, +90, -206, +5, -208, +5, -208, +5, -209, +5, -208, +4, -207, +5, -208, +5, -209, +328, -207, +5, -208, +5, -209, +4, -210, +4, -208, +5, -208, +5, -209, +5, -209, +74, -206, +5, -208, +5, -209, +6, -208, +5, -208, +5, -208, +5, -208, +5, -208, +73, -207, +6, -208, +5, -208, +5, -207, +5, -209, +3, -208, +5, -208, +5, -208, +73, -207, +209, -3, +211, -2, +211, -3, +211, -2, +6, -208, +5, -209, +209, -3, +11424,
# ],
track_02_v1: [ # track number (02) version 1
-1081, +33212,
-1104, +1114, -3, +27, -185, +209, -3, +27, -185, +27, -185, +27, -186, +27, -185, +27, -185, +209, -3, +141, -207, +5, -208, +5, -208, +5, -208, +4, -209, +4, -208, +5, -208, +209, -4, +91, -208, +5, -209, +5, -209, +5, -208, +5, -208, +208, -4, +5, -208, +210, -2, +92, -207, +5, -208, +5, -209, +4, -210, +4, -208, +5, -208, +5, -209, +5, -209, +277, -207, +5, -207, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +5, -208, +89, -208, +5, -208, +5, -208, +4, -208, +6, -207, +5, -208, +5, -208, +5, -208, +90, -207, +209, -2, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +3, -210, +88, -208, +5, -209, +5, -208, +5, -208, +5, -207, +6, -207, +5, -208, +5, -209, +90, -207, +5, -208, +5, -208, +5, -208, +5, -208, +4, -208, +5, -208, +5, -208, +226, -205, +5, -208, +5, -208, +5, -208, +5, -209, +5, -209, +5, -207, +5, -208, +73, -208, +5, -208, +5, -208, +5, -208, +5, -209, +5, -208, +4, -208, +5, -208, +73, -208, +5, -207, +5, -208, +6, -208, +5, -208, +5, -208, +5, -208, +3, -208, +73, -208, +209, -2, +6, -208, +4, -208, +6, -207, +210, -3, +5, -208, +209, -3, +11501,
],
track_02_v2: [ # track number (02) version 2
-1067, +32877,
-1108, +1015, -101, +24, -188, +102, -110, +24, -189, +22, -190, +23, -190, +22, -190, +23, -190, +103, -109, +107, -207, +5, -208, +5, -208, +4, -210, +4, -208, +5, -208, +5, -209, +209, -3, +73, -208, +5, -208, +5, -208, +5, -208, +5, -209, +210, -2, +6, -209, +210, -2, +92, -207, +5, -208, +5, -208, +5, -209, +3, -210, +4, -208, +5, -208, +5, -208, +73, -207, +5, -208, +5, -208, +5, -209, +5, -208, +5, -208, +5, -208, +5, -208, +73, -207, +5, -208, +5, -208, +5, -208, +4, -208, +5, -208, +5, -208, +5, -208, +89, -208, +209, -3, +6, -208, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +225, -208, +3, -209, +7, -207, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +73, -207, +5, -209, +5, -208, +5, -208, +6, -207, +5, -209, +5, -208, +5, -208, +73, -208, +5, -208, +4, -208, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +91, -207, +5, -208, +5, -208, +5, -207, +5, -208, +5, -208, +5, -208, +5, -208, +90, -208, +5, -208, +5, -209, +5, -208, +5, -208, +5, -208, +5, -208, +4, -208, +261, -207, +210, -2, +6, -208, +5, -209, +5, -208, +209, -3, +7, -208, +209, -3, +11582,
],
track_04: [ # track number (04)
-1067, +32537,
-1105, +1018, -98, +25, -188, +103, -108, +23, -190, +23, -190, +22, -191, +21, -191, +19, -192, +107, -106, +141, -207, +5, -208, +5, -209, +5, -208, +5, -208, +5, -207, +6, -207, +210, -3, +414, -207, +5, -208, +5, -208, +5, -208, +5, -208, +209, -2, +7, -208, +209, -2, +92, -207, +5, -208, +5, -208, +5, -209, +4, -210, +4, -208, +5, -208, +5, -209, +90, -207, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +5, -208, +73, -207, +5, -208, +5, -207, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +208, -209, +4, -208, +209, -2, +6, -208, +4, -209, +4, -207, +5, -208, +5, -208, +89, -208, +5, -208, +5, -208, +5, -209, +5, -209, +5, -208, +5, -208, +5, -208, +89, -207, +6, -208, +5, -208, +5, -208, +5, -209, +5, -209, +5, -207, +5, -208, +210, -207, +5, -208, +5, -208, +5, -209, +3, -210, +4, -208, +5, -208, +5, -208, +90, -207, +6, -209, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +242, -207, +5, -208, +5, -209, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +123, -207, +5, -209, +209, -2, +7, -208, +5, -208, +209, -3, +6, -208, +208, -3, +11148,
],
track_4_to_2: [ # track number (04) message changed to show 02
-1067, +32537,
-1105, +1018, -98, +25, -188, +103, -108, +23, -190, +23, -190, +22, -191, +21, -191, +19, -192, +107, -106, +141, -207, +5, -208, +5, -209, +5, -208, +5, -208, +5, -207, +6, -207, +210, -3, +414, -207, +5, -208, +5, -208, +5, -208, +5, -208, +209, -2, +7, -208, +209, -2, +92, -207, +5, -208, +5, -208, +5, -209, +4, -210, +4, -208, +5, -208, +5, -209, +90, -207, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +5, -208, +73, -207, +5, -208, +5, -207, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +208, -208, +209, -3, +6, -208, +6, -208, +4, -209, +4, -207, +5, -208, +5, -208, +89, -208, +5, -208, +5, -208, +5, -209, +5, -209, +5, -208, +5, -208, +5, -208, +89, -207, +6, -208, +5, -208, +5, -208, +5, -209, +5, -209, +5, -207, +5, -208, +210, -207, +5, -208, +5, -208, +5, -209, +3, -210, +4, -208, +5, -208, +5, -208, +90, -207, +6, -209, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +5, -208, +242, -207, +5, -208, +5, -209, +5, -208, +5, -208, +5, -208, +5, -208, +5, -209, +123, -207, +210, -2, +6, -208, +7, -208, +5, -208, +209, -3, +6, -208, +208, -3, +11148,
]
}
unless (commands.map{|_k, v| v.length}.uniq.length == 1)
raise "number of commands differ: #{commands.map{|k, v| "#{k}: #{v.length}"}.join(', ')}"
end
def to_nearest(nearest, num)
return ((num + (nearest / 2).to_i) / nearest).to_i * nearest;
end
# raise "number of commands differ: #{full_battery_level.length} vs #{track_number_02.length} vs #{track_number_04.length}" unless full_battery_level.length == track_number_02.length && full_battery_level.length == track_number_04.length
# justification = 6
boundary = 20
# labels = "#{"full".rjust(justification)} #{"trk_2".ljust(justification)} #{"trk_4".ljust(justification)}"
max_label_length = commands.map{|k, _v| k.to_s.length}.max
justification = max_label_length
labels = commands.map{|k, _v| k.to_s.center(justification)}.join(' ')
puts labels
commands[commands.keys.first].length.times do |i|
samples = commands.keys.map do |cmd|
commands[cmd][i]
end
line = ""
samples.each_with_index do |sample, idx|
if idx == 0
line << sample.to_s.center(justification)
else
if ((sample < samples[idx-1]-boundary) || (sample > samples[idx-1]+boundary))
line << ' * '
else
line << ' '
end
line << sample.to_s.center(justification)
if idx == samples.length - 1
if ((sample < samples.first-boundary) || (sample > samples.first+boundary))
line << ' *'
end
end
end
end
puts line
end
puts labels