Skip to content

Commit

Permalink
Differentiated between printed and elapsed time (#75)
Browse files Browse the repository at this point in the history
Co-authored-by: Kurt Haenen <[email protected]>
  • Loading branch information
Misterke and Kurt Haenen authored Mar 26, 2024
1 parent 38a1acb commit ad68095
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CYD-Klipper/src/core/data_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ void fetch_printer_data()
const char *filename = status["print_stats"]["filename"];
strcpy(filename_buff, filename);
printer.print_filename = filename_buff;
printer.elapsed_time_s = status["print_stats"]["print_duration"];
printer.elapsed_time_s = status["print_stats"]["total_duration"];
printer.printed_time_s = status["print_stats"]["print_duration"];
printer.filament_used_mm = status["print_stats"]["filament_used"];
printer.total_layers = status["print_stats"]["info"]["total_layer"];
printer.current_layer = status["print_stats"]["info"]["current_layer"];
Expand Down Expand Up @@ -248,12 +249,12 @@ void fetch_printer_data()

if (printer.state == PRINTER_STATE_PRINTING && printer.print_progress > 0)
{
float remaining_time_s_percentage = (printer.elapsed_time_s / printer.print_progress) - printer.elapsed_time_s;
float remaining_time_s_percentage = (printer.printed_time_s / printer.print_progress) - printer.printed_time_s;
float remaining_time_s_slicer = 0;

if (printer.slicer_estimated_print_time_s > 0)
{
remaining_time_s_slicer = printer.slicer_estimated_print_time_s - printer.elapsed_time_s;
remaining_time_s_slicer = printer.slicer_estimated_print_time_s - printer.printed_time_s;
}

if (remaining_time_s_slicer <= 0 || config->remaining_time_calc_mode == REMAINING_TIME_CALC_PERCENTAGE)
Expand Down
1 change: 1 addition & 0 deletions CYD-Klipper/src/core/data_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef struct _Printer {
unsigned char homed_axis;
unsigned char absolute_coords;
float elapsed_time_s;
float printed_time_s;
float remaining_time_s;
float filament_used_mm;
char* print_filename;
Expand Down

0 comments on commit ad68095

Please sign in to comment.