v2.4.1 - Remove Impossible Range Check in set_poll_count() (2026-02-24)¶
What Changed?¶
This release removes a dead range check in Command::set_poll_count().
The condition count > 65535 was always false because count is a uint16_t (max value 65535).
Only the meaningful lower-bound check (count < 1) remains.
What's New¶
Main Feature: Remove Dead count > 65535 Check¶
What it does:
Removes the impossible upper-bound check in set_poll_count():
// Before
bool Command::set_poll_count(uint16_t count) {
if (count < 1 || count > 65535) { // count > 65535 is always false
return false;
}
...
}
// After
bool Command::set_poll_count(uint16_t count) {
if (count < 1) {
return false;
}
...
}
Why it matters:
uint16_thas a maximum value of 65535 by definition — the upper-bound check can never be true- The lower-bound check
count < 1(reject zero) remains valid and is kept - Input validation is already handled in
poll_count.cppbefore calling this function
Installation¶
Quick Start¶
# Get the release
git checkout 2.4.1
# Build
task v2:build
# Upload
task v2:upload
# Check it works
task monitor
What's Different from the Last Version?¶
🔧 Changed¶
src/v2_command.cpp: removedcount > 65535dead check fromset_poll_count()src/v2_command.cpp: updated docstring to reflect actual validation (count >= 1)
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- No behavior change — the removed condition was never true
set_poll_count(0)still returnsfalse(lower-bound check preserved)
Tests Passed¶
- ✅ Builds without errors
Release Details¶
- Date: 2026-02-24
- Version: v2.4.1
- Files Changed: 1 (
src/v2_command.cpp)
Next Steps¶
Continued code quality improvements (see REFACTORING_ROADMAP.md):
- Propagate
set_rtc_time()error return value (P2) - Remove double
discard_input()call (P2) - Add
V2_prefix to include guards (P2) - Fix
@filedocstrings to match actual filenames (P2)