Bugfix: Correct power signalling issues

This commit is contained in:
Starbeamrainbowlabs 2019-07-08 14:48:09 +01:00
parent 1a39c5902e
commit cc3c0d9d63
5 changed files with 15 additions and 3 deletions

View file

@ -57,8 +57,8 @@ GPSLocation gps_fetch() {
Serial.println(); Serial.println();
ticks = 0; ticks = 0;
} }
}
ms_last_update = millis(); ms_last_update = millis();
}
continue; continue;
} }

View file

@ -22,6 +22,8 @@ void setup() {
Serial.println(F("[main] Starting")); Serial.println(F("[main] Starting"));
random_begin(); random_begin();
power_init();
DISPLAY_FREE_MEMORY(); DISPLAY_FREE_MEMORY();
GPSLocation gps_data = gps_fetch(); GPSLocation gps_data = gps_fetch();
DISPLAY_FREE_MEMORY(); DISPLAY_FREE_MEMORY();

View file

@ -2,11 +2,15 @@
#include "settings.h" #include "settings.h"
void power_init() {
pinMode(PIN_TPL_DONE, OUTPUT);
digitalWrite(PIN_TPL_DONE, LOW);
}
void power_off() { void power_off() {
Serial.println(F("[power] Shutting down")); Serial.println(F("[power] Shutting down"));
// Serial.println(F("[power] Switching GPS module to standby")); // Serial.println(F("[power] Switching GPS module to standby"));
// power_gps_standby(); // power_gps_standby();
pinMode(PIN_TPL_DONE, OUTPUT);
digitalWrite(PIN_TPL_DONE, HIGH); digitalWrite(PIN_TPL_DONE, HIGH);
// Wait until we're turned off // Wait until we're turned off

View file

@ -1,4 +1,10 @@
/**
* Initialises the TPL5111 done pin to be LOW, so that it catches it when we
* set it to HIGH later.
*/
void power_init();
/** /**
* Signals that our work is complete and that we can turn off now to the * Signals that our work is complete and that we can turn off now to the
* TPL5111. * TPL5111.

View file

@ -25,7 +25,7 @@
#define PIN_SPI_DATA 9 #define PIN_SPI_DATA 9
// The 'done' pin to pulse to signal to the TPL5111 // The 'done' pin to pulse to signal to the TPL5111
#define PIN_TPL_DONE 8 #define PIN_TPL_DONE A0
// Uncomment to print RAM diagnostics at regular intervals. // Uncomment to print RAM diagnostics at regular intervals.
//#define ENABLE_MEMORY_DIAGNOSTICS //#define ENABLE_MEMORY_DIAGNOSTICS