Fix and optimize MightyBoard (#20493)

This commit is contained in:
grauerfuchs 2020-12-17 18:22:59 -05:00 committed by GitHub
parent 7b9ff164cc
commit e9677594ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 24 deletions

View file

@ -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

View file

@ -27,7 +27,7 @@
#include "digipot.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
@ -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

View file

@ -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

View file

@ -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
#
[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]
platform = atmelavr
extends = common_avr8
board = ATmega1280
upload_speed = 57600
extends = mega_extended_optimized
board = megamega1280
#
# MightyBoard ATmega2560 (MegaCore 100 pin boards variants)
# MightyBoard ATmega2560
#
[env:MightyBoard2560]
platform = atmelavr
extends = common_avr8
board = ATmega2560
upload_protocol = wiring
upload_speed = 57600
board_upload.maximum_size = 253952
extends = mega_extended_optimized
board = megaatmega2560
#
# RAMBo