mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
This commit is contained in:
parent
63a6286029
commit
8022b03ae6
@ -73,9 +73,9 @@ lib_deps =
|
||||
git+https://github.com/fvanroie/ConsoleInput.git
|
||||
;git+https://github.com/andrethomas/TasmotaSlave.git
|
||||
;git+https://github.com/lvgl/lvgl.git
|
||||
lvgl/lvgl @^7.11.0 ; from PIO library
|
||||
;bodmer/TFT_eSPI @ 2.3.4 ; Tft SPI drivers EXACT version 2.3.5 has compile error
|
||||
git+https://github.com/Bodmer/TFT_eSPI.git
|
||||
lvgl/lvgl@^7.11.0 ; from PIO library
|
||||
bodmer/TFT_eSPI^2.3.61 ; Tft SPI drivers EXACT version 2.3.5 has compile error
|
||||
;git+https://github.com/Bodmer/TFT_eSPI.git
|
||||
; ------ Unused / Test libraries
|
||||
;https://github.com/netwizeBE/TFT_eSPI.git
|
||||
;Syslog@^2.0.0 ; Obsoleted
|
||||
|
@ -91,9 +91,7 @@ void Esp32Device::set_backlight_pin(uint8_t pin)
|
||||
|
||||
void Esp32Device::set_backlight_level(uint8_t level)
|
||||
{
|
||||
_backlight_level = level >= 0 ? level : 0;
|
||||
_backlight_level = _backlight_level <= 100 ? _backlight_level : 100;
|
||||
|
||||
_backlight_level = level;
|
||||
update_backlight();
|
||||
}
|
||||
|
||||
@ -116,7 +114,7 @@ bool Esp32Device::get_backlight_power()
|
||||
void Esp32Device::update_backlight()
|
||||
{
|
||||
if(_backlight_pin < GPIO_NUM_MAX) {
|
||||
uint32_t duty = _backlight_power ? map(_backlight_level, 0, 100, 0, 4095) : 0;
|
||||
uint32_t duty = _backlight_power ? map(_backlight_level, 0, 255, 0, 4095) : 0;
|
||||
ledcWrite(BACKLIGHT_CHANNEL, duty); // ledChannel and value
|
||||
}
|
||||
}
|
||||
|
@ -60,9 +60,7 @@ void Esp8266Device::set_backlight_pin(uint8_t pin)
|
||||
|
||||
void Esp8266Device::set_backlight_level(uint8_t level)
|
||||
{
|
||||
_backlight_level = level >= 0 ? level : 0;
|
||||
_backlight_level = _backlight_level <= 100 ? _backlight_level : 100;
|
||||
|
||||
_backlight_level = level;
|
||||
update_backlight();
|
||||
}
|
||||
|
||||
@ -86,7 +84,7 @@ void Esp8266Device::update_backlight()
|
||||
{
|
||||
if(_backlight_pin == -1) return;
|
||||
|
||||
analogWrite(_backlight_pin, _backlight_power ? map(_backlight_level, 0, 100, 0, 1023) : 0);
|
||||
analogWrite(_backlight_pin, _backlight_power ? map(_backlight_level, 0, 255, 0, 1023) : 0);
|
||||
}
|
||||
|
||||
size_t Esp8266Device::get_free_max_block()
|
||||
|
@ -88,8 +88,7 @@ void PosixDevice::set_backlight_pin(uint8_t pin)
|
||||
|
||||
void PosixDevice::set_backlight_level(uint8_t level)
|
||||
{
|
||||
uint8_t new_level = level >= 0 ? level : 0;
|
||||
new_level = new_level <= 100 ? new_level : 100;
|
||||
uint8_t new_level = level;
|
||||
|
||||
if(_backlight_level != new_level) {
|
||||
_backlight_level = new_level;
|
||||
@ -115,7 +114,7 @@ bool PosixDevice::get_backlight_power()
|
||||
|
||||
void PosixDevice::update_backlight()
|
||||
{
|
||||
uint8_t level = _backlight_power ? map(_backlight_level, 0, 100, 0, 255) : 0;
|
||||
uint8_t level = _backlight_power ? _backlight_level : 0;
|
||||
monitor_backlight(level);
|
||||
// SDL_SetTextureColorMod(monitor.texture, level, level, level);
|
||||
// window_update(&monitor);
|
||||
|
@ -71,9 +71,7 @@ const char* Stm32f4Device::get_chip_model()
|
||||
|
||||
void Stm32f4Device::set_backlight_level(uint8_t level)
|
||||
{
|
||||
_backlight_level = level >= 0 ? level : 0;
|
||||
_backlight_level = _backlight_level <= 100 ? _backlight_level : 100;
|
||||
|
||||
_backlight_level = level;
|
||||
update_backlight();
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,7 @@ void Win32Device::set_backlight_pin(uint8_t pin)
|
||||
|
||||
void Win32Device::set_backlight_level(uint8_t level)
|
||||
{
|
||||
uint8_t new_level = level >= 0 ? level : 0;
|
||||
new_level = new_level <= 100 ? new_level : 100;
|
||||
uint8_t new_level = level;
|
||||
|
||||
if(_backlight_level != new_level) {
|
||||
_backlight_level = new_level;
|
||||
@ -95,7 +94,7 @@ bool Win32Device::get_backlight_power()
|
||||
|
||||
void Win32Device::update_backlight()
|
||||
{
|
||||
uint8_t level = _backlight_power ? map(_backlight_level, 0, 100, 0, 255) : 0;
|
||||
uint8_t level = _backlight_power ? _backlight_level : 0;
|
||||
monitor_backlight(level);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ uint8_t hasp_sleep_state = HASP_SLEEP_OFF; // Used in hasp_drv_touch.cpp
|
||||
static uint16_t sleepTimeShort = 60; // 1 second resolution
|
||||
static uint16_t sleepTimeLong = 120; // 1 second resolution
|
||||
|
||||
uint8_t haspStartDim = 100;
|
||||
uint8_t haspStartDim = 255;
|
||||
uint8_t haspStartPage = 1;
|
||||
uint8_t haspThemeId = 2;
|
||||
uint16_t haspThemeHue = 200;
|
||||
|
@ -288,7 +288,7 @@ static void oobe_calibrate_cb(lv_obj_t* ta, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_CLICKED) {
|
||||
if(oobeAutoCalibrate) {
|
||||
haspDevice.set_backlight_level(100);
|
||||
haspDevice.set_backlight_level(255);
|
||||
guiCalibrate();
|
||||
oobeAutoCalibrate = false;
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
@ -316,7 +316,7 @@ bool oobeSetup()
|
||||
char pass[32];
|
||||
|
||||
if(wifiShowAP(ssid, pass)) {
|
||||
haspDevice.set_backlight_level(100);
|
||||
haspDevice.set_backlight_level(255);
|
||||
oobeSetupQR(ssid, pass);
|
||||
oobeSetupSsid();
|
||||
|
||||
@ -344,7 +344,7 @@ void oobeFakeSetup(const char*, const char*)
|
||||
char ssid[32] = "HASP-ABCDEF";
|
||||
char pass[32] = "haspadmin";
|
||||
|
||||
haspDevice.set_backlight_level(100);
|
||||
haspDevice.set_backlight_level(255);
|
||||
oobeSetupQR(ssid, pass);
|
||||
oobeSetupSsid();
|
||||
oobeSetPage(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user