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:
@@ -4,13 +4,20 @@
|
||||
#define MAX_4_CH_LEDS_PER_UNIVERSE 128
|
||||
#define MAX_CHANNELS_PER_UNIVERSE 512
|
||||
|
||||
// forward declarations
|
||||
static void handleDDPPacket(e131_packet_t* p);
|
||||
static void handleArtnetPollReply(IPAddress ipAddress);
|
||||
static void prepareArtnetPollReply(ArtPollReply *reply);
|
||||
static void sendArtnetPollReply(ArtPollReply *reply, IPAddress ipAddress, uint16_t portAddress);
|
||||
|
||||
|
||||
/*
|
||||
* E1.31 handler
|
||||
*/
|
||||
|
||||
//DDP protocol support, called by handleE131Packet
|
||||
//handles RGB data only
|
||||
void handleDDPPacket(e131_packet_t* p) {
|
||||
static void handleDDPPacket(e131_packet_t* p) {
|
||||
static bool ddpSeenPush = false; // have we seen a push yet?
|
||||
int lastPushSeq = e131LastSequenceNumber[0];
|
||||
|
||||
@@ -336,7 +343,7 @@ void handleDMXData(uint16_t uni, uint16_t dmxChannels, uint8_t* e131_data, uint8
|
||||
e131NewData = true;
|
||||
}
|
||||
|
||||
void handleArtnetPollReply(IPAddress ipAddress) {
|
||||
static void handleArtnetPollReply(IPAddress ipAddress) {
|
||||
ArtPollReply artnetPollReply;
|
||||
prepareArtnetPollReply(&artnetPollReply);
|
||||
|
||||
@@ -402,7 +409,7 @@ void handleArtnetPollReply(IPAddress ipAddress) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void prepareArtnetPollReply(ArtPollReply *reply) {
|
||||
static void prepareArtnetPollReply(ArtPollReply *reply) {
|
||||
// Art-Net
|
||||
reply->reply_id[0] = 0x41;
|
||||
reply->reply_id[1] = 0x72;
|
||||
@@ -521,7 +528,7 @@ void prepareArtnetPollReply(ArtPollReply *reply) {
|
||||
}
|
||||
}
|
||||
|
||||
void sendArtnetPollReply(ArtPollReply *reply, IPAddress ipAddress, uint16_t portAddress) {
|
||||
static void sendArtnetPollReply(ArtPollReply *reply, IPAddress ipAddress, uint16_t portAddress) {
|
||||
reply->reply_net_sw = (uint8_t)((portAddress >> 8) & 0x007F);
|
||||
reply->reply_sub_sw = (uint8_t)((portAddress >> 4) & 0x000F);
|
||||
reply->reply_sw_out[0] = (uint8_t)(portAddress & 0x000F);
|
||||
|
||||
Reference in New Issue
Block a user