Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with EXTRUDERS = 0, no bed/fan, etc. #18395

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 120: M120(); break; // M120: Enable endstops
case 121: M121(); break; // M121: Disable endstops

#if HAS_HOTEND && HAS_LCD_MENU
#if PREHEAT_COUNT
case 145: M145(); break; // M145: Set material heatup parameters
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class GcodeSuite {
static void M191();
#endif

#if HAS_HOTEND && HAS_LCD_MENU
#if PREHEAT_COUNT
static void M145();
#endif

Expand Down
30 changes: 14 additions & 16 deletions Marlin/src/gcode/lcd/M145.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../../inc/MarlinConfig.h"

#if HAS_HOTEND && HAS_LCD_MENU
#if PREHEAT_COUNT

#include "../gcode.h"
#include "../../lcd/ultralcd.h"
Expand All @@ -37,25 +37,23 @@
*/
void GcodeSuite::M145() {
const uint8_t material = (uint8_t)parser.intval('S');
if (material >= COUNT(ui.preheat_hotend_temp))
if (material >= PREHEAT_COUNT)
SERIAL_ERROR_MSG(STR_ERR_MATERIAL_INDEX);
else {
int v;
if (parser.seenval('H')) {
v = parser.value_int();
ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT));
}
if (parser.seenval('F')) {
v = parser.value_int();
ui.preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255);
}
preset_t &mat = ui.material_preset[material];
#if HAS_HOTEND
if (parser.seenval('H'))
mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP) - (HOTEND_OVERSHOOT));
#endif
#if TEMP_SENSOR_BED != 0
if (parser.seenval('B')) {
v = parser.value_int();
ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAX_TARGET);
}
if (parser.seenval('B'))
mat.bed_temp = constrain(parser.value_int(), BED_MINTEMP, BED_MAX_TARGET);
#endif
#if HAS_FAN
if (parser.seenval('F'))
mat.fan_speed = constrain(parser.value_int(), 0, 255);
#endif
}
}

#endif // HOTENDS && HAS_LCD_MENU
#endif // PREHEAT_COUNT
14 changes: 14 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,10 @@
#define HAS_CONTROLLER_FAN 1
#endif

#if BED_OR_CHAMBER || HAS_FAN0
#define BED_OR_CHAMBER_OR_FAN 1
#endif

// Servos
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
#define HAS_SERVO_0 1
Expand Down Expand Up @@ -2080,6 +2084,16 @@
#define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING)
#endif

#if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER
#define HAS_TEMPERATURE 1
#endif

#if HAS_TEMPERATURE && EITHER(HAS_LCD_MENU, DWIN_CREALITY_LCD)
#define PREHEAT_COUNT 2
#else
#undef PREHEAT_COUNT
#endif

/**
* Up to 3 PWM fans
*/
Expand Down
14 changes: 9 additions & 5 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1404,12 +1404,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS

#endif

#if HAS_MESH
#if HAS_CLASSIC_JERK
static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
#if HAS_MESH && HAS_CLASSIC_JERK
static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling.");
#endif

#if ENABLED(G26_MESH_VALIDATION)
#if !EXTRUDERS
#error "G26_MESH_VALIDATION requires at least one extruder."
#elif !HAS_MESH
#error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL."
#endif
#elif ENABLED(G26_MESH_VALIDATION)
#error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL."
#endif

#if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_GRAPHICAL_LCD)
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/lcd/dogm/dogm_Statusscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,6 @@
#define STATUS_CHAMBER_WIDTH 0
#endif

#define BED_OR_CHAMBER_OR_FAN (BED_OR_CHAMBER || HAS_FAN0)

// Can also be overridden in Configuration_adv.h
// If you can afford it, try the 3-frame fan animation!
// Don't compile in the fan animation with no fan
Expand Down
Loading