OPEnSLab-OSU/Loom

SleepyDog is included but not used, causing compilation errors

Closed this issue · 3 comments

Describe the bug
The Adafruit SleepyDog library is included in Loom, but never used:

#include "Sleep_Manager.h"
#include "RTC/RTC.h"
#include <Adafruit_SleepyDog.h>
#include <LowPower.h>
bool Loom_Sleep_Manager::sleep()
{
pre_sleep();
LowPower.standby();
// This is where programs waits until waking
post_sleep();
}
I suspect SleepyDog was previously used but was removed during feature development.

As SleepyDog conflicts with FeatherFault (see OPEnSLab-OSU/FeatherFault#5) which is needed by several projects in the lab, it would be nice if this dependency could be removed.

On second pass, I did find a place where SleepyDog is used:

Loom/src/Manager.cpp

Lines 361 to 371 in 49d1a5d

void LoomManager::nap(const uint16_t ms) const
{
Serial.end();
USBDevice.detach();
// Sleep, with max time of 16000 milliseconds
uint16_t sleepMS = Watchdog.sleep( (ms <= 16000) ? ms : 16000);
USBDevice.attach();
Serial.begin(SERIAL_BAUD);
}
Do projects in the lab use Loom::nap?

Looking at the Github wikis for all of the projects, the only project I see that uses the Loom::nap function is Smartrock. However, when looking at their Github, they have a more recent code that they have for field testing that does not use the Loom::nap function. I would have to check in with them to see whether they are using the code that uses the Loom::nap function or the one without it.

https://github.com/OPEnSLab-OSU/SmartRock/blob/master/SmartRock2.5/SmartRock2.5.ino

SleepyDog has been removed from Loom with version 2.4.0. The nap function in Loom Manager has been moved outside to an example sketch that requires Adafruit SleepyDog to be downloaded outside of Loom, resolving any conflicts with FeatherFault