Fixes for ExtUI / EVE (#17726)
This commit is contained in:
		| @@ -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,17 +1168,13 @@ 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 | ||||
|         + ENABLED(TOUCH_UI_PORTRAIT) * 2 | ||||
|         + ENABLED(TOUCH_UI_INVERTED) * 1 | ||||
|       ); | ||||
|       cmd.execute(); | ||||
|     } | ||||
|     else | ||||
|       TERN_(TOUCH_UI_INVERTED, mem_write_32(REG::ROTATE, 1)); | ||||
|     CommandFifo cmd; | ||||
|     cmd.setrotate( | ||||
|         ENABLED(TOUCH_UI_MIRRORED) * 4 | ||||
|       + ENABLED(TOUCH_UI_PORTRAIT) * 2 | ||||
|       + ENABLED(TOUCH_UI_INVERTED) * 1 | ||||
|     ); | ||||
|     cmd.execute(); | ||||
|   #elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) | ||||
|     #error "PORTRAIT or MIRRORED orientation not supported on the FT800." | ||||
|   #elif ENABLED(TOUCH_UI_INVERTED) | ||||
|   | ||||
| @@ -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 | ||||
|     }; | ||||
|  | ||||
|   | ||||
| @@ -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." | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user