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
2 changes: 1 addition & 1 deletion usermods/quinled-an-penta/quinled-an-penta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class QuinLEDAnPentaUsermod : public Usermod

// Always draw these two on the bottom
char charUptime[charPerRow+1];
sprintf(charUptime, "Uptime: %ds", int(millis()/1000 + rolloverMillis*4294967)); // From json.cpp
sprintf(charUptime, "Uptime: %ds", int(millis()/1000 + getRolloverMillis()*4294967)); // From json.cpp
oledDisplay->drawStr(0, 53, charUptime);

char charWledVersion[charPerRow+1];
Expand Down
3 changes: 3 additions & 0 deletions wled00/fcn_declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ bool isAsterisksOnly(const char* str, byte maxLen);
void handleSettingsSet(AsyncWebServerRequest *request, byte subPage);
bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply=true);

//wled.cpp
uint16_t getRolloverMillis();

//udp.cpp
void notify(byte callMode, bool followUp=false);
uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, const uint8_t* buffer, uint8_t bri=255, bool isRGBW=false);
Expand Down
2 changes: 1 addition & 1 deletion wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ void serializeInfo(JsonObject root)
// Total PSRAM size in MB, round up to correct for allocator overhead
root[F("psrSz")] = (ESP.getPsramSize() + (1024U * 1024U - 1)) / (1024U * 1024U);
#endif
root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;
root[F("uptime")] = millis()/1000 + getRolloverMillis()*4294967;

char time[32];
getTimeString(time);
Expand Down
7 changes: 7 additions & 0 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
#endif
extern "C" void usePWMFixedNMI();

// millis()-rollover counter (millis() wraps every ~50 days) - previously
// WLED_GLOBAL. json.cpp and usermods only ever read it for uptime reporting,
// so it gets a by-value getter rather than a mutable reference: an accidental
// write from outside this file is now a build error instead of a silent bug.
static uint16_t rolloverMillis = 0;
uint16_t getRolloverMillis() { return rolloverMillis; }

/*
* Main WLED class implementation. Mostly initialization and connection logic
*/
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ WLED_GLOBAL unsigned long ntpLastSyncTime _INIT(NTP_NEVER);
WLED_GLOBAL unsigned long ntpPacketSentTime _INIT(NTP_NEVER);
WLED_GLOBAL IPAddress ntpServerIP;
WLED_GLOBAL uint16_t ntpLocalPort _INIT(2390);
WLED_GLOBAL uint16_t rolloverMillis _INIT(0);
// rolloverMillis is private to wled.cpp - use getRolloverMillis() instead.
WLED_GLOBAL float longitude _INIT(WLED_LON);
WLED_GLOBAL float latitude _INIT(WLED_LAT);
WLED_GLOBAL time_t sunrise _INIT(0);
Expand Down
Loading