Skip to content

Instantly share code, notes, and snippets.

@maximeborges
Created December 15, 2023 04:15
Show Gist options
  • Save maximeborges/cf525d9c072e7d70e7ae58a694b7f8ad to your computer and use it in GitHub Desktop.
Save maximeborges/cf525d9c072e7d70e7ae58a694b7f8ad to your computer and use it in GitHub Desktop.
PTL HDMI switch remote signals plot
import matplotlib.pyplot as plt
signals = [
("Output A/Input 1\n0x00/0x00", [9070, -4448, 620, -513, 613, -511, 615, -513, 614, -537, 590, -512, 614, -514, 613, -512, 615, -513, 613, -1633, 621, -1632, 620, -1633, 620, -1633, 620, -1633, 620, -1633, 620, -1632, 621, -1633, 620, -537, 590, -513, 614, -511, 615, -514, 612, -511, 616, -511, 616, -516, 611, -510, 616, -1633, 620, -1633, 620, -1633, 621, -1632, 620, -1633, 620, -1633, 620, -1632, 621, -1634, 619]),
("Output A/Input 2\n0x00/0x01", [9068, -4448, 620, -509, 618, -509, 617, -537, 589, -511, 616, -511, 615, -512, 613, -511, 616, -509, 618, -1633, 619, -1632, 621, -1632, 620, -1631, 622, -1632, 621, -1632, 620, -1633, 620, -1632, 620, -1632, 620, -510, 616, -514, 613, -510, 616, -511, 616, -510, 616, -537, 589, -515, 612, -511, 615, -1633, 619, -1633, 620, -1633, 619, -1634, 616, -1636, 617, -1635, 617, -1635, 618]),
("Output A/Input 3\n0x00/0x02", [9042, -4475, 593, -536, 590, -564, 563, -534, 591, -539, 584, -538, 590, -536, 591, -537, 608, -518, 588, -1663, 592, -1661, 593, -1660, 591, -1661, 592, -1661, 592, -1660, 592, -1661, 589, -1662, 590, -538, 588, -1663, 593, -536, 591, -563, 563, -564, 563, -563, 562, -565, 563, -538, 587, -1661, 592, -564, 562, -1661, 591, -1662, 590, -1662, 610, -1645, 591, -1661, 590, -1663, 590]),
("Output A/Input 4\n0x00/0x03", [9041, -4478, 589, -538, 590, -536, 588, -538, 590, -536, 591, -539, 588, -539, 587, -564, 563, -537, 589, -1660, 612, -1641, 590, -1663, 593, -1661, 592, -1661, 593, -1660, 592, -1661, 593, -1660, 593, -1660, 590, -1663, 589, -538, 589, -538, 588, -537, 591, -536, 592, -536, 591, -536, 591, -543, 582, -536, 592, -1660, 592, -1661, 593, -1660, 593, -1659, 590, -1664, 589, -1663, 614]),
("Output B/Input 1\n0x00/0x09", [9064, -4455, 589, -540, 587, -540, 586, -541, 605, -521, 587, -542, 586, -539, 587, -540, 587, -538, 589, -1663, 590, -1663, 613, -1641, 612, -1639, 616, -1640, 588, -1664, 590, -1663, 590, -1664, 589, -1665, 588, -539, 588, -541, 585, -1665, 613, -513, 614, -514, 611, -515, 613, -514, 613, -512, 590, -1665, 588, -1664, 590, -538, 588, -1665, 588, -1666, 588, -1663, 590, -1662, 616]),
("Output B/Input 2\n0x00/0x0A", [9039, -4480, 612, -515, 615, -513, 611, -517, 610, -512, 590, -541, 607, -518, 587, -540, 586, -542, 585, -1663, 590, -1663, 590, -1662, 590, -1664, 614, -1637, 616, -1639, 613, -1638, 590, -1663, 589, -538, 588, -1663, 590, -542, 605, -1643, 590, -539, 587, -544, 583, -539, 608, -517, 612, -1640, 616, -515, 610, -1638, 616, -515, 586, -1664, 589, -1664, 609, -1643, 610, -1644, 588]),
("Output B/Input 3\n0x00/0x0B", [9041, -4479, 608, -524, 585, -539, 587, -539, 588, -539, 588, -539, 607, -520, 587, -540, 586, -537, 612, -1640, 613, -1641, 613, -1641, 589, -1664, 589, -1663, 589, -1664, 589, -1663, 590, -1664, 589, -1664, 614, -1638, 615, -513, 615, -1637, 610, -523, 584, -540, 586, -540, 587, -539, 588, -538, 589, -542, 585, -1663, 590, -540, 587, -1664, 589, -1663, 616, -1637, 617, -1637, 614]),
("Output B/Input 4\n0x00/0x0C", [9039, -4481, 612, -514, 615, -515, 611, -541, 560, -540, 587, -542, 585, -540, 587, -539, 607, -520, 587, -1665, 607, -1646, 589, -1663, 590, -1664, 612, -1639, 614, -1639, 616, -1639, 590, -1664, 589, -539, 588, -539, 588, -1663, 589, -1664, 590, -540, 586, -539, 609, -520, 608, -516, 616, -1613, 637, -1639, 612, -517, 587, -540, 588, -1664, 608, -1644, 590, -1663, 589, -1663, 589]),
]
fig = plt.figure(figsize=(15, 8))
gs = fig.add_gridspec(len(signals), hspace=0)
axs = gs.subplots(sharex=True, sharey=True)
# fig, axs = plt.subplots(len(signals))
fig.suptitle('IR remote commands')
for i, (title, signal) in enumerate(signals):
x = 0
y = 0 if signal[0] > 0 else 1
x_values = []
y_values = []
for value in signal:
x_values.append(x)
x += abs(value)
x_values.append(x)
y_values.append(0 if value > 0 else 1)
y_values.append(0 if value > 0 else 1)
axs[i].margins(x=0)
axs[i].yaxis.set_visible(False)
axs[i].set_title(title, loc='left', x=0.005, y=1.0, pad=-28)
axs[i].plot(x_values, y_values)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment