From 0e260c6c1deca5b184bdef5997e69b357f520193 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Wed, 11 Oct 2017 15:23:04 -0500 Subject: [PATCH] Get FolgerTech i3-2020 working again with 32-bit platforms (#7944) Setup FolgerTech i3-2020 Configuration files as a reference platform for 32-Bit work. Also fix MAX7219 debug lights on 32-bit platforms. --- .../Folger Tech/i3-2020/Configuration.h | 15 ++++---- .../Folger Tech/i3-2020/Configuration_adv.h | 12 ++++-- Marlin/src/feature/Max7219_Debug_LEDs.cpp | 37 ++++++++++++++++--- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h index fabbaa7ceb..d158a800c0 100644 --- a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h @@ -119,12 +119,13 @@ // The following define selects which electronics board you have. // Please choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_RAMPS_14_EFB + #define MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB // For people switching over to the Panucatt Re-ARM board +//#define MOTHERBOARD BOARD_RAMPS_14_EFB // For unmodified printers using Atmega-2560 and RAMPS boards. #endif // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -#define CUSTOM_MACHINE_NAME "FT-2020" +#define CUSTOM_MACHINE_NAME "FT-2020 v2" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -777,15 +778,15 @@ // @section machine // The size of the print bed -#define X_BED_SIZE 207 -#define Y_BED_SIZE 182 +//#define X_BED_SIZE 207 // For now... use the old method of X_MIN_POS and X_MAX_POS to set X size +//#define Y_BED_SIZE 182 // For now... use the old method of Y_MIN_POS and Y_MAX_POS to set Y size // Travel limits (mm) after homing, corresponding to endstop positions. #define X_MIN_POS 6 #define Y_MIN_POS 3 #define Z_MIN_POS 0 -#define X_MAX_POS X_BED_SIZE -#define Y_MAX_POS Y_BED_SIZE +#define X_MAX_POS 207 +#define Y_MAX_POS 182 #define Z_MAX_POS 175 // If enabled, axes won't move below MIN_POS in response to movement commands. @@ -1037,7 +1038,7 @@ // // M100 Free Memory Watcher // -#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose // // G20/G21 Inch mode support diff --git a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h index 490c74a4b9..0f553b1e78 100644 --- a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h @@ -1391,11 +1391,15 @@ * Fully assembled MAX7219 boards can be found on the internet for under $2(US). * For example, see https://www.ebay.com/sch/i.html?_nkw=332349290049 */ -//#define MAX7219_DEBUG +#define MAX7219_DEBUG #if ENABLED(MAX7219_DEBUG) - #define MAX7219_CLK_PIN 64 // 77 on Re-ARM // Configuration of the 3 pins to control the display - #define MAX7219_DIN_PIN 57 // 78 on Re-ARM - #define MAX7219_LOAD_PIN 44 // 79 on Re-ARM +//#define MAX7219_CLK_PIN 64 // on RAMPS // Configuration of the 3 pins to control the display +//#define MAX7219_DIN_PIN 57 // on RAMPS +//#define MAX7219_LOAD_PIN 44 // on RAMPS + + #define MAX7219_CLK_PIN 77 // on Re-ARM // Configuration of the 3 pins to control the display + #define MAX7219_DIN_PIN 78 // on Re-ARM + #define MAX7219_LOAD_PIN 79 // on Re-ARM /** * Sample debug features diff --git a/Marlin/src/feature/Max7219_Debug_LEDs.cpp b/Marlin/src/feature/Max7219_Debug_LEDs.cpp index f2502303c3..4d5f751b8a 100644 --- a/Marlin/src/feature/Max7219_Debug_LEDs.cpp +++ b/Marlin/src/feature/Max7219_Debug_LEDs.cpp @@ -63,18 +63,38 @@ static uint8_t LEDs[8] = { 0 }; void Max7219_PutByte(uint8_t data) { for (uint8_t i = 8; i--;) { - WRITE(MAX7219_CLK_PIN, LOW); // tick - WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW); // send 1 or 0 based on data bit - WRITE(MAX7219_CLK_PIN, HIGH); // tock + #ifdef CPU_32_BIT // The 32-bit processors are so fast, a small delay in the code is needed + // to let the signal wires stabilize. + WRITE(MAX7219_CLK_PIN, LOW); // tick + delayMicroseconds(5); + WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW); // send 1 or 0 based on data bit + delayMicroseconds(5); + WRITE(MAX7219_CLK_PIN, HIGH); // tock + delayMicroseconds(5); + #else + WRITE(MAX7219_CLK_PIN, LOW); // tick + WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW); // send 1 or 0 based on data bit + WRITE(MAX7219_CLK_PIN, HIGH); // tock + #endif + data <<= 1; } } void Max7219(const uint8_t reg, const uint8_t data) { WRITE(MAX7219_LOAD_PIN, LOW); // begin + #ifdef CPU_32_BIT // The 32-bit processors are so fast, a small delay in the code is needed + delayMicroseconds(5); // to let the signal wires stabilize. + #endif Max7219_PutByte(reg); // specify register Max7219_PutByte(data); // put data + #ifdef CPU_32_BIT + delayMicroseconds(5); + #endif WRITE(MAX7219_LOAD_PIN, LOW); // and tell the chip to load the data + #ifdef CPU_32_BIT + delayMicroseconds(5); + #endif WRITE(MAX7219_LOAD_PIN, HIGH); } @@ -135,6 +155,7 @@ void Max7219_init() { SET_OUTPUT(MAX7219_CLK_PIN); OUT_WRITE(MAX7219_LOAD_PIN, HIGH); + delay(1); //initiation of the max 7219 Max7219(max7219_reg_scanLimit, 0x07); @@ -187,9 +208,13 @@ void Max7219_init() { void Max7219_idle_tasks() { #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE) static int debug_cnt = 0; - if (debug_cnt++ > 100) { - Max7219_LED_Toggle(7, 7); - debug_cnt = 0; + #ifdef CPU_32_BIT + if (debug_cnt++ > 400) { + #else + if (debug_cnt++ > 100) { + #endif + Max7219_LED_Toggle(7, 7); + debug_cnt = 0; } #endif