mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-03 03:13:25 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -85,6 +85,8 @@
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
|
||||
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
|
||||
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
|
||||
// if these spindle function pins are defined, they will be activated in the code
|
||||
@@ -105,6 +107,80 @@
|
||||
#define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // needs external pullup
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CPU_MAP_ESP32_ESC_SPINDLE
|
||||
// This is the CPU Map for the ESP32 CNC Controller R2
|
||||
|
||||
// It is OK to comment out any step and direction pins. This
|
||||
// won't affect operation except that there will be no output
|
||||
// form the pins. Grbl will virtually move the axis. This could
|
||||
// be handy if you are using a servo, etc. for another axis.
|
||||
#define CPU_MAP_NAME "CPU_MAP_ESP32_ESC_SPINDLE"
|
||||
|
||||
#define X_STEP_PIN GPIO_NUM_12
|
||||
#define X_DIRECTION_PIN GPIO_NUM_26
|
||||
#define X_RMT_CHANNEL 0
|
||||
|
||||
#define Y_STEP_PIN GPIO_NUM_14
|
||||
#define Y_DIRECTION_PIN GPIO_NUM_25
|
||||
#define Y_RMT_CHANNEL 1
|
||||
|
||||
#define Z_STEP_PIN GPIO_NUM_27
|
||||
#define Z_DIRECTION_PIN GPIO_NUM_33
|
||||
#define Z_RMT_CHANNEL 2
|
||||
|
||||
// OK to comment out to use pin for other features
|
||||
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
|
||||
|
||||
// *** the flood coolant feature code is activated by defining this pins
|
||||
// *** Comment it out to use the pin for other features
|
||||
#define COOLANT_FLOOD_PIN GPIO_NUM_16
|
||||
//#define COOLANT_MIST_PIN GPIO_NUM_21
|
||||
|
||||
// If SPINDLE_PWM_PIN is commented out, this frees up the pin, but Grbl will still
|
||||
// use a virtual spindle. Do not comment out the other parameters for the spindle.
|
||||
#define SPINDLE_PWM_PIN GPIO_NUM_17
|
||||
#define SPINDLE_PWM_CHANNEL 0
|
||||
|
||||
// RC ESC Based Spindle
|
||||
// An ESC works like a hobby servo with 50Hz PWM 1ms to 2 ms pulse range
|
||||
#define SPINDLE_PWM_BASE_FREQ 50 // Hz for ESC
|
||||
#define SPINDLE_PWM_BIT_PRECISION 16 // 16 bit required for ESC
|
||||
#define SPINDLE_PULSE_RES_COUNT 65535
|
||||
|
||||
#define ESC_MIN_PULSE_SEC 0.001 // min pulse in seconds (OK to tune this one)
|
||||
#define ESC_MAX_PULSE_SEC 0.002 // max pulse in seconds (OK to tune this one)
|
||||
#define ESC_TIME_PER_BIT ((1.0 / (float)SPINDLE_PWM_BASE_FREQ) / ((float)SPINDLE_PULSE_RES_COUNT) ) // seconds
|
||||
|
||||
#define SPINDLE_PWM_OFF_VALUE (uint16_t)(ESC_MIN_PULSE_SEC / ESC_TIME_PER_BIT) // in timer counts
|
||||
#define SPINDLE_PWM_MAX_VALUE (uint16_t)(ESC_MAX_PULSE_SEC / ESC_TIME_PER_BIT) // in timer counts
|
||||
|
||||
#ifndef SPINDLE_PWM_MIN_VALUE
|
||||
#define SPINDLE_PWM_MIN_VALUE SPINDLE_PWM_OFF_VALUE // Must be greater than zero.
|
||||
#endif
|
||||
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
|
||||
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
|
||||
|
||||
// if these spindle function pins are defined, they will be activated in the code
|
||||
// comment them out to use the pins for other functions
|
||||
//#define SPINDLE_ENABLE_PIN GPIO_NUM_16
|
||||
//#define SPINDLE_DIR_PIN GPIO_NUM_16
|
||||
|
||||
#define X_LIMIT_PIN GPIO_NUM_2
|
||||
#define Y_LIMIT_PIN GPIO_NUM_4
|
||||
#define Z_LIMIT_PIN GPIO_NUM_15
|
||||
#define LIMIT_MASK B111
|
||||
|
||||
#define PROBE_PIN GPIO_NUM_32
|
||||
|
||||
#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35 // needs external pullup
|
||||
#define CONTROL_RESET_PIN GPIO_NUM_34 // needs external pullup
|
||||
#define CONTROL_FEED_HOLD_PIN GPIO_NUM_36 // needs external pullup
|
||||
#define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // needs external pullup
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CPU_MAP_PEN_LASER // The Buildlog.net pen laser controller V1
|
||||
@@ -709,7 +785,7 @@
|
||||
#define USE_SPINDLE_RELAY
|
||||
|
||||
#ifdef USE_SPINDLE_RELAY
|
||||
#define SPINDLE_PWM_PIN GPIO_NUM_17
|
||||
#define SPINDLE_PWM_PIN GPIO_NUM_2
|
||||
#else
|
||||
#define SPINDLE_PWM_PIN GPIO_NUM_16
|
||||
#define SPINDLE_ENABLE_PIN GPIO_NUM_32
|
||||
@@ -736,7 +812,7 @@
|
||||
// Relay can be used for Spindle or Coolant
|
||||
//#define COOLANT_FLOOD_PIN GPIO_NUM_17
|
||||
|
||||
#define X_LIMIT_PIN GPIO_NUM_2
|
||||
#define X_LIMIT_PIN GPIO_NUM_17
|
||||
#define Y_LIMIT_PIN GPIO_NUM_4
|
||||
#define Z_LIMIT_PIN GPIO_NUM_15
|
||||
#define LIMIT_MASK B111
|
||||
@@ -785,7 +861,7 @@
|
||||
|
||||
|
||||
// Note: if you use PWM rather than relay, you could map GPIO_NUM_17 to mist or flood
|
||||
//#define USE_SPINDLE_RELAY
|
||||
#define USE_SPINDLE_RELAY
|
||||
|
||||
#ifdef USE_SPINDLE_RELAY
|
||||
#define SPINDLE_PWM_PIN GPIO_NUM_17
|
||||
|
Binary file not shown.
@@ -47,16 +47,16 @@ void ESPResponseStream::println(const char *data){
|
||||
}
|
||||
|
||||
//helper to format size to readable string
|
||||
String ESPResponseStream::formatBytes (uint32_t bytes)
|
||||
String ESPResponseStream::formatBytes (uint64_t bytes)
|
||||
{
|
||||
if (bytes < 1024) {
|
||||
return String (bytes) + " B";
|
||||
if (bytes < 1024) {
|
||||
return String ((uint16_t)bytes) + " B";
|
||||
} else if (bytes < (1024 * 1024) ) {
|
||||
return String (bytes / 1024.0) + " KB";
|
||||
return String ((float)(bytes / 1024.0),2) + " KB";
|
||||
} else if (bytes < (1024 * 1024 * 1024) ) {
|
||||
return String (bytes / 1024.0 / 1024.0) + " MB";
|
||||
return String ((float)(bytes / 1024.0 / 1024.0),2) + " MB";
|
||||
} else {
|
||||
return String (bytes / 1024.0 / 1024.0 / 1024.0) + " GB";
|
||||
return String ((float)(bytes / 1024.0 / 1024.0 / 1024.0),2) + " GB";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class ESPResponseStream{
|
||||
void print(const char *data);
|
||||
void println(const char *data);
|
||||
void flush();
|
||||
static String formatBytes (uint32_t bytes);
|
||||
static String formatBytes (uint64_t bytes);
|
||||
uint8_t client() {return _client;}
|
||||
#if defined (ENABLE_HTTP) && defined(ENABLE_WIFI)
|
||||
ESPResponseStream(WebServer * webserver);
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
// Grbl versioning system
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#define GRBL_VERSION_BUILD "20180917"
|
||||
#define GRBL_VERSION_BUILD "20190518"
|
||||
|
||||
//#include <sdkconfig.h>
|
||||
#include <Arduino.h>
|
||||
|
@@ -486,9 +486,9 @@ void report_gcode_modes(uint8_t client)
|
||||
|
||||
|
||||
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) {
|
||||
sprintf(temp, " F:%.1f", gc_state.feed_rate);
|
||||
sprintf(temp, " F%.1f", gc_state.feed_rate);
|
||||
} else {
|
||||
sprintf(temp, " F:%.0f", gc_state.feed_rate);
|
||||
sprintf(temp, " F%.0f", gc_state.feed_rate);
|
||||
}
|
||||
strcat(modes_rpt, temp);
|
||||
|
||||
|
@@ -49,7 +49,7 @@ void spindle_stop()
|
||||
{
|
||||
spindle_set_enable(false);
|
||||
#ifdef SPINDLE_PWM_PIN
|
||||
grbl_analogWrite(SPINDLE_PWM_CHANNEL, 0);
|
||||
grbl_analogWrite(SPINDLE_PWM_CHANNEL, SPINDLE_PWM_OFF_VALUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void spindle_set_speed(uint32_t pwm_value)
|
||||
#else
|
||||
spindle_set_enable(pwm_value != 0);
|
||||
#endif
|
||||
grbl_analogWrite(SPINDLE_PWM_CHANNEL, pwm_value);
|
||||
grbl_analogWrite(SPINDLE_PWM_CHANNEL, pwm_value);
|
||||
}
|
||||
|
||||
// Called by spindle_set_state() and step segment generator. Keep routine small and efficient.
|
||||
|
@@ -254,7 +254,9 @@ void IRAM_ATTR onStepperDriverTimer(void *para) // ISR It is time to take a ste
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
// Set real-time spindle output as segment is loaded, just prior to the first step.
|
||||
if (st_prep_block->is_pwm_rate_adjusted) {
|
||||
spindle_set_speed(st.exec_segment->spindle_pwm);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
@@ -1153,7 +1155,6 @@ void st_prep_buffer()
|
||||
bit_false(sys.step_control,STEP_CONTROL_UPDATE_SPINDLE_PWM);
|
||||
}
|
||||
prep_segment->spindle_pwm = prep.current_spindle_pwm; // Reload segment PWM value
|
||||
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------------
|
||||
|
@@ -1228,8 +1228,8 @@ void Web_Server::handle_direct_SDFileList()
|
||||
_upload_status = UPLOAD_STATUS_NONE;
|
||||
}
|
||||
bool list_files = true;
|
||||
uint32_t totalspace = 0;
|
||||
uint32_t usedspace = 0;
|
||||
uint64_t totalspace = 0;
|
||||
uint64_t usedspace = 0;
|
||||
if (get_sd_state(true) != SDCARD_IDLE) {
|
||||
_webserver->sendHeader("Cache-Control","no-cache");
|
||||
_webserver->send(200, "application/json", "{\"status\":\"No SD Card\"}");
|
||||
|
Reference in New Issue
Block a user