Skip to content

Commit

Permalink
Merge pull request #132 from sparkfun/release_candidate
Browse files Browse the repository at this point in the history
v2.3 Revisited - disable unnecessary debug prints
  • Loading branch information
PaulZC authored Aug 1, 2022
2 parents 7c3b6a3 + 1730ffc commit 6801bbe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Binary file modified Binaries/OpenLog_Artemis-V10-v23.bin
Binary file not shown.
Binary file modified Binaries/OpenLog_Artemis-X04-v23.bin
Binary file not shown.
23 changes: 17 additions & 6 deletions Firmware/OpenLog_Artemis/OpenLog_Artemis.ino
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ enum returnStatus {
STATUS_PRESSED_X,
};

//Header
void beginSD(bool silent = false);
void beginIMU(bool silent = false);

//Setup Qwiic Port
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#include <Wire.h>
Expand Down Expand Up @@ -908,7 +912,7 @@ void setQwiicPullups(uint32_t qwiicBusPullUps)
pin_config(PinName(PIN_QWIIC_SDA), sdaPinCfg);
}

void beginSD()
void beginSD(bool silent)
{
pinMode(PIN_MICROSD_POWER, OUTPUT);
pin_config(PinName(PIN_MICROSD_POWER), g_AM_HAL_GPIO_OUTPUT); // Make sure the pin does actually get re-configured
Expand Down Expand Up @@ -944,8 +948,11 @@ void beginSD()
}
if (sd.begin(SD_CONFIG) == false) // Try to begin the SD card using the correct chip select
{
SerialPrintln(F("SD init failed (second attempt). Is card present? Formatted?"));
SerialPrintln(F("Please ensure the SD card is formatted correctly using https://www.sdcard.org/downloads/formatter/"));
if (!silent)
{
SerialPrintln(F("SD init failed (second attempt). Is card present? Formatted?"));
SerialPrintln(F("Please ensure the SD card is formatted correctly using https://www.sdcard.org/downloads/formatter/"));
}
digitalWrite(PIN_MICROSD_CHIP_SELECT, HIGH); //Be sure SD is deselected
online.microSD = false;
return;
Expand All @@ -955,7 +962,10 @@ void beginSD()
//Change to root directory. All new file creation will be in root.
if (sd.chdir() == false)
{
SerialPrintln(F("SD change directory failed"));
if (!silent)
{
SerialPrintln(F("SD change directory failed"));
}
online.microSD = false;
return;
}
Expand Down Expand Up @@ -988,7 +998,7 @@ void configureSerial1TxRx(void) // Configure pins 12 and 13 for UART1 TX and RX
pin_config(PinName(BREAKOUT_PIN_RX), pinConfigRx);
}

void beginIMU()
void beginIMU(bool silent)
{
pinMode(PIN_IMU_POWER, OUTPUT);
pin_config(PinName(PIN_IMU_POWER), g_AM_HAL_GPIO_OUTPUT); // Make sure the pin does actually get re-configured
Expand Down Expand Up @@ -1038,7 +1048,8 @@ void beginIMU()
{
printDebug("beginIMU: second attempt at myICM.begin failed. myICM.status = " + (String)myICM.status + "\r\n");
digitalWrite(PIN_IMU_CHIP_SELECT, HIGH); //Be sure IMU is deselected
//SerialPrintln(F("ICM-20948 failed to init."));
if (!silent)
SerialPrintln(F("ICM-20948 failed to init."));
imuPowerOff();
online.IMU = false;
return;
Expand Down
4 changes: 2 additions & 2 deletions Firmware/OpenLog_Artemis/lowerPower.ino
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ void wakeFromSleep()

SPI.begin(); //Needed if SD is disabled

beginSD(); //285 - 293ms
beginSD(true); //285 - 293ms

enableCIPOpullUp(); // Enable CIPO pull-up _after_ beginSD

Expand All @@ -517,7 +517,7 @@ void wakeFromSleep()
beginSerialOutput();
}

beginIMU(); //61ms
beginIMU(true); //61ms
printDebug("wakeFromSleep: online.IMU = " + (String)online.IMU + "\r\n");

//If we powered down the Qwiic bus, then re-begin and re-configure everything
Expand Down

0 comments on commit 6801bbe

Please sign in to comment.