Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin
Browse files Browse the repository at this point in the history
… into bugfix-2.0.x
  • Loading branch information
crysxd committed Jul 3, 2020
2 parents 1f2890c + 90380d5 commit bdd2fc6
Show file tree
Hide file tree
Showing 27 changed files with 411 additions and 263 deletions.
5 changes: 5 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,11 @@
//
//#define OVERLORD_OLED

//
// FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER with WS2812 RGB
// Where to find : https://www.aliexpress.com/item/4000345255731.html
//#define FYSETC_242_OLED_12864 // Uses the SSD1309 controller

//=============================================================================
//========================== Extensible UI Displays ===========================
//=============================================================================
Expand Down
5 changes: 3 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1471,8 +1471,9 @@
//#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
#define BABYSTEP_MULTIPLICATOR_Z 1 // Babysteps are very small. Increase for faster motion.
#define BABYSTEP_MULTIPLICATOR_XY 1
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
#define BABYSTEP_MULTIPLICATOR_Z 1 // (steps or mm) Steps or millimeter distance for each Z babystep
#define BABYSTEP_MULTIPLICATOR_XY 1 // (steps or mm) Steps or millimeter distance for each XY babystep

#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
Expand Down
25 changes: 15 additions & 10 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,34 +466,39 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
const millis_t ms = millis();

// Prevent steppers timing-out in the middle of M600
#define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
// unless PAUSE_PARK_NO_STEPPER_TIMEOUT is disabled
const bool parked_or_ignoring = ignore_stepper_queue ||
(BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print);

if (STAY_TEST || ignore_stepper_queue)
gcode.reset_stepper_timeout(ms);
// Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
if (parked_or_ignoring) gcode.reset_stepper_timeout(ms);

if (gcode.stepper_max_timed_out(ms)) {
SERIAL_ERROR_START();
SERIAL_ECHOLNPAIR(STR_KILL_INACTIVE_TIME, parser.command_ptr);
kill();
}

// M18 / M94 : Handle steppers inactive time timeout
if (gcode.stepper_inactive_time) {

static bool already_shutdown_steppers; // = false

// Any moves in the planner? Resets both the M18/M84
// activity timeout and the M85 max 'kill' timeout
if (planner.has_blocks_queued())
gcode.reset_stepper_timeout(ms);
else if (!STAY_TEST && !ignore_stepper_queue && gcode.stepper_inactive_timeout()) {
else if (!parked_or_ignoring && gcode.stepper_inactive_timeout()) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this

// Individual axes will be disabled if configured
if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
#if BOTH(HAS_LCD_MENU, AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
ui.defer_status_screen(false);
}
#endif

TERN_(AUTO_BED_LEVELING_UBL, ubl.steppers_were_disabled());
}
}
else
Expand Down
6 changes: 1 addition & 5 deletions Marlin/src/feature/bedlevel/ubl/ubl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@
_GRIDPOS(Y, 12), _GRIDPOS(Y, 13), _GRIDPOS(Y, 14), _GRIDPOS(Y, 15)
);

#if HAS_LCD_MENU
bool unified_bed_leveling::lcd_map_control = false;
#endif

volatile int unified_bed_leveling::encoder_diff;
volatile int16_t unified_bed_leveling::encoder_diff;

