#include "SharedState.h" #include "UIThread.h" #include "AudioThread.h" void setup() { Serial.begin(115200); delay(2000); // Wait for serial monitor Serial.println(F("Starting NoiceSynth...")); setupUI(); setupAudio(); Serial.println(F("Started.")); // Enable Watchdog lastLoop0Time = millis(); lastLoop1Time = millis(); watchdogActive = true; } void loop1() { if (!watchdogActive) { delay(100); return; } unsigned long now = millis(); lastLoop1Time = now; if (watchdogActive && (now - lastLoop0Time > 1000)) { Serial.println(F("Core 0 Freeze detected! Rebooting...")); rp2040.reboot(); } loopAudio(); } void loop() { unsigned long now = millis(); lastLoop0Time = now; if (watchdogActive && (now - lastLoop1Time > 1000)) { Serial.println(F("Core 1 Freeze detected! Rebooting...")); rp2040.reboot(); } loopUI(); }