61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description: TjdUiAppPowerSavingDialModel.cpp
|
|
*
|
|
* Author: luziquan@ss-tjd.com
|
|
*
|
|
* Create: 2024-11-18
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
#include "TjdUiAppBatterySaverModel.h"
|
|
#include "rtc_api.h"
|
|
#include "soc_lcd_api.h"
|
|
#include "sql_fit.h"
|
|
#include "sys_config.h"
|
|
namespace TJD {
|
|
|
|
#define ENABLE_PRINT_INFO 1
|
|
#if ENABLE_PRINT_INFO
|
|
#define static_print_info(...) sys_ui_log_i(__VA_ARGS__) // 一般信息打印宏控制
|
|
#define static_print_warn(...) sys_ui_log_w(__VA_ARGS__) // 警告信息打印一般常开
|
|
#define static_print_error(...) sys_ui_log_e(__VA_ARGS__) // 错误信息打印一般常开
|
|
#define static_print_debug(...) sys_ui_log_d(__VA_ARGS__) // 调试信息打印一般常开
|
|
#else
|
|
#define static_print_info(...)
|
|
#define static_print_warn(...)
|
|
#define static_print_error(...)
|
|
#define static_print_debug(...)
|
|
#endif
|
|
|
|
TjdUiAppBatterySaverModel &TjdUiAppBatterySaverModel::GetInstance(void)
|
|
{
|
|
static TjdUiAppBatterySaverModel instance;
|
|
return instance;
|
|
};
|
|
|
|
struct BatterySaverData TjdUiAppBatterySaverModel::GetCurrentData(void)
|
|
{
|
|
struct rtc_time cur_time = {};
|
|
tjd_driver_rtc_get_ops()->get_rtc_time(&cur_time);
|
|
BatterySaverData data = {
|
|
.month = cur_time.tm_mon,
|
|
.day = cur_time.tm_mday,
|
|
.hour = cur_time.tm_hour,
|
|
.minute = cur_time.tm_min,
|
|
.second = cur_time.tm_sec,
|
|
.week = cur_time.tm_wday,
|
|
.step = sql_fit_get_day_step(cur_time.tm_wday),
|
|
};
|
|
return data;
|
|
}
|
|
void TjdUiAppBatterySaverModel::SetLcdIdleMode(bool enable)
|
|
{
|
|
if (enable) {
|
|
uapi_lcd_enter_idle_mode();
|
|
} else {
|
|
uapi_lcd_exit_idle_mode();
|
|
}
|
|
}
|
|
|
|
} // namespace TJD
|