mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-01-18 05:45:33 -07:00
debug prints
This commit is contained in:
parent
98633f7093
commit
da2a295741
3 changed files with 94 additions and 0 deletions
|
|
@ -552,6 +552,38 @@
|
|||
#define HAS_WIRED_LCD 1
|
||||
#endif
|
||||
|
||||
|
||||
// Compile-time diagnostic warnings for MightyBoard builds
|
||||
#if ENABLED(MIGHTYBOARD_LCD)
|
||||
#warning "MightyBoard build: MIGHTYBOARD_LCD is ENABLED"
|
||||
#if ENABLED(IS_ULTIPANEL)
|
||||
#warning "MightyBoard build: IS_ULTIPANEL is defined"
|
||||
#else
|
||||
#warning "MightyBoard build: IS_ULTIPANEL is NOT defined"
|
||||
#endif
|
||||
#if ENABLED(HAS_WIRED_LCD)
|
||||
#warning "MightyBoard build: HAS_WIRED_LCD is defined"
|
||||
#else
|
||||
#warning "MightyBoard build: HAS_WIRED_LCD is NOT defined"
|
||||
#endif
|
||||
#if ENABLED(HAS_MARLINUI_HD44780)
|
||||
#warning "MightyBoard build: HAS_MARLINUI_HD44780 is defined"
|
||||
#else
|
||||
#warning "MightyBoard build: HAS_MARLINUI_HD44780 is NOT defined"
|
||||
#endif
|
||||
#if ENABLED(HAS_MARLINUI_MENU)
|
||||
#warning "MightyBoard build: HAS_MARLINUI_MENU is defined"
|
||||
#else
|
||||
#warning "MightyBoard build: HAS_MARLINUI_MENU is NOT defined"
|
||||
#endif
|
||||
#if ENABLED(HAS_SHIFT_ENCODER)
|
||||
#warning "MightyBoard build: HAS_SHIFT_ENCODER is defined"
|
||||
#else
|
||||
#warning "MightyBoard build: HAS_SHIFT_ENCODER is NOT defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if ANY(IS_ULTIPANEL, REPRAPWORLD_KEYPAD)
|
||||
#define IS_NEWPANEL 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
#if (HAS_MARLINUI_ENCODER || ANY_BUTTON(ENC, BACK, UP, DOWN, LEFT, RIGHT)) && DISABLED(TOUCH_UI_FTDI_EVE)
|
||||
#define HAS_DIGITAL_BUTTONS 1
|
||||
#warning "HAS_DIGITAL_BUTTONS enabled"
|
||||
#endif
|
||||
#if !HAS_ADC_BUTTONS && (IS_RRW_KEYPAD || (HAS_WIRED_LCD && !IS_NEWPANEL))
|
||||
#define HAS_SHIFT_ENCODER 1
|
||||
|
|
|
|||
|
|
@ -313,6 +313,39 @@ void MarlinUI::init() {
|
|||
SET_INPUT(BTN_RIGHT);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Compile-time warnings to confirm whether this directional-button init block
|
||||
// is compiled for the current board. These will appear in the compiler output
|
||||
// only when ANY_BUTTON(UP, DOWN, LFT, RT) evaluates true for the current build.
|
||||
#if ANY_BUTTON(UP, DOWN, LFT, RT)
|
||||
#warning "Marlin: Compiling directional button init (UP/DOWN/LEFT/RIGHT)"
|
||||
#endif
|
||||
|
||||
// Optional runtime trace for MightyBoard UI/button flow.
|
||||
// Enable by uncommenting `#define MIGHTYBOARD_RUNTIME_DEBUG` in the board pins file.
|
||||
#if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG)
|
||||
SERIAL_ECHOLN("MarlinUI::init() - MIGHTYBOARD_RUNTIME_DEBUG active");
|
||||
#if ENABLED(MIGHTYBOARD_BUTTON_PULLUPS)
|
||||
SERIAL_ECHOLN("MIGHTYBOARD_BUTTON_PULLUPS: ENABLED");
|
||||
#else
|
||||
SERIAL_ECHOLN("MIGHTYBOARD_BUTTON_PULLUPS: DISABLED");
|
||||
#endif
|
||||
SERIAL_ECHO_MSG("LCD dimensions: ", LCD_WIDTH, " x ", LCD_HEIGHT);
|
||||
SERIAL_ECHOLN("");
|
||||
|
||||
// Report encoder/click compile-time presence and pin numbers (if defined)
|
||||
#if BUTTON_EXISTS(ENC)
|
||||
SERIAL_ECHOLN("BUTTON_EXISTS(ENC): defined");
|
||||
SERIAL_ECHO_MSG("BTN_ENC pin: ", BTN_ENC);
|
||||
SERIAL_ECHOLN("");
|
||||
#else
|
||||
SERIAL_ECHOLN("BUTTON_EXISTS(ENC): NOT defined");
|
||||
#endif
|
||||
|
||||
#ifdef BTN_CLICK
|
||||
SERIAL_ECHO_MSG("BTN_CLICK pin: ", BTN_CLICK);
|
||||
SERIAL_ECHOLN("");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_SHIFT_ENCODER
|
||||
|
|
@ -1347,6 +1380,18 @@ void MarlinUI::init() {
|
|||
void MarlinUI::update_buttons() {
|
||||
const millis_t now = millis();
|
||||
|
||||
// #if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG)
|
||||
// // Debug: print raw pin reads for encoder/click to diagnose BTN_ENC alias
|
||||
// #if BUTTON_EXISTS(ENC)
|
||||
// SERIAL_ECHO_MSG("DBG: READ(BTN_ENC) = ", READ(BTN_ENC));
|
||||
// SERIAL_ECHOLN("");
|
||||
// #endif
|
||||
// #ifdef BTN_CLICK
|
||||
// SERIAL_ECHO_MSG("DBG: READ(BTN_CLICK) = ", READ(BTN_CLICK));
|
||||
// SERIAL_ECHOLN("");
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
#if HAS_MARLINUI_ENCODER
|
||||
|
||||
const int8_t delta = get_encoder_delta(now);
|
||||
|
|
@ -1379,18 +1424,34 @@ void MarlinUI::init() {
|
|||
if (BUTTON_PRESSED(UP)) {
|
||||
encoderDiff = pulses * (ENCODER_STEPS_PER_MENU_ITEM);
|
||||
next_button_update_ms = now + 300;
|
||||
// #if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG)
|
||||
// SERIAL_ECHO_MSG("update_buttons(): UP -> encoderDiff=", encoderDiff);
|
||||
// SERIAL_ECHOLN("");
|
||||
// #endif
|
||||
}
|
||||
else if (BUTTON_PRESSED(DOWN)) {
|
||||
encoderDiff = pulses * -(ENCODER_STEPS_PER_MENU_ITEM);
|
||||
next_button_update_ms = now + 300;
|
||||
// #if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG)
|
||||
// SERIAL_ECHO_MSG("update_buttons(): DOWN -> encoderDiff=", encoderDiff);
|
||||
// SERIAL_ECHOLN("");
|
||||
// #endif
|
||||
}
|
||||
else if (BUTTON_PRESSED(LEFT)) {
|
||||
encoderDiff = -pulses;
|
||||
next_button_update_ms = now + 300;
|
||||
// #if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG)
|
||||
// SERIAL_ECHO_MSG("update_buttons(): LEFT -> encoderDiff=", encoderDiff);
|
||||
// SERIAL_ECHOLN("");
|
||||
// #endif
|
||||
}
|
||||
else if (BUTTON_PRESSED(RIGHT)) {
|
||||
encoderDiff = pulses;
|
||||
next_button_update_ms = now + 300;
|
||||
// #if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG)
|
||||
// SERIAL_ECHO_MSG("update_buttons(): RIGHT -> encoderDiff=", encoderDiff);
|
||||
// SERIAL_ECHOLN("");
|
||||
// #endif
|
||||
}
|
||||
|
||||
#endif // UP || DOWN || LEFT || RIGHT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue