Skip to content

Missing commit on #10715#10868

Merged
caveman99 merged 2 commits into
meshtastic:developfrom
fablabbcn:bugfix/detection-on-0x69-address-missing-commit
Jul 3, 2026
Merged

Missing commit on #10715#10868
caveman99 merged 2 commits into
meshtastic:developfrom
fablabbcn:bugfix/detection-on-0x69-address-missing-commit

Conversation

@oscgonfer

@oscgonfer oscgonfer commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Missing commit for #10715

Summary by CodeRabbit

  • Bug Fixes
    • Improved sensor model detection during startup, making device recognition more reliable.
    • Reduced the chance of detection failures when the sensor name cannot be read immediately.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The findModel() method in SEN5XSensor.cpp was refactored to use a foundModel boolean variable, tracking detection success and returning it uniformly at the end of the function rather than returning true/false directly from within the switch/error paths. Two whitespace-only blank line changes were also applied.

Changes

SEN5X findModel Refactor

Layer / File(s) Summary
findModel foundModel flag and probe spacing
src/modules/Telemetry/Sensor/SEN5XSensor.cpp
findModel() now initializes foundModel to false, sets it true in recognized SEN50/SEN54/SEN55 switch cases, and returns foundModel uniformly instead of returning directly; two blank-line whitespace changes applied near probe().

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A flag named foundModel, small and true,
Hops through the switch to find what's new,
SEN50, SEN54, SEN55 in sight,
One tidy return sets the logic right,
This bunny thumps approval, snug and light. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only says it's a missing commit for #10715 and omits the required template sections and attestations. Replace the placeholder text with the template sections, include what changed, testing details, affected devices, and bug-fix references if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is related to the PR's purpose as a missing commit from #10715, but it doesn't clearly describe the sensor detection fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/modules/Telemetry/Sensor/SEN5XSensor.cpp (1)

62-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider char literals over magic numbers.

name[4] is compared against 48, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b6b4cb and 8ef2923.

📒 Files selected for processing (1)
  • src/modules/Telemetry/Sensor/SEN5XSensor.cpp

@caveman99 caveman99 merged commit 84b1af0 into meshtastic:develop Jul 3, 2026
4 of 6 checks passed
@oscgonfer oscgonfer deleted the bugfix/detection-on-0x69-address-missing-commit branch July 3, 2026 14:09
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants