Commit 45cf718e authored by MagoKimbra's avatar MagoKimbra

Merge remote-tracking branch 'refs/remotes/origin/master' into dev

parents 47d4feb6 cc967a46
...@@ -107,9 +107,6 @@ ...@@ -107,9 +107,6 @@
*****************************************************************************************/ *****************************************************************************************/
//#define Z_PROBE_ENDSTOP //#define Z_PROBE_ENDSTOP
// Uncomment to enable autocalibration debug messages
#define DEBUG_MESSAGES
// Speed for autocalibration travel and probing moves // Speed for autocalibration travel and probing moves
#define AUTOCAL_TRAVELRATE 100 // mm/sec #define AUTOCAL_TRAVELRATE 100 // mm/sec
#define AUTOCAL_PROBERATE 50 // mm/sec #define AUTOCAL_PROBERATE 50 // mm/sec
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
* MOTION FEATURES: * MOTION FEATURES:
* - Software endstops * - Software endstops
* - Endstops only for homing * - Endstops only for homing
* - Abort on endstop hit feature
* - R/C Servo * - R/C Servo
* - Late Z axis * - Late Z axis
* - Ahead slowdown * - Ahead slowdown
...@@ -580,19 +581,38 @@ ...@@ -580,19 +581,38 @@
**************************************************************************/ **************************************************************************/
#define SOFTWARE_MIN_ENDSTOPS true // If true, axis won't move to coordinates less than HOME_POS. #define SOFTWARE_MIN_ENDSTOPS true // If true, axis won't move to coordinates less than HOME_POS.
#define SOFTWARE_MAX_ENDSTOPS true // If true, axis won't move to coordinates greater than the defined lengths below. #define SOFTWARE_MAX_ENDSTOPS true // If true, axis won't move to coordinates greater than the defined lengths below.
/***********************************************************************/ /**************************************************************************/
/************************************************************************** /**************************************************************************
*********************** Endstops only for homing ************************* *********************** Endstops only for homing *************************
**************************************************************************
* *
* If defined the endstops will only be used for homing *
* *
**************************************************************************/ **************************************************************************/
#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing #define ENDSTOPS_ONLY_FOR_HOMING
/***********************************************************************/ /**************************************************************************/
/*********************************************************************** /**************************************************************************
**************************** R/C Servo ******************************** ******************** Abort on endstop hit feature ************************
***********************************************************************/ **************************************************************************
* *
* This option allows you to abort printing when any endstop is triggered.*
* This feature must be enabled with "M540 S1" or from the LCD menu or *
* by define ABORT ON ENDSTOP HIT INIT true. *
* To have any effect, endstops must be enabled during SD printing. *
* With ENDSTOPS ONLY FOR HOMING you must send "M120" to enable endstops. *
* *
**************************************************************************/
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
//#define ABORT_ON_ENDSTOP_HIT_INIT true
/**************************************************************************
****************************** R/C Servo *********************************
**************************************************************************/
//#define ENABLE_SERVOS //#define ENABLE_SERVOS
// Number of servos // Number of servos
// If you select a configuration below, this will receive a default value and does not need to be set manually // If you select a configuration below, this will receive a default value and does not need to be set manually
...@@ -621,7 +641,7 @@ ...@@ -621,7 +641,7 @@
// 300ms is a good value but you can try less delay. // 300ms is a good value but you can try less delay.
// If the servo can't reach the requested position, increase it. // If the servo can't reach the requested position, increase it.
#define SERVO_DEACTIVATION_DELAY 300 #define SERVO_DEACTIVATION_DELAY 300
/***********************************************************************/ /**************************************************************************/
/*********************************************************************** /***********************************************************************
...@@ -1026,12 +1046,6 @@ ...@@ -1026,12 +1046,6 @@
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT //#define LONG_FILENAME_HOST_SUPPORT
// This option allows you to abort SD printing when any endstop is triggered.
// This feature must be enabled with "M540 S1" or from the LCD menu.
// To have any effect, endstops must be enabled during SD printing.
// With ENDSTOPS_ONLY_FOR_HOMING you must send "M120" to enable endstops.
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
// This enable the firmware to write some configuration that require frequent update, on the SD card // This enable the firmware to write some configuration that require frequent update, on the SD card
//#define SD_SETTINGS // Uncomment to enable //#define SD_SETTINGS // Uncomment to enable
#define SD_CFG_SECONDS 300 // seconds between update #define SD_CFG_SECONDS 300 // seconds between update
......
#ifndef CONFIGURATION_VERSION_H #ifndef CONFIGURATION_VERSION_H
#define CONFIGURATION_VERSION_H #define CONFIGURATION_VERSION_H
#define BUILD_VERSION "MarlinKimbra 4.2.3 dev" #define BUILD_VERSION "MarlinKimbra 4.2.4 dev"
#define SHORT_BUILD_VERSION "4.2.3 dev" #define SHORT_BUILD_VERSION "4.2.4 dev"
#define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time #define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time
// It might also be appropriate to define a location where additional information can be found // It might also be appropriate to define a location where additional information can be found
#define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra" #define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra"
......
...@@ -30,27 +30,27 @@ ...@@ -30,27 +30,27 @@
#include "base.h" #include "base.h"
#include "Marlin_main.h" #include "Marlin_main.h"
#include "ultralcd.h" #include "module/ultralcd.h"
#include "module/nextion_lcd.h" #include "module/nextion_lcd.h"
#include "base.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "module/vector_3.h"
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_GRID)
#include "qr_solve.h" #include "module/qr_solve.h"
#endif #endif
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE
#include "planner.h" #include "module/planner.h"
#include "stepper_indirection.h" #include "module/stepper_indirection.h"
#if MB(ALLIGATOR) #if MB(ALLIGATOR)
#include "external_dac.h" #include "module/external_dac.h"
#endif #endif
#include "stepper.h" #include "module/stepper.h"
#include "temperature.h" #include "module/temperature.h"
#include "cardreader.h" #include "module/cardreader.h"
#include "configuration_store.h" #include "configuration_store.h"
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include "watchdog.h" #include "module/watchdog.h"
#endif #endif
#if HAS(BUZZER) #if HAS(BUZZER)
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
* M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). * M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
* M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. * M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
* M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings. * M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
* M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) * M540 - Use S[0|1] to enable or disable the stop print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
* M595 - Set hotend AD595 offset and gain * M595 - Set hotend AD595 offset and gain
* M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] * M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
* M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ] * M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
...@@ -262,7 +262,7 @@ bool axis_known_position[3] = { false }; ...@@ -262,7 +262,7 @@ bool axis_known_position[3] = { false };
bool pos_saved = false; bool pos_saved = false;
float stored_position[NUM_POSITON_SLOTS][NUM_AXIS]; float stored_position[NUM_POSITON_SLOTS][NUM_AXIS];
static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0; static long gcode_N, gcode_LastN;
static char* current_command, *current_command_args; static char* current_command, *current_command_args;
static int cmd_queue_index_r = 0; static int cmd_queue_index_r = 0;
...@@ -498,6 +498,11 @@ double printer_usage_filament; ...@@ -498,6 +498,11 @@ double printer_usage_filament;
//=========================================================================== //===========================================================================
inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); } inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
void delay_ms(millis_t ms) {
ms += millis();
while (millis() < ms) idle();
}
void process_next_command(); void process_next_command();
void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise); void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
...@@ -510,7 +515,7 @@ bool setTargetedHotend(int code); ...@@ -510,7 +515,7 @@ bool setTargetedHotend(int code);
#ifdef __AVR__ // HAL for Due #ifdef __AVR__ // HAL for Due
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "SdFatUtil.h" #include "module/SdFatUtil.h"
int freeMemory() { return SdFatUtil::FreeRam(); } int freeMemory() { return SdFatUtil::FreeRam(); }
#else #else
extern "C" { extern "C" {
...@@ -723,7 +728,7 @@ bool enqueuecommand(const char* cmd) { ...@@ -723,7 +728,7 @@ bool enqueuecommand(const char* cmd) {
#if ENABLED(DONDOLO) #if ENABLED(DONDOLO)
servo[DONDOLO_SERVO_INDEX].attach(0); servo[DONDOLO_SERVO_INDEX].attach(0);
servo[DONDOLO_SERVO_INDEX].write(DONDOLO_SERVOPOS_E0); servo[DONDOLO_SERVO_INDEX].write(DONDOLO_SERVOPOS_E0);
delay(DONDOLO_SERVO_DELAY); delay_ms(DONDOLO_SERVO_DELAY);
servo[DONDOLO_SERVO_INDEX].detach(); servo[DONDOLO_SERVO_INDEX].detach();
#endif #endif
...@@ -849,23 +854,28 @@ void setup() { ...@@ -849,23 +854,28 @@ void setup() {
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate) // loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings(); Config_RetrieveSettings();
lcd_init(); lcd_init(); // Initialize LCD
tp_init(); // Initialize temperature loop tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner; plan_init(); // Initialize planner;
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
watchdog_init(); watchdog_init();
#endif #endif
st_init(); // Initialize stepper, this enables interrupts! st_init(); // Initialize stepper, this enables interrupts!
#if HAS(PHOTOGRAPH) #if HAS(PHOTOGRAPH)
setup_photpin(); setup_photpin();
#endif #endif
#if ENABLED(LASERBEAM) #if ENABLED(LASERBEAM)
setup_laserbeampin(); // Initialize Laserbeam pin setup_laserbeampin();
#endif #endif
#if HAS(SERVOS) #if HAS(SERVOS)
servo_init(); servo_init();
#endif #endif
#if HAS(STEPPER_RESET) #if HAS(STEPPER_RESET)
enableStepperDrivers(); enableStepperDrivers();
#endif #endif
...@@ -876,17 +886,19 @@ void setup() { ...@@ -876,17 +886,19 @@ void setup() {
#if HAS(Z_PROBE_SLED) #if HAS(Z_PROBE_SLED)
setup_zprobesled(); setup_zprobesled();
#endif // Z_PROBE_SLED #endif
#if HAS(HOME) #if HAS(HOME)
setup_homepin(); setup_homepin();
#endif #endif
#if ENABLED(TEMP_STAT_LEDS) #if ENABLED(TEMP_STAT_LEDS)
setup_statled(); setup_statled();
#endif #endif
#if ENABLED(FIRMWARE_TEST) #if ENABLED(FIRMWARE_TEST)
FirmwareTest(); FirmwareTest();
#endif // FIRMWARE_TEST #endif
} }
/** /**
...@@ -3985,6 +3997,9 @@ inline void gcode_G28() { ...@@ -3985,6 +3997,9 @@ inline void gcode_G28() {
* G30: Do a single Z probe at the current XY * G30: Do a single Z probe at the current XY
*/ */
inline void gcode_G30() { inline void gcode_G30() {
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "gcode_G30 >>>");
#if HAS(SERVO_ENDSTOPS) #if HAS(SERVO_ENDSTOPS)
raise_z_for_servo(); raise_z_for_servo();
#endif #endif
...@@ -4009,6 +4024,8 @@ inline void gcode_G28() { ...@@ -4009,6 +4024,8 @@ inline void gcode_G28() {
#endif #endif
stow_z_probe(); // Retract Z Servo endstop if available stow_z_probe(); // Retract Z Servo endstop if available
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_G30");
} }
#endif // !Z_PROBE_SLED #endif // !Z_PROBE_SLED
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE
...@@ -4019,6 +4036,7 @@ inline void gcode_G28() { ...@@ -4019,6 +4036,7 @@ inline void gcode_G28() {
* G29: Delta Z-Probe, probes the bed at more points. * G29: Delta Z-Probe, probes the bed at more points.
*/ */
inline void gcode_G29() { inline void gcode_G29() {
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "gcode_G29 >>>"); if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "gcode_G29 >>>");
if (code_seen('D')) { if (code_seen('D')) {
...@@ -4034,10 +4052,9 @@ inline void gcode_G28() { ...@@ -4034,10 +4052,9 @@ inline void gcode_G28() {
deploy_z_probe(); deploy_z_probe();
calibrate_print_surface(z_probe_offset[Z_AXIS] + (code_seen(axis_codes[Z_AXIS]) ? code_value() : 0.0)); calibrate_print_surface(z_probe_offset[Z_AXIS] + (code_seen(axis_codes[Z_AXIS]) ? code_value() : 0.0));
retract_z_probe(); retract_z_probe();
clean_up_after_endstop_move();
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_G29"); if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_G29");
clean_up_after_endstop_move();
} }
/* G30: Delta AutoCalibration /* G30: Delta AutoCalibration
...@@ -4048,6 +4065,8 @@ inline void gcode_G28() { ...@@ -4048,6 +4065,8 @@ inline void gcode_G28() {
*/ */
inline void gcode_G30() { inline void gcode_G30() {
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "gcode_G30 >>>");
//Zero the bed level array //Zero the bed level array
reset_bed_level(); reset_bed_level();
...@@ -4248,6 +4267,8 @@ inline void gcode_G28() { ...@@ -4248,6 +4267,8 @@ inline void gcode_G28() {
lcd_reset_alert_level(); lcd_reset_alert_level();
clean_up_after_endstop_move(); clean_up_after_endstop_move();
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_G30");
} }
#endif // DELTA && Z_PROBE_ENDSTOP #endif // DELTA && Z_PROBE_ENDSTOP
...@@ -4674,6 +4695,8 @@ inline void gcode_M42() { ...@@ -4674,6 +4695,8 @@ inline void gcode_M42() {
*/ */
inline void gcode_M48() { inline void gcode_M48() {
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "gcode_M48 >>>");
double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50]; double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50];
uint8_t verbose_level = 1, n_samples = 10, n_legs = 0; uint8_t verbose_level = 1, n_samples = 10, n_legs = 0;
...@@ -4815,7 +4838,7 @@ inline void gcode_M42() { ...@@ -4815,7 +4838,7 @@ inline void gcode_M42() {
if (deploy_probe_for_each_reading) { if (deploy_probe_for_each_reading) {
deploy_z_probe(); deploy_z_probe();
delay(1000); delay_ms(1000);
} }
setup_for_endstop_move(); setup_for_endstop_move();
...@@ -4856,21 +4879,21 @@ inline void gcode_M42() { ...@@ -4856,21 +4879,21 @@ inline void gcode_M42() {
if (deploy_probe_for_each_reading) { if (deploy_probe_for_each_reading) {
stow_z_probe(); stow_z_probe();
delay(1000); delay_ms(1000);
} }
} }
if (!deploy_probe_for_each_reading) { if (!deploy_probe_for_each_reading) {
stow_z_probe(); stow_z_probe();
delay(1000); delay_ms(1000);
} }
clean_up_after_endstop_move(); clean_up_after_endstop_move();
if (verbose_level > 0) ECHO_EMV("Mean: ", mean, 6); if (verbose_level > 0) ECHO_EMV("Mean: ", mean, 6);
ECHO_EMV("Standard Deviation: ", sigma, 6); ECHO_EMV("Standard Deviation: ", sigma, 6);
if (debugLevel & DEBUG_INFO) ECHO_LM(DB, "<<< gcode_M28");
} }
#endif // AUTO_BED_LEVELING_FEATURE && Z_PROBE_REPEATABILITY_TEST #endif // AUTO_BED_LEVELING_FEATURE && Z_PROBE_REPEATABILITY_TEST
...@@ -4937,7 +4960,7 @@ inline void gcode_M81() { ...@@ -4937,7 +4960,7 @@ inline void gcode_M81() {
disable_e(); disable_e();
finishAndDisableSteppers(); finishAndDisableSteppers();
fanSpeed = 0; fanSpeed = 0;
delay(1000); // Wait 1 second before switching off delay_ms(1000); // Wait 1 second before switching off
#if HAS(SUICIDE) #if HAS(SUICIDE)
st_synchronize(); st_synchronize();
suicide(); suicide();
...@@ -5918,7 +5941,7 @@ inline void gcode_M226() { ...@@ -5918,7 +5941,7 @@ inline void gcode_M226() {
#endif #endif
srv->write(servo_position); srv->write(servo_position);
#if HAS(SERVO_ENDSTOPS) #if HAS(SERVO_ENDSTOPS)
delay(SERVO_DEACTIVATION_DELAY); delay_ms(SERVO_DEACTIVATION_DELAY);
srv->detach(); srv->detach();
#endif #endif
} }
...@@ -5926,7 +5949,7 @@ inline void gcode_M226() { ...@@ -5926,7 +5949,7 @@ inline void gcode_M226() {
Servo *srv = &servo[servo_index]; Servo *srv = &servo[servo_index];
srv->attach(0); srv->attach(0);
srv->write(servo_position); srv->write(servo_position);
delay (DONDOLO_SERVO_DELAY); delay_ms(DONDOLO_SERVO_DELAY);
srv->detach(); srv->detach();
} }
else { else {
...@@ -5944,7 +5967,7 @@ inline void gcode_M226() { ...@@ -5944,7 +5967,7 @@ inline void gcode_M226() {
#endif #endif
srv->write(servo_position); srv->write(servo_position);
#if HAS(SERVO_ENDSTOPS) #if HAS(SERVO_ENDSTOPS)
delay(SERVO_DEACTIVATION_DELAY); delay_ms(SERVO_DEACTIVATION_DELAY);
srv->detach(); srv->detach();
#endif #endif
} }
...@@ -6498,7 +6521,7 @@ inline void gcode_M503() { ...@@ -6498,7 +6521,7 @@ inline void gcode_M503() {
st_synchronize(); st_synchronize();
//disable extruder steppers so filament can be removed //disable extruder steppers so filament can be removed
disable_e(); disable_e();
delay(100); delay_ms(100);
boolean beep = true; boolean beep = true;
boolean sleep = false; boolean sleep = false;
uint8_t cnt = 0; uint8_t cnt = 0;
...@@ -6792,7 +6815,6 @@ inline void gcode_M999() { ...@@ -6792,7 +6815,6 @@ inline void gcode_M999() {
Running = true; Running = true;
Printing = false; Printing = false;
lcd_reset_alert_level(); lcd_reset_alert_level();
//gcode_LastN = Stopped_gcode_LastN;
FlushSerialRequestResend(); FlushSerialRequestResend();
} }
...@@ -6896,28 +6918,28 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6896,28 +6918,28 @@ inline void gcode_T(uint8_t tmp_extruder) {
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E1E3_CHOICE_PIN, LOW); WRITE_RELE(E1E3_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 1: case 1:
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E1E3_CHOICE_PIN, LOW); WRITE_RELE(E1E3_CHOICE_PIN, LOW);
active_driver = 1; active_driver = 1;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e1(); enable_e1();
break; break;
case 2: case 2:
WRITE_RELE(E0E2_CHOICE_PIN, HIGH); WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
WRITE_RELE(E1E3_CHOICE_PIN, LOW); WRITE_RELE(E1E3_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e2(); enable_e2();
break; break;
case 3: case 3:
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E1E3_CHOICE_PIN, HIGH); WRITE_RELE(E1E3_CHOICE_PIN, HIGH);
active_driver = 1; active_driver = 1;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e3(); enable_e3();
break; break;
} }
...@@ -6931,7 +6953,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6931,7 +6953,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E0E3_CHOICE_PIN, LOW); WRITE_RELE(E0E3_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 1: case 1:
...@@ -6939,7 +6961,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6939,7 +6961,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E0E3_CHOICE_PIN, LOW); WRITE_RELE(E0E3_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 2: case 2:
...@@ -6947,7 +6969,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6947,7 +6969,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
WRITE_RELE(E0E2_CHOICE_PIN, HIGH); WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
WRITE_RELE(E0E3_CHOICE_PIN, LOW); WRITE_RELE(E0E3_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 3: case 3:
...@@ -6955,7 +6977,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6955,7 +6977,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
WRITE_RELE(E0E2_CHOICE_PIN, HIGH); WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
WRITE_RELE(E0E3_CHOICE_PIN, HIGH); WRITE_RELE(E0E3_CHOICE_PIN, HIGH);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
} }
...@@ -6967,19 +6989,19 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6967,19 +6989,19 @@ inline void gcode_T(uint8_t tmp_extruder) {
case 0: case 0:
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 1: case 1:
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 1; active_driver = 1;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e1(); enable_e1();
break; break;
case 2: case 2:
WRITE_RELE(E0E2_CHOICE_PIN, HIGH); WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
} }
...@@ -6992,21 +7014,21 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -6992,21 +7014,21 @@ inline void gcode_T(uint8_t tmp_extruder) {
WRITE_RELE(E0E1_CHOICE_PIN, LOW); WRITE_RELE(E0E1_CHOICE_PIN, LOW);
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 1: case 1:
WRITE_RELE(E0E1_CHOICE_PIN, HIGH); WRITE_RELE(E0E1_CHOICE_PIN, HIGH);
WRITE_RELE(E0E2_CHOICE_PIN, LOW); WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 2: case 2:
WRITE_RELE(E0E1_CHOICE_PIN, HIGH); WRITE_RELE(E0E1_CHOICE_PIN, HIGH);
WRITE_RELE(E0E2_CHOICE_PIN, HIGH); WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
} }
...@@ -7018,13 +7040,13 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -7018,13 +7040,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
case 0: case 0:
WRITE_RELE(E0E1_CHOICE_PIN, LOW); WRITE_RELE(E0E1_CHOICE_PIN, LOW);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
case 1: case 1:
WRITE_RELE(E0E1_CHOICE_PIN, HIGH); WRITE_RELE(E0E1_CHOICE_PIN, HIGH);
active_driver = 0; active_driver = 0;
delay(500); // 500 microseconds delay for relay delay_ms(500); // 500 microseconds delay for relay
enable_e0(); enable_e0();
break; break;
} }
...@@ -7055,7 +7077,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -7055,7 +7077,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
else if (target_extruder == 1) { else if (target_extruder == 1) {
servo[DONDOLO_SERVO_INDEX].write(DONDOLO_SERVOPOS_E1); servo[DONDOLO_SERVO_INDEX].write(DONDOLO_SERVOPOS_E1);
} }
delay(DONDOLO_SERVO_DELAY); delay_ms(DONDOLO_SERVO_DELAY);
servo[DONDOLO_SERVO_INDEX].detach(); servo[DONDOLO_SERVO_INDEX].detach();
active_extruder = target_extruder; active_extruder = target_extruder;
active_driver = 0; active_driver = 0;
...@@ -8376,7 +8398,6 @@ void Stop() { ...@@ -8376,7 +8398,6 @@ void Stop() {
disable_all_heaters(); disable_all_heaters();
if (IsRunning()) { if (IsRunning()) {
Running = false; Running = false;
Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
ECHO_LM(ER, SERIAL_ERR_STOPPED); ECHO_LM(ER, SERIAL_ERR_STOPPED);
ECHO_S(PAUSE); ECHO_S(PAUSE);
ECHO_E; ECHO_E;
......
...@@ -83,6 +83,8 @@ void clamp_to_software_endstops(float target[3]); ...@@ -83,6 +83,8 @@ void clamp_to_software_endstops(float target[3]);
extern millis_t previous_cmd_ms; extern millis_t previous_cmd_ms;
void refresh_cmd_timeout(); void refresh_cmd_timeout();
extern void delay_ms(millis_t ms);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN)
void setPwmFrequency(uint8_t pin, int val); void setPwmFrequency(uint8_t pin, int val);
#endif #endif
...@@ -236,7 +238,6 @@ extern void calculate_volumetric_multipliers(); ...@@ -236,7 +238,6 @@ extern void calculate_volumetric_multipliers();
long code_value_long(); long code_value_long();
bool code_seen(char ); bool code_seen(char );
// //
// Utility functions used by M100 to get its work done. // Utility functions used by M100 to get its work done.
// //
...@@ -247,4 +248,5 @@ extern void calculate_volumetric_multipliers(); ...@@ -247,4 +248,5 @@ extern void calculate_volumetric_multipliers();
int how_many_E5s_are_here( unsigned char *); int how_many_E5s_are_here( unsigned char *);
#endif #endif
#endif //MARLIN_H #endif //MARLIN_H
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
#endif #endif
#include <util/delay.h> #include <util/delay.h>
#include <avr/eeprom.h> #include <avr/eeprom.h>
#include "fastio.h" #include "module/fastio.h"
#endif #endif
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include "macros.h" #include "module/macros.h"
#include "Boards.h" #include "Boards.h"
#include "mechanics.h" #include "module/mechanics.h"
#include "Configuration_Version.h" #include "Configuration_Version.h"
#include "Configuration_Overall.h" #include "Configuration_Overall.h"
...@@ -49,10 +49,10 @@ ...@@ -49,10 +49,10 @@
#endif #endif
#include "language/language.h" #include "language/language.h"
#include "conditionals.h" #include "module/conditionals.h"
#include "sanitycheck.h" #include "module/sanitycheck.h"
#include "thermistortables.h" #include "module/thermistortables.h"
#include "comunication.h" #include "module/comunication.h"
typedef unsigned long millis_t; typedef unsigned long millis_t;
......
#include "base.h" #include "base.h"
#include "Marlin_main.h" #include "Marlin_main.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "module/vector_3.h"
#endif #endif
#include "planner.h" #include "module/planner.h"
#include "stepper_indirection.h" #include "module/stepper_indirection.h"
#include "stepper.h" #include "module/stepper.h"
#include "temperature.h" #include "module/temperature.h"
#include "ultralcd.h" #include "module/ultralcd.h"
#include "configuration_store.h" #include "configuration_store.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "cardreader.h" #include "module/cardreader.h"
#endif #endif
/** /**
* configuration_store.cpp * configuration_store.cpp
......
...@@ -184,11 +184,11 @@ ...@@ -184,11 +184,11 @@
#define SERIAL_T_MINTEMP "MINTEMP triggered" #define SERIAL_T_MINTEMP "MINTEMP triggered"
// Endstop // Endstop
#define SERIAL_ENDSTOP_X " X:" #define SERIAL_ENDSTOP_X " X="
#define SERIAL_ENDSTOP_Y " Y:" #define SERIAL_ENDSTOP_Y " Y="
#define SERIAL_ENDSTOP_Z " Z:" #define SERIAL_ENDSTOP_Z " Z="
#define SERIAL_ENDSTOP_E " E:" #define SERIAL_ENDSTOP_E " E="
#define SERIAL_ENDSTOP_PROBE " PROBE:" #define SERIAL_ENDSTOP_PROBE " PROBE="
// Debug // Debug
#define SERIAL_DEBUG_ECHO "DEBUG ECHO ENABLED" #define SERIAL_DEBUG_ECHO "DEBUG ECHO ENABLED"
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
Modified 28 September 2010 by Mark Sproul Modified 28 September 2010 by Mark Sproul
*/ */
#include "base.h" #include "../base.h"
#include "MarlinSerial.h" #include "MarlinSerial.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* along with the Arduino Sd2Card Library. If not, see * along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "base.h" #include "../base.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "Sd2Card.h" #include "Sd2Card.h"
......
...@@ -18,9 +18,11 @@ ...@@ -18,9 +18,11 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "../base.h"
#ifndef Sd2Card_h #ifndef Sd2Card_h
#define Sd2Card_h #define Sd2Card_h
#include "base.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
/** /**
......
...@@ -18,9 +18,11 @@ ...@@ -18,9 +18,11 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "base.h" #include "../base.h"
#include "../Marlin_main.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "Marlin_main.h"
#include <stdint.h> #include <stdint.h>
#include "SdBaseFile.h" #include "SdBaseFile.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -18,14 +18,18 @@ ...@@ -18,14 +18,18 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "../base.h"
#ifndef SdFatUtil_h #ifndef SdFatUtil_h
#define SdFatUtil_h #define SdFatUtil_h
/** /**
* \file * \file
* \brief Useful utility functions. * \brief Useful utility functions.
*/ */
#include "base.h"
#include "MarlinSerial.h" #include "MarlinSerial.h"
/** Store and print a string in flash memory.*/ /** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x)) #define PgmPrint(x) SerialPrint_P(PSTR(x))
/** Store and print a string in flash memory followed by a CR/LF.*/ /** Store and print a string in flash memory followed by a CR/LF.*/
......
...@@ -17,9 +17,12 @@ ...@@ -17,9 +17,12 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "base.h"
#include "../base.h"
#include "../Marlin_main.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "Marlin_main.h"
#include "SdFile.h" #include "SdFile.h"
/** Create a file object and open it in the current working directory. /** Create a file object and open it in the current working directory.
* *
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "base.h"
#include "Marlin_main.h" #include "../base.h"
#include "../Marlin_main.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "SdVolume.h" #include "SdVolume.h"
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef SdVolume_h #ifndef SdVolume_h
#define SdVolume_h #define SdVolume_h
/** /**
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#if HAS(BUZZER) #if HAS(BUZZER)
#include "buzzer.h" #include "buzzer.h"
#include "../ultralcd.h" #include "ultralcd.h"
void buzz(long duration, uint16_t freq) { void buzz(long duration, uint16_t freq) {
if (freq > 0) { if (freq > 0) {
......
#include "base.h" #include "../base.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "Marlin_main.h" #include "../Marlin_main.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "vector_3.h"
#endif #endif
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "stepper.h" #include "stepper.h"
#include "temperature.h" #include "temperature.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "module/nextion_lcd.h" #include "nextion_lcd.h"
#include "cardreader.h" #include "cardreader.h"
CardReader::CardReader() { CardReader::CardReader() {
......
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
#endif #endif
#endif #endif
#include "pins.h" #include "../Pins.h"
/** /**
* DONDOLO * DONDOLO
......
#include "base.h" #include "../base.h"
#if ENABLED(DIGIPOT_I2C) #if ENABLED(DIGIPOT_I2C)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Externa DAC for Alligator Board * Externa DAC for Alligator Board
* *
****************************************************************/ ****************************************************************/
#include "base.h" #include "../base.h"
#if MB(ALLIGATOR) #if MB(ALLIGATOR)
#include "stepper.h" #include "stepper.h"
......
...@@ -4,19 +4,18 @@ ...@@ -4,19 +4,18 @@
*/ */
#include "../base.h" #include "../base.h"
#include "../Marlin_main.h"
#if ENABLED(FIRMWARE_TEST) #if ENABLED(FIRMWARE_TEST)
#include "firmware_test.h" #include "firmware_test.h"
#include "planner.h"
#include "../Marlin_main.h" #include "stepper_indirection.h"
#include "../planner.h" #include "stepper.h"
#include "../stepper_indirection.h" #include "temperature.h"
#include "../stepper.h"
#include "../temperature.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "../vector_3.h" #include "vector_3.h"
#endif #endif
static char serial_answer; static char serial_answer;
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
*/ */
#include "../base.h" #include "../base.h"
#include "../Marlin_main.h"
#if ENABLED(NEXTION_GFX) #if ENABLED(NEXTION_GFX)
#include "../Marlin_main.h" #include "stepper.h"
#include "../stepper.h"
#include "nextion_gfx.h" #include "nextion_gfx.h"
const int INSIDE = 0; // 0000 const int INSIDE = 0; // 0000
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
* *
*/ */
#ifndef NEXTION_GFX_H #ifndef NEXTION_GFX_H
#define NEXTION_GFX_H #define NEXTION_GFX_H
......
#include "../base.h" #include "../base.h"
#include "../Marlin_main.h"
#include "../configuration_store.h"
#if ENABLED(NEXTION) #if ENABLED(NEXTION)
#include "../Marlin_main.h" #include "cardreader.h"
#include "../cardreader.h" #include "temperature.h"
#include "../temperature.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "../vector_3.h" #include "vector_3.h"
#endif #endif
#include "../planner.h" #include "planner.h"
#include "../stepper_indirection.h" #include "stepper_indirection.h"
#include "../stepper.h" #include "stepper.h"
#include "../configuration_store.h"
#include "nextion_lcd.h" #include "nextion_lcd.h"
#include "nextion_gfx.h" #include "nextion_gfx.h"
#include <Nextion.h> #include <Nextion.h>
const float MaxWave = 0.2;
bool NextionON = false; bool NextionON = false;
bool PageInfo = false; bool PageInfo = false;
bool gfxON = false;
char buffer[100] = {0}; char buffer[100] = {0};
uint32_t slidermaxval = 20; uint32_t slidermaxval = 20;
char lcd_status_message[30] = WELCOME_MSG; char lcd_status_message[30] = WELCOME_MSG;
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
static millis_t next_lcd_update_ms; static millis_t next_lcd_update_ms;
#if ENABLED(NEXTION_GFX) #if ENABLED(NEXTION_GFX)
GFX gfx = GFX(200, 190); GFX gfx = GFX(196, 194);
#endif #endif
// Page // Page
...@@ -39,10 +41,10 @@ ...@@ -39,10 +41,10 @@
NexPage Pmove = NexPage(6, 0, "move"); NexPage Pmove = NexPage(6, 0, "move");
// Text // Text
NexText Hotend0 = NexText(1, 2, "t0"); NexText Hotend0 = NexText(1, 1, "t0");
NexText Hotend1 = NexText(1, 4, "t1"); NexText Hotend1 = NexText(1, 4, "t1");
NexText Hotend21 = NexText(1, 5, "h2"); NexText Hotend2 = NexText(1, 5, "t2");
NexText Hotend2 = NexText(1, 6, "t2"); NexText Hotend21 = NexText(1, 6, "h2");
NexText LedStatus = NexText(1, 7, "t4"); NexText LedStatus = NexText(1, 7, "t4");
NexText LedCoord = NexText(1, 8, "t5"); NexText LedCoord = NexText(1, 8, "t5");
NexText set0 = NexText(2, 2, "set0"); NexText set0 = NexText(2, 2, "set0");
...@@ -55,15 +57,15 @@ ...@@ -55,15 +57,15 @@
NexText sdfolder = NexText(4, 23, "sdfolder"); NexText sdfolder = NexText(4, 23, "sdfolder");
// Picture // Picture
NexPicture Menu = NexPicture(1, 9, "p0"); NexPicture Menu = NexPicture(1, 10, "p0");
NexPicture MSD = NexPicture(1, 10, "p1"); NexPicture MSD = NexPicture(1, 11, "p1");
NexPicture MSetup = NexPicture(1, 11, "p2"); NexPicture MSetup = NexPicture(1, 12, "p2");
NexPicture Hend0 = NexPicture(1, 12, "p3"); NexPicture Hend0 = NexPicture(1, 13, "p3");
NexPicture Hend1 = NexPicture(1, 14, "p4"); NexPicture Hend1 = NexPicture(1, 14, "p4");
NexPicture Hend2 = NexPicture(1, 16, "p5"); NexPicture Hend2 = NexPicture(1, 15, "p5");
NexPicture Fanpic = NexPicture(1, 18, "p6"); NexPicture Fanpic = NexPicture(1, 19, "p6");
NexPicture NPlay = NexPicture(1, 24, "p7"); NexPicture NPlay = NexPicture(1, 27, "p7");
NexPicture NStop = NexPicture(1, 25, "p8"); NexPicture NStop = NexPicture(1, 28, "p8");
NexPicture Exit1 = NexPicture(3, 4, "p3"); NexPicture Exit1 = NexPicture(3, 4, "p3");
NexPicture Folder0 = NexPicture(4, 9, "p0"); NexPicture Folder0 = NexPicture(4, 9, "p0");
NexPicture Folder1 = NexPicture(4, 10, "p1"); NexPicture Folder1 = NexPicture(4, 10, "p1");
...@@ -84,29 +86,32 @@ ...@@ -84,29 +86,32 @@
NexPicture ZDown = NexPicture(6, 12, "p11"); NexPicture ZDown = NexPicture(6, 12, "p11");
// Progress Bar // Progress Bar
NexProgressBar sdbar = NexProgressBar(1, 23, "j0"); NexProgressBar sdbar = NexProgressBar(1, 26, "j0");
// Slider // Slider
NexSlider sdlist = NexSlider(4, 1, "h0"); NexSlider sdlist = NexSlider(4, 1, "h0");
// Wafeform // Wafeform
NexWaveform Graph0 = NexWaveform(1, 9, "s0");
NexWaveform Graph1 = NexWaveform(1, 24, "s1");
NexWaveform Graph2 = NexWaveform(1, 25, "s2");
// Touch area // Touch area
NexHotspot hot0 = NexHotspot(1, 13, "hot0"); NexHotspot hot0 = NexHotspot(1, 14, "hot0");
NexHotspot hot1 = NexHotspot(1, 15, "hot1"); NexHotspot hot1 = NexHotspot(1, 16, "hot1");
NexHotspot hot2 = NexHotspot(1, 17, "hot2"); NexHotspot hot2 = NexHotspot(1, 18, "hot2");
NexHotspot m11 = NexHotspot(2, 14, "m11"); NexHotspot m11 = NexHotspot(2, 14, "m11");
NexHotspot tup = NexHotspot(2, 16, "tup"); NexHotspot tup = NexHotspot(2, 16, "tup");
NexHotspot tdown = NexHotspot(2, 17, "tdown"); NexHotspot tdown = NexHotspot(2, 17, "tdown");
// Timer // Timer
NexTimer startimer = NexTimer(0, 1, "tm0"); NexTimer startimer = NexTimer(0, 1, "tm0");
NexTimer fantimer = NexTimer(1, 22, "tm0"); NexTimer fantimer = NexTimer(1, 23, "tm0");
// Variable // Variable
NexVar Hotend = NexVar(1, 19, "he"); NexVar Hotend = NexVar(1, 20, "he");
NexVar Bed = NexVar(1, 20, "bed");
NexVar set1 = NexVar(2, 17, "set1"); NexVar set1 = NexVar(2, 17, "set1");
NexVar Bed = NexVar(1, 21, "bed");
NexVar filename0 = NexVar(4, 19, "va0"); NexVar filename0 = NexVar(4, 19, "va0");
NexVar filename1 = NexVar(4, 20, "va1"); NexVar filename1 = NexVar(4, 20, "va1");
NexVar filename2 = NexVar(4, 21, "va2"); NexVar filename2 = NexVar(4, 21, "va2");
...@@ -160,6 +165,14 @@ ...@@ -160,6 +165,14 @@
NULL NULL
}; };
NexWaveform *graph_list[] =
{
&Graph0,
&Graph1,
&Graph2,
NULL
};
NexText *row_list[] = NexText *row_list[] =
{ {
&sdrow0, &sdrow0,
...@@ -198,10 +211,6 @@ ...@@ -198,10 +211,6 @@
PageInfo = true; PageInfo = true;
#if ENABLED(NEXTION_GFX)
gfx_clear(X_MAX_POS, Y_MAX_POS, Z_MAX_POS);
#endif
#if HAS_TEMP_0 #if HAS_TEMP_0
Hotend.setValue(1); Hotend.setValue(1);
#endif #endif
...@@ -269,6 +278,7 @@ ...@@ -269,6 +278,7 @@
static void setpagesdcard() { static void setpagesdcard() {
PageInfo = false; PageInfo = false;
gfxON = false;
Psdcard.show(); Psdcard.show();
uint16_t fileCnt = card.getnrfilenames(); uint16_t fileCnt = card.getnrfilenames();
...@@ -426,10 +436,12 @@ ...@@ -426,10 +436,12 @@
void setpagePopCallback(void *ptr) { void setpagePopCallback(void *ptr) {
if (ptr == &Menu) { if (ptr == &Menu) {
PageInfo = false; PageInfo = false;
gfxON = false;
Pmenu.show(); Pmenu.show();
} }
else if (ptr == &MSetup) { else if (ptr == &MSetup) {
PageInfo = false; PageInfo = false;
gfxON = false;
Psetup.show(); Psetup.show();
} }
...@@ -472,7 +484,7 @@ ...@@ -472,7 +484,7 @@
#endif #endif
void lcd_init() { void lcd_init() {
delay(1000); delay_ms(1000);
NextionON = nexInit(); NextionON = nexInit();
if (!NextionON) { if (!NextionON) {
...@@ -549,6 +561,11 @@ ...@@ -549,6 +561,11 @@
hotend_list[h]->setText(buffer); hotend_list[h]->setText(buffer);
hotend_list[h]->setColor(color); hotend_list[h]->setColor(color);
if (!gfxON) {
graph_list[h]->addValue(0, (int)(T1 * MaxWave));
graph_list[h]->addValue(1, (int)(T2 * MaxWave));
}
} }
static void coordtoLCD() { static void coordtoLCD() {
...@@ -661,17 +678,19 @@ ...@@ -661,17 +678,19 @@
#if ENABLED(NEXTION_GFX) #if ENABLED(NEXTION_GFX)
void gfx_clear(float x, float y, float z) { void gfx_clear(float x, float y, float z) {
if (PageInfo) if (PageInfo) {
gfx.clear(x, y, z); gfx.clear(x, y, z);
gfxON = true;
}
} }
void gfx_cursor_to(float x, float y, float z) { void gfx_cursor_to(float x, float y, float z) {
if (PageInfo) if (PageInfo && gfxON)
gfx.cursor_to(x, y, z); gfx.cursor_to(x, y, z);
} }
void gfx_line_to(float x, float y, float z){ void gfx_line_to(float x, float y, float z){
if (PageInfo) if (PageInfo && gfxON)
gfx.line_to(VC_TOOL, x, y, z); gfx.line_to(VC_TOOL, x, y, z);
} }
#endif #endif
......
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
* *
*/ */
#include "base.h" #include "../base.h"
#include "Marlin_main.h" #include "../Marlin_main.h"
#include "planner.h" #include "planner.h"
#include "stepper_indirection.h" #include "stepper_indirection.h"
......
#include "base.h" #include "../base.h"
#if ENABLED(AUTO_BED_LEVELING_GRID) #if ENABLED(AUTO_BED_LEVELING_GRID)
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/* The timer calculations of this module informed by the 'RepRap cartesian firmware' by Zack Smith /* The timer calculations of this module informed by the 'RepRap cartesian firmware' by Zack Smith
and Philipp Tiefenbacher. */ and Philipp Tiefenbacher. */
#include "base.h" #include "../base.h"
#include "Marlin_main.h" #include "../Marlin_main.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "vector_3.h"
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "stepper.h" #include "stepper.h"
#include "temperature.h" #include "temperature.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "module/nextion_lcd.h" #include "nextion_lcd.h"
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "cardreader.h" #include "cardreader.h"
...@@ -96,7 +96,11 @@ static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROB ...@@ -96,7 +96,11 @@ static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROB
old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX, E_MIN old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX, E_MIN
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
#if ENABLED(ABORT_ON_ENDSTOP_HIT_INIT)
bool abort_on_endstop_hit = ABORT_ON_ENDSTOP_HIT_INIT;
#else
bool abort_on_endstop_hit = false; bool abort_on_endstop_hit = false;
#endif
#endif #endif
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
...@@ -263,7 +267,16 @@ void endstops_hit_on_purpose() { ...@@ -263,7 +267,16 @@ void endstops_hit_on_purpose() {
void checkHitEndstops() { void checkHitEndstops() {
if (endstop_hit_bits) { if (endstop_hit_bits) {
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
if (abort_on_endstop_hit)
ECHO_SM(ER, SERIAL_ENDSTOPS_HIT);
else
ECHO_SM(DB, SERIAL_ENDSTOPS_HIT); ECHO_SM(DB, SERIAL_ENDSTOPS_HIT);
#else
ECHO_SM(DB, SERIAL_ENDSTOPS_HIT);
#endif
if (endstop_hit_bits & BIT(X_MIN)) { if (endstop_hit_bits & BIT(X_MIN)) {
ECHO_MV(SERIAL_ENDSTOP_X, (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]); ECHO_MV(SERIAL_ENDSTOP_X, (float)endstops_trigsteps[X_AXIS] / axis_steps_per_unit[X_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_XS); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT MSG_ENDSTOP_XS);
...@@ -290,16 +303,19 @@ void checkHitEndstops() { ...@@ -290,16 +303,19 @@ void checkHitEndstops() {
#endif #endif
ECHO_E; ECHO_E;
endstops_hit_on_purpose(); #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
if (abort_on_endstop_hit && !(endstop_hit_bits & BIT(Z_PROBE)) && !(endstop_hit_bits & BIT(E_MIN))) {
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
if (abort_on_endstop_hit) {
card.sdprinting = false; card.sdprinting = false;
card.closeFile(); card.closeFile();
quickStop(); #endif
disable_all_heaters(); // switch off all heaters. for (int i = 0; i < 3; i++) axis_known_position[i] = false; // not homed anymore
quickStop(); // kill the planner buffer
Stop(); // restart by M999
} }
#endif #endif
endstops_hit_on_purpose();
} }
} }
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
along with Marlin. If not, see <http://www.gnu.org/licenses/>. along with Marlin. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "base.h" #include "../base.h"
#include "stepper_indirection.h" #include "stepper_indirection.h"
#if ENABLED(HAVE_TMCDRIVER) #if ENABLED(HAVE_TMCDRIVER)
#include <SPI.h> #include <SPI.h>
#include <TMC26XStepper.h> #include <TMC26XStepper.h>
......
...@@ -18,13 +18,14 @@ ...@@ -18,13 +18,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "base.h" #include "../base.h"
#include "Marlin_main.h" #include "../Marlin_main.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "vector_3.h"
#endif #endif
#include "ultralcd.h" #include "ultralcd.h"
#include "module/nextion_lcd.h" #include "nextion_lcd.h"
#include "planner.h" #include "planner.h"
#include "stepper_indirection.h" #include "stepper_indirection.h"
#if MB(ALLIGATOR) #if MB(ALLIGATOR)
...@@ -1101,7 +1102,7 @@ void tp_init() { ...@@ -1101,7 +1102,7 @@ void tp_init() {
TIMSK0 |= BIT(OCIE0B); TIMSK0 |= BIT(OCIE0B);
// Wait for temperature measurement to settle // Wait for temperature measurement to settle
delay(250); delay_ms(250);
#define TEMP_MIN_ROUTINE(NR) \ #define TEMP_MIN_ROUTINE(NR) \
minttemp[NR] = HEATER_ ## NR ## _MINTEMP; \ minttemp[NR] = HEATER_ ## NR ## _MINTEMP; \
......
#include "base.h" #include "../base.h"
#include "../Marlin_main.h"
#include "../configuration_store.h"
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
#include "Marlin_main.h"
#include "cardreader.h" #include "cardreader.h"
#include "temperature.h" #include "temperature.h"
...@@ -13,11 +14,10 @@ ...@@ -13,11 +14,10 @@
#include "planner.h" #include "planner.h"
#include "stepper_indirection.h" #include "stepper_indirection.h"
#include "stepper.h" #include "stepper.h"
#include "configuration_store.h"
#include "ultralcd.h" #include "ultralcd.h"
#if HAS(BUZZER) #if HAS(BUZZER)
#include "module/buzzer.h" #include "buzzer.h"
#endif #endif
int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
......
#ifndef ULTRALCD_H #ifndef ULTRALCD_H
#define ULTRALCD_H #define ULTRALCD_H
#include "Marlin_main.h" #include "../Marlin_main.h"
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
#if HAS(BUZZER) #if HAS(BUZZER)
#include "module/buzzer.h" #include "buzzer.h"
#endif #endif
int lcd_strlen(char* s); int lcd_strlen(char* s);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <math.h> #include <math.h>
#include "base.h" #include "../base.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h" #include "vector_3.h"
......
#include "base.h" #include "../base.h"
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment