From 6b9ca8c3893b6213d9978851954692a97bfa6347 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Sun, 22 Jan 2023 18:19:20 -0500 Subject: [PATCH] Switch to OTA app if an unexpected error occurs --- src/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9648849..9b74bb7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -186,10 +186,14 @@ void loop() } else if (M5.BtnC.wasClicked()) { next = App::Text; } - if (next != current_app) { - switch_app(next); - } else { - app->loop(); + try { + if (next != current_app) { + switch_app(next); + } else { + app->loop(); + } + } catch (...) { + switch_app(App::OTA); } yield(); }