-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
Adds filamentUsed and longestPrint stats to PrintCounter #4298
Adds filamentUsed and longestPrint stats to PrintCounter #4298
Conversation
81b25fd
to
a4ba95e
Compare
Nice. We could also display the total volume of filament. For example, if the filament were an average 2.98mm diameter: |
SERIAL_ECHOPGM("h "); | ||
|
||
SERIAL_ECHO(l % 60); | ||
SERIAL_ECHOPGM("min"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d h min
instead of d h m
?
Lately I've been favoring d:hh:mm:ss
for times, as they are straightforward and compact. Well, actually with M31
I went with…
inline void gcode_M31() {
millis_t t = print_job_timer.duration();
int d = int(t / 60 / 60 / 24),
h = int(t / 60 / 60) % 60,
m = int(t / 60) % 60,
s = int(t % 60);
char time[30];
if (d)
sprintf_P(time, PSTR("%i:%02i:%02i:%02i"), d, h, m, s);
else if (h)
sprintf_P(time, PSTR("%02i:%02i:%02i"), h, m, s);
else
sprintf_P(time, PSTR("%02i:%02i"), m, s);
lcd_setstatus(time);
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
SERIAL_ECHOLN(time);
thermalManager.autotempShutdown();
}
I guess there could be some confusion with mm:ss
because it could be interpreted as hh:mm
. So maybe the d h m s
convention is more clear. I do think it's fine to leave off 0d
, 0h
, etc., for any of the time components that are zero. So you could see 1d 25s
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone back to the 1d 2h 3m 4s
format. And in fact, I'm thinking we can replace the time report at the end of SD printing with a simple call to M31
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a datetime struct that we could reuse everywhere ?
datetime_t t = print_job_timer.duration();
/*
Example usage:
int d = t.days();
h = t.hours(),
m = t.minutes(),
s = t.seconds();
*/
lcd_setstatus(t.toString());
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_PRINT_TIME " ");
SERIAL_ECHOLN(t.toString());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So long as it's reasonably economical compared to the existing code.
For the filament used counter I was actually thinking of a running total so you could see how many hundreds of meters has been used. This would be handy to help plan service intervals on my printer and reduce down time. |
"Filament used" is an accumulative counter. |
static uint32_t update_before = millis(), | ||
eeprom_before = millis(); | ||
static uint32_t update_last = millis(), | ||
eeprom_last = millis(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is millis()
a volatile
function? If so, this will compile 2 function calls. Otherwise it will init in one go.
a4ba95e
to
2f26bc2
Compare
TM: Fix TM calibration from the Calibration menu
Fixes #4294.