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

Adds filamentUsed and longestPrint stats to PrintCounter #4298

Merged

Conversation

jbrazio
Copy link
Contributor

@jbrazio jbrazio commented Jul 14, 2016

Fixes #4294.

Stats: Prints: 61, Finished: 46, Failed: 15
Stats: Total time: 2d 13h 6min, Longest job: 0d 8h 23min
Stats: Filament used: 15.19m

@jbrazio jbrazio added this to the 1.1.0 milestone Jul 14, 2016
@jbrazio jbrazio force-pushed the feature/filament-counter branch from 81b25fd to a4ba95e Compare July 14, 2016 01:40
@jbrazio jbrazio mentioned this pull request Jul 14, 2016
@thinkyhead
Copy link
Member

Nice. We could also display the total volume of filament. For example, if the filament were an average 2.98mm diameter: π * 1.49^2 * 15.19 gives a total volume of 10.59cc. If there were some way to translate that volume into weight (based on a material profile) it could calculate the material cost of the print too. Someday…

SERIAL_ECHOPGM("h ");

SERIAL_ECHO(l % 60);
SERIAL_ECHOPGM("min");
Copy link
Member

@thinkyhead thinkyhead Jul 14, 2016

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.

Copy link
Member

@thinkyhead thinkyhead Jul 14, 2016

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.

Copy link
Contributor Author

@jbrazio jbrazio Jul 14, 2016

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());

Copy link
Member

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.

@RDickens
Copy link

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.

@jbrazio
Copy link
Contributor Author

jbrazio commented Jul 14, 2016

"Filament used" is an accumulative counter.

static uint32_t update_before = millis(),
eeprom_before = millis();
static uint32_t update_last = millis(),
eeprom_last = millis();
Copy link
Member

@thinkyhead thinkyhead Jul 15, 2016

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.

@jbrazio jbrazio force-pushed the feature/filament-counter branch from a4ba95e to 2f26bc2 Compare July 16, 2016 11:12
@thinkyhead thinkyhead merged commit 0228566 into MarlinFirmware:RCBugFix Jul 17, 2016
@jbrazio jbrazio deleted the feature/filament-counter branch July 17, 2016 17:29
This was referenced Jul 22, 2016
drewmoseley pushed a commit to drewmoseley/Marlin that referenced this pull request Feb 10, 2024
TM: Fix TM calibration from the Calibration menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants