xmin-c3 share MCP tool and sleep mode can be disabled

This commit is contained in:
Terrence
2025-08-09 03:07:09 +08:00
parent 2a02dd65be
commit 48a1c5da29
9 changed files with 149 additions and 109 deletions

View File

@@ -2,6 +2,7 @@
#include "application.h"
#include "board.h"
#include "display.h"
#include "settings.h"
#include <esp_log.h>
#include <esp_sleep.h>
@@ -32,6 +33,12 @@ SleepTimer::~SleepTimer() {
void SleepTimer::SetEnabled(bool enabled) {
if (enabled && !enabled_) {
Settings settings("wifi", false);
if (!settings.GetBool("sleep_mode", true)) {
ESP_LOGI(TAG, "Power save timer is disabled by settings");
return;
}
ticks_ = 0;
enabled_ = enabled;
ESP_ERROR_CHECK(esp_timer_start_periodic(sleep_timer_, 1000000));