Return buffer in duration.toString
This commit is contained in:
parent
dc65788511
commit
d683f98019
@ -31,8 +31,8 @@
|
|||||||
*/
|
*/
|
||||||
void GcodeSuite::M31() {
|
void GcodeSuite::M31() {
|
||||||
char buffer[21];
|
char buffer[21];
|
||||||
duration_t elapsed = print_job_timer.duration();
|
duration_t(print_job_timer.duration()).toString(buffer);
|
||||||
elapsed.toString(buffer);
|
|
||||||
ui.set_status(buffer);
|
ui.set_status(buffer);
|
||||||
|
|
||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
|
@ -842,8 +842,8 @@ namespace ExtUI {
|
|||||||
#if ENABLED(PRINTCOUNTER)
|
#if ENABLED(PRINTCOUNTER)
|
||||||
char* getTotalPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().totalPrints)); return buffer; }
|
char* getTotalPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().totalPrints)); return buffer; }
|
||||||
char* getFinishedPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().finishedPrints)); return buffer; }
|
char* getFinishedPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().finishedPrints)); return buffer; }
|
||||||
char* getTotalPrintTime_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; }
|
char* getTotalPrintTime_str(char buffer[21]) { return duration_t(print_job_timer.getStats().printTime).toString(buffer); }
|
||||||
char* getLongestPrint_str(char buffer[21]) { duration_t(print_job_timer.getStats().longestPrint).toString(buffer); return buffer; }
|
char* getLongestPrint_str(char buffer[21]) { return duration_t(print_job_timer.getStats().longestPrint).toString(buffer); }
|
||||||
char* getFilamentUsed_str(char buffer[21]) {
|
char* getFilamentUsed_str(char buffer[21]) {
|
||||||
printStatistics stats = print_job_timer.getStats();
|
printStatistics stats = print_job_timer.getStats();
|
||||||
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10);
|
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10);
|
||||||
|
@ -59,40 +59,29 @@
|
|||||||
STATIC_PAIR(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), false); // Print Count: 999
|
STATIC_PAIR(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), false); // Print Count: 999
|
||||||
STATIC_PAIR(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), false); // Completed : 666
|
STATIC_PAIR(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), false); // Completed : 666
|
||||||
|
|
||||||
duration_t elapsed = stats.printTime;
|
|
||||||
elapsed.toString(buffer);
|
|
||||||
|
|
||||||
STATIC_PAIR_P(MSG_INFO_PRINT_TIME, "", false); // Total print Time:
|
STATIC_PAIR_P(MSG_INFO_PRINT_TIME, "", false); // Total print Time:
|
||||||
STATIC_ITEM("> ", false, false, buffer); // > 99y 364d 23h 59m 59s
|
STATIC_ITEM("> ", false, false, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s
|
||||||
|
|
||||||
STATIC_PAIR_P(MSG_INFO_PRINT_LONGEST, "", false); // Longest job time:
|
STATIC_PAIR_P(MSG_INFO_PRINT_LONGEST, "", false); // Longest job time:
|
||||||
elapsed = stats.longestPrint;
|
STATIC_ITEM("> ", false, false, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s
|
||||||
elapsed.toString(buffer);
|
|
||||||
STATIC_ITEM("> ", false, false, buffer); // > 99y 364d 23h 59m 59s
|
|
||||||
|
|
||||||
STATIC_PAIR_P(MSG_INFO_PRINT_FILAMENT, "", false); // Extruded total:
|
STATIC_PAIR_P(MSG_INFO_PRINT_FILAMENT, "", false); // Extruded total:
|
||||||
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10);
|
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10);
|
||||||
STATIC_ITEM("> ", false, false, buffer); // > 125m
|
STATIC_ITEM("> ", false, false, buffer); // > 125m
|
||||||
|
|
||||||
#if SERVICE_INTERVAL_1 > 0
|
#if SERVICE_INTERVAL_1 > 0
|
||||||
elapsed = stats.nextService1;
|
|
||||||
elapsed.toString(buffer);
|
|
||||||
STATIC_ITEM(SERVICE_NAME_1 MSG_SERVICE_IN, false, false); // Service X in:
|
STATIC_ITEM(SERVICE_NAME_1 MSG_SERVICE_IN, false, false); // Service X in:
|
||||||
STATIC_ITEM("> ", false, false, buffer); // > 7d 12h 11m 10s
|
STATIC_ITEM("> ", false, false, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERVICE_INTERVAL_2 > 0
|
#if SERVICE_INTERVAL_2 > 0
|
||||||
elapsed = stats.nextService2;
|
|
||||||
elapsed.toString(buffer);
|
|
||||||
STATIC_ITEM(SERVICE_NAME_2 MSG_SERVICE_IN, false, false);
|
STATIC_ITEM(SERVICE_NAME_2 MSG_SERVICE_IN, false, false);
|
||||||
STATIC_ITEM("> ", false, false, buffer);
|
STATIC_ITEM("> ", false, false, duration_t(stats.nextService2).toString(buffer));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SERVICE_INTERVAL_3 > 0
|
#if SERVICE_INTERVAL_3 > 0
|
||||||
elapsed = stats.nextService3;
|
|
||||||
elapsed.toString(buffer);
|
|
||||||
STATIC_ITEM(SERVICE_NAME_3 MSG_SERVICE_IN, false, false);
|
STATIC_ITEM(SERVICE_NAME_3 MSG_SERVICE_IN, false, false);
|
||||||
STATIC_ITEM("> ", false, false, buffer);
|
STATIC_ITEM("> ", false, false, duration_t(stats.nextService3).toString(buffer));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
END_SCREEN();
|
END_SCREEN();
|
||||||
|
@ -120,7 +120,7 @@ struct duration_t {
|
|||||||
* 59m 59s
|
* 59m 59s
|
||||||
* 59s
|
* 59s
|
||||||
*/
|
*/
|
||||||
void toString(char *buffer) const {
|
char* toString(char * const buffer) const {
|
||||||
int y = this->year(),
|
int y = this->year(),
|
||||||
d = this->day() % 365,
|
d = this->day() % 365,
|
||||||
h = this->hour() % 24,
|
h = this->hour() % 24,
|
||||||
@ -132,6 +132,7 @@ struct duration_t {
|
|||||||
else if (h) sprintf_P(buffer, PSTR("%ih %im %is"), h, m, s);
|
else if (h) sprintf_P(buffer, PSTR("%ih %im %is"), h, m, s);
|
||||||
else if (m) sprintf_P(buffer, PSTR("%im %is"), m, s);
|
else if (m) sprintf_P(buffer, PSTR("%im %is"), m, s);
|
||||||
else sprintf_P(buffer, PSTR("%is"), s);
|
else sprintf_P(buffer, PSTR("%is"), s);
|
||||||
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,11 +183,9 @@ void PrintCounter::saveStats() {
|
|||||||
|
|
||||||
#if HAS_SERVICE_INTERVALS
|
#if HAS_SERVICE_INTERVALS
|
||||||
inline void _service_when(char buffer[], const char * const msg, const uint32_t when) {
|
inline void _service_when(char buffer[], const char * const msg, const uint32_t when) {
|
||||||
duration_t elapsed = when;
|
|
||||||
elapsed.toString(buffer);
|
|
||||||
SERIAL_ECHOPGM(MSG_STATS);
|
SERIAL_ECHOPGM(MSG_STATS);
|
||||||
serialprintPGM(msg);
|
serialprintPGM(msg);
|
||||||
SERIAL_ECHOLNPAIR(" in ", buffer);
|
SERIAL_ECHOLNPAIR(" in ", duration_t(when).toString(buffer));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user