|
@@ -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)
|