@@ -145,6 +145,10 @@ void setup() {
145
145
146
146
arcada.displayBegin ();
147
147
148
+ DISPLAY_SIZE = min (ARCADA_TFT_WIDTH, ARCADA_TFT_HEIGHT);
149
+ DISPLAY_X_OFFSET = (ARCADA_TFT_WIDTH - DISPLAY_SIZE) / 2 ;
150
+ DISPLAY_Y_OFFSET = (ARCADA_TFT_HEIGHT - DISPLAY_SIZE) / 2 ;
151
+
148
152
Serial.begin (115200 );
149
153
// while(!Serial) delay(10);
150
154
@@ -161,13 +165,13 @@ void setup() {
161
165
// of the nose booper when doing this...it self-calibrates on startup.
162
166
// DO THIS BEFORE THE SPLASH SO IT DOESN'T REQUIRE A LENGTHY HOLD.
163
167
char *filename = " config.eye" ;
164
- arcada. readButtons ();
165
- uint32_t buttonState = arcada.justPressedButtons ();
166
- if (buttonState & ARCADA_BUTTONMASK_UP) {
168
+
169
+ uint32_t buttonState = arcada.readButtons ();
170
+ if (( buttonState & ARCADA_BUTTONMASK_UP) && arcada. exists ( " config1.eye " ) ) {
167
171
filename = " config1.eye" ;
168
- } else if (buttonState & ARCADA_BUTTONMASK_A) {
172
+ } else if (( buttonState & ARCADA_BUTTONMASK_A) && arcada. exists ( " config2.eye " ) ) {
169
173
filename = " config2.eye" ;
170
- } else if (buttonState & ARCADA_BUTTONMASK_DOWN) {
174
+ } else if (( buttonState & ARCADA_BUTTONMASK_DOWN) && arcada. exists ( " config3.eye " ) ) {
171
175
filename = " config3.eye" ;
172
176
}
173
177
@@ -204,7 +208,9 @@ void setup() {
204
208
yield ();
205
209
uint8_t e;
206
210
for (e=0 ; e<NUM_EYES; e++) {
211
+ #if (ARCADA_TFT_WIDTH != 160) && (ARCADA_TFT_HEIGHT != 128) // 160x128 is ST7735 which isn't able to deal
207
212
eye[e].spi ->setClockSource (DISPLAY_CLKSRC);
213
+ #endif
208
214
eye[e].display ->fillScreen (0 );
209
215
eye[e].dma .allocate ();
210
216
eye[e].dma .setTrigger (eye[e].spi ->getDMAC_ID_TX ());
@@ -837,7 +843,7 @@ void loop() {
837
843
// Initialize new SPI transaction & address window...
838
844
eye[eyeNum].spi ->beginTransaction (settings);
839
845
digitalWrite (eye[eyeNum].cs , LOW); // Chip select
840
- eye[eyeNum].display ->setAddrWindow (0 , 0 , DISPLAY_SIZE, DISPLAY_SIZE);
846
+ eye[eyeNum].display ->setAddrWindow (DISPLAY_X_OFFSET, DISPLAY_Y_OFFSET , DISPLAY_SIZE, DISPLAY_SIZE);
841
847
delayMicroseconds (1 );
842
848
digitalWrite (eye[eyeNum].dc , HIGH); // Data mode
843
849
if (eyeNum == (NUM_EYES-1 )) {
0 commit comments