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

Estimate Remaining Time (graphical display) #15497

Merged

Conversation

LinFor
Copy link
Contributor

@LinFor LinFor commented Oct 9, 2019

This is currently in draft so I can do more testing on real hardware.

Description

  1. Added optional time-to-print-completion estimation based on current elapsed print time and current progress estimation. It prints together with elapsed time via blinking, estimated completion time prefixed with "E" letter. (PRINT_PROGRESS_ESTIMATE_TIME_TO_COMPLETION)
  2. To increase precision of estimation added ability to calculate progress in permyads (1/100 of percent and 1/10000 of whole). This is done in fixed-point math via uint16 (instead of uint8).
  3. Added optional ability to show calculated print progress with up to 2 decimal digits (PRINT_PROGRESS_SHOW_DECIMALS).
  4. M73 command now can accept fractional P argument to support above scenarios.
  5. Implemented caching of print progress / elapsed time / estimated completion time calculation results to decrease CPU cycles usage. Buffers are prepared during the "first-page" preparation and updates only if progress changed or 1 second has passed.

All of these is done only for DOGM displays, but possible for another ones (but I hasn't somthing another hardware for testing).

Benefits

Ability to estimate time to print completion.
Ability to more precise estimate print progress for long-running prints.

Demo

demonstration

Related Issues

#12123, #8515, #2181

@LinFor LinFor force-pushed the pr_time_to_completion_estimation branch from 5cad9f1 to 31f3b67 Compare October 9, 2019 12:47
@thinkyhead thinkyhead marked this pull request as ready for review October 10, 2019 01:45
@thinkyhead thinkyhead force-pushed the pr_time_to_completion_estimation branch 2 times, most recently from e212008 to 6428bec Compare October 10, 2019 06:46
Marlin/src/lcd/ultralcd.h Outdated Show resolved Hide resolved
@LinFor
Copy link
Contributor Author

LinFor commented Oct 10, 2019

I have a strange issue with LCD and seems that this PR not related to them.

When I print from SD file without M73 commands in it - LCD updates as usual, once per second: https://youtu.be/6oVtPs9nY8I
When I print from SD same file but with M73 commands - LCD starts to update very quickly. This is visible in X/Y/Z position counters and temperatures - which code I didn't touched at all: https://youtu.be/ktYBHKg6h7A (sorry for video orientation - i don't know how rotate video on youtube quickly).

Problem is that later LCD freezes - probably due to very high mcu load from lcd calculation and drawing.

I have no idea how this matters.

@LinFor LinFor force-pushed the pr_time_to_completion_estimation branch from 77b2649 to 547b134 Compare October 10, 2019 12:40
@LinFor
Copy link
Contributor Author

LinFor commented Oct 10, 2019

I made some investigation about "quick LCD updating". It's not relevant to this PR or M73 command at all, instead it occurs after any M117 command. Probably, we must create a bug.
Also, LCD freezes gone after increasing DOGM_SPI_DELAY_US up to 15, so it's problem with my hardware.

@thinkyhead
Copy link
Member

Probably, we must create a bug.

The solution is to comment out the refresh() at the end of MarlinUI::finish_status.

@thinkyhead thinkyhead force-pushed the pr_time_to_completion_estimation branch from 8c2e8cc to 9e121ef Compare October 11, 2019 02:02
@thinkyhead thinkyhead merged commit b20d5a7 into MarlinFirmware:bugfix-2.0.x Oct 11, 2019
@thinkyhead thinkyhead changed the title Time to completion estimation for DOGM displays Estimate Remaining Time (graphical display) Oct 11, 2019
@randellhodges
Copy link
Contributor

I think there is an issue around this line:

if (!WITHIN(i, -99, 999)) return i16tostr4sign((int)f);

Marlin\src\libs\numtostr.cpp: In function 'char* ftostr4sign(const float&)':
Marlin\src\libs\numtostr.cpp:206:51: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
     if (!WITHIN(i, -99, 999)) return i16tostr4sign((int)f);
                                      ~~~~~~~~~~~~~^~~~~~~~
*** [.pio\build\LPC1768\src\src\libs\numtostr.cpp.o] Error 1

@LinFor LinFor mentioned this pull request Oct 11, 2019
@LinFor
Copy link
Contributor Author

LinFor commented Oct 11, 2019

Here is fixup: LinFor@a732649

rolkun pushed a commit to rolkun/Marlin that referenced this pull request Oct 25, 2019
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.

None yet

3 participants