@@ -127,18 +127,26 @@ void fatal(const char *message, uint16_t blinkDelay) {
127127 }
128128}
129129
130+ #include < unistd.h> // sbrk() function
131+
132+ uint32_t availableRAM (void ) {
133+ char top; // Local variable pushed on stack
134+ return &top - (char *)sbrk (0 ); // Top of stack minus end of heap
135+ }
136+
130137// SETUP FUNCTION - CALLED ONCE AT PROGRAM START ---------------------------
131138
132139void setup () {
133140 if (!arcada.arcadaBegin ()) {
134141 while (1 );
135142 }
136- arcada.displayBegin ();
137143
138144 if (!arcada.filesysBeginMSD ()) {
139145 fatal (" No filesystem found!" , 100 );
140146 }
141-
147+
148+ arcada.displayBegin ();
149+
142150 Serial.begin (115200 );
143151// while(!Serial) delay(10);
144152
@@ -155,7 +163,6 @@ void setup() {
155163 // of the nose booper when doing this...it self-calibrates on startup.
156164 // DO THIS BEFORE THE SPLASH SO IT DOESN'T REQUIRE A LENGTHY HOLD.
157165 char *filename = " config.eye" ;
158- #if NUM_EYES > 1 // Only available on MONSTER M4SK
159166 arcada.readButtons ();
160167 uint32_t buttonState = arcada.justPressedButtons ();
161168 if (buttonState & ARCADA_BUTTONMASK_UP) {
@@ -165,7 +172,6 @@ void setup() {
165172 } else if (buttonState & ARCADA_BUTTONMASK_DOWN) {
166173 filename = " config3.eye" ;
167174 }
168- #endif
169175
170176 yield ();
171177 uint8_t e, rtna = 0x01 ; // Screen refresh rate control (datasheet 9.2.18, FRCTRL2)
@@ -886,7 +892,6 @@ void loop() {
886892 irisValue = irisMin + (sum * irisRange); // 0.0-1.0 -> iris min/max
887893 if ((++iris_frame) >= (1 << IRIS_LEVELS)) iris_frame = 0 ;
888894 }
889- #if defined(ADAFRUIT_MONSTER_M4SK_EXPRESS)
890895 if (voiceOn) {
891896 // Read buttons, change pitch
892897 arcada.readButtons ();
@@ -905,7 +910,6 @@ void loop() {
905910 Serial.println (currentPitch);
906911 }
907912 }
908- #endif // ADAFRUIT_MONSTER_M4SK_EXPRESS
909913 user_loop ();
910914 }
911915 } // end first-column check
0 commit comments