1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-01 10:23:19 +02:00

Rename coolant variables

This commit is contained in:
Mitch Bradley
2021-05-24 06:24:44 -10:00
parent 92532e8622
commit 11f436ddda
3 changed files with 24 additions and 31 deletions

View File

@@ -28,17 +28,17 @@ void CoolantControl::init() {
static bool init_message = true; // used to show messages only once.
if (init_message) {
if (flood_.defined()) {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Flood coolant on pin %s", flood_.name().c_str());
if (_flood.defined()) {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Flood coolant on pin %s", _flood.name().c_str());
}
if (mist_.defined()) {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Mist coolant on pin %s", mist_.name().c_str());
if (_mist.defined()) {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Mist coolant on pin %s", _mist.name().c_str());
}
init_message = false;
}
flood_.setAttr(Pin::Attr::Output);
mist_.setAttr(Pin::Attr::Output);
_flood.setAttr(Pin::Attr::Output);
_mist.setAttr(Pin::Attr::Output);
stop();
}
@@ -48,16 +48,16 @@ CoolantState CoolantControl::get_state() {
CoolantState cl_state = {};
bool pinState;
if (flood_.defined()) {
auto pinState = flood_.read();
if (_flood.defined()) {
auto pinState = _flood.read();
if (pinState) {
cl_state.Flood = 1;
}
}
if (mist_.defined()) {
auto pinState = mist_.read();
if (_mist.defined()) {
auto pinState = _mist.read();
if (pinState) {
cl_state.Mist = 1;
@@ -68,20 +68,14 @@ CoolantState CoolantControl::get_state() {
}
void CoolantControl::write(CoolantState state) {
if (flood_.defined()) {
if (_flood.defined()) {
bool pinState = state.Flood;
#ifdef INVERT_COOLANT_FLOOD_PIN
pinState = !pinState;
#endif
flood_.write(pinState);
_flood.write(pinState);
}
if (mist_.defined()) {
if (_mist.defined()) {
bool pinState = state.Mist;
#ifdef INVERT_COOLANT_MIST_PIN
pinState = !pinState;
#endif
mist_.write(pinState);
_mist.write(pinState);
}
}
@@ -123,7 +117,7 @@ void CoolantControl::sync(CoolantState state) {
void CoolantControl::validate() const {}
void CoolantControl::handle(Configuration::HandlerBase& handler) {
handler.handle("flood", flood_);
handler.handle("mist", mist_);
handler.handle("delay", delay_);
handler.handle("flood", _flood);
handler.handle("mist", _mist);
handler.handle("delay", _delay);
}

View File

@@ -28,18 +28,18 @@
#include "GCode.h"
class CoolantControl : public Configuration::Configurable {
Pin mist_;
Pin flood_;
Pin _mist;
Pin _flood;
float delay_ = 0.0;
float _delay = 0.0;
void write(CoolantState state);
public:
CoolantControl() = default;
bool hasMist() const { return mist_.defined(); }
bool hasFlood() const { return flood_.defined(); }
bool hasMist() const { return _mist.defined(); }
bool hasFlood() const { return _flood.defined(); }
// Initializes coolant control pins.
void init();
@@ -54,8 +54,6 @@ public:
void off();
void set_state(CoolantState state);
float delay() { return delay_; }
// G-code parser entry-point for setting coolant states. Checks for and executes additional conditions.
void sync(CoolantState state);

View File

@@ -684,7 +684,8 @@ static void protocol_exec_rt_suspend() {
if (!sys.suspend.bit.restartRetract) {
// NOTE: Laser mode will honor this delay. An exhaust system is often controlled by this pin.
config->_coolant->set_state(restore_coolant);
delay_msec(int32_t(1000.0 * config->_coolant->delay()), DwellMode::SysSuspend);
// TODO: Should this be buried in _coolant->set_state() ?
delay_msec(int32_t(1000.0 * config->_coolant->_delay), DwellMode::SysSuspend);
}
}
#ifdef PARKING_ENABLE