@@ -202,6 +202,10 @@ enum returnStatus {
202
202
STATUS_PRESSED_X,
203
203
};
204
204
205
+ // Header
206
+ void beginSD (bool silent = false );
207
+ void beginIMU (bool silent = false );
208
+
205
209
// Setup Qwiic Port
206
210
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
207
211
#include < Wire.h>
@@ -908,7 +912,7 @@ void setQwiicPullups(uint32_t qwiicBusPullUps)
908
912
pin_config (PinName (PIN_QWIIC_SDA), sdaPinCfg);
909
913
}
910
914
911
- void beginSD ()
915
+ void beginSD (bool silent )
912
916
{
913
917
pinMode (PIN_MICROSD_POWER, OUTPUT);
914
918
pin_config (PinName (PIN_MICROSD_POWER), g_AM_HAL_GPIO_OUTPUT); // Make sure the pin does actually get re-configured
@@ -944,8 +948,11 @@ void beginSD()
944
948
}
945
949
if (sd.begin (SD_CONFIG) == false ) // Try to begin the SD card using the correct chip select
946
950
{
947
- SerialPrintln (F (" SD init failed (second attempt). Is card present? Formatted?" ));
948
- SerialPrintln (F (" Please ensure the SD card is formatted correctly using https://www.sdcard.org/downloads/formatter/" ));
951
+ if (!silent)
952
+ {
953
+ SerialPrintln (F (" SD init failed (second attempt). Is card present? Formatted?" ));
954
+ SerialPrintln (F (" Please ensure the SD card is formatted correctly using https://www.sdcard.org/downloads/formatter/" ));
955
+ }
949
956
digitalWrite (PIN_MICROSD_CHIP_SELECT, HIGH); // Be sure SD is deselected
950
957
online.microSD = false ;
951
958
return ;
@@ -955,7 +962,10 @@ void beginSD()
955
962
// Change to root directory. All new file creation will be in root.
956
963
if (sd.chdir () == false )
957
964
{
958
- SerialPrintln (F (" SD change directory failed" ));
965
+ if (!silent)
966
+ {
967
+ SerialPrintln (F (" SD change directory failed" ));
968
+ }
959
969
online.microSD = false ;
960
970
return ;
961
971
}
@@ -988,7 +998,7 @@ void configureSerial1TxRx(void) // Configure pins 12 and 13 for UART1 TX and RX
988
998
pin_config (PinName (BREAKOUT_PIN_RX), pinConfigRx);
989
999
}
990
1000
991
- void beginIMU ()
1001
+ void beginIMU (bool silent )
992
1002
{
993
1003
pinMode (PIN_IMU_POWER, OUTPUT);
994
1004
pin_config (PinName (PIN_IMU_POWER), g_AM_HAL_GPIO_OUTPUT); // Make sure the pin does actually get re-configured
@@ -1038,7 +1048,8 @@ void beginIMU()
1038
1048
{
1039
1049
printDebug (" beginIMU: second attempt at myICM.begin failed. myICM.status = " + (String)myICM.status + " \r\n " );
1040
1050
digitalWrite (PIN_IMU_CHIP_SELECT, HIGH); // Be sure IMU is deselected
1041
- // SerialPrintln(F("ICM-20948 failed to init."));
1051
+ if (!silent)
1052
+ SerialPrintln (F (" ICM-20948 failed to init." ));
1042
1053
imuPowerOff ();
1043
1054
online.IMU = false ;
1044
1055
return ;
0 commit comments