You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
925 B
37 lines
925 B
#ifndef _MODULE_POWER_h
|
|
#define _MODULE_POWER_h
|
|
|
|
#include <Arduino.h>
|
|
#include "watchos_consts.h"
|
|
//#include "watchos_hw.h"
|
|
//#include "watchos_types.h"
|
|
#include "EventListener.h"
|
|
|
|
#define MODULE_POWER_INTERACTIVE_LIGHT_SLEEP_DELAY_MS 200
|
|
#define MODULE_POWER_INTERACTIVE_DEEP_SLEEP_DELAY_MS 3000
|
|
|
|
#define MODULE_POWER_NONINTERACTIVE_LIGHT_SLEEP_DELAY_MS 200
|
|
#define MODULE_POWER_NONINTERACTIVE_DEEP_SLEEP_DELAY_MS 500
|
|
|
|
class Module_Power : public Task, public IRunnable, public EventListener
|
|
{
|
|
int m_light_sleep_delay = 0, m_deep_sleep_delay = 0;
|
|
int m_light_sleep_accumulator = 0, m_deep_sleep_accumulator = 0;
|
|
|
|
unsigned long m_last_tick;
|
|
bool m_did_light_sleep;
|
|
|
|
bool m_light_sleep_enabled = true, m_deep_sleep_enabled = true;
|
|
|
|
public:
|
|
void start();
|
|
void tick();
|
|
|
|
void disableLightSleep();
|
|
void enableLightSleep();
|
|
void disableDeepSleep();
|
|
void enableDeepSleep();
|
|
|
|
};
|
|
|
|
#endif
|