From 19c9f45432b4bda00572b84f9b34ca9e1a81f87f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 2 Mar 2022 08:14:03 -0500 Subject: [PATCH] added sleep at start during boot to delay battery read --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 8b0c8835..948d7496 100644 --- a/main.c +++ b/main.c @@ -22,6 +22,8 @@ #include "main.h" int main(int argc, char * argv[]) { + + sleep(5); // try sleep at start to help boot printf("\n\nCubeSatSim v1.1 starting...\n\n"); @@ -723,6 +725,8 @@ int main(int argc, char * argv[]) { fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); #endif // if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V + +/**/ if ((batteryCurrent > currentThreshold) && (batteryVoltage < voltageThreshold) && !sim_mode) // currentThreshold ensures that this won't happen when running on DC power. { fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage); @@ -745,7 +749,7 @@ int main(int argc, char * argv[]) { pclose(file6); sleep(10); } - +/**/ // sleep(1); // Delay 1 second ctr = 0; #ifdef DEBUG_LOGGING