Browse Source

Fixes for ExtUI / EVE (#17726)

vanilla_fb_2.0.x
RudolphRiedel 5 years ago
committed by GitHub
parent
commit
0b3a96412c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Marlin/Configuration_adv.h
  2. 27
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp
  3. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.h
  4. 18
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h
  5. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp

1
Marlin/Configuration_adv.h

@ -1385,6 +1385,7 @@
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping //#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping //#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
//#define S6_TFT_PINMAP // FYSETC S6 pin mapping //#define S6_TFT_PINMAP // FYSETC S6 pin mapping
//#define CHEETAH_TFT_PINMAP // FYSETC Cheetah pin mapping
//#define E3_EXP1_PINMAP // E3 type boards (SKR E3/DIP, FYSETC Cheetah and Stock boards) EXP1 pin mapping //#define E3_EXP1_PINMAP // E3 type boards (SKR E3/DIP, FYSETC Cheetah and Stock boards) EXP1 pin mapping
//#define GENERIC_EXP2_PINMAP // GENERIC EXP2 pin mapping //#define GENERIC_EXP2_PINMAP // GENERIC EXP2 pin mapping

27
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp

@ -1057,6 +1057,8 @@ void CLCD::init() {
host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0); host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0);
host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock
delay(40); // FTDI/BRT recommendation: no SPI traffic during startup. EVE needs at the very least 45ms to start, so leave her alone for a little while.
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */ /* read the device-id until it returns 0x7c or times out, should take less than 150ms */
uint8_t counter; uint8_t counter;
for (counter = 0; counter < 250; counter++) { for (counter = 0; counter < 250; counter++) {
@ -1078,6 +1080,24 @@ void CLCD::init() {
} }
} }
/* make sure that all units are in working conditions, usually the touch-controller needs a little more time */
for (counter = 0; counter < 100; counter++) {
uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03;
if (reset_status == 0x00) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_MSG("FTDI chip all units running ");
#endif
break;
}
else
delay(1);
if (ENABLED(TOUCH_UI_DEBUG) && counter == 99) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR("Timeout waiting for reset status. Should be 0x00, got ", reset_status);
}
}
mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default
/* Configure the FT8xx Registers */ /* Configure the FT8xx Registers */
@ -1129,9 +1149,6 @@ void CLCD::init() {
// Turning off dithering seems to help prevent horizontal line artifacts on certain colors // Turning off dithering seems to help prevent horizontal line artifacts on certain colors
mem_write_8(REG::DITHER, 0); mem_write_8(REG::DITHER, 0);
// Initialize the command FIFO
CommandFifo::reset();
default_touch_transform(); default_touch_transform();
default_display_orientation(); default_display_orientation();
} }
@ -1151,7 +1168,6 @@ void CLCD::default_display_orientation() {
#if FTDI_API_LEVEL >= 810 #if FTDI_API_LEVEL >= 810
// Set the initial display orientation. On the FT810, we use the command // Set the initial display orientation. On the FT810, we use the command
// processor to do this since it will also update the transform matrices. // processor to do this since it will also update the transform matrices.
if (FTDI::ftdi_chip >= 810) {
CommandFifo cmd; CommandFifo cmd;
cmd.setrotate( cmd.setrotate(
ENABLED(TOUCH_UI_MIRRORED) * 4 ENABLED(TOUCH_UI_MIRRORED) * 4
@ -1159,9 +1175,6 @@ void CLCD::default_display_orientation() {
+ ENABLED(TOUCH_UI_INVERTED) * 1 + ENABLED(TOUCH_UI_INVERTED) * 1
); );
cmd.execute(); cmd.execute();
}
else
TERN_(TOUCH_UI_INVERTED, mem_write_32(REG::ROTATE, 1));
#elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) #elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED)
#error "PORTRAIT or MIRRORED orientation not supported on the FT800." #error "PORTRAIT or MIRRORED orientation not supported on the FT800."
#elif ENABLED(TOUCH_UI_INVERTED) #elif ENABLED(TOUCH_UI_INVERTED)

2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.h

@ -55,7 +55,7 @@ namespace FTDI {
#ifdef CLCD_USE_SOFT_SPI #ifdef CLCD_USE_SOFT_SPI
return _soft_spi_xfer(0x00); return _soft_spi_xfer(0x00);
#else #else
SPI_OBJ.transfer(0x00); return SPI_OBJ.transfer(0x00);
#endif #endif
}; };

18
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h

@ -27,6 +27,24 @@
* without adding new pin definitions to the board. * without adding new pin definitions to the board.
*/ */
#ifdef CHEETAH_TFT_PINMAP
#ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin."
#endif
#define CLCD_SPI_BUS 2
#define CLCD_MOD_RESET PC9
#define CLCD_SPI_CS PB12
//#define CLCD_USE_SOFT_SPI
#if ENABLED(CLCD_USE_SOFT_SPI)
#define CLCD_SOFT_SPI_MOSI PB15
#define CLCD_SOFT_SPI_MISO PB14
#define CLCD_SOFT_SPI_SCLK PB13
#endif
#endif
#ifdef S6_TFT_PINMAP #ifdef S6_TFT_PINMAP
#ifndef __MARLIN_FIRMWARE__ #ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin." #error "This pin mapping requires Marlin."

2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp

@ -161,7 +161,7 @@ void InterfaceSettingsScreen::onIdle() {
CommandProcessor cmd; CommandProcessor cmd;
switch (cmd.track_tag(value)) { switch (cmd.track_tag(value)) {
case 2: case 2:
screen_data.InterfaceSettingsScreen.brightness = _MAX(11, (value * 128UL) / 0xFFFF); screen_data.InterfaceSettingsScreen.brightness = max(11, (value * 128UL) / 0xFFFF);
CLCD::set_brightness(screen_data.InterfaceSettingsScreen.brightness); CLCD::set_brightness(screen_data.InterfaceSettingsScreen.brightness);
SaveSettingsDialogBox::settingsChanged(); SaveSettingsDialogBox::settingsChanged();
break; break;

Loading…
Cancel
Save