From a1e04942a2c8e10dca3e6e017276cd24eea932d9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 20 Apr 2017 14:04:26 -0500 Subject: [PATCH 1/6] Cleanup to software PWM variables --- Marlin/Marlin_main.cpp | 2 +- Marlin/planner.cpp | 6 +- Marlin/temperature.cpp | 150 ++++++++++++++++++++--------------------- Marlin/temperature.h | 14 ++-- 4 files changed, 82 insertions(+), 90 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 45bfac5c0f..3c9eabab2e 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -11516,7 +11516,7 @@ void prepare_move_to_destination() { const millis_t ms = millis(); if (ELAPSED(ms, nextMotorCheck)) { nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s - if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || thermalManager.soft_pwm_bed > 0 + if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || thermalManager.soft_pwm_amount_bed > 0 || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled... #if E_STEPPERS > 1 || E1_ENABLE_READ == E_ENABLE_ON diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 2a0bfe2a70..f95d8ab6ef 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -491,13 +491,13 @@ void Planner::check_axes_activity() { #if ENABLED(FAN_SOFT_PWM) #if HAS_FAN0 - thermalManager.fanSpeedSoftPwm[0] = CALC_FAN_SPEED(0); + thermalManager.soft_pwm_amount_fan[0] = CALC_FAN_SPEED(0); #endif #if HAS_FAN1 - thermalManager.fanSpeedSoftPwm[1] = CALC_FAN_SPEED(1); + thermalManager.soft_pwm_amount_fan[1] = CALC_FAN_SPEED(1); #endif #if HAS_FAN2 - thermalManager.fanSpeedSoftPwm[2] = CALC_FAN_SPEED(2); + thermalManager.soft_pwm_amount_fan[2] = CALC_FAN_SPEED(2); #endif #else #if HAS_FAN0 diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 3b9454ccc4..e39b1fde18 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -74,12 +74,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, float Temperature::redundant_temperature = 0.0; #endif -uint8_t Temperature::soft_pwm_bed; - -#if ENABLED(FAN_SOFT_PWM) - uint8_t Temperature::fanSpeedSoftPwm[FAN_COUNT]; -#endif - #if ENABLED(PIDTEMP) #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp), @@ -194,10 +188,12 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE millis_t Temperature::next_auto_fan_check_ms = 0; #endif -uint8_t Temperature::soft_pwm[HOTENDS]; +uint8_t Temperature::soft_pwm_amount[HOTENDS], + Temperature::soft_pwm_amount_bed; #if ENABLED(FAN_SOFT_PWM) - uint8_t Temperature::soft_pwm_fan[FAN_COUNT]; + uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT], + Temperature::soft_pwm_count_fan[FAN_COUNT]; #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) @@ -206,7 +202,7 @@ uint8_t Temperature::soft_pwm[HOTENDS]; #if ENABLED(PROBING_HEATERS_OFF) bool Temperature::paused; - int16_t Temperature::paused_hotend_temps[HOTENDS]; + int16_t Temperature::paused_hotend_temp[HOTENDS]; #if HAS_TEMP_BED int16_t Temperature::paused_bed_temp; #endif @@ -254,13 +250,13 @@ uint8_t Temperature::soft_pwm[HOTENDS]; #if HAS_PID_FOR_BOTH if (hotend < 0) - soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1; + soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1; else - soft_pwm[hotend] = bias = d = (PID_MAX) >> 1; + soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1; #elif ENABLED(PIDTEMP) - soft_pwm[hotend] = bias = d = (PID_MAX) >> 1; + soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1; #else - soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1; + soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1; #endif wait_for_heatup = true; @@ -298,13 +294,13 @@ uint8_t Temperature::soft_pwm[HOTENDS]; heating = false; #if HAS_PID_FOR_BOTH if (hotend < 0) - soft_pwm_bed = (bias - d) >> 1; + soft_pwm_amount_bed = (bias - d) >> 1; else - soft_pwm[hotend] = (bias - d) >> 1; + soft_pwm_amount[hotend] = (bias - d) >> 1; #elif ENABLED(PIDTEMP) - soft_pwm[hotend] = (bias - d) >> 1; + soft_pwm_amount[hotend] = (bias - d) >> 1; #elif ENABLED(PIDTEMPBED) - soft_pwm_bed = (bias - d) >> 1; + soft_pwm_amount_bed = (bias - d) >> 1; #endif t1 = ms; t_high = t1 - t2; @@ -367,13 +363,13 @@ uint8_t Temperature::soft_pwm[HOTENDS]; } #if HAS_PID_FOR_BOTH if (hotend < 0) - soft_pwm_bed = (bias + d) >> 1; + soft_pwm_amount_bed = (bias + d) >> 1; else - soft_pwm[hotend] = (bias + d) >> 1; + soft_pwm_amount[hotend] = (bias + d) >> 1; #elif ENABLED(PIDTEMP) - soft_pwm[hotend] = (bias + d) >> 1; + soft_pwm_amount[hotend] = (bias + d) >> 1; #else - soft_pwm_bed = (bias + d) >> 1; + soft_pwm_amount_bed = (bias + d) >> 1; #endif cycles++; min = temp; @@ -466,7 +462,7 @@ void Temperature::updatePID() { } int Temperature::getHeaterPower(int heater) { - return heater < 0 ? soft_pwm_bed : soft_pwm[heater]; + return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater]; } #if HAS_AUTO_FAN @@ -717,7 +713,7 @@ void Temperature::manage_heater() { float pid_output = get_pid_output(e); // Check if temperature is within the correct range - soft_pwm[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0; + soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0; // Check if the temperature is failing to increase #if WATCH_HOTENDS @@ -798,27 +794,27 @@ void Temperature::manage_heater() { #if ENABLED(PIDTEMPBED) float pid_output = get_pid_output_bed(); - soft_pwm_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0; + soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0; #elif ENABLED(BED_LIMIT_SWITCHING) // Check if temperature is within the correct band if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) { if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) - soft_pwm_bed = 0; + soft_pwm_amount_bed = 0; else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS)) - soft_pwm_bed = MAX_BED_POWER >> 1; + soft_pwm_amount_bed = MAX_BED_POWER >> 1; } else { - soft_pwm_bed = 0; + soft_pwm_amount_bed = 0; WRITE_HEATER_BED(LOW); } #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING // Check if temperature is within the correct range if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) { - soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0; + soft_pwm_amount_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0; } else { - soft_pwm_bed = 0; + soft_pwm_amount_bed = 0; WRITE_HEATER_BED(LOW); } #endif @@ -1205,7 +1201,7 @@ void Temperature::init() { #if ENABLED(PROBING_HEATERS_OFF) paused = false; - ZERO(paused_hotend_temps); + ZERO(paused_hotend_temp); #if HAS_TEMP_BED paused_bed_temp = 0; #endif @@ -1316,7 +1312,7 @@ void Temperature::disable_all_heaters() { // Unpause and reset everything #if ENABLED(PROBING_HEATERS_OFF) paused = false; - ZERO(paused_hotend_temps); + ZERO(paused_hotend_temp); #if HAS_TEMP_BED paused_bed_temp = 0; #endif @@ -1327,7 +1323,7 @@ void Temperature::disable_all_heaters() { #define DISABLE_HEATER(NR) { \ setTargetHotend(0, NR); \ - soft_pwm[NR] = 0; \ + soft_pwm_amount[NR] = 0; \ WRITE_HEATER_ ##NR (LOW); \ } @@ -1349,7 +1345,7 @@ void Temperature::disable_all_heaters() { #if HAS_TEMP_BED target_temperature_bed = 0; - soft_pwm_bed = 0; + soft_pwm_amount_bed = 0; #if HAS_HEATER_BED WRITE_HEATER_BED(LOW); #endif @@ -1366,7 +1362,7 @@ void Temperature::disable_all_heaters() { if (p) { HOTEND_LOOP() { - paused_hotend_temps[e] = degTargetHotend(e); + paused_hotend_temp[e] = degTargetHotend(e); setTargetHotend(0, e); } #if HAS_TEMP_BED @@ -1375,7 +1371,7 @@ void Temperature::disable_all_heaters() { #endif } else { - HOTEND_LOOP() setTargetHotend(paused_hotend_temps[e], e); + HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e); #if HAS_TEMP_BED setTargetBed(paused_bed_temp); #endif @@ -1613,11 +1609,11 @@ void Temperature::isr() { #if ENABLED(SLOW_PWM_HEATERS) static uint8_t slow_pwm_count = 0; #define ISR_STATICS(n) \ - static uint8_t soft_pwm_ ## n; \ - static uint8_t state_heater_ ## n = 0; \ - static uint8_t state_timer_heater_ ## n = 0 + static uint8_t soft_pwm_count_ ## n, \ + state_heater_ ## n = 0, \ + state_timer_heater_ ## n = 0 #else - #define ISR_STATICS(n) static uint8_t soft_pwm_ ## n = 0 + #define ISR_STATICS(n) static uint8_t soft_pwm_count_ ## n = 0 #endif // Statics per heater @@ -1656,73 +1652,73 @@ void Temperature::isr() { */ if (pwm_count_tmp >= 127) { pwm_count_tmp -= 127; - soft_pwm_0 = (soft_pwm_0 & pwm_mask) + soft_pwm[0]; - WRITE_HEATER_0(soft_pwm_0 > pwm_mask ? HIGH : LOW); + soft_pwm_count_0 = (soft_pwm_count_0 & pwm_mask) + soft_pwm_amount[0]; + WRITE_HEATER_0(soft_pwm_count_0 > pwm_mask ? HIGH : LOW); #if HOTENDS > 1 - soft_pwm_1 = (soft_pwm_1 & pwm_mask) + soft_pwm[1]; - WRITE_HEATER_1(soft_pwm_1 > pwm_mask ? HIGH : LOW); + soft_pwm_count_1 = (soft_pwm_count_1 & pwm_mask) + soft_pwm_amount[1]; + WRITE_HEATER_1(soft_pwm_count_1 > pwm_mask ? HIGH : LOW); #if HOTENDS > 2 - soft_pwm_2 = (soft_pwm_2 & pwm_mask) + soft_pwm[2]; - WRITE_HEATER_2(soft_pwm_2 > pwm_mask ? HIGH : LOW); + soft_pwm_count_2 = (soft_pwm_count_2 & pwm_mask) + soft_pwm_amount[2]; + WRITE_HEATER_2(soft_pwm_count_2 > pwm_mask ? HIGH : LOW); #if HOTENDS > 3 - soft_pwm_3 = (soft_pwm_3 & pwm_mask) + soft_pwm[3]; - WRITE_HEATER_3(soft_pwm_3 > pwm_mask ? HIGH : LOW); + soft_pwm_count_3 = (soft_pwm_count_3 & pwm_mask) + soft_pwm_amount[3]; + WRITE_HEATER_3(soft_pwm_count_3 > pwm_mask ? HIGH : LOW); #if HOTENDS > 4 - soft_pwm_4 = (soft_pwm_4 & pwm_mask) + soft_pwm[4]; - WRITE_HEATER_4(soft_pwm_4 > pwm_mask ? HIGH : LOW); + soft_pwm_count_4 = (soft_pwm_count_4 & pwm_mask) + soft_pwm_amount[4]; + WRITE_HEATER_4(soft_pwm_count_4 > pwm_mask ? HIGH : LOW); #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 #if HAS_HEATER_BED - soft_pwm_BED = (soft_pwm_BED & pwm_mask) + soft_pwm_bed; - WRITE_HEATER_BED(soft_pwm_BED > pwm_mask ? HIGH : LOW); + soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed; + WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW); #endif #if ENABLED(FAN_SOFT_PWM) #if HAS_FAN0 - soft_pwm_fan[0] = (soft_pwm_fan[0] & pwm_mask) + fanSpeedSoftPwm[0] >> 1; - WRITE_FAN(soft_pwm_fan[0] > pwm_mask ? HIGH : LOW); + soft_pwm_count_fan[0] = (soft_pwm_count_fan[0] & pwm_mask) + soft_pwm_amount_fan[0] >> 1; + WRITE_FAN(soft_pwm_count_fan[0] > pwm_mask ? HIGH : LOW); #endif #if HAS_FAN1 - soft_pwm_fan[1] = (soft_pwm_fan[1] & pwm_mask) + fanSpeedSoftPwm[1] >> 1; - WRITE_FAN1(soft_pwm_fan[1] > pwm_mask ? HIGH : LOW); + soft_pwm_count_fan[1] = (soft_pwm_count_fan[1] & pwm_mask) + soft_pwm_amount_fan[1] >> 1; + WRITE_FAN1(soft_pwm_count_fan[1] > pwm_mask ? HIGH : LOW); #endif #if HAS_FAN2 - soft_pwm_fan[2] = (soft_pwm_fan[2] & pwm_mask) + fanSpeedSoftPwm[2] >> 1; - WRITE_FAN2(soft_pwm_fan[2] > pwm_mask ? HIGH : LOW); + soft_pwm_count_fan[2] = (soft_pwm_count_fan[2] & pwm_mask) + soft_pwm_amount_fan[2] >> 1; + WRITE_FAN2(soft_pwm_count_fan[2] > pwm_mask ? HIGH : LOW); #endif #endif } else { - if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0); + if (soft_pwm_count_0 <= pwm_count_tmp) WRITE_HEATER_0(0); #if HOTENDS > 1 - if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0); + if (soft_pwm_count_1 <= pwm_count_tmp) WRITE_HEATER_1(0); #if HOTENDS > 2 - if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0); + if (soft_pwm_count_2 <= pwm_count_tmp) WRITE_HEATER_2(0); #if HOTENDS > 3 - if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0); + if (soft_pwm_count_3 <= pwm_count_tmp) WRITE_HEATER_3(0); #if HOTENDS > 4 - if (soft_pwm_4 <= pwm_count_tmp) WRITE_HEATER_4(0); + if (soft_pwm_count_4 <= pwm_count_tmp) WRITE_HEATER_4(0); #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 #if HAS_HEATER_BED - if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0); + if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(0); #endif #if ENABLED(FAN_SOFT_PWM) #if HAS_FAN0 - if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0); + if (soft_pwm_count_fan[0] <= pwm_count_tmp) WRITE_FAN(0); #endif #if HAS_FAN1 - if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0); + if (soft_pwm_count_fan[1] <= pwm_count_tmp) WRITE_FAN1(0); #endif #if HAS_FAN2 - if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0); + if (soft_pwm_count_fan[2] <= pwm_count_tmp) WRITE_FAN2(0); #endif #endif } @@ -1765,7 +1761,7 @@ void Temperature::isr() { WRITE_HEATER_ ##NR(0); \ } \ } - #define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm[n]) + #define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm_amount[n]) #define PWM_OFF_ROUTINE(NR) \ if (soft_pwm_ ##NR < slow_pwm_count) { \ @@ -1792,7 +1788,7 @@ void Temperature::isr() { #endif // HOTENDS > 2 #endif // HOTENDS > 1 #if HAS_HEATER_BED - _SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED + _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED #endif } // slow_pwm_count == 0 @@ -1818,26 +1814,26 @@ void Temperature::isr() { if (pwm_count_tmp >= 127) { pwm_count_tmp = 0; #if HAS_FAN0 - soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1; - WRITE_FAN(soft_pwm_fan[0] > 0 ? HIGH : LOW); + soft_pwm_count_fan[0] = soft_pwm_amount_fan[0] >> 1; + WRITE_FAN(soft_pwm_count_fan[0] > 0 ? HIGH : LOW); #endif #if HAS_FAN1 - soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1; - WRITE_FAN1(soft_pwm_fan[1] > 0 ? HIGH : LOW); + soft_pwm_count_fan[1] = soft_pwm_amount_fan[1] >> 1; + WRITE_FAN1(soft_pwm_count_fan[1] > 0 ? HIGH : LOW); #endif #if HAS_FAN2 - soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1; - WRITE_FAN2(soft_pwm_fan[2] > 0 ? HIGH : LOW); + soft_pwm_count_fan[2] = soft_pwm_amount_fan[2] >> 1; + WRITE_FAN2(soft_pwm_count_fan[2] > 0 ? HIGH : LOW); #endif } #if HAS_FAN0 - if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0); + if (soft_pwm_count_fan[0] <= pwm_count_tmp) WRITE_FAN(0); #endif #if HAS_FAN1 - if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0); + if (soft_pwm_count_fan[1] <= pwm_count_tmp) WRITE_FAN1(0); #endif #if HAS_FAN2 - if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0); + if (soft_pwm_count_fan[2] <= pwm_count_tmp) WRITE_FAN2(0); #endif #endif // FAN_SOFT_PWM diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 7fc9926c35..073341895f 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -109,10 +109,12 @@ class Temperature { static float redundant_temperature; #endif - static uint8_t soft_pwm_bed; + static uint8_t soft_pwm_amount[HOTENDS], + soft_pwm_amount_bed; #if ENABLED(FAN_SOFT_PWM) - static uint8_t fanSpeedSoftPwm[FAN_COUNT]; + static uint8_t soft_pwm_amount_fan[FAN_COUNT], + soft_pwm_count_fan[FAN_COUNT]; #endif #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) @@ -249,19 +251,13 @@ class Temperature { static millis_t next_auto_fan_check_ms; #endif - static uint8_t soft_pwm[HOTENDS]; - - #if ENABLED(FAN_SOFT_PWM) - static uint8_t soft_pwm_fan[FAN_COUNT]; - #endif - #if ENABLED(FILAMENT_WIDTH_SENSOR) static int current_raw_filwidth; //Holds measured filament diameter - one extruder only #endif #if ENABLED(PROBING_HEATERS_OFF) static bool paused; - static int16_t paused_hotend_temps[HOTENDS]; + static int16_t paused_hotend_temp[HOTENDS]; #if HAS_TEMP_BED static int16_t paused_bed_temp; From a6dafb058eba43588de40738292bc5d9da0d26ad Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 May 2017 13:58:09 -0500 Subject: [PATCH 2/6] Small reduction in error code size --- Marlin/Marlin_main.cpp | 4 +++- Marlin/temperature.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3c9eabab2e..f55d62be26 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2060,7 +2060,9 @@ static void clean_up_after_endstop_or_probe_move() { void fans_pause(bool p) { if (p == fans_paused) { // If called out of order something is wrong SERIAL_ERROR_START; - serialprintPGM(fans_paused ? PSTR("Fans already paused!") : PSTR("Fans already unpaused!")); + SERIAL_ERRORPGM("Fans already "); + if (!fans_paused) SERIAL_ERRORPGM("un"); + SERIAL_ERRORLNPGM("paused!"); return; } diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index e39b1fde18..074b9ce130 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1356,7 +1356,9 @@ void Temperature::disable_all_heaters() { void Temperature::pause(bool p) { if (p == paused) { // If called out of order something is wrong SERIAL_ERROR_START; - serialprintPGM(paused ? PSTR("Heaters already paused!") : PSTR("Heaters already unpaused!")); + SERIAL_ERRORPGM("Heaters already "); + if (!paused) SERIAL_ERRORPGM("un"); + SERIAL_ERRORLNPGM("paused!"); return; } From dca48f0e63d9b5ce7ee40799517cc43a1f94e269 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 May 2017 14:14:11 -0500 Subject: [PATCH 3/6] Move platformio.ini back to Marlin folder - it works there --- platformio.ini => Marlin/platformio.ini | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename platformio.ini => Marlin/platformio.ini (100%) diff --git a/platformio.ini b/Marlin/platformio.ini similarity index 100% rename from platformio.ini rename to Marlin/platformio.ini From 71396f77d3c6a65a18d4b6bf4ef29dc077d83100 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 May 2017 14:09:37 -0500 Subject: [PATCH 4/6] Cleanups following recent commits --- Marlin/Conditionals_post.h | 2 +- Marlin/Marlin_main.cpp | 43 +++++++++++++++--------------------- Marlin/temperature.cpp | 45 +++++++++++++++----------------------- Marlin/temperature.h | 3 +-- Marlin/ubl_G29.cpp | 2 +- Marlin/ubl_motion.cpp | 2 +- 6 files changed, 40 insertions(+), 57 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 0a5e1820c6..3edc8dfe83 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -649,7 +649,7 @@ /** * Heater & Fan Pausing */ - #if ENABLED(PROBING_FANS_OFF) && FAN_COUNT == 0 + #if FAN_COUNT == 0 #undef PROBING_FANS_OFF #endif #define QUIET_PROBING (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF)) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f55d62be26..482d0f257a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2057,26 +2057,21 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if ENABLED(PROBING_FANS_OFF) - void fans_pause(bool p) { - if (p == fans_paused) { // If called out of order something is wrong - SERIAL_ERROR_START; - SERIAL_ERRORPGM("Fans already "); - if (!fans_paused) SERIAL_ERRORPGM("un"); - SERIAL_ERRORLNPGM("paused!"); - return; + + void fans_pause(const bool p) { + if (p != fans_paused) { + fans_paused = p; + if (p) + for (uint8_t x = 0; x < FAN_COUNT; x++) { + paused_fanSpeeds[x] = fanSpeeds[x]; + fanSpeeds[x] = 0; + } + else + for (uint8_t x = 0; x < FAN_COUNT; x++) + fanSpeeds[x] = paused_fanSpeeds[x]; } - - if (p) - for (uint8_t x = 0;x < FAN_COUNT;x++) { - paused_fanSpeeds[x] = fanSpeeds[x]; - fanSpeeds[x] = 0; - } - else - for (uint8_t x = 0;x < FAN_COUNT;x++) - fanSpeeds[x] = paused_fanSpeeds[x]; - - fans_paused = p; } + #endif // PROBING_FANS_OFF #if HAS_BED_PROBE @@ -2091,18 +2086,16 @@ static void clean_up_after_endstop_or_probe_move() { #endif #if QUIET_PROBING - void probing_pause(bool pause) { + void probing_pause(const bool p) { #if ENABLED(PROBING_HEATERS_OFF) - thermalManager.pause(pause); + thermalManager.pause(p); #endif - #if ENABLED(PROBING_FANS_OFF) - fans_pause(pause); + fans_pause(p); #endif - - if(pause) safe_delay(25); + if (p) safe_delay(25); } - #endif + #endif // QUIET_PROBING #if ENABLED(BLTOUCH) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 074b9ce130..6021d899ad 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1353,38 +1353,29 @@ void Temperature::disable_all_heaters() { } #if ENABLED(PROBING_HEATERS_OFF) - void Temperature::pause(bool p) { - if (p == paused) { // If called out of order something is wrong - SERIAL_ERROR_START; - SERIAL_ERRORPGM("Heaters already "); - if (!paused) SERIAL_ERRORPGM("un"); - SERIAL_ERRORLNPGM("paused!"); - return; - } - if (p) { - HOTEND_LOOP() { - paused_hotend_temp[e] = degTargetHotend(e); - setTargetHotend(0, e); + void Temperature::pause(const bool p) { + if (p != paused) { + paused = p; + if (p) { + HOTEND_LOOP() { + paused_hotend_temp[e] = degTargetHotend(e); + setTargetHotend(0, e); + } + #if HAS_TEMP_BED + paused_bed_temp = degTargetBed(); + setTargetBed(0); + #endif + } + else { + HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e); + #if HAS_TEMP_BED + setTargetBed(paused_bed_temp); + #endif } - #if HAS_TEMP_BED - paused_bed_temp = degTargetBed(); - setTargetBed(0); - #endif } - else { - HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e); - #if HAS_TEMP_BED - setTargetBed(paused_bed_temp); - #endif - } - - paused = p; } - bool Temperature::ispaused() { - return paused; - } #endif // PROBING_HEATERS_OFF #if ENABLED(HEATER_0_USES_MAX6675) diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 073341895f..e8632311d6 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -458,8 +458,7 @@ class Temperature { #endif // BABYSTEPPING #if ENABLED(PROBING_HEATERS_OFF) - static void pause(bool p); - static bool ispaused(); + static void pause(const bool p); #endif private: diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 247ae27d65..7a174f702d 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -1006,7 +1006,7 @@ if (!ubl.state.active) SERIAL_PROTOCOLPGM("de"); SERIAL_PROTOCOLLNPGM("activated.\n"); } - + bool g29_parameter_parsing() { bool err_flag = false; diff --git a/Marlin/ubl_motion.cpp b/Marlin/ubl_motion.cpp index a6065dab55..5fbf141abd 100644 --- a/Marlin/ubl_motion.cpp +++ b/Marlin/ubl_motion.cpp @@ -225,7 +225,7 @@ const float e_normalized_dist = e_position / on_axis_distance, z_normalized_dist = z_position / on_axis_distance; - int current_xi = cell_start_xi, + int current_xi = cell_start_xi, current_yi = cell_start_yi; const float m = dy / dx, From f04d1096d4ed70b0da01117956c3b550cdaaf735 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 May 2017 14:00:38 -0500 Subject: [PATCH 5/6] Link to users in README.md --- README.md | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 393cb20bd3..730a0bdd62 100644 --- a/README.md +++ b/README.md @@ -113,37 +113,37 @@ Proposed patches should be submitted as a Pull Request against this branch ([bug ## Credits The current Marlin dev team consists of: - - Roxanne Neufeld [@Roxy-3D] - English - - Scott Lahteine [@thinkyhead] - English - - Bob Kuhn [@Bob-the-Kuhn] - English - - Andreas Hardtung [@AnHardt] - Deutsch, English - - Nico Tonnhofer [@Wurstnase] - Deutsch, English - - Jochen Groppe [@CONSULitAS] - Deutsch, English - - João Brazio [@jbrazio] - Portuguese, English - - Bo Hermannsen [@boelle] - Danish, English - - Bob Cousins [@bobc] - English - - [@maverikou] - - Chris Palmer [@nophead] - - [@paclema] - - Erik van der Zalm [@ErikZalm] - - David Braam [@daid] - - Bernhard Kubicek [@bkubicek] + - Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - English + - Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - English + - Bob Kuhn [[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)] - English + - Andreas Hardtung [[@AnHardt](https://github.com/AnHardt)] - Deutsch, English + - Nico Tonnhofer [[@Wurstnase](https://github.com/Wurstnase)] - Deutsch, English + - Jochen Groppe [[@CONSULitAS](https://github.com/CONSULitAS)] - Deutsch, English + - João Brazio [[@jbrazio](https://github.com/jbrazio)] - Portuguese, English + - Bo Hermannsen [[@boelle](https://github.com/boelle)] - Danish, English + - Bob Cousins [[@bobc](https://github.com/bobc)] - English + - [[@maverikou](https://github.com/maverikou)] + - Chris Palmer [[@nophead](https://github.com/nophead)] + - [[@paclema](https://github.com/paclema)] + - Erik van der Zalm [[@ErikZalm](https://github.com/ErikZalm)] + - David Braam [[@daid](https://github.com/daid)] + - Bernhard Kubicek [[@bkubicek](https://github.com/bkubicek)] More features have been added by: - - Alberto Cotronei [@MagoKimbra] - English, Italian - - Thomas Moore [@tcm0116] - - Ernesto Martinez [@emartinez167] - - Petr Zahradnik [@clexpert] - - Kai [@Kaibob2] - - Edward Patel [@epatel] - - F. Malpartida [@fmalpartida] - English, Spanish - - [@esenapaj] - English, Japanese - - [@benlye] - - [@Tannoo] - - [@teemuatlut] - - [@bgort] - - [@LVD-AC] - - [@paulusjacobus] + - Alberto Cotronei [[@MagoKimbra](https://github.com/MagoKimbra)] - English, Italian + - Thomas Moore [[@tcm0116](https://github.com/tcm0116)] + - Ernesto Martinez [[@emartinez167](https://github.com/emartinez167)] + - Petr Zahradnik [[@clexpert](https://github.com/clexpert)] + - Kai [[@Kaibob2](https://github.com/Kaibob2)] + - Edward Patel [[@epatel](https://github.com/epatel)] + - F. Malpartida [[@fmalpartida](https://github.com/fmalpartida)] - English, Spanish + - [[@esenapaj](https://github.com/esenapaj)] - English, Japanese + - [[@benlye](https://github.com/benlye)] + - [[@Tannoo](https://github.com/Tannoo)] + - [[@teemuatlut](https://github.com/teemuatlut)] + - [[@bgort](https://github.com/bgort)] + - [[@LVD-AC](https://github.com/LVD-AC)] + - [[@paulusjacobus](https://github.com/paulusjacobus)] - ...and many others ## License From 911a87e006bd79a6b493be7c674d5c20979d20ab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 May 2017 14:41:03 -0500 Subject: [PATCH 6/6] Disable SCARA feedrate scaling by default --- Marlin/Marlin_main.cpp | 6 +++--- Marlin/example_configurations/SCARA/Configuration.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 482d0f257a..2d685e3117 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -11136,7 +11136,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { // SERIAL_ECHOPAIR(" seconds=", seconds); // SERIAL_ECHOLNPAIR(" segments=", segments); - #if IS_SCARA + #if IS_SCARA && ENABLED(SCARA_FEEDRATE_SCALING) // SCARA needs to scale the feed rate from mm/s to degrees/s const float inv_segment_length = min(10.0, float(segments) / cartesian_mm), // 1/mm/segs feed_factor = inv_segment_length * _feedrate_mm_s; @@ -11163,7 +11163,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled - #if IS_SCARA + #if IS_SCARA && ENABLED(SCARA_FEEDRATE_SCALING) // For SCARA scale the feed rate from mm/s to degrees/s // Use ratio between the length of the move and the larger angle change const float adiff = abs(delta[A_AXIS] - oldA), @@ -11179,7 +11179,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { // Since segment_distance is only approximate, // the final move must be to the exact destination. - #if IS_SCARA + #if IS_SCARA && ENABLED(SCARA_FEEDRATE_SCALING) // For SCARA scale the feed rate from mm/s to degrees/s // With segments > 1 length is 1 segment, otherwise total length inverse_kinematics(ltarget); diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index fcaf75b4e7..d464efd3ca 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -76,6 +76,7 @@ #if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA) //#define DEBUG_SCARA_KINEMATICS + //#define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly // If movement is choppy try lowering this value #define SCARA_SEGMENTS_PER_SECOND 200