mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 05:06:32 +00:00
Leds Panel add checkbox to enable/disable the feature (#23048)
This commit is contained in:
parent
1db796c40f
commit
0c26698ba6
@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
### Changed
|
### Changed
|
||||||
- LVGL, prepare for HASPmota theme, change: no-grow when clicked, DPI set to 160
|
- LVGL, prepare for HASPmota theme, change: no-grow when clicked, DPI set to 160
|
||||||
- LVGL Mirroring add checkbox to enable/disable the feature (in the iterim for a better solution)
|
- LVGL Mirroring add checkbox to enable/disable the feature (in the iterim for a better solution)
|
||||||
|
- Leds Panel add checkbox to enable/disable the feature (in the iterim for a better solution)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -707,6 +707,7 @@ class leds_panel
|
|||||||
|
|
||||||
static var SAMPLING = 100
|
static var SAMPLING = 100
|
||||||
static var PORT = 8886 # default port 8886
|
static var PORT = 8886 # default port 8886
|
||||||
|
static var HTML_WIDTH = 290
|
||||||
static var HTML_HEAD1 =
|
static var HTML_HEAD1 =
|
||||||
"<!DOCTYPE HTML><html><head>"
|
"<!DOCTYPE HTML><html><head>"
|
||||||
static var HTML_URL_F =
|
static var HTML_URL_F =
|
||||||
@ -794,10 +795,10 @@ class leds_panel
|
|||||||
'<body>'
|
'<body>'
|
||||||
'<style>body{margin:0px;}</style>'
|
'<style>body{margin:0px;}</style>'
|
||||||
static var HTML_CONTENT =
|
static var HTML_CONTENT =
|
||||||
'<table style="width:100%;border:0px;margin:0px;">'
|
'<table style="width:100%;border:0px;margin:0px;">'
|
||||||
'<tbody>'
|
'<tbody>'
|
||||||
'<tr><td>'
|
'<tr><td>'
|
||||||
'<canvas id="canvas" width="330" height="10" style="display:block;margin-left:auto;margin-right:auto;"></canvas>'
|
'<canvas id="canvas" width="290" height="10" style="display:block;margin-left:auto;margin-right:auto;"></canvas>'
|
||||||
'</td></tr>'
|
'</td></tr>'
|
||||||
'</tbody>'
|
'</tbody>'
|
||||||
'</table>'
|
'</table>'
|
||||||
@ -837,7 +838,7 @@ class leds_panel
|
|||||||
self.p_leds = self.strip.pixels_buffer(self.p_leds) # update buffer
|
self.p_leds = self.strip.pixels_buffer(self.p_leds) # update buffer
|
||||||
self.h = tasmota.settings.light_pixels_height_1 + 1
|
self.h = tasmota.settings.light_pixels_height_1 + 1
|
||||||
self.w = self.strip.pixel_count() / (tasmota.settings.light_pixels_height_1 + 1)
|
self.w = self.strip.pixel_count() / (tasmota.settings.light_pixels_height_1 + 1)
|
||||||
self.cell_size = tasmota.int(330 / self.w, 4, 25)
|
self.cell_size = tasmota.int(self.HTML_WIDTH / self.w, 4, 25)
|
||||||
self.cell_space = (self.cell_size <= 6) ? 1 : 2
|
self.cell_space = (self.cell_size <= 6) ? 1 : 2
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -946,14 +947,46 @@ class leds_panel
|
|||||||
webserver.content_send(
|
webserver.content_send(
|
||||||
f'<table style="width:100%;">'
|
f'<table style="width:100%;">'
|
||||||
'<tbody>'
|
'<tbody>'
|
||||||
'<fieldset style="background-color:{tasmota.webcolor(1)};"><legend style="text-align:left;"> Leds mirroring </legend>'
|
'<tr>'
|
||||||
'<iframe src="http://{ip}:{self.port}/leds" '
|
'<td>'
|
||||||
'style="color:#eaeaea; border:0px none;height:{height}px;width:340px;margin:0px 8px 0px 8px;padding:0px 0px;">'
|
'<fieldset style="background-color:{tasmota.webcolor(1)};">'
|
||||||
'</iframe>'
|
'<legend style="text-align:left;">'
|
||||||
'</fieldset>'
|
'<label>'
|
||||||
'</td>'
|
'<input type="checkbox" id="ledchk"> Leds mirroring '
|
||||||
'</tr>'
|
'</label>'
|
||||||
'</tbody></table>'
|
'</legend>'
|
||||||
|
'<iframe id="led_iframe" src="about:blank" hidden="true" '
|
||||||
|
'style="color:#eaeaea;border:0px none;height:{height}px;width:300px;margin:0px 8px 0px 8px;padding:0px 0px;">'
|
||||||
|
'</iframe>'
|
||||||
|
'</fieldset>'
|
||||||
|
'</td>'
|
||||||
|
'</tr>'
|
||||||
|
'</tbody>'
|
||||||
|
'</table>'
|
||||||
|
'<script>'
|
||||||
|
'const leduri="http://{ip}:{self.port}/leds";'
|
||||||
|
'</script>'
|
||||||
|
)
|
||||||
|
webserver.content_send(
|
||||||
|
'<script>'
|
||||||
|
'function ledm(){'
|
||||||
|
'ledchk=eb("ledchk");'
|
||||||
|
# checkbox event
|
||||||
|
'ledchk.addEventListener("change",(event)=>{'
|
||||||
|
'const iframe=document.getElementById("led_iframe");'
|
||||||
|
'if(ledchk.checked){'
|
||||||
|
# When checked, reload the original content
|
||||||
|
'iframe.src=leduri;'
|
||||||
|
'iframe.hidden=false;'
|
||||||
|
'}else{'
|
||||||
|
# When unchecked, replace iframe with itself to unload it
|
||||||
|
'iframe.src="about:blank";'
|
||||||
|
'iframe.hidden=true;'
|
||||||
|
'}'
|
||||||
|
'});'
|
||||||
|
'}'
|
||||||
|
'wl(ledm);'
|
||||||
|
'</script>'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Binary file not shown.
@ -1024,7 +1024,7 @@ class lvgl_panel
|
|||||||
'<input type="checkbox" id="lvchk"> LVGL screen mirroring '
|
'<input type="checkbox" id="lvchk"> LVGL screen mirroring '
|
||||||
'</label>'
|
'</label>'
|
||||||
'</legend>'
|
'</legend>'
|
||||||
'<iframe id="lvgl_iframe" src="about:blank" hidden="true"'
|
'<iframe id="lvgl_iframe" src="about:blank" hidden="true" '
|
||||||
'style="color:#eaeaea; border:0px none;height:{height}px;width:{width}px;margin:0px 8px 0px 8px;padding:0px 0px;">'
|
'style="color:#eaeaea; border:0px none;height:{height}px;width:{width}px;margin:0px 8px 0px 8px;padding:0px 0px;">'
|
||||||
'</iframe>'
|
'</iframe>'
|
||||||
'</fieldset>'
|
'</fieldset>'
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user