Fixes for ExtUI / EVE (#17726)

This commit is contained in:
RudolphRiedel 2020-04-27 17:14:42 +02:00 committed by GitHub
parent 035d6cd16d
commit 0b3a96412c
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 16 deletions

View file

@ -1385,6 +1385,7 @@
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 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 GENERIC_EXP2_PINMAP // GENERIC EXP2 pin mapping

View file

@ -1057,6 +1057,8 @@ void CLCD::init() {
host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0);
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 */
uint8_t 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
/* Configure the FT8xx Registers */
@ -1129,9 +1149,6 @@ void CLCD::init() {
// Turning off dithering seems to help prevent horizontal line artifacts on certain colors
mem_write_8(REG::DITHER, 0);
// Initialize the command FIFO
CommandFifo::reset();
default_touch_transform();
default_display_orientation();
}
@ -1151,7 +1168,6 @@ void CLCD::default_display_orientation() {
#if FTDI_API_LEVEL >= 810
// Set the initial display orientation. On the FT810, we use the command
// processor to do this since it will also update the transform matrices.
if (FTDI::ftdi_chip >= 810) {
CommandFifo cmd;
cmd.setrotate(
ENABLED(TOUCH_UI_MIRRORED) * 4
@ -1159,9 +1175,6 @@ void CLCD::default_display_orientation() {
+ ENABLED(TOUCH_UI_INVERTED) * 1
);
cmd.execute();
}
else
TERN_(TOUCH_UI_INVERTED, mem_write_32(REG::ROTATE, 1));
#elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED)
#error "PORTRAIT or MIRRORED orientation not supported on the FT800."
#elif ENABLED(TOUCH_UI_INVERTED)

View file

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

View file

@ -27,6 +27,24 @@
* 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
#ifndef __MARLIN_FIRMWARE__
#error "This pin mapping requires Marlin."

View file

@ -161,7 +161,7 @@ void InterfaceSettingsScreen::onIdle() {
CommandProcessor cmd;
switch (cmd.track_tag(value)) {
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);
SaveSettingsDialogBox::settingsChanged();
break;