From 8e56568b863dd38d9a6a608c087fd8b958fbdd38 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 02:17:45 -0300 Subject: [PATCH 01/33] preliminar pins according to research --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 285 +++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h new file mode 100644 index 0000000000..81cc45a71e --- /dev/null +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -0,0 +1,285 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Mightyboard Rev.G and H pin assignments + * Schematic: not avalable (as rev G and H are not open source) + * Pins based on the work of https://github.com/Sgail7/Replicator-Revival-Project/ + * pin number acording to arduino mapping, port is indicated in comments eg: 36 // PC1 + */ + + +#define ALLOW_MEGA1280 +#include "env_validate.h" + +#define BOARD_INFO_NAME "Mightyboard rev.G/H" +#define DEFAULT_MACHINE_NAME "MB Replicator" + +// +// Servos (unconfirmed) +// +//#define SERVO0_PIN 36 // C1 (1280-EX1) +// #define SERVO1_PIN 37 // C0 (1280-EX2) +// #define SERVO2_PIN 40 // G1 (1280-EX3) +// #define SERVO3_PIN 41 // G0 (1280-EX4) + +// +// Limit Switches +// +#define X_MIN_PIN 30 // C7 ** +// #define X_MAX_PIN 48 // L1 +#define Y_MIN_PIN 31 // C6 ** +// #define Y_MAX_PIN 46 // L3 +#define Z_MIN_PIN 32 // C5 ** +// #define Z_MAX_PIN 42 // L7 + +// +// Z Probe (when not Z_MIN_PIN) +// +// #ifndef Z_MIN_PROBE_PIN +// #define Z_MIN_PROBE_PIN 42 +// #endif + +// +// Filament Runout Sensor +// +// #ifndef FIL_RUNOUT_PIN +// #define FIL_RUNOUT_PIN 49 +// #endif +// #ifndef FIL_RUNOUT2_PIN +// #define FIL_RUNOUT2_PIN 47 +// #endif + +// +// Steppers +// +#define X_STEP_PIN ... // D6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define X_DIR_PIN 38 // D7 ** +#define X_ENABLE_PIN ... // D4 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + +#define Y_STEP_PIN 44 // L5 ** +#define Y_DIR_PIN 42 // L7 ** +#define Y_ENABLE_PIN 45 // L4 ** + +#define Z_STEP_PIN 48 // L1 ** +#define Z_DIR_PIN 47 // L2 ** +#define Z_ENABLE_PIN 49 // L0 ** + +#define E0_STEP_PIN 25 // A3 ** +#define E0_DIR_PIN 24 // A2 ** +#define E0_ENABLE_PIN 27 // A5 ** + +#define E1_STEP_PIN 22 // A0 ** +#define E1_DIR_PIN 15 // K7 ** +#define E1_ENABLE_PIN 23 // A1 ** + +// +// I2C Digipots - MCP4018 +// Address 5E (2F << 1) +// Set from 0 - 127 with stop bit. +// (Ex. 3F << 1 | 1) +// +#define DIGIPOTS_I2C_SCL 28 // A6 * +#define DIGIPOTS_I2C_SDA_X ... // D5 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define DIGIPOTS_I2C_SDA_Y 43 // L6 ** +#define DIGIPOTS_I2C_SDA_Z 46 // L3 ** +#define DIGIPOTS_I2C_SDA_E0 26 // A4 ** +#define DIGIPOTS_I2C_SDA_E1 77 // J7 ** + +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) +#endif +#define DIGIPOT_ENABLE_I2C_PULLUPS // MightyBoard doesn't have hardware I2C pin pull-ups. + +/* +* Temperature Sensors +* Uses ADS1118 as ADC converter to read the temperature sensors +* SPI for ADS1118 ADC, Uses software SPI +* +*/ +// +// K7 - 69 / ADC15 - 15 +#define TEMP_BED_PIN 3 // F3 ** It seems to be connected to arduino ADC, shouldn't it be connected to ads1118 too? + +// E6 +// E2 +// E7 +// H2 +// +#define TEMP_0_CS_PIN ... // E6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_SCK_PIN ... // E2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_MISO_PIN ... // E7 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_MOSI_PIN ... // H2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + +#define TEMP_1_CS_PIN 2 // E4 ** +#define TEMP_1_SCK_PIN TEMP_0_SCK_PIN +#define TEMP_1_MISO_PIN TEMP_0_MISO_PIN +#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN + +// +// FET Pin Mapping - FET A is closest to the input power connector +// + +#define MOSFET_A_PIN 3 // E5 ** +#define MOSFET_B_PIN 5 // E3 ** +#define MOSFET_C_PIN 8 // H5 ** +#define MOSFET_D_PIN 7 // H4 ** +#define MOSFET_E_PIN 2 // E4 ** +#define MOSFET_F_PIN 4 // G5 ** + +// +// Heaters / Fans (24V) +// + +#define HEATER_0_PIN MOSFET_A_PIN // E5 ** +#define HEATER_1_PIN MOSFET_B_PIN // E3 ?* +#define HEATER_BED_PIN MOSFET_C_PIN // H5 ** + +#ifndef E0_AUTO_FAN_PIN + #define E0_AUTO_FAN_PIN MOSFET_D_PIN +#elif !defined(FAN0_PIN) + #define FAN0_PIN MOSFET_D_PIN +#endif + +#ifndef E1_AUTO_FAN_PIN + #define E1_AUTO_FAN_PIN MOSFET_E_PIN +#elif !defined(FAN1_PIN) + #define FAN1_PIN MOSFET_E_PIN +#endif + +// +// Misc. Functions +// PCA9632 LED + + +//#define LED_PIN 13 // B7 +//#define CUTOFF_RESET_PIN 16 // H1 +//#define CUTOFF_TEST_PIN 17 // H0 +//#define CUTOFF_SR_CHECK_PIN 70 // G4 (TOSC1) + +// +// LCD / Controller +// + +#if HAS_WIRED_LCD + + #if IS_RRD_FG_SC + + #define LCD_PINS_RS 33 // C4: LCD-STROBE + #define LCD_PINS_EN 72 // J2: LEFT + #define LCD_PINS_D4 35 // C2: LCD-CLK + #define LCD_PINS_D5 32 // C5: RLED + #define LCD_PINS_D6 34 // C3: LCD-DATA + #define LCD_PINS_D7 31 // C6: GLED + + #define BTN_EN2 75 // J4, UP + #define BTN_EN1 73 // J3, DOWN + // STOP button connected as KILL_PIN + #define KILL_PIN 14 // J1, RIGHT (not connected) + + #define BEEPER_PIN 8 // H5, SD_WP + + // Onboard leds + #define STAT_LED_RED_PIN SERVO0_PIN // C1 (1280-EX1, DEBUG2) + #define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3) + + #else + // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power + #define SPI_SOFT_MOSI_PIN 37 // C0 ** + #define SPI_SOFT_SCLK_PIN 36 // C1 ** + #define SPI_SOFT_MISO_PIN 33 // C4 ** + + #define BTN_LATCH_PIN 34 // C3 ** + #define BTN_CLICK_PIN 39 // G2 ** + + #define BTN_UP_PIN ... // J5 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + #define BTN_DOWN_PIN ... // J4 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + #define BTN_LEFT_PIN ... // J6/J13 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + + #define LCD_POWER_PIN 29 // A7 ** + + #define LCD_LED1_PIN 35 // C2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + + // #define BTN_RIGHT_PIN 14 // J1 ? + + // #define SR_DATA_PIN 37 // C0 * + // #define SR_CLK_PIN 36 // C1 * + // #define SR_STROBE_PIN 33 // C? + + // #define BTN_UP 75 // J5 * + // #define BTN_DOWN 73 // J4 * + // #define BTN_LEFT 72 // J6/J13 * + // #define BTN_RIGHT 14 // J1 ? + + // Disable encoder + #undef BTN_EN1 + #undef BTN_EN2 + + #define BEEPER_PIN 6 // H3 ** + + // #define STAT_LED_RED_PIN 32 // C2 * + // #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) + + #endif + + // #define BTN_CENTER 15 // J6/J13 * + // #define BTN_ENC BTN_CENTER + +#endif // HAS_WIRED_LCD + +// +// SD Card +// Not sure about these +// #define SD_SS_PIN 53 // B0 +// #define SD_DETECT_PIN 9 // H6 + +// #if HAS_TMC_UART +// /** +// * TMC220x stepper drivers +// * +// * Hardware serial communication ports. +// * If undefined software serial is used according to the pins below +// */ +// #define X_HARDWARE_SERIAL Serial2 +// #define Y_HARDWARE_SERIAL Serial1 + +// /** +// * Software serial +// */ + +// #define X_SERIAL_TX_PIN 16 +// #define X_SERIAL_RX_PIN 17 + +// #define Y_SERIAL_TX_PIN 18 +// #define Y_SERIAL_RX_PIN 19 + +// #define Z_SERIAL_TX_PIN 41 +// #define Z_SERIAL_RX_PIN 66 + +// #define E0_SERIAL_TX_PIN 40 +// #define E0_SERIAL_RX_PIN 67 + +// #define E1_SERIAL_TX_PIN 37 +// #define E1_SERIAL_RX_PIN 68 + +// #endif From bd12738969e16df22b823a63a2638b5bfd8dfdb8 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 02:32:43 -0300 Subject: [PATCH 02/33] feat: add Makerbot Mightyboard Revision G and H to boards.h --- Marlin/src/core/boards.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 0ee4b75cfa..f5f5f67fb6 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -185,6 +185,7 @@ #define BOARD_MALYAN_M180 1332 // Malyan M180 Mainboard Version 2 (no display function, direct G-code only) #define BOARD_PROTONEER_CNC_SHIELD_V3 1333 // Mega controller & Protoneer CNC Shield V3.00 #define BOARD_WEEDO_62A 1334 // WEEDO 62A board (TINA2, Monoprice Cadet, etc.) +#define BOARD_MIGHTYBOARD_REVG 1335 // Makerbot Mightyboard Revision G and H // // ATmega1281, ATmega2561 From 6619a70480c4a56be3dc7c22d28ca78b22890d55 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 02:48:10 -0300 Subject: [PATCH 03/33] feat: using mega extended pins --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 81cc45a71e..d18cb683f5 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -25,7 +25,8 @@ * Mightyboard Rev.G and H pin assignments * Schematic: not avalable (as rev G and H are not open source) * Pins based on the work of https://github.com/Sgail7/Replicator-Revival-Project/ - * pin number acording to arduino mapping, port is indicated in comments eg: 36 // PC1 + * Pin number according to Mega extended mega2560ext: .\buildroot\share\PlatformIO\variants\MARLIN_MEGA_EXTENDED\pins_arduino.h + * Use env:MightyBoard2560 or env:MightyBoard1280 in platformio.ini */ @@ -38,7 +39,7 @@ // // Servos (unconfirmed) // -//#define SERVO0_PIN 36 // C1 (1280-EX1) +// #define SERVO0_PIN 36 // C1 (1280-EX1) // #define SERVO1_PIN 37 // C0 (1280-EX2) // #define SERVO2_PIN 40 // G1 (1280-EX3) // #define SERVO3_PIN 41 // G0 (1280-EX4) @@ -73,9 +74,9 @@ // // Steppers // -#define X_STEP_PIN ... // D6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define X_STEP_PIN 83 // D6 *** does not have an equivalent in standard arduino core. uses mega extended #define X_DIR_PIN 38 // D7 ** -#define X_ENABLE_PIN ... // D4 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define X_ENABLE_PIN 81 // D4 *** does not have an equivalent in standard arduino core. uses mega extended #define Y_STEP_PIN 44 // L5 ** #define Y_DIR_PIN 42 // L7 ** @@ -100,7 +101,7 @@ // (Ex. 3F << 1 | 1) // #define DIGIPOTS_I2C_SCL 28 // A6 * -#define DIGIPOTS_I2C_SDA_X ... // D5 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define DIGIPOTS_I2C_SDA_X 82 // D5 *** does not have an equivalent in standard arduino core. #define DIGIPOTS_I2C_SDA_Y 43 // L6 ** #define DIGIPOTS_I2C_SDA_Z 46 // L3 ** #define DIGIPOTS_I2C_SDA_E0 26 // A4 ** @@ -126,10 +127,10 @@ // E7 // H2 // -#define TEMP_0_CS_PIN ... // E6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? -#define TEMP_0_SCK_PIN ... // E2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? -#define TEMP_0_MISO_PIN ... // E7 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? -#define TEMP_0_MOSI_PIN ... // H2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_CS_PIN 79 // E6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_SCK_PIN 78 // E2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_MISO_PIN 80 // E7 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_MOSI_PIN 84 // H2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? #define TEMP_1_CS_PIN 2 // E4 ** #define TEMP_1_SCK_PIN TEMP_0_SCK_PIN @@ -212,13 +213,13 @@ #define BTN_LATCH_PIN 34 // C3 ** #define BTN_CLICK_PIN 39 // G2 ** - #define BTN_UP_PIN ... // J5 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? - #define BTN_DOWN_PIN ... // J4 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? - #define BTN_LEFT_PIN ... // J6/J13 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + #define BTN_UP_PIN 76 // J5 *** does not have an equivalent in standard arduino core. + #define BTN_DOWN_PIN 75 // J4 *** does not have an equivalent in standard arduino core. + #define BTN_LEFT_PIN 77 // J6/J13 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? #define LCD_POWER_PIN 29 // A7 ** - #define LCD_LED1_PIN 35 // C2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + #define LCD_LED1_PIN 35 // C2 ** // #define BTN_RIGHT_PIN 14 // J1 ? From 5f7ade441347770357ace220ec5b0b1f24825e0e Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 02:50:51 -0300 Subject: [PATCH 04/33] feat: add mighty rev g --- Marlin/src/pins/pins.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 0adceffe46..0086f1bc19 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -261,6 +261,8 @@ #include "mega/pins_CHEAPTRONICv2.h" // ATmega2560 env:mega2560 #elif MB(MIGHTYBOARD_REVE) #include "mega/pins_MIGHTYBOARD_REVE.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 +#elif MB(MIGHTYBOARD_REVG) + #include "mega/pins_MIGHTYBOARD_REVG.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 #elif MB(MEGATRONICS) #include "mega/pins_MEGATRONICS.h" // ATmega2560 env:mega2560 #elif MB(MEGATRONICS_2) From fda52a42093ce76eaca2f39287c4b3b94cf3e066 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 02:55:05 -0300 Subject: [PATCH 05/33] ordering comments --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index d18cb683f5..c203903800 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -112,21 +112,16 @@ #endif #define DIGIPOT_ENABLE_I2C_PULLUPS // MightyBoard doesn't have hardware I2C pin pull-ups. + +// Bed temp sensor pin +#define TEMP_BED_PIN 3 // F3 ** It seems to be connected to arduino ADC, shouldn't it be connected to ads1118 too? + /* * Temperature Sensors -* Uses ADS1118 as ADC converter to read the temperature sensors +* Uses ADS1118 as ADC converter to read the hotend temperature sensors * SPI for ADS1118 ADC, Uses software SPI * */ -// -// K7 - 69 / ADC15 - 15 -#define TEMP_BED_PIN 3 // F3 ** It seems to be connected to arduino ADC, shouldn't it be connected to ads1118 too? - -// E6 -// E2 -// E7 -// H2 -// #define TEMP_0_CS_PIN 79 // E6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? #define TEMP_0_SCK_PIN 78 // E2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? #define TEMP_0_MISO_PIN 80 // E7 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? From 75eab380465a7a3e7f7420d023aa2981ff4b7f56 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 03:35:34 -0300 Subject: [PATCH 06/33] add: softspi pins for mightyboard rev g --- Marlin/src/libs/softspi.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Marlin/src/libs/softspi.h b/Marlin/src/libs/softspi.h index cc36d658cd..4763405bc8 100644 --- a/Marlin/src/libs/softspi.h +++ b/Marlin/src/libs/softspi.h @@ -207,7 +207,15 @@ {&DDRJ, &PINJ, &PORTJ, 5}, // J5 76 {&DDRJ, &PINJ, &PORTJ, 6}, // J6 77 {&DDRE, &PINE, &PORTE, 2}, // E2 78 - {&DDRE, &PINE, &PORTE, 6} // E6 79 + {&DDRE, &PINE, &PORTE, 6}, // E6 79 + + // pins MIGHTYBOARD_REVG.h + {&DDRE, &PINE, &PORTE, 7}, // E7 80 + {&DDRD, &PIND, &PORTD, 4}, // D4 81 + {&DDRD, &PIND, &PORTD, 5}, // D5 82 + {&DDRD, &PIND, &PORTD, 6}, // D6 83 + {&DDRH, &PINH, &PORTH, 2}, // H2 84 + {&DDRH, &PINH, &PORTH, 7} // H7 85 }; #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__) \ From d9c15a8793ec136b5faac782a37b3d86bdb6848b Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 03:36:31 -0300 Subject: [PATCH 07/33] Fix: correct config for homing --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index c203903800..2484ad85d9 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -45,12 +45,12 @@ // #define SERVO3_PIN 41 // G0 (1280-EX4) // -// Limit Switches -// -#define X_MIN_PIN 30 // C7 ** -// #define X_MAX_PIN 48 // L1 -#define Y_MIN_PIN 31 // C6 ** -// #define Y_MAX_PIN 46 // L3 +// Limit Switches: X and Y go to max, Z to min +// +// #define X_MIN_PIN 30 // C7 ** +#define X_MAX_PIN 30 // C7 ** +// #define Y_MIN_PIN 31 // C6 ** +#define Y_MAX_PIN 31 // C6 ** #define Z_MIN_PIN 32 // C5 ** // #define Z_MAX_PIN 42 // L7 From 8d90014c2d15f102f3590f41e8c039b7e908c7dd Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 03:37:46 -0300 Subject: [PATCH 08/33] leave Shift Register pins for LCD just for now --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 2484ad85d9..6876cae3f9 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -218,9 +218,10 @@ // #define BTN_RIGHT_PIN 14 // J1 ? - // #define SR_DATA_PIN 37 // C0 * - // #define SR_CLK_PIN 36 // C1 * - // #define SR_STROBE_PIN 33 // C? + // Leave Old pins defined for now + #define SR_DATA_PIN 37 // C0 * + #define SR_CLK_PIN 36 // C1 * + #define SR_STROBE_PIN 33 // C4 * // #define BTN_UP 75 // J5 * // #define BTN_DOWN 73 // J4 * From 5a6b6d2afb38b983185ae9a1265624f4f0dcadff Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Thu, 2 Oct 2025 03:40:28 -0300 Subject: [PATCH 09/33] clean pins --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 110 +++++++++---------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 6876cae3f9..0072a41d29 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -47,11 +47,11 @@ // // Limit Switches: X and Y go to max, Z to min // -// #define X_MIN_PIN 30 // C7 ** -#define X_MAX_PIN 30 // C7 ** -// #define Y_MIN_PIN 31 // C6 ** -#define Y_MAX_PIN 31 // C6 ** -#define Z_MIN_PIN 32 // C5 ** +// #define X_MIN_PIN 30 // C7 +#define X_MAX_PIN 30 // C7 +// #define Y_MIN_PIN 31 // C6 +#define Y_MAX_PIN 31 // C6 +#define Z_MIN_PIN 32 // C5 // #define Z_MAX_PIN 42 // L7 // @@ -74,25 +74,25 @@ // // Steppers // -#define X_STEP_PIN 83 // D6 *** does not have an equivalent in standard arduino core. uses mega extended -#define X_DIR_PIN 38 // D7 ** -#define X_ENABLE_PIN 81 // D4 *** does not have an equivalent in standard arduino core. uses mega extended +#define X_STEP_PIN 83 // D6 +#define X_DIR_PIN 38 // D7 +#define X_ENABLE_PIN 81 // D4 -#define Y_STEP_PIN 44 // L5 ** -#define Y_DIR_PIN 42 // L7 ** -#define Y_ENABLE_PIN 45 // L4 ** +#define Y_STEP_PIN 44 // L5 +#define Y_DIR_PIN 42 // L7 +#define Y_ENABLE_PIN 45 // L4 -#define Z_STEP_PIN 48 // L1 ** -#define Z_DIR_PIN 47 // L2 ** -#define Z_ENABLE_PIN 49 // L0 ** +#define Z_STEP_PIN 48 // L1 +#define Z_DIR_PIN 47 // L2 +#define Z_ENABLE_PIN 49 // L0 -#define E0_STEP_PIN 25 // A3 ** -#define E0_DIR_PIN 24 // A2 ** -#define E0_ENABLE_PIN 27 // A5 ** +#define E0_STEP_PIN 25 // A3 +#define E0_DIR_PIN 24 // A2 +#define E0_ENABLE_PIN 27 // A5 -#define E1_STEP_PIN 22 // A0 ** -#define E1_DIR_PIN 15 // K7 ** -#define E1_ENABLE_PIN 23 // A1 ** +#define E1_STEP_PIN 22 // A0 +#define E1_DIR_PIN 15 // K7 +#define E1_ENABLE_PIN 23 // A1 // // I2C Digipots - MCP4018 @@ -100,12 +100,12 @@ // Set from 0 - 127 with stop bit. // (Ex. 3F << 1 | 1) // -#define DIGIPOTS_I2C_SCL 28 // A6 * -#define DIGIPOTS_I2C_SDA_X 82 // D5 *** does not have an equivalent in standard arduino core. -#define DIGIPOTS_I2C_SDA_Y 43 // L6 ** -#define DIGIPOTS_I2C_SDA_Z 46 // L3 ** -#define DIGIPOTS_I2C_SDA_E0 26 // A4 ** -#define DIGIPOTS_I2C_SDA_E1 77 // J7 ** +#define DIGIPOTS_I2C_SCL 28 // A6 +#define DIGIPOTS_I2C_SDA_X 82 // D5 +#define DIGIPOTS_I2C_SDA_Y 43 // L6 +#define DIGIPOTS_I2C_SDA_Z 46 // L3 +#define DIGIPOTS_I2C_SDA_E0 26 // A4 +#define DIGIPOTS_I2C_SDA_E1 77 // J7 #ifndef DIGIPOT_I2C_ADDRESS_A #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) @@ -114,7 +114,7 @@ // Bed temp sensor pin -#define TEMP_BED_PIN 3 // F3 ** It seems to be connected to arduino ADC, shouldn't it be connected to ads1118 too? +#define TEMP_BED_PIN 3 // F3 /* * Temperature Sensors @@ -122,12 +122,12 @@ * SPI for ADS1118 ADC, Uses software SPI * */ -#define TEMP_0_CS_PIN 79 // E6 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? -#define TEMP_0_SCK_PIN 78 // E2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? -#define TEMP_0_MISO_PIN 80 // E7 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? -#define TEMP_0_MOSI_PIN 84 // H2 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? +#define TEMP_0_CS_PIN 79 // E6 +#define TEMP_0_SCK_PIN 78 // E2 +#define TEMP_0_MISO_PIN 80 // E7 +#define TEMP_0_MOSI_PIN 84 // H2 -#define TEMP_1_CS_PIN 2 // E4 ** +#define TEMP_1_CS_PIN 2 // E4 #define TEMP_1_SCK_PIN TEMP_0_SCK_PIN #define TEMP_1_MISO_PIN TEMP_0_MISO_PIN #define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN @@ -136,20 +136,20 @@ // FET Pin Mapping - FET A is closest to the input power connector // -#define MOSFET_A_PIN 3 // E5 ** -#define MOSFET_B_PIN 5 // E3 ** -#define MOSFET_C_PIN 8 // H5 ** -#define MOSFET_D_PIN 7 // H4 ** -#define MOSFET_E_PIN 2 // E4 ** -#define MOSFET_F_PIN 4 // G5 ** +#define MOSFET_A_PIN 3 // E5 +#define MOSFET_B_PIN 5 // E3 +#define MOSFET_C_PIN 8 // H5 +#define MOSFET_D_PIN 7 // H4 +#define MOSFET_E_PIN 2 // E4 +#define MOSFET_F_PIN 4 // G5 // // Heaters / Fans (24V) // -#define HEATER_0_PIN MOSFET_A_PIN // E5 ** +#define HEATER_0_PIN MOSFET_A_PIN // E5 #define HEATER_1_PIN MOSFET_B_PIN // E3 ?* -#define HEATER_BED_PIN MOSFET_C_PIN // H5 ** +#define HEATER_BED_PIN MOSFET_C_PIN // H5 #ifndef E0_AUTO_FAN_PIN #define E0_AUTO_FAN_PIN MOSFET_D_PIN @@ -201,20 +201,20 @@ #else // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power - #define SPI_SOFT_MOSI_PIN 37 // C0 ** - #define SPI_SOFT_SCLK_PIN 36 // C1 ** - #define SPI_SOFT_MISO_PIN 33 // C4 ** + #define SPI_SOFT_MOSI_PIN 37 // C0 + #define SPI_SOFT_SCLK_PIN 36 // C1 + #define SPI_SOFT_MISO_PIN 33 // C4 - #define BTN_LATCH_PIN 34 // C3 ** - #define BTN_CLICK_PIN 39 // G2 ** + #define BTN_LATCH_PIN 34 // C3 + #define BTN_CLICK_PIN 39 // G2 - #define BTN_UP_PIN 76 // J5 *** does not have an equivalent in standard arduino core. - #define BTN_DOWN_PIN 75 // J4 *** does not have an equivalent in standard arduino core. - #define BTN_LEFT_PIN 77 // J6/J13 *** does not have an equivalent in standard arduino core. Maybe need to use https://github.com/MCUdude/MegaCore ? + #define BTN_UP_PIN 76 // J5 + #define BTN_DOWN_PIN 75 // J4 + #define BTN_LEFT_PIN 77 // J6/J13 - #define LCD_POWER_PIN 29 // A7 ** + #define LCD_POWER_PIN 29 // A7 - #define LCD_LED1_PIN 35 // C2 ** + #define LCD_LED1_PIN 35 // C2 // #define BTN_RIGHT_PIN 14 // J1 ? @@ -223,16 +223,16 @@ #define SR_CLK_PIN 36 // C1 * #define SR_STROBE_PIN 33 // C4 * - // #define BTN_UP 75 // J5 * - // #define BTN_DOWN 73 // J4 * - // #define BTN_LEFT 72 // J6/J13 * - // #define BTN_RIGHT 14 // J1 ? + // #define BTN_UP 75 // J5 + // #define BTN_DOWN 73 // J4 + // #define BTN_LEFT 72 // J6/J13 + // #define BTN_RIGHT 14 // J1 // Disable encoder #undef BTN_EN1 #undef BTN_EN2 - #define BEEPER_PIN 6 // H3 ** + #define BEEPER_PIN 6 // H3 // #define STAT_LED_RED_PIN 32 // C2 * // #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) From e4feec9d838f1cf68d8654423a885a5bce243836 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Fri, 3 Oct 2025 01:09:03 -0300 Subject: [PATCH 10/33] match order --- Marlin/src/pins/pins.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 0086f1bc19..474ef3a534 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -261,8 +261,6 @@ #include "mega/pins_CHEAPTRONICv2.h" // ATmega2560 env:mega2560 #elif MB(MIGHTYBOARD_REVE) #include "mega/pins_MIGHTYBOARD_REVE.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 -#elif MB(MIGHTYBOARD_REVG) - #include "mega/pins_MIGHTYBOARD_REVG.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 #elif MB(MEGATRONICS) #include "mega/pins_MEGATRONICS.h" // ATmega2560 env:mega2560 #elif MB(MEGATRONICS_2) @@ -317,7 +315,8 @@ #include "mega/pins_PROTONEER_CNC_SHIELD_V3.h" // ATmega2560 env:mega2560 #elif MB(WEEDO_62A) #include "mega/pins_WEEDO_62A.h" // ATmega2560 env:mega2560 - +#elif MB(MIGHTYBOARD_REVG) + #include "mega/pins_MIGHTYBOARD_REVG.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 // // ATmega1281, ATmega2561 // From 518f8a8ef6f4da9414e66fcc2bb12f81082fcbbe Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Fri, 3 Oct 2025 01:14:00 -0300 Subject: [PATCH 11/33] pin naming and format --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 0072a41d29..b0aae384de 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -47,12 +47,9 @@ // // Limit Switches: X and Y go to max, Z to min // -// #define X_MIN_PIN 30 // C7 -#define X_MAX_PIN 30 // C7 -// #define Y_MIN_PIN 31 // C6 -#define Y_MAX_PIN 31 // C6 -#define Z_MIN_PIN 32 // C5 -// #define Z_MAX_PIN 42 // L7 +#define X_STOP_PIN 30 // C7 +#define Y_STOP_PIN 31 // C6 +#define Z_MIN_PIN 32 // C5 // // Z Probe (when not Z_MIN_PIN) From e716a50d797086a893c78915dcbc773f93d5dd93 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Fri, 3 Oct 2025 01:37:29 -0300 Subject: [PATCH 12/33] format --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 58 ++++---------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index b0aae384de..ed855d77b5 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -36,37 +36,13 @@ #define BOARD_INFO_NAME "Mightyboard rev.G/H" #define DEFAULT_MACHINE_NAME "MB Replicator" -// -// Servos (unconfirmed) -// -// #define SERVO0_PIN 36 // C1 (1280-EX1) -// #define SERVO1_PIN 37 // C0 (1280-EX2) -// #define SERVO2_PIN 40 // G1 (1280-EX3) -// #define SERVO3_PIN 41 // G0 (1280-EX4) - // // Limit Switches: X and Y go to max, Z to min // -#define X_STOP_PIN 30 // C7 -#define Y_STOP_PIN 31 // C6 -#define Z_MIN_PIN 32 // C5 +#define X_STOP_PIN 30 // C7 +#define Y_STOP_PIN 31 // C6 +#define Z_MIN_PIN 32 // C5 -// -// Z Probe (when not Z_MIN_PIN) -// -// #ifndef Z_MIN_PROBE_PIN -// #define Z_MIN_PROBE_PIN 42 -// #endif - -// -// Filament Runout Sensor -// -// #ifndef FIL_RUNOUT_PIN -// #define FIL_RUNOUT_PIN 49 -// #endif -// #ifndef FIL_RUNOUT2_PIN -// #define FIL_RUNOUT2_PIN 47 -// #endif // // Steppers @@ -105,7 +81,7 @@ #define DIGIPOTS_I2C_SDA_E1 77 // J7 #ifndef DIGIPOT_I2C_ADDRESS_A - #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) + #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) #endif #define DIGIPOT_ENABLE_I2C_PULLUPS // MightyBoard doesn't have hardware I2C pin pull-ups. @@ -149,33 +125,23 @@ #define HEATER_BED_PIN MOSFET_C_PIN // H5 #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN MOSFET_D_PIN + #define E0_AUTO_FAN_PIN MOSFET_D_PIN #elif !defined(FAN0_PIN) - #define FAN0_PIN MOSFET_D_PIN + #define FAN0_PIN MOSFET_D_PIN #endif #ifndef E1_AUTO_FAN_PIN - #define E1_AUTO_FAN_PIN MOSFET_E_PIN + #define E1_AUTO_FAN_PIN MOSFET_E_PIN #elif !defined(FAN1_PIN) - #define FAN1_PIN MOSFET_E_PIN + #define FAN1_PIN MOSFET_E_PIN #endif -// -// Misc. Functions -// PCA9632 LED - - -//#define LED_PIN 13 // B7 -//#define CUTOFF_RESET_PIN 16 // H1 -//#define CUTOFF_TEST_PIN 17 // H0 -//#define CUTOFF_SR_CHECK_PIN 70 // G4 (TOSC1) - // // LCD / Controller // #if HAS_WIRED_LCD - + #if IS_RRD_FG_SC #define LCD_PINS_RS 33 // C4: LCD-STROBE @@ -213,7 +179,7 @@ #define LCD_LED1_PIN 35 // C2 - // #define BTN_RIGHT_PIN 14 // J1 ? + //#define BTN_RIGHT_PIN 14 // J1 ? // Leave Old pins defined for now #define SR_DATA_PIN 37 // C0 * @@ -229,7 +195,7 @@ #undef BTN_EN1 #undef BTN_EN2 - #define BEEPER_PIN 6 // H3 + #define BEEPER_PIN 6 // H3 // #define STAT_LED_RED_PIN 32 // C2 * // #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) @@ -238,7 +204,7 @@ // #define BTN_CENTER 15 // J6/J13 * // #define BTN_ENC BTN_CENTER - + #endif // HAS_WIRED_LCD // From bb1ed7b1a6fdd58286369e09fbb5252d560454ca Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Fri, 3 Oct 2025 01:46:00 -0300 Subject: [PATCH 13/33] clean and format pins --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 51 +------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index ed855d77b5..8298277d91 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -179,67 +179,18 @@ #define LCD_LED1_PIN 35 // C2 - //#define BTN_RIGHT_PIN 14 // J1 ? - // Leave Old pins defined for now #define SR_DATA_PIN 37 // C0 * #define SR_CLK_PIN 36 // C1 * #define SR_STROBE_PIN 33 // C4 * - // #define BTN_UP 75 // J5 - // #define BTN_DOWN 73 // J4 - // #define BTN_LEFT 72 // J6/J13 - // #define BTN_RIGHT 14 // J1 - // Disable encoder #undef BTN_EN1 #undef BTN_EN2 #define BEEPER_PIN 6 // H3 - // #define STAT_LED_RED_PIN 32 // C2 * - // #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) - #endif - // #define BTN_CENTER 15 // J6/J13 * - // #define BTN_ENC BTN_CENTER - + #endif // HAS_WIRED_LCD - -// -// SD Card -// Not sure about these -// #define SD_SS_PIN 53 // B0 -// #define SD_DETECT_PIN 9 // H6 - -// #if HAS_TMC_UART -// /** -// * TMC220x stepper drivers -// * -// * Hardware serial communication ports. -// * If undefined software serial is used according to the pins below -// */ -// #define X_HARDWARE_SERIAL Serial2 -// #define Y_HARDWARE_SERIAL Serial1 - -// /** -// * Software serial -// */ - -// #define X_SERIAL_TX_PIN 16 -// #define X_SERIAL_RX_PIN 17 - -// #define Y_SERIAL_TX_PIN 18 -// #define Y_SERIAL_RX_PIN 19 - -// #define Z_SERIAL_TX_PIN 41 -// #define Z_SERIAL_RX_PIN 66 - -// #define E0_SERIAL_TX_PIN 40 -// #define E0_SERIAL_RX_PIN 67 - -// #define E1_SERIAL_TX_PIN 37 -// #define E1_SERIAL_RX_PIN 68 - -// #endif From 25c47f103518510bd36dcad017e2b784194629a5 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Fri, 3 Oct 2025 20:59:19 +1300 Subject: [PATCH 14/33] reformatting in pins_MIGHTYBOARD_REVG.h --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 24 ++++++++------------ 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 8298277d91..7c1e866cd6 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -29,7 +29,6 @@ * Use env:MightyBoard2560 or env:MightyBoard1280 in platformio.ini */ - #define ALLOW_MEGA1280 #include "env_validate.h" @@ -37,13 +36,12 @@ #define DEFAULT_MACHINE_NAME "MB Replicator" // -// Limit Switches: X and Y go to max, Z to min -// +// Limit Switches: X and Y go to max, Z to min +// #define X_STOP_PIN 30 // C7 #define Y_STOP_PIN 31 // C6 #define Z_MIN_PIN 32 // C5 - // // Steppers // @@ -53,7 +51,7 @@ #define Y_STEP_PIN 44 // L5 #define Y_DIR_PIN 42 // L7 -#define Y_ENABLE_PIN 45 // L4 +#define Y_ENABLE_PIN 45 // L4 #define Z_STEP_PIN 48 // L1 #define Z_DIR_PIN 47 // L2 @@ -85,16 +83,15 @@ #endif #define DIGIPOT_ENABLE_I2C_PULLUPS // MightyBoard doesn't have hardware I2C pin pull-ups. - -// Bed temp sensor pin +// Bed temp sensor pin #define TEMP_BED_PIN 3 // F3 -/* +/* * Temperature Sensors * Uses ADS1118 as ADC converter to read the hotend temperature sensors * SPI for ADS1118 ADC, Uses software SPI * -*/ +*/ #define TEMP_0_CS_PIN 79 // E6 #define TEMP_0_SCK_PIN 78 // E2 #define TEMP_0_MISO_PIN 80 // E7 @@ -121,7 +118,7 @@ // #define HEATER_0_PIN MOSFET_A_PIN // E5 -#define HEATER_1_PIN MOSFET_B_PIN // E3 ?* +#define HEATER_1_PIN MOSFET_B_PIN // E3 ?* #define HEATER_BED_PIN MOSFET_C_PIN // H5 #ifndef E0_AUTO_FAN_PIN @@ -141,7 +138,7 @@ // #if HAS_WIRED_LCD - + #if IS_RRD_FG_SC #define LCD_PINS_RS 33 // C4: LCD-STROBE @@ -175,11 +172,11 @@ #define BTN_DOWN_PIN 75 // J4 #define BTN_LEFT_PIN 77 // J6/J13 - #define LCD_POWER_PIN 29 // A7 + #define LCD_POWER_PIN 29 // A7 #define LCD_LED1_PIN 35 // C2 - // Leave Old pins defined for now + // Leave Old pins defined for now #define SR_DATA_PIN 37 // C0 * #define SR_CLK_PIN 36 // C1 * #define SR_STROBE_PIN 33 // C4 * @@ -192,5 +189,4 @@ #endif - #endif // HAS_WIRED_LCD From b695c85a9204d5b113aa0a7686e4027ee4bf88f3 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Fri, 3 Oct 2025 10:23:27 -0300 Subject: [PATCH 15/33] use z stop --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 7c1e866cd6..dda9cf8e56 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -40,7 +40,7 @@ // #define X_STOP_PIN 30 // C7 #define Y_STOP_PIN 31 // C6 -#define Z_MIN_PIN 32 // C5 +#define Z_STOP_PIN 32 // C5 // // Steppers From 0fb2ab28cb745ad6cd2cbc4d21c779b764bb8db9 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Tue, 14 Oct 2025 01:47:52 -0300 Subject: [PATCH 16/33] add the plus 70 pins variant for Mighty rev G --- Marlin/src/HAL/AVR/pinsDebug.h | 2 +- Marlin/src/HAL/AVR/pinsDebug_plus_70.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h index c833964a29..ce801333a2 100644 --- a/Marlin/src/HAL/AVR/pinsDebug.h +++ b/Marlin/src/HAL/AVR/pinsDebug.h @@ -45,7 +45,7 @@ #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS -#if MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14) +#if MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14, MIGHTYBOARD_REVG) #define AVR_ATmega2560_FAMILY_PLUS_70 1 #endif diff --git a/Marlin/src/HAL/AVR/pinsDebug_plus_70.h b/Marlin/src/HAL/AVR/pinsDebug_plus_70.h index 6565acd523..46fe45c1f8 100644 --- a/Marlin/src/HAL/AVR/pinsDebug_plus_70.h +++ b/Marlin/src/HAL/AVR/pinsDebug_plus_70.h @@ -25,7 +25,7 @@ * Structures for 2560 family boards that use more than 70 pins */ -#if MB(BQ_ZUM_MEGA_3D, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14) +#if MB(BQ_ZUM_MEGA_3D, MINIRAMBO, SCOOVO_X9H, TRIGORILLA_14, MIGHTYBOARD_REVG) #undef NUM_DIGITAL_PINS #define NUM_DIGITAL_PINS 85 #elif MB(MIGHTYBOARD_REVE) From 94ba0965ea7d91100eabe01682b6bf946bf46d66 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Mon, 17 Nov 2025 18:01:42 -0300 Subject: [PATCH 17/33] pins according to independent test --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 27 +++++++++----------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index dda9cf8e56..0b93399056 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -161,25 +161,22 @@ #else // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power - #define SPI_SOFT_MOSI_PIN 37 // C0 - #define SPI_SOFT_SCLK_PIN 36 // C1 - #define SPI_SOFT_MISO_PIN 33 // C4 + + #define SR_DATA_PIN 37 // C0 + #define SR_CLK_PIN 36 // C1 + #define SR_STROBE_PIN 34 // C3 - #define BTN_LATCH_PIN 34 // C3 - #define BTN_CLICK_PIN 39 // G2 + #define SR_DETECT_PIN 33 // C4 - #define BTN_UP_PIN 76 // J5 - #define BTN_DOWN_PIN 75 // J4 - #define BTN_LEFT_PIN 77 // J6/J13 + #define LCD_LED1_PIN 35 // C2 To be implemented... - #define LCD_POWER_PIN 29 // A7 + #define BTN_CLICK 39 // G2 + #define BTN_UP 83 // J5 76 or 83? + #define BTN_DOWN 82 // J4 75 or 82? + #define BTN_LEFT 84 // J6 77 or 84? + #define BTN_RIGHT 81 // J13 - #define LCD_LED1_PIN 35 // C2 - - // Leave Old pins defined for now - #define SR_DATA_PIN 37 // C0 * - #define SR_CLK_PIN 36 // C1 * - #define SR_STROBE_PIN 33 // C4 * + #define LCD_POWER_PIN 29 // A7 To be implemented... // Disable encoder #undef BTN_EN1 From 2eba129fe10984a22bf21ba8289f6b267bfbb345 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Mon, 17 Nov 2025 18:09:13 -0300 Subject: [PATCH 18/33] use backlight code --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 0b93399056..cae831bc23 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -176,7 +176,7 @@ #define BTN_LEFT 84 // J6 77 or 84? #define BTN_RIGHT 81 // J13 - #define LCD_POWER_PIN 29 // A7 To be implemented... + #define LCD_BACKLIGHT_PIN 29 // A7 To be implemented... // Disable encoder #undef BTN_EN1 From e1ac0a194b1dff2e73b4418d05b733a866ad5faf Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Mon, 17 Nov 2025 18:13:37 -0300 Subject: [PATCH 19/33] add sailfish LCD lib dep --- platformio.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 4d03696b5a..3e5e0e652c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,7 +54,8 @@ extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py pre:buildroot/share/PlatformIO/scripts/preflight-checks.py post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py -lib_deps = +lib_deps = + https://github.com/mikeshub/SailfishLCD.git default_src_filter = + - - ; LCDs and Controllers - - - - - From ac7b1cafeed8279ae6326e051eef3c714168d413 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Mon, 17 Nov 2025 23:22:14 -0300 Subject: [PATCH 20/33] working LCD --- Marlin/Configuration.h | 4 +- Marlin/src/inc/Conditionals-2-LCD.h | 6 + .../src/lcd/HD44780/MightyboardLCDSerial.cpp | 341 ++++++++++++++++++ Marlin/src/lcd/HD44780/MightyboardLCDSerial.h | 142 ++++++++ Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 31 +- Marlin/src/lcd/HD44780/marlinui_HD44780.h | 9 + Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 6 + Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 7 +- 8 files changed, 535 insertions(+), 11 deletions(-) create mode 100644 Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp create mode 100644 Marlin/src/lcd/HD44780/MightyboardLCDSerial.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 40b8ba5f22..6a3cad0b45 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3003,7 +3003,9 @@ // https://github.com/mikeshub/SailfishLCD // Uses the code directly from Sailfish // -//#define FF_INTERFACEBOARD +// #define FF_INTERFACEBOARD + +// #define MIGHTYBOARD_LCD // // TFT GLCD Panel with Marlin UI diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 41d3805954..1f50a71bf0 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -540,6 +540,12 @@ #define IS_ULTIPANEL 1 #endif +#if ENABLED(MIGHTYBOARD_LCD) + #define HAS_WIRED_LCD 1 + #define LCD_WIDTH 20 + #define LCD_HEIGHT 4 +#endif + #if ANY(IS_ULTIPANEL, ULTRA_LCD) #define HAS_WIRED_LCD 1 #endif diff --git a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp new file mode 100644 index 0000000000..a9374ffcac --- /dev/null +++ b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp @@ -0,0 +1,341 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "MightyboardLCDSerial.h" + +#include "../../inc/MarlinConfigPre.h" +#include "../../core/serial.h" + +#if HAS_MARLINUI_HD44780 && ENABLED(MIGHTYBOARD_LCD) + +#include + +/** + * Constructor: store pin assignments + */ +MightyboardLCDSerial::MightyboardLCDSerial(uint8_t strobe, uint8_t data, uint8_t clk, uint8_t pwrPin) + : _strobe_pin(strobe), _data_pin(data), _clk_pin(clk), _pwr_pin(pwrPin), + _displayfunction(LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS), + _displaycontrol(LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF), + _displaymode(LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT), + _xcursor(0), _ycursor(0) {} + +/** + * Initialize LCD display with 4-bit mode + * Follows HD44780 initialization sequence from datasheet + */ +void MightyboardLCDSerial::begin(uint8_t cols, uint8_t rows, uint8_t charsize) { + pinMode(_strobe_pin, OUTPUT); + pinMode(_data_pin, OUTPUT); + pinMode(_clk_pin, OUTPUT); + + // Power on LCD if power pin is defined + if (_pwr_pin != 255) { + pinMode(_pwr_pin, OUTPUT); + digitalWrite(_pwr_pin, LOW); // Power on (active low) + } + + _cols = cols; + _rows = rows; + + // Diagnostic output showing LCD configuration + SERIAL_ECHOLN("MightyboardLCDSerial::begin() - LCD Configuration:"); + SERIAL_ECHO(" Dimensions: "); + SERIAL_ECHO(_cols); + SERIAL_ECHO(" x "); + SERIAL_ECHOLN(_rows); + #ifdef LCD_WIDTH + SERIAL_ECHO(" Expected from config: "); + SERIAL_ECHO(LCD_WIDTH); + SERIAL_ECHO(" x "); + SERIAL_ECHOLN(LCD_HEIGHT); + #endif + SERIAL_ECHO(" Charsize: "); + if (charsize == LCD_5x8DOTS) + SERIAL_ECHOLN("5x8 dots"); + else if (charsize == LCD_5x10DOTS) + SERIAL_ECHOLN("5x10 dots"); + else + SERIAL_ECHOLN("unknown"); + + if (rows > 1) { + _displayfunction |= LCD_2LINE; + } + + if ((charsize != LCD_5x8DOTS) && (rows == 1)) { + _displayfunction |= LCD_5x10DOTS; + } + + // Power-up delay as per HD44780 datasheet (> 40ms required) + delay(50); + + // Initialization sequence for 4-bit mode + // This is a simplified sequence that works reliably + sendCommand(0x33); // Initialize, 8-bit mode attempt 1 + sendCommand(0x32); // Set 4-bit mode + sendCommand(0x28); // Function Set: 4-bit, 2-line, 5x8 dots + sendCommand(0x0C); // Display ON, cursor OFF, blink OFF + sendCommand(0x06); // Entry Mode Set: increment, no shift + sendCommand(0x01); // Clear display + delay(5); +} + +/** + * Clear the display and return cursor to home + */ +void MightyboardLCDSerial::clear() { + sendCommand(LCD_CLEARDISPLAY); + delay(2); // Clear takes ~1.52ms +} + +/** + * Return cursor to home (0, 0) + */ +void MightyboardLCDSerial::home() { + sendCommand(LCD_RETURNHOME); + delay(2); + _xcursor = 0; + _ycursor = 0; +} + +/** + * Turn display off (keeps data in DDRAM) + */ +void MightyboardLCDSerial::noDisplay() { + _displaycontrol &= ~LCD_DISPLAYON; + sendCommand(LCD_DISPLAYCONTROL | _displaycontrol); +} + +/** + * Turn display on + */ +void MightyboardLCDSerial::display() { + _displaycontrol |= LCD_DISPLAYON; + sendCommand(LCD_DISPLAYCONTROL | _displaycontrol); +} + +/** + * Turn off the blinking cursor + */ +void MightyboardLCDSerial::noBlink() { + _displaycontrol &= ~LCD_BLINKON; + sendCommand(LCD_DISPLAYCONTROL | _displaycontrol); +} + +/** + * Turn on the blinking cursor + */ +void MightyboardLCDSerial::blink() { + _displaycontrol |= LCD_BLINKON; + sendCommand(LCD_DISPLAYCONTROL | _displaycontrol); +} + +/** + * Turn off the underline cursor + */ +void MightyboardLCDSerial::noCursor() { + _displaycontrol &= ~LCD_CURSORON; + sendCommand(LCD_DISPLAYCONTROL | _displaycontrol); +} + +/** + * Turn on the underline cursor + */ +void MightyboardLCDSerial::cursor() { + _displaycontrol |= LCD_CURSORON; + sendCommand(LCD_DISPLAYCONTROL | _displaycontrol); +} + +/** + * Scroll display contents left (cursor follows) + */ +void MightyboardLCDSerial::scrollDisplayLeft() { + sendCommand(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT); +} + +/** + * Scroll display contents right (cursor follows) + */ +void MightyboardLCDSerial::scrollDisplayRight() { + sendCommand(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT); +} + +/** + * Set text direction left-to-right + */ +void MightyboardLCDSerial::leftToRight() { + _displaymode |= LCD_ENTRYLEFT; + sendCommand(LCD_ENTRYMODESET | _displaymode); +} + +/** + * Set text direction right-to-left + */ +void MightyboardLCDSerial::rightToLeft() { + _displaymode &= ~LCD_ENTRYLEFT; + sendCommand(LCD_ENTRYMODESET | _displaymode); +} + +/** + * Enable autoscroll (characters printed shift display left) + */ +void MightyboardLCDSerial::autoscroll() { + _displaymode |= LCD_ENTRYSHIFTINCREMENT; + sendCommand(LCD_ENTRYMODESET | _displaymode); +} + +/** + * Disable autoscroll + */ +void MightyboardLCDSerial::noAutoscroll() { + _displaymode &= ~LCD_ENTRYSHIFTINCREMENT; + sendCommand(LCD_ENTRYMODESET | _displaymode); +} + +/** + * Load a custom character into CGRAM + * @param location CGRAM address (0-7) + * @param charmap 8-byte array defining the character + */ +void MightyboardLCDSerial::createChar(uint8_t location, uint8_t charmap[]) { + location &= 0x7; // Only 8 locations available + sendCommand(LCD_SETCGRAMADDR | (location << 3)); + for (int8_t i = 0; i < 8; i++) { + sendData(charmap[i]); + } +} + +/** + * Set cursor position + * @param col Column (0 to cols-1) + * @param row Row (0 to rows-1) + */ +void MightyboardLCDSerial::setCursor(uint8_t col, uint8_t row) { + static const uint8_t row_offsets[] = {0x00, 0x40, 0x14, 0x54}; + if (row >= _rows) row = _rows - 1; + _xcursor = col; + _ycursor = row; + sendCommand(LCD_SETDDRAMADDR | (col + row_offsets[row])); +} + +/** + * Write a character to the LCD at current cursor position + * Automatically advances cursor and wraps to next line if needed + */ +size_t MightyboardLCDSerial::write(uint8_t value) { + sendData(value); + _xcursor++; + if (_xcursor >= _cols) { + _xcursor = 0; + _ycursor++; + if (_ycursor >= _rows) _ycursor = 0; + setCursor(_xcursor, _ycursor); + } + return 1; +} + +/** + * Send a raw command byte to LCD + */ +void MightyboardLCDSerial::command(uint8_t value) { + send(value, false); +} + +/** + * Low-level: send 8-bit value as two 4-bit nibbles + * @param value Byte to send + * @param mode false = command, true = data + */ +void MightyboardLCDSerial::send(uint8_t value, bool mode) { + write4bits(value >> 4, mode); + write4bits(value & 0x0F, mode); +} + +/** + * Send command (RS = 0) + */ +inline void MightyboardLCDSerial::sendCommand(uint8_t value) { + send(value, false); +} + +/** + * Send data (RS = 1) + */ +inline void MightyboardLCDSerial::sendData(uint8_t value) { + send(value, true); +} + +/** + * Write 4-bit nibble to display + * @param value Lower 4 bits are used + * @param dataMode false = command (RS=0), true = data (RS=1) + */ +void MightyboardLCDSerial::write4bits(uint8_t value, bool dataMode) { + // Shift data to upper 4 bits (D7-D4 in HD44780) + uint8_t bits = value << 4; + + // Set RS bit (bit 1) based on mode + // On Mightyboard: RS = 0b0010 + if (dataMode) + bits |= 0b0010; // RS = 1 for data + + // Pulse enable to latch the nibble + pulseEnable(bits); +} + +/** + * Pulse the Enable line to latch data + * On Mightyboard hardware: Enable = bit 3 (0b01000) + * @param value Pre-set data bits (D7-D0 in shift register) + */ +void MightyboardLCDSerial::pulseEnable(uint8_t value) { + _delay_us(1); + value |= 0b01000; // Set enable HIGH + writeSerial(value); + _delay_us(1); + value &= 0b11110111; // Set enable LOW + writeSerial(value); + _delay_us(50); // Wait for command execution +} + +/** + * Shift out 8 bits serially via shift register + * Sends MSB first (bit 7 down to bit 0) + * @param value Byte to shift out + */ +void MightyboardLCDSerial::writeSerial(uint8_t value) { + // Shift out each bit, MSB first + for (int8_t i = 7; i >= 0; i--) { + digitalWrite(_clk_pin, LOW); + bool data = (value >> i) & 0x01; + digitalWrite(_data_pin, data); + digitalWrite(_clk_pin, HIGH); + _delay_us(1); // Clock pulse width + } + + // Pulse strobe to latch data into display shift register + digitalWrite(_strobe_pin, HIGH); + _delay_us(1); + digitalWrite(_strobe_pin, LOW); +} + +#endif // HAS_MARLINUI_HD44780 && ENABLED(MIGHTYBOARD_LCD) diff --git a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h new file mode 100644 index 0000000000..63ac91a06e --- /dev/null +++ b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h @@ -0,0 +1,142 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * MightyboardLCDSerial + * Optimized 3-wire shift-register LCD driver for Mightyboard OEM displays + * Provides HD44780 compatible interface with minimal CPU overhead + */ + +#include + +class MightyboardLCDSerial : public Print { +public: + /** + * Constructor: initialize pin assignments + * @param strobe Strobe/latch pin (LATCH_PIN / SR_STROBE_PIN) + * @param data Data pin (MOSI_PIN / SR_DATA_PIN) + * @param clk Clock pin (SCLK_PIN / SR_CLK_PIN) + * @param pwrPin Power control pin (LCD_PWR_PIN) + */ + MightyboardLCDSerial(uint8_t strobe, uint8_t data, uint8_t clk, uint8_t pwrPin = 255); + + /** + * Initialize display with given dimensions + * @param cols Number of columns (typically 20) + * @param rows Number of rows (typically 4) + */ + void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); + + // Basic display control + void clear(); + void home(); + void noDisplay(); + void display(); + void noBlink(); + void blink(); + void noCursor(); + void cursor(); + + // Cursor movement + void setCursor(uint8_t col, uint8_t row); + void scrollDisplayLeft(); + void scrollDisplayRight(); + void leftToRight(); + void rightToLeft(); + void autoscroll(); + void noAutoscroll(); + + // Custom characters + void createChar(uint8_t location, uint8_t charmap[]); + + // Text output + virtual size_t write(uint8_t value); + using Print::write; + + // Low-level command + void command(uint8_t value); + +private: + uint8_t _strobe_pin; + uint8_t _data_pin; + uint8_t _clk_pin; + uint8_t _pwr_pin; + + uint8_t _cols; + uint8_t _rows; + uint8_t _displayfunction; + uint8_t _displaycontrol; + uint8_t _displaymode; + + uint8_t _xcursor; + uint8_t _ycursor; + + // Low-level communication + void send(uint8_t value, bool mode); + void sendCommand(uint8_t value); + void sendData(uint8_t value); + void write4bits(uint8_t value, bool dataMode); + void pulseEnable(uint8_t value); + void writeSerial(uint8_t value); + + // HD44780 command constants + static const uint8_t LCD_CLEARDISPLAY = 0x01; + static const uint8_t LCD_RETURNHOME = 0x02; + static const uint8_t LCD_ENTRYMODESET = 0x04; + static const uint8_t LCD_DISPLAYCONTROL = 0x08; + static const uint8_t LCD_CURSORSHIFT = 0x10; + static const uint8_t LCD_FUNCTIONSET = 0x20; + static const uint8_t LCD_SETCGRAMADDR = 0x40; + static const uint8_t LCD_SETDDRAMADDR = 0x80; + + // Entry mode flags + static const uint8_t LCD_ENTRYRIGHT = 0x00; + static const uint8_t LCD_ENTRYLEFT = 0x02; + static const uint8_t LCD_ENTRYSHIFTINCREMENT = 0x01; + static const uint8_t LCD_ENTRYSHIFTDECREMENT = 0x00; + + // Display control flags + static const uint8_t LCD_DISPLAYON = 0x04; + static const uint8_t LCD_DISPLAYOFF = 0x00; + static const uint8_t LCD_CURSORON = 0x02; + static const uint8_t LCD_CURSOROFF = 0x00; + static const uint8_t LCD_BLINKON = 0x01; + static const uint8_t LCD_BLINKOFF = 0x00; + + // Display shift flags + static const uint8_t LCD_DISPLAYMOVE = 0x08; + static const uint8_t LCD_CURSORMOVE = 0x00; + static const uint8_t LCD_MOVERIGHT = 0x04; + static const uint8_t LCD_MOVELEFT = 0x00; + + // Function set flags + static const uint8_t LCD_8BITMODE = 0x10; + static const uint8_t LCD_4BITMODE = 0x00; + static const uint8_t LCD_2LINE = 0x08; + static const uint8_t LCD_1LINE = 0x00; + static const uint8_t LCD_5x10DOTS = 0x04; + static const uint8_t LCD_5x8DOTS = 0x00; +}; + +// Alias for compatibility with Marlin's LCD_CLASS macro +using MightyboardLCD = MightyboardLCDSerial; diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index a7507bd1e8..5362a3d056 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -67,19 +67,19 @@ // #if ENABLED(LCD_I2C_TYPE_PCF8575) - + #warning "LCD_CLASS: LiquidCrystal_I2C (PCF8575)" LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7); #elif ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) - + #warning "LCD_CLASS: LiquidTWI2 (MCP23017/MCP23008)" LCD_CLASS lcd(LCD_I2C_ADDRESS OPTARG(DETECT_I2C_LCD_DEVICE, 1)); #elif ENABLED(LCD_I2C_TYPE_PCA8574) - + #warning "LCD_CLASS: LiquidCrystal_I2C (PCA8574)" LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); #elif ENABLED(SR_LCD_2W_NL) - + #warning "LCD_CLASS: LiquidCrystal_SR (2-Wire)" // 2 wire Non-latching LCD SR from: // https://github.com/fmalpartida/New-LiquidCrystal/wiki/schematics#user-content-ShiftRegister_connection @@ -89,8 +89,20 @@ #endif ); -#elif ENABLED(SR_LCD_3W_NL) +#elif ENABLED(MIGHTYBOARD_LCD) + #warning "LCD_CLASS: MightyboardLCDSerial (MIGHTYBOARD_LCD)" + // 3-wire shift-register LCD for Mightyboard + // Optimized in-tree implementation + #if PIN_EXISTS(LCD_PWR) + #warning "MIGHTYBOARD: LCD_PWR_PIN defined - power control enabled" + LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN, LCD_PWR_PIN); + #else + #warning "MIGHTYBOARD: LCD_PWR_PIN not defined - power control disabled" + LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN); + #endif +#elif ENABLED(SR_LCD_3W_NL) + #warning "LCD_CLASS: LiquidCrystalSerial (Sailfish SR_LCD_3W_NL)" // NewLiquidCrystal was not working // https://github.com/mikeshub/SailfishLCD // uses the code directly from Sailfish @@ -98,7 +110,7 @@ LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN); #elif ENABLED(LCM1602) - + #warning "LCD_CLASS: LiquidCrystal_I2C (LCM1602)" LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); #elif ENABLED(YHCB2004) @@ -119,10 +131,11 @@ #error "YHCB2004 display requires YHCB2004_SS_PIN, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, and YHCB2004_MISO_PIN." #endif + #warning "LCD_CLASS: LiquidCrystal_AIP31068_SPI (YHCB2004)" LCD_CLASS lcd(YHCB2004_SS_PIN, 20, 4, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, YHCB2004_MISO_PIN); // SS, cols, rows, SCK, MOSI, MISO #else - + #warning "LCD_CLASS: LiquidCrystal (Standard Direct)" // Standard direct-connected LCD implementations LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_EN, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); @@ -378,6 +391,8 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS void MarlinUI::init_lcd() { + SERIAL_ECHOLN("DEBUG_LCD: about to call lcd.begin()"); + #if ENABLED(LCD_I2C_TYPE_PCF8575) lcd.begin(LCD_WIDTH, LCD_HEIGHT); #ifdef LCD_I2C_PIN_BL @@ -402,6 +417,8 @@ void MarlinUI::init_lcd() { lcd.begin(LCD_WIDTH, LCD_HEIGHT); #endif + SERIAL_ECHOLN("DEBUG_LCD: lcd.begin returned"); + set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); lcd.clear(); diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.h b/Marlin/src/lcd/HD44780/marlinui_HD44780.h index 15f268f8d9..09050d2996 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.h +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.h @@ -89,6 +89,15 @@ #include #define LCD_CLASS LiquidCrystal_SR +#elif ENABLED(MIGHTYBOARD_LCD) + + // 3-wire shift-register LCD for Mightyboard + // Optimized in-tree implementation + // Pin mapping: SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN + + #include "MightyboardLCDSerial.h" + #define LCD_CLASS MightyboardLCDSerial + #elif ENABLED(SR_LCD_3W_NL) // NewLiquidCrystal didn't work, so this uses diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 94e911dba1..9d10d2b2ad 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -304,6 +304,11 @@ void MarlinUI::init_lcd() { u8g.init(U8G_PARAM); did_init_u8g = true; } + SERIAL_ECHOLN("init LCD"); + #if PIN_EXISTS(LCD_PWR_PIN) + SERIAL_ECHOLN("Pwr pin low"); + digitalWrite(LCD_PWR_PIN, LOW); + #endif #if PIN_EXISTS(LCD_BACKLIGHT) OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away @@ -339,6 +344,7 @@ void MarlinUI::init_lcd() { #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT) WRITE(LCD_BACKLIGHT_PIN, HIGH); + SERIAL_ECHOLN("Backlight high"); #endif TERN_(HAS_LCD_CONTRAST, refresh_contrast()); diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index cae831bc23..3ffa69ea65 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -138,7 +138,7 @@ // #if HAS_WIRED_LCD - +#warning "HAS_WIRED_LCD is defined." #if IS_RRD_FG_SC #define LCD_PINS_RS 33 // C4: LCD-STROBE @@ -160,6 +160,7 @@ #define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3) #else + #warning "Using SR pins." // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power #define SR_DATA_PIN 37 // C0 @@ -176,8 +177,8 @@ #define BTN_LEFT 84 // J6 77 or 84? #define BTN_RIGHT 81 // J13 - #define LCD_BACKLIGHT_PIN 29 // A7 To be implemented... - + #define LCD_PWR_PIN 29 // A7 To be implemented... + // Disable encoder #undef BTN_EN1 #undef BTN_EN2 From 98633f7093c1ad51ce29361e14b128acd3e6dcab Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 19 Nov 2025 01:14:03 -0300 Subject: [PATCH 21/33] Corrected pins, add debug pins list for M43, conditional input pullups, conditional UI LCD --- Marlin/src/inc/Conditionals-2-LCD.h | 8 +++-- Marlin/src/lcd/marlinui.cpp | 31 ++++++++++++++++---- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 20 +++++++++---- Marlin/src/pins/pinsDebug_list.h | 4 +++ 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 1f50a71bf0..6aa8b25e99 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -540,13 +540,15 @@ #define IS_ULTIPANEL 1 #endif -#if ENABLED(MIGHTYBOARD_LCD) - #define HAS_WIRED_LCD 1 +#if ENABLED(MIGHTYBOARD_INTERFACE) + #define MIGHTYBOARD_LCD + // #define IS_ULTIPANEL 1 + // #define HAS_WIRED_LCD 1 #define LCD_WIDTH 20 #define LCD_HEIGHT 4 #endif -#if ANY(IS_ULTIPANEL, ULTRA_LCD) +#if ANY(IS_ULTIPANEL, ULTRA_LCD, MIGHTYBOARD_LCD) #define HAS_WIRED_LCD 1 #endif diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index f4d4c28fa7..27613756b5 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -273,7 +273,11 @@ void MarlinUI::init() { SET_INPUT_PULLUP(BTN_EN2); #endif #if BUTTON_EXISTS(ENC) - SET_INPUT_PULLUP(BTN_ENC); + #if ENABLED(MIGHTYBOARD_DISABLE_ENC_PULLUP) + SET_INPUT(BTN_ENC); + #else + SET_INPUT_PULLUP(BTN_ENC); + #endif #endif #if BUTTON_EXISTS(ENC_EN) SET_INPUT_PULLUP(BTN_ENC_EN); @@ -282,16 +286,33 @@ void MarlinUI::init() { SET_INPUT_PULLUP(BTN_BACK); #endif #if BUTTON_EXISTS(UP) - SET_INPUT(BTN_UP); + #if ENABLED(MIGHTYBOARD_BUTTON_PULLUPS) + SET_INPUT_PULLUP(BTN_UP); + #else + SET_INPUT(BTN_UP); + #endif #endif #if BUTTON_EXISTS(DOWN) - SET_INPUT(BTN_DOWN); + #if ENABLED(MIGHTYBOARD_BUTTON_PULLUPS) + SET_INPUT_PULLUP(BTN_DOWN); + #else + SET_INPUT(BTN_DOWN); + #endif #endif #if BUTTON_EXISTS(LFT) - SET_INPUT(BTN_LEFT); + #if ENABLED(MIGHTYBOARD_BUTTON_PULLUPS) + SET_INPUT_PULLUP(BTN_LEFT); + #else + SET_INPUT(BTN_LEFT); + #endif #endif #if BUTTON_EXISTS(RT) - SET_INPUT(BTN_RIGHT); + #if ENABLED(MIGHTYBOARD_BUTTON_PULLUPS) + SET_INPUT_PULLUP(BTN_RIGHT); + #else + SET_INPUT(BTN_RIGHT); + #endif + #endif #endif #if HAS_SHIFT_ENCODER diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 3ffa69ea65..fca1db4e06 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -26,6 +26,7 @@ * Schematic: not avalable (as rev G and H are not open source) * Pins based on the work of https://github.com/Sgail7/Replicator-Revival-Project/ * Pin number according to Mega extended mega2560ext: .\buildroot\share\PlatformIO\variants\MARLIN_MEGA_EXTENDED\pins_arduino.h + * Corrected pins based on Marlin\src\libs\softspi.h * Use env:MightyBoard2560 or env:MightyBoard1280 in platformio.ini */ @@ -76,7 +77,7 @@ #define DIGIPOTS_I2C_SDA_Y 43 // L6 #define DIGIPOTS_I2C_SDA_Z 46 // L3 #define DIGIPOTS_I2C_SDA_E0 26 // A4 -#define DIGIPOTS_I2C_SDA_E1 77 // J7 +#define DIGIPOTS_I2C_SDA_E1 74 // J7 #ifndef DIGIPOT_I2C_ADDRESS_A #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) @@ -171,11 +172,16 @@ #define LCD_LED1_PIN 35 // C2 To be implemented... - #define BTN_CLICK 39 // G2 - #define BTN_UP 83 // J5 76 or 83? - #define BTN_DOWN 82 // J4 75 or 82? - #define BTN_LEFT 84 // J6 77 or 84? - #define BTN_RIGHT 81 // J13 + #define BTN_CENTER 39 // G2 + #define BTN_UP 76 // J5 + #define BTN_DOWN 75 // J4 + #define BTN_LEFT 77 // J6 + #define BTN_RIGHT 73 // J3 + + // Map the CLICK button to the encoder 'click' so Marlin treats it as SELECT + #ifndef BTN_ENC + #define BTN_ENC BTN_CENTER + #endif #define LCD_PWR_PIN 29 // A7 To be implemented... @@ -188,3 +194,5 @@ #endif #endif // HAS_WIRED_LCD + + diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index ad17fe2436..ba1aeb8816 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -954,6 +954,10 @@ #if PIN_EXISTS(LCD_BACKLIGHT) REPORT_NAME_DIGITAL(__LINE__, LCD_BACKLIGHT_PIN) #endif +#if PIN_EXISTS(LCD_PWR) + REPORT_NAME_DIGITAL(__LINE__, LCD_PWR_PIN) +#endif + // // LED Lights From da2a295741ed0becc84b0efc7670f20bfa97f681 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 19 Nov 2025 01:15:16 -0300 Subject: [PATCH 22/33] debug prints --- Marlin/src/inc/Conditionals-2-LCD.h | 32 +++++++++++++++ Marlin/src/lcd/buttons.h | 1 + Marlin/src/lcd/marlinui.cpp | 61 +++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 6aa8b25e99..d8cc8ac3c8 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -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 diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index 2bd5fd7b35..8bf76b784d 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -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 diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 27613756b5..9fa602e07f 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -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 From d5c8b1307dd3e6fab8a866216215c8569e37dc51 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 19 Nov 2025 01:19:28 -0300 Subject: [PATCH 23/33] debug conditional print --- .../src/lcd/HD44780/MightyboardLCDSerial.cpp | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp index a9374ffcac..b8326de0fd 100644 --- a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp +++ b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp @@ -58,25 +58,26 @@ void MightyboardLCDSerial::begin(uint8_t cols, uint8_t rows, uint8_t charsize) { _rows = rows; // Diagnostic output showing LCD configuration - SERIAL_ECHOLN("MightyboardLCDSerial::begin() - LCD Configuration:"); - SERIAL_ECHO(" Dimensions: "); - SERIAL_ECHO(_cols); - SERIAL_ECHO(" x "); - SERIAL_ECHOLN(_rows); - #ifdef LCD_WIDTH - SERIAL_ECHO(" Expected from config: "); - SERIAL_ECHO(LCD_WIDTH); + #ifdef MIGHTYBOARD_RUNTIME_DEBUG + SERIAL_ECHOLN("MightyboardLCDSerial::begin() - LCD Configuration:"); + SERIAL_ECHO(" Dimensions: "); + SERIAL_ECHO(_cols); SERIAL_ECHO(" x "); - SERIAL_ECHOLN(LCD_HEIGHT); + SERIAL_ECHOLN(_rows); + #ifdef LCD_WIDTH + SERIAL_ECHO(" Expected from config: "); + SERIAL_ECHO(LCD_WIDTH); + SERIAL_ECHO(" x "); + SERIAL_ECHOLN(LCD_HEIGHT); + #endif + SERIAL_ECHO(" Charsize: "); + if (charsize == LCD_5x8DOTS) + SERIAL_ECHOLN("5x8 dots"); + else if (charsize == LCD_5x10DOTS) + SERIAL_ECHOLN("5x10 dots"); + else + SERIAL_ECHOLN("unknown"); #endif - SERIAL_ECHO(" Charsize: "); - if (charsize == LCD_5x8DOTS) - SERIAL_ECHOLN("5x8 dots"); - else if (charsize == LCD_5x10DOTS) - SERIAL_ECHOLN("5x10 dots"); - else - SERIAL_ECHOLN("unknown"); - if (rows > 1) { _displayfunction |= LCD_2LINE; } From 730339ef7f3ca4d3926b0a6cf9506fda66fb00af Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 19 Nov 2025 01:22:21 -0300 Subject: [PATCH 24/33] update name --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index fca1db4e06..bfd351ea96 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -170,7 +170,7 @@ #define SR_DETECT_PIN 33 // C4 - #define LCD_LED1_PIN 35 // C2 To be implemented... + #define BUTTON_LED_PIN 35 // C2 To be implemented... #define BTN_CENTER 39 // G2 #define BTN_UP 76 // J5 @@ -183,7 +183,7 @@ #define BTN_ENC BTN_CENTER #endif - #define LCD_PWR_PIN 29 // A7 To be implemented... + #define LCD_PWR_PIN 29 // A7 // Disable encoder #undef BTN_EN1 From 2a5939116910d0ccacb3ac69d0a1488798112c58 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 19 Nov 2025 01:29:20 -0300 Subject: [PATCH 25/33] clean debug, disable, conditional enable --- Marlin/src/inc/Conditionals-2-LCD.h | 63 ++++++++++++++++------------- Marlin/src/lcd/buttons.h | 1 - Marlin/src/lcd/marlinui.cpp | 60 +++++++++++++-------------- 3 files changed, 64 insertions(+), 60 deletions(-) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index d8cc8ac3c8..53daae462f 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -553,35 +553,40 @@ #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 +// // 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 +// #if ENABLED(HAS_DIGITAL_BUTTONS) +// #warning "HAS_DIGITAL_BUTTONS enabled" +// #else +// #warning "MightyBoard build: HAS_DIGITAL_BUTTONS is NOT defined" +// #endif +// #endif #if ANY(IS_ULTIPANEL, REPRAPWORLD_KEYPAD) diff --git a/Marlin/src/lcd/buttons.h b/Marlin/src/lcd/buttons.h index 8bf76b784d..2bd5fd7b35 100644 --- a/Marlin/src/lcd/buttons.h +++ b/Marlin/src/lcd/buttons.h @@ -28,7 +28,6 @@ #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 diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 9fa602e07f..ee372aca69 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -314,39 +314,39 @@ void MarlinUI::init() { #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 + // // 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 ENABLED(MIGHTYBOARD_RUNTIME_DEBUG) && 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(""); + // // 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 + // // 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 + // #ifdef BTN_CLICK + // SERIAL_ECHO_MSG("BTN_CLICK pin: ", BTN_CLICK); + // SERIAL_ECHOLN(""); + // #endif + // #endif #if HAS_SHIFT_ENCODER From 7c19f8b48411badfbf734d02924d6850dccb870c Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 19 Nov 2025 01:43:03 -0300 Subject: [PATCH 26/33] not using sailfish lcd --- platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 3e5e0e652c..8df06b084e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -55,7 +55,6 @@ extra_scripts = pre:buildroot/share/PlatformIO/scripts/preflight-checks.py post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py lib_deps = - https://github.com/mikeshub/SailfishLCD.git default_src_filter = + - - ; LCDs and Controllers - - - - - From e81066d6acd5e422a2154c83a1d152233b0f37bb Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Mon, 24 Nov 2025 03:19:34 -0300 Subject: [PATCH 27/33] fix buttons UI, SD pins --- Marlin/src/inc/Conditionals-2-LCD.h | 4 ++-- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 53daae462f..579d88bada 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -542,14 +542,14 @@ #if ENABLED(MIGHTYBOARD_INTERFACE) #define MIGHTYBOARD_LCD - // #define IS_ULTIPANEL 1 + #define IS_ULTIPANEL 1 // Enables button menu navigation and functions (Marlin UI) // #define HAS_WIRED_LCD 1 #define LCD_WIDTH 20 #define LCD_HEIGHT 4 #endif #if ANY(IS_ULTIPANEL, ULTRA_LCD, MIGHTYBOARD_LCD) - #define HAS_WIRED_LCD 1 + #define HAS_WIRED_LCD 1 // Enables LCD and button detection #endif diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index bfd351ea96..3bf7422d6b 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -191,6 +191,22 @@ #define BEEPER_PIN 6 // H3 + // + // SD Card + // + // --- Secure Digital Card configuration --- + // NOTE: If SD support is enabled, it is implicitly assumed that the + // following pins are connected: + // AVR | SD header + //---------|-------------- + // MISO | DATA_OUT + // MOSI | DATA_IN + // SCK | CLK + + #define SD_WRITE_PIN 41 // Sailfish mighty two: G0(41) H5(D8) - + #define SD_DETECT_PIN 40 // Sailfish mighty two: G1(40) H6(D9) L0(D49) + #define SD_SS_PIN 53 // Sailfish mighty two: B0(53) + #endif #endif // HAS_WIRED_LCD From ff03ac9d9e6834c65c1b168b3122442b6da8ce46 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Wed, 26 Nov 2025 03:40:20 +0000 Subject: [PATCH 28/33] format mightyboard pins --- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 3bf7422d6b..9ed0d277f7 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -163,14 +163,14 @@ #else #warning "Using SR pins." // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power - - #define SR_DATA_PIN 37 // C0 - #define SR_CLK_PIN 36 // C1 + + #define SR_DATA_PIN 37 // C0 + #define SR_CLK_PIN 36 // C1 #define SR_STROBE_PIN 34 // C3 #define SR_DETECT_PIN 33 // C4 - #define BUTTON_LED_PIN 35 // C2 To be implemented... + #define BUTTON_LED_PIN 35 // C2 To be implemented... #define BTN_CENTER 39 // G2 #define BTN_UP 76 // J5 @@ -180,11 +180,11 @@ // Map the CLICK button to the encoder 'click' so Marlin treats it as SELECT #ifndef BTN_ENC - #define BTN_ENC BTN_CENTER + #define BTN_ENC BTN_CENTER #endif #define LCD_PWR_PIN 29 // A7 - + // Disable encoder #undef BTN_EN1 #undef BTN_EN2 @@ -203,12 +203,10 @@ // MOSI | DATA_IN // SCK | CLK - #define SD_WRITE_PIN 41 // Sailfish mighty two: G0(41) H5(D8) - - #define SD_DETECT_PIN 40 // Sailfish mighty two: G1(40) H6(D9) L0(D49) - #define SD_SS_PIN 53 // Sailfish mighty two: B0(53) + #define SD_WRITE_PIN 41 // Sailfish mighty two: G0(41) H5(D8) - + #define SD_DETECT_PIN 40 // Sailfish mighty two: G1(40) H6(D9) L0(D49) + #define SD_SS_PIN 53 // Sailfish mighty two: B0(53) #endif #endif // HAS_WIRED_LCD - - From 0a479f2d34b0462647b84cfc3c5ee9c2aefbfb49 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Tue, 2 Dec 2025 01:34:20 -0300 Subject: [PATCH 29/33] update conditionals add mighty --- Marlin/src/inc/Conditionals-2-LCD.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index e11bbf7af7..a74bfd231f 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -967,6 +967,7 @@ + ENABLED(CARTESIO_UI) \ + ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ + ENABLED(FF_INTERFACEBOARD) \ + + ENABLED(MIGHTYBOARD_INTERFACE) \ + ENABLED(FYSETC_242_OLED_12864) \ + ENABLED(G3D_PANEL) \ + ENABLED(LCD_FOR_MELZI) \ From 2bf26d7458cfeb8b8c1249bd2d40773bbe3f8277 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Tue, 2 Dec 2025 01:37:33 -0300 Subject: [PATCH 30/33] fix space --- Marlin/src/inc/Conditionals-2-LCD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index a74bfd231f..0781e4d865 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -967,7 +967,7 @@ + ENABLED(CARTESIO_UI) \ + ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ + ENABLED(FF_INTERFACEBOARD) \ - + ENABLED(MIGHTYBOARD_INTERFACE) \ + + ENABLED(MIGHTYBOARD_INTERFACE) \ + ENABLED(FYSETC_242_OLED_12864) \ + ENABLED(G3D_PANEL) \ + ENABLED(LCD_FOR_MELZI) \ From 94b91dbbe19f209749bbfe6de321cee4d7c43717 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Sun, 14 Dec 2025 03:25:56 -0300 Subject: [PATCH 31/33] set custom address, ad optional swap color channels --- Marlin/src/feature/leds/pca9632.cpp | 35 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/Marlin/src/feature/leds/pca9632.cpp b/Marlin/src/feature/leds/pca9632.cpp index d8fba380a4..8f586226cb 100644 --- a/Marlin/src/feature/leds/pca9632.cpp +++ b/Marlin/src/feature/leds/pca9632.cpp @@ -81,7 +81,11 @@ #define LED_ON 0x01 #define LED_PWM 0x02 -#define PCA9632_ADDRESS 0b01100000 +#if !defined(PCA9632_ADDRESS) + #define PCA9632_ADDRESS 0b01100000 + #warning "Using default PCA9632 I2C address=" STRINGIFY(PCA9632_ADDRESS) +#endif +#warning "Using PCA9632 I2C address=" STRINGIFY(PCA9632_ADDRESS) byte PCA_init = 0; @@ -132,15 +136,28 @@ void PCA9632_set_led_color(const LED1Color_t &color) { PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_MODE2, PCA9632_MODE2_VALUE); } - const byte LEDOUT = (color.r ? LED_PWM << PCA9632_RED : 0) - | (color.g ? LED_PWM << PCA9632_GRN : 0) - | (color.b ? LED_PWM << PCA9632_BLU : 0) - | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0)); + #if ENABLED(PCA9632_SWAP_RB) + const byte LEDOUT = (color.b ? LED_PWM << PCA9632_RED : 0) + | (color.g ? LED_PWM << PCA9632_GRN : 0) + | (color.r ? LED_PWM << PCA9632_BLU : 0) + | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0)); + + PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.b, color.g, color.r + OPTARG(PCA9632_RGBW, color.w) + ); + PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT); + #else + const byte LEDOUT = (color.r ? LED_PWM << PCA9632_RED : 0) + | (color.g ? LED_PWM << PCA9632_GRN : 0) + | (color.b ? LED_PWM << PCA9632_BLU : 0) + | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0)); + + PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.r, color.g, color.b + OPTARG(PCA9632_RGBW, color.w) + ); + PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT); + #endif - PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.r, color.g, color.b - OPTARG(PCA9632_RGBW, color.w) - ); - PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT); } #if ENABLED(PCA9632_BUZZER) From 05a0dee3dab6750f0419a5fc9160cda0ddc5f509 Mon Sep 17 00:00:00 2001 From: Axel Sepulveda Date: Mon, 22 Dec 2025 14:22:27 -0300 Subject: [PATCH 32/33] Left and right wotk as menu back and back to status, similar as zonestar LCD and RRW display --- Marlin/Configuration.h | 30 +++++++++++++++++- Marlin/src/lcd/marlinui.cpp | 63 ++++++++++++++++++++++++------------- Marlin/src/lcd/marlinui.h | 6 ++++ 3 files changed, 77 insertions(+), 22 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index fdaaf1ceab..20ddfeead5 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3045,7 +3045,35 @@ // // #define FF_INTERFACEBOARD -// #define MIGHTYBOARD_LCD +// +// MightyBoard LCD/Interface +// + +//#define MIGHTYBOARD_LCD +//#define MIGHTYBOARD_INTERFACE + +// Runtime debug: uncomment to enable lightweight serial runtime traces for UI/button flow +// Enable runtime debug traces for MightyBoard button diagnostics +// Uncomment to see serial output of button state reads and encoder changes +//#define MIGHTYBOARD_RUNTIME_DEBUG + + +// BTN_ENC (central click) pull-up control (independent flag for click button) +// Disable this if the button reads stuck HIGH even when pressed +//#define MIGHTYBOARD_DISABLE_ENC_PULLUP + +// Board-specific option: enable internal INPUT_PULLUP for MightyBoard button pins +// Define `MIGHTYBOARD_BUTTON_PULLUPS` to enable `SET_INPUT_PULLUP(BTN_*)` in Marlin's UI init. +// #ifndef MIGHTYBOARD_BUTTON_PULLUPS +// #define MIGHTYBOARD_BUTTON_PULLUPS +// #endif + +// +// Optional: Button behavior for LEFT/RIGHT +// If enabled, LEFT goes back one menu level, RIGHT returns to status screen +// If disabled (default), LEFT/RIGHT change encoder position (navigate menu items) +// +//#define DIGITAL_BUTTON_L_R_MENU_BACK_STATUS // // TFT GLCD Panel with Marlin UI diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index ee372aca69..d7462aa929 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -70,6 +70,12 @@ MarlinUI ui; bool MarlinUI::wait_for_move; // = false #endif +#if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) +// Flags set from interrupt context; handled in main loop +volatile bool MarlinUI::request_back = false; +volatile bool MarlinUI::request_return_to_status = false; +#endif + constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if HAS_STATUS_MESSAGE @@ -1079,7 +1085,19 @@ void MarlinUI::init() { else wait_for_unclick = false; } - + #if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) + // Handle requests set from interrupt context (ISR-safe) + if (MarlinUI::request_back) { + MarlinUI::request_back = false; + quick_feedback(); + goto_previous_screen(); + } + if (MarlinUI::request_return_to_status) { + MarlinUI::request_return_to_status = false; + quick_feedback(); + return_to_status(); + } + #endif if (LCD_BACK_CLICKED()) { quick_feedback(); goto_previous_screen(); @@ -1432,27 +1450,30 @@ void MarlinUI::init() { 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 } + #if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) + // Alternative behavior: LEFT/RIGHT for menu navigation (back/home) instead of encoder scrolling + else if (BUTTON_PRESSED(LEFT)) { + // ISR-safe: request action to be handled in main loop + MarlinUI::request_back = true; + next_button_update_ms = now + 300; + } + else if (BUTTON_PRESSED(RIGHT)) { + // ISR-safe: request action to be handled in main loop + MarlinUI::request_return_to_status = true; + next_button_update_ms = now + 300; + } + #else + // Default behavior: LEFT/RIGHT change encoder position for menu item selection + else if (BUTTON_PRESSED(LEFT)) { + encoderDiff = -pulses; + next_button_update_ms = now + 300; + } + else if (BUTTON_PRESSED(RIGHT)) { + encoderDiff = pulses; + next_button_update_ms = now + 300; + } + #endif // DIGITAL_BUTTON_L_R_MENU_BACK_STATUS #endif // UP || DOWN || LEFT || RIGHT diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 85d05887e3..cda27c879b 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -825,6 +825,12 @@ public: static void update_buttons(); + #if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) + // Requests set from interrupt context and handled in main loop + static volatile bool request_back; + static volatile bool request_return_to_status; + #endif + #if ENABLED(ENCODER_NOISE_FILTER) /** * Some printers may have issues with EMI noise especially using a motherboard with 3.3V logic levels From 2e888ff89a7863c082813ba6a9e501b8defbc0f7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 11 Jan 2026 02:58:29 -0600 Subject: [PATCH 33/33] review cleanup --- Marlin/Configuration.h | 36 ++-- Marlin/src/feature/leds/pca9632.cpp | 46 ++--- Marlin/src/inc/Conditionals-2-LCD.h | 57 +----- .../src/lcd/HD44780/MightyboardLCDSerial.cpp | 47 ++--- Marlin/src/lcd/HD44780/MightyboardLCDSerial.h | 2 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 23 +-- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 8 +- Marlin/src/lcd/marlinui.cpp | 164 +++++++++--------- Marlin/src/lcd/marlinui.h | 7 +- Marlin/src/libs/softspi.h | 3 +- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h | 146 ++++++++-------- Marlin/src/pins/pins.h | 3 +- platformio.ini | 2 +- 13 files changed, 223 insertions(+), 321 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 20ddfeead5..2b5791c9e6 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3043,37 +3043,21 @@ // https://github.com/mikeshub/SailfishLCD // Uses the code directly from Sailfish // -// #define FF_INTERFACEBOARD +//#define FF_INTERFACEBOARD // -// MightyBoard LCD/Interface +// MightyBoard LCD and Interface // - //#define MIGHTYBOARD_LCD -//#define MIGHTYBOARD_INTERFACE +#if ENABLED(MIGHTYBOARD_LCD) + //#define MIGHTYBOARD_RUNTIME_DEBUG // Lightweight debug output for buttons and encoder + //#define MIGHTYBOARD_DISABLE_ENC_PULLUP // Enable if the encoder button doesn't work correctly + //#define MIGHTYBOARD_BUTTON_PULLUPS // Enable if other buttons don't work correctly -// Runtime debug: uncomment to enable lightweight serial runtime traces for UI/button flow -// Enable runtime debug traces for MightyBoard button diagnostics -// Uncomment to see serial output of button state reads and encoder changes -//#define MIGHTYBOARD_RUNTIME_DEBUG - - -// BTN_ENC (central click) pull-up control (independent flag for click button) -// Disable this if the button reads stuck HIGH even when pressed -//#define MIGHTYBOARD_DISABLE_ENC_PULLUP - -// Board-specific option: enable internal INPUT_PULLUP for MightyBoard button pins -// Define `MIGHTYBOARD_BUTTON_PULLUPS` to enable `SET_INPUT_PULLUP(BTN_*)` in Marlin's UI init. -// #ifndef MIGHTYBOARD_BUTTON_PULLUPS -// #define MIGHTYBOARD_BUTTON_PULLUPS -// #endif - -// -// Optional: Button behavior for LEFT/RIGHT -// If enabled, LEFT goes back one menu level, RIGHT returns to status screen -// If disabled (default), LEFT/RIGHT change encoder position (navigate menu items) -// -//#define DIGITAL_BUTTON_L_R_MENU_BACK_STATUS + // Enable to use LEFT/RIGHT for Back and Status Screen. + // Otherwise LEFT/RIGHT act like the encoder in menu navigation and value editing. + //#define MIGHTYBOARD_BACK_STATUS_BUTTONS +#endif // MIGHTYBOARD_LCD // // TFT GLCD Panel with Marlin UI diff --git a/Marlin/src/feature/leds/pca9632.cpp b/Marlin/src/feature/leds/pca9632.cpp index 8f586226cb..29c00fc682 100644 --- a/Marlin/src/feature/leds/pca9632.cpp +++ b/Marlin/src/feature/leds/pca9632.cpp @@ -81,11 +81,11 @@ #define LED_ON 0x01 #define LED_PWM 0x02 -#if !defined(PCA9632_ADDRESS) +#ifndef PCA9632_ADDRESS #define PCA9632_ADDRESS 0b01100000 - #warning "Using default PCA9632 I2C address=" STRINGIFY(PCA9632_ADDRESS) + #warning "Using default PCA9632_ADDRESS for I2C (0b01100000)." #endif -#warning "Using PCA9632 I2C address=" STRINGIFY(PCA9632_ADDRESS) +//static_assert(false, "Using PCA9632 I2C address=" STRINGIFY(PCA9632_ADDRESS)); byte PCA_init = 0; @@ -102,16 +102,16 @@ static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const #if DISABLED(PCA9632_NO_AUTO_INC) uint8_t data[4]; data[0] = PCA9632_AUTO_IND | regadd; - data[1 + (PCA9632_RED >> 1)] = vr; + data[1 + (PCA9632_RED >> 1)] = TERN(PCA9632_SWAP_RB, vb, vr); data[1 + (PCA9632_GRN >> 1)] = vg; - data[1 + (PCA9632_BLU >> 1)] = vb; + data[1 + (PCA9632_BLU >> 1)] = TERN(PCA9632_SWAP_RB, vr, vb); Wire.beginTransmission(I2C_ADDRESS(addr)); Wire.write(data, sizeof(data)); Wire.endTransmission(); #else - PCA9632_WriteRegister(addr, regadd + (PCA9632_RED >> 1), vr); + PCA9632_WriteRegister(addr, regadd + (PCA9632_RED >> 1), TERN(PCA9632_SWAP_RB, vb, vr)); PCA9632_WriteRegister(addr, regadd + (PCA9632_GRN >> 1), vg); - PCA9632_WriteRegister(addr, regadd + (PCA9632_BLU >> 1), vb); + PCA9632_WriteRegister(addr, regadd + (PCA9632_BLU >> 1), TERN(PCA9632_SWAP_RB, vb, vr)); #if ENABLED(PCA9632_RGBW) PCA9632_WriteRegister(addr, regadd + (PCA9632_WHT >> 1), vw); #endif @@ -136,27 +136,19 @@ void PCA9632_set_led_color(const LED1Color_t &color) { PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_MODE2, PCA9632_MODE2_VALUE); } - #if ENABLED(PCA9632_SWAP_RB) - const byte LEDOUT = (color.b ? LED_PWM << PCA9632_RED : 0) - | (color.g ? LED_PWM << PCA9632_GRN : 0) - | (color.r ? LED_PWM << PCA9632_BLU : 0) - | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0)); + const byte LEDOUT = (TERN(PCA9632_SWAP_RB, color.b, color.r) ? LED_PWM << PCA9632_RED : 0) + | (color.g ? LED_PWM << PCA9632_GRN : 0) + | (TERN(PCA9632_SWAP_RB, color.r, color.b) ? LED_PWM << PCA9632_BLU : 0) + | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0)); - PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.b, color.g, color.r - OPTARG(PCA9632_RGBW, color.w) - ); - PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT); - #else - const byte LEDOUT = (color.r ? LED_PWM << PCA9632_RED : 0) - | (color.g ? LED_PWM << PCA9632_GRN : 0) - | (color.b ? LED_PWM << PCA9632_BLU : 0) - | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0)); - - PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.r, color.g, color.b - OPTARG(PCA9632_RGBW, color.w) - ); - PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT); - #endif + PCA9632_WriteAllRegisters( + PCA9632_ADDRESS, PCA9632_PWM0, + TERN(PCA9632_SWAP_RB, color.b, color.r), + color.g, + TERN(PCA9632_SWAP_RB, color.r, color.b) + OPTARG(PCA9632_RGBW, color.w) + ); + PCA9632_WriteRegister(PCA9632_ADDRESS,PCA9632_LEDOUT, LEDOUT); } diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h index 0781e4d865..8878e2e3c7 100644 --- a/Marlin/src/inc/Conditionals-2-LCD.h +++ b/Marlin/src/inc/Conditionals-2-LCD.h @@ -307,6 +307,12 @@ #define IS_RRD_SC 1 #define U8GLIB_SSD1309 +#elif ENABLED(MIGHTYBOARD_LCD) + + #define IS_ULTIPANEL 1 + #define LCD_WIDTH 20 + #define LCD_HEIGHT 4 + #endif // ST7920-based graphical displays @@ -541,55 +547,10 @@ #define IS_ULTIPANEL 1 #endif -#if ENABLED(MIGHTYBOARD_INTERFACE) - #define MIGHTYBOARD_LCD - #define IS_ULTIPANEL 1 // Enables button menu navigation and functions (Marlin UI) - // #define HAS_WIRED_LCD 1 - #define LCD_WIDTH 20 - #define LCD_HEIGHT 4 +#if ANY(IS_ULTIPANEL, ULTRA_LCD) + #define HAS_WIRED_LCD 1 #endif -#if ANY(IS_ULTIPANEL, ULTRA_LCD, MIGHTYBOARD_LCD) - #define HAS_WIRED_LCD 1 // Enables LCD and button detection -#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 -// #if ENABLED(HAS_DIGITAL_BUTTONS) -// #warning "HAS_DIGITAL_BUTTONS enabled" -// #else -// #warning "MightyBoard build: HAS_DIGITAL_BUTTONS is NOT defined" -// #endif -// #endif - - #if ANY(IS_ULTIPANEL, REPRAPWORLD_KEYPAD) #define IS_NEWPANEL 1 #endif @@ -967,7 +928,7 @@ + ENABLED(CARTESIO_UI) \ + ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ + ENABLED(FF_INTERFACEBOARD) \ - + ENABLED(MIGHTYBOARD_INTERFACE) \ + + ENABLED(MIGHTYBOARD_LCD) \ + ENABLED(FYSETC_242_OLED_12864) \ + ENABLED(G3D_PANEL) \ + ENABLED(LCD_FOR_MELZI) \ diff --git a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp index b8326de0fd..6291689931 100644 --- a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp +++ b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2026 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -58,33 +58,25 @@ void MightyboardLCDSerial::begin(uint8_t cols, uint8_t rows, uint8_t charsize) { _rows = rows; // Diagnostic output showing LCD configuration - #ifdef MIGHTYBOARD_RUNTIME_DEBUG - SERIAL_ECHOLN("MightyboardLCDSerial::begin() - LCD Configuration:"); - SERIAL_ECHO(" Dimensions: "); - SERIAL_ECHO(_cols); - SERIAL_ECHO(" x "); - SERIAL_ECHOLN(_rows); + #if ENABLED(MIGHTYBOARD_RUNTIME_DEBUG) + SERIAL_ECHOLNPGM("MightyboardLCDSerial::begin() - LCD Configuration:"); + SERIAL_ECHOLNPGM(" Dimensions: ", _cols, " x ", _rows); #ifdef LCD_WIDTH - SERIAL_ECHO(" Expected from config: "); - SERIAL_ECHO(LCD_WIDTH); - SERIAL_ECHO(" x "); - SERIAL_ECHOLN(LCD_HEIGHT); + SERIAL_ECHOLNPGM(" Expected from config: ", LCD_WIDTH, " x ", LCD_HEIGHT); #endif - SERIAL_ECHO(" Charsize: "); + SERIAL_ECHOPGM(" Charsize: "); if (charsize == LCD_5x8DOTS) - SERIAL_ECHOLN("5x8 dots"); + SERIAL_ECHOLNPGM("5x8 dots"); else if (charsize == LCD_5x10DOTS) - SERIAL_ECHOLN("5x10 dots"); + SERIAL_ECHOLNPGM("5x10 dots"); else - SERIAL_ECHOLN("unknown"); + SERIAL_ECHOLNPGM("unknown"); #endif - if (rows > 1) { - _displayfunction |= LCD_2LINE; - } - if ((charsize != LCD_5x8DOTS) && (rows == 1)) { + if (rows > 1) + _displayfunction |= LCD_2LINE; + else if (rows == 1 && charsize != LCD_5x8DOTS) _displayfunction |= LCD_5x10DOTS; - } // Power-up delay as per HD44780 datasheet (> 40ms required) delay(50); @@ -220,9 +212,7 @@ void MightyboardLCDSerial::noAutoscroll() { void MightyboardLCDSerial::createChar(uint8_t location, uint8_t charmap[]) { location &= 0x7; // Only 8 locations available sendCommand(LCD_SETCGRAMADDR | (location << 3)); - for (int8_t i = 0; i < 8; i++) { - sendData(charmap[i]); - } + for (int8_t i = 0; i < 8; i++) sendData(charmap[i]); } /** @@ -293,12 +283,11 @@ inline void MightyboardLCDSerial::sendData(uint8_t value) { void MightyboardLCDSerial::write4bits(uint8_t value, bool dataMode) { // Shift data to upper 4 bits (D7-D4 in HD44780) uint8_t bits = value << 4; - + // Set RS bit (bit 1) based on mode // On Mightyboard: RS = 0b0010 - if (dataMode) - bits |= 0b0010; // RS = 1 for data - + if (dataMode) bits |= 0b0010; // RS = 1 for data + // Pulse enable to latch the nibble pulseEnable(bits); } @@ -310,7 +299,7 @@ void MightyboardLCDSerial::write4bits(uint8_t value, bool dataMode) { */ void MightyboardLCDSerial::pulseEnable(uint8_t value) { _delay_us(1); - value |= 0b01000; // Set enable HIGH + value |= 0b00001000; // Set enable HIGH writeSerial(value); _delay_us(1); value &= 0b11110111; // Set enable LOW @@ -332,7 +321,7 @@ void MightyboardLCDSerial::writeSerial(uint8_t value) { digitalWrite(_clk_pin, HIGH); _delay_us(1); // Clock pulse width } - + // Pulse strobe to latch data into display shift register digitalWrite(_strobe_pin, HIGH); _delay_us(1); diff --git a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h index 63ac91a06e..6e630196e9 100644 --- a/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h +++ b/Marlin/src/lcd/HD44780/MightyboardLCDSerial.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2026 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index e58b9d6e38..505dd573ff 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -67,19 +67,19 @@ // #if ENABLED(LCD_I2C_TYPE_PCF8575) - #warning "LCD_CLASS: LiquidCrystal_I2C (PCF8575)" + LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7); #elif ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) - #warning "LCD_CLASS: LiquidTWI2 (MCP23017/MCP23008)" + LCD_CLASS lcd(LCD_I2C_ADDRESS OPTARG(DETECT_I2C_LCD_DEVICE, 1)); #elif ENABLED(LCD_I2C_TYPE_PCA8574) - #warning "LCD_CLASS: LiquidCrystal_I2C (PCA8574)" + LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); #elif ENABLED(SR_LCD_2W_NL) - #warning "LCD_CLASS: LiquidCrystal_SR (2-Wire)" + // 2 wire Non-latching LCD SR from: // https://github.com/fmalpartida/New-LiquidCrystal/wiki/schematics#user-content-ShiftRegister_connection @@ -90,19 +90,17 @@ ); #elif ENABLED(MIGHTYBOARD_LCD) - #warning "LCD_CLASS: MightyboardLCDSerial (MIGHTYBOARD_LCD)" + // 3-wire shift-register LCD for Mightyboard // Optimized in-tree implementation #if PIN_EXISTS(LCD_PWR) - #warning "MIGHTYBOARD: LCD_PWR_PIN defined - power control enabled" LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN, LCD_PWR_PIN); #else - #warning "MIGHTYBOARD: LCD_PWR_PIN not defined - power control disabled" LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN); #endif #elif ENABLED(SR_LCD_3W_NL) - #warning "LCD_CLASS: LiquidCrystalSerial (Sailfish SR_LCD_3W_NL)" + // NewLiquidCrystal was not working // https://github.com/mikeshub/SailfishLCD // uses the code directly from Sailfish @@ -110,7 +108,7 @@ LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN); #elif ENABLED(LCM1602) - #warning "LCD_CLASS: LiquidCrystal_I2C (LCM1602)" + LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); #elif ENABLED(YHCB2004) @@ -131,11 +129,10 @@ #error "YHCB2004 display requires YHCB2004_SS_PIN, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, and YHCB2004_MISO_PIN." #endif - #warning "LCD_CLASS: LiquidCrystal_AIP31068_SPI (YHCB2004)" LCD_CLASS lcd(YHCB2004_SS_PIN, 20, 4, YHCB2004_SCK_PIN, YHCB2004_MOSI_PIN, YHCB2004_MISO_PIN); // SS, cols, rows, SCK, MOSI, MISO #else - #warning "LCD_CLASS: LiquidCrystal (Standard Direct)" + // Standard direct-connected LCD implementations LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_EN, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); @@ -391,8 +388,6 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS void MarlinUI::init_lcd() { - SERIAL_ECHOLN("DEBUG_LCD: about to call lcd.begin()"); - #if ENABLED(LCD_I2C_TYPE_PCF8575) lcd.begin(LCD_WIDTH, LCD_HEIGHT); #ifdef LCD_I2C_PIN_BL @@ -417,8 +412,6 @@ void MarlinUI::init_lcd() { lcd.begin(LCD_WIDTH, LCD_HEIGHT); #endif - SERIAL_ECHOLN("DEBUG_LCD: lcd.begin returned"); - set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); lcd.clear(); diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 9d10d2b2ad..773cb966ab 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -304,10 +304,9 @@ void MarlinUI::init_lcd() { u8g.init(U8G_PARAM); did_init_u8g = true; } - SERIAL_ECHOLN("init LCD"); - #if PIN_EXISTS(LCD_PWR_PIN) - SERIAL_ECHOLN("Pwr pin low"); - digitalWrite(LCD_PWR_PIN, LOW); + + #if PIN_EXISTS(LCD_PWR) + OUT_WRITE(LCD_PWR_PIN, LOW); #endif #if PIN_EXISTS(LCD_BACKLIGHT) @@ -344,7 +343,6 @@ void MarlinUI::init_lcd() { #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT) WRITE(LCD_BACKLIGHT_PIN, HIGH); - SERIAL_ECHOLN("Backlight high"); #endif TERN_(HAS_LCD_CONTRAST, refresh_contrast()); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index d7462aa929..58529ee95b 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -70,10 +70,10 @@ MarlinUI ui; bool MarlinUI::wait_for_move; // = false #endif -#if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) -// Flags set from interrupt context; handled in main loop -volatile bool MarlinUI::request_back = false; -volatile bool MarlinUI::request_return_to_status = false; +#if ENABLED(MIGHTYBOARD_BACK_STATUS_BUTTONS) + // Flags set from interrupt context; handled in main loop + volatile bool MarlinUI::request_back = false, + MarlinUI::request_return_to_status = false; #endif constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; @@ -320,39 +320,39 @@ void MarlinUI::init() { #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 ENABLED(MIGHTYBOARD_RUNTIME_DEBUG) && ANY_BUTTON(UP, DOWN, LFT, RT) - // #warning "Marlin: Compiling directional button init (UP/DOWN/LEFT/RIGHT)" - // #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 ENABLED(MIGHTYBOARD_RUNTIME_DEBUG) && 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 + // 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 // MIGHTYBOARD_RUNTIME_DEBUG #if HAS_SHIFT_ENCODER @@ -1085,19 +1085,20 @@ void MarlinUI::init() { else wait_for_unclick = false; } - #if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) - // Handle requests set from interrupt context (ISR-safe) - if (MarlinUI::request_back) { - MarlinUI::request_back = false; - quick_feedback(); - goto_previous_screen(); - } - if (MarlinUI::request_return_to_status) { - MarlinUI::request_return_to_status = false; - quick_feedback(); - return_to_status(); - } + #if ENABLED(MIGHTYBOARD_BACK_STATUS_BUTTONS) + // Handle requests set from interrupt context (ISR-safe) + if (request_back) { + request_back = false; + quick_feedback(); + goto_previous_screen(); + } + if (request_return_to_status) { + request_return_to_status = false; + quick_feedback(); + return_to_status(); + } #endif + if (LCD_BACK_CLICKED()) { quick_feedback(); goto_previous_screen(); @@ -1398,17 +1399,17 @@ 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 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 @@ -1442,38 +1443,31 @@ 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 + //#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(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) - // Alternative behavior: LEFT/RIGHT for menu navigation (back/home) instead of encoder scrolling - else if (BUTTON_PRESSED(LEFT)) { - // ISR-safe: request action to be handled in main loop - MarlinUI::request_back = true; - next_button_update_ms = now + 300; - } - else if (BUTTON_PRESSED(RIGHT)) { - // ISR-safe: request action to be handled in main loop - MarlinUI::request_return_to_status = true; - next_button_update_ms = now + 300; - } - #else - // Default behavior: LEFT/RIGHT change encoder position for menu item selection - else if (BUTTON_PRESSED(LEFT)) { + else if (BUTTON_PRESSED(LEFT)) { + #if ENABLED(MIGHTYBOARD_BACK_STATUS_BUTTONS) + request_back = true; // ISR-safe: flag action run in the main loop + #else encoderDiff = -pulses; - next_button_update_ms = now + 300; - } - else if (BUTTON_PRESSED(RIGHT)) { - encoderDiff = pulses; - next_button_update_ms = now + 300; - } - #endif // DIGITAL_BUTTON_L_R_MENU_BACK_STATUS + #endif + next_button_update_ms = now + 300; + } + else if (BUTTON_PRESSED(RIGHT)) { + #if ENABLED(MIGHTYBOARD_BACK_STATUS_BUTTONS) + request_return_to_status = true; // ISR-safe: flag action run in the main loop + #else + encoderDiff = -pulses; + #endif + next_button_update_ms = now + 300; + } #endif // UP || DOWN || LEFT || RIGHT diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index cda27c879b..41b740cdf3 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -825,10 +825,9 @@ public: static void update_buttons(); - #if ENABLED(DIGITAL_BUTTON_L_R_MENU_BACK_STATUS) - // Requests set from interrupt context and handled in main loop - static volatile bool request_back; - static volatile bool request_return_to_status; + #if ENABLED(MIGHTYBOARD_BACK_STATUS_BUTTONS) + // Requests set from interrupt context and handled in main loop + static volatile bool request_back, request_return_to_status; #endif #if ENABLED(ENCODER_NOISE_FILTER) diff --git a/Marlin/src/libs/softspi.h b/Marlin/src/libs/softspi.h index bf859708db..3b9775f3e9 100644 --- a/Marlin/src/libs/softspi.h +++ b/Marlin/src/libs/softspi.h @@ -210,12 +210,13 @@ {&DDRE, &PINE, &PORTE, 6}, // E6 79 // pins MIGHTYBOARD_REVG.h + // TODO: Only include with a -D define in build {&DDRE, &PINE, &PORTE, 7}, // E7 80 {&DDRD, &PIND, &PORTD, 4}, // D4 81 {&DDRD, &PIND, &PORTD, 5}, // D5 82 {&DDRD, &PIND, &PORTD, 6}, // D6 83 {&DDRH, &PINH, &PORTH, 2}, // H2 84 - {&DDRH, &PINH, &PORTH, 7} // H7 85 + {&DDRH, &PINH, &PORTH, 7} // H7 85 }; #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__) \ diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h index 9ed0d277f7..61c6340a02 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVG.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2026 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -66,12 +66,12 @@ #define E1_DIR_PIN 15 // K7 #define E1_ENABLE_PIN 23 // A1 -// -// I2C Digipots - MCP4018 -// Address 5E (2F << 1) -// Set from 0 - 127 with stop bit. -// (Ex. 3F << 1 | 1) -// +/** + * I2C Digipots - MCP4018 + * Address 5E (2F << 1) + * Set from 0 - 127 with stop bit. + * (Ex. 3F << 1 | 1) + */ #define DIGIPOTS_I2C_SCL 28 // A6 #define DIGIPOTS_I2C_SDA_X 82 // D5 #define DIGIPOTS_I2C_SDA_Y 43 // L6 @@ -80,19 +80,18 @@ #define DIGIPOTS_I2C_SDA_E1 74 // J7 #ifndef DIGIPOT_I2C_ADDRESS_A - #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) + #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) #endif #define DIGIPOT_ENABLE_I2C_PULLUPS // MightyBoard doesn't have hardware I2C pin pull-ups. // Bed temp sensor pin #define TEMP_BED_PIN 3 // F3 -/* -* Temperature Sensors -* Uses ADS1118 as ADC converter to read the hotend temperature sensors -* SPI for ADS1118 ADC, Uses software SPI -* -*/ +/** + * Temperature Sensors + * Uses ADS1118 as ADC converter to read the hotend temperature sensors + * SPI for ADS1118 ADC, Uses software SPI + */ #define TEMP_0_CS_PIN 79 // E6 #define TEMP_0_SCK_PIN 78 // E2 #define TEMP_0_MISO_PIN 80 // E7 @@ -123,90 +122,81 @@ #define HEATER_BED_PIN MOSFET_C_PIN // H5 #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN MOSFET_D_PIN + #define E0_AUTO_FAN_PIN MOSFET_D_PIN #elif !defined(FAN0_PIN) - #define FAN0_PIN MOSFET_D_PIN + #define FAN0_PIN MOSFET_D_PIN #endif #ifndef E1_AUTO_FAN_PIN - #define E1_AUTO_FAN_PIN MOSFET_E_PIN + #define E1_AUTO_FAN_PIN MOSFET_E_PIN #elif !defined(FAN1_PIN) - #define FAN1_PIN MOSFET_E_PIN + #define FAN1_PIN MOSFET_E_PIN #endif // // LCD / Controller // -#if HAS_WIRED_LCD -#warning "HAS_WIRED_LCD is defined." - #if IS_RRD_FG_SC +#if IS_RRD_FG_SC - #define LCD_PINS_RS 33 // C4: LCD-STROBE - #define LCD_PINS_EN 72 // J2: LEFT - #define LCD_PINS_D4 35 // C2: LCD-CLK - #define LCD_PINS_D5 32 // C5: RLED - #define LCD_PINS_D6 34 // C3: LCD-DATA - #define LCD_PINS_D7 31 // C6: GLED + #define BEEPER_PIN 8 // H5, SD_WP - #define BTN_EN2 75 // J4, UP - #define BTN_EN1 73 // J3, DOWN - // STOP button connected as KILL_PIN - #define KILL_PIN 14 // J1, RIGHT (not connected) + #define BTN_EN2 75 // J4, UP + #define BTN_EN1 73 // J3, DOWN - #define BEEPER_PIN 8 // H5, SD_WP + #define LCD_PINS_RS 33 // C4: LCD-STROBE + #define LCD_PINS_EN 72 // J2: LEFT + #define LCD_PINS_D4 35 // C2: LCD-CLK + #define LCD_PINS_D5 32 // C5: RLED + #define LCD_PINS_D6 34 // C3: LCD-DATA + #define LCD_PINS_D7 31 // C6: GLED - // Onboard leds - #define STAT_LED_RED_PIN SERVO0_PIN // C1 (1280-EX1, DEBUG2) - #define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3) + // STOP button connected as KILL_PIN + #define KILL_PIN 14 // J1, RIGHT (not connected) - #else - #warning "Using SR pins." - // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power + // Onboard leds + #define STAT_LED_RED_PIN SERVO0_PIN // C1 (1280-EX1, DEBUG2) + #define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3) - #define SR_DATA_PIN 37 // C0 - #define SR_CLK_PIN 36 // C1 - #define SR_STROBE_PIN 34 // C3 +#elif HAS_WIRED_LCD - #define SR_DETECT_PIN 33 // C4 + // Replicator 2 and 2X uses a HD44780 SPI display, pins: mosi, sclk, miso (not used), missing: latch, click, power - #define BUTTON_LED_PIN 35 // C2 To be implemented... - - #define BTN_CENTER 39 // G2 - #define BTN_UP 76 // J5 - #define BTN_DOWN 75 // J4 - #define BTN_LEFT 77 // J6 - #define BTN_RIGHT 73 // J3 - - // Map the CLICK button to the encoder 'click' so Marlin treats it as SELECT - #ifndef BTN_ENC - #define BTN_ENC BTN_CENTER - #endif - - #define LCD_PWR_PIN 29 // A7 - - // Disable encoder - #undef BTN_EN1 - #undef BTN_EN2 - - #define BEEPER_PIN 6 // H3 - - // - // SD Card - // - // --- Secure Digital Card configuration --- - // NOTE: If SD support is enabled, it is implicitly assumed that the - // following pins are connected: - // AVR | SD header - //---------|-------------- - // MISO | DATA_OUT - // MOSI | DATA_IN - // SCK | CLK - - #define SD_WRITE_PIN 41 // Sailfish mighty two: G0(41) H5(D8) - - #define SD_DETECT_PIN 40 // Sailfish mighty two: G1(40) H6(D9) L0(D49) - #define SD_SS_PIN 53 // Sailfish mighty two: B0(53) + #define BEEPER_PIN 6 // H3 + // Map the CLICK button to the encoder 'click' so Marlin treats it as SELECT + #ifndef BTN_ENC + #define BTN_ENC BTN_CENTER #endif + #define BTN_CENTER 39 // G2 + #define BTN_UP 76 // J5 + #define BTN_DOWN 75 // J4 + #define BTN_LEFT 77 // J6 + #define BTN_RIGHT 73 // J3 + + #define SR_DATA_PIN 37 // C0 + #define SR_CLK_PIN 36 // C1 + #define SR_STROBE_PIN 34 // C3 + #define SR_DETECT_PIN 33 // C4 + + #define LCD_PWR_PIN 29 // A7 + + #define BUTTON_LED_PIN 35 // C2 To be implemented... + + /** + * SD Card + * + * NOTE: With SD support enabled it is implicitly assumed + * that the following pins are connected: + * AVR | SD header + *---------|-------------- + * MISO | DATA_OUT + * MOSI | DATA_IN + * SCK | CLK + */ + //#define SD_WRITE_PIN 41 // Sailfish mighty two: G0(41) H5(D8) - + #define SD_DETECT_PIN 40 // Sailfish mighty two: G1(40) H6(D9) L0(D49) + #define SD_SS_PIN 53 // Sailfish mighty two: B0(53) + #endif // HAS_WIRED_LCD diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index aab06e3750..108ea3a811 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -318,7 +318,8 @@ #elif MB(WEEDO_62A) #include "mega/pins_WEEDO_62A.h" // ATmega2560 env:mega2560 #elif MB(MIGHTYBOARD_REVG) - #include "mega/pins_MIGHTYBOARD_REVG.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 + #include "mega/pins_MIGHTYBOARD_REVG.h" // ATmega2560, ATmega1280 env:MightyBoard2560 env:MightyBoard1280 env:mega2560ext + // // ATmega1281, ATmega2561 // diff --git a/platformio.ini b/platformio.ini index a53201cd86..df5418cde4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,7 +54,7 @@ extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py pre:buildroot/share/PlatformIO/scripts/preflight-checks.py post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py -lib_deps = +lib_deps = default_src_filter = + - - ; LCDs and Controllers - - - - -