luksal/ESP32-DMX

Case missmatch in SimpleRX.ino

Closed this issue · 4 comments

Disclaimer: this could be an issue with my test bed. I'm using VSCode & platformio.
The code in SimpleRX:

if(DMX_healthy()) ... ... Serial.print(DMX_read(1));

But, the definition in .cpp & .h:

`static uint8_t Read(uint16_t channel);

    static bool IsHealthy();  `

I changed SimpleRX to:
if(DMX::IsHealthy()) ... ... Serial.print(DMX::Read(1));

And it appears to work.

I'm sorry, there was a type in the example. It is now fixed

Ok, I figured as much...
Just curious (and showing my limited C/C++ knowledge probably...)

What is the define used for in the .h file? (I understand the ifndef/define, but what is the DMX_h?)

#ifndef DMX_h #define DMX_h

That is called an "include guard", it's a common pattern to prevent that a header file is included multiple times.
More information: https://en.wikipedia.org/wiki/Include_guard

Duh...looked at the link and connected the #endif to #ifndef. Must have jogged some cobwebs in my brain.

Thanks!