unified_bed_leveling::unified_bed_leveling() {
reset();
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ class unified_bed_leveling {

#if HAS_LCD_MENU
static bool lcd_map_control;
static void steppers_were_disabled();
#else
static inline void steppers_were_disabled() {}
#endif

static volatile int encoder_diff; // Volatile because it's changed at interrupt time.
static volatile int16_t encoder_diff; // Volatile because buttons may changed it at interrupt time

unified_bed_leveling();

Expand Down
25 changes: 18 additions & 7 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@
#define UBL_G29_P31

#if HAS_LCD_MENU
void _lcd_ubl_output_map_lcd();

bool unified_bed_leveling::lcd_map_control = false;

void unified_bed_leveling::steppers_were_disabled() {
if (lcd_map_control) {
lcd_map_control = false;
ui.defer_status_screen(false);
}
}

void ubl_map_screen();

#endif

#define SIZE_OF_LITTLE_RAISE 1
Expand Down Expand Up @@ -789,11 +800,11 @@

bool click_and_hold(const clickFunc_t func=nullptr) {
if (ui.button_pressed()) {
ui.quick_feedback(false); // Preserve button state for click-and-hold
ui.quick_feedback(false); // Preserve button state for click-and-hold
const millis_t nxt = millis() + 1500UL;
while (ui.button_pressed()) { // Loop while the encoder is pressed. Uses hardware flag!
idle(); // idle, of course
if (ELAPSED(millis(), nxt)) { // After 1.5 seconds
while (ui.button_pressed()) { // Loop while the encoder is pressed. Uses hardware flag!
idle(); // idle, of course
if (ELAPSED(millis(), nxt)) { // After 1.5 seconds
ui.quick_feedback();
if (func) (*func)();
ui.wait_for_release();
Expand Down Expand Up @@ -995,9 +1006,9 @@
lcd_mesh_edit_setup(new_z);

do {
idle();
new_z = lcd_mesh_edit();
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset + new_z)); // Move the nozzle as the point is edited
idle();
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (!ui.button_pressed());

Expand All @@ -1022,7 +1033,7 @@
SERIAL_ECHOLNPGM("Done Editing Mesh");

if (lcd_map_control)
ui.goto_screen(_lcd_ubl_output_map_lcd);
ui.goto_screen(ubl_map_screen);
else
ui.return_to_status();
}
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/feature/touch/xpt2046.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
#endif

XPT2046 touch;
extern int8_t encoderDiff;

void XPT2046::init() {
SET_INPUT(TOUCH_MISO_PIN);
Expand Down
7 changes: 1 addition & 6 deletions Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ void GcodeSuite::M18_M84() {
else
planner.finish_and_disable();

#if BOTH(HAS_LCD_MENU, AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
ui.defer_status_screen(false);
}
#endif
TERN_(AUTO_BED_LEVELING_UBL, ubl.steppers_were_disabled());
}
}
21 changes: 21 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,27 @@
#define IS_RRD_SC
#define IS_U8GLIB_SSD1306

#elif ENABLED(FYSETC_242_OLED_12864)

#define IS_RRD_SC
#define U8GLIB_SH1106

#define LED_CONTROL_MENU
#define NEOPIXEL_LED
#undef NEOPIXEL_TYPE
#define NEOPIXEL_TYPE NEO_RGB
#if NEOPIXEL_PIXELS < 3
#undef NEOPIXELS_PIXELS
#define NEOPIXEL_PIXELS 3
#endif
#ifndef NEOPIXEL_BRIGHTNESS
#define NEOPIXEL_BRIGHTNESS 127
#endif

#if ENABLED(PSU_CONTROL)
#define LED_BACKLIGHT_TIMEOUT 10000
#endif

#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1)

#define FYSETC_MINI_12864
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
#endif
#endif

#if ENABLED(FYSETC_MINI_12864_2_1)
#if ENABLED(FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864)
#define LED_CONTROL_MENU
#define LED_USER_PRESET_STARTUP
#define LED_COLOR_PRESETS
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-07-02"
#define STRING_DISTRIBUTION_DATE "2020-07-03"
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/ultralcd_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void MarlinUI::init_lcd() {
OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away
#endif

#if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306)
#if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864)
SET_OUTPUT(LCD_PINS_DC);
#ifndef LCD_RESET_PIN
#define LCD_RESET_PIN LCD_PINS_RS
Expand Down
12 changes: 12 additions & 0 deletions Marlin/src/lcd/dogm/ultralcd_DOGM.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@
#define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
#endif

#elif ENABLED(FYSETC_242_OLED_12864)

// FYSETC OLED 2.42" 128 × 64 FULL GRAPHICS CONTROLLER

#define FORCE_SOFT_SPI // SW-SPI

#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SSD1306_128X64 // 8 stripes
#endif

#elif ENABLED(U8GLIB_SH1106)

// Generic SH1106 OLED I2C LCD
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co
screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z);
else {
#if ENABLED(MOVE_Z_WHEN_IDLE)
move_menu_scale = MOVE_Z_IDLE_MULTIPLICATOR;
ui.manual_move.menu_scale = MOVE_Z_IDLE_MULTIPLICATOR;
screen = lcd_move_z;
#endif
}
Expand Down Expand Up @@ -343,7 +343,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
ui.defer_status_screen();
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
if (ui.encoderPosition) {
const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR_Z);
const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_SIZE_Z);
ui.encoderPosition = 0;

const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/lcd/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,17 @@ void _lcd_draw_homing();
#else
void lcd_babystep_z();
#endif

#if ENABLED(BABYSTEP_MILLIMETER_UNITS)
#define BABYSTEP_SIZE_X int32_t((BABYSTEP_MULTIPLICATOR_XY) * planner.settings.axis_steps_per_mm[X_AXIS])
#define BABYSTEP_SIZE_Y int32_t((BABYSTEP_MULTIPLICATOR_XY) * planner.settings.axis_steps_per_mm[Y_AXIS])
#define BABYSTEP_SIZE_Z int32_t((BABYSTEP_MULTIPLICATOR_Z) * planner.settings.axis_steps_per_mm[Z_AXIS])
#else
#define BABYSTEP_SIZE_X BABYSTEP_MULTIPLICATOR_XY
#define BABYSTEP_SIZE_Y BABYSTEP_MULTIPLICATOR_XY
#define BABYSTEP_SIZE_Z BABYSTEP_MULTIPLICATOR_Z
#endif

#endif

#if ENABLED(POWER_LOSS_RECOVERY)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_delta_calibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
do_blocking_move_to_xy_z(xy, Z_CLEARANCE_BETWEEN_PROBES);
ui.wait_for_move = false;
ui.synchronize();
move_menu_scale = _MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT));
ui.manual_move.menu_scale = _MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT));
ui.goto_screen(lcd_move_z);
}
}
Expand Down
43 changes: 14 additions & 29 deletions Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,13 @@
float manual_move_e_origin = 0;
#endif

