123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- #include "mmu2.h"
- #include "mmu2_reporting.h"
- #include "mmu2_error_converter.h"
- #include "mmu2/error_codes.h"
- #include "mmu2/buttons.h"
- #include "ultralcd.h"
- #include "Filament_sensor.h"
- #include "language.h"
- namespace MMU2 {
- const char * const ProgressCodeToText(uint16_t pc);
- void BeginReport(CommandInProgress cip, uint16_t ec) {
- custom_message_type = CustomMsg::MMUProgress;
- lcd_setstatuspgm( ProgressCodeToText(ec) );
- }
- void EndReport(CommandInProgress cip, uint16_t ec) {
-
- custom_message_type = CustomMsg::Status;
- }
- static void ReportErrorHook_cb(void)
- {
-
-
- lcd_set_cursor(3, 2);
- lcd_printf_P(PSTR("%d"), mmu2.FindaDetectsFilament());
- lcd_set_cursor(8, 2);
- lcd_printf_P(PSTR("%d"), fsensor.getFilamentPresent());
- lcd_set_cursor(11, 2);
- lcd_print("?>?");
-
-
-
-
-
-
- lcd_set_cursor(16, 2);
- lcd_printf_P(PSTR("%d"), (int)(degHotend(0) + 0.5));
- }
- void ReportErrorHook(CommandInProgress cip, uint16_t ec) {
-
-
-
-
-
-
-
- const uint8_t ei = PrusaErrorCodeIndex(ec);
- uint8_t choice_selected = 0;
- bool two_choices = false;
-
-
- const uint8_t button_operation = PrusaErrorButtons(ei);
- const uint8_t button_high_nibble = BUTTON_OP_HI_NIBBLE(button_operation);
- const uint8_t button_low_nibble = BUTTON_OP_LO_NIBBLE(button_operation);
-
- if (button_high_nibble == (uint8_t)ButtonOperations::NoOperation)
- {
-
- two_choices = true;
- }
- back_to_choices:
- lcd_clear();
- lcd_update_enable(false);
-
-
- lcd_printf_P(PSTR("%.20S\nprusa3d.com/ERR04%hu"), _T(PrusaErrorTitle(ei)), PrusaErrorCode(ei) );
-
- lcd_set_cursor(0, 2);
- lcd_printf_P(PSTR("FI: FS: > %c %c"), LCD_STR_THERMOMETER[0], LCD_STR_DEGREE[0]);
-
- choice_selected = lcd_show_multiscreen_message_with_choices_and_wait_P(
- NULL,
- false,
- two_choices ? LEFT_BUTTON_CHOICE : MIDDLE_BUTTON_CHOICE,
- _T(PrusaErrorButtonTitle(button_low_nibble)),
- _T(two_choices ? PrusaErrorButtonMore() : PrusaErrorButtonTitle(button_high_nibble)),
- two_choices ? nullptr : _T(PrusaErrorButtonMore()),
- two_choices ?
- 10
- : 7,
- ReportErrorHook_cb
- );
- if ((two_choices && choice_selected == MIDDLE_BUTTON_CHOICE)
- || (!two_choices && choice_selected == RIGHT_BUTTON_CHOICE))
- {
-
- lcd_show_fullscreen_message_and_wait_P(_T(PrusaErrorDesc(ei)));
-
- goto back_to_choices;
- } else if(choice_selected == MIDDLE_BUTTON_CHOICE) {
-
-
- switch (button_high_nibble)
- {
- case (uint8_t)ButtonOperations::Retry:
- case (uint8_t)ButtonOperations::Continue:
- case (uint8_t)ButtonOperations::RestartMMU:
- case (uint8_t)ButtonOperations::Unload:
- case (uint8_t)ButtonOperations::StopPrint:
- case (uint8_t)ButtonOperations::DisableMMU:
- default:
- lcd_update_enable(true);
- lcd_return_to_status();
- break;
- }
- } else {
-
-
- switch (button_low_nibble)
- {
- case (uint8_t)ButtonOperations::Retry:
- case (uint8_t)ButtonOperations::Continue:
- case (uint8_t)ButtonOperations::RestartMMU:
- case (uint8_t)ButtonOperations::Unload:
- case (uint8_t)ButtonOperations::StopPrint:
- case (uint8_t)ButtonOperations::DisableMMU:
- default:
- lcd_update_enable(true);
- lcd_return_to_status();
- break;
- }
- }
- }
- void ReportProgressHook(CommandInProgress cip, uint16_t ec) {
- custom_message_type = CustomMsg::MMUProgress;
- lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
- }
- Buttons ButtonPressed(uint16_t ec) {
-
- }
- }
|