mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-30 03:26:13 +01:00
Compare commits
No commits in common. "923b031d06442d578607d7462de39897f58bd58b" and "27dc8059d78a6666ebb2c844ad64f952416d89bf" have entirely different histories.
923b031d06
...
27dc8059d7
|
@ -141,73 +141,44 @@ void setup()
|
||||||
CommandDistributor::broadcastPower();
|
CommandDistributor::broadcastPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
void looptimer(unsigned long timeout, const FSH* message)
|
|
||||||
{
|
|
||||||
static unsigned long lasttimestamp = 0;
|
|
||||||
unsigned long now = micros();
|
|
||||||
if (timeout != 0) {
|
|
||||||
unsigned long diff = now - lasttimestamp;
|
|
||||||
if (diff > timeout) {
|
|
||||||
DIAG(message);
|
|
||||||
DIAG(F("DeltaT=%L"), diff);
|
|
||||||
lasttimestamp = micros();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lasttimestamp = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// The main sketch has responsibilities during loop()
|
// The main sketch has responsibilities during loop()
|
||||||
|
|
||||||
// Responsibility 1: Handle DCC background processes
|
// Responsibility 1: Handle DCC background processes
|
||||||
// (loco reminders and power checks)
|
// (loco reminders and power checks)
|
||||||
looptimer(0, F(""));
|
|
||||||
DCC::loop();
|
DCC::loop();
|
||||||
looptimer(5000, F("DCC")); // got warnings up to 3884 during prog track read
|
|
||||||
|
|
||||||
// Responsibility 2: handle any incoming commands on USB connection
|
// Responsibility 2: handle any incoming commands on USB connection
|
||||||
SerialManager::loop();
|
SerialManager::loop();
|
||||||
looptimer(2000, F("Serial")); // got warnings up to 1900 during start
|
|
||||||
|
|
||||||
// Responsibility 3: Optionally handle any incoming WiFi traffic
|
// Responsibility 3: Optionally handle any incoming WiFi traffic
|
||||||
#ifndef ARDUINO_ARCH_ESP32
|
#ifndef ARDUINO_ARCH_ESP32
|
||||||
#if WIFI_ON
|
#if WIFI_ON
|
||||||
WifiInterface::loop();
|
WifiInterface::loop();
|
||||||
looptimer(9000, F("Wifi")); // got warnings up to 8000
|
|
||||||
|
|
||||||
#endif //WIFI_ON
|
#endif //WIFI_ON
|
||||||
#else //ARDUINO_ARCH_ESP32
|
#else //ARDUINO_ARCH_ESP32
|
||||||
#ifndef WIFI_TASK_ON_CORE0
|
#ifndef WIFI_TASK_ON_CORE0
|
||||||
WifiESP::loop();
|
WifiESP::loop();
|
||||||
looptimer(1000, F("WifiESP"));
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif //ARDUINO_ARCH_ESP32
|
#endif //ARDUINO_ARCH_ESP32
|
||||||
#if ETHERNET_ON
|
#if ETHERNET_ON
|
||||||
EthernetInterface::loop();
|
EthernetInterface::loop();
|
||||||
looptimer(10000, F("Ethernet"));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RMFT::loop(); // ignored if no automation
|
RMFT::loop(); // ignored if no automation
|
||||||
looptimer(1000, F("RMFT"));
|
|
||||||
|
|
||||||
#if defined(LCN_SERIAL)
|
#if defined(LCN_SERIAL)
|
||||||
LCN::loop();
|
LCN::loop();
|
||||||
looptimer(1000, F("LCN"));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Display refresh
|
// Display refresh
|
||||||
DisplayInterface::loop();
|
DisplayInterface::loop();
|
||||||
looptimer(2000, F("Display")); // got warnings around 1150
|
|
||||||
|
|
||||||
// Handle/update IO devices.
|
// Handle/update IO devices.
|
||||||
IODevice::loop();
|
IODevice::loop();
|
||||||
looptimer(1000, F("IODevice"));
|
|
||||||
|
|
||||||
Sensor::checkAll(); // Update and print changes
|
Sensor::checkAll(); // Update and print changes
|
||||||
looptimer(1000, F("Sensor"));
|
|
||||||
|
|
||||||
// Report any decrease in memory (will automatically trigger on first call)
|
// Report any decrease in memory (will automatically trigger on first call)
|
||||||
static int ramLowWatermark = __INT_MAX__; // replaced on first loop
|
static int ramLowWatermark = __INT_MAX__; // replaced on first loop
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-fozzie-202408071912Z"
|
#define GITHUB_SHA "devel-202406182019Z"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user