1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-01 18:32:37 +02:00

Fixed thread fencing for settings

Fixed copyright comments
This commit is contained in:
Stefan de Bruijn
2021-05-25 09:48:24 +02:00
parent 5ca34f9911
commit 8efe02e565
72 changed files with 1208 additions and 45 deletions

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "StackTrace/AssertionFailed.h"
@@ -11,7 +29,7 @@ class AssertionFailed;
#define Assert(condition, ...) \
{ \
if (!(condition)) { \
const char* ch = #condition " (@line " Stringify2(__LINE__) ")"; \
const char* ch = #condition " (@line " Stringify2(__LINE__) ")"; \
throw AssertionFailed::create(ch, ##__VA_ARGS__); \
} \
}

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AfterParse.h"
#include "Configurable.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Generator.h"

View File

@@ -1,11 +1,34 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Generator.h"
#include "Configurable.h"
#include <cstring>
#include <cstdio>
#include <atomic>
namespace Configuration {
Generator::Generator(SimpleOutputStream& dst) : indent_(0), dst_(dst) {
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst);
}
void Generator::enter(const char* name) {
indent();
dst_ << name << ":\n";

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>
@@ -35,7 +53,7 @@ namespace Configuration {
HandlerType handlerType() override { return HandlerType::Generator; }
public:
Generator(SimpleOutputStream& dst) : indent_(0), dst_(dst) {}
Generator(SimpleOutputStream& dst);
void handle(const char* name, int& value) override {
indent();

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "HandlerType.h"
@@ -39,13 +57,6 @@ namespace Configuration {
virtual void handle(const char* name, StringRange& value) = 0;
virtual void handle(const char* name, Pin& value) = 0;
template <typename T>
inline void handle(const char* name, volatile T& value) {
T val = value;
handle(name, val);
value = val;
}
virtual void handle(const char* name, String& value) {
StringRange range;
handle(name, range);

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace Configuration {

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "LegacySettingRegistry.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "LegacySettingRegistry.h"
#include "LegacySettingHandler.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace Configuration {

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Parser.h"
#include "ParseException.h"
@@ -22,7 +40,6 @@ namespace Configuration {
}
}
bool Parser::is(const char* expected) const {
if (current_.keyStart_ == nullptr) {
return false;

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Tokenizer.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "HandlerBase.h"

View File

@@ -1,8 +1,32 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "RuntimeSetting.h"
#include <cstdlib>
#include <atomic>
namespace Configuration {
RuntimeSetting::RuntimeSetting(const char* runtimeSetting) : setting_(runtimeSetting + 1), start_(runtimeSetting + 1) {
// Read fence for config. Shouldn't be necessary, but better safe than sorry.
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst);
}
void RuntimeSetting::handleDetail(const char* name, Configuration::Configurable* value) {
if (is(name) && this->value() == nullptr) {
auto previous = start_;
@@ -49,4 +73,8 @@ namespace Configuration {
value = Pin::create(StringRange(this->value()));
}
}
RuntimeSetting::~RuntimeSetting() {
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // Write fence for config
}
}

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "HandlerBase.h"
@@ -35,7 +53,7 @@ namespace Configuration {
bool matchesUninitialized(const char* name) override { return false; }
public:
RuntimeSetting(const char* runtimeSetting) : setting_(runtimeSetting + 1), start_(runtimeSetting + 1) {}
RuntimeSetting(const char* runtimeSetting);
void handle(const char* name, int& value) override;
void handle(const char* name, double& value) override;
@@ -43,5 +61,7 @@ namespace Configuration {
void handle(const char* name, Pin& value) override;
HandlerType handlerType() override { return HandlerType::Runtime; }
virtual ~RuntimeSetting();
};
}

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace Configuration {

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Tokenizer.h"
#include "ParseException.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "TokenKind.h"

View File

@@ -1,10 +1,34 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Validator.h"
#include "Configurable.h"
#include <cstring>
#include <atomic>
namespace Configuration {
Validator::Validator() {
// Read fence for config. Shouldn't be necessary, but better safe than sorry.
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst);
}
void Validator::handleDetail(const char* name, Configurable* value) {
value->validate();
value->handle(*this);

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>
@@ -18,7 +36,7 @@ namespace Configuration {
HandlerType handlerType() override { return HandlerType::Validator; }
public:
Validator() = default;
Validator();
void handle(const char* name, bool& value) override {}
void handle(const char* name, int& value) override {}

View File

@@ -4,8 +4,10 @@
Copyright (c) 2012-2016 Sungeun K. Jeon for Gnea Research LLC
2018 - Bart Dring This file was modifed for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
2018 - Bart Dring. This file was modifed for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
2021 - Stefan de Bruijn. Introduced classes and configuration for
coolant control.
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -28,6 +28,8 @@
#include "Grbl.h"
#include "MachineConfig.h"
#include <atomic>
xQueueHandle limit_sw_queue; // used by limit switch debouncing
// Homing axis search distance multiplier. Computed by this value times the cycle travel.
@@ -403,6 +405,8 @@ void limits_soft_check(float* target) {
// this is the task
void limitCheckTask(void* pvParameters) {
while (true) {
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings
int evt;
xQueueReceive(limit_sw_queue, &evt, portMAX_DELAY); // block until receive queue
vTaskDelay(DEBOUNCE_PERIOD / portTICK_PERIOD_MS); // delay a while

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Logging.h"
#ifndef ESP32

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "SimpleOutputStream.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MachineConfig.h"
#include "Motors/Motor.h"
@@ -14,6 +32,7 @@
#include <SPIFFS.h>
#include <cstdio>
#include <cstring>
#include <atomic>
MachineConfig* config;
@@ -498,6 +517,9 @@ bool MachineConfig::load(const char* filename) {
delete[] buffer;
}
delete[] input;
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst);
return successful;
}

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Assert.h"

View File

@@ -32,6 +32,8 @@
#include "Servo.h"
#include "../MachineConfig.h"
#include <atomic>
namespace Motors {
Servo* Servo::List = NULL;
@@ -62,6 +64,7 @@ namespace Motors {
xLastWakeTime = xTaskGetTickCount(); // Initialise the xLastWakeTime variable with the current time.
vTaskDelay(2000); // initial delay
while (true) { // don't ever return from this or the task dies
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings
for (Servo* p = List; p; p = p->link) {
p->update();
}

View File

@@ -21,6 +21,7 @@
#include "../MachineConfig.h"
#include <TMCStepper.h>
#include <atomic>
#ifdef USE_I2S_OUT
@@ -365,6 +366,7 @@ namespace Motors {
xLastWakeTime = xTaskGetTickCount(); // Initialise the xLastWakeTime variable with the current time.
while (true) { // don't ever return from this or the task dies
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings
if (sys.state == State::Cycle || sys.state == State::Homing || sys.state == State::Jog) {
for (TrinamicDriver* p = List; p; p = p->link) {
if (p->_stallguardDebugMode) {

View File

@@ -26,6 +26,7 @@
#include "../MachineConfig.h"
#include <TMCStepper.h>
#include <atomic>
Uart tmc_serial(TMC_UART);
@@ -338,6 +339,7 @@ namespace Motors {
xLastWakeTime = xTaskGetTickCount(); // Initialise the xLastWakeTime variable with the current time.
while (true) { // don't ever return from this or the task dies
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings
if (sys.state == State::Cycle || sys.state == State::Homing || sys.state == State::Jog) {
for (TrinamicUartDriver* p = List; p; p = p->link) {
if (p->_stallguardDebugMode) {

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Pin.h"
// Pins:

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Pins/PinLookup.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
// This file attempts to build all the pin settings definitions, while retaining backward compatibility with the
// original machine files.
//

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PwmPin.h"
#include "../Pin.h"
@@ -81,7 +99,7 @@ namespace PinUsers {
}
public:
NativePwm(Pin pin, uint32_t frequency, uint32_t maxDuty) : pin_(pin), frequency_(frequency), maxDuty_(maxDuty){
NativePwm(Pin pin, uint32_t frequency, uint32_t maxDuty) : pin_(pin), frequency_(frequency), maxDuty_(maxDuty) {
auto native = pin.getNative(Pin::Capabilities::PWM | Pin::Capabilities::Native);
pwmChannel_ = TryGrabChannel(frequency);

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Pin.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Uart.h"
#include "../Pin.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Pin.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DebugPinDetail.h"
#include "../Grbl.h" // for printf
@@ -25,7 +43,7 @@ namespace Pins {
if (high != _isHigh) {
_isHigh = high;
if (shouldEvent()) {
WriteSerial( "Write %s < %d", toString().c_str(), high);
WriteSerial("Write %s < %d", toString().c_str(), high);
}
}
_implementation->write(high);

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "PinDetail.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ErrorPinDetail.h"
#include "../Assert.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "PinDetail.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Arduino.h>
#include <stdexcept>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "PinDetail.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef ESP32
# include "I2SOPinDetail.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef ESP32

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PinAttributes.h"
#include "PinCapabilities.h"
@@ -14,10 +32,10 @@ namespace Pins {
PinAttributes PinAttributes::Output(1 << (__LINE__ - START_LINE));
PinAttributes PinAttributes::PullUp(1 << (__LINE__ - START_LINE));
PinAttributes PinAttributes::PullDown(1 << (__LINE__ - START_LINE));
PinAttributes PinAttributes::ISR(1 << (__LINE__ - START_LINE)); // ^ These are capabilities mapped
const int capabilityMask = (1 << (__LINE__ - START_LINE)) - 1; // -------- Mask capabilities till here
PinAttributes PinAttributes::ISR(1 << (__LINE__ - START_LINE)); // ^ These are capabilities mapped
const int capabilityMask = (1 << (__LINE__ - START_LINE)) - 1; // -------- Mask capabilities till here
PinAttributes PinAttributes::ActiveLow(1 << (__LINE__ - START_LINE));
PinAttributes PinAttributes::Exclusive(1 << (__LINE__ - START_LINE)); // \/ These are attributes
PinAttributes PinAttributes::Exclusive(1 << (__LINE__ - START_LINE)); // \/ These are attributes
PinAttributes PinAttributes::InitialOn(1 << (__LINE__ - START_LINE)); // \/ These are attributes
bool PinAttributes::validateWith(PinCapabilities caps) {

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PinCapabilities.h"
namespace Pins {
@@ -17,7 +35,7 @@ namespace Pins {
PinCapabilities PinCapabilities::PullUp(1 << (__LINE__ - START_LINE)); // NOTE: Mapped in PinAttributes!
PinCapabilities PinCapabilities::PullDown(1 << (__LINE__ - START_LINE)); // NOTE: Mapped in PinAttributes!
PinCapabilities PinCapabilities::ISR(1 << (__LINE__ - START_LINE)); // NOTE: Mapped in PinAttributes!
PinCapabilities PinCapabilities::PWM(1 << (__LINE__ - START_LINE));
PinCapabilities PinCapabilities::UART(1 << (__LINE__ - START_LINE));
PinCapabilities PinCapabilities::ADC(1 << (__LINE__ - START_LINE));

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PinDetail.h"
#include "../Assert.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "PinCapabilities.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PinLookup.h"
#include "PinAttributes.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Assert.h"

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PinOptionsParser.h"
#include <cstring>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
class Pin; // Forward declaration

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "VoidPinDetail.h"
namespace Pins {

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "PinDetail.h"

View File

@@ -56,6 +56,7 @@
*/
#include "Grbl.h"
#include <atomic>
portMUX_TYPE myMutex = portMUX_INITIALIZER_UNLOCKED;
@@ -71,6 +72,7 @@ uint8_t client_get_rx_buffer_available(uint8_t client) {
void heapCheckTask(void* pvParameters) {
static uint32_t heapSize = 0;
while (true) {
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings and whatnot
uint32_t newHeapSize = xPortGetFreeHeapSize();
if (newHeapSize != heapSize) {
heapSize = newHeapSize;
@@ -149,8 +151,9 @@ static uint8_t getClientChar(uint8_t* data) {
// Realtime stuff is acted upon, then characters are added to the appropriate buffer
void clientCheckTask(void* pvParameters) {
uint8_t data = 0;
uint8_t client; // who sent the data
while (true) { // run continuously
uint8_t client; // who sent the data
while (true) { // run continuously
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings
while ((client = getClientChar(&data)) != CLIENT_ALL) {
// Pick off realtime command characters directly from the serial stream. These characters are
// not passed into the main buffer, but these set system state flag bits for realtime execution.

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SimpleOutputStream.h"
#include <cstring>

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstring>

View File

@@ -34,6 +34,7 @@
*/
#include "VFDSpindle.h"
#include "../MachineConfig.h"
#include <atomic>
const uart_port_t VFD_RS485_UART_PORT = UART_NUM_2; // hard coded for this port right now
const int VFD_RS485_BUF_SIZE = 127;
@@ -61,6 +62,7 @@ namespace Spindles {
uint8_t rx_message[VFD_RS485_MAX_MSG_SIZE];
while (true) {
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings
response_parser parser = nullptr;
next_cmd.msg[0] = VFD_RS485_ADDR; // Always default to this

View File

@@ -81,8 +81,8 @@ namespace Spindles {
// TODO FIXME: Have to make these public because of the parsers.
// Should hide them and use a member function.
volatile uint32_t _min_rpm;
volatile uint32_t _max_rpm;
uint32_t _min_rpm;
uint32_t _max_rpm;
volatile uint32_t _sync_rpm;
volatile bool _syncing;

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AssertionFailed.h"
#include <cstdarg>
@@ -5,9 +23,9 @@
#ifdef ESP32
# include "debug_helpers.h"
# include "WString.h"
# include "stdio.h"
# include "debug_helpers.h"
# include "WString.h"
# include "stdio.h"
AssertionFailed AssertionFailed::create(const char* condition, const char* msg, ...) {
String st = condition;
@@ -50,7 +68,7 @@ std::exception AssertionFailed::create(const char* condition, const char* msg, .
va_start(arg, msg);
size_t len = vsnprintf(tmp, 255, msg, arg);
tmp[254] = 0;
msg = tmp;
msg = tmp;
oss << tmp;
oss << " at ";

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "WString.h"
@@ -10,9 +28,7 @@ public:
AssertionFailed(String st) : stackTrace(st) {}
static AssertionFailed create(const char* condition) {
return create(condition, "Assertion failed");
}
static AssertionFailed create(const char* condition) { return create(condition, "Assertion failed"); }
static AssertionFailed create(const char* condition, const char* msg, ...);
const char* what() const { return msg.c_str(); }
@@ -26,9 +42,7 @@ public:
String stackTrace;
String msg;
static std::exception create(const char* condition) {
return create(condition, "Assertion failed");
}
static std::exception create(const char* condition) { return create(condition, "Assertion failed"); }
static std::exception create(const char* condition, const char* msg, ...);
const char* what() const { return msg.c_str(); }

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstring>
@@ -68,7 +86,7 @@ public:
#else
String str() const {
// TODO: Check if we can eliminate this function. I'm pretty sure we can.
auto len = length();
auto len = length();
char* buf = new char[len + 1];
memcpy(buf, begin(), len);
buf[len] = 0;

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Stefan de Bruijn
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "SimpleOutputStream.h"
@@ -5,16 +23,11 @@
#include <vector>
class StringStream : public SimpleOutputStream
{
class StringStream : public SimpleOutputStream {
std::vector<char> data_;
public:
void add(char c) override {
data_.push_back(c);
}
public:
void add(char c) override { data_.push_back(c); }
StringRange str() const {
return StringRange(data_.data(), data_.data() + data_.size());
}
};
StringRange str() const { return StringRange(data_.data(), data_.data() + data_.size()); }
};

View File

@@ -22,6 +22,7 @@
#include "Config.h"
#include "SettingsDefinitions.h"
#include "MachineConfig.h"
#include <atomic>
// Declare system global variable structure
system_t sys;
@@ -165,6 +166,7 @@ void system_ini() { // Renamed from system_init() due to conflict with esp32 fi
// this is the debounce task
void controlCheckTask(void* pvParameters) {
while (true) {
std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); // read fence for settings and other state
int evt;
xQueueReceive(control_sw_queue, &evt, portMAX_DELAY); // block until receive queue
vTaskDelay(CONTROL_SW_DEBOUNCE_PERIOD); // delay a while

View File

@@ -1,3 +1,20 @@
/*
Part of Grbl_ESP32
2021 - Mitch Bradley
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* UART driver that accesses the ESP32 hardware FIFOs directly.
*/

View File

@@ -1,3 +1,21 @@
/*
Part of Grbl_ESP32
2021 - Mitch Bradley
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <driver/uart.h>