My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * DWIN End Stops diagnostic page
  24. * Author: Miguel A. Risco-Castillo (MRISCOC)
  25. * Version: 1.0.2
  26. * Date: 2021/11/06
  27. *
  28. * Based on the original code provided by Creality under GPL
  29. */
  30. #include "../../../inc/MarlinConfigPre.h"
  31. #include "dwin_defines.h"
  32. #if BOTH(DWIN_CREALITY_LCD_ENHANCED, HAS_ESDIAG)
  33. #include "endstop_diag.h"
  34. #include "../../../core/types.h"
  35. #include "../../marlinui.h"
  36. #include "dwin_lcd.h"
  37. #include "dwinui.h"
  38. #include "dwin_popup.h"
  39. #include "dwin.h"
  40. #if HAS_FILAMENT_SENSOR
  41. #include "../../../feature/runout.h"
  42. #endif
  43. #if HAS_BED_PROBE
  44. #include "../../../module/probe.h"
  45. #endif
  46. ESDiagClass ESDiag;
  47. void draw_es_label(FSTR_P const flabel=nullptr) {
  48. DWINUI::cursor.x = 40;
  49. if (flabel) DWINUI::Draw_String(F(flabel));
  50. DWINUI::Draw_String(F(": "));
  51. DWINUI::MoveBy(0, 25);
  52. }
  53. void draw_es_state(const bool is_hit) {
  54. const uint8_t LM = 130;
  55. DWINUI::cursor.x = LM;
  56. DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
  57. is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
  58. DWINUI::MoveBy(0, 25);
  59. }
  60. void ESDiagClass::Draw() {
  61. Title.ShowCaption(F("End-stops Diagnostic"));
  62. DWINUI::ClearMenuArea();
  63. Draw_Popup_Bkgd();
  64. DWINUI::Draw_Icon(ICON_Continue_E, 86, 250);
  65. DWINUI::cursor.y = 80;
  66. #define ES_LABEL(S) draw_es_label(F(STR_##S))
  67. #if HAS_X_MIN
  68. ES_LABEL(X_MIN);
  69. #endif
  70. #if HAS_Y_MIN
  71. ES_LABEL(Y_MIN);
  72. #endif
  73. #if HAS_Z_MIN
  74. ES_LABEL(Z_MIN);
  75. #endif
  76. #if HAS_FILAMENT_SENSOR
  77. draw_es_label(F(STR_FILAMENT));
  78. #endif
  79. Update();
  80. }
  81. void ESDiagClass::Update() {
  82. DWINUI::cursor.y = 80;
  83. #define ES_REPORT(S) draw_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING)
  84. #if HAS_X_MIN
  85. ES_REPORT(X_MIN);
  86. #endif
  87. #if HAS_Y_MIN
  88. ES_REPORT(Y_MIN);
  89. #endif
  90. #if HAS_Z_MIN
  91. ES_REPORT(Z_MIN);
  92. #endif
  93. #if HAS_FILAMENT_SENSOR
  94. draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE);
  95. #endif
  96. DWIN_UpdateLCD();
  97. }
  98. #endif // DWIN_CREALITY_LCD_ENHANCED && HAS_ESDIAG