errors_list.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. // Extracted from Prusa-Error-Codes repo
  2. // Subject to automation and optimization
  3. // BEWARE - this file shall be included only into mmu2_error_converter.cpp, not anywhere else!
  4. #pragma once
  5. #include "inttypes.h"
  6. #include "../language.h"
  7. #include <avr/pgmspace.h>
  8. #include "buttons.h"
  9. namespace MMU2 {
  10. static constexpr uint8_t ERR_MMU_CODE = 4;
  11. typedef enum : uint16_t {
  12. ERR_UNDEF = 0,
  13. ERR_MECHANICAL = 100,
  14. ERR_MECHANICAL_FINDA_DIDNT_TRIGGER,
  15. ERR_MECHANICAL_FINDA_DIDNT_GO_OFF,
  16. ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER,
  17. ERR_MECHANICAL_FSENSOR_DIDNT_GO_OFF,
  18. ERR_MECHANICAL_PULLEY_CANNOT_MOVE = 105,
  19. ERR_MECHANICAL_SELECTOR_CANNOT_HOME = 115,
  20. ERR_MECHANICAL_SELECTOR_CANNOT_MOVE = 116,
  21. ERR_MECHANICAL_IDLER_CANNOT_HOME = 125,
  22. ERR_MECHANICAL_IDLER_CANNOT_MOVE = 126,
  23. ERR_TEMPERATURE = 200,
  24. ERR_TEMPERATURE_PULLEY_WARNING_TMC_TOO_HOT = 201,
  25. ERR_TEMPERATURE_SELECTOR_WARNING_TMC_TOO_HOT = 211,
  26. ERR_TEMPERATURE_IDLER_WARNING_TMC_TOO_HOT = 221,
  27. ERR_TEMPERATURE_PULLEY_TMC_OVERHEAT_ERROR = 202,
  28. ERR_TEMPERATURE_SELECTOR_TMC_OVERHEAT_ERROR = 212,
  29. ERR_TEMPERATURE_IDLER_TMC_OVERHEAT_ERROR = 222,
  30. ERR_ELECTRICAL = 300,
  31. ERR_ELECTRICAL_PULLEY_TMC_DRIVER_ERROR = 301,
  32. ERR_ELECTRICAL_SELECTOR_TMC_DRIVER_ERROR = 311,
  33. ERR_ELECTRICAL_IDLER_TMC_DRIVER_ERROR = 321,
  34. ERR_ELECTRICAL_PULLEY_TMC_DRIVER_RESET = 302,
  35. ERR_ELECTRICAL_SELECTOR_TMC_DRIVER_RESET = 312,
  36. ERR_ELECTRICAL_IDLER_TMC_DRIVER_RESET = 322,
  37. ERR_ELECTRICAL_PULLEY_TMC_UNDERVOLTAGE_ERROR = 303,
  38. ERR_ELECTRICAL_SELECTOR_TMC_UNDERVOLTAGE_ERROR = 313,
  39. ERR_ELECTRICAL_IDLER_TMC_UNDERVOLTAGE_ERROR = 323,
  40. ERR_ELECTRICAL_PULLEY_TMC_DRIVER_SHORTED = 304,
  41. ERR_ELECTRICAL_SELECTOR_TMC_DRIVER_SHORTED = 314,
  42. ERR_ELECTRICAL_IDLER_TMC_DRIVER_SHORTED = 324,
  43. ERR_CONNECT = 400,
  44. ERR_CONNECT_MMU_NOT_RESPONDING = 401,
  45. ERR_CONNECT_COMMUNICATION_ERROR = 402,
  46. ERR_SYSTEM = 500,
  47. ERR_SYSTEM_FILAMENT_ALREADY_LOADED = 501,
  48. ERR_SYSTEM_INVALID_TOOL = 502,
  49. ERR_SYSTEM_QUEUE_FULL = 503,
  50. ERR_SYSTEM_FW_UPDATE_NEEDED = 504,
  51. ERR_SYSTEM_FW_RUNTIME_ERROR = 505,
  52. ERR_SYSTEM_UNLOAD_MANUALLY = 506,
  53. ERR_OTHER = 900
  54. } err_num_t;
  55. // Avr gcc has serious trouble understanding static data structures in PROGMEM
  56. // and inadvertedly falls back to copying the whole structure into RAM (which is obviously unwanted).
  57. // But since this file ought to be generated in the future from yaml prescription,
  58. // it really makes no difference if there are "nice" data structures or plain arrays.
  59. static const constexpr uint16_t errorCodes[] PROGMEM = {
  60. ERR_MECHANICAL_FINDA_DIDNT_TRIGGER,
  61. ERR_MECHANICAL_FINDA_DIDNT_GO_OFF,
  62. ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER,
  63. ERR_MECHANICAL_FSENSOR_DIDNT_GO_OFF,
  64. ERR_MECHANICAL_PULLEY_CANNOT_MOVE,
  65. ERR_MECHANICAL_SELECTOR_CANNOT_HOME,
  66. ERR_MECHANICAL_SELECTOR_CANNOT_MOVE,
  67. ERR_MECHANICAL_IDLER_CANNOT_HOME,
  68. ERR_MECHANICAL_IDLER_CANNOT_MOVE,
  69. ERR_TEMPERATURE_PULLEY_WARNING_TMC_TOO_HOT,
  70. ERR_TEMPERATURE_SELECTOR_WARNING_TMC_TOO_HOT,
  71. ERR_TEMPERATURE_IDLER_WARNING_TMC_TOO_HOT,
  72. ERR_TEMPERATURE_PULLEY_TMC_OVERHEAT_ERROR,
  73. ERR_TEMPERATURE_SELECTOR_TMC_OVERHEAT_ERROR,
  74. ERR_TEMPERATURE_IDLER_TMC_OVERHEAT_ERROR,
  75. ERR_ELECTRICAL_PULLEY_TMC_DRIVER_ERROR,
  76. ERR_ELECTRICAL_SELECTOR_TMC_DRIVER_ERROR,
  77. ERR_ELECTRICAL_IDLER_TMC_DRIVER_ERROR,
  78. ERR_ELECTRICAL_PULLEY_TMC_DRIVER_RESET,
  79. ERR_ELECTRICAL_SELECTOR_TMC_DRIVER_RESET,
  80. ERR_ELECTRICAL_IDLER_TMC_DRIVER_RESET,
  81. ERR_ELECTRICAL_PULLEY_TMC_UNDERVOLTAGE_ERROR,
  82. ERR_ELECTRICAL_SELECTOR_TMC_UNDERVOLTAGE_ERROR,
  83. ERR_ELECTRICAL_IDLER_TMC_UNDERVOLTAGE_ERROR,
  84. ERR_ELECTRICAL_PULLEY_TMC_DRIVER_SHORTED,
  85. ERR_ELECTRICAL_SELECTOR_TMC_DRIVER_SHORTED,
  86. ERR_ELECTRICAL_IDLER_TMC_DRIVER_SHORTED,
  87. ERR_CONNECT_MMU_NOT_RESPONDING,
  88. ERR_CONNECT_COMMUNICATION_ERROR,
  89. ERR_SYSTEM_FILAMENT_ALREADY_LOADED,
  90. ERR_SYSTEM_INVALID_TOOL,
  91. ERR_SYSTEM_QUEUE_FULL,
  92. ERR_SYSTEM_FW_UPDATE_NEEDED,
  93. ERR_SYSTEM_FW_UPDATE_NEEDED,
  94. ERR_SYSTEM_UNLOAD_MANUALLY
  95. };
  96. // @@TODO some of the strings are duplicates, can be merged into one
  97. static const char titleFINDA_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("FINDA DIDNT TRIGGER");
  98. static const char titleFINDA_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("FINDA DIDNT GO OFF");
  99. static const char titleFSENSOR_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("FSENSOR DIDNT TRIGGER");
  100. static const char titleFSENSOR_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("FSENSOR DIDNT GO OFF");
  101. static const char titlePULLEY_CANNOT_MOVE[] PROGMEM_I1 = ISTR("PULLEY CANNOT MOVE");
  102. static const char titleSELECTOR_CANNOT_MOVE[] PROGMEM_I1 = ISTR("SELECTOR CANNOT MOVE");
  103. static const char titleSELECTOR_CANNOT_HOME[] PROGMEM_I1 = ISTR("SELECTOR CANNOT HOME");
  104. static const char titleIDLER_CANNOT_MOVE[] PROGMEM_I1 = ISTR("IDLER CANNOT MOVE");
  105. static const char titleIDLER_CANNOT_HOME[] PROGMEM_I1 = ISTR("IDLER CANNOT HOME");
  106. static const char titlePULLEY_TMC_WARNING_TMC_TOO_HOT[] PROGMEM_I1 = ISTR("WARNING TMC TOO HOT");
  107. static const char titleSELECTOR_TMC_WARNING_TMC_TOO_HOT[] PROGMEM_I1 = ISTR("WARNING TMC TOO HOT");
  108. static const char titleIDLER_TMC_WARNING_TMC_TOO_HOT[] PROGMEM_I1 = ISTR("WARNING TMC TOO HOT");
  109. static const char titlePULLEY_TMC_OVERHEAT_ERROR[] PROGMEM_I1 = ISTR("TMC OVERHEAT ERROR");
  110. static const char titleSELECTOR_TMC_OVERHEAT_ERROR[] PROGMEM_I1 = ISTR("TMC OVERHEAT ERROR");
  111. static const char titleIDLER_TMC_OVERHEAT_ERROR[] PROGMEM_I1 = ISTR("TMC OVERHEAT ERROR");
  112. static const char titlePULLEY_TMC_DRIVER_ERROR[] PROGMEM_I1 = ISTR("TMC DRIVER ERROR");
  113. static const char titleSELECTOR_TMC_DRIVER_ERROR[] PROGMEM_I1 = ISTR("TMC DRIVER ERROR");
  114. static const char titleIDLER_TMC_DRIVER_ERROR[] PROGMEM_I1 = ISTR("TMC DRIVER ERROR");
  115. static const char titlePULLEY_TMC_DRIVER_RESET[] PROGMEM_I1 = ISTR("TMC DRIVER RESET");
  116. static const char titleSELECTOR_TMC_DRIVER_RESET[] PROGMEM_I1 = ISTR("TMC DRIVER RESET");
  117. static const char titleIDLER_TMC_DRIVER_RESET[] PROGMEM_I1 = ISTR("TMC DRIVER RESET");
  118. static const char titlePULLEY_TMC_UNDERVOLTAGE_ERROR[] PROGMEM_I1 = ISTR("TMC UNDERVOLTAGE ERR");
  119. static const char titleSELECTOR_TMC_UNDERVOLTAGE_ERROR[] PROGMEM_I1 = ISTR("TMC UNDERVOLTAGE ERR");
  120. static const char titleIDLER_TMC_UNDERVOLTAGE_ERROR[] PROGMEM_I1 = ISTR("TMC UNDERVOLTAGE ERR");
  121. static const char titlePULLEY_TMC_DRIVER_SHORTED[] PROGMEM_I1 = ISTR("TMC DRIVER SHORTED");
  122. static const char titleSELECTOR_TMC_DRIVER_SHORTED[] PROGMEM_I1 = ISTR("TMC DRIVER SHORTED");
  123. static const char titleIDLER_TMC_DRIVER_SHORTED[] PROGMEM_I1 = ISTR("TMC DRIVER SHORTED");
  124. static const char titleMMU_NOT_RESPONDING[] PROGMEM_I1 = ISTR("MMU NOT RESPONDING");
  125. static const char titleCOMMUNICATION_ERROR[] PROGMEM_I1 = ISTR("COMMUNICATION ERROR");
  126. static const char titleFILAMENT_ALREADY_LOADED[] PROGMEM_I1 = ISTR("FILAMENT ALREADY LOA");
  127. static const char titleINVALID_TOOL[] PROGMEM_I1 = ISTR("INVALID TOOL");
  128. static const char titleQUEUE_FULL[] PROGMEM_I1 = ISTR("QUEUE FULL");
  129. static const char titleFW_UPDATE_NEEDED[] PROGMEM_I1 = ISTR("FW UPDATE NEEDED");
  130. static const char titleFW_RUNTIME_ERROR[] PROGMEM_I1 = ISTR("FW RUNTIME ERROR");
  131. static const char titleUNLOAD_MANUALLY[] PROGMEM_I1 = ISTR("UNLOAD MANUALLY");
  132. static const char * const errorTitles [] PROGMEM = {
  133. titleFINDA_DIDNT_TRIGGER,
  134. titleFINDA_DIDNT_GO_OFF,
  135. titleFSENSOR_DIDNT_TRIGGER,
  136. titleFSENSOR_DIDNT_GO_OFF,
  137. titlePULLEY_CANNOT_MOVE,
  138. titleSELECTOR_CANNOT_HOME,
  139. titleSELECTOR_CANNOT_MOVE,
  140. titleIDLER_CANNOT_HOME,
  141. titleIDLER_CANNOT_MOVE,
  142. titlePULLEY_TMC_WARNING_TMC_TOO_HOT,
  143. titleSELECTOR_TMC_WARNING_TMC_TOO_HOT,
  144. titleIDLER_TMC_WARNING_TMC_TOO_HOT,
  145. titlePULLEY_TMC_OVERHEAT_ERROR,
  146. titleSELECTOR_TMC_OVERHEAT_ERROR,
  147. titleIDLER_TMC_OVERHEAT_ERROR,
  148. titlePULLEY_TMC_DRIVER_ERROR,
  149. titleSELECTOR_TMC_DRIVER_ERROR,
  150. titleIDLER_TMC_DRIVER_ERROR,
  151. titlePULLEY_TMC_DRIVER_RESET,
  152. titleSELECTOR_TMC_DRIVER_RESET,
  153. titleIDLER_TMC_DRIVER_RESET,
  154. titlePULLEY_TMC_UNDERVOLTAGE_ERROR,
  155. titleSELECTOR_TMC_UNDERVOLTAGE_ERROR,
  156. titleIDLER_TMC_UNDERVOLTAGE_ERROR,
  157. titlePULLEY_TMC_DRIVER_SHORTED,
  158. titleSELECTOR_TMC_DRIVER_SHORTED,
  159. titleIDLER_TMC_DRIVER_SHORTED,
  160. titleMMU_NOT_RESPONDING,
  161. titleCOMMUNICATION_ERROR,
  162. titleFILAMENT_ALREADY_LOADED,
  163. titleINVALID_TOOL,
  164. titleQUEUE_FULL,
  165. titleFW_UPDATE_NEEDED,
  166. titleFW_RUNTIME_ERROR,
  167. titleUNLOAD_MANUALLY
  168. };
  169. // @@TODO looking at the texts, they can be composed of several parts and/or parametrized (could save a lot of space ;) )
  170. static const char descFINDA_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("FINDA didn't trigger while loading filament. Ensure filament can move and FINDA works.");
  171. static const char descFINDA_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("FINDA didn't switch off while unloading filament. Try unloading manually. Ensure filament can move and FINDA works.");
  172. static const char descFSENSOR_DIDNT_TRIGGER[] PROGMEM_I1 = ISTR("Filament sensor didn't trigger while loading filament. Ensure filament reached the fsensor and the sensor works.");
  173. static const char descFSENSOR_DIDNT_GO_OFF[] PROGMEM_I1 = ISTR("Filament sensor didn't switch off while unloading filament. Ensure filament can move and the sensor works.");
  174. static const char descPULLEY_STALLED[] PROGMEM_I1 = ISTR("The Pulley motor stalled - Ensure the pulley can move and check the wiring.");
  175. static const char descSELECTOR_CANNOT_HOME[] PROGMEM_I1 = ISTR("The Selector cannot home properly - check for anything blocking its movement.");
  176. static const char descSELECTOR_CANNOT_MOVE[] PROGMEM_I1 = ISTR("The Selector cannot move - check for anything blocking its movement. Check the wiring is correct.");
  177. static const char descIDLER_CANNOT_MOVE[] PROGMEM_I1 = ISTR("The Idler cannot home properly - check for anything blocking its movement.");
  178. static const char descIDLER_CANNOT_HOME[] PROGMEM_I1 = ISTR("The Idler cannot move properly - check for anything blocking its movement. Check the wiring is correct.");
  179. static const char descPULLEY_WARNING_TMC_TOO_HOT[] PROGMEM_I1 = ISTR("TMC driver for the Pulley motor is almost overheating. Make sure there is sufficient airflow near the MMU board.");
  180. static const char descSELECTOR_WARNING_TMC_TOO_HOT[] PROGMEM_I1 = ISTR("TMC driver for the Selector motor is almost overheating. Make sure there is sufficient airflow near the MMU board.");
  181. static const char descIDLER_WARNING_TMC_TOO_HOT[] PROGMEM_I1 = ISTR("TMC driver for the Idler motor is almost overheating. Make sure there is sufficient airflow near the MMU board.");
  182. static const char descPULLEY_TMC_OVERHEAT_ERROR[] PROGMEM_I1 = ISTR("TMC driver for the Pulley motor is overheated. Cool down the MMU board and reset MMU.");
  183. static const char descSELECTOR_TMC_OVERHEAT_ERROR[] PROGMEM_I1 = ISTR("TMC driver for the Selector motor is overheated. Cool down the MMU board and reset MMU.");
  184. static const char descIDLER_TMC_OVERHEAT_ERROR[] PROGMEM_I1 = ISTR("TMC driver for the Idler motor is overheated. Cool down the MMU board and reset MMU.");
  185. static const char descPULLEY_TMC_DRIVER_ERROR[] PROGMEM_I1 = ISTR("TMC driver for the Pulley motor is not responding. Try resetting the MMU. If the issue persists contact support.");
  186. static const char descSELECTOR_TMC_DRIVER_ERROR[] PROGMEM_I1 = ISTR("TMC driver for the Selector motor is not responding. Try resetting the MMU. If the issue persists contact support.");
  187. static const char descIDLER_TMC_DRIVER_ERROR[] PROGMEM_I1 = ISTR("TMC driver for the Idler motor is not responding. Try resetting the MMU. If the issue persists contact support.");
  188. static const char descPULLEY_TMC_DRIVER_RESET[] PROGMEM_I1 = ISTR("TMC driver for the Pulley motor was restarted. There is probably an issue with the electronics. Check the wiring and connectors.");
  189. static const char descSELECTOR_TMC_DRIVER_RESET[] PROGMEM_I1 = ISTR("TMC driver for the Selector motor was restarted. There is probably an issue with the electronics. Check the wiring and connectors.");
  190. static const char descIDLER_TMC_DRIVER_RESET[] PROGMEM_I1 = ISTR("TMC driver for the Idler motor was restarted. There is probably an issue with the electronics. Check the wiring and connectors.");
  191. static const char descPULLEY_TMC_UNDERVOLTAGE_ERROR[] PROGMEM_I1 = ISTR("Not enough current for the Pulley TMC driver. There is probably an issue with the electronics. Check the wiring and connectors.");
  192. static const char descSELECTOR_TMC_UNDERVOLTAGE_ERROR[] PROGMEM_I1 = ISTR("Not enough current for the Selector TMC driver. There is probably an issue with the electronics. Check the wiring and connectors.");
  193. static const char descIDLER_TMC_UNDERVOLTAGE_ERROR[] PROGMEM_I1 = ISTR("Not enough current for the Idler TMC driver. There is probably an issue with the electronics. Check the wiring and connectors.");
  194. static const char descPULLEY_TMC_DRIVER_SHORTED[] PROGMEM_I1 = ISTR("Short circuit on the Pulley TMC driver. Check the wiring and connectors. If the issue persists contact support.");
  195. static const char descSELECTOR_TMC_DRIVER_SHORTED[] PROGMEM_I1 = ISTR("Short circuit on the Selector TMC driver. Check the wiring and connectors. If the issue persists contact support.");
  196. static const char descIDLER_TMC_DRIVER_SHORTED[] PROGMEM_I1 = ISTR("Short circuit on the Idler TMC driver. Check the wiring and connectors. If the issue persists contact support.");
  197. static const char descMMU_NOT_RESPONDING[] PROGMEM_I1 = ISTR("MMU unit not responding. Check the wiring and connectors. If the issue persists contact support.");
  198. static const char descCOMMUNICATION_ERROR[] PROGMEM_I1 = ISTR("MMU unit not responding correctly. Check the wiring and connectors. If the issue persists contact support.");
  199. static const char descFILAMENT_ALREADY_LOADED[] PROGMEM_I1 = ISTR("Cannot perform the action, filament is already loaded. Unload it first.");
  200. static const char descINVALID_TOOL[] PROGMEM_I1 = ISTR("Requested filament tool is not available on this hardware. Check the G-code for tool index out of range (T0-T4).");
  201. static const char descQUEUE_FULL[] PROGMEM_I1 = ISTR("MMU Firmware internal error, please reset the MMU.");
  202. static const char descFW_UPDATE_NEEDED[] PROGMEM_I1 = ISTR("The MMU unit reports its FW version incompatible with the printer's firmware. Make sure the MMU firmware is up to date.");
  203. static const char descFW_RUNTIME_ERROR[] PROGMEM_I1 = ISTR("Internal runtime error. Try resetting the MMU unit or updating the firmware. If the issue persists contact support.");
  204. static const char descUNLOAD_MANUALLY[] PROGMEM_I1 = ISTR("Unexpected FINDA reading. Ensure no filament is under FINDA and the selector is free. Check FINDA connection.");
  205. static const char * const errorDescs[] PROGMEM = {
  206. descFINDA_DIDNT_TRIGGER,
  207. descFINDA_DIDNT_GO_OFF,
  208. descFSENSOR_DIDNT_TRIGGER,
  209. descFSENSOR_DIDNT_GO_OFF,
  210. descPULLEY_STALLED,
  211. descSELECTOR_CANNOT_HOME,
  212. descSELECTOR_CANNOT_MOVE,
  213. descIDLER_CANNOT_HOME,
  214. descIDLER_CANNOT_MOVE,
  215. descPULLEY_WARNING_TMC_TOO_HOT,
  216. descSELECTOR_WARNING_TMC_TOO_HOT,
  217. descIDLER_WARNING_TMC_TOO_HOT,
  218. descPULLEY_TMC_OVERHEAT_ERROR,
  219. descSELECTOR_TMC_OVERHEAT_ERROR,
  220. descIDLER_TMC_OVERHEAT_ERROR,
  221. descPULLEY_TMC_DRIVER_ERROR,
  222. descSELECTOR_TMC_DRIVER_ERROR,
  223. descIDLER_TMC_DRIVER_ERROR,
  224. descPULLEY_TMC_DRIVER_RESET,
  225. descSELECTOR_TMC_DRIVER_RESET,
  226. descIDLER_TMC_DRIVER_RESET,
  227. descPULLEY_TMC_UNDERVOLTAGE_ERROR,
  228. descSELECTOR_TMC_UNDERVOLTAGE_ERROR,
  229. descIDLER_TMC_UNDERVOLTAGE_ERROR,
  230. descPULLEY_TMC_DRIVER_SHORTED,
  231. descSELECTOR_TMC_DRIVER_SHORTED,
  232. descIDLER_TMC_DRIVER_SHORTED,
  233. descMMU_NOT_RESPONDING,
  234. descCOMMUNICATION_ERROR,
  235. descFILAMENT_ALREADY_LOADED,
  236. descINVALID_TOOL,
  237. descQUEUE_FULL,
  238. descFW_UPDATE_NEEDED,
  239. descFW_RUNTIME_ERROR,
  240. descUNLOAD_MANUALLY
  241. };
  242. // we have max 3 buttons/operations to select from
  243. // one of them is "More" to show the explanation text normally hidden in the next screens.
  244. // 01234567890123456789
  245. // >bttxt >bttxt >MoreW
  246. // Therefore at least some of the buttons, which can occur on the screen together, need to be 5-chars long max @@TODO.
  247. // @@TODO beware - this doesn't correspond to the HW MMU buttons - needs to be discussed
  248. static const char btnRetry[] PROGMEM_I1 = ISTR("Retry");
  249. static const char btnContinue[] PROGMEM_I1 = ISTR("Done");
  250. static const char btnRestartMMU[] PROGMEM_I1 = ISTR("RstMMU");
  251. static const char btnUnload[] PROGMEM_I1 = ISTR("Unload");
  252. static const char btnStop[] PROGMEM_I1 = ISTR("Stop");
  253. static const char btnDisableMMU[] PROGMEM_I1 = ISTR("Disable");
  254. static const char btnMore[] PROGMEM_I1 = ISTR("More\x01");
  255. // Used to parse the buttons from Btns().
  256. static const char * const btnOperation[] PROGMEM = {
  257. btnRetry,
  258. btnContinue,
  259. btnRestartMMU,
  260. btnUnload,
  261. btnStop,
  262. btnDisableMMU
  263. };
  264. // We have 8 different operations/buttons at this time, so we need at least 4 bits to encode each.
  265. // Since one of the buttons is always "More", we can skip that one.
  266. // Therefore we need just 1 byte to describe the necessary buttons for each screen.
  267. uint8_t constexpr Btns(ButtonOperations b0, ButtonOperations b1){
  268. return ((uint8_t)b1) << 4 | ((uint8_t)b0);
  269. }
  270. static const uint8_t errorButtons[] PROGMEM = {
  271. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  272. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  273. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  274. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  275. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  276. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  277. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  278. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  279. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  280. Btns(ButtonOperations::Continue, ButtonOperations::RestartMMU),
  281. Btns(ButtonOperations::Continue, ButtonOperations::RestartMMU),
  282. Btns(ButtonOperations::Continue, ButtonOperations::RestartMMU),
  283. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  284. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  285. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  286. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  287. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  288. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  289. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  290. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  291. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  292. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  293. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  294. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  295. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  296. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  297. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  298. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  299. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  300. Btns(ButtonOperations::Unload, ButtonOperations::Continue),
  301. Btns(ButtonOperations::StopPrint, ButtonOperations::RestartMMU),
  302. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  303. Btns(ButtonOperations::NoOperation, ButtonOperations::DisableMMU),
  304. Btns(ButtonOperations::RestartMMU, ButtonOperations::NoOperation),
  305. Btns(ButtonOperations::Retry, ButtonOperations::NoOperation),
  306. };
  307. static_assert( sizeof(errorCodes) / sizeof(errorCodes[0]) == sizeof(errorDescs) / sizeof (errorDescs[0]));
  308. static_assert( sizeof(errorCodes) / sizeof(errorCodes[0]) == sizeof(errorTitles) / sizeof (errorTitles[0]));
  309. static_assert( sizeof(errorCodes) / sizeof(errorCodes[0]) == sizeof(errorButtons) / sizeof (errorButtons[0]));
  310. } // namespace MMU2