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.

DGUSDisplayDefinition.h 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /* DGUS implementation written by coldtobi in 2019 for Marlin */
  24. #include "DGUSVPVariable.h"
  25. // This file defines the interaction between Marlin and the display firmware.
  26. // information on which screen which VP is displayed
  27. // As this is a sparse table, two arrays are needed:
  28. // one to list the VPs of one screen and one to map screens to the lists.
  29. // (Strictly this would not be necessary, but allows to only send data the display needs and reducing load on Marlin)
  30. struct VPMapping {
  31. const uint8_t screen;
  32. const uint16_t *VPList; // The list is null-terminated.
  33. };
  34. extern const struct VPMapping VPMap[];
  35. enum DGUSLCD_Screens : uint8_t {
  36. DGUSLCD_SCREEN_BOOT = 0,
  37. DGUSLCD_SCREEN_MAIN = 10,
  38. DGUSLCD_SCREEN_TEMPERATURE = 20,
  39. DGUSLCD_SCREEN_STATUS = 30,
  40. DGUSLCD_SCREEN_STATUS2 = 32,
  41. DGUSLCD_SCREEN_MANUALMOVE = 40,
  42. DGUSLCD_SCREEN_MANUALEXTRUDE=42,
  43. DGUSLCD_SCREEN_FANANDFEEDRATE = 44,
  44. DGUSLCD_SCREEN_FLOWRATES = 46,
  45. DGUSLCD_SCREEN_SDFILELIST = 50,
  46. DGUSLCD_SCREEN_SDPRINTMANIPULATION = 52,
  47. DGUSLCD_SCREEN_CONFIRM = 240,
  48. DGUSLCD_SCREEN_KILL = 250, ///< Kill Screen. Must always be 250 (to be able to display "Error wrong LCD Version")
  49. DGUSLCD_SCREEN_POPUP = 252, ///< special target, popup screen will also return this code to say "return to previous screen"
  50. DGUSLDC_SCREEN_UNUSED = 255
  51. };
  52. // Display Memory layout used (T5UID)
  53. // Except system variables this is arbitrary, just to organize stuff....
  54. // 0x0000 .. 0x0FFF -- System variables and reserved by the display
  55. // 0x1000 .. 0x1FFF -- Variables to never change location, regardless of UI Version
  56. // 0x2000 .. 0x2FFF -- Controls (VPs that will trigger some action)
  57. // 0x3000 .. 0x4FFF -- Marlin Data to be displayed
  58. // 0x5000 .. -- SPs (if we want to modify display elements, e.g change color or like) -- currently unused
  59. // As there is plenty of space (at least most displays have >8k RAM), we do not pack them too tight,
  60. // so that we can keep variables nicely together in the address space.
  61. // UI Version always on 0x1000...0x1002 so that the firmware can check this and bail out.
  62. constexpr uint16_t VP_UI_VERSION_MAJOR = 0x1000; // Major -- incremented when incompatible
  63. constexpr uint16_t VP_UI_VERSION_MINOR = 0x1001; // Minor -- incremented on new features, but compatible
  64. constexpr uint16_t VP_UI_VERSION_PATCH = 0x1002; // Patch -- fixed which do not change functionality.
  65. constexpr uint16_t VP_UI_FLAVOUR = 0x1010; // lets reserve 16 bytes here to determine if UI is suitable for this Marlin. tbd.
  66. // Storage space for the Killscreen messages. 0x1100 - 0x1200 . Reused for the popup.
  67. constexpr uint16_t VP_MSGSTR1 = 0x1100;
  68. constexpr uint8_t VP_MSGSTR1_LEN = 0x20; // might be more place for it...
  69. constexpr uint16_t VP_MSGSTR2 = 0x1140;
  70. constexpr uint8_t VP_MSGSTR2_LEN = 0x20;
  71. constexpr uint16_t VP_MSGSTR3 = 0x1180;
  72. constexpr uint8_t VP_MSGSTR3_LEN = 0x20;
  73. constexpr uint16_t VP_MSGSTR4 = 0x11C0;
  74. constexpr uint8_t VP_MSGSTR4_LEN = 0x20;
  75. // Screenchange request for screens that only make sense when printer is idle.
  76. // e.g movement is only allowed if printer is not printing.
  77. // Marlin must confirm by setting the screen manually.
  78. constexpr uint16_t VP_SCREENCHANGE_ASK = 0x2000;
  79. constexpr uint16_t VP_SCREENCHANGE = 0x2001; // Key-Return button to new menu pressed. Data contains target screen in low byte and info in high byte.
  80. constexpr uint16_t VP_TEMP_ALL_OFF = 0x2002; // Turn all heaters off. Value arbitrary ;)=
  81. constexpr uint16_t VP_SCREENCHANGE_WHENSD = 0x2003; // "Print" Button touched -- go only there if there is an SD Card.
  82. constexpr uint16_t VP_CONFIRMED = 0x2010; // OK on confirm screen.
  83. // Buttons on the SD-Card File listing.
  84. constexpr uint16_t VP_SD_ScrollEvent = 0x2020; // Data: 0 for "up a directory", numbers are the amount to scroll, e.g -1 one up, 1 one down
  85. constexpr uint16_t VP_SD_FileSelected = 0x2022; // Number of file field selected.
  86. constexpr uint16_t VP_SD_FileSelectConfirm = 0x2024; // (This is a virtual VP and emulated by the Confirm Screen when a file has been confirmed)
  87. constexpr uint16_t VP_SD_ResumePauseAbort = 0x2026; // Resume(Data=0), Pause(Data=1), Abort(Data=2) SD Card prints
  88. constexpr uint16_t VP_SD_AbortPrintConfirmed = 0x2028; // Abort print confirmation (virtual, will be injected by the confirm dialog)
  89. // Controls for movement (we can't use the incremental / decremental feature of the display at this feature works only with 16 bit values
  90. // (which would limit us to 655.35mm, which is likely not a problem for common setups, but i don't want to rule out hangprinters support)
  91. // A word about the coding: The VP will be per axis and the return code will be an signed 16 bit value in 0.01 mm resolution, telling us
  92. // the relative travel amount t he user wants to do. So eg. if the display sends us VP=2100 with value 100, the user wants us to move X by +1 mm.
  93. constexpr uint16_t VP_MOVE_X = 0x2100;
  94. constexpr uint16_t VP_MOVE_Y = 0x2102;
  95. constexpr uint16_t VP_MOVE_Z = 0x2104;
  96. constexpr uint16_t VP_MOVE_E0 = 0x2110;
  97. constexpr uint16_t VP_MOVE_E1 = 0x2112;
  98. //constexpr uint16_t VP_MOVE_E2 = 0x2114;
  99. //constexpr uint16_t VP_MOVE_E3 = 0x2116;
  100. //constexpr uint16_t VP_MOVE_E4 = 0x2118;
  101. //constexpr uint16_t VP_MOVE_E5 = 0x211A;
  102. constexpr uint16_t VP_HOME_ALL = 0x2120;
  103. // Firmware version on the boot screen.
  104. constexpr uint16_t VP_MARLIN_VERSION = 0x3000;
  105. constexpr uint8_t VP_MARLIN_VERSION_LEN = 16; // there is more space on the display, if needed.
  106. // Place for status messages.
  107. constexpr uint16_t VP_M117 = 0x3020;
  108. constexpr uint8_t VP_M117_LEN = 0x20;
  109. // Temperatures.
  110. constexpr uint16_t VP_T_E0_Is = 0x3060; // 4 Byte Integer
  111. constexpr uint16_t VP_T_E0_Set = 0x3062; // 2 Byte Integer
  112. constexpr uint16_t VP_T_E1_Is = 0x3064; // 4 Byte Integer
  113. // reserved to support up to 6 Extruders:
  114. //constexpr uint16_t VP_T_E1_Set = 0x3066; // 2 Byte Integer
  115. //constexpr uint16_t VP_T_E2_Is = 0x3068; // 4 Byte Integer
  116. //constexpr uint16_t VP_T_E2_Set = 0x306A; // 2 Byte Integer
  117. //constexpr uint16_t VP_T_E3_Is = 0x306C; // 4 Byte Integer
  118. //constexpr uint16_t VP_T_E3_Set = 0x306E; // 2 Byte Integer
  119. //constexpr uint16_t VP_T_E4_Is = 0x3070; // 4 Byte Integer
  120. //constexpr uint16_t VP_T_E4_Set = 0x3072; // 2 Byte Integer
  121. //constexpr uint16_t VP_T_E4_Is = 0x3074; // 4 Byte Integer
  122. //constexpr uint16_t VP_T_E4_Set = 0x3076; // 2 Byte Integer
  123. //constexpr uint16_t VP_T_E5_Is = 0x3078; // 4 Byte Integer
  124. //constexpr uint16_t VP_T_E5_Set = 0x307A; // 2 Byte Integer
  125. constexpr uint16_t VP_T_Bed_Is = 0x3080; // 4 Byte Integer
  126. constexpr uint16_t VP_T_Bed_Set = 0x3082; // 2 Byte Integer
  127. constexpr uint16_t VP_Flowrate_E0 = 0x3090; // 2 Byte Integer
  128. constexpr uint16_t VP_Flowrate_E1 = 0x3092; // 2 Byte Integer
  129. // reserved for up to 6 Extruders:
  130. //constexpr uint16_t VP_Flowrate_E2 = 0x3094;
  131. //constexpr uint16_t VP_Flowrate_E3 = 0x3096;
  132. //constexpr uint16_t VP_Flowrate_E4 = 0x3098;
  133. //constexpr uint16_t VP_Flowrate_E5 = 0x309A;
  134. constexpr uint16_t VP_Fan_Percentage = 0x3100; // 2 Byte Integer (0..100)
  135. constexpr uint16_t VP_Feedrate_Percentage = 0x3102; // 2 Byte Integer (0..100)
  136. constexpr uint16_t VP_PrintProgress_Percentage = 0x3104; // 2 Byte Integer (0..100)
  137. constexpr uint16_t VP_PrintTime = 0x3106;
  138. constexpr uint16_t VP_PrintTime_LEN = 10;
  139. // Actual Position
  140. constexpr uint16_t VP_XPos = 0x3110; // 4 Byte Fixed point number; format xxx.yy
  141. constexpr uint16_t VP_YPos = 0x3112; // 4 Byte Fixed point number; format xxx.yy
  142. constexpr uint16_t VP_ZPos = 0x3114; // 4 Byte Fixed point number; format xxx.yy
  143. constexpr uint16_t VP_EPos = 0x3120; // 4 Byte Fixed point number; format xxx.yy
  144. // SDCard File Listing
  145. constexpr uint16_t VP_SD_FileName_LEN = 32; // LEN is shared for all entries.
  146. constexpr uint16_t DGUS_SD_FILESPERSCREEN = 5; // FIXME move that info to the display and read it from there.
  147. constexpr uint16_t VP_SD_FileName0 = 0x3200;
  148. constexpr uint16_t VP_SD_FileName1 = 0x3220;
  149. constexpr uint16_t VP_SD_FileName2 = 0x3240;
  150. constexpr uint16_t VP_SD_FileName3 = 0x3260;
  151. constexpr uint16_t VP_SD_FileName4 = 0x3280;
  152. // SPs for certain variables...
  153. // located at 0x5000 and up
  154. // Not used yet!
  155. // This can be used e.g to make controls / data display invisible
  156. constexpr uint16_t SP_T_E0_Is = 0x5000;
  157. constexpr uint16_t SP_T_E0_Set = 0x5010;
  158. constexpr uint16_t SP_T_E1_Is = 0x5020;
  159. constexpr uint16_t SP_T_Bed_Is = 0x5030;
  160. constexpr uint16_t SP_T_Bed_Set = 0x5040;
  161. // List of VPs handled by Marlin / The Display.
  162. extern const struct DGUS_VP_Variable ListOfVP[];