Skip to content

v2.2.2 - Phase 1: RTC Always-Enabled & Timestamp Refactoring (2026-01-01)

What Changed?

This release implements Phase 1 of the v2 development roadmap by consolidating RTC as a permanent v2 standard feature. The ESP32 has built-in RTC hardware, so making it always-enabled simplifies the codebase and eliminates unnecessary conditional compilation. The ENABLE_TIMESTAMP flag is preserved as user-selectable to control whether timing fields (uptime_ms, timedelta_us) are included in detection events, supporting minimal overhead deployments.


What's New

Phase 1: RTC Consolidation & Timestamp Strategy

What it does:

  • RTC (Real-Time Clock) is now permanently enabled in v2 firmware as an ESP32 built-in standard feature
  • All 11 files with #if ENABLE_RTC conditional compilation have been refactored to remove these gates
  • ENABLE_TIMESTAMP flag remains user-selectable to include/exclude timing fields (uptime_ms, timedelta_us) in event output
  • Zero functional changes to user-facing behavior - timestamp output and RTC functionality remain identical

How to use it: No changes needed! The build process remains the same:

task v2:build    # Build v2 firmware
task v2:upload   # Upload to ESP32
task monitor     # Verify functionality

RTC time management commands (GET_RTC_TIME, SET_RTC_TIME) work exactly as before, but now they're always available in v2 without conditional compilation overhead.


Installation

Quick Start

# Get the release
git checkout v2.2.2

# Build v2 firmware
task v2:build

# Upload to ESP32
task v2:upload

# Verify it works
task monitor

What's Different from the Last Version?

βœ… Added

  • Phase 1 implementation: RTC always-enabled as v2 standard feature
  • Strategy documentation: ENABLE_TIMESTAMP preserved as user-selectable flag
  • Updated CLAUDE.md: RTC moved to "Always-Present Fields" section
  • Updated REFACTORING_ROADMAP.md: Phase 1 status changed from β³θ¨ˆη”»δΈ­to πŸš€ι€²θ‘ŒδΈ­

πŸ”§ Changed

  • RTC consolidation: Removed 11 instances of #if ENABLE_RTC / #endif from:
  • include/config.h (flag definition section)
  • include/v2_event_queue.h (2 locations: event_t and device_response_t structs)
  • include/v2_command.h (method declarations)
  • src/v2_command.cpp (include + implementation section)
  • src/v2_device_response.cpp (include + device_get_timestamp() + from_event())
  • src/v2_event_queue.cpp (event_response_ok() function)
  • src/v2_detection_processor.cpp (add_rtc_data() function)
  • src/v2_main.cpp (rtc_init() call in setup())
  • src/command/rtc.cpp (file header + handler wrappers)

  • Documentation updates:

  • Timestamp Tracking: Updated Phase 3 description to clarify v2+ RTC status
  • Sensor Data & Output Formatting: Updated detected_us field documentation
  • Command Class: RTC marked as always available in v2+

πŸ› Fixed

  • Removed build-time complexity from RTC feature toggling
  • Eliminated potential for mismatched RTC configurations across translation units
  • Simplified conditional compilation logic (RTC no longer needs configuration gates)

Is It Safe to Upgrade?

Backward Compatible: Yes - 100% compatible with v2.2.1

  • No functional changes from v2.2.1
  • Same memory footprint: RAM 31.4%, Flash 27.8%
  • RTC functionality unchanged - same output format and command behavior
  • ENABLE_TIMESTAMP flag still user-selectable
  • All APIs and command interfaces remain identical

Tests Passed

  • βœ… Full v2 build: task v2:build - SUCCESS
  • βœ… Memory verification: RAM 31.4% (102,816 / 327,680 bytes), Flash 27.8% (363,773 / 1,310,720 bytes)
  • βœ… RTC consolidation: 11 files processed, #if ENABLE_RTC removed
  • βœ… ENABLE_TIMESTAMP preserved: User-selectable flag functionality intact
  • βœ… Pre-commit hooks: All checks passed (formatting, JSON schemas, merge conflicts)

Release Details

  • Date: 2026-01-01
  • Version: v2.2.2
  • Commits: 9 (7 refactor + 2 docs)
  • Files Changed: 13 total
  • 11 files: #if ENABLE_RTC removal
  • 2 files: Documentation updates (CLAUDE.md, REFACTORING_ROADMAP.md)
  • Build Status: βœ… Success
  • Branch: main (v2 development)

Next Steps

Phase 2: Dual-Core Separation (v2.3.0 planned)

With RTC consolidation complete and the codebase further simplified, the next major phase will implement multi-threading using FreeRTOS:

  • Separate detection loop (Core 1) from utility operations (Core 2)
  • Eliminate detection loss during serial transmission and command processing
  • Improve timestamp precision from Β±1-2ms to Β±100-500ΞΌs
  • Target: 10-20x improvement in detection timestamp accuracy