diff --git a/Grbl_Esp32/cpu_map.h b/Grbl_Esp32/cpu_map.h index 2d3335dc..e84b76af 100644 --- a/Grbl_Esp32/cpu_map.h +++ b/Grbl_Esp32/cpu_map.h @@ -659,6 +659,13 @@ #ifdef CPU_MAP_MPCNC // This is the CPU Map for the Buildlog.net MPCNC controller + // switch to the correct default settings + #ifdef DEFAULTS_GENERIC + #undef DEFAULTS_GENERIC + #endif + #define DEFAULTS_MPCNC + + #define USE_GANGED_AXES // allow two motors on an axis #define X_STEP_PIN GPIO_NUM_12 @@ -680,7 +687,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 diff --git a/Grbl_Esp32/defaults.h b/Grbl_Esp32/defaults.h index 59ea89e7..df276031 100644 --- a/Grbl_Esp32/defaults.h +++ b/Grbl_Esp32/defaults.h @@ -82,6 +82,58 @@ #endif +#ifdef DEFAULTS_MPCNC + // Grbl generic default settings. Should work across different machines. + #define DEFAULT_STEP_PULSE_MICROSECONDS 3 + #define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // 255 = Keep steppers on + + #define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t + #define DEFAULT_DIRECTION_INVERT_MASK 0 // uint8_t + #define DEFAULT_INVERT_ST_ENABLE 0 // boolean + #define DEFAULT_INVERT_LIMIT_PINS 1 // boolean + #define DEFAULT_INVERT_PROBE_PIN 0 // boolean + + #define DEFAULT_STATUS_REPORT_MASK 2 // MPos enabled + + #define DEFAULT_JUNCTION_DEVIATION 0.01 // mm + #define DEFAULT_ARC_TOLERANCE 0.002 // mm + #define DEFAULT_REPORT_INCHES 0 // false + + #define DEFAULT_SOFT_LIMIT_ENABLE 0 // false + #define DEFAULT_HARD_LIMIT_ENABLE 0 // false + + #define DEFAULT_HOMING_ENABLE 1 // false + #define DEFAULT_HOMING_DIR_MASK 3 // move positive dir Z,negative X,Y + #define DEFAULT_HOMING_FEED_RATE 600.0 // mm/min + #define DEFAULT_HOMING_SEEK_RATE 2000.0 // mm/min + #define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k) + #define DEFAULT_HOMING_PULLOFF 1.5 // mm + + #define DEFAULT_SPINDLE_RPM_MAX 1.0 // rpm used for spindle relay + #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm + + #define DEFAULT_LASER_MODE 0 // false + + #define DEFAULT_X_STEPS_PER_MM 200.0 + #define DEFAULT_Y_STEPS_PER_MM 200.0 + #define DEFAULT_Z_STEPS_PER_MM 800.0 + + #define DEFAULT_X_MAX_RATE 8000.0 // mm/min + #define DEFAULT_Y_MAX_RATE 8000.0 // mm/min + #define DEFAULT_Z_MAX_RATE 3000.0 // mm/min + + #define DEFAULT_X_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 + #define DEFAULT_Y_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 + #define DEFAULT_Z_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 + + #define DEFAULT_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value. + #define DEFAULT_Y_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value. + #define DEFAULT_Z_MAX_TRAVEL 80.0 // mm NOTE: Must be a positive value. + + +#endif + + #endif diff --git a/Grbl_Esp32/wificonfig.cpp b/Grbl_Esp32/wificonfig.cpp index 0f66ce01..63e6215e 100644 --- a/Grbl_Esp32/wificonfig.cpp +++ b/Grbl_Esp32/wificonfig.cpp @@ -374,7 +374,7 @@ bool WiFiConfig::StartAP(){ WiFi.softAPConfig(ip, ip, mask); //Start AP if(WiFi.softAP(SSID.c_str(), (password.length() > 0)?password.c_str():NULL, channel)) { - grbl_sendf(CLIENT_ALL,"\n[MSG:AP Started %s]\r\n", WiFi.softAPIP().toString().c_str()); + grbl_sendf(CLIENT_ALL,"\n[MSG:Local access point %s started, %s]\r\n", SSID.c_str(), WiFi.softAPIP().toString().c_str()); return true; } else { grbl_send(CLIENT_ALL,"[MSG:Starting AP failed]\r\n"); @@ -416,19 +416,21 @@ void WiFiConfig::begin() { String defV = DEFAULT_HOSTNAME; _hostname = prefs.getString(HOSTNAME_ENTRY, defV); int8_t wifiMode = prefs.getChar(ESP_RADIO_MODE, DEFAULT_RADIO_MODE); - prefs.end(); + if (wifiMode == ESP_WIFI_AP) { StartAP(); //start services wifi_services.begin(); } else if (wifiMode == ESP_WIFI_STA){ if(!StartSTA()){ - grbl_send(CLIENT_ALL,"[MSG:Cannot connect to AP]\r\n"); + defV = DEFAULT_STA_SSID; + grbl_sendf(CLIENT_ALL,"[MSG:Cannot connect to %s]\r\n", prefs.getString(STA_SSID_ENTRY, defV).c_str()); StartAP(); } //start services wifi_services.begin(); }else WiFi.mode(WIFI_OFF); + prefs.end(); } /**