Move the setup stop code to a separate (reusable) function

This commit is contained in:
Gergely Polonkai 2021-01-15 10:06:18 +01:00
parent b7a808eaa3
commit 8f223e8877
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 9 additions and 3 deletions

View File

@ -97,6 +97,14 @@ send_metrics()
server.send(200, "text/plain; version=0.0.4; charset=utf-8", message);
}
void
stop()
{
while (1) {
delay(1000);
}
}
void
setup()
{
@ -120,9 +128,7 @@ setup()
if (!MDNS.begin(MDNS_NAME)) {
Serial.println("Error setting up mDNS responder!");
while (1) {
delay(1000);
}
stop();
}
server.on("/metrics", HTTP_GET, send_metrics);