Upgrade Playlist Features

This commit is contained in:
2025-12-09 17:20:01 +08:00
parent 577990de69
commit 8bd2780688
683 changed files with 91812 additions and 81260 deletions

View File

@@ -1,34 +1,34 @@
#pragma once
#include <functional>
#include <esp_timer.h>
#include <esp_pm.h>
class PowerSaveTimer {
public:
PowerSaveTimer(int cpu_max_freq, int seconds_to_sleep = 20, int seconds_to_shutdown = -1);
~PowerSaveTimer();
void SetEnabled(bool enabled);
void OnEnterSleepMode(std::function<void()> callback);
void OnExitSleepMode(std::function<void()> callback);
void OnShutdownRequest(std::function<void()> callback);
void WakeUp();
private:
void PowerSaveCheck();
esp_timer_handle_t power_save_timer_ = nullptr;
bool enabled_ = false;
bool in_sleep_mode_ = false;
bool is_wake_word_running_ = false;
int ticks_ = 0;
int cpu_max_freq_;
int seconds_to_sleep_;
int seconds_to_shutdown_;
std::function<void()> on_enter_sleep_mode_;
std::function<void()> on_exit_sleep_mode_;
std::function<void()> on_shutdown_request_;
};
#pragma once
#include <functional>
#include <esp_timer.h>
#include <esp_pm.h>
class PowerSaveTimer {
public:
PowerSaveTimer(int cpu_max_freq, int seconds_to_sleep = 20, int seconds_to_shutdown = -1);
~PowerSaveTimer();
void SetEnabled(bool enabled);
void OnEnterSleepMode(std::function<void()> callback);
void OnExitSleepMode(std::function<void()> callback);
void OnShutdownRequest(std::function<void()> callback);
void WakeUp();
private:
void PowerSaveCheck();
esp_timer_handle_t power_save_timer_ = nullptr;
bool enabled_ = false;
bool in_sleep_mode_ = false;
bool is_wake_word_running_ = false;
int ticks_ = 0;
int cpu_max_freq_;
int seconds_to_sleep_;
int seconds_to_shutdown_;
std::function<void()> on_enter_sleep_mode_;
std::function<void()> on_exit_sleep_mode_;
std::function<void()> on_shutdown_request_;
};