Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Stripped PIR and Fingerprint code sections#3

Closed
alexanderlindquis wants to merge 3 commits into
mainfrom
stripped-code
Closed

Stripped PIR and Fingerprint code sections#3
alexanderlindquis wants to merge 3 commits into
mainfrom
stripped-code

Conversation

@alexanderlindquis

@alexanderlindquis alexanderlindquis commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Removed fingerprint sensor support and related telemetry and error fields.
    • Removed PIR motion sensor support and associated motion readings.
    • Simplified telemetry to send a smaller payload and reduce topic-specific handling.
  • Style
    • Added a small joystick-read debug print to runtime logs.

@coderabbitai

coderabbitai Bot commented Nov 14, 2025

Copy link
Copy Markdown

Walkthrough

This PR removes fingerprint and PIR sensor support (headers and implementations), updates micro-ROS APIs and calls to drop fingerprint/PIR data, and adds two new subscription callbacks for light and lidar.

Changes

Cohort / File(s) Summary
Removed Fingerprint Header
MicrocontrollerCode/include/FingerprintFunctions.h
Deleted header and all public declarations for fingerprint functions (getFingerprintID(), setupFingerprint(), loopFingerprint()), includes, and include guards.
Removed PIR Header
MicrocontrollerCode/include/PIRFunctions.h
Deleted header and public PIR API (macros PIR_0PIR_3, PIRSensors struct, setupPIR(), readPIRSingle(), readAllPIR()), includes, and guards.
Removed Fingerprint Implementation
MicrocontrollerCode/src/FingerprintFunctions.cpp
Removed Adafruit_Fingerprint integration, global sensor instance(s), and functions: getFingerprintID(), setupFingerprint(), loopFingerprint().
Removed PIR Implementation
MicrocontrollerCode/src/PIRFunctions.cpp
Removed PIR sensor setup/read implementations (setupPIR(), readPIRSingle(), readAllPIR()).
micro-ROS API & Impl Changes
MicrocontrollerCode/include/microRosFunctions.h, MicrocontrollerCode/src/microRosFunctions.cpp
Updated signatures: microRosSetup() drops fingerprintTopicName; transmitMsg() drops PIRSensors parameter (and ROS_DEBUG overload now accepts thetaRef, omegaRef); publishError() drops fingerprint_error; removed publishFingerprint() and fingerprint publisher; added light_subscription_callback and lidar_subscription_callback. Adjusted publisher/entity creation and teardown accordingly.
Main Loop / App Changes
MicrocontrollerCode/src/main.cpp
Removed includes, setup calls, variables, timing, reads, and publishes related to fingerprint and PIR; updated calls to publishError() and transmitMsg() to match new signatures; removed fingerprint error tracking and PIR in transmit path.
Minor Edit
MicrocontrollerCode/src/JoystickFunctions.cpp
Inserted a Serial.println(...) inside joystickToDisplacement() after reading joystick values (no API changes).

Sequence Diagram(s)

sequenceDiagram
    participant Main as main.cpp
    participant MicroROS as microRosFunctions
    participant ROS as ROS network
    rect rgba(120,200,255,0.12)
    Note left of Main: Data collection (fingerprint/PIR removed)
    Main->>MicroROS: transmitMsg(thetaRef, omegaRef, usData, fanSpeeds, imuData)
    MicroROS->>ROS: publish sensor message (US, Fans, IMU, refs)
    ROS-->>MicroROS: incoming subscription msg (fan)
    end
    rect rgba(200,240,200,0.12)
    Note left of MicroROS: New subscriptions
    ROS-->>MicroROS: incoming subscription msg (light)
    MicroROS->>Main: light_subscription_callback (static handler)
    ROS-->>MicroROS: incoming subscription msg (lidar)
    MicroROS->>Main: lidar_subscription_callback (static handler)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus review on:
    • Ensure all callers of transmitMsg() and publishError() were updated to new signatures (especially main.cpp and any tests).
    • Verify removal of fingerprint/PIR publishers didn't leave dangling references or uninitialized entities in microRosFunctions.cpp.
    • Confirm new subscription callbacks (light_subscription_callback, lidar_subscription_callback) are implemented and registered.
    • Check the inserted Serial.println in JoystickFunctions.cpp for unintended debug output or performance implications.

Poem

🐰 I hop through diffs with whiskers bright,
Fingerprints and PIRs take flight.
New ear-tuned callbacks hear light and lidar song,
I twirl in code, the changes swift and strong.
Tiny paws applaud — onward we hop along.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main changes: removal of PIR and Fingerprint code sections across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch stripped-code

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8125328 and 8c83224.

📒 Files selected for processing (4)
  • MicrocontrollerCode/include/microRosFunctions.h (2 hunks)
  • MicrocontrollerCode/src/JoystickFunctions.cpp (1 hunks)
  • MicrocontrollerCode/src/main.cpp (2 hunks)
  • MicrocontrollerCode/src/microRosFunctions.cpp (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • MicrocontrollerCode/src/JoystickFunctions.cpp
🧰 Additional context used
🧬 Code graph analysis (2)
MicrocontrollerCode/src/main.cpp (1)
MicrocontrollerCode/src/microRosFunctions.cpp (6)
  • publishError (318-324)
  • publishError (318-318)
  • transmitMsg (352-377)
  • transmitMsg (352-352)
  • transmitMsg (383-390)
  • transmitMsg (383-383)
MicrocontrollerCode/include/microRosFunctions.h (1)
MicrocontrollerCode/src/microRosFunctions.cpp (14)
  • microRosSetup (224-315)
  • microRosSetup (224-224)
  • create_entities (89-177)
  • create_entities (89-89)
  • destroy_entities (179-191)
  • destroy_entities (179-179)
  • microRosTick (193-219)
  • microRosTick (193-193)
  • transmitMsg (352-377)
  • transmitMsg (352-352)
  • transmitMsg (383-390)
  • transmitMsg (383-383)
  • publishError (318-324)
  • publishError (318-318)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
MicrocontrollerCode/src/main.cpp (1)

71-82: Changes look good and consistent with refactored APIs.

The function calls to publishError (lines 73, 122) and transmitMsg (line 118) have been correctly updated to match the new signatures that removed fingerprint and PIR sensor parameters. The debug output (lines 79-81) has also been appropriately updated.

Also applies to: 118-123


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
MicrocontrollerCode/include/microRosFunctions.h (1)

16-23: Remove stale parameter documentation.

The comment at line 21 still references @param fingerprintTopicName which no longer exists in the function signature. This documentation should be removed to match the updated signature.

Apply this diff:

 #ifdef ROS
 /**
  * Sets up microROS communication
  * @param timerValue The transmission period
  * @param nodeName The name of the node
  * @param sensorTopicName The name of the topic
- * @param fingerprintTopicName
  */
 boolean microRosSetup(unsigned int timerValue, const char *nodeName, const char *sensorTopicName);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2fa4618 and 8125328.

📒 Files selected for processing (8)
  • MicrocontrollerCode/include/FingerprintFunctions.h (0 hunks)
  • MicrocontrollerCode/include/PIRFunctions.h (0 hunks)
  • MicrocontrollerCode/include/microRosFunctions.h (1 hunks)
  • MicrocontrollerCode/src/FingerprintFunctions.cpp (0 hunks)
  • MicrocontrollerCode/src/JoystickFunctions.cpp (1 hunks)
  • MicrocontrollerCode/src/PIRFunctions.cpp (0 hunks)
  • MicrocontrollerCode/src/main.cpp (2 hunks)
  • MicrocontrollerCode/src/microRosFunctions.cpp (0 hunks)
💤 Files with no reviewable changes (5)
  • MicrocontrollerCode/include/PIRFunctions.h
  • MicrocontrollerCode/include/FingerprintFunctions.h
  • MicrocontrollerCode/src/PIRFunctions.cpp
  • MicrocontrollerCode/src/microRosFunctions.cpp
  • MicrocontrollerCode/src/FingerprintFunctions.cpp
🧰 Additional context used
🧬 Code graph analysis (2)
MicrocontrollerCode/src/main.cpp (1)
MicrocontrollerCode/src/microRosFunctions.cpp (6)
  • publishError (318-325)
  • publishError (318-318)
  • transmitMsg (353-382)
  • transmitMsg (353-353)
  • transmitMsg (388-395)
  • transmitMsg (388-388)
MicrocontrollerCode/include/microRosFunctions.h (1)
MicrocontrollerCode/src/microRosFunctions.cpp (8)
  • microRosSetup (224-315)
  • microRosSetup (224-224)
  • transmitMsg (353-382)
  • transmitMsg (353-353)
  • transmitMsg (388-395)
  • transmitMsg (388-388)
  • publishError (318-325)
  • publishError (318-318)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
MicrocontrollerCode/include/microRosFunctions.h (1)

35-39: LGTM!

The static subscription callback declarations are correctly defined with appropriate signatures for ROS subscription handlers.

MicrocontrollerCode/src/main.cpp (3)

79-82: LGTM!

The error status output correctly reflects the removal of fingerprint sensor functionality while maintaining debug visibility for the remaining sensors.


118-118: Verify transmitMsg implementation is updated.

This call to transmitMsg omits the PIRSensors parameter, matching the updated header signature in microRosFunctions.h. However, if the implementation in microRosFunctions.cpp wasn't updated (as suggested by the code snippets at lines 352-381), this will cause a linker error.

The verification script in the earlier comment on microRosFunctions.h line 31 will confirm whether the implementation matches.


120-123: LGTM with note.

This call to publishError correctly uses 3 arguments matching the updated function signature in microRosFunctions.h line 33. Note that line 73 in this same file incorrectly passes 4 arguments to the same function, which needs to be fixed.

Comment thread MicrocontrollerCode/include/microRosFunctions.h
Comment thread MicrocontrollerCode/include/microRosFunctions.h
Comment thread MicrocontrollerCode/src/JoystickFunctions.cpp Outdated
Comment thread MicrocontrollerCode/src/main.cpp
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant