Files
marlin_skr/Marlin/src/lcd/e3v2/enhanced/printstats.cpp
Miguel Risco-Castillo d58daaa42c 🚸 DWIN Enhanced improve, fix, and extend (#23240)
- Offset icon change to show mesh leveling status
- Reset extruder position when enter to Move menu
- New live end-stop diagnostic page
- Editable firmware retracts settings for Tune and filament settings menu
- Print Statistics page accessible from the Advanced Settings menu
- Reset printer draws the boot image
- Adds individual axes homing menu
- Adds probe deploy/stow to Probe Settings menu
- Updates lock screen
- Rebuilds main buttons to support text caption in other languages
- Increases probe offset limits to 60 mm
- Fix M303 PID variable update
- Fix Resume/Pause button update
- Fix redraw of print done
- Fix very large file name bug
- Fix bug in bed manual leveling
2021-12-27 23:23:50 -06:00

77 lines
2.5 KiB
C++

/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* DWIN Print Stats page
* Author: Miguel A. Risco-Castillo
* Version: 1.0
* Date: 2021/11/21
*/
#include "../../../inc/MarlinConfigPre.h"
#if BOTH(DWIN_CREALITY_LCD_ENHANCED, PRINTCOUNTER)
#include "printstats.h"
#include "../../../core/types.h"
#include "../../marlinui.h"
#include "../../../module/printcounter.h"
#include "dwin_lcd.h"
#include "dwinui.h"
#include "dwin_popup.h"
#include "dwin.h"
PrintStatsClass PrintStats;
void PrintStatsClass::Draw() {
char buf[50] = "";
char str[30] = "";
constexpr int8_t MRG = 30;
Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
DWINUI::ClearMenuArea();
Draw_Popup_Bkgd();
DWINUI::Draw_Icon(ICON_Continue_E, 86, 250);
printStatistics ps = print_job_timer.getStats();
sprintf_P(buf, PSTR("%s: %i"), GET_TEXT(MSG_INFO_PRINT_COUNT), ps.totalPrints);
DWINUI::Draw_String(MRG, 80, buf);
sprintf_P(buf, PSTR("%s: %i"), GET_TEXT(MSG_INFO_COMPLETED_PRINTS), ps.finishedPrints);
DWINUI::Draw_String(MRG, 100, buf);
duration_t(print_job_timer.getStats().printTime).toDigital(str, true);
sprintf_P(buf, PSTR("%s: %s"), GET_TEXT(MSG_INFO_PRINT_TIME), str);
DWINUI::Draw_String(MRG, 120, buf);
duration_t(print_job_timer.getStats().longestPrint).toDigital(str, true);
sprintf_P(buf, PSTR("%s: %s"), GET_TEXT(MSG_INFO_PRINT_LONGEST), str);
DWINUI::Draw_String(MRG, 140, buf);
sprintf_P(buf, PSTR("%s: %s m"), GET_TEXT(MSG_INFO_PRINT_FILAMENT), dtostrf(ps.filamentUsed / 1000, 1, 2, str));
DWINUI::Draw_String(MRG, 160, buf);
}
void PrintStatsClass::Reset() {
print_job_timer.initStats();
HMI_AudioFeedback();
}
#endif // DWIN_CREALITY_LCD_ENHANCED && PRINTCOUNTER