Skip to content

Add automatic configuration capability and other enhancements for Offline Mode #728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 75 commits into from
Apr 14, 2025

Conversation

brentru
Copy link
Member

@brentru brentru commented Apr 10, 2025

This pull request adds:

  • New Feature ✨ - config.json file is now built automatically!
    • Previously, A user would need to manually build a config.json file and then upload it to a board running WipperSnapper's Offline Mode.
    • Now, the config.json file is constructed during runtime and appears on the first run of the Offline Mode firmware.
  • New Feature 💾 - Automatic initialization for the microSD card
    • First attempts to initialize based on the config.json file, then falls back and attempts to initialize based on a #define within ws_boards.h file
  • New Feature 🔌 - Automatic Detection, Configuration and Initialization for I2C Components
    • I2C components are now automatically detected and added to the config.json file, without manually editing the file.
    • How this works:
        1. All components defined within the config.json file are initialized first
        1. WS Offline scans the I2C bus to discover new devices
        1. If a new device is found, a best-guess attempt is made to detect and initialize an I2C device candidate
      • 3a) If the candidate is successfully initialized, it is appended to the config.json file to allow it to persist between boots.
        1. The runtime executes with both the existing components (defined in config.json) and the new, discovered, components.

brentru and others added 30 commits March 14, 2025 16:14
…nt write out its types, device default_sensor_types is broken
Copy link

github-actions bot commented Apr 10, 2025

Test Results

6 tests  +6   6 ✅ +6   42s ⏱️ +42s
1 suites +1   0 💤 ±0 
1 files   +1   0 ❌ ±0 

Results for commit 375fd39. ± Comparison against base commit 0de3e5c.

♻️ This comment has been updated with latest results.

@brentru brentru marked this pull request as ready for review April 11, 2025 15:12
@brentru
Copy link
Member Author

brentru commented Apr 11, 2025

@tyeth This PR is passing and ready for review and testing.

Note that you do not need to review every i2c driver/drvName, there's a ton and it'd take too much time.

@brentru
Copy link
Member Author

brentru commented Apr 11, 2025

Hardware Tested:
✅ RP2040 Adalogger + SHT31
✅ RP2040 Adalogger + SHT31 + MUX w/BME280
✅ RP2040 Adalogger + RTC + MUX w/BME280
✅ ESP32-S2 Feather + Adalogger FeatherWing + BME280

Copy link
Member

@tyeth tyeth left a comment

Choose a reason for hiding this comment

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

There was some funkiness with the checksum messaging when using offline mode. I think maybe it says mismatch and then successfully verified. Maybe worth quickly checking.
I meant to add that checksum to the config tool too.

Copy link
Member

Choose a reason for hiding this comment

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

the filename and folder suffix looks like a typo

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how - would you prefer a rename?

@brentru
Copy link
Member Author

brentru commented Apr 14, 2025

I think maybe it says mismatch and then successfully verified. Maybe worth quickly checking.

I fixed this sometime on Thursday and didn't see this while testing. I also verified it against the invalid_checksum unit test scenario:

tests/test_offline.py::test_invalid_checksum Wokwi CLI v0.14.3 (7c0fea04eeb6)
Connected to Wokwi Simulation API 1.0.0-20250406-g04cf145b
Starting simulation...
....
[APP] Attempting to configure hardware...
->[Offline Mode - Invalid Checksum Value] Expected text matched: "[SD] Checksum mismatch, file has been modified from its original state!"
[Offline Mode - Invalid Checksum Value] Scenario completed successfully
PASSED

@brentru brentru merged commit 5564777 into offline-mode Apr 14, 2025
21 checks passed
@brentru brentru deleted the offline-mode-autoconfig branch April 14, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request offline-mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants