Anet ET4 / ET4P and Anet TFT28 / TFT35 (#20280)
This commit is contained in:
parent
08dcd1f680
commit
a0c8d348a0
|
@ -2368,6 +2368,16 @@
|
|||
//
|
||||
//#define LONGER_LK_TFT28
|
||||
|
||||
//
|
||||
// 320x240, 2.8", FSMC Stock Display from ET4
|
||||
//
|
||||
//#define ANET_ET4_TFT28
|
||||
|
||||
//
|
||||
// 480x320, 3.5", FSMC Stock Display from ET5
|
||||
//
|
||||
//#define ANET_ET5_TFT35
|
||||
|
||||
//
|
||||
// Generic TFT with detailed options
|
||||
//
|
||||
|
|
|
@ -48,13 +48,14 @@ void TFT_FSMC::Init() {
|
|||
|
||||
uint32_t NSBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
|
||||
|
||||
// Perform the SRAM1 memory initialization sequence
|
||||
SRAMx.Instance = FSMC_NORSRAM_DEVICE;
|
||||
SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
|
||||
/* SRAMx.Init */
|
||||
// SRAMx.Init
|
||||
SRAMx.Init.NSBank = NSBank;
|
||||
SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
|
||||
SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
|
||||
SRAMx.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
|
||||
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16);
|
||||
SRAMx.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
|
||||
SRAMx.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
|
||||
SRAMx.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
|
||||
|
@ -67,8 +68,8 @@ void TFT_FSMC::Init() {
|
|||
#ifdef STM32F4xx
|
||||
SRAMx.Init.PageSize = FSMC_PAGE_SIZE_NONE;
|
||||
#endif
|
||||
/* Read Timing - relatively slow to ensure ID information is correctly read from TFT controller */
|
||||
/* Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss */
|
||||
// Read Timing - relatively slow to ensure ID information is correctly read from TFT controller
|
||||
// Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss
|
||||
Timing.AddressSetupTime = 15;
|
||||
Timing.AddressHoldTime = 15;
|
||||
Timing.DataSetupTime = 24;
|
||||
|
@ -76,8 +77,8 @@ void TFT_FSMC::Init() {
|
|||
Timing.CLKDivision = 16;
|
||||
Timing.DataLatency = 17;
|
||||
Timing.AccessMode = FSMC_ACCESS_MODE_A;
|
||||
/* Write Timing */
|
||||
/* Can be decreases from 8-15-8 to 0-0-1 with risk of stability loss */
|
||||
// Write Timing
|
||||
// Can be decreases from 8-15-8 to 0-0-1 with risk of stability loss
|
||||
ExtTiming.AddressSetupTime = 8;
|
||||
ExtTiming.AddressHoldTime = 15;
|
||||
ExtTiming.DataSetupTime = 8;
|
||||
|
@ -131,7 +132,7 @@ void TFT_FSMC::Init() {
|
|||
|
||||
uint32_t TFT_FSMC::GetID() {
|
||||
uint32_t id;
|
||||
WriteReg(0x0000);
|
||||
WriteReg(0);
|
||||
id = LCD->RAM;
|
||||
|
||||
if (id == 0)
|
||||
|
@ -141,16 +142,16 @@ uint32_t TFT_FSMC::GetID() {
|
|||
return id;
|
||||
}
|
||||
|
||||
uint32_t TFT_FSMC::ReadID(uint16_t Reg) {
|
||||
uint32_t id;
|
||||
WriteReg(Reg);
|
||||
id = LCD->RAM; // dummy read
|
||||
id = Reg << 24;
|
||||
id |= (LCD->RAM & 0x00FF) << 16;
|
||||
id |= (LCD->RAM & 0x00FF) << 8;
|
||||
id |= LCD->RAM & 0x00FF;
|
||||
return id;
|
||||
}
|
||||
uint32_t TFT_FSMC::ReadID(tft_data_t Reg) {
|
||||
uint32_t id;
|
||||
WriteReg(Reg);
|
||||
id = LCD->RAM; // dummy read
|
||||
id = Reg << 24;
|
||||
id |= (LCD->RAM & 0x00FF) << 16;
|
||||
id |= (LCD->RAM & 0x00FF) << 8;
|
||||
id |= LCD->RAM & 0x00FF;
|
||||
return id;
|
||||
}
|
||||
|
||||
bool TFT_FSMC::isBusy() {
|
||||
if (__IS_DMA_ENABLED(&DMAtx))
|
||||
|
|
|
@ -44,9 +44,12 @@
|
|||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||
#define TFT_IO_DRIVER TFT_FSMC
|
||||
|
||||
#define TFT_DATASIZE TERN(TFT_INTERFACE_FSMC_8BIT, DATASIZE_8BIT, DATASIZE_16BIT)
|
||||
typedef TERN(TFT_INTERFACE_FSMC_8BIT, uint8_t, uint16_t) tft_data_t;
|
||||
|
||||
typedef struct {
|
||||
__IO uint16_t REG;
|
||||
__IO uint16_t RAM;
|
||||
__IO tft_data_t REG;
|
||||
__IO tft_data_t RAM;
|
||||
} LCD_CONTROLLER_TypeDef;
|
||||
|
||||
class TFT_FSMC {
|
||||
|
@ -56,8 +59,8 @@ class TFT_FSMC {
|
|||
|
||||
static LCD_CONTROLLER_TypeDef *LCD;
|
||||
|
||||
static uint32_t ReadID(uint16_t Reg);
|
||||
static void Transmit(uint16_t Data) { LCD->RAM = Data; __DSB(); }
|
||||
static uint32_t ReadID(tft_data_t Reg);
|
||||
static void Transmit(tft_data_t Data) { LCD->RAM = Data; __DSB(); }
|
||||
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
||||
|
||||
public:
|
||||
|
@ -66,11 +69,11 @@ class TFT_FSMC {
|
|||
static bool isBusy();
|
||||
static void Abort() { __HAL_DMA_DISABLE(&DMAtx); }
|
||||
|
||||
static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) {}
|
||||
static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
|
||||
static void DataTransferEnd() {};
|
||||
|
||||
static void WriteData(uint16_t Data) { Transmit(Data); }
|
||||
static void WriteReg(uint16_t Reg) { LCD->REG = Reg; __DSB(); }
|
||||
static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); }
|
||||
static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); }
|
||||
|
||||
static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
|
||||
static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
|
||||
|
@ -98,14 +101,16 @@ const PinMap PinMap_FSMC[] = {
|
|||
{PE_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D05
|
||||
{PE_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D06
|
||||
{PE_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D07
|
||||
{PE_11, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D08
|
||||
{PE_12, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D09
|
||||
{PE_13, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D10
|
||||
{PE_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D11
|
||||
{PE_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D12
|
||||
{PD_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D13
|
||||
{PD_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D14
|
||||
{PD_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D15
|
||||
#if DISABLED(TFT_INTERFACE_FSMC_8BIT)
|
||||
{PE_11, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D08
|
||||
{PE_12, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D09
|
||||
{PE_13, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D10
|
||||
{PE_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D11
|
||||
{PE_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D12
|
||||
{PD_8, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D13
|
||||
{PD_9, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D14
|
||||
{PD_10, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D15
|
||||
#endif
|
||||
{PD_4, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NOE
|
||||
{PD_5, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_NWE
|
||||
{NC, NP, 0}
|
||||
|
@ -121,7 +126,11 @@ const PinMap PinMap_FSMC_CS[] = {
|
|||
{NC, NP, 0}
|
||||
};
|
||||
|
||||
#define FSMC_RS(A) (void *)((2 << A) - 2)
|
||||
#if ENABLED(TFT_INTERFACE_FSMC_8BIT)
|
||||
#define FSMC_RS(A) (void *)((2 << (A-1)) - 1)
|
||||
#else
|
||||
#define FSMC_RS(A) (void *)((2 << A) - 2)
|
||||
#endif
|
||||
|
||||
const PinMap PinMap_FSMC_RS[] = {
|
||||
#ifdef PF0
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
#ifdef STM32F1xx
|
||||
#include <stm32f1xx_hal.h>
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
#elif defined(STM32F4xx)
|
||||
#include <stm32f4xx_hal.h>
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||
#endif
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
@ -60,13 +62,6 @@ enum XPTCoordinate : uint8_t {
|
|||
#define XPT2046_Z1_THRESHOLD 10
|
||||
#endif
|
||||
|
||||
#ifdef STM32F1xx
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||
#elif defined(STM32F4xx)
|
||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||
#endif
|
||||
|
||||
|
||||
class XPT2046 {
|
||||
private:
|
||||
static SPI_HandleTypeDef SPIx;
|
||||
|
|
|
@ -370,6 +370,8 @@
|
|||
#define BOARD_MKS_ROBIN2 4218 // MKS_ROBIN2 (STM32F407ZE)
|
||||
#define BOARD_MKS_ROBIN_PRO_V2 4219 // MKS Robin Pro V2 (STM32F407VE)
|
||||
#define BOARD_MKS_ROBIN_NANO_V3 4220 // MKS Robin Nano V3 (STM32F407VG)
|
||||
#define BOARD_ANET_ET4 4221 // ANET ET4 V1.x (STM32F407VGT6)
|
||||
#define BOARD_ANET_ET4P 4222 // ANET ET4P V1.x (STM32F407VGT6)
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
|
||||
#endif
|
||||
|
||||
// Macros to chain up to 12 conditions
|
||||
// Macros to chain up to 14 conditions
|
||||
#define _DO_1(W,C,A) (_##W##_1(A))
|
||||
#define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B))
|
||||
#define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V))
|
||||
|
@ -164,6 +164,8 @@
|
|||
#define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V))
|
||||
#define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V))
|
||||
#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V))
|
||||
#define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V))
|
||||
#define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V))
|
||||
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
|
||||
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V)
|
||||
#define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V))
|
||||
|
|
|
@ -1073,28 +1073,23 @@
|
|||
* - TFT_COLOR
|
||||
* - GRAPHICAL_TFT_UPSCALE
|
||||
*/
|
||||
#if ENABLED(MKS_TS35_V2_0)
|
||||
// Most common: ST7796
|
||||
#if ENABLED(MKS_TS35_V2_0) // Most common: ST7796
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
|
||||
#define TFT_RES_480x320
|
||||
#define TFT_INTERFACE_SPI
|
||||
#elif ENABLED(MKS_ROBIN_TFT24)
|
||||
// Most common: ST7789
|
||||
#elif ENABLED(MKS_ROBIN_TFT24) // Most common: ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT28)
|
||||
// Most common: ST7789
|
||||
#elif ENABLED(MKS_ROBIN_TFT28) // Most common: ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT32)
|
||||
// Most common: ST7789
|
||||
#elif ENABLED(MKS_ROBIN_TFT32) // Most common: ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT35)
|
||||
// Most common: ILI9488
|
||||
#elif ENABLED(MKS_ROBIN_TFT35) // Most common: ILI9488
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_RES_480x320
|
||||
#define TFT_INTERFACE_FSMC
|
||||
|
@ -1103,12 +1098,11 @@
|
|||
#define TFT_DRIVER SSD1963
|
||||
#define TFT_RES_480x272
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(MKS_ROBIN_TFT_V1_1R)
|
||||
// ILI9328 or R61505
|
||||
#elif ENABLED(MKS_ROBIN_TFT_V1_1R) // ILI9328 or R61505
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35)
|
||||
#elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_DRIVER ILI9488
|
||||
#define TFT_RES_480x320
|
||||
|
@ -1117,6 +1111,14 @@
|
|||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(ANET_ET4_TFT28) // ST7789
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
|
||||
#define TFT_RES_320x240
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(ANET_ET5_TFT35) // ST7796
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
|
||||
#define TFT_RES_480x320
|
||||
#define TFT_INTERFACE_FSMC
|
||||
#elif ENABLED(TFT_GENERIC)
|
||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
||||
#if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
|
||||
|
@ -1197,11 +1199,9 @@
|
|||
#define TOUCH_OFFSET_X XPT2046_X_OFFSET
|
||||
#define TOUCH_OFFSET_Y XPT2046_Y_OFFSET
|
||||
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
||||
#else
|
||||
#define TOUCH_CALIBRATION_X 0
|
||||
#define TOUCH_CALIBRATION_Y 0
|
||||
#define TOUCH_OFFSET_X 0
|
||||
#define TOUCH_OFFSET_Y 0
|
||||
#define TOUCH_ORIENTATION TOUCH_ORIENTATION_NONE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MB(ANET_ET4, ANET_ET4P)
|
||||
#define IS_ANET_ET 1
|
||||
#endif
|
||||
|
|
|
@ -2303,7 +2303,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
|||
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \
|
||||
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
|
||||
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
|
||||
+ COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R) \
|
||||
+ COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, ANET_ET4_TFT28, ANET_ET5_TFT35) \
|
||||
+ COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \
|
||||
+ COUNT_ENABLED(VIKI2, miniVIKI) \
|
||||
+ COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \
|
||||
|
@ -2347,7 +2347,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
|
|||
#undef IS_EXTUI
|
||||
#undef IS_LEGACY_TFT
|
||||
|
||||
#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28)
|
||||
#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35)
|
||||
#if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
|
||||
#error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one."
|
||||
#elif 1 < ENABLED(TFT_COLOR_UI) + ENABLED(TFT_CLASSIC_UI) + ENABLED(TFT_LVGL_UI)
|
||||
|
|
|
@ -95,7 +95,7 @@ void CANVAS::AddImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors)
|
|||
if (line >= startLine && line < endLine) {
|
||||
uint16_t *pixel = buffer + x + (line - startLine) * width;
|
||||
for (int16_t j = 0; j < image_width; j++) {
|
||||
if ((x + j >= 0) && (x + j < width)) *pixel = *data;
|
||||
if ((x + j >= 0) && (x + j < width)) *pixel = ENDIAN_COLOR(*data);
|
||||
pixel++;
|
||||
data++;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,13 @@
|
|||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if TFT_INTERFACE_FSMC_8BIT
|
||||
// When we have a 8 bit interface, we need to invert the bytes of the color
|
||||
#define ENDIAN_COLOR(C) (((C) >> 8) | ((C) << 8))
|
||||
#else
|
||||
#define ENDIAN_COLOR(C) (C)
|
||||
#endif
|
||||
|
||||
#if HAS_UI_320x240
|
||||
#define TFT_WIDTH 320
|
||||
#define TFT_HEIGHT 240
|
||||
|
|
|
@ -158,7 +158,7 @@ void TFT_Queue::fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, ui
|
|||
task_parameters->y = y;
|
||||
task_parameters->width = width;
|
||||
task_parameters->height = height;
|
||||
task_parameters->color = color;
|
||||
task_parameters->color = ENDIAN_COLOR(color);
|
||||
task_parameters->count = width * height;
|
||||
|
||||
*end_of_queue = TASK_END_OF_QUEUE;
|
||||
|
@ -200,7 +200,7 @@ void TFT_Queue::set_background(uint16_t color) {
|
|||
last_parameter = end_of_queue;
|
||||
|
||||
parameters->type = CANVAS_SET_BACKGROUND;
|
||||
parameters->color = color;
|
||||
parameters->color = ENDIAN_COLOR(color);
|
||||
|
||||
end_of_queue += sizeof(parametersCanvasBackground_t);
|
||||
task_parameters->count++;
|
||||
|
@ -227,7 +227,7 @@ void TFT_Queue::add_text(uint16_t x, uint16_t y, uint16_t color, uint8_t *string
|
|||
parameters->type = CANVAS_ADD_TEXT;
|
||||
parameters->x = x;
|
||||
parameters->y = y;
|
||||
parameters->color = color;
|
||||
parameters->color = ENDIAN_COLOR(color);
|
||||
parameters->stringLength = 0;
|
||||
parameters->maxWidth = maxWidth;
|
||||
|
||||
|
@ -261,18 +261,19 @@ void TFT_Queue::add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *col
|
|||
if (color_mode == HIGHCOLOR) return;
|
||||
|
||||
uint16_t *color = (uint16_t *)end_of_queue;
|
||||
uint8_t number_of_color = 0;
|
||||
uint8_t color_count = 0;
|
||||
|
||||
switch (color_mode) {
|
||||
case GREYSCALE1: number_of_color = 1; break;
|
||||
case GREYSCALE2: number_of_color = 3; break;
|
||||
case GREYSCALE4: number_of_color = 15; break;
|
||||
default:
|
||||
break;
|
||||
case GREYSCALE1: color_count = 1; break;
|
||||
case GREYSCALE2: color_count = 3; break;
|
||||
case GREYSCALE4: color_count = 15; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
while (number_of_color--) {
|
||||
*color++ = *colors++;
|
||||
uint16_t tmp;
|
||||
while (color_count--) {
|
||||
tmp = *colors++;
|
||||
*color++ = ENDIAN_COLOR(tmp);
|
||||
}
|
||||
|
||||
end_of_queue = (uint8_t *)color;
|
||||
|
@ -326,7 +327,7 @@ void TFT_Queue::add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
|
|||
parameters->y = y;
|
||||
parameters->width = width;
|
||||
parameters->height = height;
|
||||
parameters->color = color;
|
||||
parameters->color = ENDIAN_COLOR(color);
|
||||
|
||||
end_of_queue += sizeof(parametersCanvasBar_t);
|
||||
task_parameters->count++;
|
||||
|
@ -344,7 +345,7 @@ void TFT_Queue::add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t h
|
|||
parameters->y = y;
|
||||
parameters->width = width;
|
||||
parameters->height = height;
|
||||
parameters->color = color;
|
||||
parameters->color = ENDIAN_COLOR(color);
|
||||
|
||||
end_of_queue += sizeof(parametersCanvasRectangle_t);
|
||||
task_parameters->count++;
|
||||
|
|
|
@ -414,21 +414,21 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
|
|||
extern screenFunc_t _manual_move_func_ptr;
|
||||
if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) {
|
||||
|
||||
#define SLIDER_LENGHT 224
|
||||
#define SLIDER_LENGTH 224
|
||||
#define SLIDER_Y_POSITION 140
|
||||
|
||||
tft.canvas((TFT_WIDTH - SLIDER_LENGHT) / 2, SLIDER_Y_POSITION, SLIDER_LENGHT, 16);
|
||||
tft.canvas((TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION, SLIDER_LENGTH, 16);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
|
||||
int16_t position = (SLIDER_LENGHT - 2) * ui.encoderPosition / maxEditValue;
|
||||
int16_t position = (SLIDER_LENGTH - 2) * ui.encoderPosition / maxEditValue;
|
||||
tft.add_bar(0, 7, 1, 2, ui.encoderPosition == 0 ? COLOR_SLIDER_INACTIVE : COLOR_SLIDER);
|
||||
tft.add_bar(1, 6, position, 4, COLOR_SLIDER);
|
||||
tft.add_bar(position + 1, 6, SLIDER_LENGHT - 2 - position, 4, COLOR_SLIDER_INACTIVE);
|
||||
tft.add_bar(SLIDER_LENGHT - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE);
|
||||
tft.add_bar(position + 1, 6, SLIDER_LENGTH - 2 - position, 4, COLOR_SLIDER_INACTIVE);
|
||||
tft.add_bar(SLIDER_LENGTH - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE);
|
||||
|
||||
#if ENABLED(TOUCH_SCREEN)
|
||||
tft.add_image((SLIDER_LENGHT - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER);
|
||||
touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGHT) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGHT, 32, maxEditValue);
|
||||
tft.add_image((SLIDER_LENGTH - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER);
|
||||
touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGTH, 32, maxEditValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,20 @@
|
|||
#define TOUCH_LANDSCAPE 1
|
||||
#define TOUCH_PORTRAIT 2
|
||||
|
||||
#ifndef TOUCH_CALIBRATION_X
|
||||
#define TOUCH_CALIBRATION_X 0
|
||||
#endif
|
||||
#ifndef TOUCH_CALIBRATION_Y
|
||||
#define TOUCH_CALIBRATION_Y 0
|
||||
#endif
|
||||
#ifndef TOUCH_OFFSET_X
|
||||
#define TOUCH_OFFSET_X 0
|
||||
#endif
|
||||
#ifndef TOUCH_OFFSET_Y
|
||||
#define TOUCH_OFFSET_Y 0
|
||||
#endif
|
||||
#ifndef TOUCH_ORIENTATION
|
||||
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
||||
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
||||
#endif
|
||||
|
||||
#define SSD1963 0x5761
|
||||
|
|
|
@ -598,6 +598,10 @@
|
|||
#include "stm32f4/pins_MKS_ROBIN_PRO_V2.h" // STM32F4 env:mks_robin_pro2
|
||||
#elif MB(MKS_ROBIN_NANO_V3)
|
||||
#include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3
|
||||
#elif MB(ANET_ET4)
|
||||
#include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_OpenBLT
|
||||
#elif MB(ANET_ET4P)
|
||||
#include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_OpenBLT
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
|
|
223
Marlin/src/pins/stm32f4/pins_ANET_ET4.h
Normal file
223
Marlin/src/pins/stm32f4/pins_ANET_ET4.h
Normal file
|
@ -0,0 +1,223 @@
|
|||
/**
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if NOT_TARGET(STM32F4)
|
||||
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
|
||||
#elif HOTENDS > 1 || E_STEPPERS > 1
|
||||
#error "Anet ET4 only supports one hotend / E-stepper. Comment out this line to continue."
|
||||
#endif
|
||||
|
||||
#ifndef BOARD_INFO_NAME
|
||||
#define BOARD_INFO_NAME "Anet ET4 1.x"
|
||||
#endif
|
||||
|
||||
//
|
||||
// EEPROM
|
||||
//
|
||||
|
||||
// Use one of these or SDCard-based Emulation will be used
|
||||
#if NO_EEPROM_SELECTED
|
||||
//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
|
||||
#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
|
||||
//#define IIC_BL24CXX_EEPROM // Use I2C EEPROM onboard IC (AT24C04C, Size 4KB, PageSize 16B)
|
||||
#endif
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
// Decrease delays and flash wear by spreading writes across the
|
||||
// 128 kB sector allocated for EEPROM emulation.
|
||||
#define FLASH_EEPROM_LEVELING
|
||||
#elif ENABLED(IIC_BL24CXX_EEPROM)
|
||||
#define IIC_EEPROM_SDA PB11
|
||||
#define IIC_EEPROM_SCL PB10
|
||||
#define EEPROM_DEVICE_ADDRESS 0xA0
|
||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||
#endif
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
//
|
||||
#define X_STOP_PIN PC13
|
||||
#define Y_STOP_PIN PE12
|
||||
#define Z_STOP_PIN PE11
|
||||
|
||||
//
|
||||
// Z Probe
|
||||
//
|
||||
#if ENABLED(BLTOUCH)
|
||||
#error "You will need to use 24V to 5V converter and remove one resistor and capacitor from the motherboard. See https://github.com/davidtgbe/Marlin/blob/bugfix-2.0.x/docs/Tutorials/bltouch-en.md for more information. Comment out this line to proceed at your own risk."
|
||||
#define SERVO0_PIN PC3
|
||||
#elif !defined(Z_MIN_PROBE_PIN)
|
||||
#define Z_MIN_PROBE_PIN PC3
|
||||
#endif
|
||||
|
||||
//
|
||||
// Filament Runout Sensor
|
||||
//
|
||||
#ifndef FIL_RUNOUT_PIN
|
||||
#define FIL_RUNOUT_PIN PA2
|
||||
#endif
|
||||
|
||||
//
|
||||
// Power Loss Detection
|
||||
//
|
||||
#ifndef POWER_LOSS_PIN
|
||||
#define POWER_LOSS_PIN PA8
|
||||
#endif
|
||||
|
||||
//
|
||||
// LED PIN
|
||||
//
|
||||
#define LED_PIN PD12
|
||||
|
||||
//
|
||||
// Steppers
|
||||
//
|
||||
#define X_STEP_PIN PB6
|
||||
#define X_DIR_PIN PB5
|
||||
#define X_ENABLE_PIN PB7
|
||||
|
||||
#define Y_STEP_PIN PB3
|
||||
#define Y_DIR_PIN PD6
|
||||
#define Y_ENABLE_PIN PB4
|
||||
|
||||
#define Z_STEP_PIN PA12
|
||||
#define Z_DIR_PIN PA11
|
||||
#define Z_ENABLE_PIN PA15
|
||||
|
||||
#define E0_STEP_PIN PB9
|
||||
#define E0_DIR_PIN PB8
|
||||
#define E0_ENABLE_PIN PE0
|
||||
|
||||
//
|
||||
// Temperature Sensors
|
||||
//
|
||||
#define TEMP_0_PIN PA1
|
||||
#define TEMP_BED_PIN PA4
|
||||
|
||||
//
|
||||
// Heaters
|
||||
//
|
||||
#define HEATER_0_PIN PA0
|
||||
#define HEATER_BED_PIN PE2
|
||||
|
||||
//
|
||||
// Fans
|
||||
//
|
||||
#define FAN_PIN PE3 // Layer fan
|
||||
#define FAN1_PIN PE1 // Hotend fan
|
||||
|
||||
#ifndef E0_AUTO_FAN_PIN
|
||||
#define E0_AUTO_FAN_PIN FAN1_PIN
|
||||
#endif
|
||||
|
||||
//
|
||||
// LCD / Controller
|
||||
//
|
||||
#define TFT_RESET_PIN PE6
|
||||
#define TFT_CS_PIN PD7
|
||||
#define TFT_RS_PIN PD13
|
||||
#define TFT_INTERFACE_FSMC_8BIT
|
||||
|
||||
//
|
||||
// Touch Screen
|
||||
// https://ldm-systems.ru/f/doc/catalog/HY-TFT-2,8/XPT2046.pdf
|
||||
//
|
||||
#if ENABLED(TOUCH_SCREEN)
|
||||
#define TOUCH_CS_PIN PB2
|
||||
#define TOUCH_SCK_PIN PB0
|
||||
#define TOUCH_MOSI_PIN PE5
|
||||
#define TOUCH_MISO_PIN PE4
|
||||
#define TOUCH_INT_PIN PB1
|
||||
#endif
|
||||
|
||||
// Touchscreen calibration does not work correctly with ANET_ET5_TFT35 or ANET_ET4_TFT28
|
||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||
#undef TOUCH_SCREEN_CALIBRATION
|
||||
#endif
|
||||
|
||||
#if ENABLED(ANET_ET5_TFT35)
|
||||
#ifndef TOUCH_CALIBRATION_X
|
||||
#define TOUCH_CALIBRATION_X 17125
|
||||
#endif
|
||||
#ifndef TOUCH_CALIBRATION_Y
|
||||
#define TOUCH_CALIBRATION_Y -11307
|
||||
#endif
|
||||
#ifndef TOUCH_OFFSET_X
|
||||
#define TOUCH_OFFSET_X -26
|
||||
#endif
|
||||
#ifndef TOUCH_OFFSET_Y
|
||||
#define TOUCH_OFFSET_Y 337
|
||||
#endif
|
||||
#ifndef TOUCH_ORIENTATION
|
||||
#define TOUCH_ORIENTATION TOUCH_PORTRAIT
|
||||
#endif
|
||||
#elif ENABLED(ANET_ET4_TFT28)
|
||||
#ifndef TOUCH_CALIBRATION_X
|
||||
#define TOUCH_CALIBRATION_X -11838
|
||||
#endif
|
||||
#ifndef TOUCH_CALIBRATION_Y
|
||||
#define TOUCH_CALIBRATION_Y 8776
|
||||
#endif
|
||||
#ifndef TOUCH_OFFSET_X
|
||||
#define TOUCH_OFFSET_X 333
|
||||
#endif
|
||||
#ifndef TOUCH_OFFSET_Y
|
||||
#define TOUCH_OFFSET_Y -17
|
||||
#endif
|
||||
#ifndef TOUCH_ORIENTATION
|
||||
#define TOUCH_ORIENTATION TOUCH_PORTRAIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// SD Card
|
||||
//
|
||||
//#define SDIO_SUPPORT
|
||||
|
||||
#ifndef SDCARD_CONNECTION
|
||||
#define SDCARD_CONNECTION CUSTOM_CABLE
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
#define SDIO_D0_PIN PC8
|
||||
#define SDIO_D1_PIN PC9
|
||||
#define SDIO_D2_PIN PC10
|
||||
#define SDIO_D3_PIN PC11
|
||||
#define SDIO_CK_PIN PC12
|
||||
#define SDIO_CMD_PIN PD2
|
||||
|
||||
#if DISABLED(SDIO_SUPPORT)
|
||||
#define SOFTWARE_SPI
|
||||
#define SDSS SDIO_D3_PIN
|
||||
#define SCK_PIN SDIO_CK_PIN
|
||||
#define MISO_PIN SDIO_D0_PIN
|
||||
#define MOSI_PIN SDIO_CMD_PIN
|
||||
#endif
|
||||
|
||||
#ifndef SD_DETECT_PIN
|
||||
#define SD_DETECT_PIN PD3
|
||||
#endif
|
||||
|
||||
#endif
|
34
Marlin/src/pins/stm32f4/pins_ANET_ET4P.h
Normal file
34
Marlin/src/pins/stm32f4/pins_ANET_ET4P.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BOARD_INFO_NAME "Anet ET4P 1.x"
|
||||
|
||||
//
|
||||
// TMC2208 Configuration_adv defaults for Anet ET4P-MB_V1.x
|
||||
//
|
||||
#if !AXIS_DRIVER_TYPE_X(TMC2208_STANDALONE) || !AXIS_DRIVER_TYPE_Y(TMC2208_STANDALONE) || !AXIS_DRIVER_TYPE_Z(TMC2208_STANDALONE) || !AXIS_DRIVER_TYPE_E0(TMC2208_STANDALONE)
|
||||
#error "ANET_ET4P requires ([XYZ]|E0)_DRIVER_TYPE set to TMC2208_STANDALONE."
|
||||
#endif
|
||||
|
||||
#include "pins_ANET_ET4.h"
|
|
@ -1241,6 +1241,29 @@ build_flags = ${common_stm32.build_flags}
|
|||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
|
||||
#
|
||||
# Anet ET4-MB_V1.x/ET4P-MB_V1.x (STM32F407VGT6 ARM Cortex-M4)
|
||||
# For use with with davidtgbe's OpenBLT bootloader https://github.com/davidtgbe/openblt/releases
|
||||
# Comment out board_build.offset = 0x10000 if you don't plan to use OpenBLT/flashing directly to 0x08000000.
|
||||
#
|
||||
[env:Anet_ET4_OpenBLT]
|
||||
platform = ${common_stm32.platform}
|
||||
extends = common_stm32
|
||||
build_flags = ${common_stm32.build_flags} -DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED
|
||||
board = genericSTM32F407VGT6
|
||||
board_build.core = stm32
|
||||
board_build.variant = MARLIN_F4x7Vx
|
||||
board_build.ldscript = ldscript.ld
|
||||
board_build.firmware = firmware.srec
|
||||
board_build.offset = 0x10000
|
||||
board_upload.offset_address = 0x08010000
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
|
||||
#
|
||||
# BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4)
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue