Skip to content

fix: SPI lock; revert http flags - #366

Merged
mverch67 merged 1 commit into
masterfrom
fix-sd-spi
Aug 11, 2026
Merged

fix: SPI lock; revert http flags#366
mverch67 merged 1 commit into
masterfrom
fix-sd-spi

Conversation

@mverch67

@mverch67 mverch67 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

#356 introduced SPI issues when loading/saving from SD card

Summary by CodeRabbit

  • Bug Fixes

    • Improved SD card reliability during map tile loading and saving by coordinating SPI access.
    • Added automatic creation of missing folders when saving map data.
    • Improved handling and cleanup of SD card file operations and errors.
  • Performance

    • Optimized tile downloads by reusing HTTP connections, helping reduce connection overhead.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change protects SD-card operations with SPI locks, creates missing save directories recursively, excludes shared-SPI builds, and updates filesystem comments. ESP32 URL requests now reuse HTTP connections through a stored client and keep-alive headers.

Changes

SD-card access

Layer / File(s) Summary
SD-card build and save preparation
source/graphics/map/SdFatService.cpp
Shared-SPI builds exclude the SD-card implementation. Saves recursively create missing parent directories. Filesystem debug comments use SDFs.
SPI-guarded PNG file operations
source/graphics/map/SDCardService.cpp, source/graphics/map/SdFatService.cpp
PNG loading and saving hold the SPI lock across file access, allocation, reading, writing, and error handling.

URL tile HTTP reuse

Layer / File(s) Summary
Persistent HTTP request lifecycle
include/graphics/map/URLService.h, source/graphics/map/URLService.cpp
ESP32 builds store the HTTPClient instance in URLService. Tile requests use connection reuse and keep-alive headers while retaining response validation and streamed PNG decoding.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I’m a rabbit guarding tiles in the night,
SPI locks keep each file write right.
Parent paths bloom, one by one,
HTTP connections stay on the run.
PNGs hop safely into view—
A tidy map for me and you!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the two main changes: fixing SPI locking and reverting HTTP flags.

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

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

Inline comments:
In `@source/graphics/map/SdFatService.cpp`:
- Line 86: Synchronize ReentrantSpiLock’s owner/depth state while retaining a
single underlying SPI acquisition for the outermost nested guard. Apply the
corresponding guard changes at source/graphics/map/SdFatService.cpp lines 86-86
and 144-144, and source/graphics/map/SDCardService.cpp lines 94-94 and 151-151;
update the shared lock implementation or usage around these guards so concurrent
UI and radio access cannot race.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d6a0f60-ec94-446d-b9a8-375b3d7fe8fe

📥 Commits

Reviewing files that changed from the base of the PR and between 4f150e5 and 4fc6542.

📒 Files selected for processing (4)
  • include/graphics/map/URLService.h
  • source/graphics/map/SDCardService.cpp
  • source/graphics/map/SdFatService.cpp
  • source/graphics/map/URLService.cpp

Comment thread source/graphics/map/SdFatService.cpp
@mverch67
mverch67 merged commit 6e5e3b6 into master Aug 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant