Skip to content

Commit

Permalink
Merge branch 'Printcounter-Fix-(issue-MarlinFirmware#20785)' of https…
Browse files Browse the repository at this point in the history
  • Loading branch information
ConstantijnCrijnen committed Jan 25, 2021
2 parents 977eaa0 + 07c701b commit a5571df
Show file tree
Hide file tree
Showing 30 changed files with 633 additions and 749 deletions.
5 changes: 4 additions & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
#define TEMP_SENSOR_CHAMBER 0

// Dummy thermistor constant temperature readings, for use with 998 and 999
#define DUMMY_THERMISTOR_998_VALUE 25
#define DUMMY_THERMISTOR_998_VALUE 25
#define DUMMY_THERMISTOR_999_VALUE 100

// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
Expand Down Expand Up @@ -1753,6 +1753,9 @@
* View the current statistics with M78.
*/
//#define PRINTCOUNTER
#if ENABLED(PRINTCOUNTER)
#define PRINTCOUNTER_SAVE_INTERVAL 60 // (minutes) EEPROM save interval during print
#endif

/**
* Password
Expand Down
34 changes: 17 additions & 17 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
#if ENABLED(CHAMBER_VENT)
#define CHAMBER_VENT_SERVO_NR 1 // Index of the vent servo
#define HIGH_EXCESS_HEAT_LIMIT 5 // How much above target temp to consider there is excess heat in the chamber
#define LOW_EXCESS_HEAT_LIMIT 3
#define LOW_EXCESS_HEAT_LIMIT 3
#define MIN_COOLING_SLOPE_TIME_CHAMBER_VENT 20
#define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5
#endif
Expand Down Expand Up @@ -206,7 +206,7 @@
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
* below 2.
*/
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
#endif

Expand Down Expand Up @@ -284,8 +284,8 @@
// DEFAULT_Kf and PID_FAN_SCALING_LIN_FACTOR are calculated accordingly.

#define PID_FAN_SCALING_AT_FULL_SPEED 13.0 //=PID_FAN_SCALING_LIN_FACTOR*255+DEFAULT_Kf
#define PID_FAN_SCALING_AT_MIN_SPEED 6.0 //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf
#define PID_FAN_SCALING_MIN_SPEED 10.0 // Minimum fan speed at which to enable PID_FAN_SCALING
#define PID_FAN_SCALING_AT_MIN_SPEED 6.0 //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf
#define PID_FAN_SCALING_MIN_SPEED 10.0 // Minimum fan speed at which to enable PID_FAN_SCALING

