Skip to content

Use watchdog timeout for LIN communication error handling - #30

Merged
JanPetterMG merged 3 commits into
mainfrom
chore/wdt-fault-handling
Sep 5, 2026
Merged

Use watchdog timeout for LIN communication error handling#30
JanPetterMG merged 3 commits into
mainfrom
chore/wdt-fault-handling

Conversation

@JanPetterMG

Copy link
Copy Markdown
Contributor

Implement a watchdog timeout to manage LIN communication errors by forcing a reboot after 8 seconds in a fault state. This change enhances the system's reliability during communication failures.

@JanPetterMG JanPetterMG added this to the v1.0.0 milestone Sep 5, 2026
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 5081d886-9c2f-4c70-8fc4-99ac9bce915c

📥 Commits

Reviewing files that changed from the base of the PR and between 8666196 and 7c4d3b6.

📒 Files selected for processing (2)
  • src/avr/DeskService.cpp
  • src/avr/main.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/avr/main.cpp
  • src/avr/DeskService.cpp

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: Minimal (esp32-c6-zero-b)
  • GitHub Check: Minimal (attiny841)
  • GitHub Check: Full (esp32-c6-zero-b)
  • GitHub Check: Tidy (attiny841)
  • GitHub Check: Tidy (esp32-c6-zero-b)
  • GitHub Check: Format

Summary by CodeRabbit

  • Reliability
    • Added watchdog monitoring to improve recovery from stalled device communication.
    • Initialization now reports required packet failures, sounds an alert, and stops instead of continuing.
    • Communication failures are reported more consistently, with pending operations preserved for retry.
    • Successful communication now regularly refreshes device monitoring to support continued reliable operation.

Walkthrough

The AVR watchdog is now managed by DeskService. Initialization reports PID failures immediately. Successful encoder reads reset the watchdog. Encoder failures preserve pending. AVR entrypoints delegate directly to DeskService.

Changes

AVR watchdog and initialization flow

Layer / File(s) Summary
Initialization watchdog and PID failure handling
src/avr/DeskService.cpp
DeskService::begin() enables the 8-second watchdog. PID initialization failures now write I and a newline to Serial1, sound a tone, and return immediately. Successful initialization resets the watchdog.
Runtime watchdog and entrypoint delegation
src/avr/DeskService.cpp, src/avr/main.cpp
Successful encoder reads reset the watchdog. Encoder failures return false without clearing pending. AVR setup() and loop() now call only desk.begin() and desk.handle().

Merge Risk: 🟡 Moderate · up to 7c4d3

The watchdog recovery behavior may not restart the device after a PID initialization failure if encoder communication continues, leaving the desk in a failed initialization state. This should be resolved before merging.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: using a watchdog timeout to handle LIN communication errors.
Description check ✅ Passed The description accurately describes the watchdog timeout, the 8-second reboot behavior, and the reliability goal of the changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch chore/wdt-fault-handling

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 2ff69679-bec8-4c3c-b347-7c93cf0b25ce

📥 Commits

Reviewing files that changed from the base of the PR and between 8dff308 and 8666196.

📒 Files selected for processing (2)
  • src/avr/DeskService.cpp
  • src/avr/main.cpp

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread src/avr/DeskService.cpp
@JanPetterMG
JanPetterMG marked this pull request as ready for review September 5, 2026 18:23
Copilot AI lite review requested due to automatic review settings September 5, 2026 18:23
@chatgpt-codex-connector

This comment was marked as off-topic.

This comment was marked as off-topic.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #31

Docstrings generation was requested by @JanPetterMG.

* #30 (comment)

The following files were modified:

* `src/avr/DeskService.cpp`
* `src/avr/main.cpp`
📝 Add docstrings to `chore/wdt-fault-handling`
@JanPetterMG
JanPetterMG added this pull request to the merge queue Sep 5, 2026
Merged via the queue into main with commit 0032828 Sep 5, 2026
15 checks passed
@JanPetterMG
JanPetterMG deleted the chore/wdt-fault-handling branch September 5, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants