1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 15:55:46 +00:00

Compare commits

...

14 Commits

Author SHA1 Message Date
Keith Burzinski
c4de9e87e4 Merge pull request #8438 from esphome/bump-2025.3.0
2025.3.0
2025-03-19 23:37:13 -05:00
Keith Burzinski
918924d697 Bump version to 2025.3.0 2025-03-19 20:54:32 -05:00
Keith Burzinski
e2c16b4baa Merge pull request #8436 from esphome/bump-2025.3.0b5
2025.3.0b5
2025-03-19 16:01:39 -05:00
Keith Burzinski
10a9162f48 Bump version to 2025.3.0b5 2025-03-19 14:36:04 -05:00
Kevin Ahrendt
fbc884772c [audio] Bugfix: fix flac decoding glitches by using esp-audio-libs v1.1.3 (#8431) 2025-03-19 14:36:03 -05:00
Keith Burzinski
54e3153f27 Merge pull request #8428 from esphome/bump-2025.3.0b4
2025.3.0b4
2025-03-18 15:21:15 -05:00
Keith Burzinski
c2e0a01106 Bump version to 2025.3.0b4 2025-03-18 14:43:26 -05:00
Clyde Stubbs
d2c2439b97 [core] Handle mis-typed platform name more cleanly (#8424) 2025-03-18 14:43:25 -05:00
Keith Burzinski
a8d33dd26a [docker] Bump libfreetype (#8426) 2025-03-18 14:43:25 -05:00
Keith Burzinski
da41a9204e [docker] Bump curl, git, openssh-client, libopenjp2-7, nginx-light (#8419) 2025-03-18 14:43:25 -05:00
Keith Burzinski
5c6368b6b8 Merge pull request #8415 from esphome/bump-2025.3.0b3
2025.3.0b3
2025-03-16 01:53:55 -05:00
Keith Burzinski
9bd7060f6b Bump version to 2025.3.0b3 2025-03-16 01:23:06 -05:00
Mikkel Jeppesen
fb1d178abc Added getters for graphs ymin and ymax (#8112)
Co-authored-by: guillempages <guillempages@users.noreply.github.com>
2025-03-16 01:23:06 -05:00
Clyde Stubbs
90c96a0a0f [font] Fix issues with bitmap fonts (#8407) 2025-03-16 01:23:05 -05:00
8 changed files with 69 additions and 77 deletions

View File

@@ -33,9 +33,9 @@ RUN \
python3-venv=3.11.2-1+b1 \
python3-wheel=0.38.4-2 \
iputils-ping=3:20221126-1+deb12u1 \
git=1:2.39.5-0+deb12u1 \
curl=7.88.1-10+deb12u8 \
openssh-client=1:9.2p1-2+deb12u4 \
git=1:2.39.5-0+deb12u2 \
curl=7.88.1-10+deb12u12 \
openssh-client=1:9.2p1-2+deb12u5 \
python3-cffi=1.15.1-5 \
libcairo2=1.16.0-7 \
libmagic1=1:5.44-3 \
@@ -76,7 +76,7 @@ BUILD_DEPS="
python3-dev=3.11.2-1+b1
zlib1g-dev=1:1.2.13.dfsg-1
libjpeg-dev=1:2.1.5-2
libfreetype-dev=2.12.1+dfsg-5+deb12u3
libfreetype-dev=2.12.1+dfsg-5+deb12u4
libssl-dev=3.0.15-1~deb12u1
libffi-dev=3.4.4-1
cargo=0.66.0+ds1-1
@@ -84,7 +84,7 @@ BUILD_DEPS="
"
LIB_DEPS="
libtiff6=4.5.0-6+deb12u1
libopenjp2-7=2.5.0-2
libopenjp2-7=2.5.0-2+deb12u1
"
if [ "$TARGETARCH$TARGETVARIANT" = "arm64" ]
then
@@ -160,7 +160,7 @@ RUN \
apt-get update \
# Use pinned versions so that we get updates with build caching
&& apt-get install -y --no-install-recommends \
nginx-light=1.22.1-9 \
nginx-light=1.22.1-9+deb12u1 \
&& rm -rf \
/tmp/* \
/var/{cache,log}/* \

View File

@@ -118,4 +118,4 @@ def final_validate_audio_schema(
async def to_code(config):
cg.add_library("esphome/esp-audio-libs", "1.1.2")
cg.add_library("esphome/esp-audio-libs", "1.1.3")

View File

@@ -146,6 +146,13 @@ def check_missing_glyphs(file, codepoints, warning: bool = False):
raise cv.Invalid(message)
def pt_to_px(pt):
"""
Convert a point size to pixels, rounding up to the nearest pixel
"""
return (pt + 63) // 64
def validate_font_config(config):
"""
Check for duplicate codepoints, then check that all requested codepoints actually
@@ -172,42 +179,43 @@ def validate_font_config(config):
)
# Make setpoints and glyphspoints disjoint
setpoints.difference_update(glyphspoints)
if fileconf[CONF_TYPE] == TYPE_LOCAL_BITMAP:
if any(x >= 256 for x in setpoints.copy().union(glyphspoints)):
raise cv.Invalid("Codepoints in bitmap fonts must be in the range 0-255")
else:
# for TT fonts, check that glyphs are actually present
# Check extras against their own font, exclude from parent font codepoints
for extra in config[CONF_EXTRAS]:
points = {ord(x) for x in flatten(extra[CONF_GLYPHS])}
glyphspoints.difference_update(points)
setpoints.difference_update(points)
check_missing_glyphs(extra[CONF_FILE], points)
# check that glyphs are actually present
# Check extras against their own font, exclude from parent font codepoints
for extra in config[CONF_EXTRAS]:
points = {ord(x) for x in flatten(extra[CONF_GLYPHS])}
glyphspoints.difference_update(points)
setpoints.difference_update(points)
check_missing_glyphs(extra[CONF_FILE], points)
# A named glyph that can't be provided is an error
# A named glyph that can't be provided is an error
check_missing_glyphs(fileconf, glyphspoints)
# A missing glyph from a set is a warning.
if not config[CONF_IGNORE_MISSING_GLYPHS]:
check_missing_glyphs(fileconf, setpoints, warning=True)
check_missing_glyphs(fileconf, glyphspoints)
# A missing glyph from a set is a warning.
if not config[CONF_IGNORE_MISSING_GLYPHS]:
check_missing_glyphs(fileconf, setpoints, warning=True)
# Populate the default after the above checks so that use of the default doesn't trigger errors
font = FONT_CACHE[fileconf]
if not config[CONF_GLYPHS] and not config[CONF_GLYPHSETS]:
if fileconf[CONF_TYPE] == TYPE_LOCAL_BITMAP:
config[CONF_GLYPHS] = [DEFAULT_GLYPHS]
else:
# set a default glyphset, intersected with what the font actually offers
font = FONT_CACHE[fileconf]
config[CONF_GLYPHS] = [
chr(x)
for x in glyphsets.unicodes_per_glyphset(DEFAULT_GLYPHSET)
if font.get_char_index(x) != 0
]
# set a default glyphset, intersected with what the font actually offers
config[CONF_GLYPHS] = [
chr(x)
for x in glyphsets.unicodes_per_glyphset(DEFAULT_GLYPHSET)
if font.get_char_index(x) != 0
]
if config[CONF_FILE][CONF_TYPE] == TYPE_LOCAL_BITMAP:
if CONF_SIZE in config:
if font.has_fixed_sizes:
sizes = [pt_to_px(x.size) for x in font.available_sizes]
if not sizes:
raise cv.Invalid(
"Size is not a valid option for bitmap fonts, which are inherently fixed size"
f"Font {FontCache.get_name(fileconf)} has no available sizes"
)
if CONF_SIZE not in config:
config[CONF_SIZE] = sizes[0]
elif config[CONF_SIZE] not in sizes:
sizes = ", ".join(str(x) for x in sizes)
raise cv.Invalid(
f"Font {FontCache.get_name(fileconf)} only has size{'s' if len(sizes) != 1 else ''} {sizes} available"
)
elif CONF_SIZE not in config:
config[CONF_SIZE] = 20
@@ -215,14 +223,7 @@ def validate_font_config(config):
return config
FONT_EXTENSIONS = (".ttf", ".woff", ".otf")
BITMAP_EXTENSIONS = (".bdf", ".pcf")
def validate_bitmap_file(value):
if not any(map(value.lower().endswith, BITMAP_EXTENSIONS)):
raise cv.Invalid(f"Only {', '.join(BITMAP_EXTENSIONS)} files are supported.")
return CORE.relative_config_path(cv.file_(value))
FONT_EXTENSIONS = (".ttf", ".woff", ".otf", "bdf", ".pcf")
def validate_truetype_file(value):
@@ -246,7 +247,6 @@ def add_local_file(value):
TYPE_LOCAL = "local"
TYPE_LOCAL_BITMAP = "local_bitmap"
TYPE_GFONTS = "gfonts"
TYPE_WEB = "web"
LOCAL_SCHEMA = cv.All(
@@ -258,15 +258,6 @@ LOCAL_SCHEMA = cv.All(
add_local_file,
)
LOCAL_BITMAP_SCHEMA = cv.All(
cv.Schema(
{
cv.Required(CONF_PATH): validate_bitmap_file,
}
),
add_local_file,
)
FULLPATH_SCHEMA = cv.maybe_simple_value(
{cv.Required(CONF_PATH): cv.string}, key=CONF_PATH
)
@@ -403,15 +394,6 @@ def validate_file_shorthand(value):
}
)
extension = Path(value).suffix
if extension in BITMAP_EXTENSIONS:
return font_file_schema(
{
CONF_TYPE: TYPE_LOCAL_BITMAP,
CONF_PATH: value,
}
)
return font_file_schema(
{
CONF_TYPE: TYPE_LOCAL,
@@ -424,7 +406,6 @@ TYPED_FILE_SCHEMA = cv.typed_schema(
{
TYPE_LOCAL: LOCAL_SCHEMA,
TYPE_GFONTS: GFONTS_SCHEMA,
TYPE_LOCAL_BITMAP: LOCAL_BITMAP_SCHEMA,
TYPE_WEB: WEB_FONT_SCHEMA,
}
)
@@ -522,11 +503,13 @@ async def to_code(config):
bpp = config[CONF_BPP]
mode = ft_pixel_mode_grays
scale = 256 // (1 << bpp)
size = config[CONF_SIZE]
# create the data array for all glyphs
for codepoint in codepoints:
font = point_font_map[codepoint]
if not font.has_fixed_sizes:
font.set_pixel_sizes(config[CONF_SIZE], 0)
format = font.get_format().decode("utf-8")
if format != "PCF":
font.set_pixel_sizes(size, 0)
font.load_char(codepoint)
font.glyph.render(mode)
width = font.glyph.bitmap.width
@@ -550,17 +533,17 @@ async def to_code(config):
if pixel & (1 << (bpp - bit_num - 1)):
glyph_data[pos // 8] |= 0x80 >> (pos % 8)
pos += 1
ascender = font.size.ascender // 64
ascender = pt_to_px(font.size.ascender)
if ascender == 0:
if font.has_fixed_sizes:
ascender = font.available_sizes[0].height
ascender = size
else:
_LOGGER.error(
"Unable to determine ascender of font %s", config[CONF_FILE]
)
glyph_args[codepoint] = GlyphInfo(
len(data),
font.glyph.metrics.horiAdvance // 64,
pt_to_px(font.glyph.metrics.horiAdvance),
font.glyph.bitmap_left,
ascender - font.glyph.bitmap_top,
width,
@@ -599,11 +582,11 @@ async def to_code(config):
glyphs = cg.static_const_array(config[CONF_RAW_GLYPH_ID], glyph_initializer)
font_height = base_font.size.height // 64
ascender = base_font.size.ascender // 64
font_height = pt_to_px(base_font.size.height)
ascender = pt_to_px(base_font.size.ascender)
if font_height == 0:
if base_font.has_fixed_sizes:
font_height = base_font.available_sizes[0].height
font_height = size
ascender = font_height
else:
_LOGGER.error("Unable to determine height of font %s", config[CONF_FILE])

View File

@@ -132,6 +132,10 @@ void Graph::draw(Display *buff, uint16_t x_offset, uint16_t y_offset, Color colo
yrange = ymax - ymin;
}
// Store graph limts
this->graph_limit_max_ = ymax;
this->graph_limit_min_ = ymin;
/// Draw grid
if (!std::isnan(this->gridspacing_y_)) {
for (int y = yn; y <= ym; y++) {

View File

@@ -161,11 +161,15 @@ class Graph : public Component {
uint32_t get_duration() { return duration_; }
uint32_t get_width() { return width_; }
uint32_t get_height() { return height_; }
float get_graph_limit_min() { return graph_limit_min_; }
float get_graph_limit_max() { return graph_limit_max_; }
protected:
uint32_t duration_; /// in seconds
uint32_t width_; /// in pixels
uint32_t height_; /// in pixels
float graph_limit_min_{NAN};
float graph_limit_max_{NAN};
float min_value_{NAN};
float max_value_{NAN};
float min_range_{1.0};

View File

@@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2025.3.0b2"
__version__ = "2025.3.0"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
VALID_SUBSTITUTIONS_CHARACTERS = (

View File

@@ -189,10 +189,11 @@ def _is_target_platform(name):
from esphome.loader import get_component
try:
if get_component(name, True).is_target_platform:
return True
return get_component(name, True).is_target_platform
except KeyError:
pass
except ImportError:
pass
return False

View File

@@ -128,7 +128,7 @@ lib_deps =
DNSServer ; captive_portal (Arduino built-in)
esphome/ESP32-audioI2S@2.0.7 ; i2s_audio
droscy/esp_wireguard@0.4.2 ; wireguard
esphome/esp-audio-libs@1.1.2 ; audio
esphome/esp-audio-libs@1.1.3 ; audio
build_flags =
${common:arduino.build_flags}
@@ -149,7 +149,7 @@ lib_deps =
${common:idf.lib_deps}
droscy/esp_wireguard@0.4.2 ; wireguard
kahrendt/ESPMicroSpeechFeatures@1.1.0 ; micro_wake_word
esphome/esp-audio-libs@1.1.2 ; audio
esphome/esp-audio-libs@1.1.3 ; audio
build_flags =
${common:idf.build_flags}
-Wno-nonnull-compare