mmu2_progress_converter.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #include "mmu2_progress_converter.h"
  2. #include "language.h"
  3. #include "mmu2/progress_codes.h"
  4. #include <avr/pgmspace.h>
  5. namespace MMU2 {
  6. // 12345678901234567890
  7. static const char progressOk[] PROGMEM_I1 = ISTR("OK");
  8. static const char progressEngageIdler[] PROGMEM_I1 = ISTR("Engaging idler");
  9. static const char progressDisengeIdler[] PROGMEM_I1 = ISTR("Disengaging idler");
  10. static const char progressUnloadFinda[] PROGMEM_I1 = ISTR("Unloading to FINDA");
  11. static const char progressUnloadPulley[] PROGMEM_I1 = ISTR("Unloading to pulley");
  12. static const char progressFeedFinda[] PROGMEM_I1 = ISTR("Feeding to FINDA");
  13. static const char progressFeedBondtech[] PROGMEM_I1 = ISTR("Feeding to extruder");
  14. static const char progressFeedNozzle[] PROGMEM_I1 = ISTR("Feeding to nozzle");
  15. static const char progressAvoidGrind[] PROGMEM_I1 = ISTR("Avoiding grind");
  16. static const char progressFinishMoves[] PROGMEM_I1 = ISTR("Finishing moves");
  17. static const char progressWaitForUser[] PROGMEM_I1 = ISTR("ERR Wait for User");
  18. static const char progressErrInternal[] PROGMEM_I1 = ISTR("ERR Internal");
  19. static const char progressErrHelpFil[] PROGMEM_I1 = ISTR("ERR Help filament");
  20. static const char progressErrTmc[] PROGMEM_I1 = ISTR("ERR TMC failed");
  21. static const char progressUnloadFilament[] PROGMEM_I1 = ISTR("Unloading filament");
  22. static const char progressLoadFilament[] PROGMEM_I1 = ISTR("Loading filament");
  23. static const char progressSelectSlot[] PROGMEM_I1 = ISTR("Selecting fil. slot");
  24. static const char progressPrepareBlade[] PROGMEM_I1 = ISTR("Preparing blade");
  25. static const char progressPushFilament[] PROGMEM_I1 = ISTR("Pushing filament");
  26. static const char progressPerformCut[] PROGMEM_I1 = ISTR("Performing cut");
  27. static const char progressReturnSelector[] PROGMEM_I1 = ISTR("Returning selector");
  28. static const char progressParkSelector[] PROGMEM_I1 = ISTR("Parking selector");
  29. static const char progressEjectFilament[] PROGMEM_I1 = ISTR("Ejecting filament");
  30. static const char progressRetractFinda[] PROGMEM_I1 = ISTR("Retract from FINDA");
  31. static const char progressHoming[] PROGMEM_I1 = ISTR("Homing");
  32. static const char progressMovingSelector[] PROGMEM_I1 = ISTR("Moving selector");
  33. static const char progressFeedingToFSensor[] PROGMEM_I1 = ISTR("Feeding to FSensor");
  34. static const char * const progressTexts[] PROGMEM = {
  35. progressOk,
  36. progressEngageIdler,
  37. progressDisengeIdler,
  38. progressUnloadFinda,
  39. progressUnloadPulley,
  40. progressFeedFinda,
  41. progressFeedBondtech,
  42. progressFeedNozzle,
  43. progressAvoidGrind,
  44. progressFinishMoves,
  45. progressDisengeIdler, // err disengaging idler is the same text
  46. progressEngageIdler, // engage dtto.
  47. progressWaitForUser,
  48. progressErrInternal,
  49. progressErrHelpFil,
  50. progressErrTmc,
  51. progressUnloadFilament,
  52. progressLoadFilament,
  53. progressSelectSlot,
  54. progressPrepareBlade,
  55. progressPushFilament,
  56. progressPerformCut,
  57. progressReturnSelector,
  58. progressParkSelector,
  59. progressEjectFilament,
  60. progressRetractFinda,
  61. progressHoming,
  62. progressMovingSelector,
  63. progressFeedingToFSensor
  64. };
  65. const char * const ProgressCodeToText(uint16_t pc){
  66. // @@TODO ?? a better fallback option?
  67. return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
  68. ? static_cast<const char * const>(pgm_read_ptr(&progressTexts[pc]))
  69. : static_cast<const char * const>(pgm_read_ptr(&progressTexts[0]));
  70. }
  71. } // namespace MMU2