mmu2_error_converter.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stddef.h>
  4. #include "mmu2/buttons.h"
  5. namespace MMU2 {
  6. /// Translates MMU2::ErrorCode into an index of Prusa-Error-Codes
  7. /// Basically this is the way to obtain an index into all other functions in this API
  8. uint8_t PrusaErrorCodeIndex(uint16_t ec);
  9. /// @returns pointer to a PROGMEM string representing the Title of the Prusa-Error-Codes error
  10. /// @param i index of the error - obtained by calling ErrorCodeIndex
  11. const char * const PrusaErrorTitle(uint8_t i);
  12. /// @returns pointer to a PROGMEM string representing the multi-page Description of the Prusa-Error-Codes error
  13. /// @param i index of the error - obtained by calling ErrorCodeIndex
  14. const char * const PrusaErrorDesc(uint8_t i);
  15. /// @returns the actual numerical value of the Prusa-Error-Codes error
  16. /// @param i index of the error - obtained by calling ErrorCodeIndex
  17. uint16_t PrusaErrorCode(uint8_t i);
  18. /// @returns Btns pair of buttons for a particular Prusa-Error-Codes error
  19. /// @param i index of the error - obtained by calling ErrorCodeIndex
  20. uint8_t PrusaErrorButtons(uint8_t i);
  21. /// @returns pointer to a PROGMEM string representing the Title of a button
  22. /// @param i index of the error - obtained by calling PrusaErrorButtons + extracting low or high nibble from the Btns pair
  23. const char * const PrusaErrorButtonTitle(uint8_t bi);
  24. /// @returns pointer to a PROGMEM string representing the "More" button
  25. const char * const PrusaErrorButtonMore();
  26. /// Sets the selected button for later pick-up by the MMU state machine.
  27. /// Used to save the GUI selection/decoupling
  28. void SetButtonResponse(ButtonOperations rsp);
  29. /// @returns button index/code based on currently processed error/screen
  30. /// Clears the "pressed" button upon exit
  31. Buttons ButtonPressed(uint16_t ec);
  32. /// @returns button index/code based on currently processed error/screen
  33. /// Used as a subfunction of ButtonPressed.
  34. /// Does not clear the "pressed" button upon exit
  35. Buttons ButtonAvailable(uint16_t ec);
  36. } // namespace MMU2