My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

statistics_screen.cpp 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*************************
  2. * statistics_screen.cpp *
  3. *************************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  7. * *
  8. * This program is free software: you can redistribute it and/or modify *
  9. * it under the terms of the GNU General Public License as published by *
  10. * the Free Software Foundation, either version 3 of the License, or *
  11. * (at your option) any later version. *
  12. * *
  13. * This program is distributed in the hope that it will be useful, *
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU General Public License for more details. *
  17. * *
  18. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <http://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #if BOTH(LULZBOT_TOUCH_UI, PRINTCOUNTER)
  23. #include "screens.h"
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. #define GRID_COLS 4
  28. #define GRID_ROWS 7
  29. void StatisticsScreen::onRedraw(draw_mode_t what) {
  30. CommandProcessor cmd;
  31. if (what & BACKGROUND) {
  32. char buffer[21];
  33. cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
  34. .cmd(CLEAR(true,true,true))
  35. .tag(0)
  36. .font(Theme::font_medium)
  37. .text(BTN_POS(1,1), BTN_SIZE(4,1), GET_TEXTF(PRINTER_STATISTICS))
  38. .font(Theme::font_small)
  39. .tag(0)
  40. .text(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXTF(INFO_PRINT_COUNT), OPT_RIGHTX | OPT_CENTERY)
  41. .text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXTF(INFO_COMPLETED_PRINTS), OPT_RIGHTX | OPT_CENTERY)
  42. .text(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXTF(INFO_PRINT_TIME), OPT_RIGHTX | OPT_CENTERY)
  43. .text(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXTF(INFO_PRINT_LONGEST), OPT_RIGHTX | OPT_CENTERY)
  44. .text(BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXTF(INFO_PRINT_FILAMENT), OPT_RIGHTX | OPT_CENTERY);
  45. // Don't chain the following, it causes strange issues with evaluation ordering!
  46. cmd.text(BTN_POS(3,2), BTN_SIZE(2,1), getTotalPrints_str(buffer));
  47. cmd.text(BTN_POS(3,3), BTN_SIZE(2,1), getFinishedPrints_str(buffer));
  48. cmd.text(BTN_POS(3,4), BTN_SIZE(2,1), getTotalPrintTime_str(buffer));
  49. cmd.text(BTN_POS(3,5), BTN_SIZE(2,1), getLongestPrint_str(buffer));
  50. cmd.text(BTN_POS(3,6), BTN_SIZE(2,1), getFilamentUsed_str(buffer));
  51. }
  52. if (what & FOREGROUND) {
  53. cmd.font(Theme::font_medium)
  54. .colors(action_btn)
  55. .tag(1).button(BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXTF(BACK));
  56. }
  57. }
  58. bool StatisticsScreen::onTouchEnd(uint8_t tag) {
  59. switch (tag) {
  60. case 1: GOTO_PREVIOUS(); return true;
  61. default: return false;
  62. }
  63. }
  64. #endif // LULZBOT_TOUCH_UI && PRINTCOUNTER