#define DEFAULT_Kf (255.0*PID_FAN_SCALING_AT_MIN_SPEED-PID_FAN_SCALING_AT_FULL_SPEED*PID_FAN_SCALING_MIN_SPEED)/(255.0-PID_FAN_SCALING_MIN_SPEED)
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0
Expand Down Expand Up @@ -2056,21 +2056,21 @@
*/
//#define FWRETRACT
#if ENABLED(FWRETRACT)
#define FWRETRACT_AUTORETRACT // Override slicer retractions
#define FWRETRACT_AUTORETRACT // Override slicer retractions
#if ENABLED(FWRETRACT_AUTORETRACT)
#define MIN_AUTORETRACT 0.1 // (mm) Don't convert E moves under this length
#define MAX_AUTORETRACT 10.0 // (mm) Don't convert E moves over this length
#endif
#define RETRACT_LENGTH 3 // (mm) Default retract length (positive value)
#define RETRACT_LENGTH_SWAP 13 // (mm) Default swap retract length (positive value)
#define RETRACT_FEEDRATE 45 // (mm/s) Default feedrate for retracting
#define RETRACT_ZRAISE 0 // (mm) Default retract Z-raise
#define RETRACT_RECOVER_LENGTH 0 // (mm) Default additional recover length (added to retract length on recover)
#define RETRACT_RECOVER_LENGTH_SWAP 0 // (mm) Default additional swap recover length (added to retract length on recover from toolchange)
#define RETRACT_RECOVER_FEEDRATE 8 // (mm/s) Default feedrate for recovering from retraction
#define RETRACT_RECOVER_FEEDRATE_SWAP 8 // (mm/s) Default feedrate for recovering from swap retraction
#define MIN_AUTORETRACT 0.1 // (mm) Don't convert E moves under this length
#define MAX_AUTORETRACT 10.0 // (mm) Don't convert E moves over this length
#endif
#define RETRACT_LENGTH 3 // (mm) Default retract length (positive value)
#define RETRACT_LENGTH_SWAP 13 // (mm) Default swap retract length (positive value)
#define RETRACT_FEEDRATE 45 // (mm/s) Default feedrate for retracting
#define RETRACT_ZRAISE 0 // (mm) Default retract Z-raise
#define RETRACT_RECOVER_LENGTH 0 // (mm) Default additional recover length (added to retract length on recover)
#define RETRACT_RECOVER_LENGTH_SWAP 0 // (mm) Default additional swap recover length (added to retract length on recover from toolchange)
#define RETRACT_RECOVER_FEEDRATE 8 // (mm/s) Default feedrate for recovering from retraction
#define RETRACT_RECOVER_FEEDRATE_SWAP 8 // (mm/s) Default feedrate for recovering from swap retraction
#if ENABLED(MIXING_EXTRUDER)
//#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously
//#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously
#endif
#endif

Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/HAL/LPC1768/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@
#elif EITHER(I2C_EEPROM, SPI_EEPROM)
#define USE_SHARED_EEPROM 1
#endif

