mirror of
https://github.com/esphome/esphome.git
synced 2026-11-16 01:55:59 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1edffa1813 | ||
|
|
07bbad4061 | ||
|
|
1cd99ce6d6 | ||
|
|
91db9d86d0 |
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import logger
|
||||
from esphome.components.nrf52.framework import include_west_project
|
||||
from esphome.components.zephyr import zephyr_add_prj_conf
|
||||
from esphome.config_helpers import filter_source_files_from_platform
|
||||
import esphome.config_validation as cv
|
||||
@@ -53,6 +52,9 @@ CONFIG_SCHEMA = cv.All(
|
||||
|
||||
async def to_code(config: ConfigType) -> None:
|
||||
if CORE.using_zephyr:
|
||||
# Imported here so configs for other platforms do not load the nrf52 package
|
||||
from esphome.components.nrf52.framework import include_west_project
|
||||
|
||||
zephyr_add_prj_conf("HWINFO", True)
|
||||
# gdb thread support
|
||||
zephyr_add_prj_conf("DEBUG_THREAD_INFO", True)
|
||||
|
||||
@@ -56,7 +56,6 @@ from esphome.const import (
|
||||
from esphome.core import CORE, EsphomeError, HexInt
|
||||
from esphome.core.config import BOARD_MAX_LENGTH
|
||||
from esphome.coroutine import CoroPriority, coroutine_with_priority
|
||||
from esphome.espidf import sbom
|
||||
from esphome.espidf.component import IDFComponent, generate_idf_components
|
||||
import esphome.final_validate as fv
|
||||
from esphome.helpers import copy_file_if_changed, rmtree, write_file_if_changed
|
||||
@@ -4033,6 +4032,9 @@ def copy_files():
|
||||
CORE.relative_build_path("version.txt"),
|
||||
__version__,
|
||||
)
|
||||
# Imported here: sbom loads git and urllib helpers that config validation does not need
|
||||
from esphome.espidf import sbom
|
||||
|
||||
sbom.write_manifests()
|
||||
|
||||
# Remote extra build files are fetched into the shared download cache in
|
||||
|
||||
@@ -347,26 +347,23 @@ bool FUSB302B::read_message_(PdMsg &msg, bool &is_sop) {
|
||||
bool FUSB302B::send_message(const PdMsg &msg) {
|
||||
// Register address, then the TX tokens; written in one transfer without the copy write_register() makes
|
||||
uint8_t buf[1 + 4 + 1 + 2 + PD_MAX_NUM_DATA_OBJECTS * 4 + 4];
|
||||
size_t len = 0;
|
||||
uint8_t *p = buf;
|
||||
|
||||
buf[len++] = FUSB_FIFOS;
|
||||
buf[len++] = FUSB_TX_TOKEN_SYNC1;
|
||||
buf[len++] = FUSB_TX_TOKEN_SYNC1;
|
||||
buf[len++] = FUSB_TX_TOKEN_SYNC1;
|
||||
buf[len++] = FUSB_TX_TOKEN_SYNC2;
|
||||
buf[len++] = FUSB_TX_TOKEN_PACKSYM | (msg.num_of_obj * 4 + 2);
|
||||
put_le16(buf + len, msg.get_coded_header());
|
||||
len += 2;
|
||||
for (uint8_t i = 0; i < msg.num_of_obj; i++) {
|
||||
put_le32(buf + len, msg.data_objects[i]);
|
||||
len += 4;
|
||||
}
|
||||
buf[len++] = FUSB_TX_TOKEN_JAM_CRC;
|
||||
buf[len++] = FUSB_TX_TOKEN_EOP;
|
||||
buf[len++] = FUSB_TX_TOKEN_TXOFF;
|
||||
buf[len++] = FUSB_TX_TOKEN_TXON;
|
||||
*p++ = FUSB_FIFOS;
|
||||
*p++ = FUSB_TX_TOKEN_SYNC1;
|
||||
*p++ = FUSB_TX_TOKEN_SYNC1;
|
||||
*p++ = FUSB_TX_TOKEN_SYNC1;
|
||||
*p++ = FUSB_TX_TOKEN_SYNC2;
|
||||
*p++ = FUSB_TX_TOKEN_PACKSYM | (msg.num_of_obj * 4 + 2);
|
||||
p = put_le16(p, msg.get_coded_header());
|
||||
for (uint8_t i = 0; i < msg.num_of_obj; i++)
|
||||
p = put_le32(p, msg.data_objects[i]);
|
||||
*p++ = FUSB_TX_TOKEN_JAM_CRC;
|
||||
*p++ = FUSB_TX_TOKEN_EOP;
|
||||
*p++ = FUSB_TX_TOKEN_TXOFF;
|
||||
*p++ = FUSB_TX_TOKEN_TXON;
|
||||
|
||||
i2c::ErrorCode err = this->write(buf, len);
|
||||
i2c::ErrorCode err = this->write(buf, p - buf);
|
||||
if (err != i2c::ERROR_OK) {
|
||||
ESP_LOGW(TAG, "Sending message type %u failed (error %d)", msg.type, static_cast<int>(err));
|
||||
return false;
|
||||
|
||||
@@ -291,25 +291,21 @@ bool ShellyDimmer::send_command_(uint8_t cmd, const uint8_t *const payload, uint
|
||||
}
|
||||
|
||||
size_t ShellyDimmer::frame_command_(uint8_t *data, uint8_t cmd, const uint8_t *const payload, size_t len) {
|
||||
size_t pos = 0;
|
||||
|
||||
// Generate a frame.
|
||||
data[0] = SHELLY_DIMMER_PROTO_START_BYTE;
|
||||
data[1] = ++this->seq_;
|
||||
data[2] = cmd;
|
||||
data[3] = len;
|
||||
pos += 4;
|
||||
uint8_t *p = data;
|
||||
*p++ = SHELLY_DIMMER_PROTO_START_BYTE;
|
||||
*p++ = ++this->seq_;
|
||||
*p++ = cmd;
|
||||
*p++ = len;
|
||||
|
||||
if (payload != nullptr) {
|
||||
std::memcpy(data + 4, payload, len);
|
||||
pos += len;
|
||||
std::memcpy(p, payload, len);
|
||||
p += len;
|
||||
}
|
||||
|
||||
// Calculate checksum for the payload.
|
||||
put_be16(data + pos, shelly_dimmer_checksum(data + 1, 3 + len));
|
||||
pos += 2;
|
||||
data[pos++] = SHELLY_DIMMER_PROTO_END_BYTE;
|
||||
return pos;
|
||||
// Checksum over the sequence, command, length and payload bytes
|
||||
p = put_be16(p, shelly_dimmer_checksum(data + 1, 3 + len));
|
||||
*p++ = SHELLY_DIMMER_PROTO_END_BYTE;
|
||||
return p - data;
|
||||
}
|
||||
|
||||
int ShellyDimmer::handle_byte_(uint8_t c) {
|
||||
|
||||
@@ -18,7 +18,6 @@ from pathlib import Path
|
||||
import re
|
||||
from typing import Any, NamedTuple
|
||||
from urllib.parse import urlparse
|
||||
from urllib.request import url2pathname
|
||||
|
||||
from esphome import loader, yaml_util
|
||||
from esphome.components.external_components import ExternalSource, get_sources
|
||||
@@ -201,6 +200,8 @@ def _esphome_vcs() -> _Source | None:
|
||||
if commit:
|
||||
return _Source(strip_url_credentials(url), commit)
|
||||
if "dir_info" in info and url.startswith("file:"):
|
||||
from urllib.request import url2pathname
|
||||
|
||||
# An editable or local install may be a fork or a patched clone
|
||||
if (
|
||||
source := _checkout_vcs(Path(url2pathname(urlparse(url).path)))
|
||||
|
||||
@@ -17,7 +17,6 @@ import threading
|
||||
import time
|
||||
from typing import IO, TYPE_CHECKING
|
||||
from urllib.parse import urlparse
|
||||
from urllib.request import url2pathname
|
||||
|
||||
from esphome.helpers import ProgressBar, get_usable_cpu_count, rmtree
|
||||
from esphome.net_retry import (
|
||||
@@ -1363,6 +1362,9 @@ def local_path_from_url(url: str) -> Path:
|
||||
Handles ``file:///home/me/x`` and ``file:///C:/x`` (no host), ``file://localhost/x``
|
||||
and ``file://server/share/x`` (a UNC path).
|
||||
"""
|
||||
# urllib.request loads http.client and the email parser, which config validation does not need
|
||||
from urllib.request import url2pathname
|
||||
|
||||
from esphome.core import EsphomeError
|
||||
|
||||
try:
|
||||
|
||||
@@ -26,7 +26,6 @@ from pathlib import Path, PurePosixPath
|
||||
import re
|
||||
from typing import Any
|
||||
from urllib.parse import urlsplit, urlunsplit
|
||||
from urllib.request import url2pathname
|
||||
|
||||
from esphome import git
|
||||
from esphome.core import CORE, EsphomeError, Library
|
||||
@@ -961,6 +960,8 @@ def _node_key(
|
||||
f"{scheme}:// library URL '{repository}' must be an absolute "
|
||||
f"directory path, e.g. {scheme}:///path/to/lib"
|
||||
)
|
||||
from urllib.request import url2pathname
|
||||
|
||||
path = url2pathname(url_path)
|
||||
return (name or PurePosixPath(url_path).name), "local", (path, None)
|
||||
key = str(split_result.path).strip("/").removesuffix(".git")
|
||||
|
||||
Reference in new issue
Block a user