Pārlūkot izejas kodu

Fixes for ExtUI / EVE (#17726)

RudolphRiedel 5 gadus atpakaļ
vecāks
revīzija
0b3a96412c
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam

+ 1
- 0
Marlin/Configuration_adv.h Parādīt failu

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

+ 27
- 14
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp Parādīt failu

@@ -1057,6 +1057,8 @@ void CLCD::init() {
1057 1057
   host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0);
1058 1058
   host_cmd(FTDI::ACTIVE, 0);                        // Activate the System Clock
1059 1059
 
1060
+  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.
1061
+
1060 1062
   /* read the device-id until it returns 0x7c or times out, should take less than 150ms */
1061 1063
   uint8_t counter;
1062 1064
   for (counter = 0; counter < 250; counter++) {
@@ -1078,6 +1080,24 @@ void CLCD::init() {
1078 1080
    }
1079 1081
   }
1080 1082
 
1083
+  /* make sure that all units are in working conditions, usually the touch-controller needs a little more time */
1084
+  for (counter = 0; counter < 100; counter++) {
1085
+    uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03;
1086
+    if (reset_status == 0x00) {
1087
+      #if ENABLED(TOUCH_UI_DEBUG)
1088
+        SERIAL_ECHO_MSG("FTDI chip all units running ");
1089
+      #endif
1090
+      break;
1091
+    }
1092
+    else
1093
+      delay(1);
1094
+
1095
+    if (ENABLED(TOUCH_UI_DEBUG) && counter == 99) {
1096
+      SERIAL_ECHO_START();
1097
+      SERIAL_ECHOLNPAIR("Timeout waiting for reset status. Should be 0x00, got ", reset_status);
1098
+    }
1099
+  }
1100
+
1081 1101
   mem_write_8(REG::PWM_DUTY, 0);   // turn off Backlight, Frequency already is set to 250Hz default
1082 1102
 
1083 1103
   /* Configure the FT8xx Registers */
@@ -1129,9 +1149,6 @@ void CLCD::init() {
1129 1149
   // Turning off dithering seems to help prevent horizontal line artifacts on certain colors
1130 1150
   mem_write_8(REG::DITHER,  0);
1131 1151
 
1132
-  // Initialize the command FIFO
1133
-  CommandFifo::reset();
1134
-
1135 1152
   default_touch_transform();
1136 1153
   default_display_orientation();
1137 1154
 }
@@ -1151,17 +1168,13 @@ void CLCD::default_display_orientation() {
1151 1168
   #if FTDI_API_LEVEL >= 810
1152 1169
     // Set the initial display orientation. On the FT810, we use the command
1153 1170
     // processor to do this since it will also update the transform matrices.
1154
-    if (FTDI::ftdi_chip >= 810) {
1155
-      CommandFifo cmd;
1156
-      cmd.setrotate(
1157
-          ENABLED(TOUCH_UI_MIRRORED) * 4
1158
-        + ENABLED(TOUCH_UI_PORTRAIT) * 2
1159
-        + ENABLED(TOUCH_UI_INVERTED) * 1
1160
-      );
1161
-      cmd.execute();
1162
-    }
1163
-    else
1164
-      TERN_(TOUCH_UI_INVERTED, mem_write_32(REG::ROTATE, 1));
1171
+    CommandFifo cmd;
1172
+    cmd.setrotate(
1173
+        ENABLED(TOUCH_UI_MIRRORED) * 4
1174
+      + ENABLED(TOUCH_UI_PORTRAIT) * 2
1175
+      + ENABLED(TOUCH_UI_INVERTED) * 1
1176
+    );
1177
+    cmd.execute();
1165 1178
   #elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED)
1166 1179
     #error "PORTRAIT or MIRRORED orientation not supported on the FT800."
1167 1180
   #elif ENABLED(TOUCH_UI_INVERTED)

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.h Parādīt failu

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

+ 18
- 0
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/pin_mappings.h Parādīt failu

@@ -27,6 +27,24 @@
27 27
  * without adding new pin definitions to the board.
28 28
  */
29 29
 
30
+#ifdef CHEETAH_TFT_PINMAP
31
+  #ifndef __MARLIN_FIRMWARE__
32
+    #error "This pin mapping requires Marlin."
33
+  #endif    
34
+  
35
+    #define CLCD_SPI_BUS    2
36
+
37
+    #define CLCD_MOD_RESET  PC9
38
+    #define CLCD_SPI_CS     PB12
39
+
40
+    //#define CLCD_USE_SOFT_SPI
41
+    #if ENABLED(CLCD_USE_SOFT_SPI)
42
+      #define CLCD_SOFT_SPI_MOSI PB15
43
+      #define CLCD_SOFT_SPI_MISO PB14
44
+      #define CLCD_SOFT_SPI_SCLK PB13
45
+    #endif
46
+#endif
47
+
30 48
 #ifdef S6_TFT_PINMAP
31 49
   #ifndef __MARLIN_FIRMWARE__
32 50
     #error "This pin mapping requires Marlin."

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt