diff --git a/FluidNC/src/Settings.cpp b/FluidNC/src/Settings.cpp index 90ab44e1f..d5ff38135 100644 --- a/FluidNC/src/Settings.cpp +++ b/FluidNC/src/Settings.cpp @@ -12,8 +12,8 @@ #include #include -std::vector Setting::List = {}; -std::vector Command::List = {}; +std::vector Setting::List __attribute__((init_priority(101))) = {}; +std::vector Command::List __attribute__((init_priority(102))) = {}; bool anyState() { return false; @@ -35,14 +35,14 @@ Command::Command( const char* description, type_t type, permissions_t permissions, const char* grblName, const char* fullName, bool (*cmdChecker)()) : Word(type, permissions, description, grblName, fullName), _cmdChecker(cmdChecker) { - List.push_back(this); + List.insert(List.begin(), this); } Setting::Setting( const char* description, type_t type, permissions_t permissions, const char* grblName, const char* fullName, bool (*checker)(char*)) : Word(type, permissions, description, grblName, fullName), _checker(checker) { - List.push_back(this); + List.insert(List.begin(), this); // NVS keys are limited to 15 characters, so if the setting name is longer // than that, we derive a 15-character name from a hash function diff --git a/FluidNC/src/WebUI/BTConfig.cpp b/FluidNC/src/WebUI/BTConfig.cpp index 9443c8ada..fdcecb12d 100644 --- a/FluidNC/src/WebUI/BTConfig.cpp +++ b/FluidNC/src/WebUI/BTConfig.cpp @@ -17,7 +17,7 @@ // SerialBT sends the data over Bluetooth namespace WebUI { - BTConfig bt_config; + BTConfig bt_config __attribute__((init_priority(105))) ; BluetoothSerial SerialBT; BTChannel btChannel; } diff --git a/FluidNC/src/WebUI/NotificationsService.cpp b/FluidNC/src/WebUI/NotificationsService.cpp index cdf2dfddd..f03281553 100644 --- a/FluidNC/src/WebUI/NotificationsService.cpp +++ b/FluidNC/src/WebUI/NotificationsService.cpp @@ -15,7 +15,7 @@ #include "NotificationsService.h" namespace WebUI { - NotificationsService notificationsService; + NotificationsService notificationsService __attribute__((init_priority(106))) ; } #ifdef ENABLE_WIFI diff --git a/FluidNC/src/WebUI/TelnetServer.cpp b/FluidNC/src/WebUI/TelnetServer.cpp index 213f3b33e..f8329f9a2 100644 --- a/FluidNC/src/WebUI/TelnetServer.cpp +++ b/FluidNC/src/WebUI/TelnetServer.cpp @@ -9,7 +9,7 @@ #ifdef ENABLE_WIFI namespace WebUI { - TelnetServer telnetServer; + TelnetServer telnetServer __attribute__((init_priority(107))) ; } # include "WifiServices.h" diff --git a/FluidNC/src/WebUI/WebServer.cpp b/FluidNC/src/WebUI/WebServer.cpp index 966a017b6..2c0bf3e89 100644 --- a/FluidNC/src/WebUI/WebServer.cpp +++ b/FluidNC/src/WebUI/WebServer.cpp @@ -58,7 +58,7 @@ namespace WebUI { static const char LOCATION_HEADER[] = "Location"; - Web_Server webServer; + Web_Server webServer __attribute__((init_priority(108))) ; bool Web_Server::_setupdone = false; uint16_t Web_Server::_port = 0; diff --git a/FluidNC/src/WebUI/WifiConfig.cpp b/FluidNC/src/WebUI/WifiConfig.cpp index de9454f4c..6798fc4f2 100644 --- a/FluidNC/src/WebUI/WifiConfig.cpp +++ b/FluidNC/src/WebUI/WifiConfig.cpp @@ -8,7 +8,7 @@ #include #include -WebUI::WiFiConfig wifi_config; +WebUI::WiFiConfig wifi_config __attribute__((init_priority(109))) ; #ifdef ENABLE_WIFI # include "../Config.h"