[WARN] Static hold state in updateHold() persists across state changes #3

Open
opened 2026-05-29 22:22:38 +00:00 by david · 0 comments
Owner

Problem

DoorbellLogic::updateHold() uses static variables holdStartX and holdStartY that persist across loop iterations and state transitions.

If updateHold() is called when not in ALERTING state, stale values remain and could cause phantom hold detection when returning to ALERTING state.

Affected file: libraries/KlubhausCore/src/DoorbellLogic.cpp line ~104

Fix

Reset the static holdStart coordinates when leaving ALERTING state, or use member variables instead of static variables.

## Problem `DoorbellLogic::updateHold()` uses static variables `holdStartX` and `holdStartY` that persist across loop iterations and state transitions. If `updateHold()` is called when not in ALERTING state, stale values remain and could cause phantom hold detection when returning to ALERTING state. **Affected file:** `libraries/KlubhausCore/src/DoorbellLogic.cpp` line ~104 ## Fix Reset the static holdStart coordinates when leaving ALERTING state, or use member variables instead of static variables.
david added the warning label 2026-05-29 22:22:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: klubhaus/klubhaus-doorbell#3