Skip to content

Commit 89044f5

Browse files
committed
initialize update
1 parent afb09a1 commit 89044f5

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

include/DMDUtil/DMD.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,20 @@ class DMDUTILAPI DMD
108108
#pragma pack(push, 1) // Align to 1-byte boundaries, important for sending over socket.
109109
struct Update
110110
{
111-
Mode mode;
112-
AlphaNumericLayout layout;
113-
int depth;
114-
uint8_t data[256 * 64 * 3];
115-
uint16_t segData[256 * 64]; // RGB16 or segment data or SerumV1 palette
111+
Mode mode = Mode::Data; // int
112+
AlphaNumericLayout layout = AlphaNumericLayout::NoLayout; // int
113+
int depth = 2;
114+
uint8_t data[256 * 64 * 3] = {0};
115+
uint16_t segData[256 * 64] = {0}; // RGB16 or segment data or SerumV1 palette
116116
uint16_t segData2[128];
117-
bool hasData;
118-
bool hasSegData;
119-
bool hasSegData2;
120-
uint8_t r;
121-
uint8_t g;
122-
uint8_t b;
123-
uint16_t width;
124-
uint16_t height;
117+
bool hasData = false;
118+
bool hasSegData = false;
119+
bool hasSegData2 = false;
120+
uint8_t r = 255;
121+
uint8_t g = 255;
122+
uint8_t b = 255;
123+
uint16_t width = 128;
124+
uint16_t height = 32;
125125

126126
DMDUTILAPI void convertToHostByteOrder();
127127
DMDUTILAPI Update toNetworkByteOrder() const;

src/DMD.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ DMD::DMD()
150150
m_pSerum = nullptr;
151151
m_pZeDMD = nullptr;
152152
m_pPUPDMD = nullptr;
153-
m_pZeDMD = nullptr;
153+
154154
m_pZeDMDThread = nullptr;
155155
m_pLevelDMDThread = nullptr;
156156
m_pRGB24DMDThread = nullptr;
@@ -429,10 +429,6 @@ void DMD::UpdateData(const uint8_t* pData, int depth, uint16_t width, uint16_t h
429429
Mode mode, bool buffered)
430430
{
431431
auto dmdUpdate = std::make_shared<Update>();
432-
dmdUpdate->mode = mode;
433-
dmdUpdate->depth = depth;
434-
dmdUpdate->width = width;
435-
dmdUpdate->height = height;
436432
if (pData)
437433
{
438434
memcpy(dmdUpdate->data, pData, (size_t)width * height * (mode == Mode::RGB16 ? 2 : (mode == Mode::RGB24 ? 3 : 1)));
@@ -442,6 +438,10 @@ void DMD::UpdateData(const uint8_t* pData, int depth, uint16_t width, uint16_t h
442438
{
443439
dmdUpdate->hasData = false;
444440
}
441+
dmdUpdate->mode = mode;
442+
dmdUpdate->depth = depth;
443+
dmdUpdate->width = width;
444+
dmdUpdate->height = height;
445445
dmdUpdate->hasSegData = false;
446446
dmdUpdate->hasSegData2 = false;
447447
dmdUpdate->r = r;

0 commit comments

Comments
 (0)