Skip to content

v1.6.5 - Debug Mode Refactoring (2025-11-19)

What Changed?

This release simplifies the debug detection mode system by removing legacy modes and consolidating to two clear modes: Production (mode 0) and Periodic (mode 1). The Periodic mode now uses a configurable test interval that can be adjusted dynamically via the SET_INTERVAL command, making bench testing more flexible.


What's New

Main Feature: Configurable Detection Interval for Periodic Mode

What it does: Mode 1 (Periodic) now allows runtime configuration of the detection reporting interval. Instead of a fixed 5-second interval, users can adjust the interval dynamically using the SET_INTERVAL text command while the firmware is running.

How to use it:

# Connect to device with periodic mode enabled
task monitor

# Set interval to 2 seconds
SET_INTERVAL 2000

# Verify the setting
STATUS

# Set to immediate reporting (no interval)
SET_INTERVAL 0

# Reset to 5 seconds
SET_INTERVAL 5000

Code example:

// Mode 1 now uses dynamic interval from config
uint16_t interval_ms = config_get_interval();  // Gets runtime value
if (currentTime - lastDetectionTime >= interval_ms) {
  // Report detection
}

Installation

Quick Start

# Get the release
git checkout v1.6.5

# Build
task build

# Upload
task upload

# Check it works
task monitor

What's Different from the Last Version?

✅ Added

  • Configurable detection interval for Mode 1 via SET_INTERVAL command (0-60000ms)

🔧 Changed

  • Consolidated debug modes: 4 modes → 2 modes
  • Removed Mode 1 (fixed pattern)
  • Removed Mode 3 (serial command control)
  • Renamed Mode 2 to Mode 1 (Periodic mode)
  • Mode 1 now uses dynamic interval instead of hardcoded 5-second value
  • Simplified cosmic_detector.cpp (~65 lines removed)
  • Updated build profiles to use Mode 1 for debug builds

🗑️ Removed

  • DEBUG_DETECTION_MODE=1 (fixed pattern mode)
  • DEBUG_DETECTION_MODE=3 (serial command mode)
  • DEBUG_DETECTION_INTERVAL_MS unused macro

Mode Structure

Mode Name Behavior Use Case
0 Production Direct GPIO detection, immediate reporting Production deployments
1 Periodic GPIO detection with configurable interval Bench testing, event processing verification

Is It Safe to Upgrade?

Backward Compatible: Yes

  • Production mode (0) unchanged - direct GPIO detection with no interval
  • Periodic mode (1) replaces deprecated modes 1 & 3
  • Text command interface is the recommended way to control periodic behavior
  • All existing serial output formats unchanged

Tests Passed

  • ✅ Builds without errors (all profiles: release, debug, dev)
  • ✅ Mode 0 (Production) GPIO detection working correctly
  • ✅ Mode 1 (Periodic) detects GPIO signals with configurable interval
  • ✅ SET_INTERVAL command updates interval at runtime
  • ✅ STATUS command displays current interval setting
  • ✅ Legacy modes cleanly removed with no regressions

Release Details

  • Date: 2025-11-19
  • Version: v1.6.5
  • Files Changed: 6 files (cosmic_detector.cpp, config.h, platformio.ini, runtime_config.cpp, CLAUDE.md, docs/progress)
  • Commits:
  • d16bb78 - Remove DEBUG_DETECTION_MODE 1 (fixed pattern)
  • 5f9ef77 - Remove DEBUG_DETECTION_MODE 3 (serial command control)
  • 4e49090 - Change DEBUG_DETECTION_MODE 2 to GPIO detection with test interval
  • dc38d7a - Rename DEBUG_DETECTION_MODE 2 to 1 (Periodic mode)
  • b5b2ce3 - Make Mode 1 interval configurable via SET_INTERVAL command
  • 4e8324c - Remove unused DEBUG_DETECTION_INTERVAL_MS macro

Next Steps

  • Consider adding SET_INTERVAL to quick-reference command guide
  • Test Mode 1 with various intervals in real-world bench scenarios
  • Document updated debug modes in next major release notes if applicable
  • Monitor Mode 1 performance in field deployments