Fix and optimize MightyBoard (#20493)

This commit is contained in:
grauerfuchs 2020-12-17 18:22:59 -05:00 committed by Scott Lahteine
parent c3a1cd10ab
commit 02b65de6a2
4 changed files with 31 additions and 24 deletions

View File

@ -1022,7 +1022,7 @@
/** /**
* I2C-based DIGIPOTs (e.g., Azteeg X3 Pro) * 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 //#define DIGIPOT_MCP4451
#if EITHER(DIGIPOT_MCP4018, 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 #define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT:4 AZTEEG_X3_PRO:8 MKS_SBASE:5 MIGHTYBOARD_REVE:5

View File

@ -27,7 +27,7 @@
#include "digipot.h" #include "digipot.h"
#include <Stream.h> #include <Stream.h>
#include <SlowSoftI2CMaster.h> // https://github.com/stawel/SlowSoftI2CMaster #include <SlowSoftI2CMaster.h> // https://github.com/felias-fogg/SlowSoftI2CMaster
// Settings for the I2C based DIGIPOT (MCP4018) based on WT150 // 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] = { 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 #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 #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 #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 #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 #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 #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 #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 #endif
#endif #endif

View File

@ -118,6 +118,7 @@
#ifndef DIGIPOT_I2C_ADDRESS_A #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 #endif
#define DIGIPOT_ENABLE_I2C_PULLUPS // MightyBoard doesn't have hardware I2C pin pull-ups.
// //
// Temperature Sensors // Temperature Sensors

View File

@ -457,7 +457,6 @@ board = megaatmega2560
[env:mega2560ext] [env:mega2560ext]
platform = atmelavr platform = atmelavr
extends = env:mega2560 extends = env:mega2560
board = megaatmega2560
board_build.variant = megaextendedpins board_build.variant = megaextendedpins
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py pre:buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py
@ -471,24 +470,31 @@ extends = common_avr8
board = megaatmega1280 board = megaatmega1280
# #
# MightyBoard ATmega2560 (MegaCore 100 pin boards variants) # MightyBoard AVR with extended pins
#
[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 ATmega1280
# #
[env:MightyBoard1280] [env:MightyBoard1280]
platform = atmelavr platform = atmelavr
extends = common_avr8 extends = mega_extended_optimized
board = ATmega1280 board = megamega1280
upload_speed = 57600
# #
# MightyBoard ATmega2560 (MegaCore 100 pin boards variants) # MightyBoard ATmega2560
# #
[env:MightyBoard2560] [env:MightyBoard2560]
platform = atmelavr platform = atmelavr
extends = common_avr8 extends = mega_extended_optimized
board = ATmega2560 board = megaatmega2560
upload_protocol = wiring
upload_speed = 57600
board_upload.maximum_size = 253952
# #
# RAMBo # RAMBo