I am trying to redefine WEBSOCKETS_TCP_TIMEOUT constant in this library: [https://github.com/Links2004/arduinoWebSockets]. But I do not want to change library, I would like to do it in my code.
Constant defined in WebSocket.h:
#ifndef WEBSOCKETS_TCP_TIMEOUT
#define WEBSOCKETS_TCP_TIMEOUT (5000)
#endif
But when I define the same constant in my code – library does not pick it up, stays with its unchanged value, although within my own code I see my desired value. Here is the sample of my code:
#define WEBSOCKETS_TCP_TIMEOUT (10)
#include <WebSocketsServer.h
void setup()
{
...
Serial.printf("WS Timeout: %drn", WEBSOCKETS_TCP_TIMEOUT);
}
It prints my desired value, but library operates with old value… If I put #include before my #define – the same. But if I remove my define and change definition in WebSocket.h (which I do not want to do) – it prints correct value and operated with new value.
What am I doing wrong? What is the proper way to re-refine constant defined in standard library?