diff --git a/Firmware/MarlinSerial.cpp b/Firmware/MarlinSerial.cpp index 02c8b1296..5f1c5ce33 100644 --- a/Firmware/MarlinSerial.cpp +++ b/Firmware/MarlinSerial.cpp @@ -255,7 +255,7 @@ void MarlinSerial::print(double n, int digits) void MarlinSerial::println(void) { - print('\r'); + // print('\r'); print('\n'); } diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a770531ca..4739dc4a8 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5729,10 +5729,16 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) /*! ### M20 - SD Card file list M20: List SD card + #### Usage + + M20 [ L ] + #### Parameters + - `L` - Reports ling filenames instead of just short filenames. Requires host software parsing. */ case 20: + KEEPALIVE_STATE(NOT_BUSY); // do not send busy messages during listing. Inhibits the output of manage_heater() SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));////MSG_BEGIN_FILE_LIST - card.ls(); + card.ls(code_seen('L')); SERIAL_PROTOCOLLNRPGM(_N("End file list"));////MSG_END_FILE_LIST break; diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index fd0ca2732..e228c5236 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -62,9 +62,10 @@ char *createFilename(char *buffer,const dir_t &p) //buffer>12characters /** +* Dive into a folder and recurse depth-first to perform a pre-set operation lsAction: -+* LS_Count - Add +1 to nrFiles for every file within the parent -+* LS_GetFilename - Get the filename of the file indexed by nrFiles -+* LS_SerialPrint - Print the full path and size of each file to serial output ++* LS_Count - Add +1 to nrFiles for every file within the parent ++* LS_GetFilename - Get the filename of the file indexed by nrFiles ++* LS_SerialPrint - Print the full path and size of each file to serial output ++* LS_SerialPrint_LFN - Print the full path, long filename and size of each file to serial output +*/ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/) { @@ -90,9 +91,13 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m // Serial.print(path); // Get a new directory object using the full path // and dive recursively into it. + + if (lsAction == LS_SerialPrint_LFN) + printf_P(PSTR("DIR_ENTER: %s \"%s\"\n"), path, longFilename[0] ? longFilename : lfilename); + SdFile dir; if (!dir.open(parent, lfilename, O_READ)) { - if (lsAction == LS_SerialPrint) { + if (lsAction == LS_SerialPrint || lsAction == LS_SerialPrint_LFN) { //SERIAL_ECHO_START(); //SERIAL_ECHOPGM(_i("Cannot open subdir"));////MSG_SD_CANT_OPEN_SUBDIR //SERIAL_ECHOLN(lfilename); @@ -100,6 +105,9 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m } lsDive(path, dir); // close() is done automatically by destructor of SdFile + + if (lsAction == LS_SerialPrint_LFN) + puts_P(PSTR("DIR_EXIT")); } else { uint8_t pn0 = p.name[0]; @@ -114,12 +122,18 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m nrFiles++; break; + case LS_SerialPrint_LFN: case LS_SerialPrint: createFilename(filename, p); SERIAL_PROTOCOL(prepend); SERIAL_PROTOCOL(filename); MYSERIAL.write(' '); + + if (lsAction == LS_SerialPrint_LFN) + printf_P(PSTR("\"%s\" "), LONGEST_FILENAME); + SERIAL_PROTOCOLLN(p.fileSize); + manage_heater(); break; case LS_GetFilename: @@ -160,9 +174,9 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m } // while readDir } -void CardReader::ls() +void CardReader::ls(bool printLFN) { - lsAction=LS_SerialPrint; + lsAction = printLFN ? LS_SerialPrint_LFN : LS_SerialPrint; //if(lsAction==LS_Count) //nrFiles=0; diff --git a/Firmware/cardreader.h b/Firmware/cardreader.h index 12e83d969..25e97882e 100644 --- a/Firmware/cardreader.h +++ b/Firmware/cardreader.h @@ -6,7 +6,7 @@ #define MAX_DIR_DEPTH 10 #include "SdFile.h" -enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename}; +enum LsAction {LS_SerialPrint,LS_SerialPrint_LFN,LS_Count,LS_GetFilename}; class CardReader { public: @@ -38,7 +38,7 @@ public: uint16_t getWorkDirDepth(); - void ls(); + void ls(bool printLFN); void chdir(const char * relpath); void updir(); void setroot(); diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 731db1da1..5445df4f7 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -242,9 +242,11 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP | ^ | ^ | ^ | 00h 0 | ^ | Check mode for nozzle is: __none__ | ^ | ^ | 0x0DA7 3495 | uint8 | EEPROM_NOZZLE_DIAMETER | 28h 40 | ffh 255 | Nozzle diameter is: __40 or 0.40mm__ | LCD menu | D3 Ax0da7 C1 | ^ | ^ | ^ | 3ch 60 | ^ | Nozzle diameter is: __60 or 0.60mm__ | ^ | ^ +| ^ | ^ | ^ | 3ch 80 | ^ | Nozzle diameter is: __80 or 0.80mm__ | ^ | ^ | ^ | ^ | ^ | 19h 25 | ^ | Nozzle diameter is: __25 or 0.25mm__ | ^ | ^ | 0x0DA5 3493 | uint16 | EEPROM_NOZZLE_DIAMETER_uM | 9001h | ff ffh 65535 | Nozzle diameter is: __400um__ | LCD menu | D3 Ax0da5 C2 | ^ | ^ | ^ | 5802h | ^ | Nozzle diameter is: __600um__ | ^ | ^ +| ^ | ^ | ^ | 2003h | ^ | Nozzle diameter is: __800um__ | ^ | ^ | ^ | ^ | ^ | fa00h | ^ | Nozzle diameter is: __250um__ | ^ | ^ | 0x0DA4 3492 | uint8 | EEPROM_CHECK_MODEL | 01h 1 | ffh 255 | Check mode for printer model is: __warn__ | LCD menu | D3 Ax0da4 C1 | ^ | ^ | ^ | 02h 0 | ^ | Check mode for printer model is: __strict__ | ^ | ^ diff --git a/Firmware/sm4.c b/Firmware/sm4.c index cf5ac16ea..dcd314082 100644 --- a/Firmware/sm4.c +++ b/Firmware/sm4.c @@ -129,11 +129,15 @@ void sm4_set_dir_bits(uint8_t dir_bits) void sm4_do_step(uint8_t axes_mask) { #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3) || (MOTHERBOARD == BOARD_EINSY_1_0a)) +#ifdef TMC2130_DEDGE_STEPPING + PINC = (axes_mask & 0x0f); // toggle step signals by mask +#else register uint8_t portC = PORTC & 0xf0; PORTC = portC | (axes_mask & 0x0f); //set step signals by mask asm("nop"); PORTC = portC; //set step signals to zero asm("nop"); +#endif #endif //((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3) || (MOTHERBOARD == BOARD_EINSY_1_0a)) } diff --git a/Firmware/sm4.h b/Firmware/sm4.h index ce110caa8..9b5531548 100644 --- a/Firmware/sm4.h +++ b/Firmware/sm4.h @@ -1,57 +1,57 @@ -//sm4.h - simple 4-axis stepper control -#ifndef _SM4_H -#define _SM4_H - -#include -#include "config.h" - - -#if defined(__cplusplus) -extern "C" { -#endif //defined(__cplusplus) - - -// callback prototype for stop condition (return 0 - continue, return 1 - stop) -typedef uint8_t (*sm4_stop_cb_t)(); - -// callback prototype for updating position counters -typedef void (*sm4_update_pos_cb_t)(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de); - -// callback prototype for calculating delay -typedef uint16_t (*sm4_calc_delay_cb_t)(uint16_t nd, uint16_t dd); - - -// callback pointer - stop -extern sm4_stop_cb_t sm4_stop_cb; - -// callback pointer - update_pos -extern sm4_update_pos_cb_t sm4_update_pos_cb; - -// callback pointer - calc_delay -extern sm4_calc_delay_cb_t sm4_calc_delay_cb; - - -// returns direction for single axis (0 - positive, 1 - negative) -extern uint8_t sm4_get_dir(uint8_t axis); - -// set direction for single axis (0 - positive, 1 - negative) -extern void sm4_set_dir(uint8_t axis, uint8_t dir); - -// returns direction of all axes as bitmask (0 - positive, 1 - negative) -extern uint8_t sm4_get_dir_bits(void); - -// set direction for all axes as bitmask (0 - positive, 1 - negative) -extern void sm4_set_dir_bits(uint8_t dir_bits); - -// step axes by bitmask -extern void sm4_do_step(uint8_t axes_mask); - -// xyze linear-interpolated relative move, returns remaining diagonal steps (>0 means stoped) -extern uint16_t sm4_line_xyze_ui(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de); -extern uint16_t sm4_line_xyz_ui(uint16_t dx, uint16_t dy, uint16_t dz); - - -#if defined(__cplusplus) -} -#endif //defined(__cplusplus) -#endif //_SM4_H +//sm4.h - simple 4-axis stepper control +#ifndef _SM4_H +#define _SM4_H + +#include +#include "config.h" + + +#if defined(__cplusplus) +extern "C" { +#endif //defined(__cplusplus) + + +// callback prototype for stop condition (return 0 - continue, return 1 - stop) +typedef uint8_t (*sm4_stop_cb_t)(); + +// callback prototype for updating position counters +typedef void (*sm4_update_pos_cb_t)(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de); + +// callback prototype for calculating delay +typedef uint16_t (*sm4_calc_delay_cb_t)(uint16_t nd, uint16_t dd); + + +// callback pointer - stop +extern sm4_stop_cb_t sm4_stop_cb; + +// callback pointer - update_pos +extern sm4_update_pos_cb_t sm4_update_pos_cb; + +// callback pointer - calc_delay +extern sm4_calc_delay_cb_t sm4_calc_delay_cb; + + +// returns direction for single axis (0 - positive, 1 - negative) +extern uint8_t sm4_get_dir(uint8_t axis); + +// set direction for single axis (0 - positive, 1 - negative) +extern void sm4_set_dir(uint8_t axis, uint8_t dir); + +// returns direction of all axes as bitmask (0 - positive, 1 - negative) +extern uint8_t sm4_get_dir_bits(void); + +// set direction for all axes as bitmask (0 - positive, 1 - negative) +extern void sm4_set_dir_bits(uint8_t dir_bits); + +// step axes by bitmask +extern void sm4_do_step(uint8_t axes_mask); + +// xyze linear-interpolated relative move, returns remaining diagonal steps (>0 means stoped) +extern uint16_t sm4_line_xyze_ui(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de); +extern uint16_t sm4_line_xyz_ui(uint16_t dx, uint16_t dy, uint16_t dz); + + +#if defined(__cplusplus) +} +#endif //defined(__cplusplus) +#endif //_SM4_H diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 7c44d791b..e987cca30 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -48,6 +48,62 @@ int fsensor_counter; //counter for e-steps uint16_t SP_min = 0x21FF; #endif //DEBUG_STACK_MONITOR + +/* + * Stepping macros + */ +#define _STEP_PIN_X_AXIS X_STEP_PIN +#define _STEP_PIN_Y_AXIS Y_STEP_PIN +#define _STEP_PIN_Z_AXIS Z_STEP_PIN +#define _STEP_PIN_E_AXIS E0_STEP_PIN + +#ifdef DEBUG_XSTEP_DUP_PIN +#define _STEP_PIN_X_DUP_AXIS DEBUG_XSTEP_DUP_PIN +#endif +#ifdef DEBUG_YSTEP_DUP_PIN +#define _STEP_PIN_Y_DUP_AXIS DEBUG_YSTEP_DUP_PIN +#endif +#ifdef Y_DUAL_STEPPER_DRIVERS +#error Y_DUAL_STEPPER_DRIVERS not fully implemented +#define _STEP_PIN_Y2_AXIS Y2_STEP_PIN +#endif +#ifdef Z_DUAL_STEPPER_DRIVERS +#error Z_DUAL_STEPPER_DRIVERS not fully implemented +#define _STEP_PIN_Z2_AXIS Z2_STEP_PIN +#endif + +#ifdef TMC2130 +#define STEPPER_MINIMUM_PULSE TMC2130_MINIMUM_PULSE +#define STEPPER_SET_DIR_DELAY TMC2130_SET_DIR_DELAY +#define STEPPER_MINIMUM_DELAY TMC2130_MINIMUM_DELAY +#else +#define STEPPER_MINIMUM_PULSE 2 +#define STEPPER_SET_DIR_DELAY 100 +#define STEPPER_MINIMUM_DELAY delayMicroseconds(STEPPER_MINIMUM_PULSE) +#endif + +#ifdef TMC2130_DEDGE_STEPPING +static_assert(TMC2130_MINIMUM_DELAY 1, // this will fail to compile when non-empty + "DEDGE implies/requires an empty TMC2130_MINIMUM_DELAY"); +#define STEP_NC_HI(axis) TOGGLE(_STEP_PIN_##axis) +#define STEP_NC_LO(axis) //NOP +#else + +#define _STEP_HI_X_AXIS !INVERT_X_STEP_PIN +#define _STEP_LO_X_AXIS INVERT_X_STEP_PIN +#define _STEP_HI_Y_AXIS !INVERT_Y_STEP_PIN +#define _STEP_LO_Y_AXIS INVERT_Y_STEP_PIN +#define _STEP_HI_Z_AXIS !INVERT_Z_STEP_PIN +#define _STEP_LO_Z_AXIS INVERT_Z_STEP_PIN +#define _STEP_HI_E_AXIS !INVERT_E_STEP_PIN +#define _STEP_LO_E_AXIS INVERT_E_STEP_PIN + +#define STEP_NC_HI(axis) WRITE_NC(_STEP_PIN_##axis, _STEP_HI_##axis) +#define STEP_NC_LO(axis) WRITE_NC(_STEP_PIN_##axis, _STEP_LO_##axis) + +#endif //TMC2130_DEDGE_STEPPING + + //=========================================================================== //=============================public variables ============================ //=========================================================================== @@ -296,13 +352,13 @@ FORCE_INLINE void stepper_next_block() WRITE_NC(X_DIR_PIN, INVERT_X_DIR); else WRITE_NC(X_DIR_PIN, !INVERT_X_DIR); - _delay_us(100); + delayMicroseconds(STEPPER_SET_DIR_DELAY); for (uint8_t i = 0; i < st_backlash_x; i++) { - WRITE_NC(X_STEP_PIN, !INVERT_X_STEP_PIN); - _delay_us(100); - WRITE_NC(X_STEP_PIN, INVERT_X_STEP_PIN); - _delay_us(900); + STEP_NC_HI(X_AXIS); + STEPPER_MINIMUM_DELAY; + STEP_NC_LO(X_AXIS); + _delay_us(900); // hard-coded jerk! *bad* } } last_dir_bits &= ~1; @@ -319,13 +375,13 @@ FORCE_INLINE void stepper_next_block() WRITE_NC(Y_DIR_PIN, INVERT_Y_DIR); else WRITE_NC(Y_DIR_PIN, !INVERT_Y_DIR); - _delay_us(100); + delayMicroseconds(STEPPER_SET_DIR_DELAY); for (uint8_t i = 0; i < st_backlash_y; i++) { - WRITE_NC(Y_STEP_PIN, !INVERT_Y_STEP_PIN); - _delay_us(100); - WRITE_NC(Y_STEP_PIN, INVERT_Y_STEP_PIN); - _delay_us(900); + STEP_NC_HI(Y_AXIS); + STEPPER_MINIMUM_DELAY; + STEP_NC_LO(Y_AXIS); + _delay_us(900); // hard-coded jerk! *bad* } } last_dir_bits &= ~2; @@ -603,44 +659,44 @@ FORCE_INLINE void stepper_tick_lowres() // Step in X axis counter_x.lo += current_block->steps_x.lo; if (counter_x.lo > 0) { - WRITE_NC(X_STEP_PIN, !INVERT_X_STEP_PIN); + STEP_NC_HI(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN - WRITE_NC(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN); + STEP_NC_HI(X_DUP_AXIS); #endif //DEBUG_XSTEP_DUP_PIN counter_x.lo -= current_block->step_event_count.lo; count_position[X_AXIS]+=count_direction[X_AXIS]; - WRITE_NC(X_STEP_PIN, INVERT_X_STEP_PIN); + STEP_NC_LO(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN - WRITE_NC(DEBUG_XSTEP_DUP_PIN,INVERT_X_STEP_PIN); + STEP_NC_LO(X_DUP_AXIS); #endif //DEBUG_XSTEP_DUP_PIN } // Step in Y axis counter_y.lo += current_block->steps_y.lo; if (counter_y.lo > 0) { - WRITE_NC(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + STEP_NC_HI(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN - WRITE_NC(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN); + STEP_NC_HI(Y_DUP_AXIS); #endif //DEBUG_YSTEP_DUP_PIN counter_y.lo -= current_block->step_event_count.lo; count_position[Y_AXIS]+=count_direction[Y_AXIS]; - WRITE_NC(Y_STEP_PIN, INVERT_Y_STEP_PIN); + STEP_NC_LO(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN - WRITE_NC(DEBUG_YSTEP_DUP_PIN,INVERT_Y_STEP_PIN); + STEP_NC_LO(Y_DUP_AXIS); #endif //DEBUG_YSTEP_DUP_PIN } // Step in Z axis counter_z.lo += current_block->steps_z.lo; if (counter_z.lo > 0) { - WRITE_NC(Z_STEP_PIN, !INVERT_Z_STEP_PIN); + STEP_NC_HI(Z_AXIS); counter_z.lo -= current_block->step_event_count.lo; count_position[Z_AXIS]+=count_direction[Z_AXIS]; - WRITE_NC(Z_STEP_PIN, INVERT_Z_STEP_PIN); + STEP_NC_LO(Z_AXIS); } // Step in E axis counter_e.lo += current_block->steps_e.lo; if (counter_e.lo > 0) { #ifndef LIN_ADVANCE - WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); + STEP_NC_HI(E_AXIS); #endif /* LIN_ADVANCE */ counter_e.lo -= current_block->step_event_count.lo; count_position[E_AXIS] += count_direction[E_AXIS]; @@ -650,7 +706,7 @@ FORCE_INLINE void stepper_tick_lowres() #ifdef FILAMENT_SENSOR fsensor_counter += count_direction[E_AXIS]; #endif //FILAMENT_SENSOR - WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); + STEP_NC_LO(E_AXIS); #endif } if(++ step_events_completed.lo >= current_block->step_event_count.lo) @@ -665,44 +721,44 @@ FORCE_INLINE void stepper_tick_highres() // Step in X axis counter_x.wide += current_block->steps_x.wide; if (counter_x.wide > 0) { - WRITE_NC(X_STEP_PIN, !INVERT_X_STEP_PIN); + STEP_NC_HI(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN - WRITE_NC(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN); + STEP_NC_HI(X_DUP_AXIS); #endif //DEBUG_XSTEP_DUP_PIN counter_x.wide -= current_block->step_event_count.wide; count_position[X_AXIS]+=count_direction[X_AXIS]; - WRITE_NC(X_STEP_PIN, INVERT_X_STEP_PIN); + STEP_NC_LO(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN - WRITE_NC(DEBUG_XSTEP_DUP_PIN,INVERT_X_STEP_PIN); + STEP_NC_LO(X_DUP_AXIS); #endif //DEBUG_XSTEP_DUP_PIN } // Step in Y axis counter_y.wide += current_block->steps_y.wide; if (counter_y.wide > 0) { - WRITE_NC(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + STEP_NC_HI(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN - WRITE_NC(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN); + STEP_NC_HI(Y_DUP_AXIS); #endif //DEBUG_YSTEP_DUP_PIN counter_y.wide -= current_block->step_event_count.wide; count_position[Y_AXIS]+=count_direction[Y_AXIS]; - WRITE_NC(Y_STEP_PIN, INVERT_Y_STEP_PIN); + STEP_NC_LO(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN - WRITE_NC(DEBUG_YSTEP_DUP_PIN,INVERT_Y_STEP_PIN); + STEP_NC_LO(Y_DUP_AXIS); #endif //DEBUG_YSTEP_DUP_PIN } // Step in Z axis counter_z.wide += current_block->steps_z.wide; if (counter_z.wide > 0) { - WRITE_NC(Z_STEP_PIN, !INVERT_Z_STEP_PIN); + STEP_NC_HI(Z_AXIS); counter_z.wide -= current_block->step_event_count.wide; count_position[Z_AXIS]+=count_direction[Z_AXIS]; - WRITE_NC(Z_STEP_PIN, INVERT_Z_STEP_PIN); + STEP_NC_LO(Z_AXIS); } // Step in E axis counter_e.wide += current_block->steps_e.wide; if (counter_e.wide > 0) { #ifndef LIN_ADVANCE - WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); + STEP_NC_HI(E_AXIS); #endif /* LIN_ADVANCE */ counter_e.wide -= current_block->step_event_count.wide; count_position[E_AXIS]+=count_direction[E_AXIS]; @@ -712,7 +768,7 @@ FORCE_INLINE void stepper_tick_highres() #ifdef FILAMENT_SENSOR fsensor_counter += count_direction[E_AXIS]; #endif //FILAMENT_SENSOR - WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); + STEP_NC_LO(E_AXIS); #endif } if(++ step_events_completed.wide >= current_block->step_event_count.wide) @@ -1014,9 +1070,9 @@ FORCE_INLINE void advance_isr_scheduler() { bool rev = (e_steps < 0); do { - WRITE_NC(E0_STEP_PIN, !INVERT_E_STEP_PIN); + STEP_NC_HI(E_AXIS); e_steps += (rev? 1: -1); - WRITE_NC(E0_STEP_PIN, INVERT_E_STEP_PIN); + STEP_NC_LO(E_AXIS); #if defined(FILAMENT_SENSOR) && defined(PAT9125) fsensor_counter += (rev? -1: 1); #endif @@ -1389,89 +1445,106 @@ void quickStop() #ifdef BABYSTEPPING void babystep(const uint8_t axis,const bool direction) { - //MUST ONLY BE CALLED BY A ISR, it depends on that no other ISR interrupts this - //store initial pin states - switch(axis) - { - case X_AXIS: - { - enable_x(); - uint8_t old_x_dir_pin= READ(X_DIR_PIN); //if dualzstepper, both point to same direction. - - //setup new step - WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction); - - //perform step - WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); + // MUST ONLY BE CALLED BY A ISR as stepper pins are manipulated directly. + // note: when switching direction no delay is inserted at the end when the + // original is restored. We assume enough time passes as the function + // returns and the stepper is manipulated again (to avoid dead times) + switch(axis) + { + case X_AXIS: + { + enable_x(); + uint8_t old_x_dir_pin = READ(X_DIR_PIN); //if dualzstepper, both point to same direction. + uint8_t new_x_dir_pin = (INVERT_X_DIR)^direction; + + //setup new step + if (new_x_dir_pin != old_x_dir_pin) { + WRITE_NC(X_DIR_PIN, new_x_dir_pin); + delayMicroseconds(STEPPER_SET_DIR_DELAY); + } + + //perform step + STEP_NC_HI(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN - WRITE(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN); -#endif //DEBUG_XSTEP_DUP_PIN - delayMicroseconds(1); - WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); + STEP_NC_HI(X_DUP_AXIS); +#endif + STEPPER_MINIMUM_DELAY; + STEP_NC_LO(X_AXIS); #ifdef DEBUG_XSTEP_DUP_PIN - WRITE(DEBUG_XSTEP_DUP_PIN,INVERT_X_STEP_PIN); -#endif //DEBUG_XSTEP_DUP_PIN + STEP_NC_LO(X_DUP_AXIS); +#endif - //get old pin state back. - WRITE(X_DIR_PIN,old_x_dir_pin); - } - break; - case Y_AXIS: - { - enable_y(); - uint8_t old_y_dir_pin= READ(Y_DIR_PIN); //if dualzstepper, both point to same direction. - - //setup new step - WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction); - - //perform step - WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + //get old pin state back. + WRITE_NC(X_DIR_PIN, old_x_dir_pin); + } + break; + + case Y_AXIS: + { + enable_y(); + uint8_t old_y_dir_pin = READ(Y_DIR_PIN); //if dualzstepper, both point to same direction. + uint8_t new_y_dir_pin = (INVERT_Y_DIR)^direction; + + //setup new step + if (new_y_dir_pin != old_y_dir_pin) { + WRITE_NC(Y_DIR_PIN, new_y_dir_pin); + delayMicroseconds(STEPPER_SET_DIR_DELAY); + } + + //perform step + STEP_NC_HI(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN - WRITE(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN); -#endif //DEBUG_YSTEP_DUP_PIN - delayMicroseconds(1); - WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + STEP_NC_HI(Y_DUP_AXIS); +#endif + STEPPER_MINIMUM_DELAY; + STEP_NC_LO(Y_AXIS); #ifdef DEBUG_YSTEP_DUP_PIN - WRITE(DEBUG_YSTEP_DUP_PIN,INVERT_Y_STEP_PIN); -#endif //DEBUG_YSTEP_DUP_PIN + STEP_NC_LO(Y_DUP_AXIS); +#endif - //get old pin state back. - WRITE(Y_DIR_PIN,old_y_dir_pin); + //get old pin state back. + WRITE_NC(Y_DIR_PIN, old_y_dir_pin); + } + break; - } - break; - - case Z_AXIS: - { - enable_z(); - uint8_t old_z_dir_pin= READ(Z_DIR_PIN); //if dualzstepper, both point to same direction. - //setup new step - WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z); - #ifdef Z_DUAL_STEPPER_DRIVERS - WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z); - #endif - //perform step - WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); - #ifdef Z_DUAL_STEPPER_DRIVERS - WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN); - #endif - delayMicroseconds(1); - WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); - #ifdef Z_DUAL_STEPPER_DRIVERS - WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN); - #endif + case Z_AXIS: + { + enable_z(); + uint8_t old_z_dir_pin = READ(Z_DIR_PIN); //if dualzstepper, both point to same direction. + uint8_t new_z_dir_pin = (INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z; - //get old pin state back. - WRITE(Z_DIR_PIN,old_z_dir_pin); - #ifdef Z_DUAL_STEPPER_DRIVERS - WRITE(Z2_DIR_PIN,old_z_dir_pin); - #endif + //setup new step + if (new_z_dir_pin != old_z_dir_pin) { + WRITE_NC(Z_DIR_PIN, new_z_dir_pin); +#ifdef Z_DUAL_STEPPER_DRIVERS + WRITE_NC(Z2_DIR_PIN, new_z_dir_pin); +#endif + delayMicroseconds(STEPPER_SET_DIR_DELAY); + } - } - break; - - default: break; - } + //perform step + STEP_NC_HI(Z_AXIS); +#ifdef Z_DUAL_STEPPER_DRIVERS + STEP_NC_HI(Z2_AXIS); +#endif + STEPPER_MINIMUM_DELAY; + STEP_NC_LO(Z_AXIS); +#ifdef Z_DUAL_STEPPER_DRIVERS + STEP_NC_LO(Z2_AXIS); +#endif + + //get old pin state back. + if (new_z_dir_pin != old_z_dir_pin) { + WRITE_NC(Z_DIR_PIN, old_z_dir_pin); +#ifdef Z_DUAL_STEPPER_DRIVERS + WRITE_NC(Z2_DIR_PIN, old_z_dir_pin); +#endif + } + } + break; + + default: break; + } } #endif //BABYSTEPPING diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 223233a92..3f6826908 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -428,6 +428,11 @@ void tmc2130_check_overtemp() void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_t current_r) { uint8_t intpol = (mres != 0); // intpol to 256 only if microsteps aren't 256 +#ifdef TMC2130_DEDGE_STEPPING + uint8_t dedge = 1; +#else + uint8_t dedge = 0; +#endif uint8_t toff = tmc2130_chopper_config[axis].toff; // toff = 3 (fchop = 27.778kHz) uint8_t hstrt = tmc2130_chopper_config[axis].hstr; //initial 4, modified to 5 uint8_t hend = tmc2130_chopper_config[axis].hend; //original value = 1 @@ -437,6 +442,9 @@ void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_ uint8_t tbl = tmc2130_chopper_config[axis].tbl; //blanking time, original value = 2 if (axis == E_AXIS) { +#if defined(TMC2130_INTPOL_E) && (TMC2130_INTPOL_E == 0) + intpol = 0; +#endif #ifdef TMC2130_CNSTOFF_E // fd = 0 (slow decay only) hstrt = 0; //fd0..2 @@ -447,16 +455,26 @@ void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_ // toff = TMC2130_TOFF_E; // toff = 3-5 // rndtf = 1; } +#if defined(TMC2130_INTPOL_XY) && (TMC2130_INTPOL_XY == 0) + else if (axis == X_AXIS || axis == Y_AXIS) { + intpol = 0; + } +#endif +#if defined(TMC2130_INTPOL_Z) && (TMC2130_INTPOL_Z == 0) + else if (axis == Z_AXIS) { + intpol = 0; + } +#endif // DBG(_n("tmc2130_setup_chopper(axis=%hhd, mres=%hhd, curh=%hhd, curr=%hhd\n"), axis, mres, current_h, current_r); // DBG(_n(" toff=%hhd, hstr=%hhd, hend=%hhd, tbl=%hhd\n"), toff, hstrt, hend, tbl); if (current_r <= 31) { - tmc2130_wr_CHOPCONF(axis, toff, hstrt, hend, fd3, 0, rndtf, chm, tbl, 1, 0, 0, 0, mres, intpol, 0, 0); + tmc2130_wr_CHOPCONF(axis, toff, hstrt, hend, fd3, 0, rndtf, chm, tbl, 1, 0, 0, 0, mres, intpol, dedge, 0); tmc2130_wr(axis, TMC2130_REG_IHOLD_IRUN, 0x000f0000 | ((current_r & 0x1f) << 8) | (current_h & 0x1f)); } else { - tmc2130_wr_CHOPCONF(axis, toff, hstrt, hend, fd3, 0, rndtf, chm, tbl, 0, 0, 0, 0, mres, intpol, 0, 0); + tmc2130_wr_CHOPCONF(axis, toff, hstrt, hend, fd3, 0, rndtf, chm, tbl, 0, 0, 0, 0, mres, intpol, dedge, 0); tmc2130_wr(axis, TMC2130_REG_IHOLD_IRUN, 0x000f0000 | (((current_r >> 1) & 0x1f) << 8) | ((current_h >> 1) & 0x1f)); } } @@ -678,25 +696,32 @@ static uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval) #define _GET_PWR_Z (READ(Z_ENABLE_PIN) == Z_ENABLE_ON) #define _GET_PWR_E (READ(E0_ENABLE_PIN) == E_ENABLE_ON) -#define _SET_PWR_X(ena) { WRITE(X_ENABLE_PIN, ena?X_ENABLE_ON:!X_ENABLE_ON); asm("nop"); } -#define _SET_PWR_Y(ena) { WRITE(Y_ENABLE_PIN, ena?Y_ENABLE_ON:!Y_ENABLE_ON); asm("nop"); } -#define _SET_PWR_Z(ena) { WRITE(Z_ENABLE_PIN, ena?Z_ENABLE_ON:!Z_ENABLE_ON); asm("nop"); } -#define _SET_PWR_E(ena) { WRITE(E0_ENABLE_PIN, ena?E_ENABLE_ON:!E_ENABLE_ON); asm("nop"); } +#define _SET_PWR_X(ena) WRITE(X_ENABLE_PIN, ena?X_ENABLE_ON:!X_ENABLE_ON) +#define _SET_PWR_Y(ena) WRITE(Y_ENABLE_PIN, ena?Y_ENABLE_ON:!Y_ENABLE_ON) +#define _SET_PWR_Z(ena) WRITE(Z_ENABLE_PIN, ena?Z_ENABLE_ON:!Z_ENABLE_ON) +#define _SET_PWR_E(ena) WRITE(E0_ENABLE_PIN, ena?E_ENABLE_ON:!E_ENABLE_ON) #define _GET_DIR_X (READ(X_DIR_PIN) == INVERT_X_DIR) #define _GET_DIR_Y (READ(Y_DIR_PIN) == INVERT_Y_DIR) #define _GET_DIR_Z (READ(Z_DIR_PIN) == INVERT_Z_DIR) #define _GET_DIR_E (READ(E0_DIR_PIN) == INVERT_E0_DIR) -#define _SET_DIR_X(dir) { WRITE(X_DIR_PIN, dir?INVERT_X_DIR:!INVERT_X_DIR); asm("nop"); } -#define _SET_DIR_Y(dir) { WRITE(Y_DIR_PIN, dir?INVERT_Y_DIR:!INVERT_Y_DIR); asm("nop"); } -#define _SET_DIR_Z(dir) { WRITE(Z_DIR_PIN, dir?INVERT_Z_DIR:!INVERT_Z_DIR); asm("nop"); } -#define _SET_DIR_E(dir) { WRITE(E0_DIR_PIN, dir?INVERT_E0_DIR:!INVERT_E0_DIR); asm("nop"); } +#define _SET_DIR_X(dir) WRITE(X_DIR_PIN, dir?INVERT_X_DIR:!INVERT_X_DIR) +#define _SET_DIR_Y(dir) WRITE(Y_DIR_PIN, dir?INVERT_Y_DIR:!INVERT_Y_DIR) +#define _SET_DIR_Z(dir) WRITE(Z_DIR_PIN, dir?INVERT_Z_DIR:!INVERT_Z_DIR) +#define _SET_DIR_E(dir) WRITE(E0_DIR_PIN, dir?INVERT_E0_DIR:!INVERT_E0_DIR) -#define _DO_STEP_X { WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); asm("nop"); WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); asm("nop"); } -#define _DO_STEP_Y { WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); asm("nop"); WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); asm("nop"); } -#define _DO_STEP_Z { WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); asm("nop"); WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); asm("nop"); } -#define _DO_STEP_E { WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); asm("nop"); WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); asm("nop"); } +#ifdef TMC2130_DEDGE_STEPPING +#define _DO_STEP_X TOGGLE(X_STEP_PIN) +#define _DO_STEP_Y TOGGLE(Y_STEP_PIN) +#define _DO_STEP_Z TOGGLE(Z_STEP_PIN) +#define _DO_STEP_E TOGGLE(E0_STEP_PIN) +#else +#define _DO_STEP_X { WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); } +#define _DO_STEP_Y { WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); } +#define _DO_STEP_Z { WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); } +#define _DO_STEP_E { WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); TMC2130_MINIMUM_DELAY; WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); } +#endif uint16_t tmc2130_get_res(uint8_t axis) @@ -737,6 +762,7 @@ void tmc2130_set_pwr(uint8_t axis, uint8_t pwr) case Z_AXIS: _SET_PWR_Z(pwr); break; case E_AXIS: _SET_PWR_E(pwr); break; } + delayMicroseconds(TMC2130_SET_PWR_DELAY); } uint8_t tmc2130_get_inv(uint8_t axis) @@ -773,6 +799,7 @@ void tmc2130_set_dir(uint8_t axis, uint8_t dir) case Z_AXIS: _SET_DIR_Z(dir); break; case E_AXIS: _SET_DIR_E(dir); break; } + delayMicroseconds(TMC2130_SET_DIR_DELAY); } void tmc2130_do_step(uint8_t axis) @@ -788,8 +815,8 @@ void tmc2130_do_step(uint8_t axis) void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_us) { - tmc2130_set_dir(axis, dir); - delayMicroseconds(100); + if (tmc2130_get_dir(axis) != dir) + tmc2130_set_dir(axis, dir); while (steps--) { tmc2130_do_step(axis); @@ -820,7 +847,6 @@ void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_u cnt = steps; } tmc2130_set_dir(axis, dir); - delayMicroseconds(100); mscnt = tmc2130_rd_MSCNT(axis); while ((cnt--) && ((mscnt >> shift) != step)) { diff --git a/Firmware/tmc2130.h b/Firmware/tmc2130.h index ed4c0d7c0..485bf41cc 100644 --- a/Firmware/tmc2130.h +++ b/Firmware/tmc2130.h @@ -29,6 +29,18 @@ extern uint8_t tmc2130_sg_homing_axes_mask; #define TMC2130_WAVE_FAC1000_MAX 200 #define TMC2130_WAVE_FAC1000_STP 1 +#define TMC2130_MINIMUM_PULSE 0 // minimum pulse width in uS +#define TMC2130_SET_DIR_DELAY 20 // minimum delay after setting direction in uS +#define TMC2130_SET_PWR_DELAY 0 // minimum delay after changing pwr mode in uS + +#ifdef TMC2130_DEDGE_STEPPING +#define TMC2130_MINIMUM_DELAY //NOP +#elif TMC2130_MINIMUM_PULSE == 0 +#define TMC2130_MINIMUM_DELAY asm("nop") +#else +#define TMC2130_MINIMUM_DELAY delayMicroseconds(TMC2130_MINIMUM_PULSE) +#endif + extern uint8_t tmc2130_home_enabled; extern uint8_t tmc2130_home_origin[2]; extern uint8_t tmc2130_home_bsteps[2]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 020d91934..fcbb86871 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2489,6 +2489,12 @@ static void mFilamentItem_FLEX() mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP, FLEX_PREHEAT_HPB_TEMP); } +static void mFilamentItem_PVB() +{ + bFilamentPreheatState = false; + mFilamentItem(PVB_PREHEAT_HOTEND_TEMP, PVB_PREHEAT_HPB_TEMP); +} + void mFilamentBack() { menu_back(); @@ -2525,6 +2531,7 @@ void lcd_generic_preheat_menu() MENU_ITEM_SUBMENU_P(PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PET_PREHEAT_HPB_TEMP)),mFilamentItem_PET); MENU_ITEM_SUBMENU_P(PSTR("ASA - " STRINGIFY(ASA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ASA_PREHEAT_HPB_TEMP)),mFilamentItem_ASA); MENU_ITEM_SUBMENU_P(PSTR("PC - " STRINGIFY(PC_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PC_PREHEAT_HPB_TEMP)),mFilamentItem_PC); + MENU_ITEM_SUBMENU_P(PSTR("PVB - " STRINGIFY(PVB_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PVB_PREHEAT_HPB_TEMP)),mFilamentItem_PVB); MENU_ITEM_SUBMENU_P(PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ABS_PREHEAT_HPB_TEMP)),mFilamentItem_ABS); MENU_ITEM_SUBMENU_P(PSTR("HIPS - " STRINGIFY(HIPS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(HIPS_PREHEAT_HPB_TEMP)),mFilamentItem_HIPS); MENU_ITEM_SUBMENU_P(PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PP_PREHEAT_HPB_TEMP)),mFilamentItem_PP); @@ -5388,30 +5395,31 @@ do\ }\ while (0) -static void lcd_nozzle_diameter_set(void) -{ -uint16_t nDiameter; - -switch(oNozzleDiameter) - { - case ClNozzleDiameter::_Diameter_250: - oNozzleDiameter=ClNozzleDiameter::_Diameter_400; - nDiameter=400; - break; - case ClNozzleDiameter::_Diameter_400: - oNozzleDiameter=ClNozzleDiameter::_Diameter_600; - nDiameter=600; - break; - case ClNozzleDiameter::_Diameter_600: - oNozzleDiameter=ClNozzleDiameter::_Diameter_250; - nDiameter=250; - break; - default: - oNozzleDiameter=ClNozzleDiameter::_Diameter_400; - nDiameter=400; - } -eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter); -eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); +static void lcd_nozzle_diameter_cycle(void) { + uint16_t nDiameter; + switch(oNozzleDiameter){ + case ClNozzleDiameter::_Diameter_250: + oNozzleDiameter=ClNozzleDiameter::_Diameter_400; + nDiameter=400; + break; + case ClNozzleDiameter::_Diameter_400: + oNozzleDiameter=ClNozzleDiameter::_Diameter_600; + nDiameter=600; + break; + case ClNozzleDiameter::_Diameter_600: + oNozzleDiameter=ClNozzleDiameter::_Diameter_800; + nDiameter=800; + break; + case ClNozzleDiameter::_Diameter_800: + oNozzleDiameter=ClNozzleDiameter::_Diameter_250; + nDiameter=250; + break; + default: + oNozzleDiameter=ClNozzleDiameter::_Diameter_400; + nDiameter=400; + } + eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter); + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter); } #define SETTINGS_NOZZLE \ @@ -5423,9 +5431,10 @@ do\ case ClNozzleDiameter::_Diameter_250: fNozzleDiam = 0.25f; break;\ case ClNozzleDiameter::_Diameter_400: fNozzleDiam = 0.4f; break;\ case ClNozzleDiameter::_Diameter_600: fNozzleDiam = 0.6f; break;\ + case ClNozzleDiameter::_Diameter_800: fNozzleDiam = 0.8f; break;\ default: fNozzleDiam = 0.4f; break;\ }\ - MENU_ITEM_TOGGLE(_T(MSG_NOZZLE_DIAMETER), ftostr12ns(fNozzleDiam), lcd_nozzle_diameter_set);\ + MENU_ITEM_TOGGLE(_T(MSG_NOZZLE_DIAMETER), ftostr12ns(fNozzleDiam), lcd_nozzle_diameter_cycle);\ }\ while (0) @@ -6601,11 +6610,11 @@ static void lcd_main_menu() if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { - if (farm_mode) - MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 } + if (farm_mode) + MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) { diff --git a/Firmware/util.h b/Firmware/util.h index 8f23cd5c3..f25749de0 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -51,6 +51,7 @@ enum class ClNozzleDiameter:uint_least8_t _Diameter_250=25, _Diameter_400=40, _Diameter_600=60, + _Diameter_800=80, _Diameter_Undef=EEPROM_EMPTY_VALUE }; diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 887a90a6f..a74b69482 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -326,6 +326,10 @@ PREHEAT SETTINGS #define PLA_PREHEAT_HPB_TEMP 55 #define PLA_PREHEAT_FAN_SPEED 0 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 +#define PVB_PREHEAT_FAN_SPEED 0 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 #define ASA_PREHEAT_FAN_SPEED 0 diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index c9c4ed6cd..72ac605fd 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -323,6 +323,9 @@ PREHEAT SETTINGS #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 55 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 1e77dce81..ba40e0468 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -384,6 +384,9 @@ #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 60 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 2d4d73c24..33bb47170 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -385,6 +385,9 @@ #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 60 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index 4670d2188..19b2c76fd 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -384,6 +384,9 @@ #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 60 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 22af43416..cc02867dd 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -385,6 +385,9 @@ #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 60 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 9fa2d2f82..65f7ae997 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -268,6 +268,7 @@ #define TMC2130_CURRENTS_R_HOME {8, 10, 20, 18} // homing running currents for all axes #define TMC2130_STEALTH_Z +#define TMC2130_DEDGE_STEPPING //#define TMC2130_SERVICE_CODES_M910_M918 @@ -497,6 +498,9 @@ #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 60 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 5cbe392f7..c7ab7508e 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -270,6 +270,7 @@ #define TMC2130_CURRENTS_R_HOME {8, 10, 20, 18} // homing running currents for all axes #define TMC2130_STEALTH_Z +#define TMC2130_DEDGE_STEPPING //#define TMC2130_SERVICE_CODES_M910_M918 @@ -501,6 +502,9 @@ #define PLA_PREHEAT_HOTEND_TEMP 215 #define PLA_PREHEAT_HPB_TEMP 60 +#define PVB_PREHEAT_HOTEND_TEMP 215 +#define PVB_PREHEAT_HPB_TEMP 75 + #define ASA_PREHEAT_HOTEND_TEMP 260 #define ASA_PREHEAT_HPB_TEMP 105 diff --git a/PF-build.sh b/PF-build.sh index b75395782..5b0979e2a 100755 --- a/PF-build.sh +++ b/PF-build.sh @@ -56,7 +56,7 @@ # Some may argue that this is only used by a script, BUT as soon someone accidentally or on purpose starts Arduino IDE # it will use the default Arduino IDE folders and so can corrupt the build environment. # -# Version: 1.0.6-Build_33 +# Version: 1.0.6-Build_36 # Change log: # 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt' # 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is unknown @@ -135,6 +135,7 @@ # Update exit numbers 1-13 for prepare build env 21-29 for prepare compiling 30-36 compiling # 08 Jan 2021, 3d-gussner, Comment out 'sudo' auto installation # Add '-?' '-h' help option +# 27 Jan 2021, 3d-gussner, Add `-c`, `-p` and `-n` options #### Start check if OSTYPE is supported OS_FOUND=$( command -v uname) @@ -451,7 +452,7 @@ if type git > /dev/null; then git_available="1" fi -while getopts v:l:d:b:o:?h flag +while getopts v:l:d:b:o:c:p:n:?h flag do case "${flag}" in v) variant_flag=${OPTARG};; @@ -459,6 +460,9 @@ while getopts v:l:d:b:o:?h flag d) devel_flag=${OPTARG};; b) build_flag=${OPTARG};; o) output_flag=${OPTARG};; + c) clean_flag=${OPTARG};; + p) prusa_flag=${OPTARG};; + n) new_build_flag=${OPTARG};; ?) help_flag=1;; h) help_flag=1;; esac @@ -469,6 +473,9 @@ while getopts v:l:d:b:o:?h flag #echo "build_flag: $build_flag"; #echo "output_flag: $output_flag"; #echo "help_flag: $help_flag" +#echo "clean_flag: $clean_flag" +#echo "prusa_flag: $prusa_flag" +#echo "new_build_flag: $new_build_flag" # # '?' 'h' argument usage and help @@ -482,19 +489,23 @@ echo "$(tput setaf 2)-l$(tput sgr0) Languages '$(tput setaf 2)ALL$(tput sgr0)' f echo "$(tput setaf 2)-d$(tput sgr0) Devel build '$(tput setaf 2)GOLD$(tput sgr0)', '$(tput setaf 2)RC$(tput sgr0)', '$(tput setaf 2)BETA$(tput sgr0)', '$(tput setaf 2)ALPHA$(tput sgr0)', '$(tput setaf 2)DEBUG$(tput sgr0)', '$(tput setaf 2)DEVEL$(tput sgr0)' and '$(tput setaf 2)UNKNOWN$(tput sgr0)'" echo "$(tput setaf 2)-b$(tput sgr0) Build/commit number '$(tput setaf 2)Auto$(tput sgr0)' needs git or a number" echo "$(tput setaf 2)-o$(tput sgr0) Output '$(tput setaf 2)1$(tput sgr0)' force or '$(tput setaf 2)0$(tput sgr0)' block output and delays" +echo "$(tput setaf 2)-c$(tput sgr0) Do not clean up lang build'$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes" +echo "$(tput setaf 2)-p$(tput sgr0) Keep Configuration_prusa.h '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes" +echo "$(tput setaf 2)-n$(tput sgr0) New fresh build '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' yes" echo "$(tput setaf 2)-?$(tput sgr0) Help" echo "$(tput setaf 2)-h$(tput sgr0) Help" echo echo "Brief USAGE:" -echo " $(tput setaf 2)./PF-build.sh$(tput sgr0) [-v] [-l] [-d] [-b] [-o]" +echo " $(tput setaf 2)./PF-build.sh$(tput sgr0) [-v] [-l] [-d] [-b] [-o] [-c] [-p] [-n]" echo echo "Example:" echo " $(tput setaf 2)./PF-build.sh -v All -l ALL -d GOLD$(tput sgr0)" echo " Will build all variants as multi language and final GOLD version" echo -echo " $(tput setaf 2) ./PF-build.sh -v 1_75mm_MK3S-EINSy10a-E3Dv6full.h -b Auto -l ALL -d GOLD -o 1$(tput sgr0)" +echo " $(tput setaf 2) ./PF-build.sh -v 1_75mm_MK3S-EINSy10a-E3Dv6full.h -b Auto -l ALL -d GOLD -o 1 -c 1 -p 1 -n 1$(tput sgr0)" echo " Will build MK3S multi language final GOLD firmware " -echo " with current commit count number and output extra information" +echo " with current commit count number and output extra information," +echo " not delete lang build temporary files, keep Configuration_prusa.h and build with new fresh build folder." echo exit @@ -807,6 +818,12 @@ do if [ $OUTPUT == "1" ] ; then sleep 2 fi + + #New fresh PF-Firmware-build + if [ "$new_build_flag" == "1" ]; then + rm -r -f $BUILD_PATH/* || exit 36 + fi + #$BUILD_ENV_PATH/arduino-builder -dump-prefs -debug-level 10 -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=$BOARD_PACKAGE_NAME:avr:$BOARD -build-path=$BUILD_PATH -warnings=all $SCRIPT_PATH/Firmware/Firmware.ino || exit 14 $BUILD_ENV_PATH/arduino-builder -compile -hardware $ARDUINO/hardware -hardware $ARDUINO/portable/packages -tools $ARDUINO/tools-builder -tools $ARDUINO/hardware/tools/avr -tools $ARDUINO/portable/packages -built-in-libraries $ARDUINO/libraries -libraries $ARDUINO/portable/sketchbook/libraries -fqbn=$BOARD_PACKAGE_NAME:avr:$BOARD -build-path=$BUILD_PATH -warnings=all $SCRIPT_PATH/Firmware/Firmware.ino || exit 30 echo "$(tput sgr 0)" @@ -874,17 +891,21 @@ do fi fi # Cleanup after build - echo "$(tput setaf 3)" - ./fw-clean.sh || exit 34 - ./lang-clean.sh || exit 35 - echo "$(tput sgr 0)" + if [[ -z "$clean_flag" || "$clean_flag" == "0" ]]; then + echo "$(tput setaf 3)" + ./fw-clean.sh || exit 34 + ./lang-clean.sh || exit 35 + echo "$(tput sgr 0)" + fi else echo "$(tput setaf 2)Copying English only firmware to PF-build-hex folder$(tput sgr 0)" cp -f $BUILD_PATH/Firmware.ino.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/FW$FW-Build$BUILD-$VARIANT-EN_ONLY.hex || exit 34 fi # Cleanup Firmware - rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 36 + if [[ -z "$prusa_flag" || "$prusa_flag" == "0" ]]; then + rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || exit 36 + fi if find $SCRIPT_PATH/lang/ -name '*RAMBo10a*.txt' -printf 1 -quit | grep -q 1 then rm $SCRIPT_PATH/lang/*RAMBo10a*.txt @@ -901,6 +922,12 @@ do then rm $SCRIPT_PATH/lang/not_used.txt fi + + #New fresh PF-Firmware-build + if [ "$new_build_flag" == "1" ]; then + rm -r -f $BUILD_PATH/* || exit 36 + fi + # Restore files to previous state sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h sed -i -- 's/^#define FW_REPOSITORY "Prusa3d"/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h