Skip to content

Commit

Permalink
Clean up main.cpp a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Oct 10, 2024
1 parent e234f25 commit 68a22e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
9 changes: 0 additions & 9 deletions include/event_handlers/Init.h

This file was deleted.

15 changes: 9 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const char* const TAG = "main";
#include "Common.h"
#include "config/Config.h"
#include "EStopManager.h"
#include "event_handlers/Init.h"
#include "GatewayConnectionManager.h"
#include "Logging.h"
#include "OtaUpdateManager.h"
Expand All @@ -24,14 +23,14 @@ const char* const TAG = "main";
// Internal setup function, returns true if setup succeeded, false otherwise.
bool trySetup()
{
OpenShock::EventHandlers::Init();

if (!OpenShock::VisualStateManager::Init()) {
OS_PANIC(TAG, "Unable to initialize VisualStateManager");
OS_LOGE(TAG, "Unable to initialize VisualStateManager");
return false;
}

if (!OpenShock::EStopManager::Init()) {
OS_PANIC(TAG, "Unable to initialize EStopManager");
OS_LOGE(TAG, "Unable to initialize EStopManager");
return false;
}

if (!OpenShock::SerialInputHandler::Init()) {
Expand Down Expand Up @@ -95,7 +94,11 @@ void setup()
::Serial.begin(115'200);

OpenShock::Config::Init();
OpenShock::OtaUpdateManager::Init();

if (!OpenShock::OtaUpdateManager::Init()) {
OS_PANIC(TAG, "Unable to initialize OTA Update Manager");
}

if (OpenShock::OtaUpdateManager::IsValidatingApp()) {
otaSetup();
} else {
Expand Down

0 comments on commit 68a22e4

Please sign in to comment.