//
// Tell ui.update() to start a move to current_position" after a short delay.
//
inline void manual_move_to_current(AxisEnum axis
#if MULTI_MANUAL
, const int8_t eindex=-1
#endif
) {
#if MULTI_MANUAL
if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
#endif
ui.manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
ui.manual_move_axis = (int8_t)axis;
}

//
// "Motion" > "Move Axis" submenu
//

static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
if (ui.encoderPosition && !ui.processing_manual_move) {
if (ui.encoderPosition && !ui.manual_move.processing) {

// Start with no limits to movement
float min = current_position[axis] - 1000,
Expand Down Expand Up @@ -105,13 +90,13 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
#endif

// Get the new position
const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
const float diff = float(int32_t(ui.encoderPosition)) * ui.manual_move.menu_scale;
#if IS_KINEMATIC
ui.manual_move_offset += diff;
ui.manual_move.offset += diff;
if (int32_t(ui.encoderPosition) < 0)
NOLESS(ui.manual_move_offset, min - current_position[axis]);
NOLESS(ui.manual_move.offset, min - current_position[axis]);
else
NOMORE(ui.manual_move_offset, max - current_position[axis]);
NOMORE(ui.manual_move.offset, max - current_position[axis]);
#else
current_position[axis] += diff;
if (int32_t(ui.encoderPosition) < 0)
Expand All @@ -120,16 +105,16 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
NOMORE(current_position[axis], max);
#endif

manual_move_to_current(axis);
ui.manual_move.soon(axis);
ui.refresh(LCDVIEW_REDRAW_NOW);
}
ui.encoderPosition = 0;
if (ui.should_draw()) {
const float pos = NATIVE_TO_LOGICAL(
ui.processing_manual_move ? destination[axis] : current_position[axis] + TERN0(IS_KINEMATIC, ui.manual_move_offset),
ui.manual_move.processing ? destination[axis] : current_position[axis] + TERN0(IS_KINEMATIC, ui.manual_move.offset),
axis
);
MenuEditItemBase::draw_edit_screen(name, move_menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos));
MenuEditItemBase::draw_edit_screen(name, ui.manual_move.menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos));
}
}
void lcd_move_x() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_X), X_AXIS); }
Expand All @@ -141,10 +126,10 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
static void lcd_move_e(TERN_(MULTI_MANUAL, const int8_t eindex=-1)) {
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
if (ui.encoderPosition) {
if (!ui.processing_manual_move) {
const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
TERN(IS_KINEMATIC, ui.manual_move_offset, current_position.e) += diff;
manual_move_to_current(E_AXIS
if (!ui.manual_move.processing) {
const float diff = float(int32_t(ui.encoderPosition)) * ui.manual_move.menu_scale;
TERN(IS_KINEMATIC, ui.manual_move.offset, current_position.e) += diff;
ui.manual_move.soon(E_AXIS
#if MULTI_MANUAL
, eindex
#endif
Expand All @@ -160,7 +145,7 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
MenuEditItemBase::draw_edit_screen(
GET_TEXT(TERN(MULTI_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)),
ftostr41sign(current_position.e
+ TERN0(IS_KINEMATIC, ui.manual_move_offset)
+ TERN0(IS_KINEMATIC, ui.manual_move.offset)
- TERN0(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin)
)
);
Expand All @@ -181,7 +166,7 @@ screenFunc_t _manual_move_func_ptr;

void _goto_manual_move(const float scale) {
ui.defer_status_screen();
move_menu_scale = scale;
ui.manual_move.menu_scale = scale;
ui.goto_screen(_manual_move_func_ptr);
}

Expand Down
Loading

0 comments on commit bdd2fc6

Please sign in to comment.