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

Option to configure or disable PRINTCOUNTER save interval #20856

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b8a32cb
Printcounter Fix (issue #20785)
ConstantijnCrijnen Jan 21, 2021
671cfe6
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into PRR/Printco…
sjasonsmith Jan 24, 2021
7c675fa
Add pc.abort method
thinkyhead Jan 25, 2021
2e3ab97
fixups
thinkyhead Jan 25, 2021
977eaa0
comments
thinkyhead Jan 25, 2021
2bf7c36
fixups
thinkyhead Jan 25, 2021
a0a94d3
synchronize is not sensible here
thinkyhead Jan 25, 2021
75c65df
Apply SEC_TO_MS
thinkyhead Jan 25, 2021
f6d2847
Use original save interval
thinkyhead Jan 25, 2021
71a4294
Longer interval
thinkyhead Jan 25, 2021
fd903e4
better
thinkyhead Jan 25, 2021
211aeb8
sync instead of disabling
thinkyhead Jan 25, 2021
2ac4108
.stop needed for non-sd
thinkyhead Jan 25, 2021
9e61b9a
Sync on any write
thinkyhead Jan 25, 2021
f39e2d9
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/20856
thinkyhead Jan 25, 2021
02d267f
etc
thinkyhead Jan 25, 2021
07c701b
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/20856
thinkyhead Jan 25, 2021
a5571df
Merge branch 'Printcounter-Fix-(issue-#20785)' of https://github.com/…
ConstantijnCrijnen Jan 25, 2021
57a6665
Revert "Merge branch 'Printcounter-Fix-(issue-#20785)' of https://git…
ConstantijnCrijnen Jan 25, 2021
8533b62
Merge branch 'bugfix-2.0.x' into Printcounter-Fix-(issue-#20785)
thinkyhead Jan 26, 2021
47b7dcb
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/20856
thinkyhead Jan 26, 2021
051944f
Update Configuration.h
thinkyhead Jan 26, 2021
6b9482d
fix spacing
thinkyhead Jan 26, 2021
112568a
Get back to known good state
thinkyhead Jan 26, 2021
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
6 changes: 5 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ void startOrResumeJob() {

inline void abortSDPrinting() {
IF_DISABLED(NO_SD_AUTOSTART, card.autofile_cancel());
Stopwatch::stop(); //without this, PRINTCOUNTER would count print as successful
card.endFilePrint(TERN_(SD_RESORT, true));
queue.clear();
quickstop_stepper();
print_job_timer.stop();
#if DISABLED(SD_ABORT_NO_COOLDOWN)
thermalManager.disable_all_heaters();
#endif
Expand All @@ -478,6 +478,10 @@ void startOrResumeJob() {
#ifdef EVENT_GCODE_SD_ABORT
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
#endif

//Wait for EVENT_GCODE_SD_ABORT to finish, so it doesn't get interrupted by PRINTCOUNTER
planner.synchronize();
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
print_job_timer.stop();

TERN_(PASSWORD_AFTER_SD_PRINT_ABORT, password.lock_machine());
}
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,4 @@
#define MB(V...) DO(MB,||,V)

#define IS_MELZI MB(MELZI, MELZI_CREALITY, MELZI_MAKR3D, MELZI_MALYAN, MELZI_TRONXY, MELZI_V2)
#define ENV_LPC1768 MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF, MKS_SBASE, MKS_SGEN_L, AZSMZ_MINI, BIQU_BQ111_A4, SELENA_COMPACT, BIQU_B300_V1_0, GMARSH_X6_REV1, BTT_SKR_V1_1, BTT_SKR_V1_3, BTT_SKR_V1_4)
1 change: 1 addition & 0 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V))
#define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V))
#define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V))
#define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V))
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V)
#define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V))
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 @@ -89,8 +89,8 @@
*/
void GcodeSuite::M81() {
thermalManager.disable_all_heaters();
print_job_timer.stop();
planner.finish_and_disable();
print_job_timer.stop(); //moved, so writing to eeprom doesn't interrupt queued planner moves

#if HAS_FAN
thermalManager.zero_fan_speeds();
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,9 @@ void MarlinUI::update() {
host_action_cancel();
#endif
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("UI Aborted"), DISMISS_STR));
print_job_timer.stop();
//print_job_timer.stop(); //is already called by abortSDPrinting().
//...so it would be called twice in case of SDPrinting
//
LCD_MESSAGEPGM(MSG_PRINT_ABORTED);
TERN_(HAS_LCD_MENU, return_to_status());
}
Expand Down
19 changes: 13 additions & 6 deletions Marlin/src/module/printcounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,15 @@ void PrintCounter::tick() {
update_next = now + updateInterval * 1000;
}

static uint32_t eeprom_next; // = 0
if (ELAPSED(now, eeprom_next)) {
eeprom_next = now + saveInterval * 1000;
saveStats();
}
#if !ENV_LPC1768
//LPC1769 boards seem to lose steps when saving to EEPROM during print (issue #20785)
//todo: Which other boards are incompatible?
static uint32_t eeprom_next; // = 0
if (ELAPSED(now, eeprom_next)) {
eeprom_next = now + saveInterval * 1000;
saveStats();
}
#endif
}

// @Override
Expand Down Expand Up @@ -281,7 +285,10 @@ bool PrintCounter::stop() {
saveStats();
return true;
}
else return false;
else {
saveStats();
return false;
}
}

// @Override
Expand Down