Skip to content

Commit ea46402

Browse files
committed
Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
Everywhere MINTEMP is checked, use the configurable value set by M302, not an hardcoded value. EXTRUDE_MINTEMP is now used only as the initial default value. Reduce the precision of extrude_min_temp to an integer to reduce the generated code size (constant folding did in fact do the same previously anyway). Having tenths of degrees is not necessary for this feature.
1 parent 37e1c11 commit ea46402

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

Firmware/Marlin_main.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -3421,7 +3421,7 @@ static void gcode_G80()
34213421
go_home_with_z_lift();
34223422
// SERIAL_ECHOLNPGM("Go home finished");
34233423
//unretract (after PINDA preheat retraction)
3424-
if ((degHotend(active_extruder) > EXTRUDE_MINTEMP) && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() && (target_temperature_bed >= 50)) {
3424+
if ((degHotend(active_extruder) > extrude_min_temp) && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() && (target_temperature_bed >= 50)) {
34253425
current_position[E_AXIS] += default_retraction;
34263426
plan_buffer_line_curposXYZE(400);
34273427
}
@@ -7916,8 +7916,8 @@ SERIAL_PROTOCOLPGM("\n\n");
79167916
*/
79177917
case 302:
79187918
{
7919-
float temp = .0;
7920-
if (code_seen('S')) temp=code_value();
7919+
int temp = 0;
7920+
if (code_seen('S')) temp=code_value_short();
79217921
set_extrude_min_temp(temp);
79227922
}
79237923
break;
@@ -9860,7 +9860,7 @@ static uint16_t nFSCheckCount=0;
98609860
#ifdef PAT9125
98619861
fsensor_autoload_check_stop();
98629862
#endif //PAT9125
9863-
//-// if (degHotend0() > EXTRUDE_MINTEMP)
9863+
//-// if (degHotend0() > extrude_min_temp)
98649864
if(0)
98659865
{
98669866
Sound_MakeCustom(50,1000,false);
@@ -9876,7 +9876,7 @@ if(0)
98769876
*/
98779877
eFilamentAction=FilamentAction::AutoLoad;
98789878
bFilamentFirstRun=false;
9879-
if(target_temperature[0]>=EXTRUDE_MINTEMP){
9879+
if(target_temperature[0] >= extrude_min_temp){
98809880
bFilamentPreheatState=true;
98819881
// mFilamentItem(target_temperature[0],target_temperature_bed);
98829882
menu_submenu(mFilamentItemForce);
@@ -10801,7 +10801,7 @@ static void temp_compensation_start() {
1080110801
custom_message_type = CustomMsg::TempCompPreheat;
1080210802
custom_message_state = PINDA_HEAT_T + 1;
1080310803
lcd_update(2);
10804-
if (degHotend(active_extruder) > EXTRUDE_MINTEMP) {
10804+
if (degHotend(active_extruder) > extrude_min_temp) {
1080510805
current_position[E_AXIS] -= default_retraction;
1080610806
}
1080710807
plan_buffer_line_curposXYZE(400, active_extruder);

Firmware/planner.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static uint8_t g_cntr_planner_queue_min = 0;
122122
//=============================private variables ============================
123123
//===========================================================================
124124
#ifdef PREVENT_DANGEROUS_EXTRUDE
125-
float extrude_min_temp=EXTRUDE_MINTEMP;
125+
int extrude_min_temp = EXTRUDE_MINTEMP;
126126
#endif
127127

128128
#ifdef LIN_ADVANCE
@@ -1434,9 +1434,9 @@ void plan_reset_next_e()
14341434
}
14351435

14361436
#ifdef PREVENT_DANGEROUS_EXTRUDE
1437-
void set_extrude_min_temp(float temp)
1437+
void set_extrude_min_temp(int temp)
14381438
{
1439-
extrude_min_temp=temp;
1439+
extrude_min_temp = temp;
14401440
}
14411441
#endif
14421442

Firmware/planner.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ extern void planner_abort_hard();
262262
extern bool waiting_inside_plan_buffer_line_print_aborted;
263263

264264
#ifdef PREVENT_DANGEROUS_EXTRUDE
265-
void set_extrude_min_temp(float temp);
265+
extern int extrude_min_temp;
266+
void set_extrude_min_temp(int temp);
266267
#endif
267268

268269
void reset_acceleration_rates();

Firmware/ultralcd.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ static void lcd_menu_AutoLoadFilament()
23142314
static void preheat_or_continue()
23152315
{
23162316
bFilamentFirstRun = false;
2317-
if (target_temperature[0] >= EXTRUDE_MINTEMP)
2317+
if (target_temperature[0] >= extrude_min_temp)
23182318
{
23192319
bFilamentPreheatState = true;
23202320
mFilamentItem(target_temperature[0], target_temperature_bed);
@@ -2447,7 +2447,7 @@ static void _lcd_move(const char *name, uint8_t axis, int min, int max)
24472447

24482448
void lcd_move_e()
24492449
{
2450-
if (degHotend0() > EXTRUDE_MINTEMP)
2450+
if (degHotend0() > extrude_min_temp)
24512451
{
24522452
if (lcd_encoder != 0)
24532453
{
@@ -5561,7 +5561,7 @@ static void mmu_cut_filament_menu()
55615561
{
55625562
eFilamentAction=FilamentAction::MmuCut;
55635563
bFilamentFirstRun=false;
5564-
if(target_temperature[0]>=EXTRUDE_MINTEMP)
5564+
if(target_temperature[0] >= extrude_min_temp)
55655565
{
55665566
bFilamentPreheatState=true;
55675567
mFilamentItem(target_temperature[0],target_temperature_bed);

0 commit comments

Comments
 (0)