Added a test to check power consumption of the board for HW debugging purposes

This commit is contained in:
Th3maz1ng 2024-08-19 12:30:01 +02:00
parent cd8bdf2d41
commit 4761a66a28

View File

@ -0,0 +1,46 @@
/**
* Author : Anatole SCHRAMM-HENRY
* Created the : 19/08/2024
* This is the source file containing an app for power consumption testing.
* It wakes up for 4 seconds, turns the 3.3V rail on, then turns it off and goes to sleep
* for 4 seconds in a loop. This allows to check the sleep current which should be around 60 µA.
*/
#include "definition.h"
#include "BoardConfig.h"
#include "WSPeripherals.h"
#include <LowPower.h>
BoardConfig defaultBC;
WSPeripherals WSP(defaultBC);
uint8_t sleepSlots(0), rCode(0);
WeatherStationDataPacket payload;
void setup()
{
#if SERIAL_DEBUG_ENABLED == 1
Serial.begin(SERIAL_BAUD_RATE);
Serial.println("Setup begin");
#endif
rCode = WSP.init();
#if SERIAL_DEBUG_ENABLED == 1
Serial.print("WSP init returned : ");Serial.println(rCode);
Serial.println("Setup end");
#endif
}
void loop()
{
//Lets sleep for 4 secondes
LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);
Serial.println("Waking Up");
WSP.externalPeripherals(WSPeripherals::ON);
delay(4000);
WSP.externalPeripherals(WSPeripherals::OFF);
Serial.println("Sleeping");
delay(100);
sleepSlots++;
}