// LPC1768 boards seem to lose steps when saving to EEPROM during print (issue #20785)
// TODO: Which other boards are incompatible?
#if defined(MCU_LPC1768) && PRINTCOUNTER_SAVE_INTERVAL > 0
#warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
#define PRINTCOUNTER_SYNC 1
#endif
26 changes: 12 additions & 14 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,25 +362,24 @@ void startOrResumeJob() {
inline void abortSDPrinting() {
IF_DISABLED(NO_SD_AUTOSTART, card.autofile_cancel());
card.endFilePrint(TERN_(SD_RESORT, true));

queue.clear();
quickstop_stepper();
#if DISABLED(SD_ABORT_NO_COOLDOWN)
thermalManager.disable_all_heaters();
#endif
#if !HAS_CUTTER
thermalManager.zero_fan_speeds();
#else
cutter.kill(); // Full cutter shutdown including ISR control
#endif

print_job_timer.abort();

IF_DISABLED(SD_ABORT_NO_COOLDOWN, thermalManager.disable_all_heaters());

TERN(HAS_CUTTER, cutter.kill(), thermalManager.zero_fan_speeds()); // Full cutter shutdown including ISR control

wait_for_heatup = false;

TERN_(POWER_LOSS_RECOVERY, recovery.purge());

#ifdef EVENT_GCODE_SD_ABORT
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
#endif

planner.synchronize();
print_job_timer.abort(); // Wait for planner before calling!

TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
}

Expand Down Expand Up @@ -786,8 +785,7 @@ void minkill(const bool steppers_off/*=false*/) {
void stop() {
thermalManager.disable_all_heaters(); // 'unpause' taken care of in here

planner.synchronize();
print_job_timer.stop(); // Wait for planner before calling!
print_job_timer.stop();

#if ENABLED(PROBING_FANS_OFF)
if (thermalManager.fans_paused) thermalManager.set_fans_paused(false); // put things back the way they were
Expand Down Expand Up @@ -957,7 +955,7 @@ void setup() {
#endif

#if HAS_SUICIDE
SETUP_LOG("SUICIDE_PIN")
SETUP_LOG("SUICIDE_PIN");
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/control/M80_M81.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void GcodeSuite::M81() {
thermalManager.disable_all_heaters();
planner.finish_and_disable();

print_job_timer.stop(); // Wait for planner before calling!
print_job_timer.stop();

#if HAS_FAN
thermalManager.zero_fan_speeds();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/L6470/M916-918.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void GcodeSuite::M916() {
M91x_counter_max = 256; // KVAL_HOLD is 8 bits

uint8_t M91x_delay_s = parser.byteval('D'); // get delay in seconds
millis_t M91x_delay_ms = M91x_delay_s * 60 * 1000;
millis_t M91x_delay_ms = SEC_TO_MS(M91x_delay_s * 60);
millis_t M91x_delay_end;

DEBUG_ECHOLNPGM(".\n.");
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class GCodeParser {

// Code value for use as time
static inline millis_t value_millis() { return value_ulong(); }
static inline millis_t value_millis_from_seconds() { return (millis_t)(value_float() * 1000); }
static inline millis_t value_millis_from_seconds() { return (millis_t)SEC_TO_MS(value_float()); }

// Reduce to fewer bits
static inline int16_t value_int() { return (int16_t)value_long(); }
Expand Down
43 changes: 22 additions & 21 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -1155,36 +1155,37 @@
#endif
#endif

#if ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 240
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_320x240_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_320x240
#endif
#elif ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 320
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_480x320_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_480x320
#endif
#elif ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 272
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_480x272_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_480x272
#if ENABLED(TFT_COLOR_UI)
#if TFT_HEIGHT == 240
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_320x240_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_320x240
#endif
#elif TFT_HEIGHT == 320
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_480x320_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_480x320
#endif
#elif TFT_HEIGHT == 272
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_480x272_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_480x272
#endif
#endif
#endif

// Fewer lines with touch buttons on-screen
#if EITHER(TFT_320x240, TFT_320x240_SPI)
#define HAS_UI_320x240 1
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#elif EITHER(TFT_480x320, TFT_480x320_SPI)
#define HAS_UI_480x320 1
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#elif EITHER(TFT_480x272, TFT_480x272_SPI)
#define HAS_UI_480x272 1
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#endif
#if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272)
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen
#endif

// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if ENABLED(BABYSTEP_XY)
static_assert(BABYSTEP_MULTIPLICATOR_XY <= 0.25f, "BABYSTEP_MULTIPLICATOR_XY must be less than or equal to 0.25mm.");
#endif
#elif ENABLED(BABYSTEP_DISPLAY_TOTAL) && ANY(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)
#error "New Color UI (TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI) does not support BABYSTEP_DISPLAY_TOTAL yet."
#endif
#endif

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 "2021-01-24"
#define STRING_DISTRIBUTION_DATE "2021-01-25"
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/dogm_Statusscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
#define STATUS_LOGO_HEIGHT (sizeof(status_logo_bmp) / (STATUS_LOGO_BYTEWIDTH))
#endif
#ifndef STATUS_LOGO_Y
#define STATUS_LOGO_Y _MAX(0L, (28L - _MIN(28L, STATUS_LOGO_HEIGHT)) / 2L)
#define STATUS_LOGO_Y _MAX(0U, (28U - _MIN(28U, STATUS_LOGO_HEIGHT)) / 2U)
#endif
static_assert(
sizeof(status_logo_bmp) == (STATUS_LOGO_BYTEWIDTH) * (STATUS_LOGO_HEIGHT),
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@

#include "../../gcode/parser.h" // for units (and volumetric)

#if ENABLED(LCD_SHOW_E_TOTAL)
#include "../../MarlinCore.h" // for printingIsActive(), marlin_state and MF_SD_COMPLETE
#endif

#if ENABLED(FILAMENT_LCD_DISPLAY)
#include "../../feature/filwidth.h"
#include "../../module/planner.h"
Expand Down
Loading

0 comments on commit a5571df

Please sign in to comment.