diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9e5ebb33b..aed29d0f2 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1022,7 +1022,7 @@ /** * I2C-based DIGIPOTs (e.g., Azteeg X3 Pro) */ -//#define DIGIPOT_MCP4018 // Requires https://github.com/stawel/SlowSoftI2CMaster +//#define DIGIPOT_MCP4018 // Requires https://github.com/felias-fogg/SlowSoftI2CMaster //#define DIGIPOT_MCP4451 #if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451) #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT:4 AZTEEG_X3_PRO:8 MKS_SBASE:5 MIGHTYBOARD_REVE:5 diff --git a/Marlin/src/feature/digipot/digipot_mcp4018.cpp b/Marlin/src/feature/digipot/digipot_mcp4018.cpp index 4b90cc4ea..37853ff42 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4018.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4018.cpp @@ -27,7 +27,7 @@ #include "digipot.h" #include -#include // https://github.com/stawel/SlowSoftI2CMaster +#include // https://github.com/felias-fogg/SlowSoftI2CMaster // Settings for the I2C based DIGIPOT (MCP4018) based on WT150 @@ -46,21 +46,21 @@ static byte current_to_wiper(const float current) { } static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = { - SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_X, DIGIPOTS_I2C_SCL) + SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_X, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 1 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Y, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Y, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 2 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Z, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_Z, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 3 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E0, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E0, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 4 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E1, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E1, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 5 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E2, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E2, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 6 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E3, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E3, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #if DIGIPOT_I2C_NUM_CHANNELS > 7 - , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E4, DIGIPOTS_I2C_SCL) + , SlowSoftI2CMaster(DIGIPOTS_I2C_SDA_E4, DIGIPOTS_I2C_SCL, ENABLED(DIGIPOT_ENABLE_I2C_PULLUPS)) #endif #endif #endif diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index d074db8b2..b260a2786 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -118,6 +118,7 @@ #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 diff --git a/platformio.ini b/platformio.ini index 753140467..2a0901d14 100644 --- a/platformio.ini +++ b/platformio.ini @@ -457,7 +457,6 @@ board = megaatmega2560 [env:mega2560ext] platform = atmelavr extends = env:mega2560 -board = megaatmega2560 board_build.variant = megaextendedpins extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py @@ -471,24 +470,31 @@ extends = common_avr8 board = megaatmega1280 # -# MightyBoard ATmega2560 (MegaCore 100 pin boards variants) +# MightyBoard AVR with extended pins # -[env:MightyBoard1280] -platform = atmelavr -extends = common_avr8 -board = ATmega1280 -upload_speed = 57600 +[mega_extended_optimized] +extends = common_avr8 +board_build.variant = megaextendedpins +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py +upload_speed = 57600 +build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues # -# MightyBoard ATmega2560 (MegaCore 100 pin boards variants) +# MightyBoard ATmega1280 +# +[env:MightyBoard1280] +platform = atmelavr +extends = mega_extended_optimized +board = megamega1280 + +# +# MightyBoard ATmega2560 # [env:MightyBoard2560] -platform = atmelavr -extends = common_avr8 -board = ATmega2560 -upload_protocol = wiring -upload_speed = 57600 -board_upload.maximum_size = 253952 +platform = atmelavr +extends = mega_extended_optimized +board = megaatmega2560 # # RAMBo