Use DEBUG guard for asserts instead of custom define

Integration tests already pass -DDEBUG, so no custom define needed.
This commit is contained in:
J. Nick Koston
2026-02-11 11:30:51 -06:00
parent 93ff39709a
commit e63308aa33
3 changed files with 2 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ class ProtoVarInt {
/// Parse a varint from buffer. consumed must be a valid pointer (not null).
static optional<ProtoVarInt> 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

View File

@@ -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

View File

@@ -1,7 +1,4 @@
esphome:
platformio_options:
build_flags:
- -DESPHOME_DEBUG_API
on_boot:
then:
- wait_until: