Skip to content

Fixed file structure and implemented library.json#55

Open
sivar2311 wants to merge 6 commits into
rlogiacco:masterfrom
sivar2311:master
Open

Fixed file structure and implemented library.json#55
sivar2311 wants to merge 6 commits into
rlogiacco:masterfrom
sivar2311:master

Conversation

@sivar2311

@sivar2311 sivar2311 commented May 23, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Documentation

    • Updated embedded documentation images with improved source hosting for battery discharge curve and mapping functions diagrams.
  • Chores

    • Bumped library version to 1.3.0.
    • Added Arduino library package configuration and metadata for enhanced platform compatibility.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR prepares the Battery Sense Arduino library for release (v1.3.0) by adding official library metadata for the Arduino IDE package ecosystem, updating the library version, fixing documentation image references, and refining repository configuration. No functional code changes are included.

Changes

Arduino Library Release Preparation

Layer / File(s) Summary
Library metadata and versioning
library.json, library.properties
library.json is introduced with complete Arduino package metadata (name, version 1.3.0, description, author, license, supported frameworks/platforms, exported headers, and example definitions), and the version in library.properties is updated from 1.2.0 to 1.3.0.
Documentation and repository configuration
README.md, .gitignore
README image URLs are corrected: the battery discharge curve GIF now points to an HTTPS-hosted version, and the mapping functions image switches to a local doc/map-fn.png path; .gitignore adds .github to the ignored paths list.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A version bump, some metadata, and a tidy repo—

Library ready for Arduino's grand show!

Images refreshed, ignored paths clean,

v1.3.0 release, poised and keen! 📦✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes in the pull request: adding library.json file and updating .gitignore, README.md, and library.properties.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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: 2

🤖 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 `@library.json`:
- Around line 54-67: Remove the duplicate example entry for
"HigherADCResolution": locate the two identical JSON objects that contain
"name": "HigherADCResolution", "base": "examples/HigherADCResolution", and
"files": ["HigherADCResolution.ino"] and delete one of them so the examples
array contains a single unique entry; afterwards ensure the JSON remains valid
(no trailing commas) and that only one "HigherADCResolution" object exists.

In `@README.md`:
- Line 29: The README currently embeds an external image URL
("https://www.philohome.com/batteries/discharge-750.gif") which is reachable now
but fragile long-term; to fix, vendor the GIF into the repository (e.g., add
assets/discharge-750.gif), update the README image reference to the local path
(replace the external URL in the markdown image tag or add a fallback image
tag), and optionally keep the external URL commented or noted as a
fallback/attribution so the README points to the bundled asset by default while
preserving the original source.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b98ea4aa-5f3d-4cd6-a3e9-759aabc3de99

📥 Commits

Reviewing files that changed from the base of the PR and between f43f782 and 49cbaa1.

⛔ Files ignored due to path filters (5)
  • doc/higher-on-demand.png is excluded by !**/*.png
  • doc/higher.png is excluded by !**/*.png
  • doc/lower-on-demand.png is excluded by !**/*.png
  • doc/lower.png is excluded by !**/*.png
  • doc/map-fn.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • .gitignore
  • README.md
  • library.json
  • library.properties
  • src/Battery.cpp
  • src/Battery.h

Comment thread library.json
Comment on lines +54 to +67
{
"name": "HigherADCResolution",
"base": "examples/HigherADCResolution",
"files": [
"HigherADCResolution.ino"
]
},
{
"name": "HigherADCResolution",
"base": "examples/HigherADCResolution",
"files": [
"HigherADCResolution.ino"
]
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Remove duplicate HigherADCResolution example entry.

The HigherADCResolution example is declared twice (lines 54-59 and 61-67 with identical content). This duplicate will cause package metadata validation errors and could prevent the library from being published or installed correctly through the Arduino Library Manager.

🐛 Proposed fix
         {
             "name": "HigherADCResolution",
             "base": "examples/HigherADCResolution",
             "files": [
                 "HigherADCResolution.ino"
             ]
         },
-        {
-            "name": "HigherADCResolution",
-            "base": "examples/HigherADCResolution",
-            "files": [
-                "HigherADCResolution.ino"
-            ]
-        },
         {
             "name": "OnDemandDoubleLiIon",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"name": "HigherADCResolution",
"base": "examples/HigherADCResolution",
"files": [
"HigherADCResolution.ino"
]
},
{
"name": "HigherADCResolution",
"base": "examples/HigherADCResolution",
"files": [
"HigherADCResolution.ino"
]
},
{
"name": "HigherADCResolution",
"base": "examples/HigherADCResolution",
"files": [
"HigherADCResolution.ino"
]
},
🤖 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 `@library.json` around lines 54 - 67, Remove the duplicate example entry for
"HigherADCResolution": locate the two identical JSON objects that contain
"name": "HigherADCResolution", "base": "examples/HigherADCResolution", and
"files": ["HigherADCResolution.ino"] and delete one of them so the examples
array contains a single unique entry; afterwards ensure the JSON remains valid
(no trailing commas) and that only one "HigherADCResolution" object exists.

Comment thread README.md
In reality, the relation between battery capacity and its voltage is better represented by a curve and there are many factors affecting it: current drawn, temperature, age, etc...

![Battery discharge curves at 750 mA](http://www.philohome.com/batteries/discharge-750.gif)
![Battery discharge curves at 750 mA](https://www.philohome.com/batteries/discharge-750.gif)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify the battery discharge curve image URL is accessible

echo "Checking image URL accessibility..."
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://www.philohome.com/batteries/discharge-750.gif")

if [ "$HTTP_STATUS" -eq 200 ]; then
    echo "✓ Image URL is accessible (HTTP $HTTP_STATUS)"
    curl -s -I "https://www.philohome.com/batteries/discharge-750.gif" | grep -i "content-type"
else
    echo "✗ Image URL returned HTTP $HTTP_STATUS"
    exit 1
fi

Repository: rlogiacco/BatterySense

Length of output: 164


Confirm external image URL availability, but mitigate long-term link risk

The URL https://www.philohome.com/batteries/discharge-750.gif returns HTTP 200 and serves as image/gif. For long-term documentation resilience, consider vendoring the GIF into the repo or adding an internal mirror/pinned alternative to avoid breakage if the external host changes.

🤖 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 `@README.md` at line 29, The README currently embeds an external image URL
("https://www.philohome.com/batteries/discharge-750.gif") which is reachable now
but fragile long-term; to fix, vendor the GIF into the repository (e.g., add
assets/discharge-750.gif), update the README image reference to the local path
(replace the external URL in the markdown image tag or add a fallback image
tag), and optionally keep the external URL commented or noted as a
fallback/attribution so the README points to the bundled asset by default while
preserving the original source.

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