Description
The fix for 2250, commit daea578, changed the unsigned long millis()
into returning (unsigned long) micros()/1000
.
This potentially seems to have two side effects; firstly it means the top 10 bits of this unsigned long are no longer used (micros() is also an unsigned long; wrapping every 1 hour and 12 minutes - so millis() follows suit in the bottom 21 bits).
And secondly it breaks the time honoured (and very common code in Arduino libraries) of the type:
unsigned long last = 0;
void loop() {
// Use a substract to make sure that this also works when millis() wraps
// around. See https://playground.arduino.cc/Code/TimingRollover
if (millis() - last > 5*1000UL) {
Serial.println("5 second tock");
last = millis();
};
Such as used in all sort of TCP clients, SSL session key renewals, MQTT ping/acks, websocket callbacks and so on.
Board: All ESP
Core Installation version: master from git as of today.
IDE name: Arduino IDE, Platformio
Flash Frequency: All
PSRAM enabled: either
Upload Speed: 115200
Computer OS: OSX
The ideal solution would perhaps be to use a slower timer; or to derive the millis() form micros - but let it keep its own top 10 bit accounting.