From e63308aa33f60bd849b179ca964618cc8506dc7f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 11 Feb 2026 11:30:51 -0600 Subject: [PATCH] Use DEBUG guard for asserts instead of custom define Integration tests already pass -DDEBUG, so no custom define needed. --- esphome/components/api/proto.h | 4 ++-- esphome/core/defines.h | 1 - tests/components/api/common-base.yaml | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index 9666b7e9ff..be87dac6f6 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -105,7 +105,7 @@ class ProtoVarInt { /// Parse a varint from buffer. consumed must be a valid pointer (not null). static optional parse(const uint8_t *buffer, uint32_t len, uint32_t *consumed) { -#ifdef ESPHOME_DEBUG_API +#ifdef DEBUG assert(consumed != nullptr); #endif if (len == 0) @@ -922,7 +922,7 @@ inline void ProtoWriteBuffer::encode_message(uint32_t field_id, const ProtoMessa // Now encode the message content - it will append to the buffer value.encode(*this); -#ifdef ESPHOME_DEBUG_API +#ifdef DEBUG // Verify that the encoded size matches what we calculated assert(this->buffer_->size() == begin + varint_length_bytes + msg_length_bytes); #endif diff --git a/esphome/core/defines.h b/esphome/core/defines.h index a2a967985e..0c888933bf 100644 --- a/esphome/core/defines.h +++ b/esphome/core/defines.h @@ -14,7 +14,6 @@ #define ESPHOME_PROJECT_VERSION_30 "v2" #define ESPHOME_VARIANT "ESP32" #define ESPHOME_DEBUG_SCHEDULER -#define ESPHOME_DEBUG_API // Default threading model for static analysis (ESP32 is multi-threaded with atomics) #define ESPHOME_THREAD_MULTI_ATOMICS diff --git a/tests/components/api/common-base.yaml b/tests/components/api/common-base.yaml index c24045b28a..c766b61b13 100644 --- a/tests/components/api/common-base.yaml +++ b/tests/components/api/common-base.yaml @@ -1,7 +1,4 @@ esphome: - platformio_options: - build_flags: - - -DESPHOME_DEBUG_API on_boot: then: - wait_until: