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

Default SPI miso, mosi, sck, ss pins to the "standard" gpios 19, 23, 18, 5

This commit is contained in:
Stefan de Bruijn
2021-06-08 21:24:59 +02:00
parent 3bbe92a48d
commit c3fd9da5a1
2 changed files with 14 additions and 3 deletions

View File

@@ -360,6 +360,16 @@ void SPIBus::group(Configuration::HandlerBase& handler) {
handler.item("mosi", _sck);
}
void SPIBus::afterParse() {
if (_ss.undefined() && _miso.undefined() && _mosi.undefined() && _sck.undefined()) {
// Default SPI miso, mosi, sck, ss pins to the "standard" gpios 19, 23, 18, 5
_miso = Pin::create("gpio.19");
_mosi = Pin::create("gpio.23");
_sck = Pin::create("gpio.18");
_ss = Pin::create("gpio.5");
}
}
void UserOutputs::group(Configuration::HandlerBase& handler) {
handler.item("analog0", _analogOutput[0]);
handler.item("analog1", _analogOutput[1]);
@@ -577,15 +587,15 @@ bool MachineConfig::load(const char* filename) {
StringRange near(startNear, endNear);
log_error("Configuration parse error: " << ex.What() << " @ " << ex.LineNumber() << ":" << ex.ColumnNumber() << " near " << near);
} catch (const AssertionFailed& ex) {
sys.state = State::ConfigAlarm;
sys.state = State::ConfigAlarm;
// Get rid of buffer and return
log_error("Configuration loading failed: " << ex.what());
} catch (std::exception& ex) {
sys.state = State::ConfigAlarm;
sys.state = State::ConfigAlarm;
// Log exception:
log_error("Configuration validation error: " << ex.what());
} catch (...) {
sys.state = State::ConfigAlarm;
sys.state = State::ConfigAlarm;
// Get rid of buffer and return
log_error("Unknown error while processing config file");
}

View File

@@ -200,6 +200,7 @@ public:
void validate() const override;
void group(Configuration::HandlerBase& handler) override;
void afterParse() override;
~SPIBus() = default;
};