mirror of
https://github.com/esphome/esphome.git
synced 2024-11-08 09:40:53 +01:00
commit
4fd79fee2c
@ -18,8 +18,8 @@ from esphome.core import coroutine_with_priority
|
|||||||
IS_PLATFORM_COMPONENT = True
|
IS_PLATFORM_COMPONENT = True
|
||||||
|
|
||||||
display_ns = cg.esphome_ns.namespace("display")
|
display_ns = cg.esphome_ns.namespace("display")
|
||||||
Display = display_ns.class_("Display")
|
Display = display_ns.class_("Display", cg.PollingComponent)
|
||||||
DisplayBuffer = display_ns.class_("DisplayBuffer")
|
DisplayBuffer = display_ns.class_("DisplayBuffer", Display)
|
||||||
DisplayPage = display_ns.class_("DisplayPage")
|
DisplayPage = display_ns.class_("DisplayPage")
|
||||||
DisplayPagePtr = DisplayPage.operator("ptr")
|
DisplayPagePtr = DisplayPage.operator("ptr")
|
||||||
DisplayRef = Display.operator("ref")
|
DisplayRef = Display.operator("ref")
|
||||||
|
@ -64,6 +64,9 @@ void TT21100Touchscreen::setup() {
|
|||||||
// Update display dimensions if they were updated during display setup
|
// Update display dimensions if they were updated during display setup
|
||||||
this->x_raw_max_ = this->get_width_();
|
this->x_raw_max_ = this->get_width_();
|
||||||
this->y_raw_max_ = this->get_height_();
|
this->y_raw_max_ = this->get_height_();
|
||||||
|
|
||||||
|
// Trigger initial read to activate the interrupt
|
||||||
|
this->store_.touched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TT21100Touchscreen::update_touches() {
|
void TT21100Touchscreen::update_touches() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2023.12.3"
|
__version__ = "2023.12.4"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
@ -31,6 +31,7 @@ class PingStatus:
|
|||||||
while not dashboard.stop_event.is_set():
|
while not dashboard.stop_event.is_set():
|
||||||
# Only ping if the dashboard is open
|
# Only ping if the dashboard is open
|
||||||
await dashboard.ping_request.wait()
|
await dashboard.ping_request.wait()
|
||||||
|
dashboard.ping_request.clear()
|
||||||
current_entries = dashboard.entries.async_all()
|
current_entries = dashboard.entries.async_all()
|
||||||
to_ping: list[DashboardEntry] = [
|
to_ping: list[DashboardEntry] = [
|
||||||
entry for entry in current_entries if entry.address is not None
|
entry for entry in current_entries if entry.address is not None
|
||||||
|
@ -30,6 +30,7 @@ def write_file(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
tmp_filename = ""
|
tmp_filename = ""
|
||||||
|
missing_fchmod = False
|
||||||
try:
|
try:
|
||||||
# Modern versions of Python tempfile create this file with mode 0o600
|
# Modern versions of Python tempfile create this file with mode 0o600
|
||||||
with tempfile.NamedTemporaryFile(
|
with tempfile.NamedTemporaryFile(
|
||||||
@ -38,8 +39,15 @@ def write_file(
|
|||||||
fdesc.write(utf8_data)
|
fdesc.write(utf8_data)
|
||||||
tmp_filename = fdesc.name
|
tmp_filename = fdesc.name
|
||||||
if not private:
|
if not private:
|
||||||
os.fchmod(fdesc.fileno(), 0o644)
|
try:
|
||||||
|
os.fchmod(fdesc.fileno(), 0o644)
|
||||||
|
except AttributeError:
|
||||||
|
# os.fchmod is not available on Windows
|
||||||
|
missing_fchmod = True
|
||||||
|
|
||||||
os.replace(tmp_filename, filename)
|
os.replace(tmp_filename, filename)
|
||||||
|
if missing_fchmod:
|
||||||
|
os.chmod(filename, 0o644)
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(tmp_filename):
|
if os.path.exists(tmp_filename):
|
||||||
try:
|
try:
|
||||||
|
@ -13,7 +13,7 @@ def test_write_utf8_file(tmp_path: Path) -> None:
|
|||||||
assert tmp_path.joinpath("foo.txt").read_text() == "foo"
|
assert tmp_path.joinpath("foo.txt").read_text() == "foo"
|
||||||
|
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
write_utf8_file(Path("/not-writable"), "bar")
|
write_utf8_file(Path("/dev/not-writable"), "bar")
|
||||||
|
|
||||||
|
|
||||||
def test_write_file(tmp_path: Path) -> None:
|
def test_write_file(tmp_path: Path) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user