Skip to content

Commit

Permalink
Fix the problems caused by #950
Browse files Browse the repository at this point in the history
This is probably not the best way to fix it, since it uses a
GCC-specific feature, vut it works for now.
  • Loading branch information
MitchBradley committed Jul 13, 2023
1 parent 4704b8c commit e0a0a4b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions FluidNC/src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <vector>
#include <nvs.h>

std::vector<Setting*> Setting::List = {};
std::vector<Command*> Command::List = {};
std::vector<Setting*> Setting::List __attribute__((init_priority(101))) = {};
std::vector<Command*> Command::List __attribute__((init_priority(102))) = {};

bool anyState() {
return false;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/WebUI/BTConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/WebUI/NotificationsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "NotificationsService.h"

namespace WebUI {
NotificationsService notificationsService;
NotificationsService notificationsService __attribute__((init_priority(106))) ;
}

#ifdef ENABLE_WIFI
Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/WebUI/TelnetServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifdef ENABLE_WIFI

namespace WebUI {
TelnetServer telnetServer;
TelnetServer telnetServer __attribute__((init_priority(107))) ;
}

# include "WifiServices.h"
Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/WebUI/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/WebUI/WifiConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <sstream>
#include <iomanip>

WebUI::WiFiConfig wifi_config;
WebUI::WiFiConfig wifi_config __attribute__((init_priority(109))) ;

#ifdef ENABLE_WIFI
# include "../Config.h"
Expand Down

0 comments on commit e0a0a4b

Please sign in to comment.