Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
marciot committed May 5, 2020
2 parents 93732e1 + 852a8d6 commit 5c7effd
Show file tree
Hide file tree
Showing 27 changed files with 274 additions and 217 deletions.
10 changes: 5 additions & 5 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
//#define S6_TFT_PINMAP // FYSETC S6 pin mapping
//#define CHEETAH_TFT_PINMAP // FYSETC Cheetah pin mapping
//#define E3_EXP1_PINMAP // E3 type boards (SKR E3/DIP, FYSETC Cheetah and Stock boards) EXP1 pin mapping
//#define E3_EXP1_PINMAP // E3 type boards (SKR E3/DIP, and Stock boards) EXP1 pin mapping
//#define GENERIC_EXP2_PINMAP // GENERIC EXP2 pin mapping

//#define OTHER_PIN_LAYOUT // Define pins manually below
Expand Down Expand Up @@ -2398,10 +2398,10 @@
#define X2_STALL_SENSITIVITY X_STALL_SENSITIVITY
#define Y_STALL_SENSITIVITY 8
#define Y2_STALL_SENSITIVITY Y_STALL_SENSITIVITY
#define Z_STALL_SENSITIVITY 8
#define Z2_STALL_SENSITIVITY Z_STALL_SENSITIVITY
#define Z3_STALL_SENSITIVITY Z_STALL_SENSITIVITY
#define Z4_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z_STALL_SENSITIVITY 8
//#define Z2_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z3_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z4_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define SPI_ENDSTOPS // TMC2130 only
//#define IMPROVE_HOMING_RELIABILITY
#endif
Expand Down
12 changes: 8 additions & 4 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ millis_t max_inactive_time, // = 0

void setup_killpin() {
#if HAS_KILL
SET_INPUT_PULLUP(KILL_PIN);
#if KILL_PIN_STATE
SET_INPUT_PULLDOWN(KILL_PIN);
#else
SET_INPUT_PULLUP(KILL_PIN);
#endif
#endif
}

