@@ -164,6 +164,37 @@ void setup() {
164164 // default buffer is 256, would not be to bad to go back to the default in need of memory see gps.cpp
165165 SerialGPS.setRxBufferSize (512 );
166166
167+ // ##############################################################
168+ // Handle SD
169+ // ##############################################################
170+
171+ // Counter, how often the SD card will be read before writing an error on the display
172+ int8_t sdCount = 25 ;
173+
174+ displayTest->showTextOnGrid (2 , 2 , " SD..." );
175+ boolean requiresSdCardMount = true ;
176+ #ifdef RADMESSER_S_COMPATIBILITY_MODE
177+ requiresSdCardMount = false ;
178+ #endif
179+ while (!SD.begin ())
180+ {
181+ if (sdCount > 0 ) {
182+ sdCount--;
183+ } else {
184+ displayTest->showTextOnGrid (2 , 2 , " SD... error" );
185+ if (!requiresSdCardMount) {
186+ break ;
187+ }
188+ }
189+ Serial.println (" Card Mount Failed" );
190+ // delay(100);
191+ }
192+ delay (333 ); // Added for user experience
193+ if (SD.begin ()) {
194+ Serial.println (" Card Mount Succeeded" );
195+ displayTest->showTextOnGrid (2 , 2 , " SD... ok" );
196+ }
197+
167198 // ##############################################################
168199 // Check, if the button is pressed
169200 // Enter configuration mode and enable OTA
@@ -216,37 +247,6 @@ void setup() {
216247
217248 sensorManager->setPrimarySensor (1 ); // LEFT !!!
218249
219- // ##############################################################
220- // Handle SD
221- // ##############################################################
222-
223- // Counter, how often the SD card will be read before writing an error on the display
224- int8_t sdCount = 25 ;
225-
226- displayTest->showTextOnGrid (2 , 2 , " SD..." );
227- boolean requiresSdCardMount = true ;
228- #ifdef RADMESSER_S_COMPATIBILITY_MODE
229- requiresSdCardMount = false ;
230- #endif
231- while (!SD.begin ())
232- {
233- if (sdCount > 0 ) {
234- sdCount--;
235- } else {
236- displayTest->showTextOnGrid (2 , 2 , " SD... error" );
237- if (!requiresSdCardMount) {
238- break ;
239- }
240- }
241- Serial.println (" Card Mount Failed" );
242- // delay(100);
243- }
244- delay (333 ); // Added for user experience
245- if (SD.begin ()) {
246- Serial.println (" Card Mount Succeeded" );
247- displayTest->showTextOnGrid (2 , 2 , " SD... ok" );
248- }
249-
250250 // ##############################################################
251251 // Prepare CSV file
252252 // ##############################################################
0 commit comments