Initial commit

This commit is contained in:
2026-08-19 21:35:27 +03:00
commit d719b34e03
40 changed files with 35252 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
name: Fetch Firmware
# The firmware is built by the upstream repository
# (mnh-jansson/open-battery-information) and attached to its GitHub
# releases. This workflow simply downloads the latest binaries and commits
# them here, so the uploader always serves the newest firmware without
# needing a local PlatformIO toolchain.
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
fetch:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download firmware from the upstream release
run: |
curl -fL --retry 5 --retry-delay 10 -o firmware/uno.hex \
https://github.com/mnh-jansson/open-battery-information/releases/latest/download/uno.hex
curl -fL --retry 5 --retry-delay 10 -o firmware/esp32.bin \
https://github.com/mnh-jansson/open-battery-information/releases/latest/download/esp32.bin
- name: Show the upstream release this firmware came from
run: |
curl -fsSL https://api.github.com/repos/mnh-jansson/open-battery-information/releases/latest \
| python3 -c "import json, sys; r = json.load(sys.stdin); print('upstream tag:', r['tag_name'], '| published:', r['published_at'])"
- name: Commit updated firmware
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'ci: fetch latest ArduinoOBI firmware from upstream release'
file_pattern: firmware/uno.hex firmware/esp32.bin
+149
View File
@@ -0,0 +1,149 @@
name: Package desktop app
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Release tag to attach the installers to (leave empty for workflow_dispatch only build)"
required: false
permissions:
contents: write
jobs:
bump-version:
name: Sync desktop version to tag
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Bump desktop package version
working-directory: desktop
run: |
VERSION="${GITHUB_REF_NAME#v}"
npm pkg set version="$VERSION"
npm install --package-lock-only
echo "bumped desktop version to $VERSION"
- name: Commit and push version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add desktop/package.json desktop/package-lock.json
if git diff --cached --quiet; then
echo "no version change to commit"
else
git commit -m "bump desktop version to ${GITHUB_REF_NAME#v} [ci skip]"
git push origin HEAD:main
fi
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
script: dist:win
env: { CSC_IDENTITY_AUTO_DISCOVERY: "true" }
- os: macos-latest
script: dist:mac
env: { CSC_IDENTITY_AUTO_DISCOVERY: "false" }
- os: ubuntu-latest
script: dist:linux
env: { CSC_IDENTITY_AUTO_DISCOVERY: "true" }
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: desktop/package-lock.json
- name: Cache Electron binaries
uses: actions/cache@v4
with:
path: |
~/.cache/electron
~/.cache/electron-builder
key: ${{ runner.os }}-electron-${{ hashFiles('desktop/package-lock.json') }}
- name: Install dependencies
run: npm ci
working-directory: desktop
- name: Set version from release tag
env:
TAG: ${{ inputs.tag != '' && inputs.tag || github.ref_name }}
working-directory: desktop
shell: bash
run: |
VERSION="${TAG#v}"
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
npm pkg set version="$VERSION"
echo "Packaging version $VERSION"
else
echo "No semver tag ($TAG) - keeping package.json version"
fi
- name: Build installers
run: npm run ${{ matrix.script }}
working-directory: desktop
env:
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.env.CSC_IDENTITY_AUTO_DISCOVERY }}
- name: List release artifacts
shell: bash
working-directory: desktop
run: ls -la release
- name: Upload installers
uses: actions/upload-artifact@v4
with:
name: installers-${{ matrix.os }}
path: |
desktop/release/*.exe
desktop/release/*.dmg
desktop/release/*.zip
desktop/release/*.AppImage
desktop/release/*.deb
if-no-files-found: error
release:
name: Publish release
needs: build
if: startsWith(github.ref, 'refs/tags/') || inputs.tag != ''
runs-on: ubuntu-latest
steps:
- name: Download installers
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'push' && github.ref_name || inputs.tag }}
files: |
artifacts/*.exe
artifacts/*.dmg
artifacts/*.zip
artifacts/*.AppImage
artifacts/*.deb
generate_release_notes: true
+40
View File
@@ -0,0 +1,40 @@
name: Deploy to GitHub Pages
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Stage web files
run: |
mkdir -p _site
cp -r index.html obi.html setup.html download.html css js firmware assets _site/
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+8
View File
@@ -0,0 +1,8 @@
# Local clone of the upstream repo (reference only). The firmware is built
# by the upstream (mnh-jansson/open-battery-information) and its binaries
# are fetched into firmware/ by the firmware.yml workflow.
open-battery-information/
# Local web server / editor noise
.DS_Store
Thumbs.db
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+178
View File
@@ -0,0 +1,178 @@
# Open Battery Information — Web
A web version of the [open-battery-information](https://github.com/mnh-jansson/open-battery-information)
project, hostable entirely on **GitHub Pages**. It provides:
1. **Landing page** (`index.html`) — the project front page: what it does,
requirements, how to get started, and links to the two tools.
2. **OBI-1** (`obi.html`) — a browser port of the desktop Tkinter app:
the Makita LXT module with the Arduino OBI interface, talking to the
Arduino over the **Web Serial API**.
3. **Firmware Uploader** (`firmware/uploader.html`) — flashes the
Open Battery Information firmware to an **Arduino Uno** straight from the
browser, using **AVRDUDE compiled to WebAssembly** + Web Serial.
The Arduino firmware is built by the **original repository**
([open-battery-information](https://github.com/mnh-jansson/open-battery-information))
and attached to its GitHub releases. This site simply fetches the latest
binaries — no local toolchain needed.
## Usage
### Requirements
- **Chrome or Edge on desktop** (or any Chromium-based browser).
- HTTPS or `localhost` (Web Serial and SharedArrayBuffer both require a
secure context). GitHub Pages provides HTTPS automatically.
- A USB-connected Arduino Uno with the optiboot bootloader.
### Flashing the firmware
Open `firmware/uploader.html`:
1. *Board* — pick your board. **Arduino Uno** (default) or **ESP32-C3**
(SuperMini).
2. *Flash* — plug the board into USB and click **Flash firmware**; choose
the port when prompted.
- Arduino boards: AVRDUDE resets the board into its bootloader
(1200 baud DTR trick), uploads and verifies the flash.
- ESP32-C3: esptool drives RTS/DTR to enter the ROM bootloader and
flashes a merged image (bootloader + partitions + app) at offset 0x0.
When it finishes, the board reboots into the OBI firmware.
> Note: both flashers talk to the bootloader at 115200 baud. The OBI
> firmware itself runs at 9600 baud and is used by OBI-1 tool.
### Using OBI-1 tool
Open `obi.html`:
1. **Connect** — click **Connect** and pick the serial port of the Arduino
(or ESP32-C3) running the OBI firmware (9600 baud, with an automatic
board reset on connect).
2. **Read battery** — insert a battery and press **Read battery**.
The model, cell voltages, temperatures, charge count and status are read
in one go. LED tests and error reset work on supported batteries.
> **Warning:** This tool talks to battery BMS hardware. Use at your own risk —
> see the upstream project's documentation and the MIT license.
## How it works
- `js/` — OBI-1 tool: a port of the Python
`OpenBatteryInformation` app (module + interface architecture), wrapped in
a guided 3-step wizard (`connect → read → results`). `common.js` provides a
`SerialConnection` wrapper around the Web Serial API with a background
read loop.
- `firmware/avrdude.js` + `avrdude.wasm` + `avrdude.conf` — AVRDUDE compiled
to WebAssembly, vendored from the
[`@leaphy-robotics/avrdude-webassembly`](https://www.npmjs.com/package/@leaphy-robotics/avrdude-webassembly)
package (a fork of avrdude). The serial layer in `avrdude.js` was rewritten
to talk to the port directly over Web Serial on the main thread (no worker,
no SharedArrayBuffer), and performs the Arduino 1200 baud DTR reset, so the
actual port is picked with `navigator.serial` rather than `-P`.
- `firmware/uno.hex` — the compiled ArduinoOBI firmware for the Uno,
fetched from the latest upstream GitHub release by the `firmware.yml`
workflow.
- `firmware/esp32.bin` — a merged ESP32-C3 image (bootloader + partitions +
app), built upstream from the `esp32-c3-devkitm-1` PlatformIO env and
fetched the same way.
- `firmware/esptool.js` — Espressif's official
[`esptool-js`](https://www.npmjs.com/package/esptool-js) (Apache-2.0) for
flashing ESP32 chips over Web Serial; loaded on demand by the uploader.
## Continuous integration
| Workflow | What it does |
| --- | --- |
| `firmware.yml` | Downloads `uno.hex` + `esp32.bin` from the latest [upstream release](https://github.com/mnh-jansson/open-battery-information/releases) and commits them to `firmware/`. Runs on a schedule and manually via *Actions*. |
| `pages.yml` | Deploys the static site (`index.html`, `obi.html`, `setup.html`, `download.html`, `css`, `js`, `firmware`, `assets`) to GitHub Pages via `actions/deploy-pages`. |
| `packaging.yml` | Builds the desktop app (Electron) for Windows, macOS and Linux and attaches the installers to a GitHub release. Runs on a `v*` tag push or manually via *Actions*. |
To set up GitHub Pages on your fork: go to **Settings → Pages → Source:
GitHub Actions**.
## Local development
Serve the directory over HTTP (ES modules require a server, not `file://`):
```sh
python3 -m http.server 8000
```
Then open `http://localhost:8000` in Chrome/Edge. `localhost` counts as a
secure context, so Web Serial works without HTTPS.
## Desktop app
The OBI-1 page is also packaged as a self-contained **Electron** app for
Windows, macOS and Linux. The bundle contains only the OBI-1 page (no landing
page, no firmware uploader), and serial access uses the native
[`serialport`](https://serialport.io) package in the main process instead of
the browser Web Serial API — the renderer reaches it over IPC through a
`navigator.serial` shim, so the OBI code itself is unchanged.
Everything lives in `desktop/`:
- `main.js` — Electron main process; loads `site/obi.html` and owns the
serial ports (`serialport`), including a small serial-port picker dialog.
- `preload.js` / `preload-picker.js` — IPC bridges (context-isolated).
- `serial-shim.js` — renderer-side `navigator.serial` implementation backed
by the native serial ports.
- `scripts/prepare-site.mjs` — builds `desktop/site/` from the repo's
`obi.html` (trims the nav to the theme toggle, injects the serial shim) and
copies only the assets that page uses.
- `electron-builder.yml` — build config (Windows NSIS, macOS DMG + zip,
Linux AppImage + deb).
Build installers locally:
```sh
cd desktop
npm install
npm run dist # current platform
npm run dist:win # Windows installer
npm run dist:mac # macOS DMG + zip
npm run dist:linux # Linux AppImage + deb
```
Run from source without packaging:
```sh
cd desktop
npm install
npm start
```
Installers for tagged releases are built automatically in CI and attached to
GitHub releases — see the [Download](download.html) page. The macOS build is
not notarized; right-click → Open on first launch.
## License
The web app is released under the **GPL-3.0** license. It is a port of the
[open-battery-information](https://github.com/mnh-jansson/open-battery-information)
project, which is MIT licensed and is included here under its original terms:
> Copyright (c) 2024 Martin Jansson
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AVRDUDE is also GPL — see `firmware/AVRDUDE-COPYING`.
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+59
View File
@@ -0,0 +1,59 @@
/* Download page styles. */
.download-grid {
grid-template-columns: repeat(3, 1fr);
align-items: stretch;
}
.download-card {
display: flex;
flex-direction: column;
text-align: center;
gap: 6px;
}
.download-card .icon {
margin: 0 auto;
}
.download-card h3 { margin-top: 4px; }
.download-btn {
margin-top: auto;
padding: 10px 18px;
border-radius: 10px;
text-decoration: none;
font-weight: 600;
font-size: 14px;
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
box-sizing: border-box;
}
a.download-btn.primary {
background: var(--grad);
background-size: 200% 100%;
color: #fff;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 22px -8px var(--glow-1);
transition: background-position 0.45s ease, box-shadow 0.3s ease, transform 0.15s ease;
}
a.download-btn.primary:hover {
background-position: 100% 0;
color: #fff;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 30px -10px var(--glow-2);
transform: translateY(-1px);
}
.download-meta {
font-size: 12px;
color: var(--text-dim);
margin: 0;
}
.download-asset { font-family: var(--font-mono, monospace); }
@media (max-width: 760px) {
.download-grid { grid-template-columns: 1fr; }
}
+447
View File
@@ -0,0 +1,447 @@
/* Landing page styles. */
.hero {
text-align: center;
padding: 64px 24px 48px;
max-width: 820px;
margin: 0 auto;
}
.hero h1 {
font-size: 42px;
line-height: 1.15;
margin: 0 0 16px;
letter-spacing: -0.01em;
}
.hero h1 .accent { color: var(--accent); }
.hero .tagline {
font-size: 18px;
color: var(--text-dim);
margin: 0 auto 32px;
max-width: 620px;
}
.hero-actions {
display: flex;
justify-content: center;
gap: 14px;
flex-wrap: wrap;
}
.hero-actions .btn-lg { min-width: 200px; }
.hero-note {
margin-top: 18px;
font-size: 13px;
color: var(--text-dim);
}
/* ---------- Sections ---------- */
.section {
max-width: 1000px;
margin: 0 auto;
padding: 40px 24px;
width: 100%;
}
.section h2 {
font-size: 24px;
margin: 0 0 8px;
text-align: center;
}
.section .section-sub {
text-align: center;
color: var(--text-dim);
margin: 0 0 32px;
}
.section .section-lead {
max-width: 720px;
margin: 0 auto 32px;
color: var(--text-dim);
line-height: 1.65;
text-align: left;
}
.section .section-lead p { margin: 0 0 10px; }
.section .section-lead p:last-child { margin: 0; font-weight: 600; color: var(--text); }
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
}
.feature-card {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 20px;
}
.feature-card .icon {
display: block;
margin-bottom: 12px;
}
.feature-card .icon svg {
width: 26px;
height: 26px;
}
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--text-dim); font-size: 13px; }
/* ---------- How it works ---------- */
.steps {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
counter-reset: step;
}
.step {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 20px;
}
.step .step-num {
counter-increment: step;
display: inline-flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border-radius: 50%;
background: var(--accent);
color: #0b1220;
font-weight: 800;
font-size: 15px;
margin-bottom: 12px;
}
.step .step-num::before { content: counter(step); }
.step h3 { margin: 0 0 8px; font-size: 16px; }
.step p { margin: 0; color: var(--text-dim); font-size: 13px; }
/* ---------- Requirements ---------- */
.req-list {
list-style: none;
margin: 0;
padding: 0;
}
.req-list li {
display: flex;
gap: 12px;
align-items: flex-start;
padding: 12px 0;
border-bottom: 1px solid var(--border-strong);
}
.req-list li:last-child { border-bottom: none; }
.req-list .req-icon { display: block; line-height: 0; }
.req-list .req-icon svg { width: 18px; height: 18px; display: block; margin-top: 2px; }
.req-list .req-title { font-weight: 700; display: block; }
.req-list .req-detail { color: var(--text-dim); font-size: 13px; }
/* ---------- Wiring ---------- */
.wiring-grid {
display: grid;
grid-template-columns: 360px 1fr;
gap: 24px;
align-items: start;
}
.wiring-figure {
margin: 0;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 14px;
text-align: center;
}
.wiring-figure img {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
cursor: zoom-in;
}
.lightbox {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.85);
display: flex;
align-items: center;
justify-content: center;
z-index: 200;
cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
max-width: 94vw;
max-height: 92vh;
background: #fff;
border-radius: var(--radius-lg);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.wiring-figure figcaption {
margin-top: 10px;
font-size: 12px;
color: var(--text-dim);
}
.wiring-figure figcaption a { color: var(--accent); }
.wiring-heading {
margin: 0 0 10px;
font-size: 16px;
}
.wiring-heading:not(:first-child) { margin-top: 24px; }
.wiring-table {
width: 100%;
border-collapse: collapse;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
overflow: hidden;
}
.wiring-table th {
text-align: left;
padding: 9px 12px;
background: var(--bg-input);
color: var(--text-dim);
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.04em;
border-bottom: 1px solid var(--border);
}
.wiring-table td {
padding: 9px 12px;
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.wiring-table tr:last-child td { border-bottom: none; }
.wiring-table td:first-child { font-weight: 600; }
.wiring-table td:nth-child(2) {
font-family: var(--font-mono);
font-weight: 600;
color: var(--accent);
}
.wiring-table td:nth-child(3) { color: var(--text-dim); }
.wiring-battery {
margin: 24px 0 0;
color: var(--text-dim);
font-size: 14px;
}
.step-link { color: var(--accent); font-size: 13px; text-decoration: none; }
.step-link:hover { text-decoration: underline; }
/* ---------- Warning ---------- */
.warning {
background: var(--feature-tint);
border: 1px solid var(--warn);
border-radius: var(--radius-lg);
padding: 20px 22px;
}
.warning h3 {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 10px;
color: var(--warn);
font-size: 16px;
}
.warning h3 svg { width: 18px; height: 18px; flex-shrink: 0; }
.warning p { margin: 0 0 10px; color: var(--text); }
.warning p:last-child { margin-bottom: 0; }
.warning a { color: var(--accent); }
/* ---------- FAQ ---------- */
details.faq {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 14px 18px;
margin-bottom: 10px;
}
details.faq summary {
cursor: pointer;
font-weight: 700;
font-size: 15px;
}
details.faq summary::-webkit-details-marker { color: var(--text-dim); }
details.faq .faq-body { color: var(--text-dim); margin-top: 10px; font-size: 14px; }
details.faq .faq-body a { color: var(--accent); }
/* ---------- Footer ---------- */
.site-footer {
border-top: 1px solid var(--border);
background: var(--bg-elevated);
padding: 28px 24px;
text-align: center;
color: var(--text-dim);
font-size: 13px;
margin-top: auto;
}
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
@media (max-width: 640px) {
.hero h1 { font-size: 32px; }
.hero { padding: 40px 16px 32px; }
.wiring-grid { grid-template-columns: 1fr; }
}
/* ============================================================
Aurora / glass UI layer: landing page (ui-flashy branch).
============================================================ */
.hero h1 .accent {
background: var(--grad);
background-size: 220% 100%;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: grad-pan 9s linear infinite;
}
.feature-card,
.step,
.wiring-figure {
background: var(--glass);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
box-shadow: 0 12px 30px -22px rgba(0, 0, 0, 0.4);
transition: transform 0.3s var(--ease-out), box-shadow 0.35s ease, border-color 0.3s ease;
}
.feature-card:hover,
.step:hover {
transform: translateY(-5px);
border-color: color-mix(in srgb, var(--accent-2) 55%, transparent);
box-shadow: 0 18px 40px -18px var(--glow-1),
0 0 0 1px color-mix(in srgb, var(--accent-2) 20%, transparent);
}
.feature-card .icon svg {
color: var(--accent-2);
filter: drop-shadow(0 0 8px var(--glow-1));
}
.step .step-num {
background: var(--grad);
color: #fff;
border: none;
box-shadow: 0 6px 18px -6px var(--glow-1);
}
.warning {
background: color-mix(in srgb, var(--feature-tint) 72%, transparent);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
box-shadow: 0 12px 32px -22px rgba(0, 0, 0, 0.4);
}
.req-list .req-icon svg { color: var(--accent-2); }
.req-list li {
border-radius: 8px;
padding-left: 4px;
transition: background 0.25s ease, padding-left 0.25s ease;
}
.req-list li:hover {
background: color-mix(in srgb, var(--hover-bg) 55%, transparent);
padding-left: 8px;
}
details.faq {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
transition: border-color 0.25s ease, box-shadow 0.3s ease;
}
details.faq[open],
details.faq:hover {
border-color: color-mix(in srgb, var(--accent-2) 45%, transparent);
box-shadow: 0 10px 26px -18px var(--glow-1);
}
.wiring-table {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.wiring-figure img { box-shadow: 0 14px 40px -18px rgba(0, 0, 0, 0.55); }
.wiring-figure figcaption a { color: var(--accent-2); }
/* ---------- Bigger hero (ui-flashy) ---------- */
.hero {
padding: 96px 24px 80px;
max-width: 900px;
}
.hero h1 {
font-size: 58px;
line-height: 1.08;
letter-spacing: -0.02em;
margin-bottom: 22px;
}
.hero .tagline {
font-size: 20px;
line-height: 1.6;
max-width: 720px;
margin-bottom: 40px;
}
.hero-actions .btn-lg {
min-width: 240px;
font-size: 17px;
padding: 16px 34px;
}
.hero-note {
margin-top: 26px;
font-size: 14px;
}
@media (max-width: 640px) {
.hero { padding: 56px 16px 44px; }
.hero h1 { font-size: 34px; }
.hero .tagline { font-size: 17px; }
}
+744
View File
@@ -0,0 +1,744 @@
/* Shared design system for the Open Battery Information web app. */
:root {
--bg: #1e1f22;
--bg-elevated: #2b2d31;
--bg-input: #232428;
--bg-code: #141517;
--border: #3f4147;
--border-strong: #2c2e33;
--text: #e8e9eb;
--text-dim: #9aa0a6;
--accent: #4f9cf9;
--accent-hover: #6db0ff;
--danger: #e5534b;
--ok: #57ab5a;
--warn: #d29922;
--hover-bg: #33353b;
--hover-border: #55575f;
--row-alt: #242529;
--row-hover: #2a2c31;
--row-selected: #1b3a5c;
--feature-tint: #3a2c16;
--log-ok: #9ece6a;
--log-err: #f7768e;
--log-warn: #e0af68;
--log-send: #7aa2f7;
--radius: 8px;
--radius-lg: 12px;
--font-mono: "Cascadia Code", "Consolas", "Menlo", monospace;
}
[data-theme="light"] {
--bg: #f3f4f6;
--bg-elevated: #ffffff;
--bg-input: #e8eaee;
--bg-code: #fafbfc;
--border: #d0d4da;
--border-strong: #d0d4da;
--text: #1f2328;
--text-dim: #5f6b76;
--accent: #2f81f7;
--accent-hover: #1f6feb;
--danger: #d1242f;
--ok: #1a7f37;
--warn: #9a6700;
--hover-bg: #e2e5ea;
--hover-border: #b6bcc4;
--row-alt: #f0f2f5;
--row-hover: #e2e5ea;
--row-selected: #d5e6fc;
--feature-tint: #fdf2da;
--log-ok: #1a7f37;
--log-err: #d1242f;
--log-warn: #9a6700;
--log-send: #1f6feb;
}
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
min-height: 100%;
}
body {
background: var(--bg);
color: var(--text);
font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
font-size: 14px;
line-height: 1.5;
display: flex;
flex-direction: column;
}
/* ---------- Navbar ---------- */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
height: 56px;
background: var(--bg-elevated);
border-bottom: 1px solid var(--border);
flex: 0 0 auto;
}
.navbar .brand {
font-weight: 700;
font-size: 15px;
letter-spacing: 0.02em;
text-decoration: none;
color: var(--text);
white-space: nowrap;
}
.navbar .brand .accent { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
color: var(--text-dim);
text-decoration: none;
padding: 8px 12px;
border-radius: var(--radius);
font-weight: 600;
}
.nav-links a:hover { background: var(--bg-input); color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--bg-input); }
.nav-links a .nav-badge {
margin-left: 6px;
}
/* ---------- Buttons ---------- */
button {
background: var(--bg-input);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 9px 16px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
button:hover:not(:disabled) { background: var(--hover-bg); border-color: var(--hover-border); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary,
button.btn-primary {
background: var(--accent);
border-color: var(--accent);
color: #0b1220;
}
button.primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.success { background: var(--ok); border-color: var(--ok); color: #fff; }
button.btn-secondary { background: var(--bg-elevated); }
button.btn-ghost { background: transparent; }
button.btn-lg { padding: 13px 26px; font-size: 16px; }
button.btn-block { width: 100%; }
/* ---------- Forms ---------- */
select, input[type="text"], input[type="number"], input[type="checkbox"], input[type="file"] {
background: var(--bg-input);
color: var(--text);
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 10px;
font-size: 14px;
}
select { width: 100%; }
select:focus, input:focus {
outline: 2px solid var(--accent);
outline-offset: 1px;
}
label.checkbox {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--text-dim);
margin: 6px 0;
}
.field {
margin-bottom: 14px;
}
.field > label {
display: block;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-dim);
margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
/* ---------- Status / badges ---------- */
.badge {
display: inline-block;
font-size: 11px;
font-weight: 700;
padding: 3px 10px;
border-radius: 10px;
border: 1px solid var(--border);
color: var(--text-dim);
white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.busy { color: var(--warn); border-color: var(--warn); }
.badge.err { color: var(--danger); border-color: var(--danger); }
.status-line { font-size: 13px; color: var(--text-dim); }
.status-line b { color: var(--text); font-weight: 600; }
/* ---------- Modal ---------- */
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.55);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.modal {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
max-width: 480px;
width: 92%;
padding: 20px 22px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 16px; color: var(--text-dim); line-height: 1.5; white-space: pre-wrap; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* ---------- Toasts ---------- */
.toast-container {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
z-index: 200;
pointer-events: none;
}
.toast {
background: var(--glass-strong);
border: 1px solid color-mix(in srgb, var(--ok) 60%, transparent);
color: var(--text);
padding: 10px 18px;
border-radius: var(--radius);
box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
font-size: 14px;
font-weight: 600;
opacity: 1;
transform: translateY(0);
transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.toast-error { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.toast.toast-out { opacity: 0; transform: translateY(6px); }
/* ---------- Card ---------- */
.card {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 18px 20px;
margin-bottom: 16px;
}
.card h2 {
margin: 0 0 12px;
font-size: 14px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-dim);
}
/* ---------- Progress ---------- */
.progress-track {
height: 10px;
background: var(--bg-input);
border-radius: 5px;
overflow: hidden;
margin: 12px 0 4px;
}
.progress-track .bar {
height: 100%;
width: 0%;
background: var(--accent);
transition: width 0.15s;
}
/* ---------- Log output ---------- */
.log-output {
background: var(--bg-code);
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px;
font-family: var(--font-mono);
font-size: 12px;
white-space: pre-wrap;
word-break: break-word;
max-height: 260px;
overflow-y: auto;
line-height: 1.5;
}
.log-output .l-info { color: var(--text-dim); }
.log-output .l-ok { color: var(--log-ok); }
.log-output .l-err { color: var(--log-err); }
.log-output .l-warn { color: var(--log-warn); }
.log-output .l-send { color: var(--log-send); }
.theme-toggle {
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
border: 1px solid var(--border);
color: var(--text-dim);
padding: 6px 10px;
font-size: 12px;
font-weight: 600;
border-radius: var(--radius);
cursor: pointer;
white-space: nowrap;
}
.theme-toggle:hover:not(:disabled) { color: var(--text); border-color: var(--hover-border); }
.theme-toggle svg {
display: block;
width: 16px;
height: 16px;
}
/* Navbar icon link (GitHub) */
.nav-links a.nav-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 38px;
height: 38px;
padding: 0;
border: 1px solid var(--border);
border-radius: 50%;
background: var(--glass);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
color: var(--text-dim);
text-decoration: none;
transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.nav-links a.nav-icon:hover {
background: var(--glass);
border-color: var(--accent-2);
color: var(--accent-2);
box-shadow: 0 0 14px var(--glow-1);
}
.nav-links a.nav-icon svg {
display: block;
width: 24px;
height: 24px;
}
/* Burger toggle (hidden on desktop, shown on small screens) */
.nav-toggle {
display: none;
align-items: center;
justify-content: center;
width: 38px;
height: 38px;
padding: 0;
margin-left: auto;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--glass);
color: var(--text-dim);
cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent-2); color: var(--accent-2); }
.nav-toggle svg {
display: block;
width: 20px;
height: 20px;
}
@media (max-width: 860px) {
.nav-toggle { display: inline-flex; }
.nav-links {
position: absolute;
top: 56px;
left: 0;
right: 0;
flex-direction: column;
align-items: stretch;
display: none;
background: var(--glass-strong);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.55);
padding: 8px 12px 14px;
}
.navbar.nav-open .nav-links { display: flex; }
.nav-links a { padding: 12px 12px; }
.nav-links .theme-toggle,
.nav-links a.nav-icon { align-self: flex-end; margin-top: 6px; }
}
/* Sun icon (shown in dark mode: clicking switches to light) / moon for light. */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
/* ---------- Utilities ---------- */
.muted { color: var(--text-dim); }
.mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.container {
width: 100%;
max-width: 1000px;
margin: 0 auto;
padding: 24px;
flex: 1 1 auto;
}
/* ============================================================
Aurora / glass UI layer (ui-flashy branch, exploratory).
Everything above the "Flashy UI" marker below is the original
design; this section layers a richer look on top of it.
============================================================ */
:root {
--accent-1: #38bdf8;
--accent-2: #818cf8;
--accent-3: #c084fc;
--grad: linear-gradient(120deg, var(--accent-1), var(--accent-2), var(--accent-3));
--grad-soft: linear-gradient(120deg, rgba(56, 189, 248, 0.22), rgba(129, 140, 248, 0.22), rgba(192, 132, 252, 0.22));
--glass: color-mix(in srgb, var(--bg-elevated) 74%, transparent);
--glass-strong: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
--glow-1: rgba(56, 189, 248, 0.35);
--glow-2: rgba(192, 132, 252, 0.35);
--radius-xl: 16px;
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="light"] {
--accent-1: #0891b2;
--accent-2: #4f46e5;
--accent-3: #a21caf;
--grad-soft: linear-gradient(120deg, rgba(8, 145, 178, 0.16), rgba(79, 70, 229, 0.16), rgba(162, 28, 175, 0.14));
--glass: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
--glass-strong: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
--glow-1: rgba(8, 145, 178, 0.22);
--glow-2: rgba(162, 28, 175, 0.18);
}
html { scrollbar-color: var(--hover-border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
background: linear-gradient(180deg, var(--border), var(--hover-border));
border-radius: 999px;
border: 2px solid transparent;
background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--hover-border); }
::selection { background: color-mix(in srgb, var(--accent-2) 35%, transparent); }
body {
background:
radial-gradient(90rem 90rem at 110% -10%, var(--glow-2), transparent 60%),
radial-gradient(80rem 80rem at -10% 15%, var(--glow-1), transparent 55%),
var(--bg);
}
body::before,
body::after {
content: "";
position: fixed;
z-index: -1;
width: 46vmax;
height: 46vmax;
border-radius: 50%;
filter: blur(80px);
opacity: 0.32;
pointer-events: none;
will-change: transform;
}
body::before {
top: -14vmax;
left: -12vmax;
background: radial-gradient(circle, var(--accent-1), transparent 62%);
animation: aurora-a 28s var(--ease-out) infinite alternate;
}
body::after {
bottom: -16vmax;
right: -14vmax;
background: radial-gradient(circle, var(--accent-3), transparent 62%);
animation: aurora-b 36s var(--ease-out) infinite alternate;
}
[data-theme="light"] body::before,
[data-theme="light"] body::after { opacity: 0.2; }
@keyframes aurora-a {
0% { transform: translate(0, 0) scale(1); }
50% { transform: translate(7vmax, 5vmax) scale(1.18); }
100% { transform: translate(-3vmax, 9vmax) scale(0.92); }
}
@keyframes aurora-b {
0% { transform: translate(0, 0) scale(1); }
50% { transform: translate(-8vmax, -6vmax) scale(1.22); }
100% { transform: translate(4vmax, -10vmax) scale(0.9); }
}
@keyframes grad-pan { to { background-position: 220% 0; } }
/* ---------- Navbar ---------- */
.navbar {
position: sticky;
top: 0;
z-index: 50;
background: var(--glass-strong);
backdrop-filter: blur(14px) saturate(1.5);
-webkit-backdrop-filter: blur(14px) saturate(1.5);
border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.5);
}
.navbar .brand { font-size: 16px; }
.navbar .brand .accent {
background: var(--grad);
background-size: 220% 100%;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: grad-pan 9s linear infinite;
}
.nav-links a { position: relative; transition: color 0.2s ease; }
.nav-links a:hover { background: transparent; }
.nav-links a.active { background: transparent; }
.nav-links a::after {
content: "";
position: absolute;
left: 12px;
right: 12px;
bottom: 5px;
height: 2px;
border-radius: 2px;
background: var(--grad);
transform: scaleX(0);
transform-origin: left;
transition: transform 0.3s var(--ease-out);
}
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
/* ---------- Buttons ---------- */
button {
transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.25s ease,
transform 0.12s ease, color 0.18s ease;
}
button.primary,
button.btn-primary {
background: var(--grad);
background-size: 200% 100%;
border: none;
color: #fff;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 22px -8px var(--glow-1);
transition: background-position 0.45s ease, box-shadow 0.3s ease, transform 0.15s ease;
}
button.primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled) {
background-position: 100% 0;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 30px -10px var(--glow-2);
transform: translateY(-1px);
}
button.danger {
box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--danger) 55%, transparent);
}
button.success {
box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--ok) 55%, transparent);
}
.theme-toggle {
width: 34px;
height: 34px;
padding: 0;
border-radius: 50%;
background: var(--glass);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
justify-content: center;
}
.theme-toggle:hover:not(:disabled) {
border-color: var(--accent-2);
color: var(--accent-2);
box-shadow: 0 0 14px var(--glow-1);
}
/* ---------- Cards ---------- */
.card {
background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
var(--grad-soft) border-box;
border: 1px solid transparent;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
box-shadow: 0 12px 32px -22px rgba(0, 0, 0, 0.45);
}
/* ---------- Badges ---------- */
.badge {
border-radius: 999px;
background: var(--glass);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border-color: transparent;
box-shadow: inset 0 0 0 1px var(--border);
}
.badge.ok {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 55%, transparent);
background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.badge.busy {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 55%, transparent);
background: color-mix(in srgb, var(--warn) 12%, transparent);
}
.badge.err {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 55%, transparent);
background: color-mix(in srgb, var(--danger) 12%, transparent);
}
/* ---------- Modal ---------- */
.modal {
background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
var(--grad-soft) border-box;
border: 1px solid transparent;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 24px 70px -28px var(--glow-1);
}
/* ---------- Progress ---------- */
.progress-track { background: color-mix(in srgb, var(--bg-input) 80%, transparent); }
.progress-track .bar {
background: linear-gradient(90deg, var(--accent-1), var(--accent-2), var(--accent-3));
background-size: 220% 100%;
box-shadow: 0 0 14px var(--glow-1);
animation: grad-pan 2.4s linear infinite;
}
/* ---------- Log / inputs ---------- */
.log-output {
background: color-mix(in srgb, var(--bg-code) 88%, transparent);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
select,
input[type="text"],
input[type="number"],
input[type="checkbox"],
input[type="file"] {
background: var(--glass);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
select:focus,
input:focus { box-shadow: 0 0 0 3px var(--glow-1); }
/* ---------- Reveal-on-scroll (driven by js/reveal.js) ---------- */
html.js-reveal .reveal {
opacity: 0;
transform: translateY(22px);
will-change: opacity, transform;
}
html.js-reveal .reveal.revealed {
opacity: 1;
transform: none;
transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
html.js-reveal .reveal { opacity: 1; transform: none; }
.navbar .brand .accent,
.progress-track .bar,
body::before,
body::after { animation: none; }
}
+388
View File
@@ -0,0 +1,388 @@
/* OBI-1 (wizard) styles. */
.tool-wrap {
width: 100%;
max-width: 1000px;
margin: 0 auto;
padding: 24px;
flex: 1 1 auto;
}
.tool-header { margin-bottom: 20px; }
.tool-header h1 { margin: 0 0 4px; font-size: 24px; }
.tool-header .subtitle { color: var(--text-dim); margin: 0; }
/* ---------- Stepper ---------- */
.stepper {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
}
.step-item {
display: flex;
align-items: center;
gap: 8px;
flex: 0 0 auto;
}
.step-dot {
width: 30px;
height: 30px;
border-radius: 50%;
border: 2px solid var(--border);
color: var(--text-dim);
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 13px;
background: var(--bg-elevated);
flex: 0 0 auto;
}
.step-item .step-label { font-weight: 600; color: var(--text-dim); font-size: 13px; }
.step-item.active .step-dot {
border-color: var(--accent);
color: #0b1220;
background: var(--accent);
}
.step-item.active .step-label { color: var(--text); }
.step-item.done .step-dot {
border-color: var(--ok);
background: var(--ok);
color: #0b1220;
}
.step-item.done .step-label { color: var(--ok); }
.step-connector {
flex: 1 1 auto;
height: 2px;
background: var(--border);
min-width: 24px;
}
.step-item.done ~ .step-connector { background: var(--border); }
.step-item.done + .step-connector { background: var(--ok); }
/* ---------- Wizard card & panels ---------- */
.wizard-card {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 24px;
}
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-panel h2 {
margin: 0 0 6px;
font-size: 20px;
}
.wizard-panel .panel-desc { color: var(--text-dim); margin: 0 0 18px; }
/* settings row (module / interface / reset) */
.wizard-settings {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: flex-end;
padding: 14px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
margin-bottom: 18px;
}
.wizard-settings .field { margin: 0; flex: 1 1 160px; }
.wizard-settings .field-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10px;
}
.wizard-settings .field-row select { width: auto; flex: 1 1 0; }
.wizard-settings .field-row .hint { margin-top: 0; white-space: nowrap; }
.iface-status {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 16px;
}
.warning {
background: var(--feature-tint);
border: 1px solid var(--warn);
border-radius: var(--radius-lg);
padding: 16px 18px;
margin-bottom: 16px;
}
.warning h3 {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 10px;
color: var(--warn);
font-size: 16px;
}
.warning p { margin: 0; color: var(--text); line-height: 1.5; }
.warning a { color: var(--accent); }
.iface-details {
display: grid;
gap: 10px;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
margin-top: 14px;
}
.iface-detail .label {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-dim);
display: block;
margin-bottom: 4px;
}
.iface-detail .value {
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 10px;
font-size: 13px;
}
/* ---------- Read panel ---------- */
.read-step {
text-align: center;
padding: 12px 0 4px;
}
.read-step .read-illustration { margin-bottom: 8px; }
.read-step .read-illustration svg { width: 40px; height: 40px; }
.read-step .primary-action {
margin-top: 18px;
}
.read-hint {
margin-top: 14px;
font-size: 13px;
color: var(--text-dim);
}
/* ---------- Results ---------- */
.results-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 14px;
}
.results-toolbar .summary { color: var(--text-dim); font-size: 13px; }
.test-grid {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.test-group {
flex: 1 1 180px;
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 10px;
text-align: center;
}
.test-group legend {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
color: var(--text-dim);
padding: 0 6px;
}
.test-group button { display: block; width: 100%; margin-bottom: 8px; }
.test-group button:last-child { margin-bottom: 0; }
.table-wrap {
border: 1px solid var(--border);
border-radius: var(--radius);
max-height: 380px;
overflow: auto;
}
table#data-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
table#data-table th,
table#data-table td {
white-space: nowrap;
}
table#data-table th {
position: sticky;
top: 0;
background: var(--bg-input);
text-align: left;
padding: 8px 12px;
border-bottom: 1px solid var(--border);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.03em;
color: var(--text-dim);
z-index: 1;
}
table#data-table td { padding: 7px 12px; border-bottom: 1px solid var(--border-strong); }
table#data-table tr:nth-child(even) td { background: var(--row-alt); }
table#data-table tr.selected td { background: var(--row-selected) !important; }
table#data-table tbody tr { cursor: pointer; }
table#data-table tbody tr:hover td { background: var(--row-hover); }
.table-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
/* ---------- Debug drawer ---------- */
.debug-drawer {
margin-top: 16px;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.debug-drawer > summary {
cursor: pointer;
padding: 10px 14px;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-dim);
user-select: none;
}
.debug-drawer > summary:hover { color: var(--text); }
.debug-drawer #debug-text {
border-top: 1px solid var(--border);
padding: 10px;
max-height: 180px;
overflow-y: auto;
background: var(--bg-code);
font-family: var(--font-mono);
font-size: 12px;
white-space: pre-wrap;
word-break: break-word;
line-height: 1.5;
}
#debug-text .dbg-send { color: var(--log-send); }
#debug-text .dbg-recv { color: var(--log-ok); }
#debug-text .dbg-info { color: var(--text-dim); }
#debug-text .dbg-error { color: var(--log-err); }
/* ============================================================
Aurora / glass UI layer: OBI-1 tool (ui-flashy branch).
============================================================ */
.wizard-card {
background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
var(--grad-soft) border-box;
border: 1px solid transparent;
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
box-shadow: 0 18px 50px -28px var(--glow-1);
}
.step-connector { background: color-mix(in srgb, var(--border) 85%, transparent); }
.step-item.active .step-dot {
background: var(--grad);
border-color: transparent;
color: #fff;
box-shadow: 0 0 16px var(--glow-1);
animation: dot-pulse 2.4s ease-in-out infinite;
}
.step-item.done .step-dot {
background: linear-gradient(120deg, var(--ok), #34d399);
border-color: transparent;
color: #fff;
box-shadow: 0 0 14px color-mix(in srgb, var(--ok) 55%, transparent);
}
.step-item.done + .step-connector {
background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
}
@keyframes dot-pulse {
0%, 100% { box-shadow: 0 0 0 0 var(--glow-1); }
50% { box-shadow: 0 0 0 7px transparent; }
}
.wizard-settings {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
}
.iface-detail .value {
background: var(--glass);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
}
.test-group {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
}
.table-wrap {
background: var(--glass);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
box-shadow: 0 12px 30px -22px rgba(0, 0, 0, 0.4);
}
table#data-table th { background: color-mix(in srgb, var(--bg-input) 82%, transparent); }
.read-step .read-illustration svg {
width: 56px;
height: 56px;
color: var(--accent-2);
filter: drop-shadow(0 0 16px var(--glow-1));
animation: float-bob 4.5s var(--ease-out) infinite;
}
@keyframes float-bob {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-9px); }
}
.debug-drawer {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
}
.debug-drawer #debug-text { background: color-mix(in srgb, var(--bg-code) 88%, transparent); }
+255
View File
@@ -0,0 +1,255 @@
/* Firmware uploader (single-button wizard) styles. */
.uploader-wrap {
width: 100%;
max-width: 760px;
margin: 0 auto;
padding: 24px;
flex: 1 1 auto;
}
.uploader-header { margin-bottom: 20px; }
.uploader-header h1 { margin: 0 0 4px; font-size: 26px; }
.uploader-header .subtitle { color: var(--text-dim); margin: 0; }
.flash-card {
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 24px;
}
/* flow steps */
.flash-flow {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 20px;
}
.flow-item { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.flow-dot {
width: 26px;
height: 26px;
border-radius: 50%;
border: 2px solid var(--border);
color: var(--text-dim);
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 12px;
background: var(--bg-input);
flex: 0 0 auto;
}
.flow-item .flow-label { font-weight: 600; color: var(--text-dim); font-size: 13px; }
.flow-item.active .flow-dot { border-color: var(--accent); background: var(--accent); color: #0b1220; }
.flow-item.active .flow-label { color: var(--text); }
.flow-item.done .flow-dot { border-color: var(--ok); background: var(--ok); color: #0b1220; }
.flow-item.done .flow-label { color: var(--ok); }
.flow-connector { flex: 1 1 auto; height: 2px; background: var(--border); min-width: 20px; }
.flow-item.done + .flow-connector { background: var(--ok); }
/* board selector */
.board-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 12px;
}
.board-option {
display: block;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 14px;
cursor: pointer;
transition: border-color 0.12s, background 0.12s;
}
.board-option:hover { border-color: var(--hover-border); }
.board-option.selected { border-color: var(--accent); background: var(--row-selected); }
.board-option input { display: none; }
.board-option .board-name { font-weight: 700; display: block; margin-bottom: 4px; }
.board-option .board-desc { font-size: 12px; color: var(--text-dim); }
/* firmware source */
.firmware-row {
display: flex;
gap: 12px;
align-items: flex-start;
flex-wrap: wrap;
}
.firmware-row .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
/* flash area */
.flash-area { margin-top: 8px; }
.flash-status {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
min-height: 40px;
margin-bottom: 4px;
}
.flash-status .status-text { font-size: 15px; font-weight: 600; }
.flash-status .status-text.err { color: var(--danger); }
.flash-status .status-text.ok { color: var(--ok); }
.spinner {
width: 18px;
height: 18px;
border: 3px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.open-obi-btn {
display: block;
text-align: center;
background: var(--ok);
border: 1px solid var(--ok);
color: #fff;
font-size: 16px;
font-weight: 700;
padding: 13px 26px;
border-radius: var(--radius);
text-decoration: none;
margin-top: 16px;
}
.open-obi-btn:hover { background: var(--ok); filter: brightness(1.1); }
.open-obi-btn[hidden] { display: none; }
/* details / log */
.advanced {
margin-top: 16px;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 12px 14px;
}
.advanced > summary {
cursor: pointer;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-dim);
user-select: none;
}
.advanced > summary:hover { color: var(--text); }
.advanced .advanced-body { margin-top: 12px; }
.requirements-note {
margin-top: 16px;
font-size: 13px;
color: var(--text-dim);
text-align: center;
}
.requirements-note a { color: var(--accent); }
/* ============================================================
Aurora / glass UI layer: firmware uploader (ui-flashy branch).
============================================================ */
.flash-card {
background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
var(--grad-soft) border-box;
border: 1px solid transparent;
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
box-shadow: 0 18px 50px -28px var(--glow-1);
}
.flow-connector { background: color-mix(in srgb, var(--border) 85%, transparent); }
.flow-item.active .flow-dot {
background: var(--grad);
border-color: transparent;
color: #fff;
box-shadow: 0 0 14px var(--glow-1);
animation: dot-pulse 2.4s ease-in-out infinite;
}
.flow-item.done .flow-dot {
background: linear-gradient(120deg, var(--ok), #34d399);
border-color: transparent;
color: #fff;
box-shadow: 0 0 14px color-mix(in srgb, var(--ok) 55%, transparent);
}
.flow-item.done + .flow-connector {
background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
}
.board-option {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
transition: transform 0.25s var(--ease-out), border-color 0.25s ease,
box-shadow 0.3s ease, background 0.25s ease;
}
.board-option:hover {
transform: translateY(-3px);
border-color: color-mix(in srgb, var(--accent-2) 55%, transparent);
}
.board-option.selected {
border-color: transparent;
background: linear-gradient(
color-mix(in srgb, var(--row-selected) 70%, transparent),
color-mix(in srgb, var(--row-selected) 70%, transparent)) padding-box,
var(--grad-soft) border-box;
box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 40%, transparent),
0 10px 26px -16px var(--glow-1);
}
.spinner {
border-color: color-mix(in srgb, var(--border) 55%, transparent);
border-top-color: var(--accent-2);
box-shadow: 0 0 10px var(--glow-1);
}
.open-obi-btn {
background: linear-gradient(120deg, var(--ok), #2dd4bf);
border: none;
box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--ok) 60%, transparent);
transition: transform 0.2s var(--ease-out), box-shadow 0.3s ease;
}
.open-obi-btn:hover {
background: linear-gradient(120deg, #34d399, #2dd4bf);
filter: none;
transform: translateY(-1px);
box-shadow: 0 14px 32px -14px color-mix(in srgb, var(--ok) 70%, transparent);
}
.advanced {
background: var(--glass);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-color: color-mix(in srgb, var(--border) 80%, transparent);
}
@keyframes dot-pulse {
0%, 100% { box-shadow: 0 0 0 0 var(--glow-1); }
50% { box-shadow: 0 0 0 7px transparent; }
}
+3
View File
@@ -0,0 +1,3 @@
node_modules/
release/
site/
+43
View File
@@ -0,0 +1,43 @@
appId: org.openbatteryinformation.desktop
productName: Open Battery Information
copyright: "Copyright © 2026 Open Battery Information — GPL-3.0"
directories:
output: release
files:
- main.js
- preload.js
- preload-picker.js
- site/**/*
asar: true
asarUnpack:
- "**/*.node"
win:
target:
- nsis
artifactName: "Open-Battery-Information-${version}-setup-${arch}.${ext}"
nsis:
oneClick: false
perMachine: false
allowToChangeInstallationDirectory: true
shortcutName: Open Battery Information
mac:
target:
- dmg
- zip
category: public.app-category.utilities
artifactName: "Open-Battery-Information-${version}-mac-${arch}.${ext}"
linux:
target:
- AppImage
- deb
category: Utility
maintainer: Open Battery Information
artifactName: "Open-Battery-Information-${version}-linux-${arch}.${ext}"
+285
View File
@@ -0,0 +1,285 @@
/* Open Battery Information — Electron main process.
Loads the OBI-1 page and provides native serial access through the
`serialport` package (no browser Web Serial needed). The renderer talks
to the serial port over IPC via the preload bridge and a small
navigator.serial shim. Everything stays local; no telemetry. */
const { app, BrowserWindow, Menu, ipcMain, shell } = require('electron');
const path = require('path');
process.on('uncaughtException', (err) => {
console.error('[main] uncaughtException:', err);
});
process.on('unhandledRejection', (reason) => {
console.error('[main] unhandledRejection:', reason);
});
let SerialPort = null;
try {
({ SerialPort } = require('serialport'));
console.log('[main] serialport loaded');
} catch (err) {
console.error('[main] serialport failed to load:', err.message);
}
const SITE_DIR = path.join(__dirname, 'site');
const openPorts = new Map(); // port path -> { port, sender }
let pickerPromise = null;
/* ---------- serialport helpers ---------- */
function toPortInfo(p) {
return {
path: p.path,
vendorId: p.vendorId ? parseInt(p.vendorId, 16) : 0,
productId: p.productId ? parseInt(p.productId, 16) : 0,
manufacturer: p.manufacturer || '',
serialNumber: p.serialNumber || '',
};
}
function openPort(info, baudRate) {
return new Promise((resolve, reject) => {
const port = new SerialPort(
{ path: info.path, baudRate: baudRate || 9600 },
(err) => (err ? reject(err) : resolve(port))
);
port.on('error', () => {});
});
}
/* ---------- IPC: serial ---------- */
ipcMain.handle('serial:list', async () => {
const list = await SerialPort.list();
return list.map(toPortInfo);
});
ipcMain.handle('serial:requestPort', async (event) => {
const win = BrowserWindow.fromWebContents(event.sender);
const info = await showPortPicker(win);
if (!info) throw new Error('NotFoundError: No port selected');
return info;
});
ipcMain.handle('serial:open', async (event, info, baudRate) => {
const existing = openPorts.get(info.path);
if (existing && existing.port.isOpen) return { ok: true };
const port = await openPort(info, baudRate);
port.on('data', (buf) => {
const entry = openPorts.get(info.path);
if (entry && entry.sender && !entry.sender.isDestroyed()) {
entry.sender.send('serial:data', info.path, buf);
}
});
port.on('close', () => openPorts.delete(info.path));
openPorts.set(info.path, { port, sender: event.sender });
return { ok: true };
});
ipcMain.handle('serial:setSignals', async (_event, info, dtr) => {
const entry = openPorts.get(info.path);
if (!entry) throw new Error('Serial port is not open');
await new Promise((resolve, reject) =>
entry.port.set({ dtr: !!dtr }, (err) => (err ? reject(err) : resolve()))
);
return { ok: true };
});
ipcMain.handle('serial:write', async (_event, info, data) => {
const entry = openPorts.get(info.path);
if (!entry) throw new Error('Serial port is not open');
await new Promise((resolve, reject) =>
entry.port.write(Buffer.from(data), (err) => (err ? reject(err) : resolve()))
);
return { ok: true };
});
ipcMain.handle('serial:close', async (_event, info) => {
const entry = openPorts.get(info.path);
if (!entry) return { ok: true };
openPorts.delete(info.path);
await new Promise((resolve) => entry.port.close(() => resolve()));
return { ok: true };
});
/* ---------- serial port picker ---------- */
const escapeHtml = (s) =>
String(s).replace(/[&<>"']/g, (c) =>
({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c])
);
const PICKER_HTML = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, sans-serif; background: #1e1f22; color: #e6e6e6; padding: 20px; }
h1 { font-size: 16px; margin: 0 0 4px; }
p.sub { margin: 0 0 16px; color: #9b9b9b; font-size: 13px; }
.port { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #333; border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.port:hover { border-color: #5f9bff; }
.port input { margin: 0; }
.path { font-weight: 600; font-family: ui-monospace, monospace; }
.meta { margin-left: auto; color: #9b9b9b; font-size: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
button { padding: 8px 16px; border-radius: 8px; border: 1px solid #333; background: #2a2b2e; color: #e6e6e6; font: inherit; cursor: pointer; }
button.primary { background: #3d7eff; border-color: #3d7eff; }
button.primary:disabled { opacity: 0.5; cursor: default; }
.empty { color: #9b9b9b; padding: 20px 0; text-align: center; }
</style>
</head>
<body>
<h1>Select a serial port</h1>
<p class="sub">Choose the Arduino running the OBI firmware.</p>
<form id="form">__ROWS__</form>
<div class="actions">
<button id="cancel" type="button">Cancel</button>
<button id="connect" class="primary" type="button" disabled>Connect</button>
</div>
<script>
const radios = document.querySelectorAll('input[name="port"]');
const connect = document.getElementById('connect');
const cancel = document.getElementById('cancel');
const form = document.getElementById('form');
form.addEventListener('change', () => { connect.disabled = !document.querySelector('input[name="port"]:checked'); });
connect.addEventListener('click', () => {
const sel = document.querySelector('input[name="port"]:checked');
if (sel) window.picker.select(sel.value);
});
cancel.addEventListener('click', () => window.picker.cancel());
window.addEventListener('keydown', (e) => { if (e.key === 'Escape') window.picker.cancel(); });
</script>
</body>
</html>`;
function showPortPicker(parent) {
if (pickerPromise) return pickerPromise;
pickerPromise = (async () => {
let list = [];
try {
list = await SerialPort.list();
} catch (e) {
list = [];
}
if (!list.length) return null;
return await new Promise((resolve) => {
const picker = new BrowserWindow({
parent,
modal: true,
width: 540,
height: 440,
resizable: false,
autoHideMenuBar: true,
title: 'Select a serial port',
backgroundColor: '#1e1f22',
webPreferences: {
preload: path.join(__dirname, 'preload-picker.js'),
contextIsolation: true,
nodeIntegration: false,
},
});
const rows = list
.map(
(p) =>
'<label class="port"><input type="radio" name="port" value="' +
escapeHtml(p.path) +
'"><span class="path">' +
escapeHtml(p.path) +
'</span><span class="meta">' +
escapeHtml(
[p.manufacturer, p.serialNumber ? 'S/N ' + p.serialNumber : '']
.filter(Boolean)
.join(' · ')
) +
'</span></label>'
)
.join('');
ipcMain.once('picker:select', (_e, pickedPath) => {
const info = list.find((p) => p.path === pickedPath);
if (picker && !picker.isDestroyed()) picker.close();
resolve(info ? toPortInfo(info) : null);
});
ipcMain.once('picker:cancel', () => {
if (picker && !picker.isDestroyed()) picker.close();
resolve(null);
});
picker.on('closed', () => resolve(null));
picker.loadURL(
'data:text/html;charset=utf-8,' +
encodeURIComponent(PICKER_HTML.replace('__ROWS__', rows))
);
picker.once('ready-to-show', () => picker.show());
});
})().finally(() => {
pickerPromise = null;
});
return pickerPromise;
}
/* ---------- window ---------- */
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 820,
minWidth: 900,
minHeight: 600,
autoHideMenuBar: true,
backgroundColor: '#1e1f22',
title: 'OBI-1 · Open Battery Information',
show: false,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
},
});
win.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('http')) shell.openExternal(url);
return { action: 'deny' };
});
win.webContents.on('did-fail-load', (_e, code, desc, url) => {
console.error('[main] did-fail-load', code, desc, url);
});
const target = path.join(SITE_DIR, 'obi.html');
console.log('[main] loading', target);
win.loadFile(target).then(
() => console.log('[main] page loaded'),
(err) => console.error('[main] loadFile failed:', err)
);
win.once('ready-to-show', () => {
console.log('[main] window ready-to-show');
win.show();
});
return win;
}
app.whenReady().then(() => {
console.log('[main] app ready');
if (process.platform !== 'darwin') {
Menu.setApplicationMenu(null);
}
try {
createWindow();
console.log('[main] window created');
} catch (err) {
console.error('[main] createWindow failed:', err);
}
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
+4085
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
{
"name": "open-battery-information-desktop",
"productName": "Open Battery Information",
"version": "1.0.7",
"description": "Desktop build of the Open Battery Information OBI-1 tool — native serial battery diagnosis for Windows, macOS and Linux.",
"main": "main.js",
"license": "GPL-3.0",
"author": "Open Battery Information",
"homepage": "https://openbatteryinformation.github.io/",
"dependencies": {
"serialport": "^12.0.0"
},
"scripts": {
"prepare:site": "node scripts/prepare-site.mjs",
"start": "node scripts/prepare-site.mjs && electron .",
"dist": "node scripts/prepare-site.mjs && electron-builder",
"dist:win": "node scripts/prepare-site.mjs && electron-builder --win",
"dist:mac": "node scripts/prepare-site.mjs && electron-builder --mac",
"dist:linux": "node scripts/prepare-site.mjs && electron-builder --linux"
},
"devDependencies": {
"electron": "^30.0.0",
"electron-builder": "^24.13.3"
}
}
+7
View File
@@ -0,0 +1,7 @@
/* Preload for the serial port picker window. */
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('picker', {
select: (portPath) => ipcRenderer.send('picker:select', portPath),
cancel: () => ipcRenderer.send('picker:cancel'),
});
+27
View File
@@ -0,0 +1,27 @@
/* Electron preload — bridges native serial access to the renderer.
The page's serial-shim.js surfaces this through the navigator.serial API
the OBI code already uses. */
const { contextBridge, ipcRenderer } = require('electron');
function toInfo(info) {
return {
path: info.path,
vendorId: info.vendorId || 0,
productId: info.productId || 0,
manufacturer: info.manufacturer || '',
serialNumber: info.serialNumber || '',
};
}
contextBridge.exposeInMainWorld('serialAPI', {
requestPort: () => ipcRenderer.invoke('serial:requestPort').then(toInfo),
open: (info, baudRate) => ipcRenderer.invoke('serial:open', toInfo(info), baudRate),
close: (info) => ipcRenderer.invoke('serial:close', toInfo(info)),
setSignals: (info, dtr) => ipcRenderer.invoke('serial:setSignals', toInfo(info), dtr),
write: (info, bytes) => ipcRenderer.invoke('serial:write', toInfo(info), bytes),
onData: (cb) => {
const listener = (_e, portPath, data) => cb(portPath, data);
ipcRenderer.on('serial:data', listener);
return () => ipcRenderer.removeListener('serial:data', listener);
},
});
+49
View File
@@ -0,0 +1,49 @@
/* Builds desktop/site: a self-contained copy of just the OBI-1 page.
Only the files obi.html references are copied. The nav is trimmed to the
theme toggle (no links to pages that aren't bundled) and the Web Serial
shim is injected so native serialport works through the OBI code. */
import { cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ROOT = path.resolve(__dirname, '..', '..');
const SITE = path.join(__dirname, '..', 'site');
const CSS_FILES = ['style.css', 'tool.css'];
const JS_FILES = ['theme.js', 'reveal.js', 'common.js', 'obi.js'];
await rm(SITE, { recursive: true, force: true });
await mkdir(path.join(SITE, 'css'), { recursive: true });
await mkdir(path.join(SITE, 'js', 'modules'), { recursive: true });
await mkdir(path.join(SITE, 'js', 'interfaces'), { recursive: true });
/* ---- obi.html, transformed for the desktop bundle ---- */
const source = await readFile(path.join(ROOT, 'obi.html'), 'utf8');
let html = source;
html = html.replace(
'<script src="js/theme.js"></script>',
'<script src="js/theme.js"></script>\n <script src="js/serial-shim.js"></script>'
);
html = html.replace(
'<a class="brand" href="index.html">',
'<a class="brand" href="obi.html">'
);
html = html.replace(
/(<div class="nav-links">)([\s\S]*?)(<\/div>)/,
(_m, open, inner, close) => open + inner.replace(/<a [\s\S]*?<\/a>/g, '') + close
);
await writeFile(path.join(SITE, 'obi.html'), html);
/* ---- shared assets ---- */
for (const file of CSS_FILES) {
await cp(path.join(ROOT, 'css', file), path.join(SITE, 'css', file));
}
for (const file of JS_FILES) {
await cp(path.join(ROOT, 'js', file), path.join(SITE, 'js', file));
}
await cp(path.join(ROOT, 'js', 'modules', 'makita_lxt.js'), path.join(SITE, 'js', 'modules', 'makita_lxt.js'));
await cp(path.join(ROOT, 'js', 'interfaces', 'arduino_obi.js'), path.join(SITE, 'js', 'interfaces', 'arduino_obi.js'));
await cp(path.resolve(__dirname, '..', 'serial-shim.js'), path.join(SITE, 'js', 'serial-shim.js'));
console.log(`OBI-only site prepared in ${SITE}`);
+99
View File
@@ -0,0 +1,99 @@
/* Desktop-only Web Serial shim.
In the Electron app, the main process owns the serial port (via the
`serialport` package) and streams bytes over IPC. This file re-exposes
that transport through the same navigator.serial API the OBI web code
uses, so js/common.js and js/interfaces/arduino_obi.js run unchanged. */
(function () {
"use strict";
if (!window.serialAPI) return;
const api = window.serialAPI;
class DesktopSerialPort {
constructor(info) {
this._info = info;
this._open = false;
this._stream = null;
this._controller = null;
this._queue = [];
this._unsubscribe = null;
}
getInfo() {
return {
usbVendorId: this._info.vendorId || 0,
usbProductId: this._info.productId || 0,
};
}
isOpen() {
return this._open;
}
async open(options) {
if (this._open) return;
await api.open(this._info, (options && options.baudRate) || 9600);
this._open = true;
this._unsubscribe = api.onData((portPath, buf) => {
if (portPath !== this._info.path) return;
const data = new Uint8Array(buf);
if (this._controller) this._controller.enqueue(data);
else this._queue.push(data);
});
}
get readable() {
if (!this._open) throw new Error('InvalidStateError: port not open');
if (!this._stream) {
this._stream = new ReadableStream({
start: (controller) => {
this._controller = controller;
for (const chunk of this._queue) controller.enqueue(chunk);
this._queue = [];
},
cancel: () => {
this._controller = null;
},
});
}
return this._stream;
}
get writable() {
if (!this._open) throw new Error('InvalidStateError: port not open');
return new WritableStream({
write: (chunk) =>
api.write(
this._info,
chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk)
),
});
}
async setSignals(signals) {
await api.setSignals(this._info, !!(signals && signals.dataTerminalReady));
}
async close() {
await api.close(this._info);
if (this._unsubscribe) this._unsubscribe();
this._unsubscribe = null;
this._open = false;
}
async forget() {}
}
Object.defineProperty(navigator, 'serial', {
configurable: true,
enumerable: true,
value: {
getPorts: async () => [],
requestPort: async () => {
const info = await api.requestPort();
return new DesktopSerialPort(info);
},
},
});
})();
+219
View File
@@ -0,0 +1,219 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Download the Open Battery Information desktop app for Windows, macOS and Linux — a self-contained build of the OBI-1 tool with native serial-port access, no browser needed.">
<title>Download — Open Battery Information</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/landing.css">
<link rel="stylesheet" href="css/download.css">
<script src="js/theme.js"></script>
<script src="js/reveal.js" defer></script>
</head>
<body>
<nav class="navbar">
<a class="brand" href="index.html">Open Battery <span class="accent">Information</span></a>
<button id="nav-toggle" class="nav-toggle" type="button" aria-label="Open navigation menu" aria-expanded="false">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<div class="nav-links">
<a href="index.html">Home</a>
<a href="setup.html">Get started</a>
<a href="firmware/uploader.html">Flash firmware</a>
<a href="obi.html">OBI-1</a>
<a href="download.html" class="active">Download</a>
<a class="nav-icon" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io" target="_blank" rel="noopener" aria-label="View source on GitHub"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a>
<button id="theme-toggle" class="theme-toggle" type="button" aria-label="Switch to light mode">
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</button>
</div>
</nav>
<header class="hero">
<h1>Get the desktop app for your <span class="accent">platform</span></h1>
<p class="tagline">
The same OBI-1 experience as the browser version, wrapped in a self-contained
app for Windows, macOS and Linux. No browser needed — serial access is built in.
Nothing leaves your machine.
</p>
<div class="hero-actions">
<a href="#platforms"><button class="primary btn-lg">Download now</button></a>
<a href="obi.html"><button class="btn-lg">Try it in the browser</button></a>
</div>
<p class="hero-note"><span id="latest-version">Checking for the latest release…</span></p>
</header>
<main>
<section class="section" id="platforms">
<h2>Pick your platform</h2>
<p class="section-sub">Installers are built automatically from this repository for every release.</p>
<div class="feature-grid download-grid">
<div class="feature-card download-card" data-platform="win">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4l7-1v7H4z"/><path d="M4 13h7v7l-7-1z"/><path d="M13 3l7 1v6h-7z"/><path d="M13 11h7v6l-7 1z"/></svg></span>
<h3>Windows</h3>
<p>NSIS installer for Windows 10 and 11. Works with the same Arduino and USB drivers as the web version.</p>
<a class="download-btn primary" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io/releases/latest" data-asset="setup" download>Download for Windows</a>
<span class="download-meta">64-bit · <span class="download-asset">.exe</span></span>
</div>
<div class="feature-card download-card" data-platform="mac">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2C7.5 2 3 5.5 3 10c0 5 4 8 9 12 5-4 9-7 9-12 0-4.5-4.5-8-9-8z"/><circle cx="12" cy="10" r="3"/></svg></span>
<h3>macOS</h3>
<p>Apple-silicon and Intel builds packaged as a DMG. Right-click → Open the first time to bypass Gatekeeper.</p>
<a class="download-btn primary" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io/releases/latest" data-asset="mac" download>Download for macOS</a>
<span class="download-meta">Intel + Apple Silicon · <span class="download-asset">.dmg</span></span>
</div>
<div class="feature-card download-card" data-platform="linux">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="4" r="2"/><path d="M12 6v8"/><path d="M8 10h8l-2 9a2 2 0 0 1-2 1.3A2 2 0 0 1 10 19z"/></svg></span>
<h3>Linux</h3>
<p>AppImage for any distro plus a .deb for Debian/Ubuntu. Serial access is native, so no browser setup needed.</p>
<a class="download-btn primary" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io/releases/latest" data-asset="linux" download>Download for Linux</a>
<span class="download-meta">AppImage + deb · <span class="download-asset">.AppImage</span></span>
</div>
</div>
</section>
<section class="section">
<h2>Why the desktop app?</h2>
<p class="section-sub">Same hardware, same tool — with fewer steps to get going.</p>
<div class="steps">
<div class="step">
<span class="step-num"></span>
<h3>No browser needed</h3>
<p>Serial access is built straight into the app, so there's nothing to install or configure first. Just run it and connect.</p>
</div>
<div class="step">
<span class="step-num"></span>
<h3>Offline and private</h3>
<p>The app bundles the OBI-1 page itself. It works without internet, and your battery data never leaves your machine.</p>
</div>
<div class="step">
<span class="step-num"></span>
<h3>Always up to date</h3>
<p>Downloads come from GitHub Releases. Every new tag builds fresh installers in CI, so you always grab the latest firmware.</p>
</div>
</div>
</section>
<section class="section">
<div class="card">
<h2>System requirements</h2>
<ul class="req-list">
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg></span>
<span><span class="req-title">An Arduino Uno with a USB cable</span>
<span class="req-detail">The desktop app talks to the board over a native serial connection, so the same genuine-or-compatible Uno with the optiboot bootloader is required.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="16" height="10" x="2" y="7" rx="2" ry="2"/><line x1="22" x2="22" y1="11" y2="13"/></svg></span>
<span><span class="req-title">A supported battery</span>
<span class="req-detail">Currently the Makita LXT 18 V packs (BL18xx / BL14xx) via the Arduino OBI interface, matching the web version.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/></svg></span>
<span><span class="req-title">Open source</span>
<span class="req-detail">Everything is GPL-3.0 licensed. Build it yourself from source any time — instructions are in the README.</span></span>
</li>
</ul>
</div>
</section>
<section class="section">
<div class="warning">
<h3><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg> Note about macOS Gatekeeper</h3>
<p>
The macOS build is not notarized with Apple, so the first launch shows a "cannot verify developer" warning.
Right-click the app and choose <strong>Open</strong>, then confirm. If you prefer, build it yourself from
source with your own signing identity.
</p>
</div>
</section>
<section class="section">
<h2>Frequently asked questions</h2>
<p class="section-sub">About the desktop build.</p>
<details class="faq">
<summary>Is the desktop app different from the browser version?</summary>
<div class="faq-body">
Functionally it's the same code, packaged with Electron. The only real difference is that serial access is
native — no browser or secure HTTPS page required — and the page ships bundled with the app.
</div>
</details>
<details class="faq">
<summary>Why is there no installer for my architecture?</summary>
<div class="faq-body">
Installers are built in CI for the main targets: Windows x64, macOS (Intel and Apple Silicon) and Linux
x64. If you need something else, open an issue or build from source — it takes one command.
</div>
</details>
<details class="faq">
<summary>Do I still need to flash the Arduino firmware?</summary>
<div class="faq-body">
Yes. The desktop app bundles the same <a href="firmware/uploader.html">firmware uploader</a> as the web
version — open the "Flash firmware" page inside the app, plug in the Uno and flash. The newest firmware
ships with each release.
</div>
</details>
<details class="faq">
<summary>How are the installers built?</summary>
<div class="faq-body">
Every tagged release triggers a GitHub Actions workflow that packages the app on Windows, macOS and Linux
runners and attaches the installers to the release. Build logs are public.
</div>
</details>
</section>
</main>
<footer class="site-footer">
<p><strong>Open Battery Information</strong> — an open-source web port of the
<a href="https://github.com/mnh-jansson/open-battery-information">open-battery-information</a> project.</p>
<p>Released under the GPL-3.0 license. Independent project, not affiliated with Makita.</p>
<p><a href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io/releases">All releases</a> · <a href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io">Source code</a></p>
</footer>
<script>
(function () {
const RELEASES_PAGE = 'https://github.com/OpenBatteryInformation/openbatteryinformation.github.io/releases/latest';
const API_URL = 'https://api.github.com/repos/OpenBatteryInformation/openbatteryinformation.github.io/releases/latest';
function pickAsset(assets, kind) {
if (!Array.isArray(assets)) return null;
let picks;
if (kind === 'win') {
picks = assets.filter((a) => /\.exe$/i.test(a.name));
} else if (kind === 'mac') {
picks = assets.filter((a) => /\.dmg$/i.test(a.name));
} else {
picks = assets.filter((a) => /\.AppImage$/i.test(a.name));
}
return picks.length ? picks[0] : null;
}
fetch(API_URL)
.then((res) => (res.ok ? res.json() : Promise.reject(new Error(String(res.status)))))
.then((release) => {
const version = release.tag_name || release.name || '';
const badge = document.getElementById('latest-version');
if (badge) {
badge.textContent = version
? 'Latest release: ' + version + (release.published_at ? ' · ' + new Date(release.published_at).toLocaleDateString() : '')
: 'Latest release ready to download.';
}
document.querySelectorAll('.download-card').forEach((card) => {
const kind = card.dataset.platform;
const asset = pickAsset(release.assets, kind);
const link = card.querySelector('.download-btn');
if (!asset) return;
link.href = asset.browser_download_url;
link.setAttribute('download', asset.name);
});
})
.catch(() => {
const badge = document.getElementById('latest-version');
if (badge) badge.textContent = 'Downloads are published to GitHub Releases.';
});
})();
</script>
</body>
</html>
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+24653
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
+213
View File
@@ -0,0 +1,213 @@
:100000000C9462000C948A000C948A000C948A0070
:100010000C948A000C948A000C948A000C948A0038
:100020000C948A000C948A000C948A000C948A0028
:100030000C948A000C948A000C948A000C948A0018
:100040000C94A4040C948A000C9414050C94EE04F3
:100050000C948A000C948A000C948A000C948A00F8
:100060000C948A000C948A00000000080002010031
:100070000003040700000000000000000000000072
:10008000250028002B0000000000240027002A0083
:1000900000000000230026002900040404040404D6
:1000A0000404020202020202030303030303010227
:1000B00004081020408001020408102001020408F6
:1000C0001020460511241FBECFEFD8E0DEBFCDBF04
:1000D00011E0A0E0B1E0E6E1FDE002C005900D9284
:1000E000A231B107D9F721E0A2E1B1E001C01D9230
:1000F000A63CB207E1F710E0C2E6D0E004C02197C9
:10010000FE010E948306C136D107C9F70E94D705B8
:100110000C9489060C940000EF92FF920F931F93AA
:10012000CF93DF9328E030E080E041E0A3E2B0E04D
:100130009FECE92EF12C9091B801E091B901F0917A
:10014000BA01F8945181592B51836281792F7095AE
:10015000672362838D01ED012197F1F751815723C8
:100160005183E8012197F1F750817894F701319795
:10017000F1F7952309F0842B440F21503109D9F66A
:10018000DF91CF911F910F91FF90EF900895CF9243
:10019000DF92EF92FF920F931F93CF93DF9328E0AC
:1001A00030E041E06BE871E093E7C92ED12CCBE25F
:1001B000D0E00BED11E09091B801E091B901F09120
:1001C000BA01F92EF094582F542389F1F8945281F2
:1001D0005F2152835181592B5183DE011197F1F731
:1001E0005281952B92837894F8013197F1F7440F5F
:1001F0002150310901F7F894E091B901F091BA0169
:1002000091818091B801809598239183E091B90103
:10021000F091BA019281892382837894DF91CF9102
:100220001F910F91FF90EF90DF90CF900895F89479
:1002300052815F2152835181592B5183DB011197E8
:10024000F1F75281952B92837894F601CECF80916D
:10025000B801E091B901F091BA01F8949181282F89
:1002600020959223918378943DE743E050E031500C
:1002700029F1DA011197F1F790819823C1F3F894ED
:100280009281922392839181982B91837894A3EB0E
:10029000BBE01197F1F7F894918192239183A3E148
:1002A000B1E01197F1F79081982381E009F080E0A7
:1002B0007894E3E6F6E03197F1F7089580E0089549
:1002C000E0E7F0E02491E6EBF0E09491E2EAF0E080
:1002D000E491EE23C9F0222339F0233001F1A8F490
:1002E000213019F1223029F1F0E0EE0FFF1FE45820
:1002F000FF4FA591B4912FB7F894EC91811126C0CE
:1003000090959E239C932FBF08952730A9F0283005
:10031000C9F0243049F7209180002F7D03C020913F
:1003200080002F7720938000DFCF24B52F7724BD66
:10033000DBCF24B52F7DFBCF2091B0002F7720930A
:10034000B000D2CF2091B0002F7DF9CF9E2BDACF15
:100350003FB7F8948091170190911801A09119016D
:10036000B0911A0126B5A89B05C02F3F19F0019640
:10037000A11DB11D3FBFBA2FA92F982F8827BC01FF
:10038000CD01620F711D811D911D42E0660F771F27
:10039000881F991F4A95D1F708958F929F92AF9227
:1003A000BF92CF92DF92EF92FF920E94A8014B0181
:1003B0005C0180E9C82EDD24D394E12CF12C0E944D
:1003C000A801681979098A099B09683E734081056B
:1003D0009105A8F321E0C21AD108E108F10888EEDE
:1003E000880E83E0981EA11CB11CC114D104E10445
:1003F000F10429F7FF90EF90DF90CF90BF90AF907E
:100400009F908F900895AF92BF92CF92DF92EF921C
:10041000FF920F931F93CF93DF936C017B018B01AE
:10042000040F151FEB015E01AE18BF08C017D107FE
:1004300059F06991D601ED91FC910190F081E02D88
:10044000C6010995892B79F7C501DF91CF911F91DD
:100450000F91FF90EF90DF90CF90BF90AF900895F5
:10046000FC01538D448D252F30E0842F90E0821BBA
:10047000930B541710F0CF96089501970895FC013F
:10048000918D828D981761F0A28DAE0FBF2FB11D97
:100490005D968C91928D9F5F9F73928F90E00895EF
:1004A0008FEF9FEF0895FC01918D828D981731F0A9
:1004B000828DE80FF11D858D90E008958FEF9FEFFD
:1004C0000895FC01918D228D892F90E0805C9F4FD3
:1004D000821B91098F73992708958BE191E00E9407
:1004E000610221E0892B09F420E0822F089580E049
:1004F00090E0892B29F00E946D0281110C9400007C
:100500000895FC01A48DA80FB92FB11DA35ABF4FA8
:100510002C91848D90E001968F739927848FA68902
:10052000B7892C93A089B1898C91837080648C9356
:10053000938D848D981306C00288F389E02D808105
:100540008F7D80830895EF92FF920F931F93CF9337
:10055000DF93EC0181E0888F9B8D8C8D98131AC0FE
:10056000E889F989808185FF15C09FB7F894EE89E5
:10057000FF896083E889F989808183708064808342
:100580009FBF81E090E0DF91CF911F910F91FF908D
:10059000EF900895F62E0B8D10E00F5F1F4F0F7335
:1005A0001127E02E8C8D8E110CC00FB607FCFACFF0
:1005B000E889F989808185FFF5CFCE010E9481020B
:1005C000F1CFEB8DEC0FFD2FF11DE35AFF4FF082C1
:1005D0009FB7F8940B8FEA89FB8980818062CFCF27
:1005E000CF93DF93EC01888D8823B9F0AA89BB896A
:1005F000E889F9898C9185FD03C0808186FD0DC055
:100600000FB607FCF7CF8C9185FFF2CF808185FF75
:10061000EDCFCE010E948102E9CFDF91CF91089505
:100620005F926F927F928F929F92AF92BF92CF9282
:10063000DF92EF92FF920F931F93CF93DF93CDB78B
:10064000DEB7CE5FD1400FB6F894DEBF0FBECDBF90
:100650008BE191E00E943F027C018BE191E00E94DE
:100660003F028C01582E8BE191E00E943F023C0139
:10067000EE20D9F0CE0101965C016C01470199246E
:10068000C6018A199B09881599057CF48BE191E0D4
:100690000E94610218161906CCF78BE191E00E94C6
:1006A0003F02F60181936F01EBCF81E00E94600170
:1006B0000E94CD01C30199278233910509F4A3C09B
:1006C0004CF48130910509F43EC0C19709F465C02E
:1006D000512C4AC08333910509F4B2C08C3C91057A
:1006E000B9F70E9427018BE396E00197F1F78CECB4
:1006F0000E94C700CE0101965C016C01FF2493E6C5
:10070000892E99249394C6018A199B098E159F05F9
:100710000CF4F8C06E01D3947601112783E6A82E5D
:10072000BB24B394C7018C199D0980179107E4F489
:10073000C5010197F1F70E948C00F7018283FFEF5A
:10074000EF1AFF0AEFCFCE5FDE4F1882C250D140C2
:1007500082E0CD5FDE4F8883C350D14081E0CC5F23
:10076000DE4F8883C450D1407E01F394F70160824C
:100770005182539453946701052D10E0C6018E19E0
:100780009F09801791070CF0C6C0F60161916F01B7
:100790008BE191E00E94A302F1CF0E942701ABE31D
:1007A000EA2EA6E0FA2EC7010197F1F78CEC0E9421
:1007B000C70003E611E0C8010197F1F789E90E943B
:1007C000C7000E94CD010E942701C7010197F1F7E0
:1007D00081E30E94C700C8010197F1F70E948C00D5
:1007E000CD5FDE4F8883C350D140C8010197F1F738
:1007F0000E948C00CE5FDE4F8883C250D140C8017A
:100800000197F1F7B1CF0E942701FBE3EF2EF6E04D
:10081000FF2EC7010197F1F78CEC0E94C70003E699
:1008200011E0C8010197F1F789E90E94C7000E9411
:10083000CD010E942701C7010197F1F782E3C9CFDB
:100840000E9427018BE396E00197F1F783E30E9472
:10085000C700C12CDD24D394CC0EDD1EF2E0CF0EF8
:10086000D11CA12CBB24B394AC0EBD1E8AE0A80EF3
:10087000B11CE3E68E2E99249394C4010197F1F7FD
:100880000E948C00F60181936F01AE16BF06A9F796
:10089000CE0101965C016C01FF2453E6852E99245C
:1008A0009394C6018A199B098E159F0514F1E12CBA
:1008B000FF24F394EC0EFD1E9AE0E90EF11C38E0E3
:1008C000C32ED12C1127095F1F4F43E6A42EBB2452
:1008D000B3940C151D050CF447CFC5010197F1F732
:1008E0000E948C00F70181937F01FFEFCF1ADF0A8E
:1008F000F0CFC4010197F1F7F60181916F010E94D9
:10090000C700CFCFC4010197F1F7F60181916F01C4
:100910000E94C700F8CE80E0C250DE4F0FB6F894B8
:10092000DEBF0FBECDBFDF91CF911F910F91FF9022
:10093000EF90DF90CF90BF90AF909F908F907F907F
:100940006F905F900C9460011F920F920FB60F9200
:1009500011242F933F938F939F93AF93BF938091D5
:10096000130190911401A0911501B09116013091DD
:10097000120123E0230F2D3758F50196A11DB11D5B
:10098000209312018093130190931401A0931501F9
:10099000B09316018091170190911801A09119014F
:1009A000B0911A010196A11DB11D8093170190937A
:1009B0001801A0931901B0931A01BF91AF919F91B3
:1009C0008F913F912F910F900FBE0F901F90189510
:1009D00026E8230F0296A11DB11DD2CF1F920F92C0
:1009E0000FB60F9211242F933F934F935F936F9302
:1009F0007F938F939F93AF93BF93EF93FF938BE17D
:100A000091E00E948102FF91EF91BF91AF919F9180
:100A10008F917F916F915F914F913F912F910F90A7
:100A20000FBE0F901F9018951F920F920FB60F9246
:100A300011242F938F939F93EF93FF93E0912B01BA
:100A4000F0912C018081E0913101F091320182FD21
:100A50001BC09081809134018F5F8F73209135018D
:100A6000821741F0E0913401F0E0E55EFE4F958F92
:100A700080933401FF91EF919F918F912F910F906F
:100A80000FBE0F901F9018958081F4CFCF93DF9306
:100A900010921E0110921D0188EE93E0A0E0B0E0DC
:100AA00080931F0190932001A0932101B093220114
:100AB00084E091E090931C0180931B0185EC90E011
:100AC000909328018093270184EC90E090932A0171
:100AD0008093290180EC90E090932C0180932B016E
:100AE00081EC90E090932E0180932D0182EC90E0B8
:100AF0009093300180932F0186EC90E09093320127
:100B00008093310110923401109235011092360118
:100B10001092370144EB50E0FA01649180EA90E0D2
:100B2000FC0124912223C1F030E0220F331FF90190
:100B3000EA57FF4FA591B491F901E458FF4FC591D1
:100B4000D4917FB7F8943C91262F209532233C9383
:100B50003881232328837FBFFA0144914093B80151
:100B6000FC018491E82FF0E0EE0FFF1FE057FF4FEC
:100B7000859194919093BA018093B9011092C30129
:100B80001092C5011092C4011092C2011092C101CD
:100B90001092C0011092BF011092BE011092BD01CF
:100BA0001092BC011092BB01DF91CF91089578940F
:100BB00084B5826084BD84B5816084BD85B5826062
:100BC00085BD85B5816085BD80916E008160809313
:100BD0006E0010928100809181008260809381007C
:100BE000809181008160809381008091800081608C
:100BF000809380008091B10084608093B1008091E7
:100C0000B00081608093B00080917A00846080930E
:100C10007A0080917A00826080937A0080917A00D5
:100C2000816080937A0080917A00806880937A0056
:100C30001092C100E0912B01F0912C0182E08083A1
:100C4000E0912701F09128011082E0912901F091B3
:100C50002A018FEC808310923301E0912F01F091F3
:100C6000300186E08083E0912D01F0912E0180819A
:100C700080618083E0912D01F0912E018081886058
:100C80008083E0912D01F0912E0180818068808326
:100C9000E0912D01F0912E0180818F7D8083E6EB24
:100CA000F0E02491E2EAF0E08491882399F090E06A
:100CB000880F991FFC01EA57FF4FA591B491FC01E1
:100CC000E458FF4F859194918FB7F894EC91E22B03
:100CD000EC938FBFC0E0D0E08BE191E00E94610215
:100CE000049744F08BE191E00E943F02813011F4BF
:100CF0000E941003209781F30E946D02882361F304
:100D00000E940000E9CFEE0FFF1F0590F491E02D47
:060D10000994F894FFCFE6
:100D160000000000A30203023002F00261023F025B
:020D2600530276
:00000001FF
+104
View File
@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Flash the Open Battery Information firmware to an Arduino Uno from your browser using AVRDUDE WebAssembly and Web Serial.">
<title>Flash firmware · Open Battery Information</title>
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/uploader.css">
<script src="../js/theme.js"></script>
<script src="../js/reveal.js" defer></script>
</head>
<body>
<nav class="navbar">
<a class="brand" href="../index.html">Open Battery <span class="accent">Information</span></a>
<button id="nav-toggle" class="nav-toggle" type="button" aria-label="Open navigation menu" aria-expanded="false">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<div class="nav-links">
<a href="../index.html">Home</a>
<a href="../setup.html">Get started</a>
<a href="uploader.html" class="active">Flash firmware</a>
<a href="../obi.html">OBI-1</a>
<a href="../download.html">Download</a>
<button id="theme-toggle" class="theme-toggle" type="button" aria-label="Switch to light mode">
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</button>
</div>
</nav>
<div class="uploader-wrap">
<header class="uploader-header">
<h1>Flash the firmware</h1>
<p class="subtitle">One click to put the Open Battery Information firmware on your Arduino — no IDE needed.</p>
</header>
<div class="flash-card">
<div class="flash-flow">
<div class="flow-item active" id="flow-1"><span class="flow-dot">1</span><span class="flow-label">Plug in</span></div>
<div class="flow-connector"></div>
<div class="flow-item" id="flow-2"><span class="flow-dot">2</span><span class="flow-label">Flash</span></div>
<div class="flow-connector"></div>
<div class="flow-item" id="flow-3"><span class="flow-dot">3</span><span class="flow-label">Done</span></div>
</div>
<div class="field">
<label>Your board</label>
<div class="board-grid">
<label class="board-option selected">
<input type="radio" name="board" value="uno" checked>
<span class="board-name">Arduino Uno</span>
<span class="board-desc">ATmega328P · optiboot @ 115200 baud</span>
</label>
<label class="board-option">
<input type="radio" name="board" value="esp32c3">
<span class="board-name">ESP32-C3</span>
<span class="board-desc">SuperMini · esptool @ 115200 baud</span>
</label>
</div>
</div>
<div class="flash-area">
<div class="flash-status">
<div class="spinner" id="spinner" hidden></div>
<span class="status-text" id="status-text">Ready. Plug in your Arduino and press the button.</span>
</div>
<button id="flash-btn" class="primary btn-lg btn-block">Flash firmware</button>
<div class="progress-track"><div class="bar" id="progress-bar"></div></div>
<a href="../obi.html" id="open-obi-btn" class="open-obi-btn" hidden>Continue to OBI-1 →</a>
</div>
<details class="advanced">
<summary>Advanced</summary>
<div class="advanced-body">
<div class="field">
<label>Firmware image</label>
<div class="firmware-row">
<label class="checkbox"><input type="radio" name="fw-source" value="bundled" checked>
Bundled firmware <span id="bundled-size"></span></label>
<label class="checkbox"><input type="radio" name="fw-source" value="local"> Custom .hex file</label>
<input type="file" id="hex-file" accept=".hex,.ihex,text/plain,application/octet-stream" disabled>
</div>
<div class="hint" id="firmware-name">
Uses firmware/uno.hex from this site, built automatically from the ArduinoOBI source.
</div>
</div>
<div class="field">
<label>Log</label>
<div class="log-output" id="log-output"></div>
</div>
</div>
</details>
</div>
<p class="requirements-note">
Works in <b>Chrome, Edge, Opera or Firefox</b> on desktop, over HTTPS or localhost. If something goes wrong,
open <b>Advanced</b> for the full log.
</p>
</div>
<script type="module" src="uploader.js?v=6"></script>
</body>
</html>
+491
View File
@@ -0,0 +1,491 @@
/* Firmware uploader — single-button wizard.
Runs AVRDUDE compiled to WebAssembly (from the leaphy-robotics
avrdude-webassembly package) and talks to the bootloader over Web Serial.
The wasm serial layer was rewritten (see avrdude.js glue) to talk to the
port directly on the main thread — no worker, no SharedArrayBuffer, so no
cross-origin isolation is required. */
import avrdudeModule from "./avrdude.js?v=6";
const $ = (id) => document.getElementById(id);
const els = {
flashBtn: $("flash-btn"),
progressBar: $("progress-bar"),
statusText: $("status-text"),
spinner: $("spinner"),
bundledSize: $("bundled-size"),
hexFile: $("hex-file"),
firmwareName: $("firmware-name"),
logOutput: $("log-output"),
openObiBtn: $("open-obi-btn"),
boardRadios: document.querySelectorAll('input[name="board"]'),
fwRadios: document.querySelectorAll('input[name="fw-source"]'),
flowItems: { 1: $("flow-1"), 2: $("flow-2"), 3: $("flow-3") },
};
const BOARD = {
uno: {
kind: "avrdude", part: "atmega328p", programmer: "arduino", baud: 115200,
image: "uno.hex",
note: "Uses firmware/uno.hex from this site, built automatically from the ArduinoOBI source.",
},
esp32c3: {
kind: "esptool", image: "esp32.bin",
note: "Uses firmware/esp32.bin (merged bootloader + partitions + app) built from the ArduinoOBI source for the ESP32-C3.",
},
};
function selectedBoard() {
const checked = [...els.boardRadios].find((r) => r.checked);
return checked ? checked.value : "uno";
}
function updateFirmwareHint() {
if (hexSource === "local") return;
els.firmwareName.textContent = BOARD[selectedBoard()].note;
}
let myPort = null; /* user-granted SerialPort (reused across runs) */
let avrdudeModulePromise = null;
let hexSource = "bundled";
let bundledHexText = {};
let avrdudeLogIndex = 0;
let logPollTimer = null;
function appendLog(text, cls) {
const span = document.createElement("span");
if (cls) span.className = cls;
span.textContent = text + "\n";
els.logOutput.appendChild(span);
els.logOutput.scrollTop = els.logOutput.scrollHeight;
}
function setStatus(text, kind) {
els.statusText.textContent = text;
els.statusText.className = "status-text" + (kind ? " " + kind : "");
els.spinner.hidden = kind !== "busy";
}
function setProgress(pct) {
els.progressBar.style.width = pct + "%";
}
function resetFlow() {
for (const k in els.flowItems) {
els.flowItems[k].classList.remove("active", "done");
}
els.flowItems[1].classList.add("active");
}
function markFlow(n, state) {
const el = els.flowItems[n];
if (!el) return;
el.classList.remove("active", "done");
el.classList.add(state === "done" ? "done" : "active");
}
function portInfo(port) {
const info = port.getInfo ? port.getInfo() : {};
const parts = [];
if (info.usbVendorId) parts.push("VID " + info.usbVendorId.toString(16).padStart(4, "0"));
if (info.usbProductId) parts.push("PID " + info.usbProductId.toString(16).padStart(4, "0"));
return parts.length ? parts.join(" ") : "serial device";
}
function hasWebSerial() {
return "serial" in navigator;
}
/* ---------- AVRDUDE wasm loading ---------- */
function ensureAvrdude() {
if (!avrdudeModulePromise) {
appendLog("Loading AVRDUDE WebAssembly…", "l-info");
avrdudeModulePromise = (async () => {
const funcs = await avrdudeModule({
print: (t) => appendLog(t, "l-info"),
printErr: (t) => appendLog(t, "l-err"),
});
window.funcs = funcs;
return funcs;
})();
avrdudeModulePromise.catch(() => {
avrdudeModulePromise = null;
});
}
return avrdudeModulePromise;
}
function writeWasmFiles(funcs, confText, hexText) {
try {
funcs.FS.mkdir("/tmp");
} catch (e) {
/* already exists */
}
funcs.FS.writeFile("/tmp/avrdude.conf", confText);
funcs.FS.writeFile("/tmp/firmware.hex", hexText);
}
/* ---------- firmware source ---------- */
async function getFirmware() {
const board = BOARD[selectedBoard()];
if (hexSource === "local") {
const file = els.hexFile.files && els.hexFile.files[0];
if (!file) {
throw new Error("No local firmware file selected.");
}
if (board.kind === "esptool") {
return { kind: "bin", data: new Uint8Array(await file.arrayBuffer()) };
}
return { kind: "hex", text: await file.text() };
}
if (board.kind === "esptool") {
const res = await fetch("./esp32.bin");
if (!res.ok) {
throw new Error(
"Could not fetch firmware/esp32.bin (" + res.status + "). " +
"Run the firmware.yml GitHub Actions workflow to build it."
);
}
return { kind: "bin", data: new Uint8Array(await res.arrayBuffer()) };
}
if (!bundledHexText[board.image]) {
const res = await fetch("./" + board.image);
if (!res.ok) {
throw new Error(
"Could not fetch firmware/" + board.image + " (" + res.status + "). " +
"Run the firmware.yml GitHub Actions workflow to build it."
);
}
bundledHexText[board.image] = await res.text();
}
return { kind: "hex", text: bundledHexText[board.image] };
}
async function loadBundledSize() {
const board = BOARD[selectedBoard()];
try {
const res = await fetch("./" + board.image);
if (res.ok) {
const buf = await res.arrayBuffer();
els.bundledSize.textContent = "(" + buf.byteLength.toLocaleString() + " bytes)";
} else {
els.bundledSize.textContent = "(missing — build with CI)";
}
} catch (e) {
els.bundledSize.textContent = "(missing — build with CI)";
}
}
/* ---------- avrdude log polling ---------- */
function startLogPolling() {
avrdudeLogIndex = 0;
logPollTimer = setInterval(pollAvrdudeLog, 60);
}
function stopLogPolling() {
if (logPollTimer) {
clearInterval(logPollTimer);
logPollTimer = null;
}
pollAvrdudeLog();
}
function pollAvrdudeLog() {
const arr = window.avrdudeLog || [];
while (avrdudeLogIndex < arr.length) {
const line = arr[avrdudeLogIndex++];
let text = line.replace(/\r/g, "\n");
const m = text.match(/(\d+)%/);
if (m) setProgress(parseInt(m[1], 10));
for (const sub of text.split("\n")) {
if (!sub) continue;
const lower = sub.toLowerCase();
if (lower.includes("error") || lower.includes("fail") || lower.includes("cannot")) {
appendLog(sub, "l-err");
} else if (lower.includes("done") || lower.includes("verified") || lower.includes("success")) {
appendLog(sub, "l-ok");
} else if (lower.includes("warning")) {
appendLog(sub, "l-warn");
} else {
appendLog(sub, "l-info");
}
}
}
}
/* ---------- port selection ---------- */
async function selectPort() {
if (!hasWebSerial()) {
throw new Error(
"Web Serial is not available in this browser. Use Chrome or Edge on desktop over HTTPS (or localhost)."
);
}
let port;
try {
port = await navigator.serial.requestPort();
} catch (e) {
setStatus("Flash cancelled — no port selected.", "err");
return null;
}
myPort = port;
window.activePort = port;
appendLog("Port selected: " + portInfo(port), "l-ok");
return port;
}
/* ---------- flash ---------- */
async function flash() {
els.flashBtn.disabled = true;
els.openObiBtn.hidden = true;
resetFlow();
try {
if (!hasWebSerial()) {
setStatus(
"Web Serial isn't available in this browser. Use Chrome or Edge on desktop over HTTPS (or localhost).",
"err"
);
appendLog("Web Serial is NOT available in this browser.", "l-err");
return;
}
appendLog("Web Serial is available.", "l-ok");
/* navigator.serial.requestPort() requires a user gesture, so ask for
the port first — before any await consumes transient activation. */
if (!myPort) {
setStatus("Plug in your board, then click to choose its port…", "busy");
const port = await selectPort();
if (!port) return;
} else {
window.activePort = myPort;
}
markFlow(1, "done");
markFlow(2, "active");
const board = BOARD[selectedBoard()];
setStatus("Loading the flashing engine…", "busy");
if (board.kind === "esptool") {
await flashEsp32();
} else {
await flashAvrdude(board);
}
} catch (e) {
stopLogPolling();
setProgress(0);
setStatus("Flash failed: " + e.message, "err");
appendLog("Error: " + e.message, "l-err");
/* The AVRDUDE wasm runtime may have aborted (e.g. exit() on a serial
error). Reload it so the next attempt starts from a clean state. */
if (avrdudeModulePromise) {
avrdudeModulePromise = null;
window.activePort = null;
myPort = null;
}
/* Close the serial port so it stops reading and releases the connection;
otherwise a stale port holds the Web Serial connection open and the
next attempt fails or hangs. */
closeActiveSerialPort();
} finally {
els.flashBtn.disabled = false;
}
}
async function flashAvrdude(board) {
const funcs = await ensureAvrdude();
setStatus("Preparing the firmware image…", "busy");
const firmware = await getFirmware();
if (!firmware.text.trim()) throw new Error("The firmware hex file is empty.");
const confRes = await fetch("./avrdude.conf");
if (!confRes.ok) throw new Error("Could not fetch avrdude.conf (" + confRes.status + ").");
const confText = await confRes.text();
writeWasmFiles(funcs, confText, firmware.text);
appendLog(
"Firmware image: " + Math.round(firmware.text.trim().split("\n").length * 17 / 1024) +
" KB of Intel HEX (" + firmware.text.trim().split("\n").length + " records).",
"l-info"
);
const args = [
"avrdude",
"-v",
"-p", board.part,
"-c", board.programmer,
"-C", "/tmp/avrdude.conf",
"-b", String(board.baud),
"-D",
"-P", "/dev/null",
"-U", "flash:w:/tmp/firmware.hex:i",
].join(" ");
setStatus("Flashing your board — don't unplug it…", "busy");
window.avrdudeLog = [];
startLogPolling();
const startAvrdude = funcs.cwrap("startAvrdude", "number", ["string"]);
const rc = await withTimeout(startAvrdude(args), 120000);
stopLogPolling();
if (rc === 0) {
setProgress(100);
markFlow(2, "done");
markFlow(3, "active");
setStatus("Done! Your board is now running the OBI firmware.", "ok");
appendLog("AVRDUDE exited with code 0. The board will now reboot into the OBI firmware.", "l-ok");
els.openObiBtn.hidden = false;
} else {
setProgress(0);
setStatus("Flash failed (exit code " + rc + "). Open Advanced for the log.", "err");
appendLog("AVRDUDE exited with code " + rc + ". Check the log above.", "l-err");
}
}
async function flashEsp32() {
const { ESPLoader, Transport } = await import("./esptool.js?v=6");
appendLog("esptool.js loaded.", "l-ok");
setStatus("Preparing the firmware image…", "busy");
const firmware = await getFirmware();
appendLog("Firmware image: " + firmware.data.length.toLocaleString() + " bytes.", "l-info");
const terminal = {
clean() {},
write: (text) => appendLog(text, "l-info"),
writeLine: (text) => appendLog(text, "l-info"),
writeRaw: (text) => appendLog(text, "l-info"),
};
const esp = new ESPLoader({
transport: new Transport(myPort),
baudrate: 115200,
terminal,
debugLogging: false,
});
let connected = false;
try {
setStatus("Connecting to the ESP32-C3 and entering download mode…", "busy");
await esp.connect("default_reset", 7, true);
connected = true;
await esp.runStub();
setStatus("Flashing your board — don't unplug it…", "busy");
await esp.writeFlash({
fileArray: [{ data: firmware.data, address: 0x0 }],
eraseAll: false,
flashMode: "keep",
flashFreq: "keep",
flashSize: "keep",
compress: true,
reportProgress: (fileIndex, bytesSent, totalBytes) => {
if (totalBytes > 0) setProgress(Math.round((bytesSent / totalBytes) * 100));
},
});
setProgress(100);
setStatus("Restarting the board…", "busy");
await esp.after("hard_reset");
markFlow(2, "done");
markFlow(3, "active");
setStatus("Done! Your ESP32-C3 is now running the OBI firmware.", "ok");
appendLog("Flash complete. The board will now reboot into the OBI firmware.", "l-ok");
els.openObiBtn.hidden = false;
} finally {
if (connected) {
try {
await esp.disconnect();
} catch (e) {
/* ignore */
}
}
}
}
function closeActiveSerialPort() {
const port = window.activePort;
window.activePort = null;
if (!port) return;
try {
if (window.__rxReader) {
try {
window.__rxReader.cancel().catch(() => {});
} catch (e) {
/* ignore */
}
window.__rxReader = null;
}
if (window.__rxWriter) {
try {
window.__rxWriter.releaseLock();
} catch (e) {
/* ignore */
}
window.__rxWriter = null;
}
if (window.__rxQueue) window.__rxQueue.length = 0;
if (port.readable || port.writable) port.close().catch(() => {});
} catch (e) {
/* ignore */
}
}
function withTimeout(promise, ms) {
return Promise.race([
Promise.resolve(promise),
new Promise((_, reject) =>
setTimeout(() => reject(new Error("Timed out after " + ms / 1000 + "s.")), ms)
),
]);
}
/* ---------- wiring ---------- */
els.flashBtn.addEventListener("click", flash);
function onBoardChange() {
for (const o of els.boardRadios) {
o.closest(".board-option").classList.toggle("selected", o.checked);
}
updateFirmwareHint();
loadBundledSize();
}
for (const option of els.boardRadios) {
option.addEventListener("change", onBoardChange);
option.closest(".board-option").addEventListener("click", onBoardChange);
}
for (const radio of els.fwRadios) {
radio.addEventListener("change", () => {
hexSource = radio.value;
els.hexFile.disabled = hexSource !== "local";
if (hexSource === "bundled") {
updateFirmwareHint();
} else {
els.firmwareName.textContent = "Select a firmware file compiled for the selected board.";
}
});
}
els.hexFile.addEventListener("change", () => {
const f = els.hexFile.files && els.hexFile.files[0];
els.firmwareName.textContent = f ? "Will flash " + f.name : "";
});
/* ---------- init ---------- */
(async function init() {
appendLog("Uploader build v6 — direct Web Serial (no worker).", "l-ok");
if (hasWebSerial()) {
appendLog("Web Serial is available.", "l-ok");
} else {
els.flashBtn.disabled = true;
setStatus(
"Web Serial isn't available in this browser. Use Chrome or Edge on desktop over HTTPS (or localhost).",
"err"
);
appendLog("Web Serial is NOT available in this browser.", "l-err");
}
loadBundledSize();
})();
+202
View File
@@ -0,0 +1,202 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Open Battery Information - diagnose and repair locked battery BMS modules from your browser. Flash firmware to an Arduino Uno and read Makita LXT battery packs with Web Serial, no installs.">
<title>Open Battery Information</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/landing.css">
<script src="js/theme.js"></script>
<script src="js/reveal.js" defer></script>
</head>
<body>
<nav class="navbar">
<a class="brand" href="index.html">Open Battery <span class="accent">Information</span></a>
<button id="nav-toggle" class="nav-toggle" type="button" aria-label="Open navigation menu" aria-expanded="false">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<div class="nav-links">
<a href="index.html" class="active">Home</a>
<a href="setup.html">Get started</a>
<a href="firmware/uploader.html">Flash firmware</a>
<a href="obi.html">OBI-1</a>
<a href="download.html">Download</a>
<a class="nav-icon" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io" target="_blank" rel="noopener" aria-label="View source on GitHub"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a>
<button id="theme-toggle" class="theme-toggle" type="button" aria-label="Switch to light mode">
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</button>
</div>
</nav>
<header class="hero">
<h1>Diagnose and repair your battery pack <span class="accent">from the browser</span></h1>
<p class="tagline">
Open Battery Information lets you talk to the BMS inside locked or dead
power-tool batteries — no software to install, nothing to set up. Plug in
an Arduino, flash the firmware, and read your battery from
Chrome, Edge, Opera or Firefox.
</p>
<div class="hero-actions">
<a href="setup.html"><button class="primary btn-lg">Get started</button></a>
<a href="obi.html"><button class="btn-lg">Diagnose a battery</button></a>
<a href="download.html"><button class="btn-lg">Get the desktop app</button></a>
</div>
<p class="hero-note">Works in Chrome, Edge, Opera and Firefox on desktop. 100% in your browser — nothing is uploaded anywhere.</p>
</header>
<main>
<section class="section">
<h2>Why Open Battery Information?</h2>
<div class="section-lead">
<p>
This project aims to provide tools and information about various batteries in order to
aid repair. It is very common for manufacturers to lock the BMS when a fault is
detected, to protect the device and the user — an important safety feature. So when is
it a problem? There is always a chance of false triggering of this protection, or the
fault could have been temporary or even repaired. In that case it would be wasteful to
throw out a perfectly good BMS just because its software says it is faulty.
</p>
<p>This is the problem we want to solve.</p>
</div>
<div class="feature-grid">
<div class="feature-card">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="16" height="10" x="2" y="7" rx="2" ry="2"/><line x1="22" x2="22" y1="11" y2="13"/></svg></span>
<h3>Unlock dead batteries</h3>
<p>Read status, charge cycles, and error codes from battery packs whose BMS has locked them out.</p>
</div>
<div class="feature-card">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg></span>
<h3>Web Serial, no drivers</h3>
<p>Talks to your Arduino over the Web Serial API. No drivers, no cables beyond USB, no installs.</p>
</div>
<div class="feature-card">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z"/></svg></span>
<h3>Modular design</h3>
<p>Support for more modules and interfaces keeps growing — currently the Makita LXT pack via the Arduino OBI interface.</p>
</div>
<div class="feature-card">
<span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/></svg></span>
<h3>Private by design</h3>
<p>Everything runs locally in your browser tab. No accounts, no telemetry, no data leaves your machine.</p>
</div>
</div>
</section>
<section class="section">
<h2>How it works</h2>
<p class="section-sub">Three steps from plug-in to diagnosis.</p>
<div class="steps">
<div class="step">
<span class="step-num"></span>
<h3>Set up the hardware</h3>
<p>Build the Arduino OBI interface and wire it to your battery, following the <a href="setup.html">wiring guide</a>.</p>
</div>
<div class="step">
<span class="step-num"></span>
<h3>Connect the board</h3>
<p>Open OBI-1, pick your Arduino, and press Connect. The board resets and identifies itself automatically.</p>
</div>
<div class="step">
<span class="step-num"></span>
<h3>Read the battery</h3>
<p>Insert a battery, press Read battery, and see cell voltages, temperatures, charge cycles, and status at a glance.</p>
</div>
</div>
</section>
<section class="section">
<h2>What you need</h2>
<p class="section-sub">Check these before you start.</p>
<div class="card">
<ul class="req-list">
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg></span>
<span><span class="req-title">Chrome, Edge, Opera or Firefox on desktop</span>
<span class="req-detail">Web Serial works in these browsers on desktop (Firefox 151+). Safari isn't supported.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg></span>
<span><span class="req-title">An Arduino Uno with a USB cable</span>
<span class="req-detail">A genuine or compatible Uno with the optiboot bootloader. The uploader flashes it automatically.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="16" height="10" x="2" y="7" rx="2" ry="2"/><line x1="22" x2="22" y1="11" y2="13"/></svg></span>
<span><span class="req-title">A supported battery</span>
<span class="req-detail">Currently the Makita LXT 18 V packs (BL18xx / BL14xx) are supported via the Arduino OBI interface.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg></span>
<span><span class="req-title">HTTPS or localhost</span>
<span class="req-detail">Secure context is required for Web Serial. GitHub Pages provides HTTPS automatically.</span></span>
</li>
</ul>
</div>
</section>
<section class="section">
<div class="warning">
<h3><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg> Read this before you start</h3>
<p>
This tool reads and, on supported packs, modifies battery BMS data. Batteries store a lot of energy —
always follow the upstream project's wiring guide and work safely. Incorrect wiring or use can damage
the battery or the Arduino.
</p>
<p>
Use this software at your own risk. It is provided as open source (GPL-3.0) with no warranty. It is an
independent project and is not affiliated with or endorsed by Makita.
</p>
<p>See the <a href="https://github.com/mnh-jansson/open-battery-information">upstream open-battery-information project</a> for hardware details and documentation.</p>
</div>
</section>
<section class="section">
<h2>Frequently asked questions</h2>
<p class="section-sub">Quick answers to the questions we hear most.</p>
<details class="faq">
<summary>Is this the same as the desktop app?</summary>
<div class="faq-body">
Functionally, yes — this is a browser port of the
<a href="https://github.com/mnh-jansson/open-battery-information">desktop open-battery-information app</a>.
It uses the same Arduino firmware and the same module/interface architecture, so the hardware setup is identical.
</div>
</details>
<details class="faq">
<summary>Does my battery data leave my computer?</summary>
<div class="faq-body">
No. Everything runs locally in your browser tab. There are no servers, no accounts, and no analytics.
Web Serial simply passes bytes between your browser and the Arduino over USB.
</div>
</details>
<details class="faq">
<summary>Which batteries are supported?</summary>
<div class="faq-body">
The <strong>Makita LXT</strong> module covers 18 V LXT packs (e.g. BL1815, BL1850, BL1860) and their
14.4 V siblings. Other packs can be added as new modules over time.
</div>
</details>
<details class="faq">
<summary>Why do I need to flash firmware first?</summary>
<div class="faq-body">
The Arduino needs the Open Battery Information firmware to talk to the battery BMS. The uploader in this
repo flashes it for you in one click — no Arduino IDE or platformio install required.
</div>
</details>
<details class="faq">
<summary>Can it repair or re-unlock my battery?</summary>
<div class="faq-body">
The tool can read and clear error states on supported packs. Whether a pack can be fully recovered depends
on why it locked up. See the upstream documentation for what is and isn't possible.
</div>
</details>
</section>
</main>
<footer class="site-footer">
<p><strong>Open Battery Information</strong> — an open-source web port of the
<a href="https://github.com/mnh-jansson/open-battery-information">open-battery-information</a> project.</p>
<p>Released under the GPL-3.0 license. Independent project, not affiliated with Makita.</p>
</footer>
</body>
</html>
+182
View File
@@ -0,0 +1,182 @@
/* Shared helpers for the Open Battery Information web app. */
(function () {
"use strict";
const OBI = (window.OBI = window.OBI || {});
OBI.modules = {};
OBI.interfaces = {};
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const hexByte = (b) => (b & 0xff).toString(16).toUpperCase().padStart(2, "0");
const hexDump = (bytes) => Array.from(bytes, hexByte).join(" ");
function debugLine(text, cls) {
const el = document.getElementById("debug-text");
if (!el) return;
const span = document.createElement("span");
if (cls) span.className = cls;
span.textContent = text + "\n";
el.appendChild(span);
el.scrollTop = el.scrollHeight;
}
const debug = {
send: (text) => debugLine(text, "dbg-send"),
recv: (text) => debugLine(text, "dbg-recv"),
info: (text) => debugLine(text, "dbg-info"),
error: (text) => debugLine(text, "dbg-error"),
};
/* ---- Simple modal ---- */
function modal(title, message, kind, okLabel) {
return new Promise((resolve) => {
const overlay = document.createElement("div");
overlay.className = "modal-overlay";
overlay.innerHTML =
'<div class="modal" role="dialog" aria-modal="true">' +
"<h3></h3><p></p><div class='modal-actions'>" +
"<button class='primary'>" + (okLabel || "OK") + "</button>" +
"</div></div>";
overlay.querySelector("h3").textContent = title;
overlay.querySelector("p").textContent = message;
const close = () => {
overlay.remove();
resolve();
};
overlay.querySelector("button").addEventListener("click", close);
overlay.addEventListener("click", (e) => {
if (e.target === overlay) close();
});
document.body.appendChild(overlay);
});
}
/* ---- ConnectionError ---- */
class ConnectionError extends Error {}
/* ---- Web Serial connection wrapper ----
Maintains a continuous read loop and a byte queue so that
"read exactly n bytes" works reliably despite chunking. */
class SerialConnection {
constructor(port) {
this.port = port;
this.queue = [];
this.queueLength = 0;
this.reader = null;
this.closed = false;
this.portName = port.getInfo
? port.getInfo().usbVendorId + ":" + port.getInfo().usbProductId
: "unknown";
}
async start() {
this.reader = this.port.readable.getReader();
this.readLoop = (async () => {
while (!this.closed) {
try {
const { value, done } = await this.reader.read();
if (done) break;
this.queue.push(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
this.queueLength += value.length;
} catch (err) {
if (!this.closed) throw err;
break;
}
}
})().catch((err) => {
if (!this.closed) OBI.debug && OBI.debug.error("Serial read loop error: " + err.message);
});
}
async read(n, timeoutMs) {
const start = Date.now();
while (this.queueLength < n) {
if (Date.now() - start > timeoutMs) {
const partial = this.take(Math.min(this.queueLength, n));
return partial;
}
await sleep(10);
}
return this.take(n);
}
take(n) {
const out = new Uint8Array(n);
let offset = 0;
while (offset < n) {
const chunk = this.queue[0];
const take = Math.min(chunk.length, n - offset);
out.set(chunk.subarray(0, take), offset);
offset += take;
if (take === chunk.length) {
this.queue.shift();
} else {
this.queue[0] = chunk.subarray(take);
}
}
this.queueLength -= n;
return out;
}
clear() {
this.queue = [];
this.queueLength = 0;
}
async write(bytes) {
const data = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
const writer = this.port.writable.getWriter();
try {
await writer.write(data);
} finally {
writer.releaseLock();
}
}
async close() {
this.closed = true;
try {
if (this.reader) {
await this.reader.cancel();
this.reader.releaseLock();
}
await this.port.close();
} catch (err) {
/* already closed */
}
}
}
/* ---- Toast notification ---- */
let toastContainer = null;
function toast(message, kind) {
if (!toastContainer) {
toastContainer = document.createElement("div");
toastContainer.className = "toast-container";
document.body.appendChild(toastContainer);
}
const el = document.createElement("div");
el.className = "toast" + (kind ? " toast-" + kind : "");
el.textContent = message;
toastContainer.appendChild(el);
setTimeout(() => {
el.classList.add("toast-out");
el.addEventListener("transitionend", () => el.remove(), { once: true });
}, 3000);
setTimeout(() => el.remove(), 3800);
}
OBI.util = {
sleep,
hexByte,
hexDump,
debug,
modal,
toast,
ConnectionError,
SerialConnection,
};
})();
+194
View File
@@ -0,0 +1,194 @@
/* Arduino OBI interface, ported from the Python desktop app (interfaces/arduino_obi.py).
Uses the Web Serial API instead of pyserial. The widget renders the connection
details (port + firmware version); the host page owns the Connect button and
calls connect()/disconnect(). */
(function () {
"use strict";
const {
debug,
hexDump,
modal,
toast,
sleep,
ConnectionError,
SerialConnection,
} = OBI.util;
const INTERFACE_VERSION_CMD = [0x01, 0x00, 0x03, 0x01];
function createWidget(frame, obi, callbacks) {
const onConnect = (callbacks && callbacks.onConnect) || function () {};
frame.innerHTML =
'<div class="iface-details">' +
'<div class="iface-detail"><span class="label">Serial port</span>' +
'<div class="value" id="port-name">No port connected</div></div>' +
"</div>";
const portNameEl = frame.querySelector("#port-name");
const versionLabel = document.getElementById("interface-version");
let conn = null; /* SerialConnection */
let connected = false;
const setConnected = (v) => {
connected = v;
onConnect(v);
};
function portName(port) {
const info = port.getInfo ? port.getInfo() : {};
const parts = [];
if (info.usbVendorId) parts.push("VID " + info.usbVendorId.toString(16));
if (info.usbProductId) parts.push("PID " + info.usbProductId.toString(16));
return parts.length ? parts.join(" ") : "serial device";
}
async function connect(resetBoard) {
if (!("serial" in navigator)) {
modal(
"Unsupported Browser",
"Web Serial is not available in this browser.\n\n" +
"Use Chrome, Edge, Opera or Firefox 151+ on desktop over HTTPS (or localhost)."
);
return;
}
let port;
try {
port = await navigator.serial.requestPort();
} catch (e) {
/* user cancelled */
return;
}
try {
await port.open({ baudRate: 9600, bufferSize: 255 });
if (resetBoard) {
/* Classic Arduino reset: pulse DTR to reboot the board. */
await port.setSignals({ dataTerminalReady: false });
await sleep(100);
await port.setSignals({ dataTerminalReady: true });
}
/* Wait for the Uno to boot out of the (opti)bootloader and for
the OBI firmware to initialise its serial port. */
await sleep(2000);
conn = new SerialConnection(port);
await conn.start();
portNameEl.textContent = portName(port) + " (9600 baud)";
debug.info("Opened serial port: " + portNameEl.textContent);
connected = true; /* allow request() while we read the version */
const version = await getVersion();
versionLabel.textContent = "Firmware version: " + version;
debug.info("Arduino OBI interface version " + version);
onConnect(true);
toast("Connected to Arduino OBI (firmware " + version + ")");
} catch (e) {
try {
await port.close();
} catch (err) {
/* ignore */
}
setConnected(false);
portNameEl.textContent = "No port connected";
versionLabel.textContent = "Firmware version: -";
debug.error("Error opening serial port: " + e.message);
modal(
"Connection Error",
"Could not open the serial port:\n\n" +
e.message +
"\n\nCheck that the port is not in use by another application."
);
}
}
async function disconnect() {
if (conn) {
await conn.close();
conn = null;
}
setConnected(false);
versionLabel.textContent = "Firmware version: -";
portNameEl.textContent = "No port connected";
debug.info("Closed serial port");
}
function isConnected() {
return connected;
}
async function getVersion() {
const response = await request(INTERFACE_VERSION_CMD, 5);
return Array.from(response.slice(2)).join(".");
}
async function request(requestBytes, maxAttempts = 5) {
if (!connected || !conn) {
throw new ConnectionError(
"Serial port is not open. Please connect to the Arduino first."
);
}
const expectedLength = requestBytes[2] + 2;
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
debug.send(">> " + hexDump(requestBytes.slice(3)));
try {
conn.clear();
await conn.write(requestBytes);
if (requestBytes[2] === 0) {
return undefined;
}
const response = await conn.read(expectedLength, 3000);
debug.recv("<< " + hexDump(response.slice(2)));
if (response.length === 0) {
throw new Error(
"No response received from Arduino (expected " +
expectedLength +
" bytes). Check that a battery is connected."
);
}
if (response.length !== expectedLength) {
throw new Error(
"Incomplete response: received " +
response.length +
" bytes, expected " +
expectedLength +
". The battery may not be seated correctly."
);
}
if (Array.from(response.slice(2)).every((b) => b === 0xff)) {
throw new Error(
"Invalid response: all bytes are 0xFF. The battery may not be communicating correctly."
);
}
return response;
} catch (e) {
if (e instanceof ConnectionError) throw e;
debug.error(
"Attempt " + attempt + "/" + maxAttempts + " failed: " + e.message
);
}
}
throw new ConnectionError(
"Failed to get a valid response after " +
maxAttempts +
" attempts. Ensure the Arduino is connected and a battery is inserted."
);
}
return {
connect,
disconnect,
isConnected,
request,
};
}
OBI.interfaces["arduino_obi"] = {
getDisplayName: () => "Arduino OBI",
createWidget,
};
})();
+423
View File
@@ -0,0 +1,423 @@
/* Makita LXT module, ported from the Python desktop app (modules/makita_lxt.py).
The widget renders the results table and function-test buttons; the host
page drives the reading via readBattery(). */
(function () {
"use strict";
const { debug, hexDump, modal, toast, ConnectionError } = OBI.util;
/* Command definitions (start, len, rsp_len, cmd, data...) */
const MODEL_CMD = [0x01, 0x02, 0x10, 0xcc, 0xdc, 0x0c];
const READ_DATA_REQUEST = [0x01, 0x04, 0x1d, 0xcc, 0xd7, 0x00, 0x00, 0xff];
const TESTMODE_CMD = [0x01, 0x03, 0x09, 0x33, 0xd9, 0x96, 0xa5];
const LEDS_ON_CMD = [0x01, 0x02, 0x09, 0x33, 0xda, 0x31];
const LEDS_OFF_CMD = [0x01, 0x02, 0x09, 0x33, 0xda, 0x34];
const RESET_ERROR_CMD = [0x01, 0x02, 0x09, 0x33, 0xda, 0x04];
const READ_MSG_CMD = [0x01, 0x02, 0x28, 0x33, 0xaa, 0x00];
const CLEAR_CMD = [0x01, 0x02, 0x00, 0xcc, 0xf0, 0x00];
/* Commands specific to the F0513 version */
const F0513_VCELL_1_CMD = [0x01, 0x01, 0x02, 0xcc, 0x31];
const F0513_VCELL_2_CMD = [0x01, 0x01, 0x02, 0xcc, 0x32];
const F0513_VCELL_3_CMD = [0x01, 0x01, 0x02, 0xcc, 0x33];
const F0513_VCELL_4_CMD = [0x01, 0x01, 0x02, 0xcc, 0x34];
const F0513_VCELL_5_CMD = [0x01, 0x01, 0x02, 0xcc, 0x35];
const F0513_TEMP_CMD = [0x01, 0x01, 0x02, 0xcc, 0x52];
const F0513_MODEL_CMD = [0x01, 0x00, 0x02, 0x31];
const F0513_VERSION_CMD = [0x01, 0x00, 0x02, 0x32];
const F0513_TESTMODE_CMD = [0x01, 0x01, 0x00, 0xcc, 0x99];
const initialData = {
"Model": "",
"Charge count*": "",
"State": "",
"Status code": "",
"Pack Voltage": "",
"Cell 1 Voltage": "",
"Cell 2 Voltage": "",
"Cell 3 Voltage": "",
"Cell 4 Voltage": "",
"Cell 5 Voltage": "",
"Cell Voltage Difference": "",
"Temperature Sensor 1": "",
"Temperature Sensor 2": "",
"ROM ID": "",
"Manufacturing date": "",
"Battery message": "",
"Capacity": "",
"Battery type": "",
};
const nibbleSwap = (byte) =>
(((byte & 0xf0) >> 4) | ((byte & 0x0f) << 4)) & 0xff;
const u16le = (bytes, offset) =>
(bytes[offset] | (bytes[offset + 1] << 8)) & 0xffff;
function createWidget(container) {
container.innerHTML =
'<div class="test-grid">' +
"<fieldset class='test-group'><legend>Function test</legend>" +
'<button data-action="led-on" disabled>LED test ON</button>' +
'<button data-action="led-off" disabled>LED test OFF</button>' +
"</fieldset>" +
"<fieldset class='test-group'><legend>Reset battery</legend>" +
'<button data-action="reset-errors" disabled>Clear errors</button>' +
'<button data-action="reset-message" disabled>Reset battery message</button>' +
"</fieldset>" +
"</div>" +
'<div class="table-wrap"><table id="data-table">' +
"<thead><tr><th>Parameter</th><th>Value</th></tr></thead>" +
"<tbody></tbody></table></div>" +
'<div class="table-actions">' +
'<button data-action="copy">Copy</button>' +
'<button data-action="clear">Clear</button>' +
"</div>";
const state = {
interface: null,
commandVersion: null,
batteryPresent: false,
busy: false,
};
const buttons = {
"led-on": container.querySelector('[data-action="led-on"]'),
"led-off": container.querySelector('[data-action="led-off"]'),
"reset-errors": container.querySelector('[data-action="reset-errors"]'),
"reset-message": container.querySelector('[data-action="reset-message"]'),
};
const enableAllButtons = () => {
for (const key in buttons) buttons[key].disabled = false;
};
const tbody = container.querySelector("tbody");
const rows = {}; /* parameter -> <tr> */
function insertBatteryData(data) {
for (const [parameter, value] of Object.entries(data)) {
let tr = rows[parameter];
if (tr) {
tr.querySelector("td.value").textContent = String(value);
} else {
tr = document.createElement("tr");
const tdParam = document.createElement("td");
tdParam.textContent = parameter;
const tdValue = document.createElement("td");
tdValue.className = "value";
tdValue.textContent = String(value);
tr.appendChild(tdParam);
tr.appendChild(tdValue);
tr.addEventListener("click", () => tr.classList.toggle("selected"));
tbody.appendChild(tr);
rows[parameter] = tr;
}
}
}
const getInterface = () => {
if (!state.interface) {
modal(
"Error",
"No interface selected. Please select and connect an interface from the sidebar."
);
return null;
}
return state.interface;
};
/* ---- model identification ---- */
async function getModel() {
const response = await state.interface.request(MODEL_CMD);
return String.fromCharCode(...response.slice(2, 9));
}
async function getF0513Model() {
const response = await state.interface.request(F0513_MODEL_CMD);
await state.interface.request(CLEAR_CMD);
state.commandVersion = "F0513";
modal("Limited", "This model only supports diagnostics");
return (
"BL" +
response[2].toString(16).toUpperCase() +
response[3].toString(16).toUpperCase()
);
}
/* ---- dynamic data ---- */
async function readDynamicData() {
let batteryData;
if (state.commandVersion === "F0513") {
await state.interface.request(CLEAR_CMD);
await state.interface.request(CLEAR_CMD);
const cellCmds = [
F0513_VCELL_1_CMD,
F0513_VCELL_2_CMD,
F0513_VCELL_3_CMD,
F0513_VCELL_4_CMD,
F0513_VCELL_5_CMD,
];
const responses = [];
for (const cmd of cellCmds) {
responses.push(await state.interface.request(cmd));
}
const temp = await state.interface.request(F0513_TEMP_CMD);
const voltages = responses.map((r) => u16le(r, 2) / 1000);
const vPack = voltages.reduce((a, b) => a + b, 0);
const vDiff = Math.round((Math.max(...voltages) - Math.min(...voltages)) * 100) / 100;
const tCell = u16le(temp, 2) / 100;
batteryData = {
"Pack Voltage": vPack,
"Cell 1 Voltage": voltages[0],
"Cell 2 Voltage": voltages[1],
"Cell 3 Voltage": voltages[2],
"Cell 4 Voltage": voltages[3],
"Cell 5 Voltage": voltages[4],
"Cell Voltage Difference": vDiff,
"Temperature Sensor 1": tCell,
"Temperature Sensor 2": "",
};
} else {
const response = await state.interface.request(READ_DATA_REQUEST);
const vPack = u16le(response, 2) / 1000;
const voltages = [4, 6, 8, 10, 12].map((o) => u16le(response, o) / 1000);
const vDiff = Math.round((Math.max(...voltages) - Math.min(...voltages)) * 100) / 100;
const tCell = u16le(response, 16) / 100;
const tMosfet = u16le(response, 18) / 100;
batteryData = {
"Pack Voltage": vPack,
"Cell 1 Voltage": voltages[0],
"Cell 2 Voltage": voltages[1],
"Cell 3 Voltage": voltages[2],
"Cell 4 Voltage": voltages[3],
"Cell 5 Voltage": voltages[4],
"Cell Voltage Difference": vDiff,
"Temperature Sensor 1": tCell,
"Temperature Sensor 2": tMosfet,
};
}
return batteryData;
}
/* ---- combined read: static info + model + dynamic data ---- */
async function readBattery() {
const iface = getInterface();
if (!iface) return false;
if (state.busy) return false;
state.busy = true;
try {
/* static info */
let response;
try {
response = await iface.request(READ_MSG_CMD);
} catch (e) {
if (e instanceof ConnectionError) {
modal(
"Connection Error",
"Could not communicate with the battery:\n\n" + e.message
);
} else {
modal(
"Data Error",
"Received an unexpected response while reading battery info:\n\n" +
e.name + ": " + e.message
);
}
return false;
}
const romId = hexDump(response.slice(2, 10));
const rawMsg = hexDump(response.slice(10, 42));
const swapped = [nibbleSwap(response[36]), nibbleSwap(response[37])];
const chargeCount = (((swapped[0] << 8) | swapped[1]) & 0x0fff) >>> 0;
const lockNibble = response[30] & 0x0f;
const errorByte = response[29];
const lockStatus = lockNibble > 0 ? "LOCKED" : "UNLOCKED";
const pad2 = (b) => (b & 0xff).toString(10).padStart(2, "0");
const hex2 = (b) => (b & 0xff).toString(16).toUpperCase().padStart(2, "0");
insertBatteryData({
"ROM ID": romId,
"Battery message": rawMsg,
"Charge count*": chargeCount,
"State": lockStatus,
"Status code": hex2(errorByte),
"Manufacturing date":
pad2(response[4]) + "/" + pad2(response[3]) + "/20" + pad2(response[2]),
"Capacity": (nibbleSwap(response[26]) / 10).toFixed(1) + "Ah",
"Battery type": nibbleSwap(response[21]),
});
state.batteryPresent = true;
/* model identification */
state.commandVersion = null;
let model = null;
let lastException = null;
for (const command of [getModel, getF0513Model]) {
try {
model = await command();
break;
} catch (e) {
lastException = e;
}
}
if (model === null) {
modal(
"Unsupported Battery",
"Battery is present but the model is not supported.\n\nLast error: " +
(lastException && lastException.message)
);
return false;
}
insertBatteryData({ Model: model });
/* dynamic data */
try {
const batteryData = await readDynamicData();
insertBatteryData(batteryData);
} catch (e) {
if (e instanceof ConnectionError) {
modal(
"Connection Error",
"Lost communication while reading battery data:\n\n" + e.message
);
} else {
modal(
"Data Error",
"Received an unexpected response while reading battery data:\n\n" +
e.name + ": " + e.message
);
}
return false;
}
enableAllButtons();
return true;
} finally {
state.busy = false;
}
}
/* ---- function test ---- */
async function onAllLedsOnClick() {
const iface = getInterface();
if (!iface) return;
try {
await iface.request(TESTMODE_CMD);
await iface.request(LEDS_ON_CMD);
toast("LED test on — check the battery LEDs");
} catch (e) {
modal(
"Connection Error",
"Lost communication while turning LEDs on:\n\n" + e.message
);
}
}
async function onAllLedsOffClick() {
const iface = getInterface();
if (!iface) return;
try {
if (state.commandVersion === "F0513") {
await iface.request(F0513_TESTMODE_CMD);
} else {
await iface.request(TESTMODE_CMD);
}
await iface.request(LEDS_OFF_CMD);
toast("LED test off");
} catch (e) {
modal(
"Connection Error",
"Lost communication while turning LEDs off:\n\n" + e.message
);
}
}
/* ---- reset ---- */
async function onResetErrorsClick() {
const iface = getInterface();
if (!iface) return;
try {
await iface.request(TESTMODE_CMD);
await iface.request(RESET_ERROR_CMD);
toast("Battery errors cleared");
} catch (e) {
modal(
"Connection Error",
"Lost communication while resetting errors:\n\n" + e.message
);
}
}
async function onResetMessageClick() {
const iface = getInterface();
if (!iface) return;
await modal(
"Not Implemented",
"This feature is currently under development."
);
}
/* ---- table actions ---- */
function copyToClipboard() {
const selected = Array.from(tbody.querySelectorAll("tr.selected"));
if (!selected.length) {
modal("No Selection", "No rows selected to copy!");
return;
}
const rowsText = selected
.map((tr) => {
const cells = tr.querySelectorAll("td");
return Array.from(cells)
.map((td) => td.textContent)
.join("\t");
})
.join("\n");
navigator.clipboard
.writeText(rowsText)
.then(() => toast("Rows copied to clipboard"))
.catch(() => modal("Error", "Could not access the clipboard."));
}
function clearData() {
insertBatteryData(initialData);
}
container
.querySelector('[data-action="led-on"]')
.addEventListener("click", onAllLedsOnClick);
container
.querySelector('[data-action="led-off"]')
.addEventListener("click", onAllLedsOffClick);
container
.querySelector('[data-action="reset-errors"]')
.addEventListener("click", onResetErrorsClick);
container
.querySelector('[data-action="reset-message"]')
.addEventListener("click", onResetMessageClick);
container
.querySelector('[data-action="copy"]')
.addEventListener("click", copyToClipboard);
container
.querySelector('[data-action="clear"]')
.addEventListener("click", clearData);
insertBatteryData(initialData);
return {
setInterface(iface) {
state.interface = iface;
},
readBattery,
destroy() {
container.innerHTML = "";
},
};
}
OBI.modules["makita_lxt"] = {
getDisplayName: () => "Makita LXT",
createWidget,
};
})();
+191
View File
@@ -0,0 +1,191 @@
/* Open Battery Information web app shell — wizard flow.
Guides the user through: 1. Connect 2. Read battery 3. Results. */
(function () {
"use strict";
const { debug, toast } = OBI.util;
const $ = (id) => document.getElementById(id);
const els = {
moduleSelect: $("module-select"),
interfaceSelect: $("interface-select"),
resetCheck: $("reset-check"),
connectBtn: $("connect-btn"),
ifaceState: $("iface-state"),
ifaceWidget: $("iface-widget"),
serialWarning: $("serial-warning"),
readBtn: $("read-btn"),
readHint: $("read-hint"),
resultsSummary: $("results-summary"),
readAgainBtn: $("read-again-btn"),
moduleContent: $("module-content"),
};
const stepItems = { 1: $("step-1"), 2: $("step-2"), 3: $("step-3") };
const panels = { 1: $("panel-connect"), 2: $("panel-read"), 3: $("panel-results") };
let iface = null; /* interface controller */
let moduleWidget = null; /* module controller */
let connected = false;
/* ---------- stepper ---------- */
function goToStep(n) {
for (const [k, el] of Object.entries(panels)) {
el.classList.toggle("active", Number(k) === n);
}
for (const [k, el] of Object.entries(stepItems)) {
el.classList.toggle("active", Number(k) === n);
el.classList.toggle("done", Number(k) < n);
}
}
function markStepDone(n) {
const el = stepItems[n];
if (el) {
el.classList.remove("active");
el.classList.add("done");
}
}
function resetSteps() {
for (const el of Object.values(stepItems)) {
el.classList.remove("active", "done");
}
for (const el of Object.values(panels)) {
el.classList.remove("active");
}
stepItems[1].classList.add("active");
panels[1].classList.add("active");
}
/* ---------- interface ---------- */
function handleConnectChange(v) {
connected = v;
updateConnectUi();
if (v) {
markStepDone(1);
goToStep(2);
} else {
resetSteps();
}
}
function updateConnectUi() {
els.connectBtn.textContent = connected ? "Disconnect" : "Connect";
els.connectBtn.classList.toggle("primary", !connected);
els.ifaceState.textContent = connected ? "Connected" : "Not connected";
els.ifaceState.className = "badge " + (connected ? "ok" : "");
els.readBtn.disabled = !connected;
}
function setupInterface() {
const key = els.interfaceSelect.value;
const ifaceDef = OBI.interfaces[key];
if (!ifaceDef) return;
if (iface) {
iface.disconnect && iface.disconnect();
iface = null;
}
els.ifaceWidget.innerHTML = "";
iface = ifaceDef.createWidget(els.ifaceWidget, OBI, {
onConnect: handleConnectChange,
});
connected = iface.isConnected();
updateConnectUi();
}
/* ---------- module ---------- */
function setupModule() {
const key = els.moduleSelect.value;
const moduleDef = OBI.modules[key];
if (!moduleDef) return;
if (moduleWidget) {
moduleWidget.destroy();
moduleWidget = null;
}
els.moduleContent.innerHTML = "";
moduleWidget = moduleDef.createWidget(els.moduleContent);
if (iface) moduleWidget.setInterface(iface);
}
/* ---------- reading ---------- */
async function doRead() {
if (!connected || !iface || !moduleWidget) return;
els.readBtn.disabled = true;
els.readBtn.textContent = "Reading…";
els.readHint.textContent = "Talking to the battery — this takes a few seconds…";
const ok = await moduleWidget.readBattery();
if (ok) {
toast("Battery read successfully");
els.readHint.textContent =
"Battery read successfully. Open the Results step or press Read again to refresh.";
markStepDone(2);
els.resultsSummary.textContent =
"Battery read — details below. Select rows and use Copy, or Read again to refresh.";
goToStep(3);
} else {
els.readHint.textContent =
"Could not read the battery. Check it is seated correctly and connected, then try again.";
}
els.readBtn.textContent = "Read battery";
els.readBtn.disabled = !connected;
}
/* ---------- wiring ---------- */
els.connectBtn.addEventListener("click", async () => {
if (!iface) return;
if (connected) {
await iface.disconnect();
} else {
await iface.connect(els.resetCheck.checked);
}
});
els.readBtn.addEventListener("click", doRead);
els.readAgainBtn.addEventListener("click", doRead);
els.moduleSelect.addEventListener("change", () => {
setupModule();
resetSteps();
});
els.interfaceSelect.addEventListener("change", () => {
setupInterface();
setupModule();
resetSteps();
});
/* ---------- init ---------- */
function init() {
if (!("serial" in navigator)) {
debug.error(
"Web Serial is not available in this browser. Use Chrome, Edge, Opera or Firefox 151+ on desktop over HTTPS (or localhost), or the desktop app."
);
if (els.serialWarning) els.serialWarning.hidden = false;
els.connectBtn.disabled = true;
}
const names = Object.keys(OBI.modules).sort();
for (const name of names) {
const opt = document.createElement("option");
opt.value = name;
opt.textContent = OBI.modules[name].getDisplayName();
els.moduleSelect.appendChild(opt);
}
if (names.length) els.moduleSelect.value = names[0];
const ifaceNames = Object.keys(OBI.interfaces).sort();
for (const name of ifaceNames) {
const opt = document.createElement("option");
opt.value = name;
opt.textContent = OBI.interfaces[name].getDisplayName();
els.interfaceSelect.appendChild(opt);
}
if (ifaceNames.length) els.interfaceSelect.value = ifaceNames[0];
setupInterface();
setupModule();
resetSteps();
}
document.addEventListener("DOMContentLoaded", init);
})();
+49
View File
@@ -0,0 +1,49 @@
/* Reveal-on-scroll entrance animations (ui-flashy branch, exploratory).
Adds a staggered fade/slide-up to page blocks. Everything stays visible
if IntersectionObserver is missing or the user prefers reduced motion. */
(function () {
var SELECTORS = [
'.hero',
'.feature-card',
'.step',
'.card',
'.warning',
'.faq',
'.wizard-card',
'.flash-card',
'.test-group',
'.tool-header',
'.uploader-header'
].join(', ');
if (!('IntersectionObserver' in window)) return;
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
var els = document.querySelectorAll(SELECTORS);
if (!els.length) return;
document.documentElement.classList.add('js-reveal');
els.forEach(function (el) { el.classList.add('reveal'); });
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (!entry.isIntersecting) return;
var el = entry.target;
var delay = 0;
if (el.dataset.revealDelay) {
delay = parseInt(el.dataset.revealDelay, 10) || 0;
} else {
var parent = el.parentElement;
if (parent) {
var idx = Array.prototype.indexOf.call(parent.children, el);
delay = Math.min(idx * 70, 490);
}
}
if (delay) el.style.transitionDelay = delay + 'ms';
el.classList.add('revealed');
io.unobserve(el);
});
}, { threshold: 0.12, rootMargin: '0px 0px -6% 0px' });
els.forEach(function (el) { io.observe(el); });
})();
+69
View File
@@ -0,0 +1,69 @@
/* Light/dark theme. Applies <html data-theme="dark|light">, persists the
choice in localStorage and falls back to the OS preference. */
(function () {
var KEY = "obi-theme";
function initialTheme() {
try {
var saved = localStorage.getItem(KEY);
if (saved === "dark" || saved === "light") return saved;
} catch (e) {
/* storage unavailable */
}
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches) {
return "light";
}
return "dark";
}
function apply(theme) {
document.documentElement.setAttribute("data-theme", theme);
var btn = document.getElementById("theme-toggle");
if (btn) {
var next = theme === "light" ? "dark" : "light";
btn.setAttribute("aria-label", "Switch to " + next + " mode");
btn.setAttribute("title", "Switch to " + next + " mode");
}
}
apply(initialTheme());
document.addEventListener("DOMContentLoaded", function () {
var theme = document.documentElement.getAttribute("data-theme") === "light" ? "light" : "dark";
apply(theme);
var btn = document.getElementById("theme-toggle");
if (!btn) return;
btn.addEventListener("click", function () {
var next = document.documentElement.getAttribute("data-theme") === "light" ? "dark" : "light";
try {
localStorage.setItem(KEY, next);
} catch (e) {
/* ignore */
}
apply(next);
});
});
})();
/* Responsive navbar: toggle the burger menu on small screens. */
(function () {
document.addEventListener("DOMContentLoaded", function () {
var navbar = document.querySelector(".navbar");
var toggle = document.getElementById("nav-toggle");
if (!navbar || !toggle) return;
toggle.addEventListener("click", function () {
var open = navbar.classList.toggle("nav-open");
toggle.setAttribute("aria-expanded", open ? "true" : "false");
toggle.setAttribute("aria-label", open ? "Close navigation menu" : "Open navigation menu");
});
navbar.addEventListener("click", function (e) {
if (!navbar.classList.contains("nav-open")) return;
var link = e.target.closest && e.target.closest("a");
if (link) {
navbar.classList.remove("nav-open");
toggle.setAttribute("aria-expanded", "false");
toggle.setAttribute("aria-label", "Open navigation menu");
}
});
});
})();
+114
View File
@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Open Battery Information - OBI-1: read Makita LXT battery packs through an Arduino over Web Serial.">
<title>OBI-1 · Open Battery Information</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/tool.css">
<script src="js/theme.js"></script>
<script src="js/reveal.js" defer></script>
</head>
<body>
<nav class="navbar">
<a class="brand" href="index.html">Open Battery <span class="accent">Information</span></a>
<button id="nav-toggle" class="nav-toggle" type="button" aria-label="Open navigation menu" aria-expanded="false">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<div class="nav-links">
<a href="index.html">Home</a>
<a href="setup.html">Get started</a>
<a href="firmware/uploader.html">Flash firmware</a>
<a href="obi.html" class="active">OBI-1</a>
<a href="download.html">Download</a>
<a class="nav-icon" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io" target="_blank" rel="noopener" aria-label="View source on GitHub"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a>
<button id="theme-toggle" class="theme-toggle" type="button" aria-label="Switch to light mode">
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</button>
</div>
</nav>
<div class="tool-wrap">
<header class="tool-header">
<h1>OBI-1</h1>
<p class="subtitle">Diagnose your Makita LXT battery pack in three steps.</p>
</header>
<div class="stepper">
<div class="step-item active" id="step-1"><span class="step-dot">1</span><span class="step-label">Connect</span></div>
<div class="step-connector"></div>
<div class="step-item" id="step-2"><span class="step-dot">2</span><span class="step-label">Read battery</span></div>
<div class="step-connector"></div>
<div class="step-item" id="step-3"><span class="step-dot">3</span><span class="step-label">Results</span></div>
</div>
<div class="wizard-card">
<div class="wizard-settings">
<div class="field">
<label for="module-select">Battery module</label>
<select id="module-select"></select>
</div>
<div class="field">
<label for="interface-select">Interface</label>
<div class="field-row">
<select id="interface-select"></select>
<span class="hint" id="interface-version">Firmware version: -</span>
</div>
</div>
<div class="field">
<label class="checkbox" for="reset-check">
<input type="checkbox" id="reset-check" checked> Reset board on connect
</label>
</div>
</div>
<section class="wizard-panel active" id="panel-connect">
<h2>Connect the Arduino</h2>
<p class="panel-desc">Plug the Arduino into USB (the OBI firmware must already be flashed), then click Connect.</p>
<div class="warning" id="serial-warning" hidden>
<h3>Web Serial not supported</h3>
<p>This browser can't access the serial port, so the browser version of OBI-1 can't connect to the Arduino.
Use the <a href="download.html">desktop app</a> instead — it has native serial access and needs no browser setup.</p>
</div>
<div class="iface-status">
<button id="connect-btn" class="primary">Connect</button>
<span id="iface-state" class="badge">Not connected</span>
</div>
<div id="iface-widget"></div>
</section>
<section class="wizard-panel" id="panel-read">
<div class="read-step">
<div class="read-illustration"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="16" height="10" x="2" y="7" rx="2" ry="2"/><line x1="22" x2="22" y1="11" y2="13"/></svg></div>
<h2>Insert the battery</h2>
<p class="panel-desc">Place a battery in the holder so it makes contact with the interface pins.</p>
<button id="read-btn" class="primary btn-lg" disabled>Read battery</button>
<p class="read-hint" id="read-hint">
Reads the model, cell voltages, temperatures, charge count and status in one go.
</p>
</div>
</section>
<section class="wizard-panel" id="panel-results">
<div class="results-toolbar">
<span class="summary" id="results-summary">No results yet.</span>
<button id="read-again-btn">Read again</button>
</div>
<div id="module-content"></div>
</section>
</div>
<details class="debug-drawer">
<summary>Debug log</summary>
<div id="debug-text"></div>
</details>
</div>
<script src="js/common.js"></script>
<script src="js/modules/makita_lxt.js"></script>
<script src="js/interfaces/arduino_obi.js"></script>
<script src="js/obi.js"></script>
</body>
</html>
+180
View File
@@ -0,0 +1,180 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Open Battery Information - Get started: build the Arduino OBI interface, wire it to your battery, and flash the firmware from your browser.">
<title>Get started · Open Battery Information</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/landing.css">
<script src="js/theme.js"></script>
<script src="js/reveal.js" defer></script>
</head>
<body>
<nav class="navbar">
<a class="brand" href="index.html">Open Battery <span class="accent">Information</span></a>
<button id="nav-toggle" class="nav-toggle" type="button" aria-label="Open navigation menu" aria-expanded="false">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<div class="nav-links">
<a href="index.html">Home</a>
<a href="setup.html" class="active">Get started</a>
<a href="firmware/uploader.html">Flash firmware</a>
<a href="obi.html">OBI-1</a>
<a href="download.html">Download</a>
<a class="nav-icon" href="https://github.com/OpenBatteryInformation/openbatteryinformation.github.io" target="_blank" rel="noopener" aria-label="View source on GitHub"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a>
<button id="theme-toggle" class="theme-toggle" type="button" aria-label="Switch to light mode">
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</button>
</div>
</nav>
<header class="hero">
<h1>Get started</h1>
<p class="tagline">
Build the interface, wire it to a battery, and flash the firmware — then read
your pack with OBI-1. Everything runs in your browser.
</p>
<div class="hero-actions">
<a href="#wiring"><button class="primary btn-lg">Jump to the wiring</button></a>
<a href="firmware/uploader.html"><button class="btn-lg">Flash the firmware</button></a>
</div>
</header>
<main>
<section class="section">
<h2>What you need</h2>
<p class="section-sub">A handful of parts, no soldering required for a first test.</p>
<div class="card">
<ul class="req-list">
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg></span>
<span><span class="req-title">Chrome, Edge, Opera or Firefox on desktop</span>
<span class="req-detail">Web Serial works in these browsers on desktop (Firefox 151+). Safari isn't supported.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg></span>
<span><span class="req-title">An Arduino Uno or ESP32-C3 with a USB cable</span>
<span class="req-detail">A genuine or compatible Uno with the optiboot bootloader, or an ESP32-C3 SuperMini. The uploader flashes either automatically.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg></span>
<span><span class="req-title">A few jumper wires and resistors</span>
<span class="req-detail">The Arduino OBI interface is just a one-wire link with two pull-up resistors — see the schematic below.</span></span>
</li>
<li>
<span class="req-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="16" height="10" x="2" y="7" rx="2" ry="2"/><line x1="22" x2="22" y1="11" y2="13"/></svg></span>
<span><span class="req-title">A supported battery</span>
<span class="req-detail">Currently the Makita LXT 18 V packs (BL18xx / BL14xx) via the Arduino OBI interface.</span></span>
</li>
</ul>
</div>
</section>
<section class="section" id="wiring">
<h2>The wiring</h2>
<p class="section-sub">The Arduino OBI interface bridges your board's serial port to the battery's one-wire data line.</p>
<div class="wiring-grid">
<figure class="wiring-figure">
<img src="assets/bafb89f4-26f0-451f-9e2a-7f6c2626a874.png" alt="Arduino OBI interface wiring diagram" title="Click to enlarge">
<figcaption>The Arduino OBI interface, from the
<a href="https://github.com/mnh-jansson/open-battery-information">upstream open-battery-information project</a>.</figcaption>
</figure>
<div>
<h3 class="wiring-heading">Arduino Uno</h3>
<table class="wiring-table">
<thead>
<tr><th>Signal</th><th>Pin</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td>Data (one-wire)</td><td>D6</td><td>Pulled up to 5 V through the schematic's resistor.</td></tr>
<tr><td>Enable (EN)</td><td>D8</td><td>Drives the battery's enable line when a command runs.</td></tr>
<tr><td>Power</td><td>5 V / GND</td><td>The interface is powered from the Uno's 5 V rail.</td></tr>
</tbody>
</table>
<h3 class="wiring-heading">ESP32-C3 (SuperMini)</h3>
<table class="wiring-table">
<thead>
<tr><th>Signal</th><th>Pin</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td>Data (one-wire)</td><td>GPIO1</td><td>Pulled up to 3.3 V — never 5 V.</td></tr>
<tr><td>Enable (EN)</td><td>GPIO0</td><td>Drives the battery's enable line.</td></tr>
<tr><td>Power</td><td>3.3 V / GND</td><td>The interface is powered from the ESP's 3.3 V rail.</td></tr>
</tbody>
</table>
</div>
</div>
<p class="wiring-battery">
On the battery side, connect the interface's <strong>data</strong> and <strong>enable</strong> wires to the
corresponding pads of your pack's communication connector (typically labelled D1 and D2) and a common
<strong>GND</strong>. Exact pad positions vary between packs — check the upstream documentation for your model.
</p>
<div class="warning">
<h3><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg> Read this before you wire anything</h3>
<p>
On an ESP32-C3 the pull-up resistors must be connected to the <strong>3.3 V</strong> pin — connecting them to
5 V will fry the GPIOs and destroy the module.
</p>
<p>
Batteries store a lot of energy. Work with one hand in your pocket, never short the terminals, and double-check
every connection before powering anything up. Incorrect wiring can damage the battery or your board.
</p>
<p>Use this software at your own risk. It is provided as open source (GPL-3.0) with no warranty and is not affiliated with or endorsed by Makita.</p>
</div>
</section>
<section class="section">
<h2>Next steps</h2>
<p class="section-sub">Once the interface is built and wired, you're minutes away from a diagnosis.</p>
<div class="steps">
<div class="step">
<span class="step-num"></span>
<h3>Flash the firmware</h3>
<p>Plug your board into USB and flash the Open Battery Information firmware straight from the browser — no Arduino IDE needed.</p>
<p><a class="step-link" href="firmware/uploader.html">Open the uploader →</a></p>
</div>
<div class="step">
<span class="step-num"></span>
<h3>Connect the board</h3>
<p>Open OBI-1, pick your board, and press Connect. It resets and identifies itself automatically.</p>
<p><a class="step-link" href="obi.html">Open OBI-1 →</a></p>
</div>
<div class="step">
<span class="step-num"></span>
<h3>Read the battery</h3>
<p>Insert a battery, press Read battery, and see cell voltages, temperatures, charge cycles, and status at a glance.</p>
</div>
</div>
</section>
</main>
<footer class="site-footer">
<p><strong>Open Battery Information</strong> — an open-source web port of the
<a href="https://github.com/mnh-jansson/open-battery-information">open-battery-information</a> project.</p>
<p>Released under the GPL-3.0 license. Independent project, not affiliated with Makita.</p>
</footer>
<script>
(function () {
var img = document.querySelector('.wiring-figure img');
if (!img) return;
var overlay = document.createElement('div');
overlay.className = 'lightbox';
overlay.setAttribute('role', 'dialog');
overlay.setAttribute('aria-label', 'Enlarged wiring diagram');
overlay.hidden = true;
var big = document.createElement('img');
big.src = img.src;
big.alt = img.alt;
overlay.appendChild(big);
document.body.appendChild(overlay);
img.addEventListener('click', function () { overlay.hidden = false; });
function close() { overlay.hidden = true; }
overlay.addEventListener('click', close);
document.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); });
})();
</script>
</body>
</html>