mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 19:02:35 +02:00
Merge branch 'YamlSettings' of https://github.com/bdring/Grbl_Esp32 into YamlSettings
This commit is contained in:
@@ -46,7 +46,7 @@ void grbl_init() {
|
|||||||
// Load Grbl settings from non-volatile storage
|
// Load Grbl settings from non-volatile storage
|
||||||
debug_serial("Initializing settings...");
|
debug_serial("Initializing settings...");
|
||||||
settings_init();
|
settings_init();
|
||||||
config->load();
|
config->load(config_filename->get());
|
||||||
|
|
||||||
info_serial("Name: %s", config->_name.c_str());
|
info_serial("Name: %s", config->_name.c_str());
|
||||||
info_serial("Board: %s", config->_board.c_str());
|
info_serial("Board: %s", config->_board.c_str());
|
||||||
|
@@ -491,7 +491,7 @@ size_t MachineConfig::readFile(const char* filename, char*& buffer) {
|
|||||||
// in trouble with this, we can cut it in pieces and read it per chunk.
|
// in trouble with this, we can cut it in pieces and read it per chunk.
|
||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
auto filesize = ftell(file);
|
auto filesize = ftell(file);
|
||||||
log_debug("Configuration file is " << int(filesize) << " bytes");
|
log_debug("Configuration file has " << int(filesize) << " bytes");
|
||||||
|
|
||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
buffer = new char[filesize + 1];
|
buffer = new char[filesize + 1];
|
||||||
|
@@ -361,7 +361,7 @@ public:
|
|||||||
void group(Configuration::HandlerBase& handler) override;
|
void group(Configuration::HandlerBase& handler) override;
|
||||||
|
|
||||||
static size_t readFile(const char* file, char*& buffer);
|
static size_t readFile(const char* file, char*& buffer);
|
||||||
static bool load(const char* file = "/spiffs/config.yaml");
|
static bool load(const char* file);
|
||||||
|
|
||||||
~MachineConfig();
|
~MachineConfig();
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#include "Grbl.h"
|
#include "Grbl.h"
|
||||||
|
|
||||||
|
StringSetting* config_filename;
|
||||||
|
|
||||||
StringSetting* startup_line_0;
|
StringSetting* startup_line_0;
|
||||||
StringSetting* startup_line_1;
|
StringSetting* startup_line_1;
|
||||||
StringSetting* build_info;
|
StringSetting* build_info;
|
||||||
@@ -72,4 +74,6 @@ void make_settings() {
|
|||||||
user_macro0 = new StringSetting(EXTENDED, WG, NULL, "User/Macro0", DEFAULT_USER_MACRO0);
|
user_macro0 = new StringSetting(EXTENDED, WG, NULL, "User/Macro0", DEFAULT_USER_MACRO0);
|
||||||
|
|
||||||
message_level = +new EnumSetting(NULL, EXTENDED, WG, NULL, "Message/Level", static_cast<int8_t>(MsgLevel::Info), &messageLevels, NULL);
|
message_level = +new EnumSetting(NULL, EXTENDED, WG, NULL, "Message/Level", static_cast<int8_t>(MsgLevel::Info), &messageLevels, NULL);
|
||||||
|
|
||||||
|
config_filename = new StringSetting(EXTENDED, WG, NULL, "Config/Filename", "/spiffs/config.yaml");
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
extern StringSetting* config_filename;
|
||||||
|
|
||||||
extern StringSetting* startup_line_0;
|
extern StringSetting* startup_line_0;
|
||||||
extern StringSetting* startup_line_1;
|
extern StringSetting* startup_line_1;
|
||||||
extern StringSetting* build_info;
|
extern StringSetting* build_info;
|
||||||
|
Reference in New Issue
Block a user