Missing commit on #10715#10868
Conversation
📝 WalkthroughWalkthroughThe ChangesSEN5X findModel Refactor
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/modules/Telemetry/Sensor/SEN5XSensor.cpp (1)
62-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider char literals over magic numbers.
name[4]is compared against48,52,53— using'0','4','5'would be more self-documenting given the comment above already explains these represent model digits.♻️ Proposed refactor
switch (name[4]) { - case 48: + case '0': model = SEN50; LOG_INFO("%s: found sensor model SEN50", sensorName); foundModel = true; break; - case 52: + case '4': model = SEN54; LOG_INFO("%s: found sensor model SEN54", sensorName); foundModel = true; break; - case 53: + case '5': model = SEN55; LOG_INFO("%s: found sensor model SEN55", sensorName); foundModel = true; break; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/modules/Telemetry/Sensor/SEN5XSensor.cpp` around lines 62 - 78, In SEN5XSensor’s model-detection switch, replace the numeric ASCII comparisons on name[4] with the corresponding character literals so the intent is clearer and matches the comment about model digits. Update the switch cases in the detection logic to use self-documenting char values instead of magic numbers while keeping the existing SEN50/SEN54/SEN55 assignments and LOG_INFO messages unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/modules/Telemetry/Sensor/SEN5XSensor.cpp`:
- Around line 62-78: In SEN5XSensor’s model-detection switch, replace the
numeric ASCII comparisons on name[4] with the corresponding character literals
so the intent is clearer and matches the comment about model digits. Update the
switch cases in the detection logic to use self-documenting char values instead
of magic numbers while keeping the existing SEN50/SEN54/SEN55 assignments and
LOG_INFO messages unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1f4d4566-1509-48c0-8ae7-8e9fdce0d7e9
📒 Files selected for processing (1)
src/modules/Telemetry/Sensor/SEN5XSensor.cpp
⚡ Try this PR in the Web FlasherNote Building this pull request… the flash button, badges and supported-board |
Missing commit for #10715
Summary by CodeRabbit