From 5e698f2a09ba81450a4d0a9bbe3b8d0cb6265ad5 Mon Sep 17 00:00:00 2001 From: Mitch Bradley Date: Thu, 1 Jul 2021 14:03:42 -1000 Subject: [PATCH] Eliminated MachineCommon.h It had only a few consts that were either unnecessary or module specific. I eliminated the former and moved the latter. --- Grbl_Esp32/src/Config.h | 7 ------- Grbl_Esp32/src/Limits.cpp | 2 +- Grbl_Esp32/src/MachineCommon.h | 15 --------------- Grbl_Esp32/src/SDCard.cpp | 3 +-- Grbl_Esp32/src/SDCard.h | 3 +++ Grbl_Esp32/src/StepperPrivate.h | 1 + 6 files changed, 6 insertions(+), 25 deletions(-) delete mode 100644 Grbl_Esp32/src/MachineCommon.h diff --git a/Grbl_Esp32/src/Config.h b/Grbl_Esp32/src/Config.h index 104a74e0..595dbca9 100644 --- a/Grbl_Esp32/src/Config.h +++ b/Grbl_Esp32/src/Config.h @@ -48,13 +48,6 @@ Some features should not be changed. See notes below. const int SUPPORT_TASK_CORE = 1; // Reference: CONFIG_ARDUINO_RUNNING_CORE = 1 -// Include the file that loads the machine-specific config file. -// machine.h must be edited to choose the desired file. -#include "Machine.h" - -// machine_common.h contains settings that do not change -#include "MachineCommon.h" - const int MAX_N_AXIS = 6; // Serial baud rate diff --git a/Grbl_Esp32/src/Limits.cpp b/Grbl_Esp32/src/Limits.cpp index 19dfc36c..42d182fa 100644 --- a/Grbl_Esp32/src/Limits.cpp +++ b/Grbl_Esp32/src/Limits.cpp @@ -254,8 +254,8 @@ void limits_go_home(uint8_t cycle_mask, uint32_t n_locate_cycles) { break; } } - } while (STEP_MASK & axislock); + } while (axislock); if (config->_stepType == ST_I2S_STREAM) { if (!approach) { delay_ms(I2S_OUT_DELAY_MS); diff --git a/Grbl_Esp32/src/MachineCommon.h b/Grbl_Esp32/src/MachineCommon.h deleted file mode 100644 index d6cd8cb2..00000000 --- a/Grbl_Esp32/src/MachineCommon.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -// Grbl setting that are common to all machines -// It should not be necessary to change anything herein - -const int32_t GRBL_SPI_FREQ = 4000000; - - // ESP32 CPU Settings -const uint32_t fTimers = 80000000; // a reference to the speed of ESP32 timers - -// =============== Don't change or comment these out ====================== -// They are for legacy purposes and will not affect your I/O - -const int STEP_MASK = 0x3F; // 111111 -const int PROBE_MASK = 1; diff --git a/Grbl_Esp32/src/SDCard.cpp b/Grbl_Esp32/src/SDCard.cpp index 2448640e..3ca8686c 100644 --- a/Grbl_Esp32/src/SDCard.cpp +++ b/Grbl_Esp32/src/SDCard.cpp @@ -163,9 +163,8 @@ SDCard::State SDCard::get_state(bool refresh) { _state = SDCard::State::NotPresent; - //using default value for speed ? should be parameter //refresh content if card was removed - if (SD.begin(csPin, SPI, GRBL_SPI_FREQ, "/sd", 2)) { + if (SD.begin(csPin, SPI, SPIfreq, "/sd", 2)) { if (SD.cardSize() > 0) { _state = SDCard::State::Idle; } diff --git a/Grbl_Esp32/src/SDCard.h b/Grbl_Esp32/src/SDCard.h index f64b1552..b31cfe75 100644 --- a/Grbl_Esp32/src/SDCard.h +++ b/Grbl_Esp32/src/SDCard.h @@ -26,6 +26,9 @@ namespace fs { class FS; } +// XXX This should be a configuration parameter of the SPI bus +const int32_t SPIfreq = 4000000; + class SDCard : public Configuration::Configurable { public: enum class State : uint8_t { diff --git a/Grbl_Esp32/src/StepperPrivate.h b/Grbl_Esp32/src/StepperPrivate.h index cbfa24ca..d6e23639 100644 --- a/Grbl_Esp32/src/StepperPrivate.h +++ b/Grbl_Esp32/src/StepperPrivate.h @@ -24,6 +24,7 @@ struct PrepFlag { }; // fStepperTimer should be an integer divisor of the bus speed, i.e. of fTimers +const uint32_t fTimers = 80000000; // the frequency of ESP32 timers const uint32_t fStepperTimer = 20000000; // frequency of step pulse timer const int ticksPerMicrosecond = fStepperTimer / 1000000;