Expand Down Expand Up @@ -496,7 +500,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
// -------------------------------------------------------------------------------
static int killCount = 0; // make the inactivity button a bit less responsive
const int KILL_DELAY = 750;
if (!READ(KILL_PIN))
if (kill_state())
killCount++;
else if (killCount > 0)
killCount--;
Expand Down Expand Up @@ -770,10 +774,10 @@ void minkill(const bool steppers_off/*=false*/) {
#if HAS_KILL

// Wait for kill to be released
while (!READ(KILL_PIN)) watchdog_refresh();
while (kill_state()) watchdog_refresh();

// Wait for kill to be pressed
while (READ(KILL_PIN)) watchdog_refresh();
while (!kill_state()) watchdog_refresh();

void (*resetFunc)() = 0; // Declare resetFunc() at address 0
resetFunc(); // Jump to address 0
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/MarlinCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ void protected_pin_err();
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
#endif

#if HAS_KILL
#ifndef KILL_PIN_STATE
#define KILL_PIN_STATE LOW
#endif
inline bool kill_state() { return READ(KILL_PIN) == KILL_PIN_STATE; }
#endif

#if ENABLED(G29_RETRY_AND_RECOVER)
void event_probe_recover();
void event_probe_failure();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@
#define BOARD_GTM32_MINI 4022 // STM32F103VET6 controller
#define BOARD_GTM32_MINI_A30 4023 // STM32F103VET6 controller
#define BOARD_GTM32_REV_B 4024 // STM32F103VET6 controller
#define BOARD_MKS_ROBIN_E3D 4025 // MKS Robin E3D(STM32F103RCT6)
#define BOARD_MKS_ROBIN_E3 4026 // MKS Robin E3(STM32F103RCT6)
#define BOARD_MKS_ROBIN_E3D 4025 // MKS Robin E3D (STM32F103RCT6)
#define BOARD_MKS_ROBIN_E3 4026 // MKS Robin E3 (STM32F103RCT6)
#define BOARD_MALYAN_M300 4027 // STM32F070-based delta

//
Expand Down
12 changes: 12 additions & 0 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ extern uint8_t marlin_debug_flags;
#define _SELP_22(a,b,V...) do{ _SEP_2(a,b); _SELP_20(V); }while(0)
#define _SELP_23(a,b,V...) do{ _SEP_2(a,b); _SELP_21(V); }while(0)
#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0) // Eat two args, pass the rest up
#define _SELP_25(a,b,V...) do{ _SEP_2(a,b); _SELP_23(V); }while(1) // Eat two args, pass the rest up
#define _SELP_26(a,b,V...) do{ _SEP_2(a,b); _SELP_24(V); }while(2) // Eat two args, pass the rest up
#define _SELP_27(a,b,V...) do{ _SEP_2(a,b); _SELP_25(V); }while(3) // Eat two args, pass the rest up
#define _SELP_28(a,b,V...) do{ _SEP_2(a,b); _SELP_26(V); }while(4) // Eat two args, pass the rest up
#define _SELP_29(a,b,V...) do{ _SEP_2(a,b); _SELP_27(V); }while(5) // Eat two args, pass the rest up
#define _SELP_30(a,b,V...) do{ _SEP_2(a,b); _SELP_28(V); }while(6) // Eat two args, pass the rest up

#define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V)

Expand Down Expand Up @@ -215,6 +221,12 @@ extern uint8_t marlin_debug_flags;
#define _SELP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_20_P(V); }while(0)
#define _SELP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_21_P(V); }while(0)
#define _SELP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_22_P(V); }while(0) // Eat two args, pass the rest up
#define _SELP_25_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_23_P(V); }while(1) // Eat two args, pass the rest up
#define _SELP_26_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_24_P(V); }while(2) // Eat two args, pass the rest up
#define _SELP_27_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_25_P(V); }while(3) // Eat two args, pass the rest up
#define _SELP_28_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_26_P(V); }while(4) // Eat two args, pass the rest up
#define _SELP_29_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_27_P(V); }while(5) // Eat two args, pass the rest up
#define _SELP_30_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_28_P(V); }while(6) // Eat two args, pass the rest up

#define SERIAL_ECHOLNPAIR_P(V...) _SELP_N_P(NUM_ARGS(V),V)

Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,8 +1683,9 @@
SERIAL_EOL();

#if HAS_KILL
SERIAL_ECHOLNPAIR("Kill pin on :", int(KILL_PIN), " state:", READ(KILL_PIN));
SERIAL_ECHOLNPAIR("Kill pin on :", int(KILL_PIN), " state:", int(kill_state()));
#endif

SERIAL_EOL();
serial_delay(50);

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void PrintJobRecovery::save(const bool force/*=false*/) {
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; e++) info.filament_size[e] = planner.filament_size[e];
#else
if (parser.volumetric_enabled) info.filament_size = planner.filament_size[active_extruder];
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[active_extruder];
#endif
#endif

Expand Down Expand Up @@ -331,7 +331,7 @@ void PrintJobRecovery::resume() {
}
#else
if (info.volumetric_enabled) {
dtostrf(info.filament_size, 1, 3, str_1);
dtostrf(info.filament_size[0], 1, 3, str_1);
sprintf_P(cmd, PSTR("M200 D%s"), str_1);
gcode.process_subcommands_now(cmd);
}
Expand Down
6 changes: 1 addition & 5 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ typedef struct {

#if DISABLED(NO_VOLUMETRICS)
bool volumetric_enabled;
#if EXTRUDERS > 1
float filament_size[EXTRUDERS];
#else
float filament_size;
#endif
float filament_size[EXTRUDERS];
#endif

#if HAS_HOTEND
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/bedlevel/G26.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ void GcodeSuite::G26() {

if (parser.seenval('H')) {
g26_hotend_temp = parser.value_celsius();
if (!WITHIN(g26_hotend_temp, 165, (HEATER_0_MAXTEMP - HOTEND_OVERSHOOT))) {
if (!WITHIN(g26_hotend_temp, 165, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT))) {
SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible.");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/lcd/M145.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void GcodeSuite::M145() {
int v;
if (parser.seenval('H')) {
v = parser.value_int();
ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT);
ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT));
}
if (parser.seenval('F')) {
v = parser.value_int();
Expand Down
9 changes: 5 additions & 4 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@
#endif
#if ENABLED(ULTIPANEL)
#define IS_ULTRA_LCD
#ifndef NEWPANEL
#define NEWPANEL
#endif
#define NEWPANEL
#endif

#if ENABLED(IS_ULTRA_LCD)
Expand Down Expand Up @@ -410,7 +408,6 @@
#if EXTRUDERS == 0
#undef EXTRUDERS
#define EXTRUDERS 0
#undef DISTINCT_E_FACTORS
#undef SINGLENOZZLE
#undef SWITCHING_EXTRUDER
#undef SWITCHING_NOZZLE
Expand Down Expand Up @@ -515,12 +512,16 @@
* DISTINCT_E_FACTORS affects how some E factors are accessed
*/
#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
#define DISTINCT_E E_STEPPERS
#define XYZE_N (XYZ + E_STEPPERS)
#define E_INDEX_N(E) (E)
#define E_AXIS_N(E) AxisEnum(E_AXIS + E)
#define UNUSED_E(E) NOOP
#else
#undef DISTINCT_E_FACTORS
#define DISTINCT_E 1
#define XYZE_N XYZE
#define E_INDEX_N(E) 0
#define E_AXIS_N(E) E_AXIS
#define UNUSED_E(E) UNUSED(E)
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-05-04"
#define STRING_DISTRIBUTION_DATE "2020-05-05"
#endif

/**
Expand Down
51 changes: 24 additions & 27 deletions Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,13 @@
* without adding new pin definitions to the board.
*/

#ifdef CHEETAH_TFT_PINMAP
#ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin."
#endif

#define CLCD_SPI_BUS 2

#define CLCD_MOD_RESET PC9
#define CLCD_SPI_CS PB12

//#define CLCD_USE_SOFT_SPI
#if ENABLED(CLCD_USE_SOFT_SPI)
#define CLCD_SOFT_SPI_MOSI PB15
#define CLCD_SOFT_SPI_MISO PB14
#define CLCD_SOFT_SPI_SCLK PB13
#endif
#endif

#ifdef S6_TFT_PINMAP
#ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin."
#endif

#define CLCD_SPI_CS PC7
#define CLCD_MOD_RESET PC6
#define CLCD_SPI_CS PC7
#define CLCD_MOD_RESET PC6
#endif

#ifdef CR10_TFT_PINMAP
Expand All @@ -60,13 +42,13 @@
#endif

#define CLCD_USE_SOFT_SPI
#define CLCD_SOFT_SPI_SCLK LCD_PINS_D4 // PORTA1 Pin 6
#define CLCD_SOFT_SPI_MOSI LCD_PINS_ENABLE // PORTC1 Pin 8
#define CLCD_SPI_CS LCD_PINS_RS // PORTA3 Pin 7
#define CLCD_SOFT_SPI_MISO 16 // PORTC0 BTN_ENC Pin 2
#define CLCD_MOD_RESET 11 // PORTD3 BTN_EN1 Pin 3
#define CLCD_AUX_0 10 // PORTD2 BTN_EN2 Pin 5
#define CLCD_AUX_1 BEEPER_PIN // PORTA4 Pin 1
#define CLCD_SOFT_SPI_SCLK LCD_PINS_D4 // PORTA1 Pin 6
#define CLCD_SOFT_SPI_MOSI LCD_PINS_ENABLE // PORTC1 Pin 8
#define CLCD_SPI_CS LCD_PINS_RS // PORTA3 Pin 7
#define CLCD_SOFT_SPI_MISO 16 // PORTC0 BTN_ENC Pin 2
#define CLCD_MOD_RESET 11 // PORTD3 BTN_EN1 Pin 3
#define CLCD_AUX_0 10 // PORTD2 BTN_EN2 Pin 5
#define CLCD_AUX_1 BEEPER_PIN // PORTA4 Pin 1
#endif

/**
Expand Down Expand Up @@ -181,3 +163,18 @@
#define CLCD_MOD_RESET BTN_EN1
#define CLCD_SPI_CS LCD_PINS_RS
#endif

#ifdef CHEETAH_TFT_PINMAP
#ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin."
#endif

#define CLCD_MOD_RESET BTN_EN2
#define CLCD_SPI_CS LCD_PINS_RS

#if ENABLED(CLCD_USE_SOFT_SPI)
#define CLCD_SOFT_SPI_MOSI LCD_PINS_ENABLE
#define CLCD_SOFT_SPI_MISO LCD_PINS_RS
#define CLCD_SOFT_SPI_SCLK LCD_PINS_D4
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ void MaxAccelerationScreen::onRedraw(draw_mode_t what) {
w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_AMAX_X), getAxisMaxAcceleration_mm_s2(X) );
w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_AMAX_Y), getAxisMaxAcceleration_mm_s2(Y) );
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_AMAX_Z), getAxisMaxAcceleration_mm_s2(Z) );
#if EXTRUDERS == 1 || DISABLED(DISTINCT_E_FACTORS)
#if DISTINCT_E == 1
w.color(e_axis).adjuster( 8, GET_TEXT_F(MSG_AMAX_E), getAxisMaxAcceleration_mm_s2(E0) );
#elif EXTRUDERS > 1
#elif DISTINCT_E > 1
w.heading(GET_TEXT_F(MSG_AMAX_E));
w.color(e_axis).adjuster( 8, F(LCD_STR_E0), getAxisMaxAcceleration_mm_s2(E0) );
w.color(e_axis).adjuster(10, F(LCD_STR_E1), getAxisMaxAcceleration_mm_s2(E1) );
#if EXTRUDERS > 2
#if DISTINCT_E > 2
w.color(e_axis).adjuster(12, F(LCD_STR_E2), getAxisMaxAcceleration_mm_s2(E2) );
#endif
#if EXTRUDERS > 3
#if DISTINCT_E > 3
w.color(e_axis).adjuster(14, F(LCD_STR_E3), getAxisMaxAcceleration_mm_s2(E3) );
#endif
#endif
Expand All @@ -65,15 +65,15 @@ bool MaxAccelerationScreen::onTouchHeld(uint8_t tag) {
case 7: UI_INCREMENT(AxisMaxAcceleration_mm_s2, Z ); break;
case 8: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E0); break;
case 9: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E0); break;
#if EXTRUDERS > 1 && ENABLED(DISTINCT_E_FACTORS)
#if DISTINCT_E > 1
case 10: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E1); break;
case 11: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E1); break;
#endif
#if EXTRUDERS > 2 && ENABLED(DISTINCT_E_FACTORS)
#if DISTINCT_E > 2
case 12: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E2); break;
case 13: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E2); break;
#endif
#if EXTRUDERS > 3 && ENABLED(DISTINCT_E_FACTORS)
#if DISTINCT_E > 3
case 14: UI_DECREMENT(AxisMaxAcceleration_mm_s2, E3); break;
case 15: UI_INCREMENT(AxisMaxAcceleration_mm_s2, E3); break;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,19 @@ bool MaxVelocityScreen::onTouchHeld(uint8_t tag) {
case 5: UI_INCREMENT(AxisMaxFeedrate_mm_s, Y); break;
case 6: UI_DECREMENT(AxisMaxFeedrate_mm_s, Z); break;
case 7: UI_INCREMENT(AxisMaxFeedrate_mm_s, Z); break;
#if DISTINCT_E > 0
case 8: UI_DECREMENT(AxisMaxFeedrate_mm_s, E0); break;
case 9: UI_INCREMENT(AxisMaxFeedrate_mm_s, E0); break;
#if EXTRUDERS > 1 && ENABLED(DISTINCT_E_FACTORS)
#endif
#if DISTINCT_E > 1
case 10: UI_DECREMENT(AxisMaxFeedrate_mm_s, E1); break;
case 11: UI_INCREMENT(AxisMaxFeedrate_mm_s, E1); break;
#endif
#if EXTRUDERS > 2 && ENABLED(DISTINCT_E_FACTORS)
#if DISTINCT_E > 2
case 12: UI_DECREMENT(AxisMaxFeedrate_mm_s, E2); break;
case 13: UI_INCREMENT(AxisMaxFeedrate_mm_s, E2); break;
#endif
#if EXTRUDERS > 3 && ENABLED(DISTINCT_E_FACTORS)
#if DISTINCT_E > 3
case 14: UI_DECREMENT(AxisMaxFeedrate_mm_s, E3); break;
case 15: UI_INCREMENT(AxisMaxFeedrate_mm_s, E3); break;
#endif
Expand Down
19 changes: 10 additions & 9 deletions Marlin/src/lcd/extui_malyan_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,19 @@ void process_lcd_eb_command(const char* command) {
* {J:E}{J:X+200}{J:E}
* X, Y, Z, A (extruder)
*/
void process_lcd_j_command(const char* command) {
auto move_axis = [command](const auto axis) {
const float dist = atof(command + 1) / 10.0;
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(axis) + dist, axis);
};
template<typename T>
void j_move_axis(const char* command, const T axis) {
const float dist = atof(command + 1) / 10.0;
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(axis) + dist, axis);
};

void process_lcd_j_command(const char* command) {
switch (command[0]) {
case 'E': break;
case 'A': move_axis(ExtUI::extruder_t::E0); break;
case 'Y': move_axis(ExtUI::axis_t::Y); break;
case 'Z': move_axis(ExtUI::axis_t::Z); break;
case 'X': move_axis(ExtUI::axis_t::X); break;
case 'A': j_move_axis<ExtUI::extruder_t>(command, ExtUI::extruder_t::E0); break;
case 'Y': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::Y); break;
case 'Z': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::Z); break;
case 'X': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::X); break;
default: DEBUG_ECHOLNPAIR("UNKNOWN J COMMAND ", command);
}
}
Expand Down
Loading

0 comments on commit 5c7effd

Please sign in to comment.