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

Added Layers & Estimated time finish #136

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

victor7376
Copy link

Added 3 new screens:

  • Layer progress
  • Estimated time to finish (actual clock time)
  • Next update

Also for the layer progress the code switches between different size fonts if the layer size is equal or greater than 1000.

added these features into OctoprintClient & RepetierClient.

Added in Current Layer & Estimated End time (Clock) for print.
Added in Total Layers and changed the size of the font of the number of layers to a smaller size.
Added Time till next update
Added Layer & Estimated Time in webpage
Updated Readme to state new features
Updated Layer screen to change between font sizes depending on how many layers are printing.
Also added the features to RepetierClient
Fixed an issue for the text showing on Printer Layers screen.
Compiled BIN for D1 Mini including all the features that are within the INO file
@samwiseg0
Copy link

samwiseg0 commented Jun 15, 2021

@victor7376 Any chance you could honor the 12/24hour config value for End time? Maybe even a step further if the end time is not today display date and time?

@victor7376
Copy link
Author

@samwiseg0 the screens take the information from the DisplayLayerProgress plug-in, so what ever is displayed there is shown on the screens.

@samwiseg0
Copy link

samwiseg0 commented Jun 15, 2021

@victor7376 I understand. I think ETA would be better calculated by using current time and adding seconds left. That would allow the ETA time to be formatted properly. Currently with the value you selected it is just a string value for time and is only formatted in 24hrs. I am suggesting to use remaining seconds and calculate that value.

@victor7376
Copy link
Author

When I've got my printer back up and running I'll take a look.

@samwiseg0
Copy link

When I've got my printer back up and running I'll take a look.

Thank you. I have been poking at it with little success. I am very new to arruino. I have been able to make some other minor modifications but I have not been able to get this modification to work successfully.

Thank your your time. Much appreciated

@victor7376
Copy link
Author

if you want if you post what you have coded, could take a look at it.

@samwiseg0
Copy link

if you want if you post what you have coded, could take a look at it.

I am mostly stuck on trying to get current time in seconds.

My thought was. If I get current time in seconds then I can add remaining seconds to it. Then format it in either date time or just time if the date is today.

Much like the example given in the issue.

finish_time = current_time + datetime.timedelta(0,currentData["progress"]["printTimeLeft"])

I was looking at TimeClient() but I am unsure if that is the correct way to go.

@victor7376
Copy link
Author

I could see what you were trying to do, but I couldnt work it out myself. I have however found out that Display Layer Progress has a feature that shows you the day of the week when a print will finish. The guy who makes the plugin is planning a new update for the clock in a future release.

In Display Layer Progress plugin change the following option to what's shown and it will give you the day of the week.

%A = Full weekday name.
%H = 24 hour
%M = minutes
%I (capital i ) = 12 hour clock

Hope this helps.

90291828-fec93200-de80-11ea-8dd0-7cdc4c78e289

@samwiseg0
Copy link

samwiseg0 commented Jun 15, 2021

That certainly is a much easier approach. I made the changes in the plugin config and it is much more useable now. I do wish it only showed the date when it was not today. But that is a bit more minor. Thank you for pointing that out.

As a side note, another issue I came across is when the printer is paused it shows as offline.

I modified OctoPrintClient.cpp to include paused in the printing state so it does not show as offline. It's a hacky workaround but it at least still shows the data vs saying its offline. A proper screen showing the printer paused would be ideal as that is the state it is in when lets say the filament sensor is tripped or is paused for a filament change. I will keep messing with it and see if I cant add that functionality unless someone else more familiar with C++ gets to it first 😆

  String printing = (const char*)root2["state"]["flags"]["printing"];
  String paused = (const char*)root2["state"]["flags"]["paused"];
  if (printing == "true" || paused == "true") {
    printerData.isPrinting = true;
  } else {
    printerData.isPrinting = false;
  }

Thanks again for your help.

@victor7376
Copy link
Author

No problem, I do know how to make new screens, I’ll take a look tomorrow regarding pausing screen.

@samwiseg0
Copy link

samwiseg0 commented Jun 15, 2021

I was able to change the main status bar by doing the following. It now shows paused instead of the percentage.

OctoPrintClient.cpp

boolean OctoPrintClient::isPaused() {
  boolean paused = false;
  if (printerData.state == "Paused") {
    paused = true;
  }
  return paused;
}

printermonitor.ino

void drawHeaderOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {
  display->setColor(WHITE);
  display->setFont(ArialMT_Plain_16);
  String displayTime = timeClient.getAmPmHours() + ":" + timeClient.getMinutes();
  if (IS_24HOUR) {
    displayTime = timeClient.getHours() + ":" + timeClient.getMinutes();
  }
  display->setTextAlignment(TEXT_ALIGN_LEFT);
  display->drawString(0, 48, displayTime);

  if (!IS_24HOUR) {
    String ampm = timeClient.getAmPm();
    display->setFont(ArialMT_Plain_10);
    display->drawString(39, 54, ampm);
  }

  if (printerClient.isPaused()) {
    display->setFont(ArialMT_Plain_10);
    display->setTextAlignment(TEXT_ALIGN_LEFT);
    String paused = "Paused";
    display->drawString(64, 51, paused);
  }
  else {
    display->setFont(ArialMT_Plain_16);
    display->setTextAlignment(TEXT_ALIGN_LEFT);
    String percent = String(printerClient.getProgressCompletion()) + "%";
    display->drawString(64, 48, percent);
  }
  // Draw indicator to show next update
  int updatePos = (printerClient.getProgressCompletion().toFloat() / float(100)) * 128;
  display->drawRect(0, 41, 128, 6);
  display->drawHorizontalLine(0, 42, updatePos);
  display->drawHorizontalLine(0, 43, updatePos);
  display->drawHorizontalLine(0, 44, updatePos);
  display->drawHorizontalLine(0, 45, updatePos);

  drawRssi(display);
}

@victor7376
Copy link
Author

nice work, it has also given me an idea for something else. When a print is paused for example to change the filament a new screen appears informing the user regarding the pause.

@samwiseg0
Copy link

samwiseg0 commented Jun 16, 2021

@victor7376 I rebased off your branch and made additional changes. Hopefully @Qrome can merge your changes in so I can PR against them. Either way feel free to implement them in your fork if you wish.

The most notable changes are:

  • Add the ability to configure screen brightness.
  • Continue to display print information even when paused. Also change the percentage to "Paused" in the status bar.

Changes:
https://github.com/victor7376/printer-monitor/compare/master...samwiseg0:add_features?expand=1

Precompiled Binaries:
v3.0_printermonitor.ino.d1_mini_pause_brightness.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants