Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion usermods/Analog_Clock/Analog_Clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/*
* Usermod for analog clock
*/
extern Timezone* tz;

class AnalogClockUsermod : public Usermod {
private:
Expand Down
6 changes: 3 additions & 3 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
//#define MAX_FREQ_LOG10 3.71f

// effect utility functions
uint8_t sin_gap(uint16_t in) {
static uint8_t sin_gap(uint16_t in) {
if (in & 0x100) return 0;
return sin8_t(in + 192); // correct phase shift of sine so that it starts and stops at 0
}

uint16_t triwave16(uint16_t in) {
static uint16_t triwave16(uint16_t in) {
if (in < 0x8000) return in *2;
return 0xFFFF - (in - 0x8000)*2;
}
Expand All @@ -99,7 +99,7 @@ uint16_t triwave16(uint16_t in) {
* @param attdec attack & decay, max. pulsewidth / 2
* @returns signed waveform value
*/
int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) {
static int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) {
int8_t a = 127;
if (x > 127) {
a = -127;
Expand Down
12 changes: 4 additions & 8 deletions wled00/bus_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@
#include "bus_wrapper.h"
#include "wled.h"

extern char cmDNS[];
extern bool cctICused;
extern bool useParallelI2S;

// functions to get/set bits in an array - based on functions created by Brandon for GOL
// toDo : make this a class that's completely defined in a header file
// note: these functions are automatically inline by the compiler
bool getBitFromArray(const uint8_t* byteArray, size_t position) { // get bit value
static inline bool getBitFromArray(const uint8_t* byteArray, size_t position) { // get bit value
size_t byteIndex = position >> 3; // divide by 8
unsigned bitIndex = position & 0x07; // modulo 8
uint8_t byteValue = byteArray[byteIndex];
return (byteValue >> bitIndex) & 1;
}

void setBitInArray(uint8_t* byteArray, size_t position, bool value) { // set bit - with error handling for nullptr
static inline void setBitInArray(uint8_t* byteArray, size_t position, bool value) { // set bit - with error handling for nullptr
//if (byteArray == nullptr) return;
size_t byteIndex = position >> 3; // divide by 8
unsigned bitIndex = position & 0x07; // modulo 8
Expand All @@ -41,11 +37,11 @@ void setBitInArray(uint8_t* byteArray, size_t position, bool value) { // set bi
byteArray[byteIndex] &= ~(1 << bitIndex);
}

size_t getBitArrayBytes(size_t num_bits) { // number of bytes needed for an array with num_bits bits
static inline size_t getBitArrayBytes(size_t num_bits) { // number of bytes needed for an array with num_bits bits
return (num_bits + 7) >> 3;
}

void setBitArray(uint8_t* byteArray, size_t numBits, bool value) { // set all bits to same value
static inline void setBitArray(uint8_t* byteArray, size_t numBits, bool value) { // set all bits to same value
if (byteArray == nullptr) return;
size_t len = getBitArrayBytes(numBits);
if (value) memset(byteArray, 0xFF, len);
Expand Down
2 changes: 1 addition & 1 deletion wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static constexpr bool validatePinsAndTypes(const unsigned* types, unsigned numTy
//simple macro for ArduinoJSON's or syntax
#define CJSON(a,b) a = b | a

void getStringFromJson(char* dest, const char* src, size_t len) {
static inline void getStringFromJson(char* dest, const char* src, size_t len) {
if (src != nullptr) strlcpy(dest, src, len);
}

Expand Down
15 changes: 11 additions & 4 deletions wled00/e131.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions wled00/fcn_declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ void handleDMXInput();
//e131.cpp
void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol);
void handleDMXData(uint16_t uni, uint16_t dmxChannels, uint8_t* e131_data, uint8_t mde, uint8_t previousUniverses);
void handleArtnetPollReply(IPAddress ipAddress);
void prepareArtnetPollReply(ArtPollReply* reply);
void sendArtnetPollReply(ArtPollReply* reply, IPAddress ipAddress, uint16_t portAddress);
// void handleArtnetPollReply(IPAddress ipAddress); // local function, only used in e131.cpp
// void prepareArtnetPollReply(ArtPollReply* reply); // local function, only used in e131.cpp
// void sendArtnetPollReply(ArtPollReply* reply, IPAddress ipAddress, uint16_t portAddress); // local function, only used in e131.cpp

//file.cpp
bool handleFileRead(AsyncWebServerRequest*, String path);
Expand Down Expand Up @@ -207,8 +207,8 @@ void publishMqtt();
//ntp.cpp
void handleTime();
void handleNetworkTime();
void sendNTPPacket();
bool checkNTPResponse();
// void sendNTPPacket(); // local function, only used in ntp.cpp
// bool checkNTPResponse(); // local function, only used in ntp.cpp
void updateLocalTime();
void getTimeString(char* out);
bool checkCountdown();
Expand All @@ -221,8 +221,8 @@ void setTimeFromAPI(uint32_t timein);

//overlay.cpp
void handleOverlayDraw();
void _overlayAnalogCountdown();
void _overlayAnalogClock();
// void _overlayAnalogCountdown(); // local function, only used in overlay.cpp
// void _overlayAnalogClock(); // local function, only used in overlay.cpp

//playlist.cpp
void shufflePlaylist();
Expand Down
6 changes: 3 additions & 3 deletions wled00/improv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#endif

#define IMPROV_VERSION 1

void parseWiFiCommand(char *rpcData);
// forward declarations
static void parseWiFiCommand(char* rpcData);

enum ImprovPacketType {
Current_State = 0x01,
Expand Down Expand Up @@ -252,7 +252,7 @@ void startImprovWifiScan() {}
void handleImprovWifiScan() {}
#endif

void parseWiFiCommand(char* rpcData) {
static void parseWiFiCommand(char* rpcData) {
unsigned len = rpcData[0];
if (!len || len > 126) return;

Expand Down
16 changes: 8 additions & 8 deletions wled00/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* Infrared sensor support for several generic RGB remotes and custom JSON remote
*/

IRrecv* irrecv;
decode_results results;
unsigned long irCheckedTime = 0;
uint32_t lastValidCode = 0;
byte lastRepeatableAction = ACTION_NONE;
uint8_t lastRepeatableValue = 0;
uint16_t irTimesRepeated = 0;
uint8_t lastIR6ColourIdx = 0;
static IRrecv* irrecv;
static decode_results results;
static unsigned long irCheckedTime = 0;
static uint32_t lastValidCode = 0;
static byte lastRepeatableAction = ACTION_NONE;
static uint8_t lastRepeatableValue = 0;
static uint16_t irTimesRepeated = 0;
static uint8_t lastIR6ColourIdx = 0;


// brightnessSteps: a static array of brightness levels following a geometric
Expand Down
4 changes: 2 additions & 2 deletions wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ void serializeInfo(JsonObject root)
root["ip"] = s;
}

void setPaletteColors(JsonArray json, CRGBPalette16 palette)
static void setPaletteColors(JsonArray json, CRGBPalette16 palette)
{
for (int i = 0; i < 16; i++) {
JsonArray colors = json.createNestedArray();
Expand All @@ -910,7 +910,7 @@ void setPaletteColors(JsonArray json, CRGBPalette16 palette)
}
}

void setPaletteColors(JsonArray json, byte* tcp)
static void setPaletteColors(JsonArray json, byte* tcp)
{
TRGBGradientPaletteEntryUnion* ent = (TRGBGradientPaletteEntryUnion*)(tcp);
TRGBGradientPaletteEntryUnion u;
Expand Down
13 changes: 9 additions & 4 deletions wled00/ntp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#include "wled.h"
#include "fcn_declare.h"

// forward declarations
static void sendNTPPacket();
static bool checkNTPResponse();


// WARNING: may cause errors in sunset calculations on ESP8266, see #3400
// building with `-D WLED_USE_REAL_MATH` will prevent those errors at the expense of flash and RAM

Expand All @@ -11,7 +16,7 @@
//#define WLED_DEBUG_NTP
#define NTP_SYNC_INTERVAL 42000UL //Get fresh NTP time about twice per day

Timezone* tz;
static Timezone* tz;

#define TZ_UTC 0
#define TZ_UK 1
Expand Down Expand Up @@ -42,7 +47,7 @@ Timezone* tz;
#define TZ_COUNT 25
#define TZ_INIT 255

byte tzCurrent = TZ_INIT; //uninitialized
static byte tzCurrent = TZ_INIT; //uninitialized

/* C++11 form -- static std::array<std::pair<TimeChangeRule, TimeChangeRule>, TZ_COUNT> TZ_TABLE PROGMEM = {{ */
static const std::pair<TimeChangeRule, TimeChangeRule> TZ_TABLE[] PROGMEM = {
Expand Down Expand Up @@ -199,7 +204,7 @@ void handleNetworkTime()
}
}

void sendNTPPacket()
static void sendNTPPacket()
{
if (!ntpServerIP.fromString(ntpServerName)) //see if server is IP or domain
{
Expand Down Expand Up @@ -245,7 +250,7 @@ static bool isValidNtpResponse(const byte* ntpPacket) {
return true;
}

bool checkNTPResponse()
static bool checkNTPResponse()
{
int cb = ntpUdp.parsePacket();
if (cb < NTP_MIN_PACKET_SIZE) {
Expand Down
7 changes: 5 additions & 2 deletions wled00/overlay.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "wled.h"

// forward declarations
static void _overlayAnalogCountdown();

/*
* Used to draw clock overlays over the strip
*/

void _overlayAnalogClock()
static void _overlayAnalogClock()
{
int overlaySize = overlayMax - overlayMin +1;
if (countdownMode)
Expand Down Expand Up @@ -47,7 +50,7 @@ void _overlayAnalogClock()
}


void _overlayAnalogCountdown()
static void _overlayAnalogCountdown()
{
if ((unsigned long)toki.second() < countdownTime)
{
Expand Down
2 changes: 1 addition & 1 deletion wled00/remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static void setOff() {
}
}

void presetWithFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) {
static void presetWithFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) {
resetNightMode();
applyPresetWithFallback(presetID, CALL_MODE_BUTTON_PRESET, effectID, paletteID);
}
Expand Down
10 changes: 5 additions & 5 deletions wled00/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,16 +570,16 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
macroAlexaOff = request->arg(F("A1")).toInt();
macroCountdown = request->arg(F("MC")).toInt();
macroNl = request->arg(F("MN")).toInt();
int i = 0;
int ii = 0;
for (auto &button : buttons) {
char mp[4] = "MP"; mp[2] = (i<10?'0':'A'-10)+i; mp[3] = 0; // short
char ml[4] = "ML"; ml[2] = (i<10?'0':'A'-10)+i; ml[3] = 0; // long
char md[4] = "MD"; md[2] = (i<10?'0':'A'-10)+i; md[3] = 0; // double
char mp[4] = "MP"; mp[2] = (ii<10?'0':'A'-10)+ii; mp[3] = 0; // short
char ml[4] = "ML"; ml[2] = (ii<10?'0':'A'-10)+ii; ml[3] = 0; // long
char md[4] = "MD"; md[2] = (ii<10?'0':'A'-10)+ii; md[3] = 0; // double
//if (!request->hasArg(mp)) break;
button.macroButton = request->arg(mp).toInt(); // these will default to 0 if not present
button.macroLongPress = request->arg(ml).toInt();
button.macroDoublePress = request->arg(md).toInt();
i++;
ii++;
}

char k[3]; k[2] = 0;
Expand Down
2 changes: 1 addition & 1 deletion wled00/udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ void exitRealtime() {

#define TMP2NET_OUT_PORT 65442

void sendTPM2Ack() {
static void sendTPM2Ack() {
notifierUdp.beginPacket(notifierUdp.remoteIP(), TMP2NET_OUT_PORT);
uint8_t response_ack = 0xac;
notifierUdp.write(&response_ack, 1);
Expand Down
2 changes: 1 addition & 1 deletion wled00/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ int16_t extractModeDefaults(uint8_t mode, const char *segVar)
void checkSettingsPIN(const char* pin) {
if (!pin) return;
if (!correctPIN && millis() - lastEditTime < PIN_RETRY_COOLDOWN) return; // guard against PIN brute force
bool correctBefore = correctPIN;
//bool correctBefore = correctPIN; // unused
correctPIN = (strlen(settingsPIN) == 0 || strncmp(settingsPIN, pin, 4) == 0);
lastEditTime = millis();
}
Expand Down
13 changes: 8 additions & 5 deletions wled00/wled_serial.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "wled.h"

// forward declarations
static void sendBytes();

/*
* Adalight and TPM2 handler
*/
Expand All @@ -19,9 +22,9 @@ enum class AdaState {
TPM2_Header_CountLo,
};

uint16_t currentBaud = 1152; //default baudrate 115200 (divided by 100)
bool continuousSendLED = false;
uint32_t lastUpdate = 0;
static uint16_t currentBaud = 1152; //default baudrate 115200 (divided by 100)
static bool continuousSendLED = false;
static uint32_t lastUpdate = 0;

void updateBaudRate(uint32_t rate){
unsigned rate100 = rate/100;
Expand All @@ -37,7 +40,7 @@ void updateBaudRate(uint32_t rate){
}

// RGB LED data return as JSON array. Slow, but easy to use on the other end.
void sendJSON(){
static inline void sendJSON(){
if (serialCanTX) {
unsigned used = strip.getLengthTotal();
Serial.write('[');
Expand All @@ -50,7 +53,7 @@ void sendJSON(){
}

// RGB LED data returned as bytes in TPM2 format. Faster, and slightly less easy to use on the other end.
void sendBytes(){
static void sendBytes(){
if (serialCanTX) {
Serial.write(0xC9); Serial.write(0xDA);
unsigned used = strip.getLengthTotal();
Expand Down
Loading