Skip to content

Commit

Permalink
Merge branch 'bugfix-2.1.x' into mike-anet-evo
Browse files Browse the repository at this point in the history
* bugfix-2.1.x:
  [cron] Bump distribution date (2024-01-25)
  📝 Fix dead LCD link (MarlinFirmware#26669)
  🚸 PLR recover chamber temp (MarlinFirmware#26696)
  🔧 Wrap POWER_LOSS_RETRACT_LEN (MarlinFirmware#26695)
  🔧 Allow RAMPS FAN1_PIN override (MarlinFirmware#26725)
  🔧 Update SKR_MINI_SCREEN_ADAPTER error (MarlinFirmware#26726)
  🔧 STM32 UID followup (MarlinFirmware#26727)
  [cron] Bump distribution date (2024-01-24)
  🎨 Cosmetic cleanup 23-01
  🔧 Fix ROTATIONAL_AXIS_GANG
  🩹 Fix _U and other conflicts
  🔧 Allow for no STOP pin
  🔧 Sanity check Z_CLEARANCE_FOR_HOMING (MarlinFirmware#26721)
  🚸 DOGM active extruder indicator (MarlinFirmware#26152)
  • Loading branch information
mikezs committed Jan 25, 2024
2 parents 5f2b0cf + a215bc2 commit 83f0eb7
Show file tree
Hide file tree
Showing 25 changed files with 164 additions and 126 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@

//
// Factory display for Creality CR-10 / CR-7 / Ender-3
// https://www.aliexpress.com/item/32833148327.html
// https://marlinfw.org/docs/hardware/controllers.html#cr10_stockdisplay
//
// Connect to EXP1 on RAMPS and compatible boards.
//
Expand Down
22 changes: 14 additions & 8 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0

#else
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed)
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power-loss due to cooling = Kf * (fan_speed)
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
#endif
Expand Down Expand Up @@ -1540,6 +1540,7 @@
* Axis moves <= 1/2 the axis length and Extruder moves <= EXTRUDE_MAXLENGTH
* will be shown in the move submenus.
*/

#define MANUAL_MOVE_DISTANCE_MM 10, 1.0, 0.1 // (mm)
//#define MANUAL_MOVE_DISTANCE_MM 100, 50, 10, 1.0, 0.1 // (mm)
//#define MANUAL_MOVE_DISTANCE_MM 500, 100, 50, 10, 1.0, 0.1 // (mm)
Expand Down Expand Up @@ -1744,21 +1745,26 @@
*/
#define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY)
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
#define PLR_ENABLED_DEFAULT false // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
//#define PLR_BED_THRESHOLD BED_MAXTEMP // (°C) Skip user confirmation at or above this bed temperature (0 to disable)
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss

//#define POWER_LOSS_PIN 44 // Pin to detect power-loss. Set to -1 to disable default pin on boards without module, or comment to use board default.
//#define POWER_LOSS_STATE HIGH // State of pin indicating power-loss
//#define POWER_LOSS_PULLUP // Set pullup / pulldown as appropriate for your sensor
//#define POWER_LOSS_PULLDOWN
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.

//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power-loss with UPS)
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume

// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
// especially with "vase mode" printing. Set too high and vases cannot be continued.
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data

//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power-loss
#if ENABLED(BACKUP_POWER_SUPPLY)
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail
#endif

// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
//#define POWER_LOSS_RECOVER_ZHOME
#if ENABLED(POWER_LOSS_RECOVER_ZHOME)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2024-01-23"
//#define STRING_DISTRIBUTION_DATE "2024-01-25"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ class AxisBits {
typedef bits_t(NUM_AXIS_ENUMS) el;
union {
el bits;
// x, y, z ... e0, e1, e2 ... hx, hy, hz
// Axes x, y, z ... e0, e1, e2 ... hx, hy, hz
struct {
#if NUM_AXES
bool NUM_AXIS_LIST(x:1, y:1, z:1, i:1, j:1, k:1, u:1, v:1, w:1);
Expand All @@ -949,7 +949,7 @@ class AxisBits {
bool hx:1, hy:1, hz:1;
#endif
};
// X, Y, Z ... E0, E1, E2 ... HX, HY, HZ
// Axes X, Y, Z ... E0, E1, E2 ... HX, HY, HZ
struct {
#if NUM_AXES
bool NUM_AXIS_LIST(X:1, Y:1, Z:1, I:1, J:1, K:1, U:1, V:1, W:1);
Expand All @@ -963,7 +963,7 @@ class AxisBits {
};
// a, b, c, e ... ha, hb, hc
struct {
bool LOGICAL_AXIS_LIST(e:1, a:1, b:1, c:1, _i:1, _j:1, _k:1, _u:1, _v:1, _w:1);
bool LOGICAL_AXIS_LIST(e:1, a:1, b:1, c:1, ii:1, jj:1, kk:1, uu:1, vv:1, ww:1);
#if EXTRUDERS > 1
#define _EN_ITEM(N) bool _e##N:1;
REPEAT_S(1,EXTRUDERS,_EN_ITEM)
Expand All @@ -975,7 +975,7 @@ class AxisBits {
};
// A, B, C, E ... HA, HB, HC
struct {
bool LOGICAL_AXIS_LIST(E:1, A:1, B:1, C:1, _I:1, _J:1, _K:1, _U:1, _V:1, _W:1);
bool LOGICAL_AXIS_LIST(E:1, A:1, B:1, C:1, II:1, JJ:1, KK:1, UU:1, VV:1, WW:1);
#if EXTRUDERS > 1
#define _EN_ITEM(N) bool _E##N:1;
REPEAT_S(1,EXTRUDERS,_EN_ITEM)
Expand Down
19 changes: 15 additions & 4 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ uint32_t PrintJobRecovery::cmd_sdpos, // = 0

PrintJobRecovery recovery;

#ifndef POWER_LOSS_PURGE_LEN
#define POWER_LOSS_PURGE_LEN 0
#endif

#if DISABLED(BACKUP_POWER_SUPPLY)
#undef POWER_LOSS_RETRACT_LEN // No retract at outage without backup power
#endif
#ifndef POWER_LOSS_RETRACT_LEN
#define POWER_LOSS_RETRACT_LEN 0
#endif
#ifndef POWER_LOSS_PURGE_LEN
#define POWER_LOSS_PURGE_LEN 0
#endif

// Allow power-loss recovery to be aborted
#define PLR_CAN_ABORT
Expand Down Expand Up @@ -229,6 +228,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW

TERN_(HAS_HEATED_BED, info.target_temperature_bed = thermalManager.degTargetBed());

TERN_(HAS_HEATED_CHAMBER, info.target_temperature_chamber = thermalManager.degTargetChamber());

TERN_(HAS_FAN, COPY(info.fan_speed, thermalManager.fan_speed));

#if HAS_LEVELING
Expand Down Expand Up @@ -384,6 +385,12 @@ void PrintJobRecovery::resume() {
PROCESS_SUBCOMMANDS_NOW(F("M420S0"));
#endif

#if HAS_HEATED_CHAMBER
// Restore the chamber temperature
const celsius_t ct = info.target_temperature_chamber;
if (ct) PROCESS_SUBCOMMANDS_NOW(TS(F("M191S"), ct));
#endif

#if HAS_HEATED_BED
// Restore the bed temperature
const celsius_t bt = info.target_temperature_bed;
Expand Down Expand Up @@ -634,6 +641,10 @@ void PrintJobRecovery::resume() {
DEBUG_ECHOLNPGM("target_temperature_bed: ", info.target_temperature_bed);
#endif

#if HAS_HEATED_CHAMBER
DEBUG_ECHOLNPGM("target_temperature_chamber: ", info.target_temperature_chamber);
#endif

#if HAS_FAN
DEBUG_ECHOPGM("fan_speed: ");
FANS_LOOP(i) {
Expand Down
8 changes: 7 additions & 1 deletion Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
#define POWER_LOSS_STATE HIGH
#endif

#if DISABLED(BACKUP_POWER_SUPPLY)
#undef POWER_LOSS_ZRAISE // No Z raise at outage without backup power
#endif
#ifndef POWER_LOSS_ZRAISE
#define POWER_LOSS_ZRAISE 2
#define POWER_LOSS_ZRAISE 2 // Default Z-raise on outage or resume
#endif

//#define DEBUG_POWER_LOSS_RECOVERY
Expand Down Expand Up @@ -84,6 +87,9 @@ typedef struct {
#if HAS_HEATED_BED
celsius_t target_temperature_bed;
#endif
#if HAS_HEATED_CHAMBER
celsius_t target_temperature_chamber;
#endif
#if HAS_FAN
uint8_t fan_speed[FAN_COUNT];
#endif
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "../../feature/caselight.h"
#endif

#if !defined(MACHINE_UUID) && HAS_STM32_UID
#if !defined(MACHINE_UUID) && ENABLED(HAS_STM32_UID)
#include "../../libs/hex_print.h"
#endif

Expand Down Expand Up @@ -72,15 +72,15 @@ void GcodeSuite::M115() {
#if NUM_AXES != XYZ
" AXIS_COUNT:" STRINGIFY(NUM_AXES)
#endif
#if defined(MACHINE_UUID) || HAS_STM32_UID
#if defined(MACHINE_UUID) || ENABLED(HAS_STM32_UID)
" UUID:"
#endif
#ifdef MACHINE_UUID
MACHINE_UUID
#endif
);

#if !defined(MACHINE_UUID) && HAS_STM32_UID
#if !defined(MACHINE_UUID) && ENABLED(HAS_STM32_UID)
/**
* STM32-based devices have a 96-bit CPU device serial number.
* Used by LumenPnP / OpenPNP to keep track of unique hardware/configurations.
Expand All @@ -93,7 +93,7 @@ void GcodeSuite::M115() {
#else
uint16_t * const UID = (uint16_t*)UID_BASE;
SERIAL_ECHO(
F("CEDE2A2F-"), hex_word(UID[0]), '-', hex_word(UID[1]), '-', hex_word(UID[2]), '-',
F("CEDE2A2F-"), hex_word(UID[0]), C('-'), hex_word(UID[1]), C('-'), hex_word(UID[2]), C('-'),
hex_word(UID[3]), hex_word(UID[4]), hex_word(UID[5])
);
#endif
Expand Down
32 changes: 18 additions & 14 deletions Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ class GCodeParser {
// Bool is true with no value or non-zero
static bool value_bool() { return !has_value() || !!value_byte(); }

static constexpr bool axis_is_rotational(const AxisEnum axis) {
return (false
|| TERN0(AXIS4_ROTATES, axis == I_AXIS)
|| TERN0(AXIS5_ROTATES, axis == J_AXIS)
|| TERN0(AXIS6_ROTATES, axis == K_AXIS)
|| TERN0(AXIS7_ROTATES, axis == U_AXIS)
|| TERN0(AXIS8_ROTATES, axis == V_AXIS)
|| TERN0(AXIS9_ROTATES, axis == W_AXIS)
);
}

// Units modes: Inches, Fahrenheit, Kelvin

#if ENABLED(INCH_MODE_SUPPORT)
Expand All @@ -307,14 +318,7 @@ class GCodeParser {
}

static float axis_unit_factor(const AxisEnum axis) {
if (false
|| TERN0(AXIS4_ROTATES, axis == I_AXIS)
|| TERN0(AXIS5_ROTATES, axis == J_AXIS)
|| TERN0(AXIS6_ROTATES, axis == K_AXIS)
|| TERN0(AXIS7_ROTATES, axis == U_AXIS)
|| TERN0(AXIS8_ROTATES, axis == V_AXIS)
|| TERN0(AXIS9_ROTATES, axis == W_AXIS)
) return 1.0f;
if (axis_is_rotational(axis)) return 1.0f;
#if HAS_EXTRUDERS
if (axis >= E_AXIS && volumetric_enabled) return volumetric_unit_factor;
#endif
Expand All @@ -327,12 +331,12 @@ class GCodeParser {

#else

static float mm_to_linear_unit(const_float_t mm) { return mm; }
static float mm_to_volumetric_unit(const_float_t mm) { return mm; }
static constexpr float mm_to_linear_unit(const_float_t mm) { return mm; }
static constexpr float mm_to_volumetric_unit(const_float_t mm) { return mm; }

static float linear_value_to_mm(const_float_t v) { return v; }
static float axis_value_to_mm(const AxisEnum, const float v) { return v; }
static float per_axis_value(const AxisEnum, const float v) { return v; }
static constexpr float linear_value_to_mm(const_float_t v) { return v; }
static constexpr float axis_value_to_mm(const AxisEnum, const float v) { return v; }
static constexpr float per_axis_value(const AxisEnum, const float v) { return v; }

#endif

Expand Down Expand Up @@ -402,7 +406,7 @@ class GCodeParser {

#else // !TEMPERATURE_UNITS_SUPPORT

static float to_temp_units(int16_t c) { return (float)c; }
static constexpr float to_temp_units(int16_t c) { return (float)c; }

static celsius_t value_celsius() { return value_int(); }
static celsius_t value_celsius_diff() { return value_int(); }
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@
#define ROTATIONAL_AXES 0
#endif

#if ROTATIONAL_AXES
#define HAS_ROTATIONAL_AXES 1
#endif

/**
* Number of Secondary Linear Axes (e.g., UVW)
* All secondary axes for which AXIS*_ROTATES is not defined.
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,11 @@
#undef MANUAL_MOVE_DISTANCE_IN
#endif

// Clean up if no rotational axes exist
#if !HAS_ROTATIONAL_AXES
#undef MANUAL_MOVE_DISTANCE_DEG
#endif

// Power-Loss Recovery
#if ENABLED(POWER_LOSS_RECOVERY) && defined(PLR_BED_THRESHOLD)
#define HAS_PLR_BED_THRESHOLD 1
Expand Down
6 changes: 0 additions & 6 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@
#define AXIS9_NAME 'W'
#endif

#if ANY(AXIS4_ROTATES, AXIS5_ROTATES, AXIS6_ROTATES, AXIS7_ROTATES, AXIS8_ROTATES, AXIS9_ROTATES)
#define HAS_ROTATIONAL_AXES 1
#else
#undef MANUAL_MOVE_DISTANCE_DEG
#endif

#if HAS_X_AXIS
#define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
#endif
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,13 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
static_assert(WITHIN(Z_SAFE_HOMING_Y_POINT, Y_MIN_POS, Y_MAX_POS), "Z_SAFE_HOMING_Y_POINT can't be reached by the nozzle.");
#endif

/**
* Make sure Z_CLEARANCE_FOR_HOMING is below Z_MAX_POS
*/
#if HAS_Z_AXIS
static_assert(Z_CLEARANCE_FOR_HOMING <= Z_MAX_POS, "Z_CLEARANCE_FOR_HOMING must be smaller than or equal to Z_MAX_POS.");
#endif

// Check Safe Bed Leveling settings
#if HAS_SAFE_BED_LEVELING
#if defined(SAFE_BED_LEVELING_START_Y) && !defined(SAFE_BED_LEVELING_START_X)
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 "2024-01-23"
#define STRING_DISTRIBUTION_DATE "2024-01-25"
#endif

/**
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/lcd/dogm/status/hotend.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@

#elif STATUS_HOTEND_BITMAPS > 1

const unsigned char status_active_extruder_indicator_bmp[] PROGMEM = {
B00110000,
B00011000,
B00001100,
B00011000,
B00110000
};

#ifdef STATUS_HOTEND_ANIM

const unsigned char status_hotend1_a_bmp[] PROGMEM = {
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co

} // PAGE_CONTAINS

#if HAS_MULTI_EXTRUDER && DISABLED(SLIM_LCD_MENUS)
if (active_extruder == heater_id)
u8g.drawBitmapP(_MAX(0, STATUS_HOTEND_X(heater_id) - 6), STATUS_HEATERS_Y + 3, 1, 5, status_active_extruder_indicator_bmp);
#endif

#endif // !STATUS_COMBINE_HEATERS

if (PAGE_UNDER(7)) {
Expand Down
Loading

0 comments on commit 83f0eb7

Please sign in to comment.