Clean up global variables namespace, save a few 100 bytes of flash (#5368)
* reduce scope of some variables to "static" these are not used anywhere else. Making them static avoid name conflicts, cleans up the global scope and in some cases allows for better optimization by the compiler. * remove unused reference ``tz``from analog clock usermod * side-catch: remove two "local var shadows global var" warnings * reduce scope of functions declared globally, but not used anywhere else Safe to make static * declared in fcn_declare.h, only used locally in one file * not declared in fcn_declare.h, only used locally * HUB75 small optimization make bit array functions "static inline" -> better for optimization, saves some bytes because the compiler does not need to preserve a non-inline function copy for external references. * a few more static functions as suggested by the rabbit.
This commit is contained in:
@@ -5,15 +5,18 @@
|
||||
*/
|
||||
#ifdef WLED_ENABLE_WEBSOCKETS
|
||||
|
||||
// forward declarations
|
||||
static bool sendLiveLedsWs(uint32_t wsClient);
|
||||
|
||||
// define some constants for binary protocols, dont use defines but C++ style constexpr
|
||||
constexpr uint8_t BINARY_PROTOCOL_GENERIC = 0xFF; // generic / auto detect NOT IMPLEMENTED
|
||||
constexpr uint8_t BINARY_PROTOCOL_E131 = P_E131; // = 0, untested!
|
||||
constexpr uint8_t BINARY_PROTOCOL_ARTNET = P_ARTNET; // = 1, untested!
|
||||
constexpr uint8_t BINARY_PROTOCOL_DDP = P_DDP; // = 2
|
||||
|
||||
uint16_t wsLiveClientId = 0;
|
||||
unsigned long wsLastLiveTime = 0;
|
||||
//uint8_t* wsFrameBuffer = nullptr;
|
||||
static uint16_t wsLiveClientId = 0;
|
||||
static unsigned long wsLastLiveTime = 0;
|
||||
//static uint8_t* wsFrameBuffer = nullptr;
|
||||
|
||||
#define WS_LIVE_INTERVAL 40
|
||||
|
||||
@@ -185,7 +188,7 @@ void sendDataWs(AsyncWebSocketClient * client)
|
||||
releaseJSONBufferLock();
|
||||
}
|
||||
|
||||
bool sendLiveLedsWs(uint32_t wsClient)
|
||||
static bool sendLiveLedsWs(uint32_t wsClient)
|
||||
{
|
||||
AsyncWebSocketClient * wsc = ws.client(wsClient);
|
||||
if (!wsc || wsc->queueLength() > 0) return false; //only send if queue free
|
||||
|
||||
Reference in New Issue
Block a user