forked from xiaozhi/xiaozhi-esp32
开机检查背光是否为0,如果为0则调为10 (#379)
* Update backlight.cc * Update backlight.cc --------- Co-authored-by: Xiaoxia <terrence@tenclass.com>
This commit is contained in:
@@ -31,8 +31,16 @@ Backlight::~Backlight() {
|
||||
|
||||
void Backlight::RestoreBrightness() {
|
||||
// Load brightness from settings
|
||||
Settings settings("display");
|
||||
SetBrightness(settings.GetInt("brightness", 75));
|
||||
Settings settings("display");
|
||||
int saved_brightness = settings.GetInt("brightness", 75);
|
||||
|
||||
// 检查亮度值是否为0或过小,设置默认值
|
||||
if (saved_brightness <= 0) {
|
||||
ESP_LOGW(TAG, "Invalid brightness value (%d), setting to default", saved_brightness);
|
||||
saved_brightness = 10; // 设置一个较低的默认值
|
||||
}
|
||||
|
||||
SetBrightness(saved_brightness);
|
||||
}
|
||||
|
||||
void Backlight::SetBrightness(uint8_t brightness, bool permanent) {
|
||||
|
||||
Reference in New Issue
Block a user