Skip to content

v2.4.0 - EventQueue RAM Optimization (2026-02-24)

What Changed?

This release fixes the EventQueue item size mismatch, reducing RAM usage from 31.4% to 14.3%. The queue buffer was allocated with sizeof(event_response_t) (~370 bytes per item) but enqueue and flush both use event_t (~90 bytes per item). Correcting to sizeof(event_t) saves ~56KB.


What's New

Main Feature: Fix EventQueue Item Size — 56KB RAM Savings

What it does:

Changes the FreeRTOS queue buffer and xQueueCreateStatic item size from sizeof(event_response_t) to sizeof(event_t), matching the actual type used in enqueue() and flush().

Also adds a static_assert to prevent future regressions:

static_assert(sizeof(event_t) <= sizeof(event_response_t),
              "event_t must not exceed event_response_t (queue item size safety check)");

Why it matters:

  • event_response_t (~370 bytes) includes a 256-byte error_message[] buffer not needed in the queue
  • The queue stores event_t (~90 bytes) — the raw detection data before Layer 1 processing
  • 200-item queue: 200 × (370 − 90) ≈ 56KB of static RAM reclaimed

Installation

Quick Start

# Get the release
git checkout v2.4.0

# Build
task v2:build

# Upload
task v2:upload

# Check it works
task monitor

What's Different from the Last Version?

🐛 Fixed

  • src/v2_event_queue.cpp: queue buffer size sizeof(event_response_t)sizeof(event_t)
  • src/v2_event_queue.cpp: xQueueCreateStatic item size corrected to sizeof(event_t)
  • src/v2_event_queue.cpp: added static_assert to guard against future size mismatch

Is It Safe to Upgrade?

Backward Compatible: Yes

  • Queue behavior (capacity, enqueue/flush logic) is unchanged
  • No change in serial output format or detection behavior

Tests Passed

  • ✅ Builds without errors
  • ✅ RAM: 31.4% → 14.3% (102,880 → 46,880 bytes)

Release Details

  • Date: 2026-02-24
  • Version: v2.4.0
  • Files Changed: 1 (src/v2_event_queue.cpp)

Next Steps

Continued code quality improvements (see REFACTORING_ROADMAP.md):

  • Remove impossible range check in set_poll_count() (P2)
  • Propagate set_rtc_time() error return value (P2)
  • Remove double discard_input() call (P2)