1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-30 17:49:56 +02:00

Merge branch 'YamlSettings' of https://github.com/bdring/Grbl_Esp32 into YamlSettings

This commit is contained in:
bdring
2021-06-11 14:21:49 -05:00
5 changed files with 9 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ void grbl_init() {
// Load Grbl settings from non-volatile storage
debug_serial("Initializing settings...");
settings_init();
config->load();
config->load(config_filename->get());
info_serial("Name: %s", config->_name.c_str());
info_serial("Board: %s", config->_board.c_str());

View File

@@ -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.
fseek(file, 0, SEEK_END);
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);
buffer = new char[filesize + 1];

View File

@@ -361,7 +361,7 @@ public:
void group(Configuration::HandlerBase& handler) override;
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();
};

View File

@@ -1,5 +1,7 @@
#include "Grbl.h"
StringSetting* config_filename;
StringSetting* startup_line_0;
StringSetting* startup_line_1;
StringSetting* build_info;
@@ -72,4 +74,6 @@ void make_settings() {
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);
config_filename = new StringSetting(EXTENDED, WG, NULL, "Config/Filename", "/spiffs/config.yaml");
}

View File

@@ -1,5 +1,7 @@
#pragma once
extern StringSetting* config_filename;
extern StringSetting* startup_line_0;
extern StringSetting* startup_line_1;
extern StringSetting* build_info;