diff --git a/src/ZeDMD.cpp b/src/ZeDMD.cpp index d505e10..6465641 100644 --- a/src/ZeDMD.cpp +++ b/src/ZeDMD.cpp @@ -211,7 +211,12 @@ bool ZeDMD::Open(int width, int height) void ZeDMD::SetPalette(uint8_t *pPalette) { - SetPalette(pPalette, 64); + m_paletteChanged = false; + if (memcmp(&m_palette, pPalette, 192)) + { + SetPalette(pPalette, 64); + m_paletteChanged = true; + } } void ZeDMD::SetPalette(uint8_t* pPalette, int numColors) @@ -310,7 +315,7 @@ void ZeDMD::RenderColoredGray6(uint8_t *pFrame, uint8_t *pRotations) if (!m_usb && !m_wifi) return; - if (UpdateFrameBuffer8(pFrame)) + if (UpdateFrameBuffer8(pFrame) || m_paletteChanged) { int width; int height; diff --git a/src/ZeDMD.h b/src/ZeDMD.h index 63fa6c8..1dd770f 100644 --- a/src/ZeDMD.h +++ b/src/ZeDMD.h @@ -101,6 +101,7 @@ class ZEDMDAPI ZeDMD bool m_wifi = false; bool m_downscaling = false; bool m_upscaling = false; + bool m_paletteChanged = false; uint8_t *m_pFrameBuffer; uint8_t *m_pScaledFrameBuffer;