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