mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-18 20:31:35 +02:00
Consistent and concise startup messages
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
#include "Report.h"
|
#include "Report.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "SettingsDefinitions.h"
|
#include "SettingsDefinitions.h"
|
||||||
#include "I2SOut.h"
|
|
||||||
#include "Limits.h"
|
#include "Limits.h"
|
||||||
#include "Protocol.h"
|
#include "Protocol.h"
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
@@ -66,7 +65,6 @@ void grbl_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load Grbl settings from non-volatile storage
|
// Load Grbl settings from non-volatile storage
|
||||||
debug_serial("Initializing settings...");
|
|
||||||
settings_init(); // requires config
|
settings_init(); // requires config
|
||||||
bool configOkay = config->load(config_filename->get());
|
bool configOkay = config->load(config_filename->get());
|
||||||
make_grbl_commands();
|
make_grbl_commands();
|
||||||
@@ -79,31 +77,26 @@ void grbl_init() {
|
|||||||
report_machine_type(CLIENT_SERIAL);
|
report_machine_type(CLIENT_SERIAL);
|
||||||
info_serial("Board: %s", config->_board.c_str());
|
info_serial("Board: %s", config->_board.c_str());
|
||||||
|
|
||||||
|
// The initialization order reflects dependencies between the subsystems
|
||||||
if (config->_i2so) {
|
if (config->_i2so) {
|
||||||
info_serial("Initializing I2SO...");
|
config->_i2so->init();
|
||||||
// The I2S out must be initialized before it can access the expanded GPIO port. Must be initialized _after_ settings!
|
|
||||||
i2s_out_init();
|
|
||||||
}
|
}
|
||||||
if (config->_spi) {
|
if (config->_spi) {
|
||||||
info_serial("Initializing SPI...");
|
|
||||||
// The SPI must be initialized before we can use it.
|
|
||||||
config->_spi->init();
|
config->_spi->init();
|
||||||
|
|
||||||
// Initialize SD card after SPI:
|
|
||||||
if (config->_sdCard != nullptr) {
|
if (config->_sdCard != nullptr) {
|
||||||
config->_sdCard->init();
|
config->_sdCard->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info_serial("Initializing steppers...");
|
|
||||||
stepper_init(); // Configure stepper pins and interrupt timers
|
stepper_init(); // Configure stepper pins and interrupt timers
|
||||||
|
|
||||||
info_serial("Initializing axes...");
|
|
||||||
config->_axes->read_settings();
|
config->_axes->read_settings();
|
||||||
config->_axes->init();
|
config->_axes->init();
|
||||||
|
|
||||||
config->_control->init();
|
config->_control->init();
|
||||||
init_output_pins(); // Configure pinout pins and pin-change interrupt (Renamed due to conflict with esp32 files)
|
init_output_pins(); // Configure pinout pins and pin-change interrupt (Renamed due to conflict with esp32 files)
|
||||||
|
|
||||||
memset(sys_position, 0, sizeof(sys_position)); // Clear machine position.
|
memset(sys_position, 0, sizeof(sys_position)); // Clear machine position.
|
||||||
|
|
||||||
machine_init(); // user supplied function for special initialization
|
machine_init(); // user supplied function for special initialization
|
||||||
|
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "I2SOBus.h"
|
#include "I2SOBus.h"
|
||||||
|
#include "../I2SOut.h"
|
||||||
|
#include "../Report.h"
|
||||||
|
|
||||||
namespace Machine {
|
namespace Machine {
|
||||||
void I2SOBus::validate() const {
|
void I2SOBus::validate() const {
|
||||||
@@ -32,4 +34,10 @@ namespace Machine {
|
|||||||
handler.item("data", _data);
|
handler.item("data", _data);
|
||||||
handler.item("ws", _ws);
|
handler.item("ws", _ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I2SOBus::init() {
|
||||||
|
info_serial("I2SO BCK:%s WS:%s DATA:%s", _bck.name().c_str(), _ws.name().c_str(), _data.name().c_str());
|
||||||
|
i2s_out_init();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,8 @@ namespace Machine {
|
|||||||
void validate() const override;
|
void validate() const override;
|
||||||
void group(Configuration::HandlerBase& handler) override;
|
void group(Configuration::HandlerBase& handler) override;
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
~I2SOBus() = default;
|
~I2SOBus() = default;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -85,17 +85,17 @@ namespace Machine {
|
|||||||
|
|
||||||
void MachineConfig::afterParse() {
|
void MachineConfig::afterParse() {
|
||||||
if (_axes == nullptr) {
|
if (_axes == nullptr) {
|
||||||
log_info("Axes config missing; building default axes");
|
log_info("Axes: using defaults");
|
||||||
_axes = new Axes();
|
_axes = new Axes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_coolant == nullptr) {
|
if (_coolant == nullptr) {
|
||||||
log_info("Coolant control config missing; building default coolant");
|
log_info("Coolant: using defaults");
|
||||||
_coolant = new CoolantControl();
|
_coolant = new CoolantControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_probe == nullptr) {
|
if (_probe == nullptr) {
|
||||||
log_info("Probe config missing; building default probe");
|
log_info("Probe: using defaults");
|
||||||
_probe = new Probe();
|
_probe = new Probe();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,12 +115,12 @@ namespace Machine {
|
|||||||
// Only if an i2so section is present will config->_i2so be non-null
|
// Only if an i2so section is present will config->_i2so be non-null
|
||||||
|
|
||||||
if (_control == nullptr) {
|
if (_control == nullptr) {
|
||||||
log_info("Control config missing; building default");
|
log_info("Control: using defaults");
|
||||||
_control = new Control();
|
_control = new Control();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_spindles.size() == 0) {
|
if (_spindles.size() == 0) {
|
||||||
log_info("Spindle config missing; using null spindle");
|
log_info("Spindle: using defaults (no spindle)");
|
||||||
_spindles.push_back(new Spindles::Null());
|
_spindles.push_back(new Spindles::Null());
|
||||||
}
|
}
|
||||||
uint32_t next_tool = 100;
|
uint32_t next_tool = 100;
|
||||||
@@ -131,7 +131,7 @@ namespace Machine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_comms == nullptr) {
|
if (_comms == nullptr) {
|
||||||
log_info("Comms config missing; building default comms");
|
log_info("Comms: using defaults");
|
||||||
_comms = new Communications();
|
_comms = new Communications();
|
||||||
#ifdef ENABLE_WIFI
|
#ifdef ENABLE_WIFI
|
||||||
_comms->_apConfig = new WifiAPConfig();
|
_comms->_apConfig = new WifiAPConfig();
|
||||||
@@ -225,7 +225,7 @@ namespace Machine {
|
|||||||
|
|
||||||
if (filesize > 0) {
|
if (filesize > 0) {
|
||||||
input = new StringRange(buffer, buffer + filesize);
|
input = new StringRange(buffer, buffer + filesize);
|
||||||
log_info("Using configuration file " << filename);
|
log_info("Configuration file: " << filename);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log_info("Using default configuration");
|
log_info("Using default configuration");
|
||||||
@@ -252,7 +252,7 @@ namespace Machine {
|
|||||||
|
|
||||||
handler.enterSection("machine", config);
|
handler.enterSection("machine", config);
|
||||||
|
|
||||||
log_info("Parsed configuration. Running after-parse tasks");
|
log_info("Running after-parse tasks");
|
||||||
|
|
||||||
// log_info("Heap size before after-parse is " << uint32_t(xPortGetFreeHeapSize()));
|
// log_info("Heap size before after-parse is " << uint32_t(xPortGetFreeHeapSize()));
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ namespace Machine {
|
|||||||
config->group(afterParse);
|
config->group(afterParse);
|
||||||
} catch (std::exception& ex) { log_info("Validation error: " << ex.what()); }
|
} catch (std::exception& ex) { log_info("Validation error: " << ex.what()); }
|
||||||
|
|
||||||
log_info("Validating configuration");
|
log_info("Checking configuration");
|
||||||
|
|
||||||
// log_info("Heap size before validation is " << uint32_t(xPortGetFreeHeapSize()));
|
// log_info("Heap size before validation is " << uint32_t(xPortGetFreeHeapSize()));
|
||||||
|
|
||||||
@@ -272,12 +272,12 @@ namespace Machine {
|
|||||||
config->group(validator);
|
config->group(validator);
|
||||||
} catch (std::exception& ex) { log_info("Validation error: " << ex.what()); }
|
} catch (std::exception& ex) { log_info("Validation error: " << ex.what()); }
|
||||||
|
|
||||||
log_info("Validated configuration");
|
|
||||||
|
|
||||||
// log_info("Heap size after configuation load is " << uint32_t(xPortGetFreeHeapSize()));
|
// log_info("Heap size after configuation load is " << uint32_t(xPortGetFreeHeapSize()));
|
||||||
|
|
||||||
successful = (sys.state != State::ConfigAlarm);
|
successful = (sys.state != State::ConfigAlarm);
|
||||||
|
|
||||||
|
log_info("Configuration is " << (successful ? "valid" : "invalid"));
|
||||||
|
|
||||||
} catch (const Configuration::ParseException& ex) {
|
} catch (const Configuration::ParseException& ex) {
|
||||||
sys.state = State::ConfigAlarm;
|
sys.state = State::ConfigAlarm;
|
||||||
auto startNear = ex.Near();
|
auto startNear = ex.Near();
|
||||||
|
@@ -81,6 +81,7 @@ void load_settings() {
|
|||||||
for (Setting* s = Setting::List; s; s = s->next()) {
|
for (Setting* s = Setting::List; s; s = s->next()) {
|
||||||
s->load();
|
s->load();
|
||||||
}
|
}
|
||||||
|
info_serial("Settings loaded from non-volatile storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void make_settings();
|
extern void make_settings();
|
||||||
|
Reference in New Issue
Block a user