Compare commits
200 Commits
a6ae30d655
...
Firmware_1
Author | SHA1 | Date | |
---|---|---|---|
1126111edb | |||
a9053997a1 | |||
27993d72ee | |||
04705ce666 | |||
98629b744d | |||
c8c67551fd | |||
2b588b3be2 | |||
3a6c102b45 | |||
c6d65f50bf | |||
3e69485696 | |||
ec9a75e472 | |||
1966705f7f | |||
9cb3a61184 | |||
f735ea7b0d | |||
05f476bae2 | |||
c998cce1a8 | |||
12ee18adee | |||
8393f24ae2 | |||
546e4a1885 | |||
2d26a92937 | |||
c1513641fc | |||
a849e65f9a | |||
b6f9de2894 | |||
68d571a747 | |||
b7ccffc157 | |||
c7af5619eb | |||
3357691a21 | |||
5638c03e76 | |||
051796b19b | |||
cf032fe516 | |||
618ee4ce80 | |||
41d38a2afc | |||
bb824f0376 | |||
d08e0cfbb3 | |||
479b1861d1 | |||
b276d74907 | |||
8c022188c6 | |||
4d020b5ced | |||
c399672755 | |||
dd34bfe645 | |||
125fc17c39 | |||
8cf310e634 | |||
1ee326fd57 | |||
b627f52272 | |||
d723290e57 | |||
fbe5f0b202 | |||
f92f6a23c7 | |||
ac8be93faf | |||
059b693889 | |||
b723a80d46 | |||
26ec46eb0e | |||
d01953409e | |||
8ef469b9f1 | |||
88b572f408 | |||
75ed8e6308 | |||
bbd76e77fa | |||
dcaf56074e | |||
bc2c19dad1 | |||
8f494dfa05 | |||
e913ce6e1b | |||
d994fd25a0 | |||
cebf0db60c | |||
d524b919fd | |||
eac5dd243b | |||
f1defa98f2 | |||
94e407208e | |||
5df69bcdb7 | |||
a449c04cf4 | |||
ed6f4e488a | |||
0aae5a742c | |||
b79c4bd60f | |||
286ba1fe6c | |||
6a9d09ddf3 | |||
ef8f27e495 | |||
eee7baaece | |||
58c6bc820a | |||
925167ec3c | |||
c236322667 | |||
157d59963c | |||
ac28ab21d4 | |||
a7ea17ef05 | |||
f52f4103f6 | |||
62cc2bf982 | |||
e375fab048 | |||
16d6aee420 | |||
eaf2ad4933 | |||
9c2e039bf8 | |||
3d7e798310 | |||
e8a93a600e | |||
be53089726 | |||
e85eef271b | |||
cc93236b8e | |||
51b80f08a5 | |||
a576c7b70c | |||
aa3a2106aa | |||
f8a195bd4b | |||
b20481140c | |||
b37c0a05be | |||
2138f640ee | |||
d593e40f38 | |||
3bb9bf694e | |||
f320fb1ca6 | |||
b775738e20 | |||
c42de4b24c | |||
ce9f1a2306 | |||
e1770527ab | |||
aff1d40297 | |||
caff1c185f | |||
bea78c0020 | |||
744f8c431c | |||
e9567602d3 | |||
0469b183f2 | |||
e3392d92c4 | |||
6a6227ed85 | |||
c8f5cda4ba | |||
0bc7d0862b | |||
c593b8a546 | |||
6221262dbf | |||
83e288fdcf | |||
9c4c4a14b4 | |||
49b3598275 | |||
8fdd09f32f | |||
f87d2aaeca | |||
34c50df2e9 | |||
cb3d49ad13 | |||
f02a53e161 | |||
50208e4a1a | |||
a563182f3e | |||
335b883043 | |||
fb366b4976 | |||
367a41527d | |||
5460a70f6d | |||
3b4a22bff7 | |||
df209a788b | |||
a6031798da | |||
00cba7b5ac | |||
034b6c918b | |||
3af678f3f8 | |||
32107a45db | |||
a446a51c07 | |||
5b41090add | |||
2376d14b5d | |||
77a94de2eb | |||
c9a6e4c870 | |||
9ac161ee4c | |||
1f8b085598 | |||
46f98b1244 | |||
9e87a05418 | |||
140414ee8b | |||
371e21429d | |||
64f9e102a5 | |||
dc4dbb05ca | |||
8c0db2ffd9 | |||
c6b47fffaf | |||
1b49ed4a2e | |||
4167a222d7 | |||
f9498dac7d | |||
b9f658b111 | |||
4e34aaa24a | |||
084925b844 | |||
e6a861185c | |||
e12971b971 | |||
4f5fdb7af4 | |||
730f020f41 | |||
3af1cfcb1b | |||
685832cff8 | |||
3811834927 | |||
0025f8b0be | |||
a30f56ff58 | |||
26942dd946 | |||
c997949c5b | |||
1b0498ee5a | |||
82043ed9be | |||
f67817adb5 | |||
da19ebcc09 | |||
eaf2c9d8a8 | |||
9072f2b3e2 | |||
7d669dc04f | |||
79a7ca6fc1 | |||
821e94eec8 | |||
0d9acaf43e | |||
35361449eb | |||
45363b10fe | |||
c7f26bee32 | |||
984affb5a7 | |||
d78c73d61f | |||
812a094e50 | |||
2ada3d9a61 | |||
6ffe239cae | |||
bd4c1d9d53 | |||
808709f5c2 | |||
080742c88c | |||
38185e9056 | |||
17ed1ff7fa | |||
0e34e7121f | |||
4ce550c668 | |||
a6f5b4ef65 | |||
7c38d02bf8 | |||
01ba4b7333 | |||
3048c6c2a1 |
674
COPYING.GPLv3
Normal 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>.
|
BIN
Case/up to PCB Rev 4/Case_V1_Bottom.stl
Normal file
BIN
Case/up to PCB Rev 4/Case_V1_Lid.stl
Normal file
BIN
Case/up to PCB Rev 4/Case_V1_Lid_Display.stl
Normal file
192
DEV.md
Normal file
@@ -0,0 +1,192 @@
|
||||
# Developer Documentation – Smart Chain Oiler
|
||||
|
||||
Diese Datei richtet sich an Entwickler\:innen, die das Projekt aufbauen, erweitern oder debuggen wollen. Ergänzend zur [README.md](README.md) (Überblick & Features) enthält dieses Dokument Details zu Build‑Prozess, Debugging, Protokollen und internen Architekturen.
|
||||
|
||||
---
|
||||
|
||||
## Build & Flash
|
||||
|
||||
### PlatformIO Environments
|
||||
|
||||
* `pcb_rev_1-2_serial`, `pcb_rev_1-2_ota`
|
||||
* `pcb_rev_1-3_serial`, `pcb_rev_1-3_ota`
|
||||
* `pcb_rev_1-4_serial`, `pcb_rev_1-4_ota`
|
||||
|
||||
Default: **pcb\_rev\_1-4\_serial**
|
||||
|
||||
### Serial Flash
|
||||
|
||||
```bash
|
||||
pio run -e pcb_rev_1-4_serial -t upload
|
||||
```
|
||||
|
||||
### OTA Flash
|
||||
|
||||
```bash
|
||||
pio run -e pcb_rev_1-4_ota -t upload
|
||||
```
|
||||
|
||||
* Port: 8266
|
||||
* Auth: `ADMIN_PASSWORD` (aus `wifi_credentials.ini`)
|
||||
|
||||
### Filesystem Update (LittleFS)
|
||||
|
||||
* **Immer zuerst** FS‑Image flashen, wenn „Benötigte Flash‑Version“ ≠ „Installierte“
|
||||
* `.fs.gz` hochladen → danach `.fw.bin`
|
||||
|
||||
---
|
||||
|
||||
## Serial Console (115200 Baud)
|
||||
|
||||
Der ESP8266 bietet ein einfaches CLI (über UART oder USB). Nützliche Befehle:
|
||||
|
||||
| Befehl | Funktion |
|
||||
| ------------------ | ------------------------------ |
|
||||
| `help` | Liste aller Kommandos |
|
||||
| `sysinfo` | Systeminfo (Versionen, Uptime) |
|
||||
| `netinfo` | Netzwerkinfos (IP, WiFi) |
|
||||
| `dtc_list` | Aktive DTCs anzeigen |
|
||||
| `dtc_clear` | DTC‑Liste zurücksetzen |
|
||||
| `purge` | Entlüften/Pumpimpulse starten |
|
||||
| `toggle_wifi` | WiFi‑AP ein/aus |
|
||||
| `tank_refill` | Tankfüllstand zurücksetzen |
|
||||
| `isr_debug on/off` | Debug-Ausgabe zu Impuls‑ISR |
|
||||
|
||||
---
|
||||
|
||||
## WebSocket API
|
||||
|
||||
### Endpoint
|
||||
|
||||
`ws://<host>/ws`
|
||||
|
||||
### Server → Client Events
|
||||
|
||||
* `NOTIFY:<type>;<msg>` → Toast/Alert im UI
|
||||
* `DEBUG:<text>` → Debugausgabe
|
||||
* `DTC:<list>` → aktive DTCs (Format: `ts,code,severity,active;…`)
|
||||
* `MAPPING_STATUS:<map>` → Mapping Keys → Labels (Statuswerte)
|
||||
* `MAPPING_STATIC:<map>` → Mapping Keys → Labels (Staticwerte)
|
||||
* `STATUS:<values>` → Livewerte (z. B. Distanzzähler, Tank %)
|
||||
* `STATIC:<values>` → Konfiguration, Versionen
|
||||
|
||||
### Client → Server Events
|
||||
|
||||
* Generisches Schema: `btn-<elementId>:<value>`
|
||||
* Beispiel: `btn-refill:1` (Tankreset), `btn-purge:25` (25 Impulse)
|
||||
|
||||
---
|
||||
|
||||
## DTC Framework
|
||||
|
||||
Severity:
|
||||
|
||||
* **INFO** – nur Anzeige im WebUI
|
||||
* **WARN (Orange)** – Hinweis, Betrieb läuft weiter
|
||||
* **CRITICAL (Rot)** – Pumpe gestoppt
|
||||
|
||||
DTC‑Definitionen: siehe [`dtc_defs.txt`](dtc_defs.txt). Im WebUI werden Codes per `dtc_table.json` in Titel & Beschreibung gemappt.
|
||||
|
||||
---
|
||||
|
||||
## Tankmodell & Persistenz
|
||||
|
||||
* `amountPerDose_microL` definiert Ölmenge pro Puls
|
||||
* Virtueller Tank (ml, Warnschwelle %, Restreichweite)
|
||||
* Daten persistiert in EEPROM/Flash (Partition PDS)
|
||||
* Sanity/Checksum‑Prüfungen → passende DTCs
|
||||
|
||||
---
|
||||
|
||||
## Speed Sources
|
||||
|
||||
* **Impuls/Pickup:** via Interrupt (konfigurierbar: Puls/Umdrehung, Reifenmaße)
|
||||
* **GPS (TinyGPSPlus):** Baudrate wählbar, Distanzberechnung
|
||||
* **CAN (KTM‑spezifisch):** tested mit KTM 890 Adventure R & 1290 SuperDuke
|
||||
* **OBD2 CAN/K‑Line:** in Testphase (PCB ≥ 1.4 für K‑Line)
|
||||
|
||||
---
|
||||
|
||||
## LED Control
|
||||
|
||||
* Implementiert in `ledcontrol.cpp`
|
||||
* Farben + Muster (`led_colors.h`)
|
||||
* Brightness‑Range konfigurierbar (WebUI)
|
||||
* DTC Severity → LED Orange/Rot
|
||||
|
||||
---
|
||||
|
||||
## Codegen & Versionsverwaltung
|
||||
|
||||
* `struct2json.cpp` wird **automatisch generiert** (nicht manuell editieren)
|
||||
* Git‑Revision via `codegen/git_rev_macro.py` eingebettet
|
||||
* Flash‑Version Check: „Benötigte vs. Installierte Flash‑Version“ (WebUI‑Update‑Tab)
|
||||
|
||||
---
|
||||
|
||||
## Hardware Pin‑Mapping & PCB Revisionen
|
||||
|
||||
### Power‑Pfad (Rev 1.4)
|
||||
|
||||
* **+12 V Eingang** → **Verpolschutz‑Diode** → **Step‑Down auf 5 V** → versorgt **Wemos D1 mini**
|
||||
* **3,3 V** wird vom **Wemos** bereitgestellt (per LDO) und speist Peripherie (CAN, K‑Line, OLED, EEPROM, WS2812‑Data‑Level ok am D3)
|
||||
* **Pumpe**: Low‑Side‑MOSFET mit **Freilaufdiode** (Entstörung gegen induktive Spannungsspitzen)
|
||||
|
||||
### Wemos D1 mini (ESP8266) – Pins
|
||||
|
||||
| Funktion | Board‑Pin | GPIO | Bemerkung |
|
||||
| ---------------------------------- | --------- | ------ | ------------------------------------------------------------------------------------------- |
|
||||
| **Pumpe (MOSFET, Low‑Side)** | D0 | GPIO16 | Schaltausgang für Pumpentreiber |
|
||||
| **I²C SCL (OLED/EEPROM)** | D1 | GPIO5 | U8g2 + I2C‑EEPROM auf gleichem Bus |
|
||||
| **I²C SDA (OLED/EEPROM)** | D2 | GPIO4 | Pull‑Ups auf 3,3 V vorhanden |
|
||||
| **WS2812 LED – Data** | D3 | GPIO0 | Serieller Widerstand im Datenpfad |
|
||||
| **Cockpit‑Taster** | D4 | GPIO2 | gegen **GND**, Schutzdiode, interner Pull‑Up |
|
||||
| **SPI SCK (MCP2515)** | D5 | GPIO14 | CAN‑Controller |
|
||||
| **SPI MISO (MCP2515)** | D6 | GPIO12 | shared mit internen Leitungen, siehe K‑Line/UART Hinweis |
|
||||
| **SPI MOSI (MCP2515)** | D7 | GPIO13 | CAN‑Controller |
|
||||
| **CS / CEN / Impuls (per Jumper)** | D8 | GPIO15 | **Jumper‑Funktion**: CS für MCP2515 **oder** **CEN\_K‑Line** **oder** **Impuls‑Eingang** |
|
||||
| **UART0 TX** | TX (J4‑4) | GPIO1 | geht an USB‑UART **und** an K‑Line‑Transceiver (aktiv nur wenn **CEN\_K‑Line** gesetzt) |
|
||||
| **UART0 RX / GPS‑Eingang** | RX (J4‑3) | GPIO3 | USB‑UART **und** GPS‑Eingang; GPS‑Frames werden vom Parser konsumiert, Rest an CLI geroutet |
|
||||
|
||||
> **Hinweis zu K‑Line:** Der MC33660 wird über **CEN\_K‑Line** (D8, per Löt‑Jumper) nur aktiviert, wenn gesendet/empfangen werden soll. Dadurch bleibt die serielle Konsole (USB) im Normalbetrieb verfügbar.
|
||||
|
||||
### CAN / OBD‑K‑Line / GPS – Anschlüsse
|
||||
|
||||
* **CAN:** MCP2515 (SPI) + MCP2551, Signale **CAN\_H**/**CAN\_L** nach außen geführt
|
||||
* **K‑Line:** MC33660, UART0 TX/RX zugeschaltet über **CEN\_K‑Line**
|
||||
* **GPS (seriell):** UART0 RX an **J4‑Pin 3**, Baudrate im WebUI wählbar; nur RX genutzt
|
||||
|
||||
### PCB‑Revisionen
|
||||
|
||||
* **Rev 1.2:** Basis (Pumpe, Taster, LED, optional OLED/I²C)
|
||||
* **Rev 1.3:** Verbesserte CAN‑Integration/Power‑Pfad
|
||||
* **Rev 1.4:** K‑Line‑Transceiver, Jumper‑Mux auf **D8** (CS/CEN/Impuls), GPS‑Header (J4)
|
||||
|
||||
\-------------------|------|-----------------|-------------------------------------------|
|
||||
\| Taster | D3 | GPIO0 | Pull‑Up, ISR‑Abfrage |
|
||||
\| RGB‑LED (WS2812) | D4 | GPIO2 | Adafruit NeoPixel‑Lib |
|
||||
\| Pumpe (MOSFET) | D1 | GPIO5 | Low‑Side Treiber |
|
||||
\| CAN‑CS | D8 | GPIO15 | MCP2515 CS |
|
||||
\| CAN‑INT | D0 | GPIO16 | Interrupt vom MCP2515 |
|
||||
\| OBD2 K‑Line | D7 | GPIO13 | ab PCB Rev 1.4, Pegelwandler erforderlich |
|
||||
\| GPS RX | D6 | GPIO12 | Seriell, TinyGPSPlus |
|
||||
\| OLED I²C SCL | D5 | GPIO14 | U8g2‑Lib |
|
||||
\| OLED I²C SDA | D2 | GPIO4 | U8g2‑Lib |
|
||||
|
||||
> Hinweis: tatsächliches Mapping je nach `config.h` und PCB‑Revision. Tabelle zeigt Standardzuordnung Rev 1.4.
|
||||
|
||||
### PCB Revisionen
|
||||
|
||||
* **Rev 1.2:** Basisfunktionen, kein OBD2‑Support
|
||||
* **Rev 1.3:** Verbesserte CAN‑Integration, stabileres Power‑Design
|
||||
* **Rev 1.4:** zusätzlicher Pegelwandler für **OBD2 K‑Line**, vorbereitet für GPS‑Modul
|
||||
|
||||
---
|
||||
|
||||
## Known Limitations / TODO
|
||||
|
||||
* OBD2 CAN/K‑Line: nur Basisfunktionen, erweiterte PID‑Unterstützung offen
|
||||
* GPS: bei schlechtem Empfang kann DTC „NO GPS SIGNAL“ spammen
|
||||
* OLED: nur Basic‑Statusanzeigen; keine volle UI
|
||||
|
||||
---
|
BIN
Documentation/Anschluss Schemata PCB Rev_1.2.jpg
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
Documentation/Anschluss Schemata PCB Rev_1.3.jpg
Normal file
After Width: | Height: | Size: 101 KiB |
BIN
Documentation/Dellorto PLE Pumpe.pdf
Normal file
245
Documentation/Manual.md
Normal file
@@ -0,0 +1,245 @@
|
||||
# Kettenöler – Bedienungsanleitung
|
||||
|
||||
Diese Anleitung beschreibt Installation, Bedienung und Wartung des Smart Chain Oiler Systems.
|
||||
|
||||
---
|
||||
|
||||
## 1. Einleitung & Sicherheit
|
||||
|
||||
Der Smart Chain Oiler ist ein intelligenter, mikrocontroller‑gesteuerter Kettenöler für Motorräder.
|
||||
|
||||
⚠️ **Sicherheits- und Nutzungshinweise:**
|
||||
|
||||
* Der Einbau erfordert grundlegende Kenntnisse in Elektronik und Fahrzeugtechnik.
|
||||
* Öl darf nur auf die Kette aufgetragen werden – nicht auf Reifen oder Bremsen.
|
||||
* Ein leerer Tank oder Fehlfunktion kann zum Ausfall der automatischen Schmierung führen. Kette regelmäßig prüfen.
|
||||
* Nutzung auf eigene Verantwortung.
|
||||
|
||||
---
|
||||
|
||||
## 2. Systemübersicht
|
||||
|
||||
**Bedienung:**
|
||||
|
||||
* 1x Taster (multifunktional)
|
||||
* RGB‑LED (Statusanzeige)
|
||||
* Optional: I²C OLED‑Display (128x64)
|
||||
* Erweiterte Einstellungen und Wartung über WebUI (WiFi‑Access Point)
|
||||
|
||||
**Komponenten:**
|
||||
|
||||
* ESP8266 MCU (Wemos D1 mini)
|
||||
* Pumpe (empfohlen: McCoi Spezial‑Ölpumpe)
|
||||
* Tank (frei wählbar, Größe im WebUI einstellbar)
|
||||
|
||||
---
|
||||
|
||||
## 3. Installation & Anschluss
|
||||
|
||||
### Versorgung
|
||||
|
||||
* **Spannungsversorgung:** 12 V DC
|
||||
* **Anschluss:** **Zündungs-Plus (ACC)**, nicht Dauerplus (verhindert Batterieentladung)
|
||||
* **Absicherung:** **5 A Sicherung** empfohlen (kurzzeitige hohe Stromaufnahme von 1A bis 2A der Pumpe möglich)
|
||||
|
||||
### Anschlussklemmen & Header
|
||||
|
||||
* **Power-Klemme (3-polige Schraubklemme):**
|
||||
|
||||
* Pin 1: **+12 V** (Zündungsplus, ggf. Sicherung vorschalten)
|
||||
* Pin 2: **Pumpen-Minus** (geht auf MOSFET → wird geschaltet)
|
||||
* Pin 3: **GND** (gemeinsame Masse)
|
||||
* 👉 Pumpen-Plus kommt direkt an +12 V (hinter der Sicherung).
|
||||
|
||||
* **Cockpit-Header (LED/Taster/OLED):**
|
||||
|
||||
| Pin | Signal | Bemerkung |
|
||||
| --- | --------- | ----------------------------------------------------------- |
|
||||
| 1 | SDA (I²C) | Datenleitung für OLED, Pull-Up 4k7 auf 3,3 V |
|
||||
| 2 | +5 V | Versorgung für Cockpit (LED, OLED etc.) |
|
||||
| 3 | SCL (I²C) | Taktleitung für OLED, Pull-Up 4k7 auf 3,3 V |
|
||||
| 4 | LED Data | WS2812 LED Datenleitung (über R3=100 Ω) |
|
||||
| 5 | +3,3 V | I²C/OLED Versorgung (vom ESP8266 intern bereitgestellt) |
|
||||
| 6 | Taster | GPIO2, gegen GND, mit Schutzdiode |
|
||||
| 7 | GND | Masse |
|
||||
| 8 | GND | Masse |
|
||||
|
||||
* ⚠️ Die Leitungen des Display sollten **kurz gehalten werden** (Faustregel: <20 cm bei ungeschirmten Leitungen).
|
||||
|
||||
* **Signal-Header (Eingänge):**
|
||||
|
||||
| Pin | Signal | Bemerkung |
|
||||
| --- | ----------- | -------------------------------------------------------- |
|
||||
| 1 | GND | Masse |
|
||||
| 2 | K-Line OBD2 | OBD2 K-Line, geht auf den MC33660 |
|
||||
| 3 | SERIAL\_RX | UART0 RX (für GPS oder CLI), geschützt durch Diode |
|
||||
| 4 | SERIAL\_TX | UART0 TX (CLI, Debug) |
|
||||
| 5 | GPIO\_PULSE | Impulseingang (Pickup/Tachosignal), RC-gefiltert + Diode |
|
||||
| 6 | CAN\_L | Low-Leitung für CAN |
|
||||
| 7 | GND | Masse (zweiter Anschluss, symmetrisch) |
|
||||
| 8 | CAN\_H | High-Leitung für CAN |
|
||||
|
||||
👉 Details siehe Anschluss‑Schemata der jeweiligen PCB‑Revision.
|
||||
|
||||
---
|
||||
|
||||
## 4. LED-Anzeigen
|
||||
|
||||
* **Grün** → Normalmodus (Standard-Schmierung)
|
||||
* **Blau** → Regenmodus (verstärkte Schmierung)
|
||||
* **Pink blinkend** → Prime/Entlüften aktiv
|
||||
* **Türkis** → Wash‑Mode aktiv
|
||||
* **Gelb aufblitzend** → WiFi‑AP aktiv
|
||||
* **Orange** → Warnung (Tank niedrig, EEPROM Sanity, oder anderes DTC/WARN)
|
||||
* **Rot** → Kritischer Fehler (DTC\_CRITICAL, Öler gestoppt)
|
||||
|
||||
---
|
||||
|
||||
## 5. Bedienung über den Taster
|
||||
|
||||
Prinzip: **Taste gedrückt halten → LED‑Farbe beobachten → bei gewünschter Farbe loslassen**.
|
||||
|
||||
* **0,5–3,5 s halten → loslassen:** Normal (Grün) ↔ Regen (Blau)
|
||||
* **3,5–6,5 s halten → loslassen:** Wash‑Mode aktivieren (Türkis)
|
||||
* **6,5–9,5 s halten → loslassen:** Prime / Entlüften starten (Pink blinkend)
|
||||
* **9,5–12,5 s halten → loslassen:** WiFi‑AP ein-/ausschalten (Gelb)
|
||||
|
||||
---
|
||||
|
||||
## 6. Funktionsbeschreibung der Modi
|
||||
|
||||
### Normalmodus (Grün)
|
||||
|
||||
* Schmierimpuls alle **8.000 m** (Standard, im WebUI anpassbar)
|
||||
* Zähler metergenau, auch über Neustarts hinweg
|
||||
|
||||
### Regenmodus (Blau)
|
||||
|
||||
* Schmierimpuls alle **4.000 m** (Standard, im WebUI anpassbar)
|
||||
* Zuletzt gewählter Modus wird gespeichert und nach Neustart übernommen
|
||||
|
||||
### Wash‑Mode (Türkis)
|
||||
|
||||
* Für Pflege nach Reinigung (z. B. Hochdruckreiniger)
|
||||
* Standard: alle **10 m** ein Impuls über **500 m**
|
||||
* Danach automatische Rückkehr in Normal/Regen
|
||||
|
||||
### Prime / Entlüften (Pink blinkend)
|
||||
|
||||
* Standard: **25 Impulse**, Leitung spülen oder Luft entfernen
|
||||
* Auch über WebUI startbar
|
||||
|
||||
### WiFi-AP (Gelb)
|
||||
|
||||
* Aktiviert den Access Point für das WebUI
|
||||
* Zugriff auf Einstellungen, Wartung und Updates
|
||||
|
||||
**So geht’s:**
|
||||
|
||||
1. **Taster gedrückt halten**, bis die LED **Gelb** aufleuchtet → dann loslassen.
|
||||
2. Der WiFi-Hotspot startet und bleibt **bis zum nächsten Neustart** aktiv.
|
||||
3. SSID: **`ChainLube_XXXXXX`** (XXXXXX = ChipID des ESP8266)
|
||||
4. Passwort: **`wifiappass`**
|
||||
5. Smartphone/PC mit dem Hotspot verbinden.
|
||||
* Android meldet evtl. *„Dieses Netzwerk hat keine Internetverbindung“* → trotzdem verbunden bleiben.
|
||||
6. Browser öffnen → **[http://10.0.0.1](http://10.0.0.1)** aufrufen → WebUI erscheint.
|
||||
|
||||
### Tanküberwachung
|
||||
|
||||
* Virtuell, basierend auf Tankgröße im WebUI
|
||||
* **Orange LED + WARN DTC:** Tank fast leer
|
||||
* **Rot LED + CRITICAL DTC:** Tank leer, Öler gestoppt
|
||||
* Tank jederzeit im WebUI zurücksetzbar
|
||||
|
||||
---
|
||||
|
||||
## 7. WebUI Bedienung
|
||||
|
||||
WiFi‑AP öffnen → Browser → `10.0.0.1`
|
||||
|
||||
### Tabs & Funktionen
|
||||
|
||||
* **Home:** Tankstand %, Status, aktive DTCs
|
||||
* **Wartung:** Tank zurücksetzen, Purge starten, Einmessen, Live‑Debug, Reboot
|
||||
* **Einstellungen:** Signalquelle (Impuls/CAN/GPS/OBD), Dosierung, Tankgröße, LED, WiFi
|
||||
* **Update:** Firmwareversionen, Flash‑Version, Git‑Revision, Firmware‑ und Filesystem‑Update, EEPROM‑Backup/Restore
|
||||
|
||||
👉 Wechsel der Signalquelle führt zu Neustart!
|
||||
|
||||
---
|
||||
|
||||
Genau so machen wir’s 🐺✨ – hier meine überarbeiteten Versionen für die beiden Abschnitte plus ein Vorschlag für den Feedback-Teil am Ende:
|
||||
|
||||
---
|
||||
|
||||
### **8. Diagnose (DTC)**
|
||||
|
||||
### Kategorien
|
||||
|
||||
* **INFO:** Nur im WebUI sichtbar, keine LED-Reaktion
|
||||
* **WARN (Orange):** Hinweis, Betrieb läuft weiter
|
||||
* **CRITICAL (Rot):** Kritisch, Pumpe gestoppt
|
||||
|
||||
### Darstellung
|
||||
|
||||
* **Alle aktiven DTCs** werden **im WebUI mit Volltext und Beschreibung angezeigt**.
|
||||
* Über die LED wird nur die Schwere (Warnung/Kritisch) signalisiert.
|
||||
|
||||
### Typische Beispiele
|
||||
|
||||
* **Tank leer (CRITICAL, Rot):** Vorrat nachfüllen, Tank im WebUI zurücksetzen
|
||||
* **Tank niedrig (WARN, Orange):** Vorrat bald auffüllen
|
||||
* **EEPROM/Flash Fehler (CRITICAL, Rot):** Speicher zurücksetzen, ggf. Hardware prüfen
|
||||
* **GPS/CAN/OBD Fehler:** Verbindung oder Konfiguration prüfen
|
||||
* **Dummy-DTCs:** nur für Debugzwecke
|
||||
|
||||
👉 Vollständige Liste aller Codes und Texte siehe `dtc_defs.txt` / `dtc_table.json`.
|
||||
|
||||
---
|
||||
|
||||
## 9. Troubleshooting
|
||||
|
||||
| Symptom | Ursache | Lösung |
|
||||
| -------------------------- | ------------------------------------------ | --------------------------------------------- |
|
||||
| LED dauerhaft Rot | Kritischer DTC (Tank leer, EEPROM, Flash) | WebUI öffnen, DTC prüfen, Ursache beheben |
|
||||
| Keine Schmierung | Tank leer oder Pumpe blockiert | Tank auffüllen, Purge starten, Pumpe prüfen |
|
||||
| Kein WebUI erreichbar | AP nicht aktiv | Taste 9,5–12,5 s halten, auf Gelb warten |
|
||||
| GPS zeigt nichts | Falsche Baudrate oder kein Signal | Baudrate im WebUI prüfen, Antenne freie Sicht |
|
||||
| CAN/OBD funktioniert nicht | Falsches Modell oder Jumper falsch gesetzt | Einstellungen prüfen, Jumper korrekt setzen |
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
### **10. Wartung**
|
||||
|
||||
* Regelmäßig Ölstand prüfen und im WebUI nach dem Nachfüllen **Tank zurücksetzen**
|
||||
* Nach längeren Standzeiten (z. B. Winterpause) einmal **Prime/Purge** laufen lassen, um die Leitung zu spülen
|
||||
* Kabel & Anschlüsse auf festen Sitz und Isolation prüfen
|
||||
* Software- und WebUI-Updates **nur bei Bedarf** einspielen (z. B. bei neuen Funktionen oder Bugfixes)
|
||||
|
||||
---
|
||||
|
||||
## **11. Technische Daten**
|
||||
|
||||
* **Versorgung:** 12 V DC (Motorradbatterie), \~50 mA (ohne Pumpe)
|
||||
* **MCU:** ESP8266 (Wemos D1 mini)
|
||||
* **Tankgröße:** frei einstellbar (ml)
|
||||
* **Dosierung:** konfigurierbar in µl pro Puls
|
||||
* **Signalquellen:** Impuls, GPS, CAN (KTM), OBD2 (CAN/K‑Line)
|
||||
* **Speicher:** EEPROM für CFG & PDS, Checksummen & Sanity Checks
|
||||
* **Pumpen:** abgestimmt auf McCoi Spezial‑Ölpumpe
|
||||
* **Betriebstemperatur:** −10 bis +70 °C
|
||||
|
||||
---
|
||||
|
||||
## **12. Feedback & Community**
|
||||
|
||||
Dieses Projekt lebt vom Feedback und den Ideen der Nutzer.
|
||||
|
||||
* Wenn du Fehler findest oder Verbesserungsvorschläge hast → melde dich!
|
||||
* Auch neue Ideen für Features oder Anpassungen an andere Motorräder sind willkommen.
|
||||
* Rückmeldungen helfen, den Öler stabiler, praktischer und vielseitiger zu machen.
|
||||
* Diskussionen, Tests und Spinnereien sind ausdrücklich erwünscht – manchmal entstehen daraus die besten Features.
|
||||
|
||||
💡 Ja, mir ist klar: das Ding ist für „einfach nur Kette ölen“ eigentlich hoffnungslos **over-engineered** – aber genau das macht den Reiz aus. Ich hab Spaß daran und freue mich über alles, was das Projekt noch ein Stück nerdiger, smarter oder einfach nützlicher macht.
|
BIN
Documentation/PCB_rev_1.2 Connections.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
Documentation/PCB_rev_1.3 Connections.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
Documentation/WS2811 5mm LED.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
24
Hardware/MC33660.lib
Normal file
@@ -0,0 +1,24 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# MC33660
|
||||
#
|
||||
DEF MC33660 U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 0 50 H V C CNN
|
||||
F1 "MC33660" 0 -100 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
S -400 250 400 -350 0 1 0 N
|
||||
X VBB 1 50 450 200 D 50 50 1 1 W
|
||||
X NC 2 -50 -550 200 U 50 50 1 1 W
|
||||
X GND 3 50 -550 200 U 50 50 1 1 W
|
||||
X ISO 4 600 -50 200 L 50 50 1 1 B
|
||||
X TX 5 -600 -200 200 R 50 50 1 1 O
|
||||
X RX 6 -600 -50 200 R 50 50 1 1 I
|
||||
X VDD 7 -50 450 200 D 50 50 1 1 W
|
||||
X CEN 8 -600 100 200 R 50 50 1 1 I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
@@ -1,15 +1,19 @@
|
||||
{
|
||||
"board": {
|
||||
"3dviewports": [],
|
||||
"design_settings": {
|
||||
"defaults": {
|
||||
"board_outline_line_width": 0.049999999999999996,
|
||||
"copper_line_width": 0.19999999999999998,
|
||||
"apply_defaults_to_fp_fields": false,
|
||||
"apply_defaults_to_fp_shapes": false,
|
||||
"apply_defaults_to_fp_text": false,
|
||||
"board_outline_line_width": 0.05,
|
||||
"copper_line_width": 0.2,
|
||||
"copper_text_italic": false,
|
||||
"copper_text_size_h": 1.5,
|
||||
"copper_text_size_v": 1.5,
|
||||
"copper_text_thickness": 0.3,
|
||||
"copper_text_upright": false,
|
||||
"courtyard_line_width": 0.049999999999999996,
|
||||
"courtyard_line_width": 0.05,
|
||||
"dimension_precision": 4,
|
||||
"dimension_units": 3,
|
||||
"dimensions": {
|
||||
@@ -20,13 +24,13 @@
|
||||
"text_position": 0,
|
||||
"units_format": 1
|
||||
},
|
||||
"fab_line_width": 0.09999999999999999,
|
||||
"fab_line_width": 0.1,
|
||||
"fab_text_italic": false,
|
||||
"fab_text_size_h": 1.0,
|
||||
"fab_text_size_v": 1.0,
|
||||
"fab_text_thickness": 0.15,
|
||||
"fab_text_upright": false,
|
||||
"other_line_width": 0.09999999999999999,
|
||||
"other_line_width": 0.1,
|
||||
"other_text_italic": false,
|
||||
"other_text_size_h": 1.0,
|
||||
"other_text_size_v": 1.0,
|
||||
@@ -45,11 +49,100 @@
|
||||
"silk_text_upright": false,
|
||||
"zones": {
|
||||
"45_degree_only": false,
|
||||
"min_clearance": 0.19999999999999998
|
||||
"min_clearance": 0.2
|
||||
}
|
||||
},
|
||||
"diff_pair_dimensions": [],
|
||||
"drc_exclusions": [],
|
||||
"drc_exclusions": [
|
||||
[
|
||||
"courtyards_overlap|118511500|75177000|1553c88f-2adb-4497-8788-967b865e436a|b792e1a3-e773-46cb-bdd0-cca64b65c21c",
|
||||
""
|
||||
],
|
||||
[
|
||||
"courtyards_overlap|123007000|75355000|00000000-0000-0000-0000-000061d28ad3|1553c88f-2adb-4497-8788-967b865e436a",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_issues|141478000|85575000|00000000-0000-0000-0000-000061d2ae4b|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|115824000|80772000|1553c88f-2adb-4497-8788-967b865e436a|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|124460000|93980000|f3127aa8-4fa0-47de-9985-06be44bbdf06|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|125984000|82296000|00000000-0000-0000-0000-000061d2caf2|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|129032000|77978000|00000000-0000-0000-0000-000061de69e4|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|129540000|88900000|479edbfe-22e9-482f-abe6-e8a9ee4f8095|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|132842000|93218000|00000000-0000-0000-0000-000061d28984|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|139700000|89916000|0b7b6b80-ae94-4b1b-a38e-a90a7895e1d0|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"lib_footprint_mismatch|145703000|65864500|00000000-0000-0000-0000-000061d2f827|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"malformed_courtyard|124128000|98140000|00000000-0000-0000-0000-000061d2ae4b|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"malformed_courtyard|124178000|72040000|00000000-0000-0000-0000-000061d2ae4b|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"malformed_courtyard|158828000|72040000|00000000-0000-0000-0000-000061d2ae4b|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_edge_clearance|108458000|61861000|ccc4cc25-ac17-45ef-825c-e079951ffb21|dc75368d-0996-4249-8abb-dc4cf7e8b3a4",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_edge_clearance|108458000|74901000|ccc4cc25-ac17-45ef-825c-e079951ffb21|53b3d478-aede-49e5-a9c6-af0d51081e6b",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_edge_clearance|131953000|99060000|626679e8-6101-4722-ac57-5b8d9dab4c8b|0ceda40c-021b-4e82-b42f-da6ab60c2da7",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_over_copper|124256491|96080000|5918385d-932b-42f5-93dc-b50c4d404527|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_over_copper|126686000|72160000|c0c7c21a-5ba8-4e1a-b19c-dd42f87b5e73|00000000-0000-0000-0000-000000000000",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_overlap|114722000|93418819|2389429b-e330-41bd-ae02-ffdf7f42affb|277dc3b2-ee65-405f-ac52-614baa7cb1bf",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_overlap|114807618|80226819|2cde46e7-b5a2-4709-b127-bb84cc090edc|d0190ea1-2eb5-4019-a426-876a8032a9c9",
|
||||
""
|
||||
],
|
||||
[
|
||||
"silk_overlap|125118537|76007746|ba335760-ecfa-408d-9aa6-aeeaddbba1a7|d65dbdcd-4994-45be-8af9-98fc61c06e09",
|
||||
""
|
||||
]
|
||||
],
|
||||
"meta": {
|
||||
"filename": "board_design_settings.json",
|
||||
"version": 2
|
||||
@@ -57,35 +150,56 @@
|
||||
"rule_severities": {
|
||||
"annular_width": "error",
|
||||
"clearance": "error",
|
||||
"connection_width": "warning",
|
||||
"copper_edge_clearance": "error",
|
||||
"copper_sliver": "warning",
|
||||
"courtyards_overlap": "error",
|
||||
"creepage": "error",
|
||||
"diff_pair_gap_out_of_range": "error",
|
||||
"diff_pair_uncoupled_length_too_long": "error",
|
||||
"drill_out_of_range": "error",
|
||||
"duplicate_footprints": "warning",
|
||||
"extra_footprint": "warning",
|
||||
"footprint": "error",
|
||||
"footprint_filters_mismatch": "ignore",
|
||||
"footprint_symbol_mismatch": "warning",
|
||||
"footprint_type_mismatch": "error",
|
||||
"hole_clearance": "error",
|
||||
"hole_near_hole": "error",
|
||||
"hole_to_hole": "error",
|
||||
"holes_co_located": "warning",
|
||||
"invalid_outline": "error",
|
||||
"isolated_copper": "warning",
|
||||
"item_on_disabled_layer": "error",
|
||||
"items_not_allowed": "error",
|
||||
"length_out_of_range": "error",
|
||||
"lib_footprint_issues": "warning",
|
||||
"lib_footprint_mismatch": "warning",
|
||||
"malformed_courtyard": "error",
|
||||
"microvia_drill_out_of_range": "error",
|
||||
"mirrored_text_on_front_layer": "warning",
|
||||
"missing_courtyard": "ignore",
|
||||
"missing_footprint": "warning",
|
||||
"net_conflict": "warning",
|
||||
"nonmirrored_text_on_back_layer": "warning",
|
||||
"npth_inside_courtyard": "ignore",
|
||||
"padstack": "error",
|
||||
"pth_inside_courtyard": "ignore",
|
||||
"shorting_items": "error",
|
||||
"silk_edge_clearance": "warning",
|
||||
"silk_over_copper": "warning",
|
||||
"silk_overlap": "warning",
|
||||
"skew_out_of_range": "error",
|
||||
"solder_mask_bridge": "error",
|
||||
"starved_thermal": "error",
|
||||
"text_height": "warning",
|
||||
"text_on_edge_cuts": "error",
|
||||
"text_thickness": "warning",
|
||||
"through_hole_pad_without_hole": "error",
|
||||
"too_many_vias": "error",
|
||||
"track_angle": "error",
|
||||
"track_dangling": "warning",
|
||||
"track_segment_length": "error",
|
||||
"track_width": "error",
|
||||
"tracks_crossing": "error",
|
||||
"unconnected_items": "error",
|
||||
@@ -101,24 +215,100 @@
|
||||
"allow_microvias": false,
|
||||
"max_error": 0.005,
|
||||
"min_clearance": 0.0,
|
||||
"min_copper_edge_clearance": 0.049999999999999996,
|
||||
"min_connection": 0.0,
|
||||
"min_copper_edge_clearance": 0.05,
|
||||
"min_groove_width": 0.0,
|
||||
"min_hole_clearance": 0.25,
|
||||
"min_hole_to_hole": 0.25,
|
||||
"min_microvia_diameter": 0.19999999999999998,
|
||||
"min_microvia_drill": 0.09999999999999999,
|
||||
"min_microvia_diameter": 0.2,
|
||||
"min_microvia_drill": 0.1,
|
||||
"min_resolved_spokes": 2,
|
||||
"min_silk_clearance": 0.0,
|
||||
"min_text_height": 0.8,
|
||||
"min_text_thickness": 0.08,
|
||||
"min_through_hole_diameter": 0.3,
|
||||
"min_track_width": 0.19999999999999998,
|
||||
"min_via_annular_width": 0.049999999999999996,
|
||||
"min_via_diameter": 0.39999999999999997,
|
||||
"min_track_width": 0.2,
|
||||
"min_via_annular_width": 0.05,
|
||||
"min_via_diameter": 0.4,
|
||||
"solder_mask_to_copper_clearance": 0.005,
|
||||
"use_height_for_length_calcs": true
|
||||
},
|
||||
"teardrop_options": [
|
||||
{
|
||||
"td_onpthpad": true,
|
||||
"td_onroundshapesonly": false,
|
||||
"td_onsmdpad": true,
|
||||
"td_ontrackend": false,
|
||||
"td_onvia": true
|
||||
}
|
||||
],
|
||||
"teardrop_parameters": [
|
||||
{
|
||||
"td_allow_use_two_tracks": true,
|
||||
"td_curve_segcount": 0,
|
||||
"td_height_ratio": 1.0,
|
||||
"td_length_ratio": 0.5,
|
||||
"td_maxheight": 2.0,
|
||||
"td_maxlen": 1.0,
|
||||
"td_on_pad_in_zone": false,
|
||||
"td_target_name": "td_round_shape",
|
||||
"td_width_to_size_filter_ratio": 0.9
|
||||
},
|
||||
{
|
||||
"td_allow_use_two_tracks": true,
|
||||
"td_curve_segcount": 0,
|
||||
"td_height_ratio": 1.0,
|
||||
"td_length_ratio": 0.5,
|
||||
"td_maxheight": 2.0,
|
||||
"td_maxlen": 1.0,
|
||||
"td_on_pad_in_zone": false,
|
||||
"td_target_name": "td_rect_shape",
|
||||
"td_width_to_size_filter_ratio": 0.9
|
||||
},
|
||||
{
|
||||
"td_allow_use_two_tracks": true,
|
||||
"td_curve_segcount": 0,
|
||||
"td_height_ratio": 1.0,
|
||||
"td_length_ratio": 0.5,
|
||||
"td_maxheight": 2.0,
|
||||
"td_maxlen": 1.0,
|
||||
"td_on_pad_in_zone": false,
|
||||
"td_target_name": "td_track_end",
|
||||
"td_width_to_size_filter_ratio": 0.9
|
||||
}
|
||||
],
|
||||
"track_widths": [
|
||||
0.0,
|
||||
0.5,
|
||||
1.0,
|
||||
2.0
|
||||
],
|
||||
"tuning_pattern_settings": {
|
||||
"diff_pair_defaults": {
|
||||
"corner_radius_percentage": 80,
|
||||
"corner_style": 1,
|
||||
"max_amplitude": 1.0,
|
||||
"min_amplitude": 0.2,
|
||||
"single_sided": false,
|
||||
"spacing": 1.0
|
||||
},
|
||||
"diff_pair_skew_defaults": {
|
||||
"corner_radius_percentage": 80,
|
||||
"corner_style": 1,
|
||||
"max_amplitude": 1.0,
|
||||
"min_amplitude": 0.2,
|
||||
"single_sided": false,
|
||||
"spacing": 0.6
|
||||
},
|
||||
"single_track_defaults": {
|
||||
"corner_radius_percentage": 80,
|
||||
"corner_style": 1,
|
||||
"max_amplitude": 1.0,
|
||||
"min_amplitude": 0.2,
|
||||
"single_sided": false,
|
||||
"spacing": 0.6
|
||||
}
|
||||
},
|
||||
"via_dimensions": [
|
||||
{
|
||||
"diameter": 0.0,
|
||||
@@ -140,7 +330,16 @@
|
||||
"zones_allow_external_fillets": false,
|
||||
"zones_use_no_outline": true
|
||||
},
|
||||
"layer_presets": []
|
||||
"ipc2581": {
|
||||
"dist": "",
|
||||
"distpn": "",
|
||||
"internal_id": "",
|
||||
"mfg": "",
|
||||
"mpn": ""
|
||||
},
|
||||
"layer_pairs": [],
|
||||
"layer_presets": [],
|
||||
"viewports": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
@@ -331,11 +530,21 @@
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"endpoint_off_grid": "warning",
|
||||
"extra_units": "error",
|
||||
"footprint_filter": "ignore",
|
||||
"footprint_link_issues": "warning",
|
||||
"four_way_junction": "ignore",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"label_multiple_wires": "warning",
|
||||
"lib_symbol_issues": "warning",
|
||||
"lib_symbol_mismatch": "warning",
|
||||
"missing_bidi_pin": "warning",
|
||||
"missing_input_pin": "warning",
|
||||
"missing_power_pin": "error",
|
||||
"missing_unit": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
@@ -344,8 +553,14 @@
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"same_local_global_label": "warning",
|
||||
"similar_label_and_power": "warning",
|
||||
"similar_labels": "warning",
|
||||
"similar_power": "warning",
|
||||
"simulation_model_issue": "ignore",
|
||||
"single_global_label": "ignore",
|
||||
"unannotated": "error",
|
||||
"unconnected_wire_endpoint": "warning",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
@@ -357,12 +572,12 @@
|
||||
},
|
||||
"meta": {
|
||||
"filename": "oiler SMD.kicad_pro",
|
||||
"version": 1
|
||||
"version": 3
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12.0,
|
||||
"bus_width": 12,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
@@ -372,32 +587,112 @@
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"priority": 2147483647,
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.25,
|
||||
"via_diameter": 0.8,
|
||||
"via_drill": 0.4,
|
||||
"wire_width": 6.0
|
||||
"wire_width": 6
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 2
|
||||
"version": 4
|
||||
},
|
||||
"net_colors": null
|
||||
"net_colors": null,
|
||||
"netclass_assignments": null,
|
||||
"netclass_patterns": []
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "Rehoiler SMD.net",
|
||||
"plot": "",
|
||||
"pos_files": "",
|
||||
"specctra_dsn": "",
|
||||
"step": "",
|
||||
"svg": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"bom_export_filename": "${PROJECTNAME}.csv",
|
||||
"bom_fmt_presets": [],
|
||||
"bom_fmt_settings": {
|
||||
"field_delimiter": ",",
|
||||
"keep_line_breaks": false,
|
||||
"keep_tabs": false,
|
||||
"name": "CSV",
|
||||
"ref_delimiter": ",",
|
||||
"ref_range_delimiter": "",
|
||||
"string_delimiter": "\""
|
||||
},
|
||||
"bom_presets": [],
|
||||
"bom_settings": {
|
||||
"exclude_dnp": false,
|
||||
"fields_ordered": [
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Reference",
|
||||
"name": "Reference",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Qty",
|
||||
"name": "${QUANTITY}",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "Value",
|
||||
"name": "Value",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "DNP",
|
||||
"name": "${DNP}",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "Exclude from BOM",
|
||||
"name": "${EXCLUDE_FROM_BOM}",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "Exclude from Board",
|
||||
"name": "${EXCLUDE_FROM_BOARD}",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": true,
|
||||
"label": "Footprint",
|
||||
"name": "Footprint",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Datasheet",
|
||||
"name": "Datasheet",
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"filter_string": "",
|
||||
"group_symbols": true,
|
||||
"include_excluded_from_bom": true,
|
||||
"name": "Default Editing",
|
||||
"sort_asc": true,
|
||||
"sort_field": "Referenz"
|
||||
},
|
||||
"connection_grid_size": 50.0,
|
||||
"drawing": {
|
||||
"dashed_lines_dash_length_ratio": 12.0,
|
||||
"dashed_lines_gap_length_ratio": 3.0,
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
@@ -408,6 +703,11 @@
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.25,
|
||||
"operating_point_overlay_i_precision": 3,
|
||||
"operating_point_overlay_i_range": "~A",
|
||||
"operating_point_overlay_v_precision": 3,
|
||||
"operating_point_overlay_v_range": "~V",
|
||||
"overbar_offset_ratio": 1.23,
|
||||
"pin_symbol_size": 25.0,
|
||||
"text_offset_ratio": 0.08
|
||||
},
|
||||
@@ -423,20 +723,26 @@
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"model_mode": 0,
|
||||
"model_mode": 4,
|
||||
"workbook_filename": ""
|
||||
},
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"space_save_all_events": true,
|
||||
"spice_adjust_passive_values": false,
|
||||
"spice_current_sheet_as_root": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"spice_model_current_sheet_as_root": true,
|
||||
"spice_save_all_currents": false,
|
||||
"spice_save_all_dissipations": false,
|
||||
"spice_save_all_voltages": false,
|
||||
"subpart_first_id": 65,
|
||||
"subpart_id_separator": 0
|
||||
},
|
||||
"sheets": [
|
||||
[
|
||||
"b1ddb058-f7b2-429c-9489-f4e2242ad7e5",
|
||||
""
|
||||
"Root"
|
||||
]
|
||||
],
|
||||
"text_variables": {}
|
||||
|
@@ -1,257 +0,0 @@
|
||||
update=03.01.2022 00:33:13
|
||||
version=1
|
||||
last_client=kicad
|
||||
[general]
|
||||
version=1
|
||||
RootSch=
|
||||
BoardNm=
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=
|
||||
[eeschema/libraries]
|
||||
[schematic_editor]
|
||||
version=1
|
||||
PageLayoutDescrFile=
|
||||
PlotDirectoryName=
|
||||
SubpartIdSeparator=0
|
||||
SubpartFirstId=65
|
||||
NetFmtName=Pcbnew
|
||||
SpiceAjustPassiveValues=0
|
||||
LabSize=50
|
||||
ERC_TestSimilarLabels=1
|
||||
[pcbnew]
|
||||
version=1
|
||||
PageLayoutDescrFile=
|
||||
LastNetListRead=Rehoiler SMD.net
|
||||
CopperLayerCount=2
|
||||
BoardThickness=1.6
|
||||
AllowMicroVias=0
|
||||
AllowBlindVias=0
|
||||
RequireCourtyardDefinitions=0
|
||||
ProhibitOverlappingCourtyards=1
|
||||
MinTrackWidth=0.2
|
||||
MinViaDiameter=0.4
|
||||
MinViaDrill=0.3
|
||||
MinMicroViaDiameter=0.2
|
||||
MinMicroViaDrill=0.09999999999999999
|
||||
MinHoleToHole=0.25
|
||||
TrackWidth1=0.25
|
||||
TrackWidth2=0.5
|
||||
TrackWidth3=1
|
||||
TrackWidth4=2
|
||||
ViaDiameter1=0.8
|
||||
ViaDrill1=0.4
|
||||
ViaDiameter2=0.7
|
||||
ViaDrill2=0.35
|
||||
ViaDiameter3=1
|
||||
ViaDrill3=0.6
|
||||
ViaDiameter4=2
|
||||
ViaDrill4=1
|
||||
dPairWidth1=0.2
|
||||
dPairGap1=0.25
|
||||
dPairViaGap1=0.25
|
||||
SilkLineWidth=0.12
|
||||
SilkTextSizeV=1
|
||||
SilkTextSizeH=1
|
||||
SilkTextSizeThickness=0.15
|
||||
SilkTextItalic=0
|
||||
SilkTextUpright=1
|
||||
CopperLineWidth=0.2
|
||||
CopperTextSizeV=1.5
|
||||
CopperTextSizeH=1.5
|
||||
CopperTextThickness=0.3
|
||||
CopperTextItalic=0
|
||||
CopperTextUpright=1
|
||||
EdgeCutLineWidth=0.05
|
||||
CourtyardLineWidth=0.05
|
||||
OthersLineWidth=0.15
|
||||
OthersTextSizeV=1
|
||||
OthersTextSizeH=1
|
||||
OthersTextSizeThickness=0.15
|
||||
OthersTextItalic=0
|
||||
OthersTextUpright=1
|
||||
SolderMaskClearance=0
|
||||
SolderMaskMinWidth=0
|
||||
SolderPasteClearance=0
|
||||
SolderPasteRatio=-0
|
||||
[pcbnew/Layer.F.Cu]
|
||||
Name=F.Cu
|
||||
Type=0
|
||||
Enabled=1
|
||||
[pcbnew/Layer.In1.Cu]
|
||||
Name=In1.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In2.Cu]
|
||||
Name=In2.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In3.Cu]
|
||||
Name=In3.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In4.Cu]
|
||||
Name=In4.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In5.Cu]
|
||||
Name=In5.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In6.Cu]
|
||||
Name=In6.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In7.Cu]
|
||||
Name=In7.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In8.Cu]
|
||||
Name=In8.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In9.Cu]
|
||||
Name=In9.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In10.Cu]
|
||||
Name=In10.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In11.Cu]
|
||||
Name=In11.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In12.Cu]
|
||||
Name=In12.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In13.Cu]
|
||||
Name=In13.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In14.Cu]
|
||||
Name=In14.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In15.Cu]
|
||||
Name=In15.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In16.Cu]
|
||||
Name=In16.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In17.Cu]
|
||||
Name=In17.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In18.Cu]
|
||||
Name=In18.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In19.Cu]
|
||||
Name=In19.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In20.Cu]
|
||||
Name=In20.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In21.Cu]
|
||||
Name=In21.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In22.Cu]
|
||||
Name=In22.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In23.Cu]
|
||||
Name=In23.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In24.Cu]
|
||||
Name=In24.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In25.Cu]
|
||||
Name=In25.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In26.Cu]
|
||||
Name=In26.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In27.Cu]
|
||||
Name=In27.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In28.Cu]
|
||||
Name=In28.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In29.Cu]
|
||||
Name=In29.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.In30.Cu]
|
||||
Name=In30.Cu
|
||||
Type=0
|
||||
Enabled=0
|
||||
[pcbnew/Layer.B.Cu]
|
||||
Name=B.Cu
|
||||
Type=0
|
||||
Enabled=1
|
||||
[pcbnew/Layer.B.Adhes]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.F.Adhes]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.B.Paste]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.F.Paste]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.B.SilkS]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.F.SilkS]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.B.Mask]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.F.Mask]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Dwgs.User]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Cmts.User]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Eco1.User]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Eco2.User]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Edge.Cuts]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Margin]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.B.CrtYd]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.F.CrtYd]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.B.Fab]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.F.Fab]
|
||||
Enabled=1
|
||||
[pcbnew/Layer.Rescue]
|
||||
Enabled=0
|
||||
[pcbnew/Netclasses]
|
||||
[pcbnew/Netclasses/Default]
|
||||
Name=Default
|
||||
Clearance=0.2
|
||||
TrackWidth=0.25
|
||||
ViaDiameter=0.8
|
||||
ViaDrill=0.4
|
||||
uViaDiameter=0.3
|
||||
uViaDrill=0.1
|
||||
dPairWidth=0.2
|
||||
dPairGap=0.25
|
||||
dPairViaGap=0.25
|
@@ -1,698 +0,0 @@
|
||||
EESchema Schematic File Version 4
|
||||
EELAYER 30 0
|
||||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date ""
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
$Comp
|
||||
L MCU_Module:WeMos_D1_mini U1
|
||||
U 1 1 61D21889
|
||||
P 6500 3150
|
||||
F 0 "U1" H 6500 2261 50 0000 C CNN
|
||||
F 1 "WeMos_D1_mini" H 6500 2170 50 0000 C CNN
|
||||
F 2 "Module:WEMOS_D1_mini_light" H 6500 2000 50 0001 C CNN
|
||||
F 3 "https://wiki.wemos.cc/products:d1:d1_mini#documentation" H 4650 2000 50 0001 C CNN
|
||||
1 6500 3150
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Transistor_FET:IRLZ44N Q1
|
||||
U 1 1 61D22C04
|
||||
P 9400 3750
|
||||
F 0 "Q1" H 9604 3796 50 0000 L CNN
|
||||
F 1 "IRLZ44N" H 9604 3705 50 0000 L CNN
|
||||
F 2 "Package_TO_SOT_THT:TO-220-3_Vertical" H 9650 3675 50 0001 L CIN
|
||||
F 3 "http://www.irf.com/product-info/datasheets/data/irlz44n.pdf" H 9400 3750 50 0001 L CNN
|
||||
1 9400 3750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Device:R R3
|
||||
U 1 1 61D23437
|
||||
P 9050 4000
|
||||
F 0 "R3" H 9120 4046 50 0000 L CNN
|
||||
F 1 "4k7" H 9120 3955 50 0000 L CNN
|
||||
F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolder" V 8980 4000 50 0001 C CNN
|
||||
F 3 "~" H 9050 4000 50 0001 C CNN
|
||||
1 9050 4000
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Device:R R2
|
||||
U 1 1 61D23883
|
||||
P 8750 3750
|
||||
F 0 "R2" V 8543 3750 50 0000 C CNN
|
||||
F 1 "100" V 8634 3750 50 0000 C CNN
|
||||
F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolder" V 8680 3750 50 0001 C CNN
|
||||
F 3 "~" H 8750 3750 50 0001 C CNN
|
||||
1 8750 3750
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0101
|
||||
U 1 1 61D23AAC
|
||||
P 9050 4200
|
||||
F 0 "#PWR0101" H 9050 3950 50 0001 C CNN
|
||||
F 1 "GND" H 9055 4027 50 0000 C CNN
|
||||
F 2 "" H 9050 4200 50 0001 C CNN
|
||||
F 3 "" H 9050 4200 50 0001 C CNN
|
||||
1 9050 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0102
|
||||
U 1 1 61D240D1
|
||||
P 9500 4200
|
||||
F 0 "#PWR0102" H 9500 3950 50 0001 C CNN
|
||||
F 1 "GND" H 9505 4027 50 0000 C CNN
|
||||
F 2 "" H 9500 4200 50 0001 C CNN
|
||||
F 3 "" H 9500 4200 50 0001 C CNN
|
||||
1 9500 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0103
|
||||
U 1 1 61D2429A
|
||||
P 6500 4200
|
||||
F 0 "#PWR0103" H 6500 3950 50 0001 C CNN
|
||||
F 1 "GND" H 6505 4027 50 0000 C CNN
|
||||
F 2 "" H 6500 4200 50 0001 C CNN
|
||||
F 3 "" H 6500 4200 50 0001 C CNN
|
||||
1 6500 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6500 4200 6500 3950
|
||||
Wire Wire Line
|
||||
8450 3750 8600 3750
|
||||
Wire Wire Line
|
||||
8900 3750 9050 3750
|
||||
Wire Wire Line
|
||||
9050 3850 9050 3750
|
||||
Connection ~ 9050 3750
|
||||
Wire Wire Line
|
||||
9050 3750 9200 3750
|
||||
Wire Wire Line
|
||||
9050 4200 9050 4150
|
||||
Wire Wire Line
|
||||
9500 4200 9500 3950
|
||||
$Comp
|
||||
L Connector_Generic:Conn_01x02 J4
|
||||
U 1 1 61D24E27
|
||||
P 9800 3350
|
||||
F 0 "J4" H 9880 3342 50 0000 L CNN
|
||||
F 1 "PUMP" H 9880 3251 50 0000 L CNN
|
||||
F 2 "Connector_Phoenix_MC:PhoenixContact_MC_1,5_2-G-3.5_1x02_P3.50mm_Horizontal" H 9800 3350 50 0001 C CNN
|
||||
F 3 "~" H 9800 3350 50 0001 C CNN
|
||||
1 9800 3350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Connector_Generic:Conn_01x02 J3
|
||||
U 1 1 61D2549D
|
||||
P 9800 2750
|
||||
F 0 "J3" H 9880 2742 50 0000 L CNN
|
||||
F 1 "POWER" H 9880 2651 50 0000 L CNN
|
||||
F 2 "Connector_Phoenix_MC:PhoenixContact_MC_1,5_2-G-3.5_1x02_P3.50mm_Horizontal" H 9800 2750 50 0001 C CNN
|
||||
F 3 "~" H 9800 2750 50 0001 C CNN
|
||||
1 9800 2750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
9500 3550 9500 3500
|
||||
Wire Wire Line
|
||||
9500 3450 9600 3450
|
||||
Wire Wire Line
|
||||
9600 3350 9500 3350
|
||||
Wire Wire Line
|
||||
9500 3350 9500 3200
|
||||
Wire Wire Line
|
||||
9500 2750 9600 2750
|
||||
$Comp
|
||||
L power:GND #PWR0104
|
||||
U 1 1 61D25EA9
|
||||
P 9600 2900
|
||||
F 0 "#PWR0104" H 9600 2650 50 0001 C CNN
|
||||
F 1 "GND" H 9605 2727 50 0000 C CNN
|
||||
F 2 "" H 9600 2900 50 0001 C CNN
|
||||
F 3 "" H 9600 2900 50 0001 C CNN
|
||||
1 9600 2900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
9600 2850 9600 2900
|
||||
Connection ~ 9500 2750
|
||||
$Comp
|
||||
L power:GND #PWR0105
|
||||
U 1 1 61D27601
|
||||
P 10100 2350
|
||||
F 0 "#PWR0105" H 10100 2100 50 0001 C CNN
|
||||
F 1 "GND" H 10105 2177 50 0000 C CNN
|
||||
F 2 "" H 10100 2350 50 0001 C CNN
|
||||
F 3 "" H 10100 2350 50 0001 C CNN
|
||||
1 10100 2350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+3.3V #PWR0106
|
||||
U 1 1 61D282EA
|
||||
P 6600 2350
|
||||
F 0 "#PWR0106" H 6600 2200 50 0001 C CNN
|
||||
F 1 "+3.3V" H 6615 2523 50 0000 C CNN
|
||||
F 2 "" H 6600 2350 50 0001 C CNN
|
||||
F 3 "" H 6600 2350 50 0001 C CNN
|
||||
1 6600 2350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Regulator_Switching:R-78C5.0-1.0 U2
|
||||
U 1 1 61D28955
|
||||
P 10100 2050
|
||||
F 0 "U2" H 10100 2292 50 0000 C CNN
|
||||
F 1 "R-78C5.0-1.0" H 10100 2201 50 0000 C CNN
|
||||
F 2 "Converter_DCDC:Converter_DCDC_RECOM_R-78E-0.5_THT" H 10150 1800 50 0001 L CIN
|
||||
F 3 "https://www.recom-power.com/pdf/Innoline/R-78Cxx-1.0.pdf" H 10100 2050 50 0001 C CNN
|
||||
1 10100 2050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+5V #PWR0107
|
||||
U 1 1 61D2BC64
|
||||
P 6400 2350
|
||||
F 0 "#PWR0107" H 6400 2200 50 0001 C CNN
|
||||
F 1 "+5V" H 6415 2523 50 0000 C CNN
|
||||
F 2 "" H 6400 2350 50 0001 C CNN
|
||||
F 3 "" H 6400 2350 50 0001 C CNN
|
||||
1 6400 2350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+5V #PWR0108
|
||||
U 1 1 61D2C166
|
||||
P 10550 1900
|
||||
F 0 "#PWR0108" H 10550 1750 50 0001 C CNN
|
||||
F 1 "+5V" H 10565 2073 50 0000 C CNN
|
||||
F 2 "" H 10550 1900 50 0001 C CNN
|
||||
F 3 "" H 10550 1900 50 0001 C CNN
|
||||
1 10550 1900
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
10400 2050 10550 2050
|
||||
Wire Wire Line
|
||||
10550 2050 10550 1900
|
||||
$Comp
|
||||
L Diode:BAT42 D2
|
||||
U 1 1 61D2CD57
|
||||
P 8250 4400
|
||||
F 0 "D2" V 8296 4320 50 0000 R CNN
|
||||
F 1 "BAT42" V 8205 4320 50 0000 R CNN
|
||||
F 2 "Diode_SMD:D_SOD-123" H 8250 4225 50 0001 C CNN
|
||||
F 3 "http://www.vishay.com/docs/85660/bat42.pdf" H 8250 4400 50 0001 C CNN
|
||||
F 4 "BAT 42" H 8250 4400 50 0001 C CNN "Reichelt Order No."
|
||||
1 8250 4400
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L Connector_Generic:Conn_01x02 J2
|
||||
U 1 1 61D2DCEE
|
||||
P 8550 4700
|
||||
F 0 "J2" H 8630 4692 50 0000 L CNN
|
||||
F 1 "SIGNAL" H 8630 4601 50 0000 L CNN
|
||||
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Horizontal" H 8550 4700 50 0001 C CNN
|
||||
F 3 "~" H 8550 4700 50 0001 C CNN
|
||||
1 8550 4700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
8350 4700 8250 4700
|
||||
Wire Wire Line
|
||||
8250 4700 8250 4550
|
||||
Wire Wire Line
|
||||
8250 4250 8250 3350
|
||||
$Comp
|
||||
L Device:C C1
|
||||
U 1 1 61D2F740
|
||||
P 7400 3700
|
||||
F 0 "C1" H 7515 3746 50 0000 L CNN
|
||||
F 1 "10n" H 7515 3655 50 0000 L CNN
|
||||
F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder" H 7438 3550 50 0001 C CNN
|
||||
F 3 "~" H 7400 3700 50 0001 C CNN
|
||||
1 7400 3700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Device:C C2
|
||||
U 1 1 61D32638
|
||||
P 8000 3700
|
||||
F 0 "C2" H 8115 3746 50 0000 L CNN
|
||||
F 1 "10n" H 8115 3655 50 0000 L CNN
|
||||
F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder" H 8038 3550 50 0001 C CNN
|
||||
F 3 "~" H 8000 3700 50 0001 C CNN
|
||||
1 8000 3700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0109
|
||||
U 1 1 61D32EB9
|
||||
P 8000 3850
|
||||
F 0 "#PWR0109" H 8000 3600 50 0001 C CNN
|
||||
F 1 "GND" H 8005 3677 50 0000 C CNN
|
||||
F 2 "" H 8000 3850 50 0001 C CNN
|
||||
F 3 "" H 8000 3850 50 0001 C CNN
|
||||
1 8000 3850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0110
|
||||
U 1 1 61D331A8
|
||||
P 7400 3850
|
||||
F 0 "#PWR0110" H 7400 3600 50 0001 C CNN
|
||||
F 1 "GND" H 7405 3677 50 0000 C CNN
|
||||
F 2 "" H 7400 3850 50 0001 C CNN
|
||||
F 3 "" H 7400 3850 50 0001 C CNN
|
||||
1 7400 3850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Diode:BAT42 D1
|
||||
U 1 1 61D35ED1
|
||||
P 7750 4400
|
||||
F 0 "D1" V 7796 4320 50 0000 R CNN
|
||||
F 1 "BAT42" V 7705 4320 50 0000 R CNN
|
||||
F 2 "Diode_SMD:D_SOD-123" H 7750 4225 50 0001 C CNN
|
||||
F 3 "http://www.vishay.com/docs/85660/bat42.pdf" H 7750 4400 50 0001 C CNN
|
||||
F 4 "BAT 42" H 7750 4400 50 0001 C CNN "Reichelt Order No."
|
||||
1 7750 4400
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L Diode:1N4001 D3
|
||||
U 1 1 61D36E68
|
||||
P 9100 2750
|
||||
F 0 "D3" H 9100 2967 50 0000 C CNN
|
||||
F 1 "1N4001" H 9100 2876 50 0000 C CNN
|
||||
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9100 2575 50 0001 C CNN
|
||||
F 3 "http://www.vishay.com/docs/88503/1n4001.pdf" H 9100 2750 50 0001 C CNN
|
||||
1 9100 2750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
9250 2750 9500 2750
|
||||
Wire Wire Line
|
||||
8950 2050 8950 2750
|
||||
Wire Wire Line
|
||||
8950 2050 9450 2050
|
||||
$Comp
|
||||
L Device:CP C3
|
||||
U 1 1 61D3892A
|
||||
P 9450 2200
|
||||
F 0 "C3" H 9568 2246 50 0000 L CNN
|
||||
F 1 "470µF" H 9568 2155 50 0000 L CNN
|
||||
F 2 "Capacitor_SMD:CP_Elec_8x10" H 9488 2050 50 0001 C CNN
|
||||
F 3 "~" H 9450 2200 50 0001 C CNN
|
||||
F 4 "ECC MZS350ARA471" H 9450 2200 50 0001 C CNN "Reichelt Order No."
|
||||
1 9450 2200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 9450 2050
|
||||
Wire Wire Line
|
||||
9450 2050 9800 2050
|
||||
$Comp
|
||||
L power:GND #PWR0111
|
||||
U 1 1 61D3952C
|
||||
P 9450 2350
|
||||
F 0 "#PWR0111" H 9450 2100 50 0001 C CNN
|
||||
F 1 "GND" H 9455 2177 50 0000 C CNN
|
||||
F 2 "" H 9450 2350 50 0001 C CNN
|
||||
F 3 "" H 9450 2350 50 0001 C CNN
|
||||
1 9450 2350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Device:CP C4
|
||||
U 1 1 61D39810
|
||||
P 10550 2200
|
||||
F 0 "C4" H 10668 2246 50 0000 L CNN
|
||||
F 1 "100µ" H 10668 2155 50 0000 L CNN
|
||||
F 2 "Capacitor_SMD:CP_Elec_6.3x7.7" H 10588 2050 50 0001 C CNN
|
||||
F 3 "~" H 10550 2200 50 0001 C CNN
|
||||
F 4 "ECC HXE250ARA101" H 10550 2200 50 0001 C CNN "Reichelt Order No."
|
||||
1 10550 2200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Connection ~ 10550 2050
|
||||
$Comp
|
||||
L power:GND #PWR0112
|
||||
U 1 1 61D39D32
|
||||
P 10550 2350
|
||||
F 0 "#PWR0112" H 10550 2100 50 0001 C CNN
|
||||
F 1 "GND" H 10555 2177 50 0000 C CNN
|
||||
F 2 "" H 10550 2350 50 0001 C CNN
|
||||
F 3 "" H 10550 2350 50 0001 C CNN
|
||||
1 10550 2350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0113
|
||||
U 1 1 61D3BF4D
|
||||
P 7850 5450
|
||||
F 0 "#PWR0113" H 7850 5200 50 0001 C CNN
|
||||
F 1 "GND" H 7855 5277 50 0000 C CNN
|
||||
F 2 "" H 7850 5450 50 0001 C CNN
|
||||
F 3 "" H 7850 5450 50 0001 C CNN
|
||||
1 7850 5450
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+5V #PWR0114
|
||||
U 1 1 61D3C31B
|
||||
P 7850 5050
|
||||
F 0 "#PWR0114" H 7850 4900 50 0001 C CNN
|
||||
F 1 "+5V" H 7865 5223 50 0000 C CNN
|
||||
F 2 "" H 7850 5050 50 0001 C CNN
|
||||
F 3 "" H 7850 5050 50 0001 C CNN
|
||||
1 7850 5050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
7900 5100 7850 5100
|
||||
Wire Wire Line
|
||||
7850 5100 7850 5050
|
||||
$Comp
|
||||
L Device:R R1
|
||||
U 1 1 61D3DA39
|
||||
P 7450 5300
|
||||
F 0 "R1" V 7243 5300 50 0000 C CNN
|
||||
F 1 "100" V 7334 5300 50 0000 C CNN
|
||||
F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolder" V 7380 5300 50 0001 C CNN
|
||||
F 3 "~" H 7450 5300 50 0001 C CNN
|
||||
1 7450 5300
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L Diode:1N4001 D4
|
||||
U 1 1 61D3DFDC
|
||||
P 9300 3350
|
||||
F 0 "D4" V 9254 3430 50 0000 L CNN
|
||||
F 1 "1N4001" V 9345 3430 50 0000 L CNN
|
||||
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9300 3175 50 0001 C CNN
|
||||
F 3 "http://www.vishay.com/docs/88503/1n4001.pdf" H 9300 3350 50 0001 C CNN
|
||||
1 9300 3350
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
9300 3500 9500 3500
|
||||
Connection ~ 9500 3500
|
||||
Wire Wire Line
|
||||
9500 3500 9500 3450
|
||||
Wire Wire Line
|
||||
9300 3200 9500 3200
|
||||
Connection ~ 9500 3200
|
||||
Wire Wire Line
|
||||
9500 3200 9500 2750
|
||||
$Comp
|
||||
L Connector_Generic:Conn_01x04 J1
|
||||
U 1 1 61D4071E
|
||||
P 8100 5200
|
||||
F 0 "J1" H 8180 5192 50 0000 L CNN
|
||||
F 1 "COCKPIT" H 8180 5101 50 0000 L CNN
|
||||
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 8100 5200 50 0001 C CNN
|
||||
F 3 "~" H 8100 5200 50 0001 C CNN
|
||||
1 8100 5200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
7900 5400 7850 5400
|
||||
Wire Wire Line
|
||||
7850 5400 7850 5450
|
||||
Wire Wire Line
|
||||
7150 5300 7300 5300
|
||||
Wire Wire Line
|
||||
7750 4550 7750 5200
|
||||
Wire Wire Line
|
||||
7900 5200 7750 5200
|
||||
Wire Wire Line
|
||||
7600 5300 7900 5300
|
||||
$Comp
|
||||
L power:GND #PWR0115
|
||||
U 1 1 61D47EEA
|
||||
P 8250 4850
|
||||
F 0 "#PWR0115" H 8250 4600 50 0001 C CNN
|
||||
F 1 "GND" H 8255 4677 50 0000 C CNN
|
||||
F 2 "" H 8250 4850 50 0001 C CNN
|
||||
F 3 "" H 8250 4850 50 0001 C CNN
|
||||
1 8250 4850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
8250 4850 8250 4800
|
||||
Wire Wire Line
|
||||
8250 4800 8350 4800
|
||||
$Comp
|
||||
L Connector_Generic:Conn_01x04 J5
|
||||
U 1 1 61E12B85
|
||||
P 8450 2500
|
||||
F 0 "J5" H 8530 2492 50 0000 L CNN
|
||||
F 1 "I2C" H 8530 2401 50 0000 L CNN
|
||||
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 8450 2500 50 0001 C CNN
|
||||
F 3 "~" H 8450 2500 50 0001 C CNN
|
||||
1 8450 2500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+3.3V #PWR0116
|
||||
U 1 1 61E137AF
|
||||
P 8050 1550
|
||||
F 0 "#PWR0116" H 8050 1400 50 0001 C CNN
|
||||
F 1 "+3.3V" H 8065 1723 50 0000 C CNN
|
||||
F 2 "" H 8050 1550 50 0001 C CNN
|
||||
F 3 "" H 8050 1550 50 0001 C CNN
|
||||
1 8050 1550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0117
|
||||
U 1 1 61E147DB
|
||||
P 8200 2750
|
||||
F 0 "#PWR0117" H 8200 2500 50 0001 C CNN
|
||||
F 1 "GND" H 8205 2577 50 0000 C CNN
|
||||
F 2 "" H 8200 2750 50 0001 C CNN
|
||||
F 3 "" H 8200 2750 50 0001 C CNN
|
||||
1 8200 2750
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
8250 2700 8200 2700
|
||||
Wire Wire Line
|
||||
8200 2700 8200 2750
|
||||
Wire Wire Line
|
||||
8050 2950 8050 2400
|
||||
Wire Wire Line
|
||||
8050 2400 8250 2400
|
||||
Wire Wire Line
|
||||
7950 2850 7950 2500
|
||||
Wire Wire Line
|
||||
7950 2500 8250 2500
|
||||
$Comp
|
||||
L Device:R R4
|
||||
U 1 1 61E189A2
|
||||
P 7950 1850
|
||||
F 0 "R4" H 7880 1804 50 0000 R CNN
|
||||
F 1 "4k7" H 7880 1895 50 0000 R CNN
|
||||
F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolder" V 7880 1850 50 0001 C CNN
|
||||
F 3 "~" H 7950 1850 50 0001 C CNN
|
||||
1 7950 1850
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Device:R R5
|
||||
U 1 1 61E1955B
|
||||
P 8050 2150
|
||||
F 0 "R5" H 7980 2104 50 0000 R CNN
|
||||
F 1 "4k7" H 7980 2195 50 0000 R CNN
|
||||
F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolder" V 7980 2150 50 0001 C CNN
|
||||
F 3 "~" H 8050 2150 50 0001 C CNN
|
||||
1 8050 2150
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
8250 2600 7850 2600
|
||||
Wire Wire Line
|
||||
7850 2600 7850 1600
|
||||
Wire Wire Line
|
||||
7850 1600 7950 1600
|
||||
Wire Wire Line
|
||||
8050 1600 8050 1550
|
||||
Connection ~ 7950 1600
|
||||
Wire Wire Line
|
||||
7950 1600 8050 1600
|
||||
Wire Wire Line
|
||||
8050 2000 8050 1600
|
||||
Connection ~ 8050 1600
|
||||
Wire Wire Line
|
||||
7950 1600 7950 1700
|
||||
Wire Wire Line
|
||||
8050 2300 8050 2400
|
||||
Connection ~ 8050 2400
|
||||
Wire Wire Line
|
||||
7950 2000 7950 2500
|
||||
Connection ~ 7950 2500
|
||||
Wire Wire Line
|
||||
6900 3550 7150 3550
|
||||
Wire Wire Line
|
||||
7150 3550 7150 5300
|
||||
Wire Wire Line
|
||||
6900 3450 7400 3450
|
||||
Connection ~ 7400 3450
|
||||
Wire Wire Line
|
||||
7400 3450 7400 3550
|
||||
Wire Wire Line
|
||||
7400 3450 7750 3450
|
||||
Wire Wire Line
|
||||
7750 3450 7750 4250
|
||||
Wire Wire Line
|
||||
6900 3350 8000 3350
|
||||
Wire Wire Line
|
||||
8000 3350 8000 3550
|
||||
Wire Wire Line
|
||||
8000 3350 8250 3350
|
||||
Connection ~ 8000 3350
|
||||
Wire Wire Line
|
||||
8450 3250 8450 3750
|
||||
Wire Wire Line
|
||||
6900 3250 8450 3250
|
||||
$Comp
|
||||
L Memory_EEPROM:24LC64 U3
|
||||
U 1 1 61DDD4E7
|
||||
P 6750 1550
|
||||
F 0 "U3" H 6750 2031 50 0000 C CNN
|
||||
F 1 "24LC64" H 6750 1940 50 0000 C CNN
|
||||
F 2 "Package_SO:SOIC-8_3.9x4.9mm_P1.27mm" H 6750 1550 50 0001 C CNN
|
||||
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/21189f.pdf" H 6750 1550 50 0001 C CNN
|
||||
1 6750 1550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+3.3V #PWR0118
|
||||
U 1 1 61DDE198
|
||||
P 6750 1250
|
||||
F 0 "#PWR0118" H 6750 1100 50 0001 C CNN
|
||||
F 1 "+3.3V" H 6765 1423 50 0000 C CNN
|
||||
F 2 "" H 6750 1250 50 0001 C CNN
|
||||
F 3 "" H 6750 1250 50 0001 C CNN
|
||||
1 6750 1250
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0119
|
||||
U 1 1 61DDE4C0
|
||||
P 6750 1850
|
||||
F 0 "#PWR0119" H 6750 1600 50 0001 C CNN
|
||||
F 1 "GND" H 6755 1677 50 0000 C CNN
|
||||
F 2 "" H 6750 1850 50 0001 C CNN
|
||||
F 3 "" H 6750 1850 50 0001 C CNN
|
||||
1 6750 1850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:GND #PWR0120
|
||||
U 1 1 61DDE71F
|
||||
P 6300 1850
|
||||
F 0 "#PWR0120" H 6300 1600 50 0001 C CNN
|
||||
F 1 "GND" H 6305 1677 50 0000 C CNN
|
||||
F 2 "" H 6300 1850 50 0001 C CNN
|
||||
F 3 "" H 6300 1850 50 0001 C CNN
|
||||
1 6300 1850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6350 1650 6300 1650
|
||||
Wire Wire Line
|
||||
6300 1650 6300 1850
|
||||
Wire Wire Line
|
||||
6350 1450 6300 1450
|
||||
Wire Wire Line
|
||||
6300 1450 6300 1550
|
||||
Connection ~ 6300 1650
|
||||
Wire Wire Line
|
||||
6350 1550 6300 1550
|
||||
Connection ~ 6300 1550
|
||||
Wire Wire Line
|
||||
6300 1550 6300 1650
|
||||
Wire Wire Line
|
||||
6900 2850 7400 2850
|
||||
Wire Wire Line
|
||||
6900 2950 7500 2950
|
||||
Wire Wire Line
|
||||
7150 1550 7400 1550
|
||||
Wire Wire Line
|
||||
7400 1550 7400 2850
|
||||
Connection ~ 7400 2850
|
||||
Wire Wire Line
|
||||
7400 2850 7950 2850
|
||||
Wire Wire Line
|
||||
7500 1450 7500 2950
|
||||
Wire Wire Line
|
||||
7150 1450 7500 1450
|
||||
Connection ~ 7500 2950
|
||||
Wire Wire Line
|
||||
7500 2950 8050 2950
|
||||
$Comp
|
||||
L power:GND #PWR0121
|
||||
U 1 1 61DFBD18
|
||||
P 7250 1850
|
||||
F 0 "#PWR0121" H 7250 1600 50 0001 C CNN
|
||||
F 1 "GND" H 7255 1677 50 0000 C CNN
|
||||
F 2 "" H 7250 1850 50 0001 C CNN
|
||||
F 3 "" H 7250 1850 50 0001 C CNN
|
||||
1 7250 1850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
7150 1650 7250 1650
|
||||
Wire Wire Line
|
||||
7250 1650 7250 1850
|
||||
$Comp
|
||||
L power:GND #PWR0122
|
||||
U 1 1 61DEAC05
|
||||
P 6000 1700
|
||||
F 0 "#PWR0122" H 6000 1450 50 0001 C CNN
|
||||
F 1 "GND" H 6005 1527 50 0000 C CNN
|
||||
F 2 "" H 6000 1700 50 0001 C CNN
|
||||
F 3 "" H 6000 1700 50 0001 C CNN
|
||||
1 6000 1700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L Device:C C5
|
||||
U 1 1 61DEA081
|
||||
P 6000 1550
|
||||
F 0 "C5" H 6115 1596 50 0000 L CNN
|
||||
F 1 "10n" H 6115 1505 50 0000 L CNN
|
||||
F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder" H 6038 1400 50 0001 C CNN
|
||||
F 3 "~" H 6000 1550 50 0001 C CNN
|
||||
1 6000 1550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L power:+3.3V #PWR0123
|
||||
U 1 1 61DEAFE2
|
||||
P 6000 1400
|
||||
F 0 "#PWR0123" H 6000 1250 50 0001 C CNN
|
||||
F 1 "+3.3V" H 6015 1573 50 0000 C CNN
|
||||
F 2 "" H 6000 1400 50 0001 C CNN
|
||||
F 3 "" H 6000 1400 50 0001 C CNN
|
||||
1 6000 1400
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$EndSCHEMATC
|
4
Hardware/sym-lib-table
Normal file
@@ -0,0 +1,4 @@
|
||||
(sym_lib_table
|
||||
(version 7)
|
||||
(lib (name "MC33660")(type "Legacy")(uri "MC33660.lib")(options "")(descr ""))
|
||||
)
|
103
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
PIO_HOME_DIR = "${WORKSPACE}/.pio"
|
||||
VENV_PATH = "${WORKSPACE}/Software/.venv"
|
||||
}
|
||||
stages {
|
||||
|
||||
stage('🧰 Setup PlatformIO') {
|
||||
steps {
|
||||
dir('Software') {
|
||||
sh """
|
||||
[ -d .venv ] || python3 -m venv .venv
|
||||
${env.VENV_PATH}/bin/pip install --upgrade pip platformio
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('📄 Dummy WiFi-Creds') {
|
||||
steps {
|
||||
dir('Software') {
|
||||
writeFile file: 'wifi_credentials.ini', text: '''
|
||||
[wifi_cred]
|
||||
wifi_ssid_client = DummySSID
|
||||
wifi_password_client = DummyPass
|
||||
admin_password = Admin123
|
||||
wifi_ap_password = DummyAP
|
||||
'''.stripIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('🧱 Build Firmware for All Environments') {
|
||||
steps {
|
||||
dir('Software') {
|
||||
script {
|
||||
def allEnvironments = ['pcb_rev_1-2_serial', 'pcb_rev_1-3_serial', 'pcb_rev_1-4_serial']
|
||||
for (envName in allEnvironments) {
|
||||
echo "🔧 Baue Firmware für: ${envName}"
|
||||
sh "${env.VENV_PATH}/bin/platformio run -e ${envName}"
|
||||
}
|
||||
env.REPRESENTATIVE_ENV = allEnvironments[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('📁 Build Filesystem') {
|
||||
steps {
|
||||
dir('Software') {
|
||||
script {
|
||||
echo "📁 Baue Filesystem für ${env.REPRESENTATIVE_ENV} (repräsentativ)"
|
||||
sh "${env.VENV_PATH}/bin/platformio run -t buildfs -e ${env.REPRESENTATIVE_ENV}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('📦 Archive Firmware & FS') {
|
||||
steps {
|
||||
dir('Software') {
|
||||
echo "🔍 Archiviere Artefakte (.fw.bin / .fs.gz)…"
|
||||
archiveArtifacts artifacts: '.pio/build/**/*.fw.bin, .pio/build/**/*.fs.gz',
|
||||
allowEmptyArchive: true,
|
||||
fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('🔌 Flash Hardware (Dummy)') {
|
||||
steps {
|
||||
echo "TODO: Flash-Script aufrufen, z. B.: python3 Hardware/flash.py /dev/ttyUSB0"
|
||||
}
|
||||
}
|
||||
|
||||
stage('🧠 Run Tests (Dummy)') {
|
||||
steps {
|
||||
dir('Testing') {
|
||||
echo "TODO: Testing mit z. B.: python3 test_runner.py oder pytest starten"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('🧹 Cleanup Build Output') {
|
||||
steps {
|
||||
dir('Software') {
|
||||
sh "rm -rf .pio"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo "✅ CI abgeschlossen – Firmware gebaut, Dummy-Stages bereit"
|
||||
}
|
||||
failure {
|
||||
echo "❌ Fehler im Build – Logs checken, Commander Seraphon"
|
||||
}
|
||||
}
|
||||
}
|
438
LICENSE.CC-BY-NC-SA-4.0
Normal file
@@ -0,0 +1,438 @@
|
||||
Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||
does not provide legal services or legal advice. Distribution of
|
||||
Creative Commons public licenses does not create a lawyer-client or
|
||||
other relationship. Creative Commons makes its licenses and related
|
||||
information available on an "as-is" basis. Creative Commons gives no
|
||||
warranties regarding its licenses, any material licensed under their
|
||||
terms and conditions, or any related information. Creative Commons
|
||||
disclaims all liability for damages resulting from their use to the
|
||||
fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and
|
||||
conditions that creators and other rights holders may use to share
|
||||
original works of authorship and other material subject to copyright
|
||||
and certain other rights specified in the public license below. The
|
||||
following considerations are for informational purposes only, are not
|
||||
exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are
|
||||
intended for use by those authorized to give the public
|
||||
permission to use material in ways otherwise restricted by
|
||||
copyright and certain other rights. Our licenses are
|
||||
irrevocable. Licensors should read and understand the terms
|
||||
and conditions of the license they choose before applying it.
|
||||
Licensors should also secure all rights necessary before
|
||||
applying our licenses so that the public can reuse the
|
||||
material as expected. Licensors should clearly mark any
|
||||
material not subject to the license. This includes other CC-
|
||||
licensed material, or material used under an exception or
|
||||
limitation to copyright. More considerations for licensors:
|
||||
wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public
|
||||
licenses, a licensor grants the public permission to use the
|
||||
licensed material under specified terms and conditions. If
|
||||
the licensor's permission is not necessary for any reason--for
|
||||
example, because of any applicable exception or limitation to
|
||||
copyright--then that use is not regulated by the license. Our
|
||||
licenses grant only permissions under copyright and certain
|
||||
other rights that a licensor has authority to grant. Use of
|
||||
the licensed material may still be restricted for other
|
||||
reasons, including because others have copyright or other
|
||||
rights in the material. A licensor may make special requests,
|
||||
such as asking that all changes be marked or described.
|
||||
Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations
|
||||
for the public:
|
||||
wiki.creativecommons.org/Considerations_for_licensees
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution-NonCommercial-ShareAlike 4.0 International Public License
|
||||
("Public License"). To the extent this Public License may be
|
||||
interpreted as a contract, You are granted the Licensed Rights in
|
||||
consideration of Your acceptance of these terms and conditions, and the
|
||||
Licensor grants You such rights in consideration of benefits the
|
||||
Licensor receives from making the Licensed Material available under
|
||||
these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. BY-NC-SA Compatible License means a license listed at
|
||||
creativecommons.org/compatiblelicenses, approved by Creative
|
||||
Commons as essentially the equivalent of this Public License.
|
||||
|
||||
d. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
e. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
g. License Elements means the license attributes listed in the name
|
||||
of a Creative Commons Public License. The License Elements of this
|
||||
Public License are Attribution, NonCommercial, and ShareAlike.
|
||||
|
||||
h. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
i. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
j. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
k. NonCommercial means not primarily intended for or directed towards
|
||||
commercial advantage or monetary compensation. For purposes of
|
||||
this Public License, the exchange of the Licensed Material for
|
||||
other material subject to Copyright and Similar Rights by digital
|
||||
file-sharing or similar means is NonCommercial provided there is
|
||||
no payment of monetary compensation in connection with the
|
||||
exchange.
|
||||
|
||||
l. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
m. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
n. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part, for NonCommercial purposes only; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material for
|
||||
NonCommercial purposes only.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. Additional offer from the Licensor -- Adapted Material.
|
||||
Every recipient of Adapted Material from You
|
||||
automatically receives an offer from the Licensor to
|
||||
exercise the Licensed Rights in the Adapted Material
|
||||
under the conditions of the Adapter's License You apply.
|
||||
|
||||
c. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties, including when
|
||||
the Licensed Material is used other than for NonCommercial
|
||||
purposes.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
b. ShareAlike.
|
||||
|
||||
In addition to the conditions in Section 3(a), if You Share
|
||||
Adapted Material You produce, the following conditions also apply.
|
||||
|
||||
1. The Adapter's License You apply must be a Creative Commons
|
||||
license with the same License Elements, this version or
|
||||
later, or a BY-NC-SA Compatible License.
|
||||
|
||||
2. You must include the text of, or the URI or hyperlink to, the
|
||||
Adapter's License You apply. You may satisfy this condition
|
||||
in any reasonable manner based on the medium, means, and
|
||||
context in which You Share Adapted Material.
|
||||
|
||||
3. You may not offer or impose any additional or different terms
|
||||
or conditions on, or apply any Effective Technological
|
||||
Measures to, Adapted Material that restrict exercise of the
|
||||
rights granted under the Adapter's License You apply.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database for NonCommercial purposes
|
||||
only;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material,
|
||||
including for purposes of Section 3(b); and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
|
67
LICENSE.CERN-OHL-S-2.0
Normal file
@@ -0,0 +1,67 @@
|
||||
CERN Open Hardware Licence Version 2 - Strongly Reciprocal
|
||||
|
||||
Preamble
|
||||
|
||||
CERN has developed this licence to promote collaboration among hardware designers and to provide a legal tool which supports the freedom to use, study, modify, share and distribute hardware designs and products based on those designs. Version 2 of the CERN Open Hardware Licence comes in three variants: CERN-OHL-P (permissive); and two reciprocal licences: CERN-OHL-W (weakly reciprocal) and this licence, CERN-OHL-S (strongly reciprocal).
|
||||
|
||||
The CERN-OHL-S is copyright CERN 2020. Anyone is welcome to use it, in unmodified form only.
|
||||
|
||||
Use of this Licence does not imply any endorsement by CERN of any Licensor or their designs nor does it imply any involvement by CERN in their development.
|
||||
|
||||
1 Definitions
|
||||
1.1 'Licence' means this CERN-OHL-S.
|
||||
1.2 'Compatible Licence' means
|
||||
a) any earlier version of the CERN Open Hardware licence, or
|
||||
b) any version of the CERN-OHL-S, or
|
||||
c) any licence which permits You to treat the Source to which it applies as licensed under CERN-OHL-S provided that on Conveyance of any such Source, or any associated Product You treat the Source in question as being licensed under CERN-OHL-S.
|
||||
1.3 'Source' means information such as design materials or digital code which can be applied to Make or test a Product or to prepare a Product for use, Conveyance or sale, regardless of its medium or how it is expressed. It may include Notices.
|
||||
1.4 'Covered Source' means Source that is explicitly made available under this Licence.
|
||||
1.5 'Product' means any device, component, work or physical object, whether in finished or intermediate form, arising from the use, application or processing of Covered Source.
|
||||
1.6 'Make' means to create or configure something, whether by manufacture, assembly, compiling, loading or applying Covered Source or another Product or otherwise.
|
||||
1.7 'Available Component' means any part, sub-assembly, library or code which:
|
||||
a) is licensed to You as Complete Source under a Compatible Licence; or
|
||||
b) is available, at the time a Product or the Source containing it is first Conveyed, to You and any other prospective licensees
|
||||
i) as a physical part with sufficient rights and information (including any configuration and programming files and information about its characteristics and interfaces) to enable it either to be Made itself, or to be sourced and used to Make the Product; or
|
||||
ii) as part of the normal distribution of a tool used to design or Make the Product.
|
||||
1.8 'Complete Source' means the set of all Source necessary to Make a Product, in the preferred form for making modifications, including necessary installation and interfacing information both for the Product, and for any included Available Components. If the format is proprietary, it must also be made available in a format (if the proprietary tool can create it) which is viewable with a tool available to potential licensees and licensed under a licence approved by the Free Software Foundation or the Open Source Initiative. Complete Source need not include the Source of any Available Component, provided that You include in the Complete Source sufficient information to enable a recipient to Make or source and use the Available Component to Make the Product.
|
||||
1.9 'Source Location' means a location where a Licensor has placed Covered Source, and which that Licensor reasonably believes will remain easily accessible for at least three years for anyone to obtain a digital copy.
|
||||
1.10 'Notice' means copyright, acknowledgement and trademark notices, Source Location references, modification notices (subsection 3.3(b)) and all notices that refer to this Licence and to the disclaimer of warranties that are included in the Covered Source.
|
||||
1.11 'Licensee' or 'You' means any person exercising rights under this Licence.
|
||||
1.12 'Licensor' means a natural or legal person who creates or modifies Covered Source. A person may be a Licensee and a Licensor at the same time.
|
||||
1.13 'Convey' means to communicate to the public or distribute.
|
||||
2 Applicability
|
||||
2.1 This Licence governs the use, copying, modification, Conveying of Covered Source and Products, and the Making of Products. By exercising any right granted under this Licence, You irrevocably accept these terms and conditions.
|
||||
2.2 This Licence is granted by the Licensor directly to You, and shall apply worldwide and without limitation in time.
|
||||
2.3 You shall not attempt to restrict by contract or otherwise the rights granted under this Licence to other Licensees.
|
||||
2.4 This Licence is not intended to restrict fair use, fair dealing, or any other similar right.
|
||||
3 Copying, modifying and Conveying Covered Source
|
||||
3.1 You may copy and Convey verbatim copies of Covered Source, in any medium, provided You retain all Notices.
|
||||
3.2 You may modify Covered Source, other than Notices, provided that You irrevocably undertake to make that modified Covered Source available from a Source Location should You Convey a Product in circumstances where the recipient does not otherwise receive a copy of the modified Covered Source. In each case subsection 3.3 shall apply.
|
||||
|
||||
You may only delete Notices if they are no longer applicable to the corresponding Covered Source as modified by You and You may add additional Notices applicable to Your modifications. Including Covered Source in a larger work is modifying the Covered Source, and the larger work becomes modified Covered Source.
|
||||
3.3 You may Convey modified Covered Source (with the effect that You shall also become a Licensor) provided that You:
|
||||
a) retain Notices as required in subsection 3.2;
|
||||
b) add a Notice to the modified Covered Source stating that You have modified it, with the date and brief description of how You have modified it;
|
||||
c) add a Source Location Notice for the modified Covered Source if You Convey in circumstances where the recipient does not otherwise receive a copy of the modified Covered Source; and
|
||||
d) license the modified Covered Source under the terms and conditions of this Licence (or, as set out in subsection 8.3, a later version, if permitted by the licence of the original Covered Source). Such modified Covered Source must be licensed as a whole, but excluding Available Components contained in it, which remain licensed under their own applicable licences.
|
||||
4 Making and Conveying Products
|
||||
|
||||
You may Make Products, and/or Convey them, provided that You either provide each recipient with a copy of the Complete Source or ensure that each recipient is notified of the Source Location of the Complete Source. That Complete Source is Covered Source, and You must accordingly satisfy Your obligations set out in subsection 3.3. If specified in a Notice, the Product must visibly and securely display the Source Location on it or its packaging or documentation in the manner specified in that Notice.
|
||||
5 Research and Development
|
||||
|
||||
You may Convey Covered Source, modified Covered Source or Products to a legal entity carrying out development, testing or quality assurance work on Your behalf provided that the work is performed on terms which prevent the entity from both using the Source or Products for its own internal purposes and Conveying the Source or Products or any modifications to them to any person other than You. Any modifications made by the entity shall be deemed to be made by You pursuant to subsection 3.2.
|
||||
6 DISCLAIMER AND LIABILITY
|
||||
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products are provided 'as is' and any express or implied warranties, including, but not limited to, implied warranties of merchantability, of satisfactory quality, non-infringement of third party rights, and fitness for a particular purpose or use are disclaimed in respect of any Source or Product to the maximum extent permitted by law. The Licensor makes no representation that any Source or Product does not or will not infringe any patent, copyright, trade secret or other proprietary right. The entire risk as to the use, quality, and performance of any Source or Product shall be with You and not the Licensor. This disclaimer of warranty is an essential part of this Licence and a condition for the grant of any rights granted under this Licence.
|
||||
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to the maximum extent permitted by law, have no liability for direct, indirect, special, incidental, consequential, exemplary, punitive or other damages of any character including, without limitation, procurement of substitute goods or services, loss of use, data or profits, or business interruption, however caused and on any theory of contract, warranty, tort (including negligence), product liability or otherwise, arising in any way in relation to the Covered Source, modified Covered Source and/or the Making or Conveyance of a Product, even if advised of the possibility of such damages, and You shall hold the Licensor(s) free and harmless from any liability, costs, damages, fees and expenses, including claims by third parties, in relation to such use.
|
||||
7 Patents
|
||||
7.1 Subject to the terms and conditions of this Licence, each Licensor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in subsections 7.2 and 8.4) patent license to Make, have Made, use, offer to sell, sell, import, and otherwise transfer the Covered Source and Products, where such licence applies only to those patent claims licensable by such Licensor that are necessarily infringed by exercising rights under the Covered Source as Conveyed by that Licensor.
|
||||
7.2 If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Covered Source or a Product constitutes direct or contributory patent infringement, or You seek any declaration that a patent licensed to You under this Licence is invalid or unenforceable then any rights granted to You under this Licence shall terminate as of the date such process is initiated.
|
||||
8 General
|
||||
8.1 If any provisions of this Licence are or subsequently become invalid or unenforceable for any reason, the remaining provisions shall remain effective.
|
||||
8.2 You shall not use any of the name (including acronyms and abbreviations), image, or logo by which the Licensor or CERN is known, except where needed to comply with section 3, or where the use is otherwise allowed by law. Any such permitted use shall be factual and shall not be made so as to suggest any kind of endorsement or implication of involvement by the Licensor or its personnel.
|
||||
8.3 CERN may publish updated versions and variants of this Licence which it considers to be in the spirit of this version, but may differ in detail to address new problems or concerns. New versions will be published with a unique version number and a variant identifier specifying the variant. If the Licensor has specified that a given variant applies to the Covered Source without specifying a version, You may treat that Covered Source as being released under any version of the CERN-OHL with that variant. If no variant is specified, the Covered Source shall be treated as being released under CERN-OHL-S. The Licensor may also specify that the Covered Source is subject to a specific version of the CERN-OHL or any later version in which case You may apply this or any later version of CERN-OHL with the same variant identifier published by CERN.
|
||||
8.4 This Licence shall terminate with immediate effect if You fail to comply with any of its terms and conditions.
|
||||
8.5 However, if You cease all breaches of this Licence, then Your Licence from any Licensor is reinstated unless such Licensor has terminated this Licence by giving You, while You remain in breach, a notice specifying the breach and requiring You to cure it within 30 days, and You have failed to come into compliance in all material respects by the end of the 30 day period. Should You repeat the breach after receipt of a cure notice and subsequent reinstatement, this Licence will terminate immediately and permanently. Section 6 shall continue to apply after any termination.
|
||||
8.6 This Licence shall not be enforceable except by a Licensor acting as such, and third party beneficiary rights are specifically excluded.
|
||||
|
||||
SPDX-License-Identifier: CERN-OHL-S-2.0
|
59
LICENSE.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Lizenz – Smart Chain Oiler
|
||||
|
||||
Dieses Projekt kombiniert Firmware, Hardware‑Designs und Dokumentation. Unterschiedliche Bestandteile stehen unter unterschiedlichen, jeweils passenden Open‑Source‑Lizenzen.
|
||||
|
||||
---
|
||||
|
||||
## Firmware & WebUI (Software)
|
||||
|
||||
**Lizenz: GNU General Public License v3 (GPL‑3.0)**
|
||||
|
||||
* Frei nutzbar, veränderbar und weiterverteilbar.
|
||||
* Änderungen oder Weitergaben müssen ebenfalls unter GPL‑3.0 veröffentlicht werden.
|
||||
* Keine kommerzielle Nutzung in Closed‑Source‑Produkten möglich.
|
||||
|
||||
👉 Datei: `COPYING.GPLv3`
|
||||
|
||||
---
|
||||
|
||||
## PCB & Schaltpläne (Hardware)
|
||||
|
||||
**Lizenz: CERN Open Hardware License v2 – Strongly Reciprocal (CERN‑OHL‑S‑2.0)**
|
||||
|
||||
* Erlaubt Nachbau, Modifikation und Weitergabe.
|
||||
* Abgeleitete Designs müssen wieder unter derselben Lizenz veröffentlicht werden.
|
||||
* Kommerzielle Nutzung ist nur erlaubt, wenn die Konstruktionsdateien (Schaltpläne, PCB‑Layouts, Gerber) offengelegt werden.
|
||||
|
||||
👉 Datei: `LICENSE.CERN‑OHL‑S‑2.0`
|
||||
|
||||
---
|
||||
|
||||
## Dokumentation & Bilder (Manuals, Renderings, Fotos)
|
||||
|
||||
**Lizenz: Creative Commons Attribution‑NonCommercial‑ShareAlike 4.0 (CC BY‑NC‑SA 4.0)**
|
||||
|
||||
* Frei nutzbar und veränderbar mit Namensnennung.
|
||||
* **Nicht‑kommerziell**: keine Nutzung für Verkauf oder gewerbliche Produkte.
|
||||
* **ShareAlike**: abgeleitete Werke müssen wieder unter derselben Lizenz stehen.
|
||||
|
||||
👉 Datei: `LICENSE.CC‑BY‑NC‑SA‑4.0`
|
||||
|
||||
---
|
||||
|
||||
## Zusammenfassung
|
||||
|
||||
* **Basteln, Nachbauen, Lernen, Forken:** erlaubt ✅
|
||||
* **Verkauf/kommerzieller Vertrieb ohne Freigabe:** verboten ❌
|
||||
* **Bei Änderungen/Forks:** immer Quelltexte, Schaltpläne und Doku wieder offenlegen.
|
||||
|
||||
---
|
||||
|
||||
## Hinweis
|
||||
|
||||
Diese Lizenzkombination wurde gewählt, um **Nachbau & Weiterentwicklung** zu fördern, gleichzeitig aber **kommerzielle Ausbeutung ohne Rücksprache** zu verhindern. Für eine kommerzielle Lizenzierung bitte Kontakt mit dem Autor aufnehmen.
|
||||
|
||||
---
|
||||
|
||||
## Autor
|
||||
|
||||
Souko „Shakaru“ Hiabuto – 2025
|
247
README.md
@@ -0,0 +1,247 @@
|
||||
# Smart Chain Oiler
|
||||
|
||||
Ein intelligenter, mikrocontroller‑gesteuerter Kettenöler für Motorräder. Bedient wird das System mit **nur einem Taster** und einer **RGB‑LED**. Alle erweiterten Einstellungen und Wartung erfolgen über ein **WebUI** (WiFi‑Access Point, plattformunabhängig, keine App nötig). Der reguläre Betrieb läuft komplett autark – Smartphone bleibt in der Tasche.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
* **Automatische Schmierung**
|
||||
|
||||
* Normalmodus: Impuls alle **8 000 m** (Standard, anpassbar)
|
||||
* Regenmodus: Impuls alle **4 000 m** (Standard, anpassbar)
|
||||
* Metergenaue Distanzzählung **über Neustarts hinweg** (setzt nicht auf 0 zurück)
|
||||
* **Modi**
|
||||
|
||||
* **Normal** / **Regen** (per Taster umschaltbar, letzter Modus wird gespeichert)
|
||||
* **Wash‑Mode**: für xy m (Standard **500 m**) **alle 10 m** ein Impuls; danach automatische Rückkehr zum vorherigen Modus
|
||||
* **Prime/Entlüften**: feste Impulsanzahl (Standard **25 Pulse**) zum Spülen/Entlüften
|
||||
* **WiFi‑AP**: Zugriff auf WebUI für Setup, Wartung, Updates
|
||||
* **Virtuelle Tanküberwachung**
|
||||
* Details zum Tankmodell & zur Pumpensteuerung siehe weiter unten.
|
||||
* **Diagnose (DTC) & Live‑Status**
|
||||
|
||||
* DTC‑Schweregrade: **INFO**, **WARN (Orange)**, **CRITICAL (Rot, stoppt Pumpe)**
|
||||
* Alle DTCs mit Klartext im WebUI; Push via WebSocket
|
||||
* **Mehrere Geschwindigkeitsquellen**
|
||||
|
||||
* **Impuls/Pickup** (Tachosignal)
|
||||
* **GPS** (seriell; Baudrate wählbar)
|
||||
* **CAN** (KTM‑spezifisch)
|
||||
* **OBD2 über CAN** (in Test)
|
||||
* **OBD2 über K‑Line** (ab PCB‑Rev 1.4)
|
||||
* **RGB‑LED Feedback**
|
||||
|
||||
* Farben: Grün (Normal), Blau (Regen), Pink blinkend (Prime), Türkis (Wash), Gelb (AP aktiv), Orange (Warnung), Rot (kritisch)
|
||||
* Helligkeit **min/max** und Blinkmodus konfigurierbar
|
||||
* **OTA‑Updates**
|
||||
|
||||
* OTA (Port 8266, Passwort), mit optionaler OLED‑Progressanzeige
|
||||
* **Dateisystem & Kompatibilität**
|
||||
|
||||
* LittleFS mit **„required flash version“**‑Check; WebUI‑Tab zeigt Firmware‑, Flash‑ und Git‑Version
|
||||
* **EEPROM‑Architektur**
|
||||
|
||||
* Partitionen **CFG**/**PDS** mit Checksummen, Sanity‑Checks & Wear‑Leveling; passende DTCs bei Inkonsistenzen
|
||||
|
||||
---
|
||||
|
||||
## Tankmodell & Pumpensteuerung
|
||||
|
||||
* **Dosis pro Puls**: einstellbar in µl (Standard auf McCoi-Pumpe abgestimmt)
|
||||
* **Virtuelles Tankmodell**: berechnet Füllstand und Restreichweite basierend auf Tankgröße und Dosiermenge
|
||||
* **Warnung & Stopp**: Orange bei niedrigem Füllstand, Rot & Abschaltung bei 0 %
|
||||
* **Prime/Purge**: feste Pulsanzahl (Standard 25), konfigurierbar im WebUI
|
||||
* **Wash-Mode**: spezielles Muster – z. B. alle 10 m ein Puls über definierte Gesamtdistanz
|
||||
* **Pumpen-Timing**: auf die McCoi Spezial-Ölpumpe abgestimmt, für gleichmäßige Dosierung
|
||||
|
||||
---
|
||||
|
||||
## Hardware
|
||||
|
||||
* **MCU:** ESP8266 (Wemos D1 mini, Arduino‑Framework)
|
||||
* **PCB:** Revisionen 1.2–1.4 (ab **1.4**: OBD2 **K‑Line**)
|
||||
* **Pumpe:**
|
||||
|
||||
* Ursprünglich **Dellorto Ölpumpe PLE 8**
|
||||
* Aktuell **McCoi Spezial‑Ölpumpe** – **Software‑Ansteuerung dieses Projekts ist auf diese Pumpe abgestimmt**. Dank hilfreicher Hinweise von Steffen Koberitz (McCoi) zur optimalen Ansteuerung; **keine Mitarbeit** an der Pumpen‑Hardwareentwicklung.
|
||||
* **Option:** I²C OLED‑Display 128×64 (Standard Arduino/„China“‑Module)
|
||||
|
||||
### Getestete Motorräder
|
||||
|
||||
* **KTM 890 Adventure R (2021)**
|
||||
* **KTM 1290 Super Duke (2023)**
|
||||
|
||||
---
|
||||
|
||||
## Tankmodell & Pumpensteuerung
|
||||
|
||||
*Implementierung: `lubeapp.cpp`*
|
||||
|
||||
* **Dosierung (µl/Puls):** konfigurierbar im WebUI (Schlüssel: *amountPerDose\_microL*). Werte und Pulszeit sind **auf die McCoi‑Pumpe abgestimmt**.
|
||||
* **Virtueller Tank:** Tankgröße (ml) → Füllstand (%) → **Warnschwelle** (Orange) → **0 %** stoppt die Pumpe (Rot). Tank‑Reset unter **Wartung**.
|
||||
* **Prime/Purge:** feste Impulsanzahl (Standard **25**), zum Spülen/Entlüften; Start per Taster oder WebUI.
|
||||
* **Wash‑Mode:** Impuls‑Pattern pro Strecke (Standard: **alle 10 m** über **500 m**), danach automatische Rückkehr zu Normal/Regen.
|
||||
* **Persistenz:** Laufende Zähler & Tankstand werden **über Neustarts** mitgeführt (EEPROM/Flash + Sanity/Checksum).
|
||||
|
||||
---
|
||||
|
||||
## GPS‑Quelle (seriell)
|
||||
|
||||
*Implementierung: `gps.cpp`, TinyGPSPlus*
|
||||
|
||||
* **Parser:** TinyGPSPlus; Baudrate im WebUI wählbar.
|
||||
* **Verwendung:** Geschwindigkeit/Distanz als Basis für Schmierintervalle, metergenau.
|
||||
* **Fallback & DTC:** Kein GPS → DTC‑Meldung (je nach Konfiguration WARN/CRIT) und LED‑Signalisierung; alternative Quellen (Impuls/CAN/OBD) bleiben nutzbar.
|
||||
* **Praxis:** Geeignet, wenn kein Pickup/Tachosignal verfügbar ist oder als zusätzliche Prüfinstanz.
|
||||
|
||||
---
|
||||
|
||||
## Bedienung (Taster & LED)
|
||||
|
||||
> **Prinzip:** Taster gedrückt halten → **LED‑Farbe beobachten** → bei gewünschter Farbe **loslassen**.
|
||||
|
||||
* **0,5–3,5 s**: **Normal ↔ Regen** (Grün/Blau)
|
||||
* **3,5–6,5 s**: **Wash‑Mode** (Türkis)
|
||||
* **6,5–9,5 s**: **Prime/Entlüften** (Pink blinkend)
|
||||
* **9,5–12,5 s**: **WiFi‑AP** an/aus (Gelb)
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[Button hold] --> B{Hold‑Dauer}
|
||||
B -->|0.5–3.5 s| C[Toggle Normal↔Regen]
|
||||
B -->|3.5–6.5 s| D[Wash‑Mode aktiv]
|
||||
B -->|6.5–9.5 s| E[Prime/Entlüften]
|
||||
B -->|9.5–12.5 s| F[WiFi‑AP Toggle]
|
||||
C --> G[LED: Grün/Blau]
|
||||
D --> H[LED: Türkis]
|
||||
E --> I[LED: Pink blinkend]
|
||||
F --> J[LED: Gelb]
|
||||
```
|
||||
|
||||
**LED‑Bedeutung (Auswahl):** Grün = Normal · Blau = Regen · Pink blinkend = Prime · Türkis = Wash · Gelb = AP aktiv · Orange = Warnung · Rot = Kritisch (Stopp)
|
||||
|
||||
---
|
||||
|
||||
## WebUI (WiFi‑AP)
|
||||
|
||||
**Stack:** WebSocket · JavaScript · Bootstrap · jQuery · responsive.
|
||||
|
||||
**Tabs & Funktionen:**
|
||||
|
||||
* **Home**: Tank % (Progressbar), aktueller Systemstatus, DTC‑Tabelle
|
||||
* **Wartung**: Tank **zurücksetzen**, Entlüften (Pulsezahl einstellen & starten), **Einmessen** (Pulsecounter), **Live‑Debug** (Start/Stop), **Reboot**
|
||||
* **Einstellungen**:
|
||||
|
||||
* **Signalquelle** (Impuls/CAN/GPS/…)
|
||||
|
||||
* **Impuls**: Reifenbreite, Verhältnis, Felgendurchmesser, Pulse/Umdrehung
|
||||
* **CAN**: Modellwahl
|
||||
* **GPS**: Baudrate
|
||||
* **Dosierung**: Normal, Regen, Waschdistanz, Waschintervall
|
||||
* **Öltank**: Kapazität (ml), Warnschwelle (%), Menge/Puls (µl)
|
||||
* **LED**: Blinkmodus, Min-/Max‑Brightness
|
||||
* **WiFi**: SSID‑Liste, Passwort, Auto‑Connect
|
||||
* **Speichern** (Hinweis: Wechsel der Signalquelle triggert Neustart)
|
||||
* **Update**:
|
||||
|
||||
* Versionen: **Firmware**, **Benötigte Flash‑Version**, **Installierte Flash‑Version**, **Git‑Revision**
|
||||
* **EEPROM‑Backup** (Download) & **Restore** (Upload `.ee.json`)
|
||||
* **Firmware‑Update** (Upload `.fw.bin` oder `.fs.gz`)
|
||||
|
||||
> Für den Alltag ist das WebUI nicht nötig; es dient Setup, Tank‑Reset und Diagnose/Updates.
|
||||
|
||||
### Frontend‑Dateien
|
||||
|
||||
* `index.htm` (Haupt‑UI)
|
||||
* `static/js/websocket.js` (WebSocket‑Client & Live‑Update)
|
||||
* `static/js/script.js` (UI‑Helpers, z. B. Passwort‑Toggle, File‑Label)
|
||||
* `static/js/dtc_table.js` + `static/dtc_table.json` (DTC‑Mapping mit Titel & Beschreibung)
|
||||
* `post.htm` (Zwischenseite nach Speichern/Update)
|
||||
|
||||
### WebSocket‑Protokoll (Client ← Server)
|
||||
|
||||
* `NOTIFY:<type>;<message>` → UI‑Toast/Alert
|
||||
* `DEBUG:<text>` → Live‑Debug‑Fenster (append)
|
||||
* `DTC:<dtcList>` → aktive DTCs, z. B. `ts,code,severity,active;...`
|
||||
→ UI: **processDTCNotifications** & **fillDTCTable** (Titel/Beschreibung via `dtc_table.json`)
|
||||
* `MAPPING_STATUS:<map>` → Schlüssel‑Mapping für **STATUS**
|
||||
* `MAPPING_STATIC:<map>` → Schlüssel‑Mapping für **STATIC**
|
||||
* `STATUS:<values>` → Laufzeitwerte, in UI gerendert
|
||||
* `STATIC:<values>` → statische Werte (Konfiguration/Versionen)
|
||||
|
||||
> **WebSocket‑Endpoint:** `ws://<host>/ws`
|
||||
|
||||
### WebSocket‑Protokoll (Client → Server)
|
||||
|
||||
* Generischer UI‑Event: `btn-<elementId>:<value>`
|
||||
Beispiel: Button‑Klicks/Bestätigungen senden `btn-…` an den Server.
|
||||
|
||||
---
|
||||
|
||||
## Build & Flash (PlatformIO)
|
||||
|
||||
* **Projekt:** `platformio.ini` mit Environments für PCB‑Revisionen **1.2**, **1.3**, **1.4** (Serial/OTA)
|
||||
* **Default‑Env:** `pcb_rev_1-4_serial`
|
||||
* **Filesystem:** LittleFS (automatisierte Vorbereitung via Pre/Post‑Scripts)
|
||||
* **OTA:** `espota` (Port 8266, Passwort aus `wifi_credentials.ini`)
|
||||
* **Git‑Revision:** wird als Macro eingebettet (Codegen‑Script)
|
||||
* **Libs (Auszug):** U8g2, Adafruit NeoPixel, Ticker, I2C\_EEPROM, ESPAsyncWebServer‑esphome, ArduinoJson 7, MCP\_CAN, TinyGPSPlus
|
||||
|
||||
### Beispiel
|
||||
|
||||
```bash
|
||||
# Firmware bauen (Standard‑Env)
|
||||
pio run
|
||||
|
||||
# Seriell flashen (z. B. PCB Rev 1.4)
|
||||
pio run -e pcb_rev_1-4_serial -t upload
|
||||
|
||||
# OTA flashen
|
||||
pio run -e pcb_rev_1-4_ota -t upload
|
||||
```
|
||||
|
||||
**Konfiguration über Build‑Flags** (Auszug):
|
||||
|
||||
* `-DPCB_REV=…` (automatisch je nach Env)
|
||||
* `-DFEATURE_ENABLE_OLED`, `-DATOMIC_FS_UPDATE`, `-DCAN_DEBUG_MESSAGE`
|
||||
* WiFi/Passwörter via `wifi_credentials.ini` (`WIFI_SSID_CLIENT`, `WIFI_PASSWORD_CLIENT`, `ADMIN_PASSWORD`, `WIFI_AP_PASSWORD`)
|
||||
|
||||
### Flash‑Version & Updatepfad
|
||||
|
||||
* Wenn „**Benötigte Flash‑Version**“ ≠ „**Installierte Flash‑Version**“: zuerst **FS‑Image** (`.fs.gz`) im WebUI unter **Update → Firmware‑Update** hochladen; danach die eigentliche Firmware (`.fw.bin`).
|
||||
|
||||
---
|
||||
|
||||
## Diagnose (DTC)
|
||||
|
||||
* **WARN (Orange)**: Hinweis/Warnung, Betrieb läuft weiter
|
||||
* **CRITICAL (Rot)**: kritischer Fehler, Öler stoppt
|
||||
* DTCs erscheinen live im WebUI (Tabelle & Detail‑Modal); zusätzlich LED‑Signale
|
||||
* **Vollständige DTC‑Liste** inkl. Beschreibungen siehe **Manual.md**
|
||||
|
||||
---
|
||||
|
||||
## Roadmap / Status
|
||||
|
||||
* OBD2 über CAN & K‑Line: **in aktiver Testphase**
|
||||
* GPS‑Quelle: **funktionsfähig**, weitere Feldtests
|
||||
* Weitere Bikes/Modelle: Community‑Feedback willkommen
|
||||
|
||||
---
|
||||
|
||||
## Lizenz
|
||||
|
||||
- **Firmware & WebUI (Software):** [GNU GPLv3](COPYING.GPLv3)
|
||||
- **PCB & Schaltpläne (Hardware):** [CERN OHL-S v2.0](LICENSE.CERN-OHL-S-2.0)
|
||||
- **Dokumentation & Bilder:** [CC BY-NC-SA 4.0](LICENSE.CC-BY-NC-SA-4.0)
|
||||
|
||||
👉 Zusammenfassung: Basteln, Nachbauen, Lernen erlaubt ✅ – kommerzieller Vertrieb oder Closed-Source-Nutzung verboten ❌. Details siehe [LICENSE.md](LICENSE.md).
|
||||
|
||||
---
|
||||
|
||||
## Autor & Dank
|
||||
|
||||
Entwickelt von **Souko „Shakaru“ Hiabuto**
|
||||
|
||||
Besonderer Dank an **Steffen Koberitz (McCoi)** für Hinweise zur optimalen Ansteuerung der McCoi‑Pumpe.
|
||||
|
45
Reverse-Engineering CAN-Bus/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.pyo
|
||||
*.pyd
|
||||
*.pkl
|
||||
*.pklz
|
||||
*.egg-info/
|
||||
*.egg
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Build
|
||||
build/
|
||||
dist/
|
||||
.eggs/
|
||||
|
||||
# Logs (Ordner behalten, Dateien ignorieren)
|
||||
logs/*
|
||||
!logs/.gitkeep
|
||||
*.log
|
||||
|
||||
# Virtual Environments
|
||||
venv/
|
||||
.env/
|
||||
.venv/
|
||||
|
||||
# System-Dateien
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Backup-Dateien
|
||||
*.bak
|
||||
*.tmp
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Editor/IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# Projekt-spezifische
|
||||
settings.json
|
||||
settings.json.bak
|
||||
tmp/
|
90
Reverse-Engineering CAN-Bus/HOW-TO-REVERSE.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# HOW-TO_REVERSE – Praxisleitfaden fürs CAN-Reverse-Engineering
|
||||
|
||||
Dieses How-To ist dein Werkzeugkasten, um aus nackten Frames echte Signale zu destillieren. Es ist kein Orakel, sondern ein **Experimentier-Protokoll**: miss, verifiziere, falsifiziere. Nutze es zusammen mit der GUI/CLI (Splitter, Explorer, Batch-Analyzer, Range-/Unsupervised-Fit).
|
||||
|
||||
---
|
||||
|
||||
## 0) Vorbereitungen (Daten sammeln wie ein Ingenieur)
|
||||
- **Zustände trennen**: *Zündung an*, *Motor aus*, *Motor an Leerlauf*, *Schieben*, *aufgebockt Hinterrad drehen*, *kurze Fahrt*.
|
||||
- **Aktoren toggeln**: Blinker, Bremse, Licht, Lüfter → generiere Ground-Truth für Bits/Flags.
|
||||
- **Nur RX** analysieren, wenn deine Hardware parallel TX sendet (Störmuster vermeiden).
|
||||
|
||||
---
|
||||
|
||||
## 1) Frame- & ID-Ebene zuerst
|
||||
- **Repetition Rate (Hz)**: Zyklische Sensor-IDs senden stabil.
|
||||
- *Daumenwerte*: WheelSpeed 20–100 Hz, RPM 10–50 Hz, TPS/APS 20–100 Hz, Lenkwinkel 50–100 Hz, Temperaturen 1–10 Hz.
|
||||
- **Jitter** der Periodizität: Streuung der Inter-Arrival-Times. Niedrig = sauberer Zyklus.
|
||||
- **DLC-Stabilität**: schwankende Payload-Länge → ggf. ISO-TP / Multiplex.
|
||||
- **Change-Density**: Anteil Frames mit Payload-Änderung. Zu hoch → Counter/Checksumme, zu niedrig → Status/Träge.
|
||||
|
||||
---
|
||||
|
||||
## 2) Byte/Bit-Signaturen
|
||||
- **Bit-Flip-Rate** pro Bit: ~50% → Flag/Event; sehr regelmäßig → Pattern/Timer.
|
||||
- **Rolling Counter**: 4/8-bit Sequenzen (0..15/255), oft konstant steigend.
|
||||
- **Checksumme**: Byte hängt deterministisch von anderen Bytes ab; häufig letzte Position.
|
||||
- **Endianness**: 16-bit LE/BE testen. Monotone Trends/kleine Deltas weisen auf richtige Byteordnung.
|
||||
- **Quantisierung**: typische Schrittweiten (z. B. 0.5 °C, 0.25 km/h).
|
||||
|
||||
---
|
||||
|
||||
## 3) Physik als Filter (Slew-Rate & Grenzen)
|
||||
Miss **ΔWert/Δt** robust (95-Perzentil, nicht Max):
|
||||
- **Temperaturen**: sehr träge → ΔT/s ≪ 1 °C/s.
|
||||
- **Fahrgeschwindigkeit**: 0→100 km/h < 1 s unrealistisch; grob ≤ 30–50 km/h/s (Straße).
|
||||
- **RPM**: schnelle Sprünge möglich, aber nicht teleport. 1k→8k in 1–3 s plausibel.
|
||||
- **Lenkwinkel**: schnell, aber begrenzt; **Jerk** (ΔΔ/Δt) nicht absurd.
|
||||
|
||||
Alles, was diese Checks bricht, ist selten dein gesuchtes physikalisches Signal (oder deine Skalierung ist falsch).
|
||||
|
||||
---
|
||||
|
||||
## 4) Korrelation & Kausalität
|
||||
- **Cross-Korrelation**: RPM ↔ WheelSpeed (Gang drin), Brake-Bit ↔ Pressure, Blinker-Bit ↔ Blinkfrequenz (~1–2 Hz).
|
||||
- **Gang** aus Ratio (RPM/Speed) ableiten und Kandidaten validieren.
|
||||
- **Event-Marker** setzen und zeitgleichen Byte-Kipp suchen.
|
||||
|
||||
---
|
||||
|
||||
## 5) Protokoll & Multiplex
|
||||
- **ISO-TP**: Muster `0x10 len …` (First Frame), `0x21…` (Consecutive). Enthält selten einzelne Sensorkanäle.
|
||||
- **Multiplexer**: Ein Byte schaltet die „Seite“ der Payload um. Erkennbar am Sprungverhalten.
|
||||
|
||||
---
|
||||
|
||||
## 6) Statistik-Fingerabdrücke
|
||||
- **Unique-Ratio** = |unique|/n. Zu klein → Flag/Konstante; moderat → analog.
|
||||
- **Entropy** pro Byte → Daten/Checksumme vs. Status.
|
||||
- **Plateaus/Hysterese**: aktualisiert nur bei Δ≥Schwelle.
|
||||
|
||||
---
|
||||
|
||||
## 7) Scale/Offset systematisch schätzen
|
||||
- **Scale-Raster**: Dekaden + praxisnahe Werte (0.0625, 0.1, 0.25, 0.5, 0.75, 1, 2, 5, 10 …).
|
||||
- **Offset** via **Intervall-Überdeckung**: wähle das Offset, das die meisten Samples in [rmin, rmax] bringt.
|
||||
- **Vorzeichen prüfen**: signed/unsigned, ggf. negative Scales zulassen.
|
||||
|
||||
---
|
||||
|
||||
## 8) Workflow-Cookbook
|
||||
1. **Splitten** (Logs → Traces).
|
||||
2. **ID-Explorer/Batch**: Periodizität, Change-Density, 8/16-bit Plots.
|
||||
3. **Range-Fit** mit physikalischen Ranges *und* **Slew-Limits** (Δ/Δt) + **Rate/Jitter-Constraints**.
|
||||
4. **Cross-Checks**: Kandidaten gegen andere Kanäle testen (RPM↔Speed, Brake↔Pressure).
|
||||
5. **Iterieren**: Range/Constraints verfeinern, Plots sichten, Hypothesen anpassen.
|
||||
|
||||
---
|
||||
|
||||
## 9) Typische Fallen
|
||||
- Falsche Endianness → Teleports.
|
||||
- Counter/Checksumme im selben 16-bit-Wort → zuerst trennen.
|
||||
- DLC<8 → 16-bit-Kombis fehlen; keine Dummies einstreuen.
|
||||
- ×10/×100-Skalierung: Δ/Δt wirkt absurd groß.
|
||||
- BCD/ASCII in Diag/Odometer – nicht physikalisch.
|
||||
|
||||
---
|
||||
|
||||
## 10) Ziel: Berichte statt Bauchgefühl
|
||||
Automatisiere Tests & Schwellen. Lass Skripts einen **Analysebericht** schreiben: „PASS (smooth, low jitter, rate ok)“ vs. „FAIL (jitter, slope99 zu hoch, hit-ratio zu klein)“.
|
||||
Das minimiert Confirmation Bias – und macht Ergebnisse reproduzierbar.
|
272
Reverse-Engineering CAN-Bus/README.md
Normal file
@@ -0,0 +1,272 @@
|
||||
# Kettenöler – CAN Reverse-Engineering Toolkit
|
||||
|
||||
Toolsuite (GUI + CLI) zum Analysieren von CAN-Logs im **Kettenöler-Format**.
|
||||
Funktionen: Logs **splitten** (pro CAN-ID), **explorative Visualisierung** (8-/16-Bit, LE/BE), **Batch-Analysen** über viele `.trace`, **Ranking** plausibler Signale und **Range-Fit** (lineare Abbildung `phys = raw*scale + offset`), optional **unsupervised** ohne vorgegebene Range.
|
||||
|
||||
---
|
||||
|
||||
## Features (Überblick)
|
||||
|
||||
* **Einheitliche GUI** (`main.py`) mit globalem Header (Workdir, Ordnerstruktur, Log-Auswahl).
|
||||
* **Gemeinsame Trace-Auswahl** in allen Trace-Tabs (gleiches Panel, synchronisiert über Tabs):
|
||||
|
||||
* **ID Explorer** (Multi-Select)
|
||||
* **Traces Batch-Analyse** (Multi-Select oder kompletter Ordner)
|
||||
* **Range-Fit** (Single-Select, supervised *oder* unsupervised)
|
||||
* **Splitter**: Logs → `.trace` pro CAN-ID (`traces/…`, inkl. `overview_ids.csv`).
|
||||
* **Einzel-ID-Explorer**: Plots aller Byte-Kanäle (8-Bit) und Nachbar-Wortkombis (16-Bit LE/BE) + Kurzstatistik.
|
||||
* **Batch-Analyzer**: Kennzahlen/Plots für alle `.trace` in einem Ordner, globales Ranking.
|
||||
* **Range-/Unsupervised-Fit**:
|
||||
|
||||
* *Supervised*: findet `scale` & `offset` für Zielbereich `[rmin, rmax]` (Offset via Intervall-Überdeckung, Scale aus plausibler Menge).
|
||||
* *Unsupervised*: identifiziert „ruhige“ physikalische Kandidaten ohne Range (Smoothness/Varianz/Rate/Spannweite).
|
||||
* **Output-Hygiene**: Ergebnisse stets unter `analyze_out/<timestamp>_<tool>/…`, optionale Zeitstempel-Unterordner verhindern Überschreiben.
|
||||
* **Projektdatei** (`Projekt.json`): speichert Workdir, Subfolder, Log-Auswahl, aktiven Traces-Ordner, etc.
|
||||
* **„Neuester Split“**-Button: springt in den jüngsten Unterordner von `traces/`.
|
||||
|
||||
---
|
||||
|
||||
## Repository-Komponenten
|
||||
|
||||
* **GUI**
|
||||
|
||||
* `main.py` – zentrales Frontend mit Tabs (Multi-Log Analyse, ID Explorer, Traces Batch-Analyse, Range-Fit).
|
||||
* **CLI-Tools**
|
||||
|
||||
* `can_split_by_id.py` – Splittet Logs nach CAN-ID → `.trace`.
|
||||
* `id_signal_explorer.py` – Visualisiert/analysiert eine `.trace` (8-Bit, 16-Bit LE/BE) + `summary_stats.csv`.
|
||||
* `trace_batch_analyzer.py` – Batch-Analyse für viele `.trace` + globales Ranking.
|
||||
* `trace_signal_fitter.py` – **Range-Fit** (scale/offset) **oder** **Unsupervised-Fit** (ohne Range).
|
||||
|
||||
> Optional/Alt: `can_universal_signal_finder.py` – ursprünglicher Multi-Log-Analyzer (Ranking auf Rohdatenebene).
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
* **Python** ≥ 3.10
|
||||
* Abhängigkeiten: `pandas`, `numpy`, `matplotlib`
|
||||
* Setup:
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Logformat (Kettenöler)
|
||||
|
||||
Eine Zeile pro Frame:
|
||||
|
||||
```
|
||||
<timestamp_ms> <TX|RX> 0x<ID_HEX> <DLC> <byte0> <byte1> ... <byte7>
|
||||
```
|
||||
|
||||
Beispiel:
|
||||
|
||||
```
|
||||
123456 RX 0x208 8 11 22 33 44 55 66 77 88
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Projekt-/Ordnerstruktur
|
||||
|
||||
Ein **Workdir** bündelt alles zu einem Fahrzeug/Projekt:
|
||||
|
||||
```
|
||||
<Workdir>/
|
||||
Projekt.json # GUI-Einstellungen
|
||||
logs/ # Input-Logs
|
||||
traces/ # per-ID .trace (vom Split)
|
||||
analyze_out/ # Ergebnisse; je Run eigener Timestamp-Unterordner
|
||||
```
|
||||
|
||||
**Namenskonventionen**
|
||||
|
||||
* Split-Ergebnisse: `traces/<timestamp?>/0x<ID>_<ursprungslog>.trace`
|
||||
* Outputs: `analyze_out/<YYYYMMDD_HHMMSS>_<tool>/…`
|
||||
|
||||
---
|
||||
|
||||
## Modelle-Ordner & Git
|
||||
|
||||
Wenn du pro Modell arbeitest, z. B.:
|
||||
|
||||
```
|
||||
models/
|
||||
Triumph 2023/
|
||||
logs/
|
||||
traces/
|
||||
analyze_out/
|
||||
Projekt.json
|
||||
```
|
||||
|
||||
Lege in `models/` folgende **`.gitignore`** ab, damit `traces/` und `analyze_out/` **in jedem Modell-Unterordner** ignoriert werden – `logs/` und `.json` bleiben versioniert:
|
||||
|
||||
```gitignore
|
||||
*/traces/
|
||||
*/traces/**
|
||||
*/analyze_out/
|
||||
*/analyze_out/**
|
||||
|
||||
traces/
|
||||
traces/**
|
||||
analyze_out/
|
||||
analyze_out/**
|
||||
|
||||
# optional: typos
|
||||
*/analyze.out/
|
||||
*/analyze.out/**
|
||||
analyze.out/
|
||||
analyze.out/**
|
||||
```
|
||||
|
||||
Leere Ordner wie `logs/` ggf. mit `.gitkeep` befüllen.
|
||||
|
||||
---
|
||||
|
||||
## GUI-Benutzung
|
||||
|
||||
```bash
|
||||
python3 main.py
|
||||
```
|
||||
|
||||
### Globaler Header (immer oben)
|
||||
|
||||
* **Workdir** wählen, **Logs scannen** → Liste aller gefundenen Logfiles (Multi-Select).
|
||||
* Subfolder einstellen: `logs`, `traces`, `analyze_out` (alle **parallel** im Workdir).
|
||||
* **Projekt speichern/laden** (`Projekt.json`).
|
||||
* Beim Workdir-Wechsel/Projekt-Laden setzt die GUI den **aktiven Traces-Ordner** automatisch auf `traces/` bzw. den **jüngsten** Unterordner.
|
||||
|
||||
### Einheitliches Trace-Panel (in allen Trace-Tabs)
|
||||
|
||||
* Links: Liste der `.trace`
|
||||
* Rechts: **Traces-Ordner wählen**, **Workdir/traces**, **Neuester Split**, **Refresh**, (optional **Alle**, **Keine**)
|
||||
* Änderungen am Ordner/Liste wirken **sofort in allen Tabs**.
|
||||
|
||||
### Tab: Multi-Log Analyse
|
||||
|
||||
* Ranking direkt aus Logs (Include/Exclude-IDs, optional Range mit `scale/offset`).
|
||||
* Output: `analyze_out/<ts>_multilog/…`
|
||||
* Optional: „Jede Logdatei separat“ → je Log eigener Unterordner.
|
||||
|
||||
### Tab: ID Explorer
|
||||
|
||||
* **Split** (aus Header-Logauswahl): Logs → `.trace` nach `traces[/<ts>]`, plus `overview_ids.csv`.
|
||||
Danach wird der neue Traces-Pfad **automatisch aktiviert**.
|
||||
* **Einzel-ID Analyse** (Multi-Select):
|
||||
|
||||
* Plots: Byte\[0..7] (8-Bit) + LE/BE für Paare (0-1 … 6-7)
|
||||
* `summary_stats.csv` pro Trace
|
||||
* Output: `analyze_out/<ts>_id_explore/…`
|
||||
|
||||
### Tab: Traces Batch-Analyse
|
||||
|
||||
* Nutzt die gemeinsame Trace-Liste.
|
||||
* **Ohne Auswahl** → kompletter Ordner; **mit Auswahl** → es wird ein Subset-Ordner gebaut (Hardlinks/Kopie) und nur dieses analysiert.
|
||||
* Parameter: `--rx-only`, `scale`, `offset`, `range-min/max`, `top`, `--plots`.
|
||||
* Output:
|
||||
|
||||
* je Trace: `*_combostats.csv` (+ Plots),
|
||||
* global: `summary_top_combinations.csv`
|
||||
* unter `analyze_out/<ts>_trace_batch/…`
|
||||
|
||||
### Tab: Range-Fit (Single-Select)
|
||||
|
||||
* **Zwei Modi**:
|
||||
|
||||
1. **Supervised** (Range-Min/Max gesetzt): findet `scale` & `offset`, maximiert **Hit-Ratio** im Zielbereich.
|
||||
Output: `<trace>_encoding_candidates.csv` + phys-Plots (Top-N).
|
||||
2. **Unsupervised** (Range leer): bewertet Kandidaten nach **Smoothness**, **Spannweite**, **Varianz**, **Rate**, **Uniqueness**.
|
||||
Output: `<trace>_unsupervised_candidates.csv` + Roh-Plots (Top-N).
|
||||
* Optionen: `nur RX`, `negative Scale erlauben` (nur supervised), `Min. Hit-Ratio`, `Min. Smoothness`, `Plots Top-N`, `Output-Label`.
|
||||
* Output: `analyze_out/<ts>_rangefit/…`
|
||||
|
||||
---
|
||||
|
||||
## CLI-Quickstart
|
||||
|
||||
### 1) Splitten
|
||||
|
||||
```bash
|
||||
python3 can_split_by_id.py logs/run1.log logs/run2.log \
|
||||
--outdir <Workdir>/traces/20250827_1200 \
|
||||
--rx-only
|
||||
```
|
||||
|
||||
### 2) Einzel-ID-Explorer
|
||||
|
||||
```bash
|
||||
python3 id_signal_explorer.py <Workdir>/traces/20250827_1200/0x208_run1.trace \
|
||||
--outdir <Workdir>/analyze_out/20250827_1210_id_explore
|
||||
```
|
||||
|
||||
### 3) Batch-Analyse
|
||||
|
||||
```bash
|
||||
python3 trace_batch_analyzer.py \
|
||||
--traces-dir <Workdir>/traces/20250827_1200 \
|
||||
--outdir <Workdir>/analyze_out/20250827_1220_trace_batch \
|
||||
--rx-only --plots --top 8 \
|
||||
--range-min 31 --range-max 80
|
||||
```
|
||||
|
||||
### 4) Range-/Unsupervised-Fit (eine `.trace`)
|
||||
|
||||
```bash
|
||||
# Supervised (z. B. Kühlmittel 31..80°C)
|
||||
python3 trace_signal_fitter.py <trace> \
|
||||
--rmin 31 --rmax 80 \
|
||||
--outdir <Workdir>/analyze_out/20250827_1230_rangefit \
|
||||
--plots-top 8 --min-hit 0.5 --allow-neg-scale
|
||||
|
||||
# Unsupervised (ohne Range)
|
||||
python3 trace_signal_fitter.py <trace> \
|
||||
--outdir <Workdir>/analyze_out/20250827_1240_unsupervised \
|
||||
--plots-top 8 --min-smooth 0.2
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Algorithmen & Heuristiken
|
||||
|
||||
* **Kombinationen**:
|
||||
|
||||
* 8-Bit: `D0..D7`
|
||||
* 16-Bit (adjazent): LE & BE für Paare `(0,1)…(6,7)`
|
||||
*(32-Bit & bit-gepackte Felder: auf der Roadmap)*
|
||||
|
||||
* **Prefilter** (für „ruhige“ physikalische Größen):
|
||||
Mindestanzahl Samples, nicht (nahezu) konstant, keine exzessiven Sprünge (p95 der |Δ| relativ zur Spannweite).
|
||||
|
||||
* **Range-Fit**:
|
||||
Für jeden Kandidaten `raw` wird über eine Menge plausibler **Scales** gesucht; für jedes `scale` wird das **Offset** via **Intervall-Überdeckung** bestimmt (`rmin ≤ scale*raw_i + offset ≤ rmax`). Ranking: Hit-Ratio ↓, dann Glattheit (p95 phys) ↑, Rate ↓, n ↓.
|
||||
|
||||
* **Unsupervised**:
|
||||
**Smoothness** = `1 − clamp(p95(|Δ|)/span, 0..1)`; zusätzlich **span**, **var**, **rate**, **uniq\_ratio**. Ranking auf diese Metriken.
|
||||
|
||||
---
|
||||
|
||||
## Tipps & Troubleshooting
|
||||
|
||||
* **Keine Kandidaten (Range-Fit)**: `--min-hit` senken, `--allow-neg-scale` testen, Range prüfen, längeres/variableres Log nutzen.
|
||||
* **Alles wird gefiltert (Unsupervised)**: `--min-smooth` senken; ggf. `--rx-only` aktivieren.
|
||||
* **Leere/komische Plots**: DLC < 8 → teils keine 16-Bit-Kombis; Frames sehr selten → Rate niedrig.
|
||||
* **Ordner stets sauber**: Zeitstempel-Unterordner aktiv lassen; pro Run eigene Artefakte.
|
||||
|
||||
---
|
||||
|
||||
## Roadmap
|
||||
|
||||
* 32-Bit-Kombinationen, bit-gepackte Felder.
|
||||
* Histogramme, Autokorrelation, Ausreißer-Detektoren.
|
||||
* vordefinierte Signal-Profile (z. B. *WheelSpeed*, *CoolantTemp*).
|
||||
|
||||
---
|
||||
|
||||
## Lizenz / Haftung
|
||||
|
||||
Nur zu Analyse-/Reverse-Engineering-Zwecken. Nutzung auf eigene Verantwortung.
|
95
Reverse-Engineering CAN-Bus/can_split_by_id.py
Normal file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from collections import defaultdict
|
||||
|
||||
LOG_PATTERN = re.compile(r"(\d+)\s+(TX|RX)\s+0x([0-9A-Fa-f]+)\s+(\d+)\s+((?:[0-9A-Fa-f]{2}\s+)+)")
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="Split Kettenöler CAN log(s) into per-ID .trace files and build an overview")
|
||||
ap.add_argument("logs", nargs="+", help="Input log file(s)")
|
||||
ap.add_argument("--outdir", default="traces", help="Output directory for per-ID trace files")
|
||||
ap.add_argument("--rx-only", action="store_true", help="Keep only RX frames in traces and stats")
|
||||
args = ap.parse_args()
|
||||
|
||||
outdir = Path(args.outdir)
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
writers = {}
|
||||
stats = defaultdict(lambda: {
|
||||
"id_hex": None, "rx":0, "tx":0, "count":0, "first_ts":None, "last_ts":None,
|
||||
"first_file":None, "dlc_set": set()
|
||||
})
|
||||
|
||||
def get_writer(can_id_hex: str, src_name: str):
|
||||
# filename pattern: 0xID_<srcfile>.trace
|
||||
safe_src = Path(src_name).name
|
||||
fn = outdir / f"{can_id_hex}_{safe_src}.trace"
|
||||
if fn not in writers:
|
||||
writers[fn] = fn.open("a", encoding="utf-8")
|
||||
return writers[fn]
|
||||
|
||||
total = 0
|
||||
written = 0
|
||||
for p in args.logs:
|
||||
with open(p, "r", errors="ignore") as f:
|
||||
for line in f:
|
||||
m = LOG_PATTERN.match(line)
|
||||
if not m:
|
||||
continue
|
||||
ts = int(m.group(1))
|
||||
dr = m.group(2)
|
||||
cid_hex = m.group(3).upper()
|
||||
dlc = int(m.group(4))
|
||||
data = m.group(5)
|
||||
|
||||
total += 1
|
||||
if args.rx_only and dr != "RX":
|
||||
continue
|
||||
|
||||
key = int(cid_hex, 16)
|
||||
s = stats[key]
|
||||
s["id_hex"] = f"0x{cid_hex}"
|
||||
s["count"] += 1
|
||||
s["rx"] += 1 if dr == "RX" else 0
|
||||
s["tx"] += 1 if dr == "TX" else 0
|
||||
s["first_ts"] = ts if s["first_ts"] is None else min(s["first_ts"], ts)
|
||||
s["last_ts"] = ts if s["last_ts"] is None else max(s["last_ts"], ts)
|
||||
s["first_file"] = s["first_file"] or Path(p).name
|
||||
s["dlc_set"].add(dlc)
|
||||
|
||||
w = get_writer(f"0x{cid_hex}", Path(p).name)
|
||||
w.write(line)
|
||||
written += 1
|
||||
|
||||
for fh in writers.values():
|
||||
fh.close()
|
||||
|
||||
# build overview CSV
|
||||
import pandas as pd
|
||||
rows = []
|
||||
for cid, s in stats.items():
|
||||
dur_ms = 0 if s["first_ts"] is None else (s["last_ts"] - s["first_ts"])
|
||||
rate_hz = (s["rx"] if args.rx_only else s["count"]) / (dur_ms/1000.0) if dur_ms > 0 else 0.0
|
||||
rows.append({
|
||||
"id_dec": cid,
|
||||
"id_hex": s["id_hex"],
|
||||
"count": s["count"],
|
||||
"rx": s["rx"],
|
||||
"tx": s["tx"],
|
||||
"duration_s": round(dur_ms/1000.0, 6),
|
||||
"rate_hz_est": round(rate_hz, 6),
|
||||
"first_file": s["first_file"],
|
||||
"dlc_variants": ",".join(sorted(str(x) for x in s["dlc_set"])),
|
||||
})
|
||||
df = pd.DataFrame(rows).sort_values(["rate_hz_est","count"], ascending=[False, False])
|
||||
csv_path = outdir / "overview_ids.csv"
|
||||
df.to_csv(csv_path, index=False)
|
||||
|
||||
print(f"Done. Parsed {total} lines, wrote {written} lines into per-ID traces at {outdir}.")
|
||||
print(f"Overview: {csv_path}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
272
Reverse-Engineering CAN-Bus/can_universal_signal_finder.py
Normal file
@@ -0,0 +1,272 @@
|
||||
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple, Optional, Dict
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
LOG_PATTERN = re.compile(r"(\d+)\s+(TX|RX)\s+0x([0-9A-Fa-f]+)\s+\d+\s+((?:[0-9A-Fa-f]{2}\s+)+)")
|
||||
|
||||
def parse_log(path: Path) -> pd.DataFrame:
|
||||
rows = []
|
||||
with open(path, "r", errors="ignore") as f:
|
||||
for line in f:
|
||||
m = LOG_PATTERN.match(line)
|
||||
if not m:
|
||||
continue
|
||||
ts = int(m.group(1))
|
||||
direction = m.group(2)
|
||||
can_id = int(m.group(3), 16)
|
||||
data = [int(x, 16) for x in m.group(4).split() if x.strip()]
|
||||
rows.append((path.name, ts, direction, can_id, data))
|
||||
df = pd.DataFrame(rows, columns=["file","ts","dir","id","data"])
|
||||
if df.empty:
|
||||
return df
|
||||
# time base per file → seconds from file start
|
||||
df["time_s"] = df.groupby("file")["ts"].transform(lambda s: (s - s.min())/1000.0)
|
||||
return df
|
||||
|
||||
def le16(data: List[int], offset: int) -> Optional[int]:
|
||||
if len(data) < offset+2:
|
||||
return None
|
||||
return data[offset] | (data[offset+1] << 8)
|
||||
|
||||
def be16(data: List[int], offset: int) -> Optional[int]:
|
||||
if len(data) < offset+2:
|
||||
return None
|
||||
return (data[offset] << 8) | data[offset+1]
|
||||
|
||||
def phys(val: float, scale: float, offs: float) -> float:
|
||||
return val*scale + offs
|
||||
|
||||
def decode_series(arr_data: List[List[int]], endian: str, offset: int) -> List[Optional[int]]:
|
||||
out = []
|
||||
for d in arr_data:
|
||||
v = le16(d, offset) if endian == "le" else be16(d, offset)
|
||||
out.append(v)
|
||||
return out
|
||||
|
||||
def score_values(vals: np.ndarray) -> Dict[str, float]:
|
||||
if len(vals) < 3:
|
||||
return {"variance":0.0, "changes":0, "unique_ratio":0.0}
|
||||
var = float(np.var(vals))
|
||||
changes = int(np.count_nonzero(np.diff(vals)))
|
||||
unique_ratio = len(set(vals.tolist()))/len(vals)
|
||||
return {"variance":var, "changes":changes, "unique_ratio":unique_ratio}
|
||||
|
||||
def analyze(df: pd.DataFrame, include_ids: Optional[List[int]], exclude_ids: Optional[List[int]]):
|
||||
# Group by ID and try each 16-bit word
|
||||
combos = []
|
||||
ids = sorted(df["id"].unique().tolist())
|
||||
if include_ids:
|
||||
ids = [i for i in ids if i in include_ids]
|
||||
if exclude_ids:
|
||||
ids = [i for i in ids if i not in exclude_ids]
|
||||
|
||||
for cid in ids:
|
||||
grp = df[df["id"]==cid]
|
||||
for endian in ("le","be"):
|
||||
for off in (0,2,4,6):
|
||||
dec = decode_series(grp["data"].tolist(), endian, off)
|
||||
# filter Nones
|
||||
pairs = [(t, v) for t, v in zip(grp["time_s"].tolist(), dec) if v is not None]
|
||||
if len(pairs) < 4:
|
||||
continue
|
||||
times = np.array([p[0] for p in pairs], dtype=float)
|
||||
vals = np.array([p[1] for p in pairs], dtype=float)
|
||||
sc = score_values(vals)
|
||||
combos.append({
|
||||
"id": cid,
|
||||
"endian": endian,
|
||||
"offset": off,
|
||||
"n": len(vals),
|
||||
"variance": sc["variance"],
|
||||
"changes": sc["changes"],
|
||||
"unique_ratio": sc["unique_ratio"],
|
||||
"rate_hz": float(len(vals)) / (times.max()-times.min()+1e-9)
|
||||
})
|
||||
cand_df = pd.DataFrame(combos)
|
||||
return cand_df
|
||||
|
||||
def range_filter_stats(vals: np.ndarray, scale: float, offs: float, rmin: Optional[float], rmax: Optional[float]) -> Dict[str, float]:
|
||||
if vals.size == 0:
|
||||
return {"hit_ratio":0.0, "min_phys":np.nan, "max_phys":np.nan}
|
||||
phys_vals = vals*scale + offs
|
||||
if rmin is None and rmax is None:
|
||||
return {"hit_ratio":1.0, "min_phys":float(np.min(phys_vals)), "max_phys":float(np.max(phys_vals))}
|
||||
mask = np.ones_like(phys_vals, dtype=bool)
|
||||
if rmin is not None:
|
||||
mask &= (phys_vals >= rmin)
|
||||
if rmax is not None:
|
||||
mask &= (phys_vals <= rmax)
|
||||
hit_ratio = float(np.count_nonzero(mask))/len(phys_vals)
|
||||
return {"hit_ratio":hit_ratio, "min_phys":float(np.min(phys_vals)), "max_phys":float(np.max(phys_vals))}
|
||||
|
||||
def export_candidate_timeseries(df: pd.DataFrame, cid: int, endian: str, off: int, scale: float, offs: float, outdir: Path, basename_hint: str):
|
||||
sub = df[df["id"]==cid].copy()
|
||||
if sub.empty:
|
||||
return False, None
|
||||
dec = decode_series(sub["data"].tolist(), endian, off)
|
||||
sub["raw16"] = dec
|
||||
sub = sub.dropna(subset=["raw16"]).copy()
|
||||
if sub.empty:
|
||||
return False, None
|
||||
|
||||
sub["phys"] = sub["raw16"].astype(float)*scale + offs
|
||||
# Save CSV
|
||||
csv_path = outdir / f"{basename_hint}_0x{cid:X}_{endian}_off{off}.csv"
|
||||
sub[["file","time_s","id","raw16","phys"]].to_csv(csv_path, index=False)
|
||||
|
||||
# Plot (single-plot image)
|
||||
plt.figure(figsize=(10,5))
|
||||
plt.plot(sub["time_s"].to_numpy(), sub["phys"].to_numpy(), marker="o")
|
||||
plt.xlabel("Zeit (s)")
|
||||
plt.ylabel("Wert (phys)")
|
||||
plt.title(f"{basename_hint} 0x{cid:X} ({endian} @ +{off})")
|
||||
plt.grid(True)
|
||||
plt.tight_layout()
|
||||
img_path = outdir / f"{basename_hint}_0x{cid:X}_{endian}_off{off}.png"
|
||||
plt.savefig(img_path, dpi=150)
|
||||
plt.close()
|
||||
return True, (csv_path, img_path)
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="Universal CAN signal finder (WheelSpeed etc.) for Kettenöler logs")
|
||||
ap.add_argument("logs", nargs="+", help="Log-Dateien (gleiche Struktur wie Kettenöler)")
|
||||
ap.add_argument("--outdir", default="analyze_out", help="Ausgabeverzeichnis")
|
||||
ap.add_argument("--top", type=int, default=20, help="Top-N Kandidaten global (nach Variance) exportieren, falls Range-Filter nichts findet")
|
||||
ap.add_argument("--include-ids", default="", help="Nur diese IDs (kommagetrennt, z.B. 0x208,0x209)")
|
||||
ap.add_argument("--exclude-ids", default="", help="Diese IDs ausschließen (kommagetrennt)")
|
||||
ap.add_argument("--scale", type=float, default=1.0, help="Skalierung: phys = raw*scale + offset")
|
||||
ap.add_argument("--offset", type=float, default=0.0, help="Offset: phys = raw*scale + offset")
|
||||
ap.add_argument("--range-min", type=float, default=None, help="Min physischer Zielbereich (nach Scale/Offset)")
|
||||
ap.add_argument("--range-max", type=float, default=None, help="Max physischer Zielbereich (nach Scale/Offset)")
|
||||
ap.add_argument("--range-hit-ratio", type=float, default=0.6, help="Mindestanteil der Werte im Zielbereich [0..1]")
|
||||
ap.add_argument("--per-id-limit", type=int, default=2, help="Max Anzahl Dekodierungen pro ID (z.B. beste zwei Offsets/Endianness)")
|
||||
|
||||
args = ap.parse_args()
|
||||
|
||||
# Parse include/exclude lists
|
||||
def parse_ids(s: str):
|
||||
if not s.strip():
|
||||
return None
|
||||
out = []
|
||||
for tok in s.split(","):
|
||||
tok = tok.strip()
|
||||
if not tok:
|
||||
continue
|
||||
if tok.lower().startswith("0x"):
|
||||
out.append(int(tok,16))
|
||||
else:
|
||||
out.append(int(tok))
|
||||
return out
|
||||
|
||||
include_ids = parse_ids(args.include_ids)
|
||||
exclude_ids = parse_ids(args.exclude_ids)
|
||||
|
||||
# Load logs
|
||||
frames = []
|
||||
for p in args.logs:
|
||||
df = parse_log(Path(p))
|
||||
if df.empty:
|
||||
print(f"Warn: {p} ergab keine Daten oder passte nicht zum Muster.", file=sys.stderr)
|
||||
else:
|
||||
frames.append(df)
|
||||
if not frames:
|
||||
print("Keine Daten.", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
df_all = pd.concat(frames, ignore_index=True)
|
||||
outdir = Path(args.outdir)
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Analyze all combos
|
||||
cand = analyze(df_all, include_ids, exclude_ids)
|
||||
if cand.empty:
|
||||
print("Keine dekodierbaren 16-bit Felder gefunden.", file=sys.stderr)
|
||||
sys.exit(3)
|
||||
|
||||
# Range filter pass
|
||||
cand = cand.sort_values(["variance","changes","unique_ratio"], ascending=[False, False, False]).reset_index(drop=True)
|
||||
|
||||
# For each candidate row, compute range-hit stats
|
||||
hits = []
|
||||
for _, row in cand.iterrows():
|
||||
cid = int(row["id"])
|
||||
endian = row["endian"]
|
||||
off = int(row["offset"])
|
||||
|
||||
sub = df_all[df_all["id"]==cid]
|
||||
dec = decode_series(sub["data"].tolist(), endian, off)
|
||||
vals = np.array([v for v in dec if v is not None], dtype=float)
|
||||
if vals.size == 0:
|
||||
continue
|
||||
rng = range_filter_stats(vals, args.scale, args.offset, args.range_min, args.range_max)
|
||||
hits.append((rng["hit_ratio"], rng["min_phys"], rng["max_phys"]))
|
||||
if hits:
|
||||
cand[["hit_ratio","min_phys","max_phys"]] = pd.DataFrame(hits, index=cand.index)
|
||||
else:
|
||||
cand["hit_ratio"] = 0.0
|
||||
cand["min_phys"] = np.nan
|
||||
cand["max_phys"] = np.nan
|
||||
|
||||
# Export global candidate table
|
||||
cand_out = outdir / "candidates_global.csv"
|
||||
cand.to_csv(cand_out, index=False)
|
||||
print(f"Globales Kandidaten-CSV: {cand_out}")
|
||||
|
||||
# Decide which candidates to export as timeseries
|
||||
selected = []
|
||||
if args.range_min is not None or args.range_max is not None:
|
||||
# choose those meeting ratio threshold; group by ID and take best few per ID
|
||||
ok = cand[cand["hit_ratio"] >= args.range_hit_ratio].copy()
|
||||
if ok.empty:
|
||||
print("Range-Filter hat keine Kandidaten gefunden; falle zurück auf Top-N nach Varianz.", file=sys.stderr)
|
||||
else:
|
||||
# per ID, take best by hit_ratio then variance
|
||||
for cid, grp in ok.groupby("id"):
|
||||
grp = grp.sort_values(["hit_ratio","variance","changes","unique_ratio"], ascending=[False, False, False, False])
|
||||
selected.extend(grp.head(args.per_id_limit).to_dict("records"))
|
||||
if not selected:
|
||||
# fallback → global top-N by variance (limit per ID)
|
||||
per_id_count = {}
|
||||
for _, row in cand.iterrows():
|
||||
cid = int(row["id"]); per_id_count.setdefault(cid,0)
|
||||
if len(selected) >= args.top:
|
||||
break
|
||||
if per_id_count[cid] >= args.per_id_limit:
|
||||
continue
|
||||
selected.append(row.to_dict())
|
||||
per_id_count[cid] += 1
|
||||
|
||||
# Export per-candidate CSVs and plots
|
||||
exp_index = []
|
||||
base_hint = "decoded"
|
||||
for row in selected:
|
||||
cid = int(row["id"])
|
||||
endian = row["endian"]
|
||||
off = int(row["offset"])
|
||||
ok, pair = export_candidate_timeseries(df_all, cid, endian, off, args.scale, args.offset, outdir, base_hint)
|
||||
if ok and pair:
|
||||
exp_index.append({
|
||||
"id": cid,
|
||||
"endian": endian,
|
||||
"offset": off,
|
||||
"csv": str(pair[0]),
|
||||
"plot": str(pair[1])
|
||||
})
|
||||
|
||||
idx_df = pd.DataFrame(exp_index)
|
||||
idx_path = outdir / "exports_index.csv"
|
||||
idx_df.to_csv(idx_path, index=False)
|
||||
print(f"Export-Index: {idx_path}")
|
||||
|
||||
print("Fertig. Tipp: Mit --range-min/--range-max und --scale/--offset kannst du auf plausible physikalische Bereiche filtern.")
|
||||
print("Beispiel: --scale 0.01 --range-min 0 --range-max 250 (wenn raw≈cm/s → km/h)")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
142
Reverse-Engineering CAN-Bus/id_signal_explorer.py
Normal file
@@ -0,0 +1,142 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
LOG_PATTERN = re.compile(r"(\d+)\s+(TX|RX)\s+0x([0-9A-Fa-f]+)\s+\d+\s+((?:[0-9A-Fa-f]{2}\s+)+)")
|
||||
|
||||
def parse_trace(path: Path) -> pd.DataFrame:
|
||||
rows = []
|
||||
with open(path, "r", errors="ignore") as f:
|
||||
for line in f:
|
||||
m = LOG_PATTERN.match(line)
|
||||
if not m:
|
||||
continue
|
||||
ts = int(m.group(1))
|
||||
direction = m.group(2)
|
||||
can_id = int(m.group(3), 16)
|
||||
data = [int(x, 16) for x in m.group(4).split() if x.strip()]
|
||||
rows.append((ts, direction, can_id, data))
|
||||
df = pd.DataFrame(rows, columns=["ts","dir","id","data"])
|
||||
if df.empty:
|
||||
return df
|
||||
df["time_s"] = (df["ts"] - df["ts"].min())/1000.0
|
||||
return df
|
||||
|
||||
def be16(b):
|
||||
return (b[0]<<8) | b[1]
|
||||
|
||||
def le16(b):
|
||||
return b[0] | (b[1]<<8)
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="Per-ID explorer: generate plots for 8-bit and 16-bit combinations")
|
||||
ap.add_argument("trace", help="Single-ID .trace file (from can_split_by_id.py)")
|
||||
ap.add_argument("--outdir", default=None, help="Output directory; default: <trace>_explore")
|
||||
ap.add_argument("--prefix", default="viz", help="File prefix for exports")
|
||||
ap.add_argument("--rx-only", action="store_true", help="Use only RX frames")
|
||||
args = ap.parse_args()
|
||||
|
||||
trace = Path(args.trace)
|
||||
df = parse_trace(trace)
|
||||
if df.empty:
|
||||
print("No data in trace.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if args.rx_only:
|
||||
df = df[df["dir"]=="RX"].copy()
|
||||
if df.empty:
|
||||
print("No RX frames.", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
outdir = Path(args.outdir) if args.outdir else trace.with_suffix("").parent / (trace.stem + "_explore")
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# --- 8-bit channels ---
|
||||
for idx in range(8):
|
||||
vals = [d[idx] if len(d)>idx else None for d in df["data"].tolist()]
|
||||
times = [t for t, v in zip(df["time_s"].tolist(), vals) if v is not None]
|
||||
series = [v for v in vals if v is not None]
|
||||
if not series:
|
||||
continue
|
||||
plt.figure(figsize=(10,4))
|
||||
plt.plot(times, series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)")
|
||||
plt.ylabel(f"Byte[{idx}] (8-bit)")
|
||||
plt.title(f"{trace.name} – 8-bit Byte {idx}")
|
||||
plt.grid(True)
|
||||
fn = outdir / f"{args.prefix}_byte{idx}.png"
|
||||
plt.tight_layout()
|
||||
plt.savefig(fn, dpi=150)
|
||||
plt.close()
|
||||
|
||||
# --- 16-bit combos ---
|
||||
pairs = [(i,i+1) for i in range(7)]
|
||||
# LE
|
||||
for i,j in pairs:
|
||||
times, series = [], []
|
||||
for t, d in zip(df["time_s"].tolist(), df["data"].tolist()):
|
||||
if len(d) > j:
|
||||
series.append(le16([d[i], d[j]])); times.append(t)
|
||||
if not series:
|
||||
continue
|
||||
plt.figure(figsize=(10,4))
|
||||
plt.plot(times, series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)")
|
||||
plt.ylabel(f"LE16 @{i}-{j}")
|
||||
plt.title(f"{trace.name} – LE16 Bytes {i}-{j}")
|
||||
plt.grid(True)
|
||||
fn = outdir / f"{args.prefix}_le16_{i}-{j}.png"
|
||||
plt.tight_layout()
|
||||
plt.savefig(fn, dpi=150)
|
||||
plt.close()
|
||||
|
||||
# BE
|
||||
for i,j in pairs:
|
||||
times, series = [], []
|
||||
for t, d in zip(df["time_s"].tolist(), df["data"].tolist()):
|
||||
if len(d) > j:
|
||||
series.append(be16([d[i], d[j]])); times.append(t)
|
||||
if not series:
|
||||
continue
|
||||
plt.figure(figsize=(10,4))
|
||||
plt.plot(times, series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)")
|
||||
plt.ylabel(f"BE16 @{i}-{j}")
|
||||
plt.title(f"{trace.name} – BE16 Bytes {i}-{j}")
|
||||
plt.grid(True)
|
||||
fn = outdir / f"{args.prefix}_be16_{i}-{j}.png"
|
||||
plt.tight_layout()
|
||||
plt.savefig(fn, dpi=150)
|
||||
plt.close()
|
||||
|
||||
# Summary stats
|
||||
stats = []
|
||||
# 8-bit stats
|
||||
for idx in range(8):
|
||||
vals = [d[idx] if len(d)>idx else None for d in df["data"].tolist()]
|
||||
vals = [v for v in vals if v is not None]
|
||||
if not vals:
|
||||
continue
|
||||
arr = np.array(vals, dtype=float)
|
||||
stats.append({"type":"byte8", "slot":idx, "min":float(arr.min()), "max":float(arr.max()), "var":float(arr.var())})
|
||||
# 16-bit stats
|
||||
for i,j in pairs:
|
||||
vals = [le16([d[i],d[j]]) for d in df["data"].tolist() if len(d)>j]
|
||||
if vals:
|
||||
arr = np.array(vals, dtype=float)
|
||||
stats.append({"type":"le16", "slot":f"{i}-{j}", "min":float(arr.min()), "max":float(arr.max()), "var":float(arr.var())})
|
||||
vals = [be16([d[i],d[j]]) for d in df["data"].tolist() if len(d)>j]
|
||||
if vals:
|
||||
arr = np.array(vals, dtype=float)
|
||||
stats.append({"type":"be16", "slot":f"{i}-{j}", "min":float(arr.min()), "max":float(arr.max()), "var":float(arr.var())})
|
||||
|
||||
pd.DataFrame(stats).to_csv(outdir / "summary_stats.csv", index=False)
|
||||
print(f"Exported 8-bit & 16-bit plots and summary_stats.csv to {outdir}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
973
Reverse-Engineering CAN-Bus/main.py
Normal file
@@ -0,0 +1,973 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import subprocess
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import tkinter as tk
|
||||
from tkinter import ttk, filedialog, messagebox
|
||||
import tempfile
|
||||
|
||||
SCRIPT_NAME = "can_universal_signal_finder.py"
|
||||
SPLIT_SCRIPT = "can_split_by_id.py"
|
||||
EXPLORE_SCRIPT = "id_signal_explorer.py"
|
||||
TRACE_BATCH = "trace_batch_analyzer.py"
|
||||
RANGE_FITTER = "trace_signal_fitter.py"
|
||||
|
||||
LOG_PATTERNS = ("*.log", "*.txt")
|
||||
TRACE_PATTERNS = ("*.trace",)
|
||||
|
||||
|
||||
# ---------------- helpers ----------------
|
||||
def now_stamp():
|
||||
return datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
|
||||
|
||||
def find_logs(root: Path, rel_logs_dir: str):
|
||||
base = (root / rel_logs_dir) if rel_logs_dir else root
|
||||
found = []
|
||||
if not base.exists():
|
||||
return found
|
||||
for pat in LOG_PATTERNS:
|
||||
found += [str(p) for p in base.glob(pat)]
|
||||
found += [str(p) for p in base.rglob(pat)] # include subdirs
|
||||
return sorted(set(found))
|
||||
|
||||
|
||||
def find_traces(base: Path):
|
||||
"""Liste .trace im Basisordner und eine Ebene tiefer."""
|
||||
files = []
|
||||
if not base.exists():
|
||||
return files
|
||||
for pat in TRACE_PATTERNS:
|
||||
files += [str(p) for p in base.glob(pat)]
|
||||
files += [str(p) for p in base.glob(f"*/*{pat[1:]}")] # eine Ebene tiefer
|
||||
return sorted(set(files))
|
||||
|
||||
|
||||
def ensure_dir(p: Path):
|
||||
p.mkdir(parents=True, exist_ok=True)
|
||||
return p
|
||||
|
||||
|
||||
def latest_subdir(base: Path) -> Path:
|
||||
"""Neuester Unterordner in base, sonst base selbst."""
|
||||
if not base.exists():
|
||||
return base
|
||||
subs = [p for p in base.iterdir() if p.is_dir()]
|
||||
if not subs:
|
||||
return base
|
||||
return max(subs, key=lambda p: p.stat().st_mtime)
|
||||
|
||||
|
||||
# ---------------- shared app state ----------------
|
||||
class AppState:
|
||||
def __init__(self):
|
||||
# core paths
|
||||
self.workdir = tk.StringVar(value="")
|
||||
self.logs_dir = tk.StringVar(value="logs")
|
||||
self.traces_dir = tk.StringVar(value="traces")
|
||||
self.analyze_out_base = tk.StringVar(value="analyze_out")
|
||||
|
||||
# discovered logs
|
||||
self.available_logs = [] # absolute paths
|
||||
self.selected_log_indices = [] # indices in header listbox
|
||||
|
||||
# project defaults
|
||||
self.timestamp_runs = tk.BooleanVar(value=True)
|
||||
|
||||
# shared traces directory + file list
|
||||
self.traces_current_dir = tk.StringVar(value="") # absoluter Pfad zum aktuell angezeigten Traces-Ordner
|
||||
self.traces_files = [] # Liste der .trace in current_dir (inkl. eine Ebene tiefer)
|
||||
self._trace_observers = [] # callbacks, die Liste aktualisieren
|
||||
|
||||
# hook: wenn der Pfad geändert wird, scannen
|
||||
self.traces_current_dir.trace_add("write", self._on_traces_dir_changed)
|
||||
|
||||
# --- path helpers ---
|
||||
def workdir_path(self) -> Path:
|
||||
wd = self.workdir.get().strip() or "."
|
||||
return Path(wd)
|
||||
|
||||
def logs_base_path(self) -> Path:
|
||||
return self.workdir_path() / (self.logs_dir.get().strip() or "logs")
|
||||
|
||||
def traces_base_path(self) -> Path:
|
||||
return self.workdir_path() / (self.traces_dir.get().strip() or "traces")
|
||||
|
||||
def analyze_out_root(self) -> Path:
|
||||
return self.workdir_path() / (self.analyze_out_base.get().strip() or "analyze_out")
|
||||
|
||||
# --- traces state ---
|
||||
def add_trace_observer(self, cb):
|
||||
if cb not in self._trace_observers:
|
||||
self._trace_observers.append(cb)
|
||||
|
||||
def _notify_trace_observers(self):
|
||||
for cb in list(self._trace_observers):
|
||||
try:
|
||||
cb(self.traces_files)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _on_traces_dir_changed(self, *_):
|
||||
base = Path(self.traces_current_dir.get().strip() or str(self.traces_base_path()))
|
||||
self.traces_files = find_traces(base)
|
||||
self._notify_trace_observers()
|
||||
|
||||
def set_traces_dir(self, path: str):
|
||||
self.traces_current_dir.set(path) # löst automatisch scan + notify aus
|
||||
|
||||
def refresh_traces(self):
|
||||
# retrigger write to force refresh
|
||||
self._on_traces_dir_changed()
|
||||
|
||||
def set_traces_to_default_or_latest(self):
|
||||
base = self.traces_base_path()
|
||||
target = latest_subdir(base)
|
||||
self.set_traces_dir(str(target))
|
||||
|
||||
|
||||
# ---------------- header (workdir + logs selection) ----------------
|
||||
class Header(ttk.Frame):
|
||||
def __init__(self, master, state: AppState):
|
||||
super().__init__(master, padding=8)
|
||||
self.state = state
|
||||
self._build_ui()
|
||||
|
||||
def _build_ui(self):
|
||||
self.columnconfigure(1, weight=1)
|
||||
self.columnconfigure(3, weight=1)
|
||||
# row 0: workdir + scan
|
||||
ttk.Label(self, text="Workdir:").grid(row=0, column=0, sticky="w")
|
||||
self.ent_workdir = ttk.Entry(self, textvariable=self.state.workdir)
|
||||
self.ent_workdir.grid(row=0, column=1, sticky="ew", padx=6)
|
||||
ttk.Button(self, text="Wählen…", command=self.pick_workdir).grid(row=0, column=2, padx=5)
|
||||
ttk.Button(self, text="Logs scannen", command=self.scan_logs).grid(row=0, column=3, padx=5)
|
||||
|
||||
# row 1: subfolders + timestamp checkbox
|
||||
ttk.Label(self, text="Logs-Unterordner:").grid(row=1, column=0, sticky="w")
|
||||
ttk.Entry(self, textvariable=self.state.logs_dir, width=24).grid(row=1, column=1, sticky="w", padx=6)
|
||||
|
||||
ttk.Label(self, text="Traces-Unterordner:").grid(row=1, column=2, sticky="w")
|
||||
ttk.Entry(self, textvariable=self.state.traces_dir, width=24).grid(row=1, column=3, sticky="w", padx=6)
|
||||
|
||||
ttk.Label(self, text="Analyze-Output:").grid(row=2, column=0, sticky="w")
|
||||
ttk.Entry(self, textvariable=self.state.analyze_out_base, width=24).grid(row=2, column=1, sticky="w", padx=6)
|
||||
ttk.Checkbutton(self, text="Zeitstempel-Unterordner pro Run", variable=self.state.timestamp_runs).grid(row=2, column=2, columnspan=2, sticky="w")
|
||||
|
||||
# row 3: logs list
|
||||
frm = ttk.LabelFrame(self, text="Gefundene Logdateien (Mehrfachauswahl möglich)")
|
||||
frm.grid(row=3, column=0, columnspan=4, sticky="nsew", pady=(8,0))
|
||||
self.rowconfigure(3, weight=1)
|
||||
frm.columnconfigure(0, weight=1)
|
||||
frm.rowconfigure(0, weight=1)
|
||||
|
||||
self.lst_logs = tk.Listbox(frm, height=6, selectmode=tk.EXTENDED)
|
||||
self.lst_logs.grid(row=0, column=0, sticky="nsew", padx=(8,4), pady=8)
|
||||
|
||||
btns = ttk.Frame(frm)
|
||||
btns.grid(row=0, column=1, sticky="ns", padx=(4,8), pady=8)
|
||||
ttk.Button(btns, text="Alle wählen", command=self.select_all).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Keine", command=self.select_none).pack(fill="x", pady=2)
|
||||
ttk.Separator(btns, orient="horizontal").pack(fill="x", pady=6)
|
||||
ttk.Button(btns, text="Manuell hinzufügen…", command=self.add_logs_manual).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Entfernen", command=self.remove_selected_logs).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Liste leeren", command=self.clear_logs).pack(fill="x", pady=2)
|
||||
ttk.Separator(btns, orient="horizontal").pack(fill="x", pady=6)
|
||||
ttk.Button(btns, text="Projekt speichern…", command=self.save_project).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Projekt laden…", command=self.load_project).pack(fill="x", pady=2)
|
||||
|
||||
# ---- actions ----
|
||||
def pick_workdir(self):
|
||||
d = filedialog.askdirectory(title="Workdir auswählen")
|
||||
if d:
|
||||
self.state.workdir.set(d)
|
||||
self.scan_logs()
|
||||
# automatisch auch traces default/latest setzen
|
||||
self.state.set_traces_to_default_or_latest()
|
||||
|
||||
def scan_logs(self):
|
||||
wd = self.state.workdir_path()
|
||||
logs_dir = self.state.logs_dir.get().strip()
|
||||
found = find_logs(wd, logs_dir)
|
||||
self.state.available_logs = found
|
||||
self.lst_logs.delete(0, tk.END)
|
||||
for p in found:
|
||||
self.lst_logs.insert(tk.END, p)
|
||||
# default-select all
|
||||
self.lst_logs.select_set(0, tk.END)
|
||||
self.state.selected_log_indices = list(range(len(found)))
|
||||
|
||||
def select_all(self):
|
||||
self.lst_logs.select_set(0, tk.END)
|
||||
self.state.selected_log_indices = list(range(self.lst_logs.size()))
|
||||
|
||||
def select_none(self):
|
||||
self.lst_logs.select_clear(0, tk.END)
|
||||
self.state.selected_log_indices = []
|
||||
|
||||
def add_logs_manual(self):
|
||||
paths = filedialog.askopenfilenames(title="Logdateien auswählen", filetypes=[("Logfiles","*.log *.txt"),("Alle Dateien","*.*")])
|
||||
if not paths: return
|
||||
for p in paths:
|
||||
if p not in self.state.available_logs:
|
||||
self.state.available_logs.append(p)
|
||||
self.lst_logs.insert(tk.END, p)
|
||||
# if workdir empty, infer from first added
|
||||
if not self.state.workdir.get().strip():
|
||||
self.state.workdir.set(str(Path(paths[0]).resolve().parent))
|
||||
# auch traces default/latest
|
||||
self.state.set_traces_to_default_or_latest()
|
||||
|
||||
def remove_selected_logs(self):
|
||||
sel = list(self.lst_logs.curselection())
|
||||
sel.reverse()
|
||||
for i in sel:
|
||||
p = self.lst_logs.get(i)
|
||||
if p in self.state.available_logs:
|
||||
self.state.available_logs.remove(p)
|
||||
self.lst_logs.delete(i)
|
||||
self.state.selected_log_indices = [i for i in range(self.lst_logs.size()) if self.lst_logs.select_includes(i)]
|
||||
|
||||
def clear_logs(self):
|
||||
self.state.available_logs = []
|
||||
self.lst_logs.delete(0, tk.END)
|
||||
self.state.selected_log_indices = []
|
||||
|
||||
def selected_logs(self):
|
||||
idx = self.lst_logs.curselection()
|
||||
if not idx:
|
||||
return []
|
||||
return [self.lst_logs.get(i) for i in idx]
|
||||
|
||||
# ---- project save/load ----
|
||||
def collect_project(self):
|
||||
return {
|
||||
"workdir": self.state.workdir.get(),
|
||||
"logs_dir": self.state.logs_dir.get(),
|
||||
"traces_dir": self.state.traces_dir.get(),
|
||||
"analyze_out_base": self.state.analyze_out_base.get(),
|
||||
"timestamp_runs": bool(self.state.timestamp_runs.get()),
|
||||
"available_logs": self.state.available_logs,
|
||||
"selected_indices": list(self.lst_logs.curselection()),
|
||||
"traces_current_dir": self.state.traces_current_dir.get(),
|
||||
}
|
||||
|
||||
def apply_project(self, cfg):
|
||||
self.state.workdir.set(cfg.get("workdir",""))
|
||||
self.state.logs_dir.set(cfg.get("logs_dir","logs"))
|
||||
self.state.traces_dir.set(cfg.get("traces_dir","traces"))
|
||||
self.state.analyze_out_base.set(cfg.get("analyze_out_base","analyze_out"))
|
||||
self.state.timestamp_runs.set(cfg.get("timestamp_runs", True))
|
||||
# restore logs
|
||||
self.scan_logs()
|
||||
# If project contained explicit available_logs, merge
|
||||
for p in cfg.get("available_logs", []):
|
||||
if p not in self.state.available_logs:
|
||||
self.state.available_logs.append(p)
|
||||
self.lst_logs.insert(tk.END, p)
|
||||
# re-select indices if valid
|
||||
self.lst_logs.select_clear(0, tk.END)
|
||||
for i in cfg.get("selected_indices", []):
|
||||
if 0 <= i < self.lst_logs.size():
|
||||
self.lst_logs.select_set(i)
|
||||
# traces current dir: sofern vorhanden nutzen, sonst default/latest
|
||||
tdir = cfg.get("traces_current_dir", "")
|
||||
if tdir and Path(tdir).exists():
|
||||
self.state.set_traces_dir(tdir)
|
||||
else:
|
||||
self.state.set_traces_to_default_or_latest()
|
||||
|
||||
def save_project(self):
|
||||
cfg = self.collect_project()
|
||||
path = filedialog.asksaveasfilename(title="Projekt speichern", defaultextension=".json", filetypes=[("Projektdatei","*.json")])
|
||||
if not path: return
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(cfg, f, indent=2)
|
||||
messagebox.showinfo("Gespeichert", f"Projekt gespeichert:\n{path}")
|
||||
|
||||
def load_project(self):
|
||||
path = filedialog.askopenfilename(title="Projekt laden", filetypes=[("Projektdatei","*.json"),("Alle Dateien","*.*")])
|
||||
if not path: return
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
cfg = json.load(f)
|
||||
self.apply_project(cfg)
|
||||
messagebox.showinfo("Geladen", f"Projekt geladen:\n{path}")
|
||||
|
||||
|
||||
# ---------------- shared Trace Panel ----------------
|
||||
class TracePanel(ttk.LabelFrame):
|
||||
"""
|
||||
Einheitliche Trace-Auswahl: Liste links, Buttons rechts.
|
||||
Nutzt AppState.traces_current_dir + AppState.traces_files.
|
||||
single_select=True => Listbox SINGLE, versteckt 'Alle/Keine'.
|
||||
"""
|
||||
def __init__(self, master, state: AppState, title="Traces", single_select=False, height=10):
|
||||
super().__init__(master, text=title)
|
||||
self.state = state
|
||||
self.single_select = single_select
|
||||
self.height = height
|
||||
self._build_ui()
|
||||
# subscribe to state updates
|
||||
self.state.add_trace_observer(self._on_traces_updated)
|
||||
# initial fill from state
|
||||
self._on_traces_updated(self.state.traces_files)
|
||||
|
||||
def _build_ui(self):
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(0, weight=1)
|
||||
|
||||
selectmode = tk.SINGLE if self.single_select else tk.EXTENDED
|
||||
self.lst = tk.Listbox(self, height=self.height, selectmode=selectmode)
|
||||
self.lst.grid(row=0, column=0, sticky="nsew", padx=(8,4), pady=8)
|
||||
|
||||
btns = ttk.Frame(self)
|
||||
btns.grid(row=0, column=1, sticky="ns", padx=(4,8), pady=8)
|
||||
|
||||
ttk.Button(btns, text="Traces-Ordner wählen…", command=self._pick_traces_dir).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Workdir/traces", command=self._use_default_traces).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Neuester Split", command=self._use_latest_split).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Refresh", command=self._refresh_traces).pack(fill="x", pady=6)
|
||||
if not self.single_select:
|
||||
ttk.Button(btns, text="Alle wählen", command=lambda: self.lst.select_set(0, tk.END)).pack(fill="x", pady=2)
|
||||
ttk.Button(btns, text="Keine", command=lambda: self.lst.select_clear(0, tk.END)).pack(fill="x", pady=2)
|
||||
|
||||
# --- state sync ---
|
||||
def _on_traces_updated(self, files):
|
||||
# refresh list content
|
||||
cur_sel_paths = self.get_selected()
|
||||
self.lst.delete(0, tk.END)
|
||||
for p in files:
|
||||
self.lst.insert(tk.END, p)
|
||||
# try to restore selection
|
||||
if cur_sel_paths:
|
||||
path_to_index = {self.lst.get(i): i for i in range(self.lst.size())}
|
||||
for p in cur_sel_paths:
|
||||
if p in path_to_index:
|
||||
self.lst.select_set(path_to_index[p])
|
||||
|
||||
def _pick_traces_dir(self):
|
||||
d = filedialog.askdirectory(title="Traces-Ordner wählen", initialdir=str(self.state.traces_base_path()))
|
||||
if d:
|
||||
self.state.set_traces_dir(d)
|
||||
|
||||
def _use_default_traces(self):
|
||||
# default or latest under Workdir/traces
|
||||
self.state.set_traces_to_default_or_latest()
|
||||
|
||||
def _use_latest_split(self):
|
||||
base = self.state.traces_base_path()
|
||||
target = latest_subdir(base)
|
||||
self.state.set_traces_dir(str(target))
|
||||
|
||||
def _refresh_traces(self):
|
||||
self.state.refresh_traces()
|
||||
|
||||
def get_selected(self):
|
||||
idx = self.lst.curselection()
|
||||
return [self.lst.get(i) for i in idx]
|
||||
|
||||
|
||||
# ---------------- Tab 1: Multi-Log Analyse (ranking optional) ----------------
|
||||
class TabAnalyze(ttk.Frame):
|
||||
def __init__(self, master, state: AppState, header: Header):
|
||||
super().__init__(master, padding=10)
|
||||
self.state = state
|
||||
self.header = header
|
||||
self._build_ui()
|
||||
|
||||
def _build_ui(self):
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(2, weight=1)
|
||||
|
||||
# params
|
||||
params = ttk.LabelFrame(self, text="Analyse-Parameter")
|
||||
params.grid(row=0, column=0, sticky="nsew", padx=5, pady=5)
|
||||
for c in (1,3):
|
||||
params.columnconfigure(c, weight=1)
|
||||
|
||||
ttk.Label(params, text="Include-IDs (z.B. 0x208,0x209):").grid(row=0, column=0, sticky="w")
|
||||
self.include_var = tk.StringVar(value="")
|
||||
ttk.Entry(params, textvariable=self.include_var).grid(row=0, column=1, sticky="ew", padx=5)
|
||||
|
||||
ttk.Label(params, text="Exclude-IDs:").grid(row=0, column=2, sticky="w")
|
||||
self.exclude_var = tk.StringVar(value="")
|
||||
ttk.Entry(params, textvariable=self.exclude_var).grid(row=0, column=3, sticky="ew", padx=5)
|
||||
|
||||
ttk.Label(params, text="Scale:").grid(row=1, column=0, sticky="w")
|
||||
self.scale_var = tk.DoubleVar(value=1.0)
|
||||
ttk.Entry(params, textvariable=self.scale_var, width=12).grid(row=1, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(params, text="Offset:").grid(row=1, column=2, sticky="w")
|
||||
self.offset_var = tk.DoubleVar(value=0.0)
|
||||
ttk.Entry(params, textvariable=self.offset_var, width=12).grid(row=1, column=3, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(params, text="Range-Min:").grid(row=2, column=0, sticky="w")
|
||||
self.rmin_var = tk.StringVar(value="")
|
||||
ttk.Entry(params, textvariable=self.rmin_var, width=12).grid(row=2, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(params, text="Range-Max:").grid(row=2, column=2, sticky="w")
|
||||
self.rmax_var = tk.StringVar(value="")
|
||||
ttk.Entry(params, textvariable=self.rmax_var, width=12).grid(row=2, column=3, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(params, text="Range-Hit-Ratio (0..1):").grid(row=3, column=0, sticky="w")
|
||||
self.hit_ratio_var = tk.DoubleVar(value=0.6)
|
||||
ttk.Entry(params, textvariable=self.hit_ratio_var, width=12).grid(row=3, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(params, text="Top-N (Fallback):").grid(row=3, column=2, sticky="w")
|
||||
self.top_var = tk.IntVar(value=20)
|
||||
ttk.Entry(params, textvariable=self.top_var, width=12).grid(row=3, column=3, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(params, text="Per-ID-Limit:").grid(row=4, column=0, sticky="w")
|
||||
self.per_id_limit_var = tk.IntVar(value=2)
|
||||
ttk.Entry(params, textvariable=self.per_id_limit_var, width=12).grid(row=4, column=1, sticky="w", padx=5)
|
||||
|
||||
self.run_separately_var = tk.BooleanVar(value=False)
|
||||
ttk.Checkbutton(params, text="Jede Logdatei separat laufen lassen", variable=self.run_separately_var).grid(row=4, column=2, columnspan=2, sticky="w", padx=5)
|
||||
|
||||
# run + console
|
||||
run = ttk.Frame(self)
|
||||
run.grid(row=1, column=0, sticky="ew", padx=5, pady=5)
|
||||
ttk.Button(run, text="Analyse starten (Ranking)", command=self.on_run).pack(side="left", padx=5)
|
||||
|
||||
out = ttk.LabelFrame(self, text="Ausgabe")
|
||||
out.grid(row=2, column=0, sticky="nsew", padx=5, pady=5)
|
||||
out.columnconfigure(0, weight=1); out.rowconfigure(0, weight=1)
|
||||
self.txt = tk.Text(out, height=12); self.txt.grid(row=0, column=0, sticky="nsew")
|
||||
sb = ttk.Scrollbar(out, orient="vertical", command=self.txt.yview); sb.grid(row=0, column=1, sticky="ns")
|
||||
self.txt.configure(yscrollcommand=sb.set)
|
||||
|
||||
def on_run(self):
|
||||
logs = self.header.selected_logs()
|
||||
if not logs:
|
||||
messagebox.showwarning("Hinweis", "Bitte oben im Header Logdateien auswählen.")
|
||||
return
|
||||
t = threading.Thread(target=self._run_worker, args=(logs,), daemon=True)
|
||||
self.txt.delete("1.0", tk.END)
|
||||
self._append("Starte Analyse…\n")
|
||||
t.start()
|
||||
|
||||
def _run_worker(self, logs):
|
||||
script_path = Path(__file__).parent / SCRIPT_NAME
|
||||
if not script_path.exists():
|
||||
self._append(f"[Fehler] Script nicht gefunden: {script_path}\n"); return
|
||||
|
||||
# output root: workdir/analyze_out/<ts>_multilog
|
||||
out_root = self.state.analyze_out_root()
|
||||
stamp = now_stamp() + "_multilog"
|
||||
outdir = ensure_dir(out_root / stamp)
|
||||
|
||||
def build_args():
|
||||
args = [sys.executable, str(script_path)]
|
||||
if self.include_var.get().strip():
|
||||
args += ["--include-ids", self.include_var.get().strip()]
|
||||
if self.exclude_var.get().strip():
|
||||
args += ["--exclude-ids", self.exclude_var.get().strip()]
|
||||
args += ["--scale", str(self.scale_var.get()), "--offset", str(self.offset_var.get())]
|
||||
if self.rmin_var.get().strip(): args += ["--range-min", self.rmin_var.get().strip()]
|
||||
if self.rmax_var.get().strip(): args += ["--range-max", self.rmax_var.get().strip()]
|
||||
args += ["--range-hit-ratio", str(self.hit_ratio_var.get())]
|
||||
args += ["--top", str(self.top_var.get()), "--per-id-limit", str(self.per_id_limit_var.get())]
|
||||
return args
|
||||
|
||||
if self.run_separately_var.get():
|
||||
for p in logs:
|
||||
sub = ensure_dir(outdir / Path(p).stem)
|
||||
cmd = build_args() + ["--outdir", str(sub), p]
|
||||
self._run_cmd(cmd)
|
||||
else:
|
||||
cmd = build_args() + ["--outdir", str(outdir)] + logs
|
||||
self._run_cmd(cmd)
|
||||
|
||||
self._append(f"\nDone. Output: {outdir}\n")
|
||||
|
||||
def _run_cmd(self, cmd):
|
||||
self._append(f"\n>>> RUN: {' '.join(cmd)}\n")
|
||||
try:
|
||||
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as proc:
|
||||
for line in proc.stdout: self._append(line)
|
||||
rc = proc.wait()
|
||||
if rc != 0: self._append(f"[Exit-Code {rc}]\n")
|
||||
except Exception as e:
|
||||
self._append(f"[Fehler] {e}\n")
|
||||
|
||||
def _append(self, s): self.txt.insert(tk.END, s); self.txt.see(tk.END)
|
||||
|
||||
|
||||
# ---------------- Tab 2: ID Explorer (split + single-ID analyze) ----------------
|
||||
class TabExplorer(ttk.Frame):
|
||||
def __init__(self, master, state: AppState, header: Header):
|
||||
super().__init__(master, padding=10)
|
||||
self.state = state
|
||||
self.header = header
|
||||
self._build_ui()
|
||||
|
||||
def _build_ui(self):
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(3, weight=1)
|
||||
|
||||
# split controls
|
||||
frm_split = ttk.LabelFrame(self, text="Split: Logs → per-ID Traces")
|
||||
frm_split.grid(row=0, column=0, sticky="ew", padx=5, pady=5)
|
||||
frm_split.columnconfigure(1, weight=1)
|
||||
|
||||
self.rx_only_var = tk.BooleanVar(value=False)
|
||||
self.ts_split_var = tk.BooleanVar(value=True)
|
||||
|
||||
ttk.Label(frm_split, text="Ziel (Workdir/traces[/timestamp])").grid(row=0, column=0, sticky="w", padx=5)
|
||||
ttk.Label(frm_split, textvariable=self.state.traces_dir).grid(row=0, column=1, sticky="w")
|
||||
ttk.Checkbutton(frm_split, text="nur RX", variable=self.rx_only_var).grid(row=1, column=0, sticky="w", padx=5)
|
||||
ttk.Checkbutton(frm_split, text="Zeitstempel-Unterordner", variable=self.ts_split_var).grid(row=1, column=1, sticky="w", padx=5)
|
||||
ttk.Button(frm_split, text="Split starten", command=self.on_split).grid(row=1, column=2, sticky="e", padx=5)
|
||||
|
||||
# unified trace panel (multi-select)
|
||||
self.trace_panel = TracePanel(self, self.state, title="Traces im ausgewählten Ordner", single_select=False, height=10)
|
||||
self.trace_panel.grid(row=1, column=0, sticky="nsew", padx=5, pady=(8,10))
|
||||
|
||||
# single-ID analyze
|
||||
frm_one = ttk.LabelFrame(self, text="Einzel-ID Analyse (Plots + summary_stats)")
|
||||
frm_one.grid(row=2, column=0, sticky="nsew", padx=5, pady=5)
|
||||
frm_one.columnconfigure(1, weight=1)
|
||||
ttk.Label(frm_one, text="Output-Basis (unter Workdir/analyze_out):").grid(row=0, column=0, sticky="w")
|
||||
self.one_out_base = tk.StringVar(value="id_explore")
|
||||
ttk.Entry(frm_one, textvariable=self.one_out_base).grid(row=0, column=1, sticky="ew", padx=5)
|
||||
self.ts_one = tk.BooleanVar(value=True)
|
||||
ttk.Checkbutton(frm_one, text="Zeitstempel-Unterordner", variable=self.ts_one).grid(row=0, column=2, sticky="w", padx=5)
|
||||
ttk.Button(frm_one, text="Analyse starten", command=self.on_one_analyze).grid(row=0, column=3, sticky="e", padx=5)
|
||||
|
||||
# console
|
||||
out = ttk.LabelFrame(self, text="Ausgabe")
|
||||
out.grid(row=3, column=0, sticky="nsew", padx=5, pady=5)
|
||||
out.columnconfigure(0, weight=1); out.rowconfigure(0, weight=1)
|
||||
self.txt = tk.Text(out, height=12); self.txt.grid(row=0, column=0, sticky="nsew")
|
||||
sb = ttk.Scrollbar(out, orient="vertical", command=self.txt.yview); sb.grid(row=0, column=1, sticky="ns")
|
||||
self.txt.configure(yscrollcommand=sb.set)
|
||||
|
||||
def on_split(self):
|
||||
logs = self.header.selected_logs()
|
||||
if not logs:
|
||||
messagebox.showwarning("Hinweis", "Bitte oben im Header Logdateien auswählen."); return
|
||||
outdir = self.state.traces_base_path()
|
||||
if self.ts_split_var.get(): outdir = outdir / now_stamp()
|
||||
ensure_dir(outdir)
|
||||
cmd = [sys.executable, str(Path(__file__).parent / SPLIT_SCRIPT), "--outdir", str(outdir)]
|
||||
if self.rx_only_var.get(): cmd.append("--rx-only")
|
||||
cmd += logs
|
||||
self._run_cmd(cmd)
|
||||
# nach dem Split: globalen Traces-Ordner setzen (neuester Ordner)
|
||||
self.state.set_traces_dir(str(outdir))
|
||||
|
||||
def on_one_analyze(self):
|
||||
sel = self.trace_panel.get_selected()
|
||||
if not sel:
|
||||
messagebox.showwarning("Hinweis", "Bitte mindestens eine .trace auswählen."); return
|
||||
out_root = self.state.analyze_out_root()
|
||||
stamp = now_stamp() + "_id_explore" if self.ts_one.get() else "id_explore"
|
||||
outdir = ensure_dir(out_root / stamp)
|
||||
for trace in sel:
|
||||
cmd = [sys.executable, str(Path(__file__).parent / EXPLORE_SCRIPT), "--outdir", str(outdir), trace]
|
||||
self._run_cmd(cmd)
|
||||
self._append(f"\nDone. Output: {outdir}\n")
|
||||
|
||||
def _run_cmd(self, cmd):
|
||||
self._append(f"\n>>> RUN: {' '.join(cmd)}\n")
|
||||
try:
|
||||
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as proc:
|
||||
for line in proc.stdout: self._append(line)
|
||||
rc = proc.wait()
|
||||
if rc != 0: self._append(f"[Exit-Code {rc}]\n")
|
||||
except Exception as e:
|
||||
self._append(f"[Fehler] {e}\n")
|
||||
|
||||
def _append(self, s): self.txt.insert(tk.END, s); self.txt.see(tk.END)
|
||||
|
||||
|
||||
# ---------------- Tab 3: Traces Batch-Analyse ----------------
|
||||
class TabTraceBatch(ttk.Frame):
|
||||
def __init__(self, master, state: AppState, header: Header):
|
||||
super().__init__(master, padding=10)
|
||||
self.state = state
|
||||
self.header = header
|
||||
self._build_ui()
|
||||
|
||||
def _build_ui(self):
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(2, weight=1)
|
||||
|
||||
# unified trace panel (multi-select)
|
||||
self.trace_panel = TracePanel(self, self.state, title="Traces (Ordner/Subset wählen)", single_select=False, height=10)
|
||||
self.trace_panel.grid(row=0, column=0, sticky="nsew", padx=5, pady=(5,10))
|
||||
|
||||
# Params
|
||||
pr = ttk.LabelFrame(self, text="Analyse-Parameter")
|
||||
pr.grid(row=1, column=0, sticky="nsew", padx=5, pady=5)
|
||||
for c in (1,3):
|
||||
pr.columnconfigure(c, weight=1)
|
||||
|
||||
self.rx_only = tk.BooleanVar(value=False)
|
||||
ttk.Checkbutton(pr, text="nur RX", variable=self.rx_only).grid(row=0, column=0, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(pr, text="Scale").grid(row=0, column=1, sticky="e")
|
||||
self.scale = tk.DoubleVar(value=1.0)
|
||||
ttk.Entry(pr, textvariable=self.scale, width=12).grid(row=0, column=2, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(pr, text="Offset").grid(row=0, column=3, sticky="e")
|
||||
self.offset = tk.DoubleVar(value=0.0)
|
||||
ttk.Entry(pr, textvariable=self.offset, width=12).grid(row=0, column=4, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(pr, text="Range-Min").grid(row=1, column=1, sticky="e")
|
||||
self.rmin = tk.StringVar(value="")
|
||||
ttk.Entry(pr, textvariable=self.rmin, width=12).grid(row=1, column=2, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(pr, text="Range-Max").grid(row=1, column=3, sticky="e")
|
||||
self.rmax = tk.StringVar(value="")
|
||||
ttk.Entry(pr, textvariable=self.rmax, width=12).grid(row=1, column=4, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(pr, text="Top pro Trace").grid(row=2, column=1, sticky="e")
|
||||
self.top = tk.IntVar(value=8)
|
||||
ttk.Entry(pr, textvariable=self.top, width=12).grid(row=2, column=2, sticky="w", padx=5)
|
||||
|
||||
self.use_ts = tk.BooleanVar(value=True)
|
||||
ttk.Checkbutton(pr, text="Zeitstempel-Unterordner", variable=self.use_ts).grid(row=2, column=3, sticky="w", padx=5)
|
||||
|
||||
# Run & console
|
||||
run = ttk.Frame(self)
|
||||
run.grid(row=3, column=0, sticky="ew", padx=5, pady=5)
|
||||
ttk.Button(run, text="Batch starten", command=self.on_run).pack(side="left", padx=5)
|
||||
|
||||
out = ttk.LabelFrame(self, text="Ausgabe")
|
||||
out.grid(row=4, column=0, sticky="nsew", padx=5, pady=5)
|
||||
out.columnconfigure(0, weight=1); out.rowconfigure(0, weight=1)
|
||||
self.txt = tk.Text(out, height=12); self.txt.grid(row=0, column=0, sticky="nsew")
|
||||
sb = ttk.Scrollbar(out, orient="vertical", command=self.txt.yview); sb.grid(row=0, column=1, sticky="ns")
|
||||
self.txt.configure(yscrollcommand=sb.set)
|
||||
|
||||
def on_run(self):
|
||||
# nutze Auswahl oder – falls leer – kompletten Ordner
|
||||
selected = self.trace_panel.get_selected()
|
||||
traces_dir = Path(self.state.traces_current_dir.get().strip() or str(self.state.traces_base_path()))
|
||||
if not traces_dir.exists():
|
||||
messagebox.showwarning("Hinweis", "Bitte gültigen Traces-Ordner wählen."); return
|
||||
|
||||
out_root = self.state.analyze_out_root()
|
||||
label = "trace_batch"
|
||||
stamp = now_stamp() + "_" + label if self.use_ts.get() else label
|
||||
outdir = ensure_dir(out_root / stamp)
|
||||
|
||||
# falls Auswahl getroffen wurde, temporären Subset-Ordner bauen
|
||||
subset_dir = None
|
||||
if selected:
|
||||
subset_dir = ensure_dir(outdir / "_subset")
|
||||
for p in selected:
|
||||
src = Path(p)
|
||||
dst = subset_dir / src.name
|
||||
try:
|
||||
# versuchen Hardlink (schnell, platzsparend)
|
||||
if dst.exists():
|
||||
dst.unlink()
|
||||
os.link(src, dst)
|
||||
except Exception:
|
||||
# Fallback: Kopieren
|
||||
shutil.copy2(src, dst)
|
||||
|
||||
run_dir = subset_dir if subset_dir else traces_dir
|
||||
|
||||
cmd = [sys.executable, str(Path(__file__).parent/TRACE_BATCH),
|
||||
"--traces-dir", str(run_dir), "--outdir", str(outdir),
|
||||
"--scale", str(self.scale.get()), "--offset", str(self.offset.get()),
|
||||
"--top", str(self.top.get()), "--plots"]
|
||||
if self.rmin.get().strip(): cmd += ["--range-min", self.rmin.get().strip()]
|
||||
if self.rmax.get().strip(): cmd += ["--range-max", self.rmax.get().strip()]
|
||||
if self.rx_only.get(): cmd.append("--rx-only")
|
||||
|
||||
self._run_cmd(cmd)
|
||||
self._append(f"\nDone. Output: {outdir}\n")
|
||||
|
||||
def _run_cmd(self, cmd):
|
||||
self._append(f"\n>>> RUN: {' '.join(cmd)}\n")
|
||||
try:
|
||||
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as proc:
|
||||
for line in proc.stdout: self._append(line)
|
||||
rc = proc.wait()
|
||||
if rc != 0: self._append(f"[Exit-Code {rc}]\n")
|
||||
except Exception as e:
|
||||
self._append(f"[Fehler] {e}\n")
|
||||
|
||||
def _append(self, s): self.txt.insert(tk.END, s); self.txt.see(tk.END)
|
||||
|
||||
# ---------------- Tab 4: Range-Fit (supervised + unsupervised, mit Physik-Constraints) ----------------
|
||||
class TabRangeFit(ttk.Frame):
|
||||
def __init__(self, master, state: AppState, header: Header):
|
||||
super().__init__(master, padding=10)
|
||||
self.state = state
|
||||
self.header = header
|
||||
self._last_outdir = None
|
||||
self._build_ui()
|
||||
|
||||
def _build_ui(self):
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(3, weight=1)
|
||||
|
||||
# unified trace panel (single-select)
|
||||
self.trace_panel = TracePanel(self, self.state, title="Trace wählen (Single)", single_select=True, height=10)
|
||||
self.trace_panel.grid(row=0, column=0, sticky="nsew", padx=5, pady=(5,10))
|
||||
|
||||
# Parameter Frames
|
||||
frm_params = ttk.Frame(self)
|
||||
frm_params.grid(row=1, column=0, sticky="nsew", padx=5, pady=5)
|
||||
for c in range(6):
|
||||
frm_params.columnconfigure(c, weight=1)
|
||||
|
||||
# --- Supervised (Range & Physik) ---
|
||||
box_sup = ttk.LabelFrame(frm_params, text="Supervised (Range-Fit) – lasse leer für Unsupervised")
|
||||
box_sup.grid(row=0, column=0, columnspan=6, sticky="nsew", padx=5, pady=5)
|
||||
for c in range(6):
|
||||
box_sup.columnconfigure(c, weight=1)
|
||||
|
||||
ttk.Label(box_sup, text="Range-Min").grid(row=0, column=0, sticky="e")
|
||||
self.rmin = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.rmin, width=12).grid(row=0, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Range-Max").grid(row=0, column=2, sticky="e")
|
||||
self.rmax = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.rmax, width=12).grid(row=0, column=3, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Min. Hit-Ratio (0..1)").grid(row=0, column=4, sticky="e")
|
||||
self.min_hit = tk.DoubleVar(value=0.5)
|
||||
ttk.Entry(box_sup, textvariable=self.min_hit, width=10).grid(row=0, column=5, sticky="w", padx=5)
|
||||
|
||||
self.allow_neg = tk.BooleanVar(value=False)
|
||||
ttk.Checkbutton(box_sup, text="negative Scale erlauben", variable=self.allow_neg).grid(row=1, column=0, columnspan=2, sticky="w")
|
||||
|
||||
ttk.Label(box_sup, text="Rate-Min (Hz)").grid(row=1, column=2, sticky="e")
|
||||
self.rate_min = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.rate_min, width=10).grid(row=1, column=3, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Rate-Max (Hz)").grid(row=1, column=4, sticky="e")
|
||||
self.rate_max = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.rate_max, width=10).grid(row=1, column=5, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Jitter-Max (ms)").grid(row=2, column=0, sticky="e")
|
||||
self.jitter_max = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.jitter_max, width=10).grid(row=2, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Max-Slope-Abs (phys/s)").grid(row=2, column=2, sticky="e")
|
||||
self.slope_abs = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.slope_abs, width=12).grid(row=2, column=3, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Max-Slope-Frac (/s)").grid(row=2, column=4, sticky="e")
|
||||
self.slope_frac = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.slope_frac, width=12).grid(row=2, column=5, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Slope-Quantile").grid(row=3, column=0, sticky="e")
|
||||
self.slope_q = tk.DoubleVar(value=0.95) # 0.95 oder 0.99
|
||||
ttk.Entry(box_sup, textvariable=self.slope_q, width=10).grid(row=3, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_sup, text="Min-Unique-Ratio").grid(row=3, column=2, sticky="e")
|
||||
self.min_uniq = tk.StringVar(value="")
|
||||
ttk.Entry(box_sup, textvariable=self.min_uniq, width=10).grid(row=3, column=3, sticky="w", padx=5)
|
||||
|
||||
# --- Unsupervised ---
|
||||
box_uns = ttk.LabelFrame(frm_params, text="Unsupervised (ohne Range)")
|
||||
box_uns.grid(row=1, column=0, columnspan=6, sticky="nsew", padx=5, pady=5)
|
||||
for c in range(6):
|
||||
box_uns.columnconfigure(c, weight=1)
|
||||
|
||||
ttk.Label(box_uns, text="Min. Smoothness (0..1)").grid(row=0, column=0, sticky="e")
|
||||
self.min_smooth = tk.DoubleVar(value=0.2)
|
||||
ttk.Entry(box_uns, textvariable=self.min_smooth, width=12).grid(row=0, column=1, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_uns, text="Max-Slope-Frac-RAW (/s)").grid(row=0, column=2, sticky="e")
|
||||
self.max_slope_frac_raw = tk.StringVar(value="")
|
||||
ttk.Entry(box_uns, textvariable=self.max_slope_frac_raw, width=12).grid(row=0, column=3, sticky="w", padx=5)
|
||||
|
||||
# --- Allgemein/Output ---
|
||||
box_out = ttk.LabelFrame(frm_params, text="Allgemein & Output")
|
||||
box_out.grid(row=2, column=0, columnspan=6, sticky="nsew", padx=5, pady=5)
|
||||
for c in range(6):
|
||||
box_out.columnconfigure(c, weight=1)
|
||||
|
||||
self.rx_only = tk.BooleanVar(value=False)
|
||||
ttk.Checkbutton(box_out, text="nur RX", variable=self.rx_only).grid(row=0, column=0, sticky="w")
|
||||
|
||||
ttk.Label(box_out, text="Plots Top-N").grid(row=0, column=1, sticky="e")
|
||||
self.plots_top = tk.IntVar(value=8)
|
||||
ttk.Entry(box_out, textvariable=self.plots_top, width=10).grid(row=0, column=2, sticky="w", padx=5)
|
||||
|
||||
ttk.Label(box_out, text="Output-Label").grid(row=0, column=3, sticky="e")
|
||||
self.out_label = tk.StringVar(value="rangefit")
|
||||
ttk.Entry(box_out, textvariable=self.out_label, width=18).grid(row=0, column=4, sticky="w", padx=5)
|
||||
|
||||
self.use_ts = tk.BooleanVar(value=True)
|
||||
ttk.Checkbutton(box_out, text="Zeitstempel-Unterordner", variable=self.use_ts).grid(row=0, column=5, sticky="w")
|
||||
|
||||
# Start + Konsole + Aktionen
|
||||
frm_run = ttk.Frame(self)
|
||||
frm_run.grid(row=2, column=0, sticky="ew", padx=5, pady=5)
|
||||
ttk.Button(frm_run, text="Start Range-/Unsupervised-Fit", command=self._on_run).pack(side="left", padx=5)
|
||||
ttk.Button(frm_run, text="Report öffnen", command=self._open_last_report).pack(side="left", padx=5)
|
||||
ttk.Button(frm_run, text="Output-Ordner öffnen", command=self._open_last_outdir).pack(side="left", padx=5)
|
||||
|
||||
frm_out = ttk.LabelFrame(self, text="Ausgabe")
|
||||
frm_out.grid(row=3, column=0, sticky="nsew", padx=5, pady=5)
|
||||
frm_out.columnconfigure(0, weight=1); frm_out.rowconfigure(0, weight=1)
|
||||
self.txt = tk.Text(frm_out, height=14); self.txt.grid(row=0, column=0, sticky="nsew")
|
||||
sbo = ttk.Scrollbar(frm_out, orient="vertical", command=self.txt.yview); sbo.grid(row=0, column=1, sticky="ns")
|
||||
self.txt.configure(yscrollcommand=sbo.set)
|
||||
|
||||
# --- helpers ---
|
||||
def _append(self, s):
|
||||
self.txt.insert(tk.END, s); self.txt.see(tk.END)
|
||||
|
||||
def _stamp(self):
|
||||
import datetime as _dt
|
||||
return _dt.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
|
||||
def _build_outdir(self, supervised: bool) -> Path:
|
||||
out_root = self.state.analyze_out_root()
|
||||
label = (self.out_label.get().strip() or ("rangefit" if supervised else "unsupervised"))
|
||||
stamp = f"{self._stamp()}_{label}" if self.use_ts.get() else label
|
||||
outdir = out_root / stamp
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
self._last_outdir = outdir
|
||||
return outdir
|
||||
|
||||
def _selected_trace(self):
|
||||
sel = self.trace_panel.get_selected()
|
||||
if not sel:
|
||||
messagebox.showwarning("Hinweis", "Bitte genau eine .trace-Datei auswählen.")
|
||||
return None
|
||||
if len(sel) != 1:
|
||||
messagebox.showwarning("Hinweis", "Range-Fit benötigt genau eine .trace-Datei (Single-Select).")
|
||||
return None
|
||||
return sel[0]
|
||||
|
||||
def _maybe(self, val: str, flag: str, args: list):
|
||||
v = (val or "").strip()
|
||||
if v != "":
|
||||
args += [flag, v]
|
||||
|
||||
def _open_path(self, p: Path):
|
||||
try:
|
||||
if sys.platform.startswith("darwin"):
|
||||
subprocess.Popen(["open", str(p)])
|
||||
elif os.name == "nt":
|
||||
os.startfile(str(p)) # type: ignore
|
||||
else:
|
||||
subprocess.Popen(["xdg-open", str(p)])
|
||||
except Exception as e:
|
||||
messagebox.showwarning("Fehler", f"Konnte nicht öffnen:\n{p}\n{e}")
|
||||
|
||||
def _open_last_outdir(self):
|
||||
if self._last_outdir and self._last_outdir.exists():
|
||||
self._open_path(self._last_outdir)
|
||||
else:
|
||||
messagebox.showinfo("Hinweis", "Noch kein Output-Ordner vorhanden.")
|
||||
|
||||
def _open_last_report(self):
|
||||
if not (self._last_outdir and self._last_outdir.exists()):
|
||||
messagebox.showinfo("Hinweis", "Noch kein Report erzeugt.")
|
||||
return
|
||||
# versuche ein *_report.md im letzten Outdir zu finden
|
||||
md = list(Path(self._last_outdir).glob("*_report.md"))
|
||||
if not md:
|
||||
messagebox.showinfo("Hinweis", "Kein Report gefunden.")
|
||||
return
|
||||
self._open_path(md[0])
|
||||
|
||||
def _on_run(self):
|
||||
trace = self._selected_trace()
|
||||
if not trace:
|
||||
return
|
||||
|
||||
# supervised?
|
||||
rmin = self.rmin.get().strip()
|
||||
rmax = self.rmax.get().strip()
|
||||
supervised = bool(rmin) and bool(rmax)
|
||||
|
||||
outdir = self._build_outdir(supervised)
|
||||
|
||||
cmd = [
|
||||
sys.executable,
|
||||
str(Path(__file__).parent / RANGE_FITTER),
|
||||
trace,
|
||||
"--outdir", str(outdir),
|
||||
"--plots-top", str(self.plots_top.get()),
|
||||
]
|
||||
if self.rx_only.get():
|
||||
cmd.append("--rx-only")
|
||||
|
||||
if supervised:
|
||||
cmd += ["--rmin", rmin, "--rmax", rmax, "--min-hit", str(self.min_hit.get())]
|
||||
if self.allow_neg.get():
|
||||
cmd.append("--allow-neg-scale")
|
||||
self._maybe(self.rate_min.get(), "--rate-min", cmd)
|
||||
self._maybe(self.rate_max.get(), "--rate-max", cmd)
|
||||
self._maybe(self.jitter_max.get(), "--jitter-max-ms", cmd)
|
||||
self._maybe(self.slope_abs.get(), "--max-slope-abs", cmd)
|
||||
self._maybe(self.slope_frac.get(), "--max-slope-frac", cmd)
|
||||
cmd += ["--slope-quantile", str(self.slope_q.get())]
|
||||
self._maybe(self.min_uniq.get(), "--min-uniq-ratio", cmd)
|
||||
else:
|
||||
# unsupervised
|
||||
cmd += ["--min-smooth", str(self.min_smooth.get())]
|
||||
self._maybe(self.max_slope_frac_raw.get(), "--max-slope-frac-raw", cmd)
|
||||
cmd += ["--slope-quantile", str(self.slope_q.get())] # wird intern für p95/p99 gewählt
|
||||
|
||||
self._append(f"\n>>> RUN: {' '.join(cmd)}\n")
|
||||
t = threading.Thread(target=self._run_cmd, args=(cmd,), daemon=True)
|
||||
t.start()
|
||||
|
||||
def _run_cmd(self, cmd):
|
||||
try:
|
||||
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) as proc:
|
||||
for line in proc.stdout:
|
||||
self._append(line)
|
||||
rc = proc.wait()
|
||||
if rc != 0:
|
||||
self._append(f"[Exit-Code {rc}]\n")
|
||||
else:
|
||||
self._append(f"\nDone. Output: {self._last_outdir}\n")
|
||||
except Exception as e:
|
||||
self._append(f"[Fehler] {e}\n")
|
||||
|
||||
# ---------------- App Shell ----------------
|
||||
class App(tk.Tk):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.title("CAN Universal Signal Finder – GUI")
|
||||
self.geometry("1180x860")
|
||||
self.configure(padx=8, pady=8)
|
||||
|
||||
# shared state
|
||||
self.state = AppState()
|
||||
|
||||
# header (always visible)
|
||||
self.header = Header(self, self.state)
|
||||
self.header.pack(fill="x", side="top")
|
||||
|
||||
# Tabs
|
||||
nb = ttk.Notebook(self)
|
||||
nb.pack(fill="both", expand=True)
|
||||
|
||||
self.tab_analyze = TabAnalyze(nb, self.state, self.header)
|
||||
self.tab_explorer = TabExplorer(nb, self.state, self.header)
|
||||
self.tab_batch = TabTraceBatch(nb, self.state, self.header)
|
||||
self.tab_rangefit = TabRangeFit(nb, self.state, self.header)
|
||||
|
||||
nb.add(self.tab_analyze, text="Multi-Log Analyse")
|
||||
nb.add(self.tab_explorer, text="ID Explorer")
|
||||
nb.add(self.tab_batch, text="Traces Batch-Analyse")
|
||||
nb.add(self.tab_rangefit, text="Range-Fit")
|
||||
|
||||
# init: traces auf default/latest stellen
|
||||
self.state.set_traces_to_default_or_latest()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = App()
|
||||
app.mainloop()
|
18
Reverse-Engineering CAN-Bus/models/.gitignore
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Ignoriere in JEDEM unmittelbaren Unterordner von models/
|
||||
# die Verzeichnisse "traces" und "analyze_out"
|
||||
*/traces/
|
||||
*/traces/**
|
||||
*/analyze_out/
|
||||
*/analyze_out/**
|
||||
|
||||
# Falls jemand versehentlich direkt unter models/ solche Ordner anlegt, auch ignorieren:
|
||||
traces/
|
||||
traces/**
|
||||
analyze_out/
|
||||
analyze_out/**
|
||||
|
||||
# (Optional, falls du dich mal vertippst)
|
||||
*/analyze.out/
|
||||
*/analyze.out/**
|
||||
analyze.out/
|
||||
analyze.out/**
|
@@ -0,0 +1,12 @@
|
||||
|
||||
possible CAN Ids !? (from Forum somwhere)
|
||||
Message ID:
|
||||
|
||||
0x540 - byte 0 - bits 6...4 - Gear Position - 0 = N, 1-6 = gears 1-6
|
||||
bit 1 - Neutral Light - 1 = on, 0 = off
|
||||
bit 2 - Check engine light????
|
||||
0x550 - byte 0 - bits 2...0 - Coolant bars on dashboard
|
||||
- bit 3 - Warning light - 1 = on, 0 = off
|
||||
0x570 - bytes 2-3 - Coolant temp - (256 * byte 3 + byte 2) / 10 = Temp in Degrees C
|
||||
0x518 - Possible revs - divide by 4
|
||||
0x519 - Similar to 0x518 Possibly TPS unsure. Doesn't actuate when only tps is rotated.
|
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"workdir": "models/Triumph Speed Twin 1200 RS (2025)",
|
||||
"logs_dir": "logs",
|
||||
"traces_dir": "traces",
|
||||
"analyze_out_base": "analyze_out",
|
||||
"timestamp_runs": true,
|
||||
"available_logs": [
|
||||
"models/Triumph Speed Twin 1200 RS (2025)/logs/cantrace-raw-2025-08-27T17-45-27-980Z-1.log"
|
||||
],
|
||||
"selected_indices": [
|
||||
0
|
||||
]
|
||||
}
|
3
Reverse-Engineering CAN-Bus/requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
pandas>=2.0.0
|
||||
numpy>=1.24.0
|
||||
matplotlib>=3.7.0
|
18
Reverse-Engineering CAN-Bus/start.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Choose python (allow override with $PYTHON)
|
||||
PYTHON_BIN="${PYTHON:-python3}"
|
||||
VENV_DIR=".venv"
|
||||
|
||||
if [ ! -d "$VENV_DIR" ]; then
|
||||
"$PYTHON_BIN" -m venv "$VENV_DIR"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$VENV_DIR/bin/activate"
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
exec python main.py "$@"
|
186
Reverse-Engineering CAN-Bus/trace_batch_analyzer.py
Normal file
@@ -0,0 +1,186 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
LOG_PATTERN = re.compile(r"(\d+)\s+(TX|RX)\s+0x([0-9A-Fa-f]+)\s+\d+\s+((?:[0-9A-Fa-f]{2}\s+)+)")
|
||||
|
||||
def parse_trace(path: Path, rx_only=False) -> pd.DataFrame:
|
||||
rows = []
|
||||
with open(path, "r", errors="ignore") as f:
|
||||
for line in f:
|
||||
m = LOG_PATTERN.match(line)
|
||||
if not m:
|
||||
continue
|
||||
ts = int(m.group(1))
|
||||
dr = m.group(2)
|
||||
if rx_only and dr != "RX":
|
||||
continue
|
||||
cid = int(m.group(3), 16)
|
||||
data = [int(x, 16) for x in m.group(4).split() if x.strip()]
|
||||
rows.append((ts, dr, cid, data))
|
||||
df = pd.DataFrame(rows, columns=["ts","dir","id","data"])
|
||||
if df.empty:
|
||||
return df
|
||||
df["time_s"] = (df["ts"] - df["ts"].min())/1000.0
|
||||
return df
|
||||
|
||||
def be16(a,b): return (a<<8)|b
|
||||
def le16(a,b): return a | (b<<8)
|
||||
|
||||
def analyze_one_trace(df: pd.DataFrame, scale=1.0, offs=0.0, rmin=None, rmax=None):
|
||||
"""Return stats for all 8-bit bytes and all adjacent 16-bit pairs (LE/BE)."""
|
||||
stats = []
|
||||
# 8-bit
|
||||
for i in range(8):
|
||||
vals = [d[i] for d in df["data"] if len(d)>i]
|
||||
if not vals: continue
|
||||
arr = np.array(vals, dtype=float)
|
||||
phys = arr*scale + offs
|
||||
hit = np.ones_like(phys, dtype=bool)
|
||||
if rmin is not None: hit &= (phys>=rmin)
|
||||
if rmax is not None: hit &= (phys<=rmax)
|
||||
stats.append({
|
||||
"type":"byte8","slot":str(i),
|
||||
"n":len(arr),
|
||||
"min":float(arr.min()),"max":float(arr.max()),"var":float(arr.var()),
|
||||
"hit_ratio": float(np.count_nonzero(hit))/len(hit) if len(hit)>0 else 0.0,
|
||||
"min_phys": float(phys.min()), "max_phys": float(phys.max())
|
||||
})
|
||||
# 16-bit
|
||||
pairs = [(i,i+1) for i in range(7)]
|
||||
for i,j in pairs:
|
||||
# LE
|
||||
vals = [le16(d[i],d[j]) for d in df["data"] if len(d)>j]
|
||||
if vals:
|
||||
arr = np.array(vals, dtype=float); phys = arr*scale + offs
|
||||
hit = np.ones_like(phys, dtype=bool)
|
||||
if rmin is not None: hit &= (phys>=rmin)
|
||||
if rmax is not None: hit &= (phys<=rmax)
|
||||
stats.append({
|
||||
"type":"le16","slot":f"{i}-{j}",
|
||||
"n":len(arr),
|
||||
"min":float(arr.min()),"max":float(arr.max()),"var":float(arr.var()),
|
||||
"hit_ratio": float(np.count_nonzero(hit))/len(hit) if len(hit)>0 else 0.0,
|
||||
"min_phys": float(phys.min()), "max_phys": float(phys.max())
|
||||
})
|
||||
# BE
|
||||
vals = [be16(d[i],d[j]) for d in df["data"] if len(d)>j]
|
||||
if vals:
|
||||
arr = np.array(vals, dtype=float); phys = arr*scale + offs
|
||||
hit = np.ones_like(phys, dtype=bool)
|
||||
if rmin is not None: hit &= (phys>=rmin)
|
||||
if rmax is not None: hit &= (phys<=rmax)
|
||||
stats.append({
|
||||
"type":"be16","slot":f"{i}-{j}",
|
||||
"n":len(arr),
|
||||
"min":float(arr.min()),"max":float(arr.max()),"var":float(arr.var()),
|
||||
"hit_ratio": float(np.count_nonzero(hit))/len(hit) if len(hit)>0 else 0.0,
|
||||
"min_phys": float(phys.min()), "max_phys": float(phys.max())
|
||||
})
|
||||
return pd.DataFrame(stats)
|
||||
|
||||
def plot_one_trace(df: pd.DataFrame, outdir: Path, prefix: str):
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
# 8-bit plots
|
||||
for i in range(8):
|
||||
times, series = [], []
|
||||
for t,d in zip(df["time_s"], df["data"]):
|
||||
if len(d)>i:
|
||||
times.append(t); series.append(d[i])
|
||||
if not series: continue
|
||||
import matplotlib.pyplot as plt
|
||||
plt.figure(figsize=(10,4))
|
||||
plt.plot(times, series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)"); plt.ylabel(f"Byte[{i}] (8-bit)")
|
||||
plt.title(f"{prefix} – 8-bit Byte {i}")
|
||||
plt.grid(True); plt.tight_layout()
|
||||
plt.savefig(outdir / f"{prefix}_byte{i}.png", dpi=150); plt.close()
|
||||
# 16-bit plots (LE/BE)
|
||||
pairs = [(i,i+1) for i in range(7)]
|
||||
for i,j in pairs:
|
||||
times, series = [], []
|
||||
for t,d in zip(df["time_s"], df["data"]):
|
||||
if len(d)>j: times.append(t); series.append(le16(d[i],d[j]))
|
||||
if series:
|
||||
import matplotlib.pyplot as plt
|
||||
plt.figure(figsize=(10,4))
|
||||
plt.plot(times, series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)"); plt.ylabel(f"LE16 @{i}-{j}")
|
||||
plt.title(f"{prefix} – LE16 {i}-{j}")
|
||||
plt.grid(True); plt.tight_layout()
|
||||
plt.savefig(outdir / f"{prefix}_le16_{i}-{j}.png", dpi=150); plt.close()
|
||||
times, series = [], []
|
||||
for t,d in zip(df["time_s"], df["data"]):
|
||||
if len(d)>j: times.append(t); series.append(be16(d[i],d[j]))
|
||||
if series:
|
||||
import matplotlib.pyplot as plt
|
||||
plt.figure(figsize=(10,4))
|
||||
plt.plot(times, series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)"); plt.ylabel(f"BE16 @{i}-{j}")
|
||||
plt.title(f"{prefix} – BE16 {i}-{j}")
|
||||
plt.grid(True); plt.tight_layout()
|
||||
plt.savefig(outdir / f"{prefix}_be16_{i}-{j}.png", dpi=150); plt.close()
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="Batch analyze per-ID traces and rank 8/16-bit combinations")
|
||||
ap.add_argument("--traces-dir", required=True, help="Directory containing *.trace files")
|
||||
ap.add_argument("--outdir", required=True, help="Output directory for analysis results")
|
||||
ap.add_argument("--rx-only", action="store_true", help="Use RX frames only")
|
||||
ap.add_argument("--plots", action="store_true", help="Also generate plots for each trace")
|
||||
ap.add_argument("--scale", type=float, default=1.0, help="phys = raw*scale + offset")
|
||||
ap.add_argument("--offset", type=float, default=0.0, help="phys = raw*scale + offset")
|
||||
ap.add_argument("--range-min", type=float, default=None, help="physical min (after scale/offset)")
|
||||
ap.add_argument("--range-max", type=float, default=None, help="physical max (after scale/offset)")
|
||||
ap.add_argument("--top", type=int, default=8, help="Export top combos per trace to summary")
|
||||
args = ap.parse_args()
|
||||
|
||||
tdir = Path(args.traces_dir)
|
||||
outdir = Path(args.outdir); outdir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
traces = sorted([p for p in tdir.glob("*.trace")])
|
||||
if not traces:
|
||||
print("No .trace files found.", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
global_rows = []
|
||||
for tr in traces:
|
||||
df = parse_trace(tr, rx_only=args.rx_only)
|
||||
if df.empty:
|
||||
continue
|
||||
stats = analyze_one_trace(df, args.scale, args.offset, args.range_min, args.range_max)
|
||||
# Ranking: primarily by hit_ratio (if range given), else by variance; break ties by var then n
|
||||
if args.range_min is not None or args.range_max is not None:
|
||||
stats = stats.sort_values(["hit_ratio","var","n"], ascending=[False, False, False])
|
||||
else:
|
||||
stats = stats.sort_values(["var","n"], ascending=[False, False])
|
||||
# write per-trace csv
|
||||
per_csv = outdir / f"{tr.stem}_combostats.csv"
|
||||
stats.to_csv(per_csv, index=False)
|
||||
|
||||
# append top rows with trace id hint
|
||||
stem = tr.stem # e.g., 0x208_log1
|
||||
for _, row in stats.head(args.top).iterrows():
|
||||
r = row.to_dict()
|
||||
r["trace"] = stem
|
||||
global_rows.append(r)
|
||||
|
||||
# plots (optional) into a subdir per trace
|
||||
if args.plots:
|
||||
plot_dir = outdir / f"{tr.stem}_plots"
|
||||
plot_one_trace(df, plot_dir, prefix=tr.stem)
|
||||
|
||||
# global summary
|
||||
if global_rows:
|
||||
gdf = pd.DataFrame(global_rows)
|
||||
gdf.to_csv(outdir / "summary_top_combinations.csv", index=False)
|
||||
print(f"Global summary written: {outdir/'summary_top_combinations.csv'}")
|
||||
|
||||
print(f"Processed {len(traces)} trace files. Results at: {outdir}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
660
Reverse-Engineering CAN-Bus/trace_signal_fitter.py
Normal file
@@ -0,0 +1,660 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
trace_signal_fitter.py – Advanced Range-/Unsupervised-Fit mit Physik-Constraints & Bericht
|
||||
|
||||
Modi:
|
||||
1) Range-Fit (supervised): --rmin/--rmax gesetzt → finde scale & offset, maximiere Hit-Ratio in [rmin, rmax].
|
||||
2) Unsupervised: ohne Range → plausible Rohsignale nach Smoothness/Var/Rate/Span.
|
||||
|
||||
Neu:
|
||||
- Periodizität: Rate (Hz), Jitter (std der Inter-Arrival-Times), CV.
|
||||
- Slew-Rate: p95/p99 von |Δ|/s (supervised in phys-Einheit, unsupervised normiert auf Roh-Span).
|
||||
- Grenzwerte als Argumente (--rate-min/max, --jitter-max-ms, --max-slope-abs, --max-slope-frac, ...).
|
||||
- Zusätzlich signed 16-bit Varianten (le16s/be16s).
|
||||
- JSON + Markdown-Bericht pro Trace mit PASS/FAIL und Begründungen.
|
||||
|
||||
Logformat (Kettenöler):
|
||||
<timestamp_ms> <TX|RX> 0x<ID_HEX> <DLC> <byte0> <byte1> ... <byte7>
|
||||
|
||||
Outputs:
|
||||
- supervised: <trace>_encoding_candidates.csv, Plots, <trace>_report.md, <trace>_report.json
|
||||
- unsupervised: <trace>_unsupervised_candidates.csv, Plots, <trace>_report.md, <trace>_report.json
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import json
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple, Dict, Iterable
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
# ---------- Parsing ----------
|
||||
|
||||
def parse_trace(path: Path, rx_only: bool = False) -> pd.DataFrame:
|
||||
"""
|
||||
Robustes Parsen des Kettenöler-Formats:
|
||||
<ts_ms> <TX|RX> 0x<ID> <DLC> <b0> <b1> ... (hex)
|
||||
"""
|
||||
rows = []
|
||||
with open(path, "r", errors="ignore") as f:
|
||||
for line in f:
|
||||
parts = line.strip().split()
|
||||
if len(parts) < 4:
|
||||
continue
|
||||
try:
|
||||
ts = int(parts[0])
|
||||
dr = parts[1]
|
||||
if rx_only and dr != "RX":
|
||||
continue
|
||||
cid = int(parts[2], 16) if parts[2].lower().startswith("0x") else int(parts[2], 16)
|
||||
dlc = int(parts[3])
|
||||
bytes_hex = parts[4:4+dlc] if dlc > 0 else []
|
||||
data = []
|
||||
for b in bytes_hex:
|
||||
try:
|
||||
data.append(int(b, 16))
|
||||
except Exception:
|
||||
data.append(0)
|
||||
rows.append((ts, dr, cid, data))
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
df = pd.DataFrame(rows, columns=["ts", "dir", "id", "data"])
|
||||
if df.empty:
|
||||
return df
|
||||
df["time_s"] = (df["ts"] - df["ts"].min()) / 1000.0
|
||||
return df
|
||||
|
||||
|
||||
# ---------- Helpers ----------
|
||||
|
||||
def be16(a: int, b: int) -> int: return (a << 8) | b
|
||||
def le16(a: int, b: int) -> int: return a | (b << 8)
|
||||
def s16(u: int) -> int: return u if u < 0x8000 else u - 0x10000
|
||||
|
||||
def p_quant_abs_diff(arr: np.ndarray, q: float) -> float:
|
||||
if arr.size < 2:
|
||||
return 0.0
|
||||
d = np.abs(np.diff(arr))
|
||||
return float(np.percentile(d, q * 100))
|
||||
|
||||
def p_quant(arr: np.ndarray, q: float) -> float:
|
||||
if arr.size == 0:
|
||||
return 0.0
|
||||
return float(np.percentile(arr, q * 100))
|
||||
|
||||
def interarrival_metrics(times: np.ndarray) -> Dict[str, float]:
|
||||
if times.size < 2:
|
||||
return {"rate_hz": 0.0, "period_mean": 0.0, "period_std": 0.0, "jitter_cv": 0.0, "n": int(times.size)}
|
||||
dt = np.diff(times)
|
||||
period_mean = float(np.mean(dt))
|
||||
period_std = float(np.std(dt))
|
||||
rate_hz = 1.0 / period_mean if period_mean > 0 else 0.0
|
||||
jitter_cv = (period_std / period_mean) if period_mean > 0 else 0.0
|
||||
return {"rate_hz": rate_hz, "period_mean": period_mean, "period_std": period_std, "jitter_cv": jitter_cv, "n": int(times.size)}
|
||||
|
||||
def slope_metrics(values: np.ndarray, times: np.ndarray) -> Dict[str, float]:
|
||||
if values.size < 2:
|
||||
return {"slope_p95": 0.0, "slope_p99": 0.0, "jerk_p95": 0.0}
|
||||
dv = np.abs(np.diff(values))
|
||||
dt = np.diff(times)
|
||||
# vermeide Division durch 0
|
||||
dt = np.where(dt <= 0, np.nan, dt)
|
||||
slope = dv / dt
|
||||
slope = slope[~np.isnan(slope)]
|
||||
if slope.size == 0:
|
||||
return {"slope_p95": 0.0, "slope_p99": 0.0, "jerk_p95": 0.0}
|
||||
jerk = np.abs(np.diff(slope))
|
||||
return {
|
||||
"slope_p95": float(np.percentile(slope, 95)),
|
||||
"slope_p99": float(np.percentile(slope, 99)),
|
||||
"jerk_p95": float(np.percentile(jerk, 95)) if jerk.size > 0 else 0.0,
|
||||
}
|
||||
|
||||
def prefilter(vals: np.ndarray) -> Tuple[bool, Dict[str, float]]:
|
||||
if vals.size < 12:
|
||||
return False, {"reason": "too_few_samples"}
|
||||
uniq = np.unique(vals)
|
||||
if uniq.size <= 2:
|
||||
return False, {"reason": "too_constant"}
|
||||
p95 = p_quant_abs_diff(vals, 0.95)
|
||||
if p95 == 0:
|
||||
return False, {"reason": "no_changes"}
|
||||
r = float(np.percentile(vals, 97) - np.percentile(vals, 3) + 1e-9)
|
||||
if p95 > 0.5 * r:
|
||||
return False, {"reason": "too_jumpi"}
|
||||
return True, {"p95_abs_diff": p95, "span_est": r}
|
||||
|
||||
def try_scaleset() -> List[float]:
|
||||
base = [
|
||||
1e-3, 2e-3, 5e-3,
|
||||
1e-2, 2e-2, 5e-2,
|
||||
0.05, 0.0625, 0.1, 0.125, 0.2, 0.25, 0.5,
|
||||
0.75, 0.8, 1.0, 1.25, 2.0, 5.0, 10.0
|
||||
]
|
||||
return sorted(set(base))
|
||||
|
||||
def interval_best_offset(raw: np.ndarray, scale: float, rmin: float, rmax: float) -> Tuple[float, float]:
|
||||
"""
|
||||
Finde das Offset, das die meisten Werte (scale*raw + offset) in [rmin, rmax] bringt.
|
||||
Sweep über Intervallgrenzen (klassische "interval stabbing" Lösung).
|
||||
"""
|
||||
a = rmin - scale * raw
|
||||
b = rmax - scale * raw
|
||||
lo = np.minimum(a, b)
|
||||
hi = np.maximum(a, b)
|
||||
events = []
|
||||
for L, H in zip(lo, hi):
|
||||
events.append((L, +1))
|
||||
events.append((H, -1))
|
||||
events.sort(key=lambda t: (t[0], -t[1]))
|
||||
best = -1
|
||||
cur = 0
|
||||
best_x = None
|
||||
for x, v in events:
|
||||
cur += v
|
||||
if cur > best:
|
||||
best = cur
|
||||
best_x = x
|
||||
hit_ratio = float(best) / float(len(raw)) if len(raw) else 0.0
|
||||
return float(best_x if best_x is not None else 0.0), hit_ratio
|
||||
|
||||
|
||||
# ---------- Candidate Generation ----------
|
||||
|
||||
def gen_candidates(df: pd.DataFrame) -> Iterable[Tuple[str, np.ndarray, np.ndarray]]:
|
||||
"""
|
||||
Liefert (label, values, times) für:
|
||||
- 8-bit Bytes D0..D7
|
||||
- 16-bit adjazente Paare (LE/BE) + signed Varianten
|
||||
Times wird auf die gefilterten Indizes gemappt (DLC-abhängig).
|
||||
"""
|
||||
times_all = df["time_s"].to_numpy(dtype=float)
|
||||
data = df["data"].tolist()
|
||||
|
||||
# 8-bit
|
||||
for i in range(8):
|
||||
idx = [k for k, d in enumerate(data) if len(d) > i]
|
||||
if len(idx) < 3:
|
||||
continue
|
||||
vals = np.array([data[k][i] for k in idx], dtype=float)
|
||||
t = times_all[idx]
|
||||
yield f"byte[{i}]", vals, t
|
||||
|
||||
# 16-bit adjazent
|
||||
for i in range(7):
|
||||
j = i + 1
|
||||
idx = [k for k, d in enumerate(data) if len(d) > j]
|
||||
if len(idx) < 3:
|
||||
continue
|
||||
a = [data[k][i] for k in idx]
|
||||
b = [data[k][j] for k in idx]
|
||||
u_le = np.array([le16(x, y) for x, y in zip(a, b)], dtype=float)
|
||||
u_be = np.array([be16(x, y) for x, y in zip(a, b)], dtype=float)
|
||||
s_le = np.array([s16(le16(x, y)) for x, y in zip(a, b)], dtype=float)
|
||||
s_be = np.array([s16(be16(x, y)) for x, y in zip(a, b)], dtype=float)
|
||||
t = times_all[idx]
|
||||
yield f"le16[{i}-{j}]", u_le, t
|
||||
yield f"be16[{i}-{j}]", u_be, t
|
||||
yield f"le16s[{i}-{j}]", s_le, t
|
||||
yield f"be16s[{i}-{j}]", s_be, t
|
||||
|
||||
|
||||
# ---------- Evaluation ----------
|
||||
|
||||
def evaluate_supervised(label: str,
|
||||
vals: np.ndarray,
|
||||
times: np.ndarray,
|
||||
rmin: float,
|
||||
rmax: float,
|
||||
allow_neg_scale: bool,
|
||||
constraints: Dict[str, float]) -> Dict[str, float] | None:
|
||||
ok, meta = prefilter(vals)
|
||||
if not ok:
|
||||
return None
|
||||
|
||||
scales = try_scaleset()
|
||||
if allow_neg_scale:
|
||||
scales += [-s for s in scales if s > 0]
|
||||
|
||||
best = {"hit_ratio": -1.0, "scale": None, "offset": 0.0}
|
||||
for s in scales:
|
||||
o, hr = interval_best_offset(vals, s, rmin, rmax)
|
||||
if hr > best["hit_ratio"]:
|
||||
best = {"scale": s, "offset": float(o), "hit_ratio": hr}
|
||||
|
||||
phys = vals * best["scale"] + best["offset"]
|
||||
within = (phys >= rmin) & (phys <= rmax)
|
||||
in_count = int(np.count_nonzero(within))
|
||||
|
||||
p95_raw = p_quant_abs_diff(vals, 0.95)
|
||||
p95_phys = p_quant_abs_diff(phys, 0.95)
|
||||
|
||||
ia = interarrival_metrics(times[:len(vals)])
|
||||
sm = slope_metrics(phys, times[:len(phys)])
|
||||
|
||||
prange = (rmax - rmin) if (rmax > rmin) else 1.0
|
||||
slope_p95_frac = sm["slope_p95"] / prange
|
||||
slope_p99_frac = sm["slope_p99"] / prange
|
||||
|
||||
failures = []
|
||||
|
||||
if constraints.get("rate_min") is not None and ia["rate_hz"] < constraints["rate_min"] - 1e-9:
|
||||
failures.append(f"rate {ia['rate_hz']:.2f}Hz < min {constraints['rate_min']:.2f}Hz")
|
||||
if constraints.get("rate_max") is not None and ia["rate_hz"] > constraints["rate_max"] + 1e-9:
|
||||
failures.append(f"rate {ia['rate_hz']:.2f}Hz > max {constraints['rate_max']:.2f}Hz")
|
||||
|
||||
if constraints.get("jitter_max_ms") is not None:
|
||||
jitter_ms = ia["period_std"] * 1000.0
|
||||
if jitter_ms > constraints["jitter_max_ms"] + 1e-9:
|
||||
failures.append(f"jitter {jitter_ms:.1f}ms > max {constraints['jitter_max_ms']:.1f}ms")
|
||||
|
||||
def _resolve_abs_slope_limit():
|
||||
if constraints.get("max_slope_abs") is not None:
|
||||
return constraints["max_slope_abs"]
|
||||
if constraints.get("max_slope_frac") is not None:
|
||||
return constraints["max_slope_frac"] * prange
|
||||
return None
|
||||
|
||||
max_s_abs = _resolve_abs_slope_limit()
|
||||
if max_s_abs is not None:
|
||||
q = constraints.get("slope_quantile", 0.95)
|
||||
qv = sm["slope_p95"] if q <= 0.95 else sm["slope_p99"]
|
||||
if qv > max_s_abs + 1e-9:
|
||||
failures.append(f"slope(q={q:.2f}) {qv:.3g} > max {max_s_abs:.3g}")
|
||||
|
||||
uniq_ratio = len(np.unique(vals)) / float(len(vals))
|
||||
if constraints.get("min_uniq_ratio") is not None and uniq_ratio < constraints["min_uniq_ratio"] - 1e-9:
|
||||
failures.append(f"uniq_ratio {uniq_ratio:.3f} < min {constraints['min_uniq_ratio']:.3f}")
|
||||
|
||||
passed = (len(failures) == 0)
|
||||
|
||||
# Quality Score
|
||||
score = best["hit_ratio"]
|
||||
if max_s_abs is not None and max_s_abs > 0:
|
||||
slope_pen = min(sm["slope_p95"] / max_s_abs, 1.0)
|
||||
score *= (1.0 - 0.3 * slope_pen)
|
||||
if constraints.get("jitter_max_ms") is not None:
|
||||
jitter_ms = ia["period_std"] * 1000.0
|
||||
jitter_pen = min(jitter_ms / constraints["jitter_max_ms"], 1.0)
|
||||
score *= (1.0 - 0.2 * jitter_pen)
|
||||
|
||||
return {
|
||||
"label": label,
|
||||
"mode": "range_fit",
|
||||
"n": int(vals.size),
|
||||
"raw_min": float(np.min(vals)),
|
||||
"raw_max": float(np.max(vals)),
|
||||
"raw_var": float(np.var(vals)),
|
||||
"p95_absdiff_raw": float(p95_raw),
|
||||
"scale": float(best["scale"]),
|
||||
"offset": float(best["offset"]),
|
||||
"hit_ratio": float(best["hit_ratio"]),
|
||||
"in_count": in_count,
|
||||
"phys_min": float(np.min(phys)),
|
||||
"phys_max": float(np.max(phys)),
|
||||
"p95_absdiff_phys": float(p95_phys),
|
||||
"span_phys": float(np.percentile(phys, 97) - np.percentile(phys, 3)),
|
||||
"rate_hz_est": float(ia["rate_hz"]),
|
||||
"period_std_ms": float(ia["period_std"] * 1000.0),
|
||||
"jitter_cv": float(ia["jitter_cv"]),
|
||||
"slope_p95_per_s": float(sm["slope_p95"]),
|
||||
"slope_p99_per_s": float(sm["slope_p99"]),
|
||||
"slope_p95_frac": float(slope_p95_frac),
|
||||
"slope_p99_frac": float(slope_p99_frac),
|
||||
"uniq_ratio": float(uniq_ratio),
|
||||
"passed": bool(passed),
|
||||
"fail_reasons": "; ".join(failures),
|
||||
"quality_score": float(score),
|
||||
}
|
||||
|
||||
def evaluate_unsupervised(label: str,
|
||||
vals: np.ndarray,
|
||||
times: np.ndarray,
|
||||
min_smooth: float = 0.2,
|
||||
max_slope_frac_raw: float | None = None,
|
||||
slope_quantile: float = 0.95) -> Dict[str, float] | None:
|
||||
if vals.size < 12:
|
||||
return None
|
||||
p95 = p_quant_abs_diff(vals, 0.95)
|
||||
span = float(np.percentile(vals, 97) - np.percentile(vals, 3) + 1e-9)
|
||||
smooth = 1.0 - min(max(p95 / span, 0.0), 1.0)
|
||||
uniq_ratio = float(len(np.unique(vals))) / float(vals.size)
|
||||
var = float(np.var(vals))
|
||||
|
||||
ia = interarrival_metrics(times[:len(vals)])
|
||||
sm = slope_metrics(vals, times[:len(vals)])
|
||||
slope_q = sm["slope_p95"] if slope_quantile <= 0.95 else sm["slope_p99"]
|
||||
slope_frac_raw = (slope_q / span) if span > 0 else 0.0
|
||||
|
||||
if uniq_ratio <= 0.02:
|
||||
return None
|
||||
if smooth < min_smooth:
|
||||
return None
|
||||
if (max_slope_frac_raw is not None) and (slope_frac_raw > max_slope_frac_raw):
|
||||
return None
|
||||
|
||||
return {
|
||||
"label": label,
|
||||
"mode": "unsupervised",
|
||||
"n": int(vals.size),
|
||||
"raw_min": float(np.min(vals)),
|
||||
"raw_max": float(np.max(vals)),
|
||||
"raw_var": var,
|
||||
"span_raw": span,
|
||||
"p95_absdiff_raw": float(p95),
|
||||
"smoothness": float(smooth),
|
||||
"uniq_ratio": float(uniq_ratio),
|
||||
"rate_hz_est": float(ia["rate_hz"]),
|
||||
"period_std_ms": float(ia["period_std"] * 1000.0),
|
||||
"jitter_cv": float(ia["jitter_cv"]),
|
||||
"slope_q_raw": float(slope_q),
|
||||
"slope_frac_raw": float(slope_frac_raw),
|
||||
}
|
||||
|
||||
|
||||
# ---------- Plot & Report ----------
|
||||
|
||||
def plot_timeseries(times: np.ndarray, series: np.ndarray, out_png: Path, title: str, ylabel: str) -> None:
|
||||
plt.figure(figsize=(10, 4))
|
||||
plt.plot(times[:len(series)], series, marker=".", linestyle="-")
|
||||
plt.xlabel("Zeit (s)")
|
||||
plt.ylabel(ylabel)
|
||||
plt.title(title)
|
||||
plt.grid(True)
|
||||
plt.tight_layout()
|
||||
out_png.parent.mkdir(parents=True, exist_ok=True)
|
||||
plt.savefig(out_png, dpi=150)
|
||||
plt.close()
|
||||
|
||||
def df_to_md_table(df: pd.DataFrame) -> str:
|
||||
"""Robustes Markdown-Table: nutzt to_markdown falls vorhanden, sonst CSV in Codeblock."""
|
||||
try:
|
||||
return df.to_markdown(index=False) # benötigt evtl. 'tabulate'
|
||||
except Exception:
|
||||
return "```\n" + df.to_csv(index=False) + "```"
|
||||
|
||||
def write_report_md(path: Path, header: dict, top_rows: pd.DataFrame, failures: pd.DataFrame, mode: str, links: dict) -> None:
|
||||
md = []
|
||||
md.append(f"# Trace Report – {header.get('trace_name','')}")
|
||||
md.append("")
|
||||
md.append(f"- **Mode:** {mode}")
|
||||
for k, v in header.items():
|
||||
if k in ("trace_name",):
|
||||
continue
|
||||
md.append(f"- **{k}**: {v}")
|
||||
md.append("")
|
||||
|
||||
if mode == "range_fit":
|
||||
md.append("## Top-Kandidaten (Range-Fit)")
|
||||
md.append("Hit-Ratio, Slope/Jitter & Score – beste zuerst.\n")
|
||||
if top_rows is not None and not top_rows.empty:
|
||||
md.append(df_to_md_table(top_rows))
|
||||
else:
|
||||
md.append("_Keine Kandidaten über Schwelle._")
|
||||
md.append("")
|
||||
if failures is not None and not failures.empty:
|
||||
md.append("## Ausgeschlossene Kandidaten (Gründe)\n")
|
||||
md.append(df_to_md_table(failures[["label", "fail_reasons"]]))
|
||||
else:
|
||||
md.append("## Top-Kandidaten (Unsupervised)\n")
|
||||
if top_rows is not None and not top_rows.empty:
|
||||
md.append(df_to_md_table(top_rows))
|
||||
else:
|
||||
md.append("_Keine plausiblen Rohsignale._")
|
||||
|
||||
md.append("\n## Artefakte")
|
||||
for k, v in links.items():
|
||||
md.append(f"- **{k}**: `{v}`")
|
||||
path.write_text("\n".join(md), encoding="utf-8")
|
||||
|
||||
|
||||
# ---------- Main ----------
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="Range-/Unsupervised-Fit mit physikbasierten Constraints + Bericht")
|
||||
ap.add_argument("trace", help="Pfad zur .trace Datei")
|
||||
|
||||
# supervision
|
||||
ap.add_argument("--rmin", type=float, default=None)
|
||||
ap.add_argument("--rmax", type=float, default=None)
|
||||
ap.add_argument("--allow-neg-scale", action="store_true")
|
||||
|
||||
# shared
|
||||
ap.add_argument("--rx-only", action="store_true")
|
||||
ap.add_argument("--outdir", default=".")
|
||||
ap.add_argument("--plots-top", type=int, default=8)
|
||||
|
||||
# supervised thresholds
|
||||
ap.add_argument("--min-hit", type=float, default=0.5)
|
||||
ap.add_argument("--rate-min", type=float, default=None)
|
||||
ap.add_argument("--rate-max", type=float, default=None)
|
||||
ap.add_argument("--jitter-max-ms", type=float, default=None)
|
||||
ap.add_argument("--max-slope-abs", type=float, default=None, help="Max |Δphys|/s (z. B. °C/s, km/h/s)")
|
||||
ap.add_argument("--max-slope-frac", type=float, default=None, help="Max |Δphys|/s relativ zu (rmax-rmin)")
|
||||
ap.add_argument("--slope-quantile", type=float, default=0.95, help="0.95 oder 0.99")
|
||||
ap.add_argument("--min-uniq-ratio", type=float, default=None)
|
||||
|
||||
# unsupervised thresholds
|
||||
ap.add_argument("--min-smooth", type=float, default=0.2)
|
||||
ap.add_argument("--max-slope-frac-raw", type=float, default=None, help="roh: (|Δraw|/s)/Span")
|
||||
|
||||
args = ap.parse_args()
|
||||
|
||||
trace = Path(args.trace)
|
||||
df = parse_trace(trace, rx_only=args.rx_only)
|
||||
if df.empty:
|
||||
print("Keine Daten in Trace.", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
supervised = (args.rmin is not None) and (args.rmax is not None)
|
||||
outdir = Path(args.outdir)
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if supervised:
|
||||
constraints = {
|
||||
"rate_min": args.rate_min,
|
||||
"rate_max": args.rate_max,
|
||||
"jitter_max_ms": args.jitter_max_ms,
|
||||
"max_slope_abs": args.max_slope_abs,
|
||||
"max_slope_frac": args.max_slope_frac,
|
||||
"slope_quantile": args.slope_quantile,
|
||||
"min_uniq_ratio": args.min_uniq_ratio,
|
||||
}
|
||||
results = []
|
||||
rejected = []
|
||||
for label, series, times in gen_candidates(df):
|
||||
r = evaluate_supervised(label, series, times, args.rmin, args.rmax, args.allow_neg_scale, constraints)
|
||||
if r is None:
|
||||
continue
|
||||
if r["hit_ratio"] >= args.min_hit:
|
||||
(results if r["passed"] else rejected).append({**r, "trace": trace.stem})
|
||||
|
||||
if not results and not rejected:
|
||||
print("Keine Kandidaten über Schwelle gefunden.", file=sys.stderr)
|
||||
sys.exit(3)
|
||||
|
||||
df_ok = pd.DataFrame(results).sort_values(
|
||||
["quality_score", "hit_ratio", "p95_absdiff_phys", "rate_hz_est", "n"],
|
||||
ascending=[False, False, True, False, False]
|
||||
)
|
||||
df_rej = pd.DataFrame(rejected)
|
||||
|
||||
csv_path = outdir / f"{trace.stem}_encoding_candidates.csv"
|
||||
if not df_ok.empty:
|
||||
df_ok.to_csv(csv_path, index=False)
|
||||
print(f"Kandidaten-CSV: {csv_path}")
|
||||
|
||||
# Plots für Top-Kandidaten (oder Rejected, falls keine OK)
|
||||
top_for_plots = df_ok if not df_ok.empty else df_rej
|
||||
data = df["data"].tolist()
|
||||
times_all = df["time_s"].to_numpy(dtype=float)
|
||||
|
||||
def reconstruct_vals(label: str) -> np.ndarray | None:
|
||||
if label.startswith("byte["):
|
||||
i = int(label.split("[")[1].split("]")[0])
|
||||
idx = [k for k, d in enumerate(data) if len(d) > i]
|
||||
if not idx: return None
|
||||
return np.array([data[k][i] for k in idx], dtype=float), times_all[idx]
|
||||
elif label.startswith(("le16", "be16", "le16s", "be16s")):
|
||||
signed = label.startswith(("le16s", "be16s"))
|
||||
i, j = map(int, label.split("[")[1].split("]")[0].split("-"))
|
||||
idx = [k for k, d in enumerate(data) if len(d) > j]
|
||||
if not idx: return None
|
||||
a = [data[k][i] for k in idx]
|
||||
b = [data[k][j] for k in idx]
|
||||
if label.startswith("le16"):
|
||||
v = [le16(x, y) for x, y in zip(a, b)]
|
||||
else:
|
||||
v = [be16(x, y) for x, y in zip(a, b)]
|
||||
if signed:
|
||||
v = [s16(int(x)) for x in v]
|
||||
return np.array(v, dtype=float), times_all[idx]
|
||||
return None
|
||||
|
||||
for _, row in top_for_plots.head(max(1, args.plots_top)).iterrows():
|
||||
rec = reconstruct_vals(row["label"])
|
||||
if rec is None:
|
||||
continue
|
||||
vals, tt = rec
|
||||
phys = vals * row["scale"] + row["offset"]
|
||||
out_png = outdir / f"{trace.stem}_{row['label'].replace('[','_').replace(']','')}.png"
|
||||
plot_timeseries(tt[:len(phys)], phys, out_png,
|
||||
f"{trace.name} – {row['label']} (scale={row['scale']:.6g}, offset={row['offset']:.6g})",
|
||||
"phys (geschätzt)")
|
||||
|
||||
# Bericht
|
||||
hdr = {
|
||||
"trace_name": trace.name,
|
||||
"mode": "range_fit",
|
||||
"rmin": args.rmin,
|
||||
"rmax": args.rmax,
|
||||
"min_hit": args.min_hit,
|
||||
"rate_min": args.rate_min,
|
||||
"rate_max": args.rate_max,
|
||||
"jitter_max_ms": args.jitter_max_ms,
|
||||
"max_slope_abs": args.max_slope_abs,
|
||||
"max_slope_frac": args.max_slope_frac,
|
||||
"slope_quantile": args.slope_quantile,
|
||||
}
|
||||
top_view = df_ok.head(12)[
|
||||
["label", "quality_score", "hit_ratio", "scale", "offset",
|
||||
"rate_hz_est", "period_std_ms", "slope_p95_per_s", "slope_p99_per_s",
|
||||
"p95_absdiff_phys", "uniq_ratio"]
|
||||
] if not df_ok.empty else pd.DataFrame()
|
||||
fail_view = df_rej[["label", "fail_reasons"]] if not df_rej.empty else pd.DataFrame()
|
||||
|
||||
md_path = outdir / f"{trace.stem}_report.md"
|
||||
json_path = outdir / f"{trace.stem}_report.json"
|
||||
write_report_md(md_path, hdr, top_view, fail_view, "range_fit",
|
||||
{"candidates_csv": str(csv_path) if not df_ok.empty else "(leer)"})
|
||||
with open(json_path, "w", encoding="utf-8") as f:
|
||||
json.dump({
|
||||
"header": hdr,
|
||||
"accepted": df_ok.to_dict(orient="records"),
|
||||
"rejected": df_rej.to_dict(orient="records"),
|
||||
}, f, ensure_ascii=False, indent=2)
|
||||
print(f"Report: {md_path}")
|
||||
print(f"Report JSON: {json_path}")
|
||||
|
||||
if not df_ok.empty:
|
||||
print("\nTop-Kandidaten:")
|
||||
cols = ["label", "quality_score", "hit_ratio", "scale", "offset",
|
||||
"rate_hz_est", "period_std_ms", "slope_p95_per_s", "slope_p99_per_s"]
|
||||
print(df_ok.head(10)[cols].to_string(index=False))
|
||||
else:
|
||||
print("\nKeine Kandidaten PASS; siehe Gründe in report.")
|
||||
|
||||
else:
|
||||
# Unsupervised
|
||||
results = []
|
||||
for label, series, times in gen_candidates(df):
|
||||
r = evaluate_unsupervised(label, series, times,
|
||||
min_smooth=args.min_smooth,
|
||||
max_slope_frac_raw=args.max_slope_frac_raw,
|
||||
slope_quantile=args.slope_quantile)
|
||||
if r is None:
|
||||
continue
|
||||
r["trace"] = trace.stem
|
||||
results.append(r)
|
||||
|
||||
if not results:
|
||||
print("Keine plausiblen Rohsignale gefunden. Tipp: --min-smooth senken.", file=sys.stderr)
|
||||
sys.exit(3)
|
||||
|
||||
df_res = pd.DataFrame(results).sort_values(
|
||||
["smoothness", "span_raw", "raw_var", "rate_hz_est", "n"],
|
||||
ascending=[False, False, False, False, False]
|
||||
)
|
||||
|
||||
csv_path = outdir / f"{trace.stem}_unsupervised_candidates.csv"
|
||||
df_res.to_csv(csv_path, index=False)
|
||||
print(f"Unsupervised-CSV: {csv_path}")
|
||||
|
||||
# Plots der Top-N (Rohwerte)
|
||||
data = df["data"].tolist()
|
||||
times_all = df["time_s"].to_numpy(dtype=float)
|
||||
|
||||
def reconstruct_raw(label: str) -> Tuple[np.ndarray, np.ndarray] | None:
|
||||
if label.startswith("byte["):
|
||||
i = int(label.split("[")[1].split("]")[0])
|
||||
idx = [k for k, d in enumerate(data) if len(d) > i]
|
||||
if not idx: return None
|
||||
return np.array([data[k][i] for k in idx], dtype=float), times_all[idx]
|
||||
elif label.startswith(("le16", "be16", "le16s", "be16s")):
|
||||
signed = label.startswith(("le16s", "be16s"))
|
||||
i, j = map(int, label.split("[")[1].split("]")[0].split("-"))
|
||||
idx = [k for k, d in enumerate(data) if len(d) > j]
|
||||
if not idx: return None
|
||||
a = [data[k][i] for k in idx]
|
||||
b = [data[k][j] for k in idx]
|
||||
if label.startswith("le16"):
|
||||
v = [le16(x, y) for x, y in zip(a, b)]
|
||||
else:
|
||||
v = [be16(x, y) for x, y in zip(a, b)]
|
||||
if signed:
|
||||
v = [s16(int(x)) for x in v]
|
||||
return np.array(v, dtype=float), times_all[idx]
|
||||
return None
|
||||
|
||||
for _, row in df_res.head(max(1, args.plots_top)).iterrows():
|
||||
rec = reconstruct_raw(row["label"])
|
||||
if rec is None:
|
||||
continue
|
||||
vals, tt = rec
|
||||
out_png = outdir / f"{trace.stem}_{row['label'].replace('[','_').replace(']','')}_raw.png"
|
||||
plot_timeseries(tt[:len(vals)], vals, out_png,
|
||||
f"{trace.name} – {row['label']} (raw)", "raw")
|
||||
|
||||
# Bericht
|
||||
hdr = {
|
||||
"trace_name": trace.name,
|
||||
"mode": "unsupervised",
|
||||
"min_smooth": args.min_smooth,
|
||||
"max_slope_frac_raw": args.max_slope_frac_raw,
|
||||
}
|
||||
top_view = df_res.head(12)[
|
||||
["label", "smoothness", "span_raw", "raw_var",
|
||||
"rate_hz_est", "period_std_ms", "slope_frac_raw", "uniq_ratio"]
|
||||
]
|
||||
md_path = outdir / f"{trace.stem}_report.md"
|
||||
json_path = outdir / f"{trace.stem}_report.json"
|
||||
write_report_md(md_path, hdr, top_view, pd.DataFrame(), "unsupervised",
|
||||
{"candidates_csv": str(csv_path)})
|
||||
with open(json_path, "w", encoding="utf-8") as f:
|
||||
json.dump({
|
||||
"header": hdr,
|
||||
"accepted": df_res.to_dict(orient="records"),
|
||||
}, f, ensure_ascii=False, indent=2)
|
||||
print(f"Report: {md_path}")
|
||||
print(f"Report JSON: {json_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
12
Software/.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
data/
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
wifi_credentials.ini
|
||||
.vscode
|
||||
wifi_credentials.ini
|
||||
__pycache__
|
||||
# Node-Tools für Build-Scripts
|
||||
/tools_node/
|
||||
/data_stripped/
|
||||
|
10
Software/.vscode/extensions.json
vendored
@@ -1,10 +0,0 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
145
Software/codegen/dtcs.py
Normal file
@@ -0,0 +1,145 @@
|
||||
import os
|
||||
import time
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
import json
|
||||
import sys
|
||||
|
||||
import filechecksum as fcs
|
||||
|
||||
def build_dtcs():
|
||||
# Pfad zur Eingabedatei und Ausgabedatei
|
||||
input_file = "src/dtc_defs.txt"
|
||||
output_file = "include/dtc_defs.h"
|
||||
json_output_file = "data_src/static/dtc_table.json"
|
||||
|
||||
# Überprüfen, ob das Verzeichnis existiert, andernfalls erstellen
|
||||
json_output_dir = os.path.dirname(json_output_file)
|
||||
if not os.path.exists(json_output_dir):
|
||||
os.makedirs(json_output_dir)
|
||||
|
||||
# Mehrdimensionales Array zum Speichern der Zeilen aus der Eingabedatei
|
||||
dtc_lines = []
|
||||
|
||||
# Lesen und analysieren der Eingabedatei
|
||||
with open(input_file, "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
|
||||
parts = line.split(";")
|
||||
if len(parts) == 5:
|
||||
num, dtc_name, dtc_severity, title, description = [part.strip() for part in parts]
|
||||
dtc_lines.append([int(num), dtc_name, dtc_severity, title, description])
|
||||
|
||||
# Überprüfen auf Duplikate in den DTC-Nummern und DTC-Namen
|
||||
num_set = set()
|
||||
dtc_name_set = set()
|
||||
duplicates = []
|
||||
|
||||
for line in dtc_lines:
|
||||
num, dtc_name, _, _, _ = line
|
||||
if num in num_set:
|
||||
duplicates.append(f"DTC-Nummer {num} ist ein Duplikat.")
|
||||
else:
|
||||
num_set.add(num)
|
||||
|
||||
if dtc_name in dtc_name_set:
|
||||
duplicates.append(f"DTC-Name '{dtc_name}' ist ein Duplikat.")
|
||||
else:
|
||||
dtc_name_set.add(dtc_name)
|
||||
|
||||
if duplicates:
|
||||
for duplicate in duplicates:
|
||||
print(f"Fehler: {duplicate}")
|
||||
raise ValueError("Duplicate DTC Data detected")
|
||||
|
||||
# Suchen nach DTC_NO_DTC und DTC_LAST_DTC
|
||||
dtc_no_dtc_added = False
|
||||
dtc_last_dtc_line = None
|
||||
|
||||
for line in dtc_lines:
|
||||
_, dtc_name, _, _, _ = line
|
||||
if dtc_name == "DTC_NO_DTC":
|
||||
dtc_no_dtc_added = True
|
||||
elif dtc_name == "DTC_LAST_DTC":
|
||||
dtc_last_dtc_line = line
|
||||
|
||||
# Einen DTC für DTC_NO_DTC hinzufügen (wenn nicht vorhanden)
|
||||
if not dtc_no_dtc_added:
|
||||
dtc_lines.insert(0, [0, "DTC_NO_DTC", "DTC_NONE", "No Error", "No Error"])
|
||||
|
||||
# Falls DTC_LAST_DTC existiert, lösche es
|
||||
if dtc_last_dtc_line:
|
||||
dtc_lines.remove(dtc_last_dtc_line)
|
||||
|
||||
# Einen DTC für DTC_LAST_DTC hinzufügen (mit der höchsten Nummer)
|
||||
if dtc_lines:
|
||||
highest_num = max([line[0] for line in dtc_lines])
|
||||
else:
|
||||
highest_num = 0
|
||||
|
||||
dtc_lines.append([highest_num + 1, "DTC_LAST_DTC", "DTC_NONE", "Last Error", "Last Error"])
|
||||
|
||||
# Sortieren der Zeilen nach der Nummer aufsteigend
|
||||
dtc_lines.sort(key=lambda x: x[0])
|
||||
|
||||
checksum = fcs.calculate_checksum(dtc_lines)
|
||||
timestamp = int(time.time())
|
||||
|
||||
if fcs.read_and_compare_checksum(output_file, checksum):
|
||||
print("Keine Änderungen im DTC-Headerfile erforderlich.")
|
||||
else:
|
||||
# DTC_NAME_CONSTANT-Makros initialisieren
|
||||
dtc_macros = []
|
||||
dtc_structs = []
|
||||
|
||||
# Verarbeiten der sortierten Zeilen
|
||||
for i, line in enumerate(dtc_lines):
|
||||
num, dtc_name, dtc_severity, title, description = line
|
||||
dtc_macros.append(f"#define {dtc_name:<30} {num}")
|
||||
comma = "," if i < len(dtc_lines) - 1 else " "
|
||||
dtc_structs.append(f" {{ {dtc_name:<30}, {dtc_severity:<12} }}{comma} // {description}")
|
||||
|
||||
env = Environment(loader=FileSystemLoader('codegen/templates', encoding='utf-8'))
|
||||
# Lade das Jinja2-Template aus der Datei
|
||||
template = env.get_template('dtc_defs.h.j2')
|
||||
|
||||
# Erstelle ein Context-Dictionary mit den erforderlichen Daten
|
||||
context = {
|
||||
'timestamp_unix': timestamp,
|
||||
'timestamp' : time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)),
|
||||
'date' : time.strftime('%d.%m.%Y', time.localtime(timestamp)),
|
||||
'dtc_macros': dtc_macros, # Übergebe die dtc_macros-Liste direkt
|
||||
'dtc_structs': dtc_structs, # Übergebe die dtc_structs-Liste direkt
|
||||
'checksum' : checksum
|
||||
}
|
||||
|
||||
# Rendere das Template mit den Werten und erhalte den Header-Text
|
||||
header_text = template.render(context)
|
||||
|
||||
# Schreibe den generierten Header-Text in die Header-Datei
|
||||
with open(output_file, "w", encoding='utf-8') as f:
|
||||
f.write(header_text)
|
||||
|
||||
print(f"Header-Datei wurde erstellt: {output_file}")
|
||||
|
||||
if fcs.read_and_compare_json_checksum(json_output_file, checksum):
|
||||
print("Keine Änderungen im DTC-JSON-file erforderlich.")
|
||||
else:
|
||||
dtc_info = {
|
||||
"codegenerator_checksum": checksum,
|
||||
'timestamp' : time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)),
|
||||
"dtc_table_data": []
|
||||
}
|
||||
|
||||
# Verarbeiten der sortierten Zeilen
|
||||
for i, line in enumerate(dtc_lines):
|
||||
num, dtc_name, dtc_severity, title, description = line
|
||||
dtc_info["dtc_table_data"].append({"num": num, "title": title, "description": description})
|
||||
|
||||
# JSON-Datei mit UTF-8-Zeichencodierung erstellen
|
||||
with open(json_output_file, 'w', encoding='utf-8') as json_f:
|
||||
json.dump(dtc_info, json_f, ensure_ascii=False, indent=4, separators=(',', ': '))
|
||||
|
||||
print(f"JSON-Datei wurde erstellt: {json_output_file}")
|
45
Software/codegen/filechecksum.py
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
# Funktion zum Berechnen der SHA-256-Checksumme
|
||||
def calculate_checksum(data):
|
||||
sha256 = hashlib.sha256()
|
||||
sha256.update(str(data).encode('utf-8'))
|
||||
return sha256.hexdigest()
|
||||
|
||||
# Funktion zum Lesen und Vergleichen der Checksumme in einer Datei
|
||||
def read_and_compare_checksum(file_path, expected_checksum):
|
||||
try:
|
||||
with open(file_path, 'r') as file:
|
||||
content = file.read()
|
||||
# Suche nach der Zeile mit der Checksumme
|
||||
checksum_line_start = content.find("// CODEGENERATOR_CHECKSUM:")
|
||||
if checksum_line_start != -1:
|
||||
# Extrahiere die Checksumme aus der Zeile
|
||||
existing_checksum = content[checksum_line_start + len("// CODEGENERATOR_CHECKSUM:"):].strip()
|
||||
# Vergleiche die Checksummen
|
||||
if existing_checksum == expected_checksum:
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
pass # Datei existiert nicht, was nicht schlimm ist
|
||||
|
||||
return False
|
||||
|
||||
def read_and_compare_json_checksum(json_file_path, expected_checksum):
|
||||
try:
|
||||
with open(json_file_path, 'r') as json_file:
|
||||
# Lade das JSON aus der Datei
|
||||
data = json.load(json_file)
|
||||
|
||||
# Überprüfe, ob "codegenerator_checksum" im JSON vorhanden ist
|
||||
if "codegenerator_checksum" in data:
|
||||
existing_checksum = data["codegenerator_checksum"]
|
||||
|
||||
# Vergleiche die Checksummen
|
||||
if existing_checksum == expected_checksum:
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
pass # Datei existiert nicht, was nicht schlimm ist
|
||||
|
||||
return False
|
154
Software/codegen/prepare_littlefs.py
Normal file
@@ -0,0 +1,154 @@
|
||||
# SCRIPT TO GZIP CRITICAL FILES FOR ACCELERATED WEBSERVING
|
||||
# see also https://community.platformio.org/t/question-esp32-compress-files-in-data-to-gzip-before-upload-possible-to-spiffs/6274/10
|
||||
|
||||
|
||||
import glob
|
||||
import shutil
|
||||
import gzip
|
||||
import os
|
||||
import subprocess
|
||||
import platform
|
||||
Import("env")
|
||||
Import("projenv")
|
||||
|
||||
def ensure_node_tool(package_name, binary_name=None):
|
||||
"""Installiert das Tool lokal, wenn es fehlt – mit npm init bei Bedarf"""
|
||||
if binary_name is None:
|
||||
binary_name = package_name
|
||||
|
||||
project_dir = env.subst('$PROJECT_DIR')
|
||||
tools_dir = os.path.join(project_dir, 'tools_node')
|
||||
local_bin = os.path.join(tools_dir, 'node_modules', '.bin', binary_name)
|
||||
|
||||
os.makedirs(tools_dir, exist_ok=True)
|
||||
|
||||
# Wenn Binary schon vorhanden ist, einfach zurückgeben
|
||||
if os.path.isfile(local_bin):
|
||||
return local_bin
|
||||
|
||||
print(f"🛠️ Installing missing node tool: {package_name}")
|
||||
|
||||
# Initialisiere npm, falls noch nicht geschehen
|
||||
if not os.path.isfile(os.path.join(tools_dir, 'package.json')):
|
||||
print("📦 Initializing local npm project...")
|
||||
subprocess.run(['npm', 'init', '-y'], cwd=tools_dir, check=True)
|
||||
|
||||
try:
|
||||
subprocess.run(['npm', 'install', package_name], cwd=tools_dir, check=True)
|
||||
except Exception as e:
|
||||
print(f"❌ Fehler beim Installieren von {package_name}: {e}")
|
||||
return binary_name # Fallback: globale binary
|
||||
|
||||
return local_bin if os.path.isfile(local_bin) else binary_name
|
||||
|
||||
# Tools sicherstellen
|
||||
# Tools sicherstellen – Package-Name und CLI-Binary ggf. unterschiedlich
|
||||
html_minifier_path = ensure_node_tool("html-minifier")
|
||||
terser_path = ensure_node_tool("terser")
|
||||
cssnano_path = ensure_node_tool("cssnano-cli", "cssnano")
|
||||
|
||||
def minify_html(input_path, output_path):
|
||||
subprocess.run([html_minifier_path, '--collapse-whitespace', '--remove-comments', input_path, '-o', output_path])
|
||||
|
||||
def minify_js(input_path, output_path):
|
||||
subprocess.run([terser_path, input_path, '-o', output_path, '-c', '-m'])
|
||||
|
||||
def minify_css(input_path, output_path):
|
||||
subprocess.run([cssnano_path, '--no-discardUnused', input_path, output_path])
|
||||
|
||||
def process_file(src_path, dest_path):
|
||||
_, file_extension = os.path.splitext(src_path)
|
||||
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
|
||||
if file_extension.lower() == '.js':
|
||||
minify_js(src_path, dest_path)
|
||||
elif file_extension.lower() == '.css':
|
||||
minify_css(src_path, dest_path)
|
||||
elif file_extension.lower() in ['.html', '.htm']:
|
||||
minify_html(src_path, dest_path)
|
||||
else:
|
||||
shutil.copy2(src_path, dest_path)
|
||||
|
||||
def strip_files(src_dir, dest_dir):
|
||||
os.makedirs(dest_dir, exist_ok=True)
|
||||
for root, _, files in os.walk(src_dir):
|
||||
for filename in files:
|
||||
src_path = os.path.join(root, filename)
|
||||
rel_path = os.path.relpath(src_path, src_dir)
|
||||
dest_path = os.path.join(dest_dir, rel_path)
|
||||
process_file(src_path, dest_path)
|
||||
|
||||
def gzip_file(src_path, dst_path):
|
||||
with open(src_path, 'rb') as src, gzip.open(dst_path, 'wb') as dst:
|
||||
for chunk in iter(lambda: src.read(4096), b""):
|
||||
dst.write(chunk)
|
||||
|
||||
def getListOfFiles(dirName):
|
||||
entries = os.listdir(dirName)
|
||||
allFiles = []
|
||||
for entry in entries:
|
||||
fullPath = os.path.join(dirName, entry)
|
||||
if os.path.isdir(fullPath):
|
||||
allFiles += getListOfFiles(fullPath)
|
||||
else:
|
||||
allFiles.append(fullPath)
|
||||
return allFiles
|
||||
|
||||
def safe_relpath(path, start):
|
||||
return os.path.relpath(path, start).replace("\\", "/")
|
||||
|
||||
def gzip_webfiles(source, target, env):
|
||||
filetypes_to_gzip = ['.css', '.png', '.js', '.ico', '.woff2', '.json']
|
||||
print('\nGZIP: Starting gzip-Process for LittleFS-Image...\n')
|
||||
src_dir = os.path.join(env.get('PROJECT_DIR'), 'data_src')
|
||||
temp_dir = os.path.join(env.get('PROJECT_DIR'), 'data_stripped')
|
||||
dst_dir = env.get('PROJECT_DATA_DIR')
|
||||
|
||||
strip_files(src_dir, temp_dir)
|
||||
|
||||
if os.path.exists(dst_dir):
|
||||
shutil.rmtree(dst_dir)
|
||||
os.mkdir(dst_dir)
|
||||
|
||||
files_to_copy = []
|
||||
files_to_gzip = []
|
||||
|
||||
for file in getListOfFiles(temp_dir):
|
||||
_, ext = os.path.splitext(file)
|
||||
if ext in filetypes_to_gzip:
|
||||
files_to_gzip.append(file)
|
||||
else:
|
||||
files_to_copy.append(safe_relpath(file, temp_dir))
|
||||
|
||||
for file in files_to_copy:
|
||||
full_dst = os.path.join(dst_dir, file)
|
||||
os.makedirs(os.path.dirname(full_dst), exist_ok=True)
|
||||
shutil.copy(os.path.join(temp_dir, file), full_dst)
|
||||
|
||||
was_error = False
|
||||
try:
|
||||
for src in files_to_gzip:
|
||||
rel_path = safe_relpath(src, temp_dir)
|
||||
dst_path = os.path.join(dst_dir, rel_path + '.gz')
|
||||
os.makedirs(os.path.dirname(dst_path), exist_ok=True)
|
||||
print('GZIP: compressing... ' + rel_path)
|
||||
gzip_file(src, dst_path)
|
||||
except IOError as e:
|
||||
was_error = True
|
||||
print('GZIP: Fehler beim Komprimieren:', e)
|
||||
|
||||
if was_error:
|
||||
print('⚠️ GZIP: Nicht alle Dateien konnten verarbeitet werden.\n')
|
||||
else:
|
||||
print('✅ GZIP: Komprimierung abgeschlossen.\n')
|
||||
shutil.rmtree(temp_dir)
|
||||
|
||||
def gzip_binffiles(source, target, env):
|
||||
littlefsbin = target[0].get_abspath()
|
||||
tmpbin = os.path.join(os.path.dirname(littlefsbin), 'filesystem.fs')
|
||||
shutil.copyfile(littlefsbin, tmpbin)
|
||||
gzip_file(tmpbin, tmpbin + '.gz')
|
||||
os.remove(tmpbin)
|
||||
|
||||
# Hooks setzen
|
||||
env.AddPreAction('$BUILD_DIR/littlefs.bin', gzip_webfiles)
|
||||
env.AddPostAction('$BUILD_DIR/littlefs.bin', gzip_binffiles)
|
87
Software/codegen/run_pre.py
Normal file
@@ -0,0 +1,87 @@
|
||||
# run_pre.py — PlatformIO pre-build script
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
Import("env") # provided by PlatformIO
|
||||
|
||||
# ---- helper ----
|
||||
def parse_ver(s: str):
|
||||
"""
|
||||
Accepts '1.04', '1.4', '1,04' etc. -> returns (major:int, minor:int, norm_str:'1.04')
|
||||
"""
|
||||
s = (s or "").strip().replace(",", ".")
|
||||
if not s:
|
||||
return 0, 0, "0.00"
|
||||
parts = s.split(".")
|
||||
try:
|
||||
major = int(parts[0])
|
||||
minor = int(parts[1]) if len(parts) > 1 else 0
|
||||
except ValueError:
|
||||
major, minor = 0, 0
|
||||
norm_str = f"{major}.{minor:02d}"
|
||||
return major, minor, norm_str
|
||||
|
||||
def read_text_file(p: Path):
|
||||
try:
|
||||
return p.read_text(encoding="utf-8").strip()
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
def git_short_hash():
|
||||
try:
|
||||
out = subprocess.check_output(
|
||||
["git", "rev-parse", "--short", "HEAD"],
|
||||
stderr=subprocess.DEVNULL
|
||||
).decode("utf-8").strip()
|
||||
return out or "nogit"
|
||||
except Exception:
|
||||
return "nogit"
|
||||
|
||||
# ---- ensure jinja present, like before ----
|
||||
env.Execute("\"$PYTHONEXE\" -m pip install jinja2")
|
||||
|
||||
# ---- keep your other pre-steps ----
|
||||
import struct2json
|
||||
import dtcs
|
||||
struct2json.struct2json()
|
||||
dtcs.build_dtcs()
|
||||
|
||||
# ---- collect inputs ----
|
||||
proj_dir = Path(env["PROJECT_DIR"])
|
||||
|
||||
# user options from platformio.ini
|
||||
pcb_rev = env.GetProjectOption("custom_pcb_revision", default="")
|
||||
fw_ver_opt = env.GetProjectOption("custom_firmware_version", default="") # new
|
||||
|
||||
# required flash version from data/version
|
||||
req_file = proj_dir / "data" / "version"
|
||||
req_ver_raw = read_text_file(req_file)
|
||||
|
||||
fw_major, fw_minor, fw_norm = parse_ver(fw_ver_opt)
|
||||
req_major, req_minor, req_norm = parse_ver(req_ver_raw)
|
||||
|
||||
githash = git_short_hash()
|
||||
|
||||
# ---- export as preprocessor defines ----
|
||||
# numeric defines
|
||||
env.Append(CPPDEFINES=[
|
||||
("FW_VERSION_MAJOR", fw_major),
|
||||
("FW_VERSION_MINOR", fw_minor),
|
||||
("REQ_FLASH_MAJOR", req_major),
|
||||
("REQ_FLASH_MINOR", req_minor),
|
||||
])
|
||||
|
||||
# useful string defines (if du sie im Code/Logging brauchst)
|
||||
env.Append(CPPDEFINES=[
|
||||
("FW_VERSION_STR", f"\"{fw_norm}\""),
|
||||
("REQ_FLASH_STR", f"\"{req_norm}\""),
|
||||
("GIT_REV", f"\"{githash}\""),
|
||||
])
|
||||
|
||||
# ---- build artifact name ----
|
||||
# bisher: firmware_pcb_1.<pcb>.fw
|
||||
# jetzt: firmware_pcb_<pcb>_v<fw>_<git>.fw (gut identifizierbar)
|
||||
pcb_part = f"{pcb_rev}".strip() or "X"
|
||||
fname = f"firmware_pcb_{pcb_part}_v{fw_norm}_{githash}.fw"
|
||||
env.Replace(PROGNAME=fname)
|
113
Software/codegen/struct2json.py
Normal file
@@ -0,0 +1,113 @@
|
||||
import os
|
||||
import time
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
import re
|
||||
|
||||
import filechecksum as fcs
|
||||
|
||||
# Pfad zur Eingabedatei und Ausgabedatei
|
||||
input_file = "include/config.h"
|
||||
output_sourcefile = "src/struct2json.cpp"
|
||||
output_headerfile = "include/struct2json.h"
|
||||
# Liste der zu suchenden Variablen/Structs
|
||||
variable_names = ['LubeConfig', 'PersistenceData']
|
||||
|
||||
def get_types(file_content, variable_names):
|
||||
result = {}
|
||||
|
||||
# Entferne Kommentare, um unerwünschte Störungen zu vermeiden
|
||||
file_content = re.sub(r'\/\*.*?\*\/', '', file_content, flags=re.DOTALL)
|
||||
file_content = re.sub(r'\/\/.*', '', file_content)
|
||||
|
||||
for var_name in variable_names:
|
||||
# Erstelle ein reguläres Ausdrucksmuster, um den Typ der Variable zu extrahieren
|
||||
pattern = re.compile(r'\b(?:extern\s+)?(\w+)\s+' + re.escape(var_name) + r'\s*;')
|
||||
match = pattern.search(file_content)
|
||||
|
||||
if match:
|
||||
# Extrahiere den Typ aus dem Treffer
|
||||
type_match = match.group(1)
|
||||
result[var_name] = type_match
|
||||
|
||||
return result
|
||||
|
||||
def extract_struct_fields(file_content, variable_types):
|
||||
result = {}
|
||||
|
||||
# Entferne Kommentare, um unerwünschte Störungen zu vermeiden
|
||||
file_content = re.sub(r'\/\*.*?\*\/', '', file_content, flags=re.DOTALL)
|
||||
file_content = re.sub(r'\/\/.*', '', file_content)
|
||||
|
||||
for var_name, var_type in variable_types.items():
|
||||
# Erstelle ein reguläres Ausdrucksmuster, um das Strukturfeld zu extrahieren
|
||||
pattern = re.compile(r'typedef\s+struct\s*{([^}]*)}\s*' + re.escape(var_type) + r'\s*;')
|
||||
match = pattern.search(file_content)
|
||||
|
||||
if match:
|
||||
# Extrahiere die Felder aus dem Treffer
|
||||
fields_match = re.findall(r'\b(\w+)\s+(\w+)(?:\[(\d+)\])?\s*;', match.group(1))
|
||||
if fields_match:
|
||||
result[var_name] = {'type': var_type, 'fields': {}}
|
||||
for field_type, field_name, array_size in fields_match:
|
||||
if array_size:
|
||||
result[var_name]['fields'][field_name] = {'type': field_type, 'size': int(array_size)}
|
||||
else:
|
||||
result[var_name]['fields'][field_name] = {'type': field_type}
|
||||
|
||||
return result
|
||||
|
||||
def struct2json():
|
||||
# Überprüfen, ob die Verzeichnisse existieren, andernfalls erstellen
|
||||
output_dir_source = os.path.dirname(output_sourcefile)
|
||||
if not os.path.exists(output_dir_source):
|
||||
os.makedirs(output_dir_source)
|
||||
output_dir_header = os.path.dirname(output_headerfile)
|
||||
if not os.path.exists(output_dir_header):
|
||||
os.makedirs(output_dir_header)
|
||||
|
||||
# Unix-Zeitstempel hinzufügen
|
||||
timestamp = int(time.time())
|
||||
|
||||
# Parse structs
|
||||
with open(input_file, 'r') as file:
|
||||
content = file.read()
|
||||
|
||||
variable_types = get_types(content, variable_names)
|
||||
structs = extract_struct_fields(content, variable_types)
|
||||
checksum = fcs.calculate_checksum(structs)
|
||||
|
||||
env = Environment(loader=FileSystemLoader('codegen/templates', encoding='utf-8'))
|
||||
# Lade das Jinja2-Template aus der Datei
|
||||
template_c = env.get_template('struct2json.cpp.j2')
|
||||
template_h = env.get_template('struct2json.h.j2')
|
||||
|
||||
# Erstelle ein Context-Dictionary mit den erforderlichen Daten
|
||||
context = {
|
||||
'timestamp_unix': timestamp,
|
||||
'timestamp' : time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)),
|
||||
'date' : time.strftime('%d.%m.%Y', time.localtime(timestamp)),
|
||||
'structs': structs,
|
||||
'checksum': checksum
|
||||
}
|
||||
|
||||
# Überprüfe, ob die Checksummen übereinstimmen
|
||||
if fcs.read_and_compare_checksum(output_sourcefile, checksum):
|
||||
print("Keine Änderungen in der Source-Datei erforderlich.")
|
||||
else:
|
||||
# Rendere das Template mit den Werten und erhalte den Source-Text
|
||||
source_text = template_c.render(context)
|
||||
# Schreibe den generierten Source-Text in die Source-Datei
|
||||
with open(output_sourcefile, "w", encoding='utf-8') as f:
|
||||
f.write(source_text)
|
||||
print(f"Source-Datei wurde erstellt: {output_sourcefile}")
|
||||
|
||||
# Überprüfe, ob die Checksummen übereinstimmen
|
||||
if fcs.read_and_compare_checksum(output_headerfile, checksum):
|
||||
print("Keine Änderungen in der Header-Datei erforderlich.")
|
||||
else:
|
||||
# Rendere das Template mit den Werten und erhalte den Header-Text
|
||||
header_text = template_h.render(context)
|
||||
# Schreibe den generierten Header-Text in die Header-Datei
|
||||
with open(output_headerfile, "w", encoding='utf-8') as f:
|
||||
f.write(header_text)
|
||||
print(f"Header-Datei wurde erstellt: {output_headerfile}")
|
54
Software/codegen/templates/dtc_defs.h.j2
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file dtc_defs.h
|
||||
*
|
||||
* @brief Header file for Diagnostic Trouble Code (DTC) definitions in the ChainLube application.
|
||||
*
|
||||
* This file contains definitions for Diagnostic Trouble Codes (DTC) in the ChainLube project.
|
||||
* It includes enums for DTC active status, severity levels, and specific DTC codes.
|
||||
* The file also defines an array of DTC definitions and a timestamp indicating the generation time.
|
||||
*
|
||||
* @note This file is auto-generated by a script on {{ timestamp }}.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date {{ date }}
|
||||
*/
|
||||
|
||||
#ifndef DTC_DEFS_H
|
||||
#define DTC_DEFS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint32_t DTCNum_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DTC_INACTIVE,
|
||||
DTC_ACTIVE,
|
||||
DTC_PREVIOUS
|
||||
} DTCActive_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DTC_NONE,
|
||||
DTC_INFO,
|
||||
DTC_WARN,
|
||||
DTC_CRITICAL
|
||||
} DTCSeverity_t;
|
||||
|
||||
typedef struct {
|
||||
DTCNum_t code;
|
||||
DTCSeverity_t severity;
|
||||
} DTC_t;
|
||||
|
||||
{% for dtc in dtc_macros -%}
|
||||
{{ dtc }}
|
||||
{% endfor %}
|
||||
const DTC_t dtc_definitions[] = {
|
||||
{% for struct in dtc_structs -%}
|
||||
{{ struct }}
|
||||
{% endfor -%}
|
||||
};
|
||||
|
||||
#endif // DTC_DEFS_H
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: {{ checksum }}
|
25
Software/codegen/templates/struct2json.cpp.j2
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @file struct2json.cpp
|
||||
*
|
||||
* @brief Implementation file for converting structs to JSON objects.
|
||||
*
|
||||
* @note This file is auto-generated by a script on {{ timestamp }}.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date {{ date }}
|
||||
*/
|
||||
|
||||
|
||||
#include "struct2json.h"
|
||||
|
||||
{% for var_name, var_info in structs.items() -%}
|
||||
void generateJsonObject_{{ var_name }}(JsonObject data)
|
||||
{
|
||||
{% for field_name, field_type in var_info['fields'].items() -%}
|
||||
data["{{ field_name }}"] = {{ var_name }}.{{ field_name }};
|
||||
{% endfor -%}
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: {{ checksum }}
|
26
Software/codegen/templates/struct2json.h.j2
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @file struct2json.h
|
||||
*
|
||||
* @brief Header file for converting structs to JSON objects.
|
||||
*
|
||||
* @note This file is auto-generated by a script on {{ timestamp }}.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date {{ date }}
|
||||
*/
|
||||
|
||||
#ifndef _STRUCT2JSON_H_
|
||||
#define _STRUCT2JSON_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
{% for var_name, var_info in structs.items() -%}
|
||||
void generateJsonObject_{{ var_name }}(JsonObject data);
|
||||
{% endfor %}
|
||||
|
||||
#endif /* _STRUCT2JSON_H_ */
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: {{ checksum }}
|
@@ -1,510 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>KTM CAN Chain Oiler</title>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="static/css/custom.css">
|
||||
<script src="static/js/jquery.min.js"></script>
|
||||
<script src="static/js/bootstrap.min.js"></script>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
|
||||
<link rel="manifest" href="static/img/site.webmanifest">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-default fixed-top">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="#">
|
||||
<img src="static/img/logo.png" width="30" height="30" class="d-inline-block align-top" alt="">
|
||||
KTM CAN ChainLube
|
||||
</a>
|
||||
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Collection of nav links, forms, and other content for toggling -->
|
||||
<div id="navbarCollapse" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a data-toggle="tab" href="#tab_home">Home</a></li>
|
||||
<li><a data-toggle="tab" href="#tab_source">Wegstrecke</a></li>
|
||||
<li><a data-toggle="tab" href="#tab_lube">Schmierung</a></li>
|
||||
<li><a data-toggle="tab" href="#tab_tank">Öltank</a></li>
|
||||
<li><a data-toggle="tab" href="#tab_maintenance">Wartung</a></li>
|
||||
<li><a data-toggle="tab" href="#tab_sysinfo">Systeminfo</a></li>
|
||||
<li><a data-toggle="tab" href="#tab_fwupdate">Update</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main role="main" class="container">
|
||||
|
||||
<!-- Tabs Content -->
|
||||
<div class="tab-content">
|
||||
<!-- Div Tab Home-->
|
||||
<div id="tab_home" class="tab-pane fade in active">
|
||||
<div class="col text-center">
|
||||
<div class="jumbotron">
|
||||
|
||||
<img src="static/img/logo.png" width="120" height="120" class="img-fluid" alt="">
|
||||
<h3>KTM CAN Chain Lube</h3>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<p>
|
||||
<h4>Tankinhalt verbleibend</h4>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="%TANK_REMAIN_CAPACITY%" aria-valuemin="0"
|
||||
aria-valuemax="100" style="width: %TANK_REMAIN_CAPACITY%%">
|
||||
%TANK_REMAIN_CAPACITY%%
|
||||
</div>
|
||||
</div>
|
||||
<h4>aktueller Modus</h4>
|
||||
<input class="form-control" type="text" placeholder="%SYSTEM_STATUS%" readonly>
|
||||
<div %SHOW_DTC_TABLE%>
|
||||
<h4>Fehlercodes</h4>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-md-4" scope="col">Timestamp</td>
|
||||
<th class="col-md-4" scope="col">DTC</td>
|
||||
<th class="col-md-4" scope="col">active</td>
|
||||
</tr>
|
||||
%DTC_TABLE%
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tab Home-->
|
||||
<!-- Div Tab Source Settings-->
|
||||
<div id="tab_source" class="tab-pane fade">
|
||||
<h3>Erfassung Wegstrecke</h3>
|
||||
<hr>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="sourceselect" class="control-label col-xs-5">Wegstrecke Quelle</label>
|
||||
<div class="col-xs-7">
|
||||
<select id="sourceselect" name="sourceselect" class="select form-control">
|
||||
%SOURCE_SELECT_OPTIONS%
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="sourcesave" type="submit" class="btn btn-primary">Übernehmen</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
<div class="alert alert-warning">
|
||||
<strong>Achtung!</strong><br>
|
||||
Bei Änderung der Wegstrecken-Quelle wird der CAN-Oiler neu gestartet.
|
||||
Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
|
||||
</div>
|
||||
<!-- Div Source:Impulse Settings-->
|
||||
<div %SHOW_IMPULSE_SETTINGS%>
|
||||
<h4>Einstellungen Impuls</h4>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="tirewidth" class="control-label col-xs-5">Reifenbreite</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="tirewidth" name="tirewidth" type="text" required="required" class="form-control"
|
||||
value="%TIRE_WIDTH_MM%">
|
||||
<div class="input-group-addon">mm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tireratio" class="control-label col-xs-5">Höhe/Breite-Verhältniss</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="tireratio" name="tireratio" type="text" required="required" class="form-control"
|
||||
value="%TIRE_RATIO%">
|
||||
<div class="input-group-addon"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tiredia" class="control-label col-xs-5">Felgendurchmesser</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="tiredia" name="tiredia" type="text" required="required" class="form-control"
|
||||
value="%RIM_DIAMETER%">
|
||||
<div class="input-group-addon">"</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pulserev" class="control-label col-xs-5">Pulse pro Umdrehung</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="pulserev" name="pulserev" type="text" required="required" class="form-control"
|
||||
value="%PULSE_PER_REV%">
|
||||
<div class="input-group-addon"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="pulsesave" type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Source:Impulse Settings-->
|
||||
<!-- Div Source:CAN Settings-->
|
||||
<div %SHOW_CAN_SETTINGS%>
|
||||
<h4>Einstellungen CAN-Bus</h4>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="cansource" class="control-label col-xs-5">Model</label>
|
||||
<div class="col-xs-7">
|
||||
<select id="cansource" name="cansource" class="select form-control">
|
||||
%CANSOURCE_SELECT_OPTIONS%
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="cansave" type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Source:CAN Settings-->
|
||||
<!-- Div Source:GPS Settings-->
|
||||
<div %SHOW_GPS_SETTINGS%>
|
||||
<h4>Einstellungen GPS</h4>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="gpsbaud" class="control-label col-xs-5">Baudrate</label>
|
||||
<div class="col-xs-7">
|
||||
<select id="gpsbaud" name="gpsbaud" class="select form-control">
|
||||
%GPSBAUD_SELECT_OPTIONS%
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="gpssave" type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Source:GPS Settings-->
|
||||
</div>
|
||||
<!-- Div Tab Source Settings-->
|
||||
<!-- Div Tab Lube -->
|
||||
<div id="tab_lube" class="tab-pane fade">
|
||||
<h3>Schmierung</h3>
|
||||
<hr>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="lubedistancenormal" class="control-label col-xs-5">Modus:normal</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="lubedistancenormal" name="lubedistancenormal" value="%LUBE_DISTANCE_NORMAL%" type="text"
|
||||
class="form-control" required="required">
|
||||
<div class="input-group-addon">m</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lubedistancerain" class="control-label col-xs-5">Modus:rain</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="lubedistancerain" name="lubedistancerain" value="%LUBE_DISTANCE_RAIN%" type="text"
|
||||
class="form-control" required="required">
|
||||
<div class="input-group-addon">m</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="oilsave" type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tab Lube -->
|
||||
<!-- Div Tab Maintenance -->
|
||||
<div id="tab_maintenance" class="tab-pane fade">
|
||||
<h3>Wartung</h3>
|
||||
<hr>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="purgepulse" class="control-label col-xs-5">Entlüftung Impulse</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="purgepulse" name="purgepulse" value="%BLEEDING_PULSES%" type="text" class="form-control">
|
||||
<div class="input-group-addon"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="maintsave" type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="tankremain_maint" class="control-label col-xs-5">Tankinhalt verbleibend</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="progress">
|
||||
<div id="tankremain_maint" class="progress-bar" role="progressbar"
|
||||
aria-valuenow="%TANK_REMAIN_CAPACITY%" aria-valuemin="0" aria-valuemax="100"
|
||||
style="width: %TANK_REMAIN_CAPACITY%%">
|
||||
%TANK_REMAIN_CAPACITY%%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="resettank" type="submit" class="btn btn-primary">Tank zurücksetzen</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tab Maintenance -->
|
||||
<!-- Div Tank Settings-->
|
||||
<div id="tab_tank" class="tab-pane fade">
|
||||
<h3>Öltank</h3>
|
||||
<hr>
|
||||
<p>
|
||||
<form action="\post.htm" method="POST" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="tankcap" class="control-label col-xs-5">Tankkapazität</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="tankcap" name="tankcap" value="%TANK_CAPACITY%" type="text" class="form-control"
|
||||
required="required">
|
||||
<div class="input-group-addon">ml</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tankwarn" class="control-label col-xs-5">Leer-Warnung</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="tankwarn" name="tankwarn" value="%TANK_REMIND%" type="text" class="form-control"
|
||||
required="required">
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pumppulse" class="control-label col-xs-5">Menge pro Puls</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="pumppulse" name="pumppulse" value="%AMOUNT_PER_DOSE%" type="text" class="form-control"
|
||||
required="required">
|
||||
<div class="input-group-addon">µl</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="oilsave" type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tank Settings-->
|
||||
<!-- Div Tab SystemInfo -->
|
||||
<div id="tab_sysinfo" class="tab-pane fade">
|
||||
<h3>Systeminfo</h3>
|
||||
<hr>
|
||||
<h4>Einstellungen</h4>
|
||||
<p>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-md-8" scope="col">Parameter</td>
|
||||
<th class="col-md-4" scope="col">Value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DistancePerLube_Default</td>
|
||||
<td>%LUBE_DISTANCE_NORMAL%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DistancePerLube_Rain</td>
|
||||
<td>%LUBE_DISTANCE_RAIN%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tankCapacity_ml</td>
|
||||
<td>%TANK_CAPACITY%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>amountPerDose_µl</td>
|
||||
<td>%AMOUNT_PER_DOSE%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TankRemindAtPercentage</td>
|
||||
<td>%TANK_REMIND%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PulsePerRevolution</td>
|
||||
<td>%PULSE_PER_REV%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TireWidth_mm</td>
|
||||
<td>%TIRE_WIDTH_MM%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TireWidthHeight_Ratio</td>
|
||||
<td>%TIRE_RATIO%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RimDiameter_Inch</td>
|
||||
<td>%RIM_DIAMETER%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DistancePerRevolution_mm</td>
|
||||
<td>%DISTANCE_PER_REV%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BleedingPulses</td>
|
||||
<td>%BLEEDING_PULSES%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SpeedSource</td>
|
||||
<td>%SPEED_SOURCE%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>GPSBaudRate</td>
|
||||
<td>%GPS_BAUD%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CANSource</td>
|
||||
<td>%CAN_SOURCE%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Checksum</td>
|
||||
<td>%CONFIG_CHECKSUM%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<h4>Betriebsdaten</h4>
|
||||
<p>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-md-8" scope="col">Parameter</td>
|
||||
<th class="col-md-4" scope="col">Value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>writeCycleCounter</td>
|
||||
<td>%WRITE_CYCLE_COUNT%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PersistenceMarker</td>
|
||||
<td>%PERSISTENCE_MARKER%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>tankRemain_µl</td>
|
||||
<td>%TANK_REMAIN_UL%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TravelDistance_highRes</td>
|
||||
<td>%TRAVEL_DISTANCE_HIGHRES%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Odometer</td>
|
||||
<td>%ODOMETER%,%ODOMETER_M%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>checksum</td>
|
||||
<td>%PERSISTANCE_CHECKSUM%</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tab SystemInfo -->
|
||||
<!-- Div Tab Firmware Update-->
|
||||
<div id="tab_fwupdate" class="tab-pane fade">
|
||||
<h3>Firmware Update</h3>
|
||||
<hr>
|
||||
<h4>Version-Info</h4>
|
||||
<p>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Firmware Version</td>
|
||||
<td>%SW_VERSION%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flash Version</td>
|
||||
<td>%FS_VERSION%</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<hr>
|
||||
<h4>Firmware-Update</h4>
|
||||
<p>
|
||||
<form method='POST' action='/doUpdate' enctype='multipart/form-data'>
|
||||
<div class="form-group">
|
||||
<label for="fw-update-file" class="col-sm-2 col-form-label">Firmware-File</label>
|
||||
<div class="col-xs-7">
|
||||
<div class="input-group">
|
||||
<input id="fw-update-file" name="fw-update-file" type="file" class="form-control-file"
|
||||
required="required">
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-offset-5 col-xs-7">
|
||||
<button name="fw-update" type="submit" class="btn btn-primary">Aktualisieren</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tab Firmware Update-->
|
||||
</div>
|
||||
<!-- Tabs Content -->
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="navbar-default navbar-fixed-bottom">
|
||||
<div class="container-fluid">
|
||||
<!-- Copyright -->
|
||||
<div class="col text-center">
|
||||
© 2022 Copyright:
|
||||
<a class="text-reset fw-bold" href="https://eventronics.de/">Marcel Peterkau</a>
|
||||
</div>
|
||||
<!-- Copyright -->
|
||||
</div>
|
||||
</footer>
|
||||
<!-- Footer -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
1
Software/data/static/css/bootstrap.min.css
vendored
@@ -1 +0,0 @@
|
||||
kbd{border:1px solid #333}.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-color:#6a6a6a;border-color:#636363}.btn-default:hover{background-color:#6a6a6a}.btn-primary:hover{background-color:#404040}.btn-success:hover{background-color:#3d8b3d}.btn-info:hover{background-color:#28a1c5}.btn-danger:hover{background-color:#b52b27}.btn-warning:hover{background-color:#df8a13}.navbar-default .navbar-nav>li.active>a:hover{background-color:#222}.navbar-inverse .navbar-nav>li.active>a:hover{background-color:#444}.table{color:#fff}.table .primary,.table .info,.table .success,.table .warning,.table .danger{color:#fff}.table-hover tr:hover{cursor:pointer}.input-group-addon{color:#fff}.nav>li>a:hover{color:#fff}.pager>li>a:hover{color:#fff}a:focus{outline:0}a.list-group-item.active:hover{background-color:#4d4d4d}a.list-group-item-success,a.list-group-item-info,a.list-group-item-warning,a.list-group-item-danger,a.list-group-item-success:hover,a.list-group-item-info:hover,a.list-group-item-warning:hover,a.list-group-item-danger:hover{color:#fff}a.active.list-group-item-success,a.active.list-group-item-info,a.active.list-group-item-warning,a.active.list-group-item-danger,a.active.list-group-item-success:hover,a.active.list-group-item-info:hover,a.active.list-group-item-warning:hover,a.active.list-group-item-danger:hover{border-color:#666}a.active.list-group-item-success:hover{background-color:#3d8b3d}a.active.list-group-item-info:hover{background-color:#28a1c5}a.active.list-group-item-warning:hover{background-color:#df8a13}a.active.list-group-item-danger:hover{background-color:#b52b27}.list-group-item-success,.list-group-item-info,.list-group-item-warning,.list-group-item-danger{color:#fff}.alert-info,.alert-primary,.alert-warning,.alert-danger,.alert-success{color:#fff}.alert-info .alert-link,.alert-primary .alert-link,.alert-warning .alert-link,.alert-danger .alert-link,.alert-success .alert-link{color:#fff}
|
@@ -1 +0,0 @@
|
||||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
7
Software/data/static/js/bootstrap.min.js
vendored
@@ -1 +0,0 @@
|
||||
1
|
652
Software/data_src/index.htm
Normal file
@@ -0,0 +1,652 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>KTM CAN Chain Oiler</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="static/css/custom.css">
|
||||
<link rel="stylesheet" href="static/css/tweaks.css">
|
||||
<script src="static/js/jquery.min.js" defer></script>
|
||||
<script src="static/js/bootstrap.min.js" defer></script>
|
||||
<script src="static/js/websocket.js" defer></script>
|
||||
<script src="static/js/dtc_table.js" defer></script>
|
||||
<script src="static/js/script.js" defer></script>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
|
||||
<link rel="manifest" href="static/img/site.webmanifest">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Connection-Overlay -->
|
||||
<div id="overlay">
|
||||
<div class="overlay-content">
|
||||
<p>Verbinde...</p>
|
||||
<span class="loader"></span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Connection-Overlay -->
|
||||
<!-- Notification-Container -->
|
||||
<div id="notification-container" class="notification-container"></div>
|
||||
<!-- Notification-Container -->
|
||||
<nav class="navbar fixed-top navbar-dark bg-primary" id="navbar1">
|
||||
<a class="navbar-brand" href="#">
|
||||
<img src="static/img/logo.png" width="30" height="30" class="d-inline-block align-top mr-1" alt="">
|
||||
KTM CAN ChainLube
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar"
|
||||
aria-controls="collapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="collapsingNavbar">
|
||||
<ul class="navbar-nav nav mr-auto mt-2 mt-lg-0">
|
||||
|
||||
<li class="nav-item"><a class="nav-link active" role="tab" data-toggle="tab" href="#tab_home">Home</a></li>
|
||||
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_maintenance">Wartung</a></li>
|
||||
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_source">Einstellungen</a></li>
|
||||
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_fwupdate">Update</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container">
|
||||
|
||||
<!-- Tabs Content -->
|
||||
<div class="tab-content">
|
||||
<!-- Div Tab Home-->
|
||||
<div id="tab_home" class="tab-pane fade show active" role="tabpanel">
|
||||
<div class="col text-center">
|
||||
<div class="jumbotron">
|
||||
<img src="static/img/logo.png" width="120" height="120" class="img-fluid" alt="">
|
||||
<h3 class="pt-3">KTM CAN Chain Lube</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Div Group Tank remain -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Tankinhalt verbleibend</h4>
|
||||
<div class="progress">
|
||||
<div id="tankremain" class="data-tankremain progress-bar text-light" role="progressbar" aria-valuenow="0"
|
||||
aria-valuemin="0" aria-valuemax="100" style="width: 0%">
|
||||
0
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Tank remain -->
|
||||
<!-- Div Group current Mode -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>aktueller Modus</h4>
|
||||
<input class="data-systemstatus form-control" type="text" id="sysstatus" readonly>
|
||||
</p>
|
||||
<!-- Div Group current Mode -->
|
||||
<!-- Div Group DTC Table -->
|
||||
<div id="dtc_container" hidden>
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Fehlercodes</h4>
|
||||
<table class="table" id="dtc_table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-6" scope="col">Zeitstempel</th>
|
||||
<th class="col-2" scope="col">Fehlercode</th>
|
||||
<th class="col-2" scope="col">Schwere</th>
|
||||
<th class="col-2" scope="col">Aktiv</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Group DTC Table -->
|
||||
</div>
|
||||
<!-- Div Tab Home-->
|
||||
|
||||
<!-- Div Tab Maintenance -->
|
||||
<div id="tab_maintenance" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Wartung</h3>
|
||||
<!-- Div Group Tank remain -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Ölvorrat</h4>
|
||||
<div class="form-group row">
|
||||
<label for="tankremain_maint" class="control-label col-4">Tankinhalt verbleibend</label>
|
||||
<div class="col-8">
|
||||
<div class="progress">
|
||||
<div id="tankremain_maint" class="data-tankremain progress-bar text-light" role="progressbar"
|
||||
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
|
||||
style="width: 0%">0%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="resettank" class="btn-wsevent confirm btn btn-outline-primary ml-2">Tank zurücksetzen</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Tank remain -->
|
||||
<!-- Div Group Purging -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Entlüftung</h4>
|
||||
<div class="form-group row">
|
||||
<label for="bleedingpulses" class="control-label col-4">Entlüftung Dosierung</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="bleedingpulses" value="0" type="text" class="set-wsevent data-bleedingpulses form-control">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">Pulse</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="purgenow" class="btn-wsevent btn btn-outline-primary ml-2">Entlüftung starten</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Purging -->
|
||||
<!-- Div Group Measure -->
|
||||
<div %SHOW_IMPULSE_SETTINGS%>
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Einmessen</h4>
|
||||
<div class="form-group row">
|
||||
<label for="measuredpulses" class="control-label col-4">erfasste Pulse</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="measuredpulses" name="measuredpulses" value="0" type="text" readonly class="form-control">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">Pulse</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="measurestartstop" class="btn-wsevent btn btn-outline-primary">Start</button>
|
||||
<button id="measurereset" class="btn-wsevent btn btn-outline-primary ml-2">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Group Purging -->
|
||||
<!-- Div Group LiveDebug -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Live Debug</h4>
|
||||
<div class="form-group row">
|
||||
<textarea class="form-control" spellcheck="false" id="livedebug-out" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="debugstart" class="btn-wsevent btn btn-outline-primary ml-2">Start</button>
|
||||
<button id="debugstop" class="btn-wsevent btn btn-outline-primary ml-2">Stop</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
<h4>CAN / OBD2 Trace</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col">
|
||||
<div class="text-center mb-2">
|
||||
<!-- Beide Start-Buttons senden btn-trace-start; Modus kommt als value -->
|
||||
<button id="trace-start" data-wsid="trace-start" value="raw" class="btn-wsevent btn btn-outline-primary">
|
||||
Start CAN-Trace
|
||||
</button>
|
||||
<button id="trace-start-obd" data-wsid="trace-start" value="obd" class="btn-wsevent btn btn-outline-primary ml-2">
|
||||
Start OBD-Trace
|
||||
</button>
|
||||
<button id="trace-stop" class="btn-wsevent btn btn-outline-danger ml-2">
|
||||
Stop
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<textarea id="trace-out" class="form-control" style="font-family:monospace" rows="8" readonly spellcheck="false"></textarea>
|
||||
<small id="trace-status" class="form-text text-muted">Trace inaktiv</small>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group LiveDebug -->
|
||||
<!-- Div Group Device Reboot -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Gerät neustarten</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="reboot" class="btn-wsevent confirm btn btn-outline-primary">Reboot</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Device Reboot -->
|
||||
</div>
|
||||
<!-- Div Tab Maintenance -->
|
||||
|
||||
<!-- Div Tab Settings-->
|
||||
<div id="tab_source" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Einstellungen</h3>
|
||||
<!-- Div Group Signal Source -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Signalquelle</h4>
|
||||
<div class="form-group row">
|
||||
<label for="speedsource" class="control-label col-4">Schnittstelle</label>
|
||||
<div class="col-8">
|
||||
<select id="speedsource" class="set-wsevent data-speedsource select form-control">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-primary alert-dismissable show fade" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong>Achtung!</strong><br>
|
||||
Bei Änderung der Signalquelle wird der CAN-Oiler neu gestartet.
|
||||
Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="sourcesave" class="btn-wsevent confirm btn btn-outline-primary">Übernehmen</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Signal Source -->
|
||||
<!-- Div Group Source:Impulse Settings-->
|
||||
<div id="showimpulse" class="data-showimpulse hideable">
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Einstellungen Impulseingang</h4>
|
||||
<div class="form-group row">
|
||||
<label for="tirewidth" class="control-label col-4">Reifenbreite</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="tirewidth" type="text" required="required" class="set-wsevent data-tirewidth form-control">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">mm</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="tireratio" class="control-label col-4">Höhe/Breite-Verhältniss</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="tireratio" type="text" required="required" class="set-wsevent data-tireratio form-control">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">mm</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="tiredia" class="control-label col-4">Felgendurchmesser</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="tiredia" type="text" required="required" class="set-wsevent data-tiredia form-control">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">"</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="pulserev" class="control-label col-4">Pulse pro Umdrehung</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="pulserev" type="text" required="required" class="set-wsevent data-pulserev form-control">
|
||||
<div class="input-group-addon"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Group Source:Impulse Settings-->
|
||||
<!-- Div Group Source:CAN Settings-->
|
||||
<div id="showcan" class="data-showcan hideable">
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Einstellungen CAN-Bus</h4>
|
||||
<div class="form-group row">
|
||||
<label for="cansource" class="control-label col-4">Model</label>
|
||||
<div class="col-8">
|
||||
<select id="cansource" class="set-wsevent data-cansource select form-control">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Group Source:CAN Settings-->
|
||||
<!-- Div Group Source:GPS Settings-->
|
||||
<div id="showgps" class="data-showgps hideable">
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Einstellungen GPS</h4>
|
||||
<div class="form-group row">
|
||||
<label for="gpsbaud" class="control-label col-4">Baudrate</label>
|
||||
<div class="col-8">
|
||||
<select id="gpsbaud" class="set-wsevent data-gpsbaud select form-control">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Group Source:GPS Settings-->
|
||||
<!-- Div Group Lube Settings-->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Dosierung</h4>
|
||||
<div class="form-group row">
|
||||
<label for="lubedistancenormal" class="control-label col-4">Normal (grün)</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="lubedistancenormal" type="text"
|
||||
class="set-wsevent data-lubedistancenormal form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">m</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="lubedistancerain" class="control-label col-4">Regen (blau)</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="lubedistancerain" type="text"
|
||||
class="set-wsevent data-lubedistancerain form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">m</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="washdistance" class="control-label col-4">Waschmodus Distanz</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="washdistance" type="text"
|
||||
class="set-wsevent data-washdistance form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">m</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="washinterval" class="control-label col-4">Waschmodus Interval</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="washinterval" type="text"
|
||||
class="set-wsevent data-washinterval form-control" required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">m</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</p>
|
||||
<!-- Div Group Lube Settings-->
|
||||
<!-- Div Group Oiltank Settings -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Öltank</h4>
|
||||
<div class="form-group row">
|
||||
<label for="tankcap" class="control-label col-4">Tankkapazität</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="tankcap" type="text" class="set-wsevent data-tankcap form-control"
|
||||
required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">ml</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="tankwarn" class="control-label col-4">Leer-Warnung</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="tankwarn" type="text" class="set-wsevent data-tankwarn form-control"
|
||||
required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="pumppulse" class="control-label col-4">Menge pro Puls</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="pumppulse" type="text" class="set-wsevent data-pumppulse form-control"
|
||||
required="required">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">µl</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group Oiltank Settings -->
|
||||
<!-- Div Group LED Settings-->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>LED Einstellungen</h4>
|
||||
<div class="form-group row">
|
||||
<label for="ledmodeflash" class="control-label col-4">LED Modus blinken</label>
|
||||
<div class="col-8">
|
||||
<div class="form-check">
|
||||
<input class="set-wsevent data-ledmodeflash form-check-input" type="checkbox" id="ledmodeflash">
|
||||
<label class="form-check-label" for="ledmodeflash">
|
||||
LED blinken
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ledmaxbrightness" class="control-label col-4">Max Helligkeit</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="ledmaxbrightness" type="text" class="set-wsevent data-ledmaxbrightness form-control" required="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="ledminbrightness" class="control-label col-4">Min Helligkeit</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<input id="ledminbrightness" type="text" class="set-wsevent data-ledminbrightness form-control" required="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group LED Settings-->
|
||||
<!-- Div Group WiFi Settings-->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>WiFi Einstellungen</h4>
|
||||
<div class="form-group row">
|
||||
<label for="wifi-ssid" class="control-label col-4">WiFi SSID</label>
|
||||
<div class="col-8">
|
||||
<select id="wifi-ssid" class="set-wsevent data-wifi-ssid select form-control">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="wifi-pass" class="control-label col-4">WiFi Passwort</label>
|
||||
<div class="col-8">
|
||||
<div class="input-group" id="show_hide_password">
|
||||
<input id="wifi-pass" type="password" minlength="8" maxlength="63" class="set-wsevent data-wifi-pass form-control">
|
||||
<div class="input-group-addon">
|
||||
<a href=""><i class="fa fa-eye-slash" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="wifi-conavailable" class="control-label col-4">automatisch verbinden</label>
|
||||
<div class="col-8">
|
||||
<div class="form-check">
|
||||
<input class="set-wsevent data-wifi-conavailable form-check-input" type="checkbox" id="wifi-conavailable">
|
||||
<label class="form-check-label" for="wifi-conavailable">
|
||||
verbinden wenn verfügbar
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group WiFi Settings-->
|
||||
<!-- Div Group Save Button-->
|
||||
<hr />
|
||||
<p>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button id="settingssave" class="btn-wsevent btn btn-outline-primary">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<!-- Div Tab Settings -->
|
||||
|
||||
<!-- Div Tab Firmware Update-->
|
||||
<div id="tab_fwupdate" class="tab-pane fade" role="tabpanel">
|
||||
<h3>Firmware</h3>
|
||||
<!-- Div Group VersionInfo -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Version-Info</h4>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="col-7" scope="col">Parameter</th>
|
||||
<th class="col-5" scope="col">Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Firmware Version</td>
|
||||
<td class="data-fw-version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Benötigte Flash Version</td>
|
||||
<td class="data-req-flash-version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Installierte Flash Version</td>
|
||||
<td class="data-flash-version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Git Revision</td>
|
||||
<td class="data-git-rev"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<!-- Div Group VersionInfo -->
|
||||
<!-- Div Group EEPROM Backup -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>EEPROM-Backup</h4>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-outline-primary" href="eejson" role="button" id="ee-backup-download">Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
<!-- Div Group EEPROM Backup -->
|
||||
<!-- Div Group EEPROM Restore -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>EEPROM-Restore</h4>
|
||||
<form method='POST' action='eeRestore' enctype='multipart/form-data'>
|
||||
<div class="form-group row">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="ee-restore-file" class="custom-file-input" id="ee-restore-file" accept=".ee.json"
|
||||
required />
|
||||
<label class="custom-file-label" for="ee-restore-file">EEPROM-Backup auswählen</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button name="submit" type="submit" class="btn btn-outline-primary">Restore starten</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
<!-- Div Group EEPROM Restore -->
|
||||
<!-- Div Group Firmware Update -->
|
||||
<hr />
|
||||
<p>
|
||||
<h4>Firmware-Update</h4>
|
||||
<form method='POST' action='doUpdate' enctype='multipart/form-data'>
|
||||
<div class="form-group row">
|
||||
<div class="custom-file">
|
||||
<input type="file" name="fw-update-file" class="custom-file-input" id="fw-update-file"
|
||||
accept=".fw.bin,.fs.gz" required />
|
||||
<label class="custom-file-label" for="fw-update-file">Firmware-Update auswählen</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col text-center">
|
||||
<button name="submit" type="submit" class="btn btn-outline-primary">Update starten</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
<!-- Div Group Firmware Update -->
|
||||
</div>
|
||||
<!-- Div Tab Firmware Update-->
|
||||
</div>
|
||||
<!-- Tabs Content -->
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
<footer class="page-footer navbar-dark bg-primary font-small fixed-bottom">
|
||||
<div class="container-fluid text-center">
|
||||
<div class="footer-copyright text-center py-3">
|
||||
<span class="text-muted">© 2023 -
|
||||
<a class="text-reset fw-bold" href="https://eventronics.de/">Marcel Peterkau</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
<!-- Modal Dialog -->
|
||||
|
||||
<div class="modal fade" id="dtcModal" tabindex="-1" role="dialog" aria-labelledby="dtcModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="dtcModalLabel">DTC-Description</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="dtc-desc">DTC Description</p>
|
||||
<p class="dtc-debugval">DTC DebugVal</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Dialog -->
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -14,7 +14,7 @@
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
|
||||
<link rel="manifest" href="static/img/site.webmanifest">
|
||||
<meta http-equiv="refresh" content="3; url='/index.htm'" />
|
||||
<meta http-equiv="refresh" content="3; url='index.htm'" />
|
||||
</head>
|
||||
|
||||
<body>
|
10003
Software/data_src/static/css/bootstrap.min.css
vendored
Normal file
8441
Software/data_src/static/css/custom.css
Normal file
90
Software/data_src/static/css/tweaks.css
Normal file
@@ -0,0 +1,90 @@
|
||||
@font-face {
|
||||
font-family: 'Comfortaa';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: url(../fonts/comfortaa.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
body {
|
||||
padding-top: 70px;
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 2px;
|
||||
border-width: 0;
|
||||
color: gray;
|
||||
background-color: gray
|
||||
}
|
||||
|
||||
.dtc-debugval {
|
||||
color: #F2771A;
|
||||
font: 0.8rem Inconsolata, monospace;
|
||||
background-color: black;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.8); /* Dunkler Hintergrund mit Transparenz */
|
||||
color: white; /* Textfarbe */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999; /* Stellen Sie sicher, dass es über anderen Elementen liegt */
|
||||
}
|
||||
|
||||
.overlay-content {
|
||||
text-align: center;
|
||||
font-size: 4rem;
|
||||
}
|
||||
|
||||
.loader {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border: 12px solid #FFF;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
animation: rotation 1s linear infinite;
|
||||
}
|
||||
.loader::after {
|
||||
content: '';
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 50%;
|
||||
border: 12px solid transparent;
|
||||
border-bottom-color: #FF3D00;
|
||||
}
|
||||
|
||||
@keyframes rotation {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.notification-container {
|
||||
position: fixed;
|
||||
top: 30%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.notification {
|
||||
margin-bottom: 20px; /* Fügen Sie bei Bedarf weitere Stile hinzu */
|
||||
}
|
121
Software/data_src/static/dtc_table.json
Normal file
@@ -0,0 +1,121 @@
|
||||
{
|
||||
"codegenerator_checksum": "15e9152fb712bc6ed7c3353a05b1b54dc697f3e489a6e1ff42b7e57f0fa094d4",
|
||||
"timestamp": "2025-05-04 12:01:55",
|
||||
"dtc_table_data": [
|
||||
{
|
||||
"num": 0,
|
||||
"title": "No Error",
|
||||
"description": "No Error"
|
||||
},
|
||||
{
|
||||
"num": 1,
|
||||
"title": "Ölvorrat leer",
|
||||
"description": "Ölvorrat ist komplett leer. Den Ölvorrat auffüllen und im Menu 'Wartung' zurück setzen"
|
||||
},
|
||||
{
|
||||
"num": 2,
|
||||
"title": "Ölvorrat niedrig",
|
||||
"description": "Ölvorrat ist unter der Warnschwelle. Den Ölvorrat demnächst auffüllen und im Menu 'Wartung' zurück setzen"
|
||||
},
|
||||
{
|
||||
"num": 3,
|
||||
"title": "kein EEPROM erkannt",
|
||||
"description": "Es wurde kein EEPROM gefunden. Dies lässt einen Hardware-Defekt vermuten."
|
||||
},
|
||||
{
|
||||
"num": 4,
|
||||
"title": "EEPROM CFG Checksumme",
|
||||
"description": "Die Checksumme der Config-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück"
|
||||
},
|
||||
{
|
||||
"num": 5,
|
||||
"title": "EEPROM PDS Checksumme",
|
||||
"description": "Die Checksumme der Betriebsdaten-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück"
|
||||
},
|
||||
{
|
||||
"num": 6,
|
||||
"title": "EEPROM PDS Adresse",
|
||||
"description": "Die Adresse der Betriebsdaten-Partition im EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück"
|
||||
},
|
||||
{
|
||||
"num": 7,
|
||||
"title": "EEPROM Version falsch",
|
||||
"description": "Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version überein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück"
|
||||
},
|
||||
{
|
||||
"num": 8,
|
||||
"title": "Flashspeicher Fehler",
|
||||
"description": "Der Flashspeicher konnte nicht initialisiert werden. Aktualisieren sie Flash & Firmware"
|
||||
},
|
||||
{
|
||||
"num": 9,
|
||||
"title": "Flashversion falsch",
|
||||
"description": "Die Version des Flashspeicher stimmt nicht mit der Firmware-Version überein. Aktualisieren sie den Flash mit der passenden Update-Datei"
|
||||
},
|
||||
{
|
||||
"num": 10,
|
||||
"title": "Keine GPS-Verbindung",
|
||||
"description": "Es wurde kein GPS-Signal über die serielle Schnittstelle empfangen, Prüfen sie die Verbindung und das GPS-Modul"
|
||||
},
|
||||
{
|
||||
"num": 11,
|
||||
"title": "CAN-Transceiver Error",
|
||||
"description": "Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Prüfen Sie die Hardware auf Defekte"
|
||||
},
|
||||
{
|
||||
"num": 12,
|
||||
"title": "Keine CAN-Verbindung",
|
||||
"description": "Es konnte kein CAN-Signal empfangen werden. Prüfen sie die Verbindung und die Einstellungen"
|
||||
},
|
||||
{
|
||||
"num": 13,
|
||||
"title": "Config-Validierung",
|
||||
"description": "Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen"
|
||||
},
|
||||
{
|
||||
"num": 14,
|
||||
"title": "Dummy-DTC Info",
|
||||
"description": "Ein Dummy-DTC der Schwere \"Info\" für Debugging-Zwecke"
|
||||
},
|
||||
{
|
||||
"num": 15,
|
||||
"title": "Dummy-DTC Warnung",
|
||||
"description": "Ein Dummy-DTC der Schwere \"Warnung\" für Debugging-Zwecke"
|
||||
},
|
||||
{
|
||||
"num": 16,
|
||||
"title": "Dummy-DTC Kritisch",
|
||||
"description": "Ein Dummy-DTC der Schwere \"Kritisch\" für Debugging-Zwecke"
|
||||
},
|
||||
{
|
||||
"num": 17,
|
||||
"title": "OBD2-KLine Timeout",
|
||||
"description": "Die Anfrage über OBD2-KLine konnte nicht gesendet werden. Prüfen Sie den K-Line-Treiber (z. B. L9637D) und die Verkabelung."
|
||||
},
|
||||
{
|
||||
"num": 18,
|
||||
"title": "OBD2-CAN Timeout",
|
||||
"description": "Die Anfrage an das Steuergerät über OBD2-CAN konnte nicht gesendet werden. Prüfen Sie die Verbindung zum CAN-Modul und die OBD2-Konfiguration."
|
||||
},
|
||||
{
|
||||
"num": 19,
|
||||
"title": "Keine OBD2-CAN Antwort",
|
||||
"description": "Es wurde innerhalb der erwarteten Zeit keine Antwort vom Steuergerät über OBD2-CAN empfangen. Prüfen Sie, ob das Fahrzeug OBD2 unterstützt und die Verbindung korrekt ist."
|
||||
},
|
||||
{
|
||||
"num": 20,
|
||||
"title": "Keine OBD2-KLine Antwort",
|
||||
"description": "Es wurde innerhalb der erwarteten Zeit keine Antwort über OBD2-KLine empfangen. Prüfen Sie die Verbindung zum Steuergerät und die Protokollkompatibilität."
|
||||
},
|
||||
{
|
||||
"num": 21,
|
||||
"title": "OBD2-KLine Antwort ungültig",
|
||||
"description": "Das empfangene Frame war unvollständig oder entsprach nicht dem erwarteten OBD2-Format. Möglicherweise inkompatibles Steuergerät."
|
||||
},
|
||||
{
|
||||
"num": 22,
|
||||
"title": "Last Error",
|
||||
"description": "Last Error"
|
||||
}
|
||||
]
|
||||
}
|
BIN
Software/data_src/static/fonts/comfortaa.woff2
Normal file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
BIN
Software/data_src/static/img/critical.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
BIN
Software/data_src/static/img/info.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
1
Software/data_src/static/img/site.webmanifest
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"","short_name":"","icons":[{"src":"/static/img/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/static/img/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
BIN
Software/data_src/static/img/warn.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
7
Software/data_src/static/js/bootstrap.min.js
vendored
Normal file
196
Software/data_src/static/js/dtc_table.js
Normal file
@@ -0,0 +1,196 @@
|
||||
const jsonFilePath = "static/dtc_table.json";
|
||||
|
||||
var dtcState = {};
|
||||
|
||||
async function processDTCNotifications(dtcArray) {
|
||||
if (dtcArray.length === 0 || dtcArray[0] == "0") {
|
||||
dtcState = {};
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < dtcArray.length; i++) {
|
||||
var dtcInfo = dtcArray[i].split(",");
|
||||
var errorCode = parseInt(dtcInfo[1]);
|
||||
var activity = parseInt(dtcInfo[3]);
|
||||
var severity = parseInt(dtcInfo[2]);
|
||||
|
||||
try {
|
||||
var { title, description } = await getDescriptionForDTCNumber(errorCode);
|
||||
|
||||
switch (severity) {
|
||||
case 1:
|
||||
severity = "info";
|
||||
break;
|
||||
case 2:
|
||||
severity = "warning";
|
||||
break;
|
||||
case 3:
|
||||
severity = "danger";
|
||||
break;
|
||||
}
|
||||
|
||||
if (dtcState[errorCode]) {
|
||||
// Überprüfen, ob sich der Zustand von "previous" auf "active" geändert hat
|
||||
if (activity !== dtcState[errorCode]) {
|
||||
dtcState[errorCode] = activity;
|
||||
if (activity === 1) showNotification(description, severity);
|
||||
}
|
||||
} else {
|
||||
// DTC ist neu, Zustand speichern und Benachrichtigung anzeigen
|
||||
dtcState[errorCode] = activity;
|
||||
showNotification(description, severity);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error processing DTC:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDescriptionForDTCNumber(number) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fetch(jsonFilePath)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
const dtcList = data.dtc_table_data;
|
||||
const foundEntry = dtcList.find((entry) => entry.num === number);
|
||||
|
||||
if (foundEntry) {
|
||||
const description = foundEntry.description;
|
||||
const title = foundEntry.title;
|
||||
resolve({ title, description });
|
||||
} else {
|
||||
// Wenn die Nummer nicht gefunden wurde, geben Sie einen Fehler zurück
|
||||
reject(`Beschreibung für Nummer ${number} nicht gefunden.`);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// Im Fehlerfall geben Sie den Fehler zurück
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function showDTCModal(event) {
|
||||
var dtc = parseInt(event.currentTarget.getAttribute("data-dtc"));
|
||||
var debugval = event.currentTarget.getAttribute("data-debugval");
|
||||
var modal = $("#dtcModal");
|
||||
|
||||
try {
|
||||
var { title, description } = await getDescriptionForDTCNumber(dtc);
|
||||
|
||||
modal.find(".modal-title").text(title);
|
||||
modal.find(".dtc-desc").text(description);
|
||||
|
||||
if (debugval > 0) {
|
||||
modal.find(".dtc-debugval").text("Debugvalue: " + debugval);
|
||||
} else {
|
||||
modal.find(".dtc-debugval").remove();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Abrufen der Beschreibung:", error);
|
||||
modal.find(".modal-title").text("Fehler");
|
||||
modal.find(".dtc-desc").text("DTC-Beschreibung konnte nicht geladen werden");
|
||||
}
|
||||
|
||||
// Modal anzeigen
|
||||
modal.modal("show");
|
||||
}
|
||||
|
||||
|
||||
function fillDTCTable(dtcArray) {
|
||||
// Referenz auf das Tabellen-Element
|
||||
var table = document.getElementById("dtc_table");
|
||||
var tablediv = document.getElementById("dtc_container");
|
||||
|
||||
// Prüfen, ob DTC vorhanden sind
|
||||
if (dtcArray.length === 0 || dtcArray[0] == "0") {
|
||||
// Verstecke das Tabellen-Div, wenn keine DTC vorhanden sind
|
||||
tablediv.hidden = true;
|
||||
table.innerHTML = "";
|
||||
return;
|
||||
} else {
|
||||
// Zeige das Tabellen-Div, wenn DTC vorhanden sind
|
||||
tablediv.hidden = false;
|
||||
}
|
||||
|
||||
// Tabelle leeren, bevor sie neu gefüllt wird
|
||||
table.innerHTML = "";
|
||||
|
||||
// Überschriften für die Tabelle erstellen
|
||||
var headerRow = table.insertRow(0);
|
||||
|
||||
// Definition der Klassen und Scopes für die Spalten
|
||||
var columnDefinitions = [
|
||||
{ class: "col-6", scope: "Zeitstempel" },
|
||||
{ class: "col-2", scope: "Fehlercode" },
|
||||
{ class: "col-2", scope: "Schwere" },
|
||||
{ class: "col-2", scope: "Aktiv" },
|
||||
];
|
||||
|
||||
for (var i = 0; i < columnDefinitions.length; i++) {
|
||||
var headerCell = headerRow.insertCell(i);
|
||||
headerCell.className = `th ${columnDefinitions[i].class}`;
|
||||
headerCell.scope = columnDefinitions[i].scope;
|
||||
headerCell.innerHTML = columnDefinitions[i].scope;
|
||||
}
|
||||
|
||||
// DTC-Daten in die Tabelle einfügen
|
||||
for (var i = 0; i < dtcArray.length; i++) {
|
||||
var dtcInfo = dtcArray[i].split(",");
|
||||
|
||||
var row = table.insertRow(i + 1); // +1 wegen der Überschriftenzeile
|
||||
|
||||
// Zeitstempel
|
||||
var timestampCell = row.insertCell(0);
|
||||
timestampCell.innerHTML = formatTimestamp(parseInt(dtcInfo[0]));
|
||||
|
||||
// Fehlercode
|
||||
var errorCodeCell = row.insertCell(1);
|
||||
errorCodeCell.innerHTML = dtcInfo[1];
|
||||
|
||||
// Schwere
|
||||
var severityCell = row.insertCell(2);
|
||||
var severity = parseInt(dtcInfo[2]);
|
||||
|
||||
// Schwere
|
||||
switch (severity) {
|
||||
case 1:
|
||||
severityCell.innerHTML = '<img src="static/img/info.png" alt="Info" />';
|
||||
break;
|
||||
case 2:
|
||||
severityCell.innerHTML =
|
||||
'<img src="static/img/warn.png" alt="Warnung" />';
|
||||
break;
|
||||
case 3:
|
||||
severityCell.innerHTML =
|
||||
'<img src="static/img/critical.png" alt="Kritisch" />';
|
||||
break;
|
||||
default:
|
||||
severityCell.innerHTML =
|
||||
'<img src="static/img/none.png" alt="Unbekannt" />';
|
||||
}
|
||||
|
||||
row.setAttribute("data-dtc", dtcInfo[1]);
|
||||
row.setAttribute("data-debugval", dtcInfo[4]);
|
||||
row.addEventListener("click", showDTCModal);
|
||||
|
||||
// Aktivität
|
||||
var activityCell = row.insertCell(3);
|
||||
activityCell.innerHTML = parseInt(dtcInfo[3]) === 1 ? "active" : "previous";
|
||||
}
|
||||
}
|
||||
|
||||
function formatTimestamp(milliseconds) {
|
||||
const date = new Date(milliseconds);
|
||||
|
||||
const days = String(date.getUTCDate() - 1).padStart(2, "0");
|
||||
const hours = String(date.getUTCHours()).padStart(2, "0");
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, "0");
|
||||
const seconds = String(date.getUTCSeconds()).padStart(2, "0");
|
||||
const millisecondsFormatted = String(date.getUTCMilliseconds()).padStart(
|
||||
3,
|
||||
"0"
|
||||
);
|
||||
|
||||
return `${days}-${hours}:${minutes}:${seconds}:${millisecondsFormatted}`;
|
||||
}
|
5
Software/data_src/static/js/popper.min.js
vendored
Normal file
26
Software/data_src/static/js/script.js
Normal file
@@ -0,0 +1,26 @@
|
||||
$(document).ready(function () {
|
||||
$(".navbar-nav a").on("click", function () {
|
||||
$(".navbar-collapse").collapse("hide");
|
||||
});
|
||||
|
||||
$("#show_hide_password a").on("click", function (event) {
|
||||
event.preventDefault();
|
||||
if ($("#show_hide_password input").attr("type") == "text") {
|
||||
$("#show_hide_password input").attr("type", "password");
|
||||
$("#show_hide_password i").addClass("fa-eye-slash");
|
||||
$("#show_hide_password i").removeClass("fa-eye");
|
||||
} else if ($("#show_hide_password input").attr("type") == "password") {
|
||||
$("#show_hide_password input").attr("type", "text");
|
||||
$("#show_hide_password i").removeClass("fa-eye-slash");
|
||||
$("#show_hide_password i").addClass("fa-eye");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document
|
||||
.querySelector(".custom-file-input")
|
||||
.addEventListener("change", function (e) {
|
||||
var fileName = document.getElementById("fw-update-file").files[0].name;
|
||||
var nextSibling = e.target.nextElementSibling;
|
||||
nextSibling.innerText = fileName;
|
||||
});
|
528
Software/data_src/static/js/websocket.js
Normal file
@@ -0,0 +1,528 @@
|
||||
var gateway = `ws://${window.location.hostname}/ws`;
|
||||
var websocket;
|
||||
|
||||
var statusMapping;
|
||||
var staticMapping;
|
||||
var overlay;
|
||||
|
||||
let traceActive = false;
|
||||
let traceMode = null;
|
||||
let traceFileName = "";
|
||||
let traceUseFsAccess = false;
|
||||
|
||||
// File-System-Access-Stream (Chromium)
|
||||
let traceWriter = null;
|
||||
let traceEncoder = null;
|
||||
let traceWriteQueue = Promise.resolve(); // für geordnete Writes
|
||||
|
||||
// Fallback: In-Memory-Sammeln (für Blob-Download bei STOP)
|
||||
let traceMemParts = [];
|
||||
|
||||
// Textarea & Status
|
||||
const TRACE_MAX_CHARS = 200000; // ~200 KB für die Anzeige
|
||||
|
||||
function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
function nowIsoCompact() {
|
||||
return new Date().toISOString().replace(/[:.]/g, "-");
|
||||
}
|
||||
function genTraceFileName(mode) {
|
||||
return `cantrace-${mode}-${nowIsoCompact()}.log`;
|
||||
}
|
||||
|
||||
function setTraceUI(active, mode, infoText) {
|
||||
traceActive = !!active;
|
||||
traceMode = active ? mode : null;
|
||||
|
||||
const btnRaw = $("trace-start");
|
||||
const btnObd = $("trace-start-obd");
|
||||
const btnStop = $("trace-stop");
|
||||
const status = $("trace-status");
|
||||
|
||||
if (btnRaw) btnRaw.disabled = active;
|
||||
if (btnObd) btnObd.disabled = active;
|
||||
if (btnStop) btnStop.disabled = !active;
|
||||
|
||||
if (status)
|
||||
status.textContent =
|
||||
infoText || (active ? `Trace aktiv (${mode})` : "Trace inaktiv");
|
||||
}
|
||||
|
||||
function traceClear() {
|
||||
const out = $("trace-out");
|
||||
if (out) out.value = "";
|
||||
}
|
||||
|
||||
function traceAppend(text) {
|
||||
const out = $("trace-out");
|
||||
if (!out || !text) return;
|
||||
out.value += text;
|
||||
if (out.value.length > TRACE_MAX_CHARS) {
|
||||
out.value = out.value.slice(-TRACE_MAX_CHARS);
|
||||
}
|
||||
out.scrollTop = out.scrollHeight;
|
||||
}
|
||||
|
||||
function triggerBlobDownload(filename, blob) {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function parseKv(s) {
|
||||
const out = Object.create(null);
|
||||
s.split(";").forEach((part) => {
|
||||
const eq = part.indexOf("=");
|
||||
if (eq > 0) {
|
||||
const k = part.slice(0, eq).trim();
|
||||
const v = part.slice(eq + 1).trim();
|
||||
if (k) out[k] = v;
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
// geordnete Writes auf File System Access Writer
|
||||
function writeToFs(chunk) {
|
||||
if (!traceUseFsAccess || !traceWriter) return;
|
||||
const data = traceEncoder
|
||||
? traceEncoder.encode(chunk)
|
||||
: new TextEncoder().encode(chunk);
|
||||
traceWriteQueue = traceWriteQueue
|
||||
.then(() => traceWriter.write(data))
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// Ihr JavaScript-Code hier, einschließlich der onLoad-Funktion
|
||||
overlay = document.getElementById("overlay");
|
||||
onLoad();
|
||||
});
|
||||
|
||||
function initWebSocket() {
|
||||
console.log("Trying to open a WebSocket connection...");
|
||||
websocket = new WebSocket(gateway);
|
||||
websocket.onopen = onOpen;
|
||||
websocket.onclose = onClose;
|
||||
websocket.onmessage = onMessage; // <-- add this line
|
||||
}
|
||||
|
||||
function initButtons() {
|
||||
var elements = document.getElementsByClassName("btn-wsevent");
|
||||
|
||||
if (elements.length > 0) {
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
let element = elements[i];
|
||||
element.addEventListener("click", sendButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initSettingInputs() {
|
||||
var elements = document.getElementsByClassName("set-wsevent");
|
||||
|
||||
if (elements.length > 0) {
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
let element = elements[i];
|
||||
element.addEventListener("change", function () {
|
||||
websocket_sendevent("set-" + element.id, element.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onOpen(event) {
|
||||
console.log("Connection opened");
|
||||
setTraceUI(false, null, "Verbunden – Trace inaktiv");
|
||||
}
|
||||
|
||||
function onClose(event) {
|
||||
console.log("Connection closed");
|
||||
setTimeout(initWebSocket, 1000);
|
||||
overlay.style.display = "flex";
|
||||
|
||||
// Falls Trace noch aktiv war: lokal finalisieren
|
||||
if (traceActive) {
|
||||
const note = "Trace beendet (Verbindung getrennt)";
|
||||
if (traceUseFsAccess && traceWriter) {
|
||||
traceWriteQueue.then(() => traceWriter.close()).catch(console.error);
|
||||
traceWriter = null;
|
||||
} else if (traceMemParts.length) {
|
||||
const blob = new Blob(traceMemParts, { type: "text/plain" });
|
||||
triggerBlobDownload(traceFileName || "cantrace.log", blob);
|
||||
traceMemParts = [];
|
||||
}
|
||||
setTraceUI(false, null, note);
|
||||
showNotification(note, "warning");
|
||||
}
|
||||
}
|
||||
|
||||
async function sendButton(event) {
|
||||
const targetElement = event.target;
|
||||
|
||||
if (
|
||||
targetElement.classList.contains("confirm") &&
|
||||
window.confirm("Sicher?") == false
|
||||
)
|
||||
return;
|
||||
|
||||
const wsid = targetElement.dataset.wsid || targetElement.id; // z.B. "trace-start"
|
||||
const val = targetElement.value || "";
|
||||
|
||||
// File-Ziel *vor* dem WS-Start öffnen (nur bei trace-start; wegen User-Gesture!)
|
||||
if (wsid === "trace-start") {
|
||||
const mode = val || "raw";
|
||||
traceFileName = genTraceFileName(mode);
|
||||
|
||||
// Anzeige schon mal leeren
|
||||
traceClear();
|
||||
setTraceUI(false, null, "Trace wird gestartet…");
|
||||
|
||||
traceUseFsAccess = false;
|
||||
traceWriter = null;
|
||||
traceEncoder = null;
|
||||
traceWriteQueue = Promise.resolve();
|
||||
traceMemParts = []; // Fallback-Puffer leeren
|
||||
|
||||
if (window.showSaveFilePicker) {
|
||||
try {
|
||||
const fh = await showSaveFilePicker({
|
||||
suggestedName: traceFileName,
|
||||
types: [
|
||||
{
|
||||
description: "Text Log",
|
||||
accept: { "text/plain": [".log", ".txt"] },
|
||||
},
|
||||
],
|
||||
});
|
||||
traceWriter = await fh.createWritable();
|
||||
traceEncoder = new TextEncoder();
|
||||
traceUseFsAccess = true;
|
||||
} catch (e) {
|
||||
// Nutzer hat evtl. abgebrochen → Fallback in RAM
|
||||
traceUseFsAccess = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
websocket_sendevent("btn-" + wsid, val);
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
var data = event.data;
|
||||
|
||||
if (data.startsWith("NOTIFY:")) {
|
||||
var notify_data = data.slice(7).split(";")[1];
|
||||
var notify_type = data.slice(7).split(";")[0];
|
||||
showNotification(notify_data, notify_type);
|
||||
} else if (data.startsWith("DEBUG:")) {
|
||||
var addtext = data.slice(6);
|
||||
var livedebug_out = document.getElementById("livedebug-out");
|
||||
livedebug_out.value += addtext;
|
||||
livedebug_out.scrollTop = livedebug_out.scrollHeight;
|
||||
do_resize(livedebug_out);
|
||||
} else if (data.startsWith("DTC:")) {
|
||||
const dtcs = data.slice(4);
|
||||
const dtcArray = dtcs.trim() !== "" ? dtcs.split(";").filter(Boolean) : [];
|
||||
|
||||
processDTCNotifications(dtcArray);
|
||||
fillDTCTable(dtcArray);
|
||||
} else if (data.startsWith("MAPPING_STATUS:")) {
|
||||
const data_sliced = data.slice(15);
|
||||
statusMapping = createMapping(data_sliced);
|
||||
} else if (data.startsWith("MAPPING_STATIC:")) {
|
||||
const data_sliced = data.slice(15);
|
||||
staticMapping = createMapping(data_sliced);
|
||||
console.log(staticMapping);
|
||||
} else if (data.startsWith("STATUS:")) {
|
||||
const data_sliced = data.slice(7);
|
||||
const result = processDataString(data_sliced, statusMapping);
|
||||
fillValuesToHTML(result);
|
||||
} else if (data.startsWith("STATIC:")) {
|
||||
const data_sliced = data.slice(7);
|
||||
const result = processDataString(data_sliced, staticMapping);
|
||||
fillValuesToHTML(result);
|
||||
overlay.style.display = "none";
|
||||
}
|
||||
// --- Trace: Start ---
|
||||
else if (data.startsWith("STARTTRACE;")) {
|
||||
const kv = parseKv(data.slice(11)); // mode=..., ts=...
|
||||
const mode = kv.mode || "?";
|
||||
setTraceUI(true, mode, `Trace gestartet (${mode})`);
|
||||
|
||||
// Fallback: wenn kein FS-Access → in RAM sammeln
|
||||
// (sonst haben wir traceWriter bereits im Klick vorbereitet)
|
||||
}
|
||||
// --- Trace: Lines (ggf. mehrere in einer WS-Nachricht) ---
|
||||
else if (data.startsWith("TRACELINE;")) {
|
||||
const payload = data.replace(/TRACELINE;/g, ""); // reiner Text inkl. '\n'
|
||||
traceAppend(payload);
|
||||
if (traceUseFsAccess && traceWriter) {
|
||||
writeToFs(payload);
|
||||
} else {
|
||||
traceMemParts.push(payload);
|
||||
}
|
||||
}
|
||||
// --- Trace: Stop/Summary ---
|
||||
else if (data.startsWith("STOPTRACE;")) {
|
||||
const kv = parseKv(data.slice(10));
|
||||
const msg = `Trace beendet (${kv.mode || "?"}), Zeilen=${
|
||||
kv.lines || "0"
|
||||
}, Drops=${kv.drops || "0"}${kv.reason ? ", Grund=" + kv.reason : ""}`;
|
||||
|
||||
// Datei finalisieren
|
||||
if (traceUseFsAccess && traceWriter) {
|
||||
traceWriteQueue.then(() => traceWriter.close()).catch(console.error);
|
||||
traceWriter = null;
|
||||
} else if (traceMemParts.length) {
|
||||
const blob = new Blob(traceMemParts, { type: "text/plain" });
|
||||
triggerBlobDownload(traceFileName || "cantrace.log", blob);
|
||||
traceMemParts = [];
|
||||
}
|
||||
|
||||
setTraceUI(false, null, msg);
|
||||
showNotification(msg, "info");
|
||||
}
|
||||
// --- Busy/Fehler/Ack ---
|
||||
else if (data.startsWith("TRACEBUSY;")) {
|
||||
const kv = parseKv(data.slice(10));
|
||||
const owner = kv.owner ? " (Owner #" + kv.owner + ")" : "";
|
||||
showNotification("Trace bereits aktiv" + owner, "warning");
|
||||
} else if (data.startsWith("TRACEERROR;")) {
|
||||
const kv = parseKv(data.slice(11));
|
||||
showNotification("Trace-Fehler: " + (kv.msg || "unbekannt"), "danger");
|
||||
} else if (data.startsWith("TRACEACK;")) {
|
||||
// optional
|
||||
const kv = parseKv(data.slice(9));
|
||||
console.log("TRACEACK", kv);
|
||||
}
|
||||
}
|
||||
|
||||
function createMapping(mappingString) {
|
||||
return mappingString
|
||||
.split(";")
|
||||
.map((s) => s.trim())
|
||||
.filter((s) => s !== "");
|
||||
}
|
||||
|
||||
function processDataString(dataString, mapping) {
|
||||
const valuesArray = dataString.split(";");
|
||||
const dataObject = {};
|
||||
|
||||
valuesArray.forEach((value, index) => {
|
||||
const variable = mapping[index];
|
||||
if (variable) {
|
||||
dataObject[variable] = value.trim();
|
||||
}
|
||||
});
|
||||
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
function onLoad(event) {
|
||||
initWebSocket();
|
||||
initButtons();
|
||||
initSettingInputs();
|
||||
overlay.style.display = "flex";
|
||||
}
|
||||
|
||||
function websocket_sendevent(element_id, element_value) {
|
||||
websocket.send(element_id + ":" + element_value);
|
||||
}
|
||||
|
||||
function do_resize(textbox) {
|
||||
var maxrows = 15;
|
||||
var minrows = 3;
|
||||
var txt = textbox.value;
|
||||
var cols = textbox.cols;
|
||||
|
||||
var arraytxt = txt.split("\n");
|
||||
var rows = arraytxt.length;
|
||||
|
||||
for (i = 0; i < arraytxt.length; i++)
|
||||
rows += parseInt(arraytxt[i].length / cols);
|
||||
|
||||
if (rows > maxrows) textbox.rows = maxrows;
|
||||
else if (rows < minrows) textbox.rows = minrows;
|
||||
else textbox.rows = rows;
|
||||
}
|
||||
|
||||
// --- Globale Puffer für Select-Handling ---
|
||||
const selectDesiredValue = Object.create(null); // keyBase -> desired value ("speedsource" -> "GPS")
|
||||
const selectOptionsReady = Object.create(null); // keyBase -> true/false
|
||||
|
||||
function splitCsv(s) {
|
||||
return (s || "")
|
||||
.split(",")
|
||||
.map((x) => x.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function hasOption(selectEl, value) {
|
||||
for (let i = 0; i < selectEl.options.length; i++) {
|
||||
if (selectEl.options[i].value === value) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function addOption(selectEl, value, selectIt = false) {
|
||||
const o = document.createElement("option");
|
||||
o.value = value;
|
||||
o.textContent = value;
|
||||
selectEl.appendChild(o);
|
||||
if (selectIt) {
|
||||
selectEl.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
function populateSelect(selectId, options, currentValue) {
|
||||
const sel = document.getElementById(selectId);
|
||||
if (!sel) return;
|
||||
|
||||
// 1) komplett ersetzen
|
||||
sel.innerHTML = "";
|
||||
options.forEach((opt) => addOption(sel, opt, false));
|
||||
|
||||
// 2) Zielwert bestimmen (currentValue > bereits gepuffert > vorhandener Wert > erste Option)
|
||||
const wanted =
|
||||
(currentValue && currentValue.length ? currentValue : null) ??
|
||||
selectDesiredValue[selectId] ??
|
||||
sel.value ??
|
||||
(options[0] || "");
|
||||
|
||||
// 3) Falls gewünschte Option fehlt, hinzufügen
|
||||
if (wanted && !hasOption(sel, wanted)) addOption(sel, wanted, false);
|
||||
|
||||
// 4) Setzen
|
||||
sel.value = wanted;
|
||||
|
||||
// 5) Markieren: Optionen sind ready
|
||||
selectOptionsReady[selectId] = true;
|
||||
// Verbrauchte Wunschwerte löschen
|
||||
delete selectDesiredValue[selectId];
|
||||
}
|
||||
|
||||
// Robust: setzt den Wert; wenn Option fehlt, füge sie hinzu
|
||||
function setDropdownValue(selectElement, value) {
|
||||
if (!value) return;
|
||||
if (!hasOption(selectElement, value)) {
|
||||
addOption(selectElement, value, false);
|
||||
}
|
||||
selectElement.value = value;
|
||||
}
|
||||
|
||||
// Core: schreibt Werte in DOM, erkennt *-options und füllt Selects
|
||||
function fillValuesToHTML(dataset) {
|
||||
for (const key in dataset) {
|
||||
const val = dataset[key];
|
||||
|
||||
// A) Optionen-Feld? (z.B. "speedsource-options")
|
||||
if (key.endsWith("-options")) {
|
||||
const base = key.slice(0, -"-options".length); // "speedsource"
|
||||
const selectId = base; // ID = keyBase
|
||||
populateSelect(
|
||||
selectId,
|
||||
splitCsv(val),
|
||||
selectDesiredValue[selectId] || undefined
|
||||
);
|
||||
continue; // fertig mit diesem key
|
||||
}
|
||||
|
||||
// B) Normales Feld
|
||||
const key_prefixed = "data-" + key;
|
||||
const elements = document.getElementsByClassName(key_prefixed);
|
||||
if (elements.length === 0) continue;
|
||||
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
const el = elements[i];
|
||||
|
||||
// Checkbox?
|
||||
if (el.type === "checkbox") {
|
||||
el.checked = val == 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Select?
|
||||
if (el.tagName === "SELECT") {
|
||||
const selectId = el.id || key; // ID hat Vorrang, sonst key
|
||||
// Wenn die Optionen für dieses Select noch NICHT bereit sind, Wunschwert puffern
|
||||
if (!selectOptionsReady[selectId]) {
|
||||
selectDesiredValue[selectId] = val;
|
||||
// Sicherheitsnetz: falls doch schon Optionen existieren, sofort setzen
|
||||
setDropdownValue(el, val);
|
||||
} else {
|
||||
// Optionen sind ready -> ganz normal setzen (ggf. Option ergänzen)
|
||||
setDropdownValue(el, val);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Progress-Bar?
|
||||
if (el.classList.contains("progress-bar")) {
|
||||
updateProgressBar(el, val);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Hideable-Section?
|
||||
if (el.classList.contains("hideable")) {
|
||||
el.style.display = val == 0 ? "none" : "";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Input/Textarea?
|
||||
if ("value" in el) {
|
||||
el.value = val;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fallback: content nodes (td, span, div)
|
||||
el.textContent = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Funktion zum Aktualisieren der Fortschrittsleiste
|
||||
function updateProgressBar(progressBar, value) {
|
||||
// Wert in das aria-valuenow-Attribut einfügen
|
||||
progressBar.setAttribute("aria-valuenow", value);
|
||||
|
||||
// Breite des Fortschrittsbalkens und inneren Text aktualisieren
|
||||
progressBar.style.width = value + "%";
|
||||
progressBar.textContent = value + "%";
|
||||
}
|
||||
|
||||
function showNotification(message, type) {
|
||||
// Erstellen Sie ein Bootstrap-Alert-Element
|
||||
var alertElement = $(
|
||||
'<div class="alert alert-' +
|
||||
type +
|
||||
' alert-dismissible fade show notification" role="alert">' +
|
||||
"<strong>" +
|
||||
message +
|
||||
"</strong>" +
|
||||
'<button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
|
||||
'<span aria-hidden="true">×</span>' +
|
||||
"</button>" +
|
||||
"</div>"
|
||||
);
|
||||
|
||||
// Fügen Sie das Alert-Element dem Container hinzu
|
||||
$("#notification-container").append(alertElement);
|
||||
|
||||
// Nach 5 Sekunden das Alert-Element ausblenden
|
||||
setTimeout(function () {
|
||||
alertElement.alert("close");
|
||||
}, 5000);
|
||||
}
|
1
Software/data_src/version
Normal file
@@ -0,0 +1 @@
|
||||
1.05
|
@@ -1,8 +0,0 @@
|
||||
import subprocess
|
||||
|
||||
revision = (
|
||||
subprocess.check_output(["git", "rev-parse", "--short=10", "HEAD"])
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
print("-DGIT_REV='\"%s\"'" % revision)
|
18
Software/include/button_actions.h
Normal file
@@ -0,0 +1,18 @@
|
||||
// === button_actions.h ===
|
||||
#ifndef _BUTTON_ACTIONS_H_
|
||||
#define _BUTTON_ACTIONS_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "buttoncontrol.h"
|
||||
|
||||
// Deklarationen der Button-Callbacks
|
||||
void ButtonAction_ToggleMode();
|
||||
void ButtonAction_StartPurge();
|
||||
void ButtonAction_ToggleWiFi();
|
||||
void ButtonAction_WashMode();
|
||||
|
||||
// Bereitstellung der Aktionsliste
|
||||
extern const ButtonActionEntry buttonActions[];
|
||||
extern const uint8_t buttonActionCount;
|
||||
|
||||
#endif
|
30
Software/include/buttoncontrol.h
Normal file
@@ -0,0 +1,30 @@
|
||||
// === buttoncontrol.h ===
|
||||
#ifndef _BUTTONCONTROL_H_
|
||||
#define _BUTTONCONTROL_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// Aktionen, die vom Button ausgelöst werden können
|
||||
enum ButtonAction
|
||||
{
|
||||
BTN_NONE,
|
||||
BTN_CUSTOM
|
||||
};
|
||||
|
||||
// Callback-Funktionstyp
|
||||
typedef void (*ButtonCallback)();
|
||||
|
||||
struct ButtonActionEntry
|
||||
{
|
||||
uint32_t holdTimeMs;
|
||||
uint32_t ledColor;
|
||||
ButtonCallback callback;
|
||||
};
|
||||
|
||||
// Initialisierung des Buttonmoduls
|
||||
void ButtonControl_Init(uint8_t pin, const ButtonActionEntry *actions, uint8_t actionCount);
|
||||
|
||||
// Muss regelmäßig in loop() aufgerufen werden
|
||||
void ButtonControl_Update();
|
||||
|
||||
#endif
|
78
Software/include/can_hal.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <mcp_can.h>
|
||||
#include "common.h"
|
||||
|
||||
// ==== Board-Pin ====
|
||||
// Falls nicht bereits global definiert:
|
||||
#ifndef GPIO_CS_CAN
|
||||
#define GPIO_CS_CAN 5
|
||||
#endif
|
||||
|
||||
// ==== Öffentliche, einzige Instanz ====
|
||||
extern MCP_CAN CAN0;
|
||||
|
||||
// ==== Init-Config ====
|
||||
struct CanHalConfig {
|
||||
uint8_t baud = CAN_500KBPS; // laut Lib
|
||||
uint8_t clock = MCP_16MHZ; // 8/16 MHz je nach Quarz
|
||||
uint16_t listenOnlyProbeMs = 0; // optionaler kurzer Hörtest
|
||||
uint16_t modeSettleMs = 10; // Wartezeit für Mode-Set (Retry-Fenster)
|
||||
};
|
||||
|
||||
// ==== Universeller Filter-Descriptor ====
|
||||
struct CanFilter {
|
||||
uint32_t id; // 11-bit oder 29-bit Roh-ID
|
||||
bool ext; // false = STD(11-bit), true = EXT(29-bit)
|
||||
};
|
||||
|
||||
// =====================
|
||||
// Trace / Logging Types
|
||||
// =====================
|
||||
struct CanLogFrame {
|
||||
uint32_t ts_ms;
|
||||
uint32_t id;
|
||||
bool ext;
|
||||
bool rx; // true = RX, false = TX
|
||||
uint8_t dlc;
|
||||
uint8_t data[8];
|
||||
};
|
||||
|
||||
using CanTraceSink = void (*)(const CanLogFrame& f);
|
||||
|
||||
// ==== API ====
|
||||
|
||||
// 1) Einmalige Hardware-Initialisierung + integrierter Loopback-Selftest.
|
||||
// - begin()
|
||||
// - LOOPBACK senden/echo prüfen (ohne Bus)
|
||||
// - optional: ListenOnly-Probe (nur Heuristik)
|
||||
// - Default: Filter/Masks weit offen, NORMAL-Mode
|
||||
// Rückgabe: true = bereit; false = Fehler (kein CAN verwenden)
|
||||
bool CAN_HAL_Init(const CanHalConfig& cfg);
|
||||
|
||||
// Ist die HAL bereit (nach Init)?
|
||||
bool CAN_HAL_IsReady();
|
||||
|
||||
// Bestätigter Moduswechsel (CONFIG/NORMAL/LISTENONLY/LOOPBACK)
|
||||
// true = erfolgreich; setzt bei Misserfolg DTC_CAN_TRANSCEIVER_FAILED
|
||||
bool CAN_HAL_SetMode(uint8_t mode);
|
||||
|
||||
// Masken/Filter
|
||||
bool CAN_HAL_SetMask(uint8_t bank, bool ext, uint32_t rawMask);
|
||||
bool CAN_HAL_SetStdMask11(uint8_t bank, uint16_t mask11);
|
||||
void CAN_HAL_ClearFilters();
|
||||
bool CAN_HAL_AddFilter(const CanFilter& f);
|
||||
bool CAN_HAL_SetFilters(const CanFilter* list, size_t count);
|
||||
|
||||
// Non-blocking IO
|
||||
bool CAN_HAL_Read(unsigned long& id, uint8_t& len, uint8_t data[8]); // true = Frame gelesen
|
||||
uint8_t CAN_HAL_Send(unsigned long id, bool ext, uint8_t len, const uint8_t* data); // CAN_OK bei Erfolg
|
||||
|
||||
// Diagnose/Utilities
|
||||
uint8_t CAN_HAL_GetErrorFlags(); // Intern: getError()
|
||||
void CAN_HAL_GetErrorCounters(uint8_t& tec, uint8_t& rec); // TX/RX Error Counter
|
||||
|
||||
// Trace / Sniffer
|
||||
void CAN_HAL_SetTraceSink(CanTraceSink sink);
|
||||
void CAN_HAL_EnableRawSniffer(bool enable);
|
||||
bool CAN_HAL_IsRawSnifferEnabled();
|
11
Software/include/can_native.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include "can_hal.h"
|
||||
|
||||
// Initialisiert den Native-CAN-Profilpfad (setzt Masken/Filter und NORMAL-Mode).
|
||||
// Voraussetzung: CAN_HAL_Init(...) hat zuvor true geliefert.
|
||||
bool Init_CAN_Native();
|
||||
|
||||
// Liest Frames non-blocking, extrahiert Hinterradgeschwindigkeit je nach Bike,
|
||||
// integriert mm über dt und liefert die seit letztem Aufruf addierten Millimeter.
|
||||
uint32_t Process_CAN_Native_WheelSpeed();
|
15
Software/include/can_obd2.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Initialisiert das OBD2-CAN-Profil:
|
||||
// - setzt Masken/Filter für 0x7E8..0x7EF (ECU-Antworten)
|
||||
// - Normal-Mode sicherstellen
|
||||
// Voraussetzung: CAN_HAL_Init(...) hat zuvor true geliefert.
|
||||
bool Init_CAN_OBD2();
|
||||
|
||||
// Polling-Prozess für OBD2 über CAN (non-blocking):
|
||||
// - sendet zyklisch Requests (0x7DF) auf PID 0x0D (Fahrzeuggeschwindigkeit)
|
||||
// - verarbeitet Antworten 0x7E8..0x7EF
|
||||
// - integriert Millimeter über dt
|
||||
// Rückgabe: seit letztem Aufruf addierte Millimeter (uint32_t)
|
||||
uint32_t Process_CAN_OBD2_Speed();
|
134
Software/include/common.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* @file common.h
|
||||
*
|
||||
* @brief Header file for common definitions and macros in the ChainLube application.
|
||||
*
|
||||
* This file defines common macros, GPIO configurations, and other shared constants
|
||||
* for the ChainLube project. It includes definitions for GPIO pins, OTA delays, pulse lengths,
|
||||
* and other common settings used across the project.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
#define SET_BIT(value, bitPosition) ((value) |= (1U << (bitPosition)))
|
||||
|
||||
// Conditional compilation based on PCB revision
|
||||
#if PCB_REV == 1
|
||||
#define GPIO_BUTTON D7
|
||||
#define GPIO_LED D8
|
||||
#define GPIO_TRIGGER D6
|
||||
#define GPIO_PUMP D5
|
||||
#elif PCB_REV == 2
|
||||
#define GPIO_BUTTON D7
|
||||
#define GPIO_LED D8
|
||||
#define GPIO_TRIGGER D6
|
||||
#define GPIO_PUMP D5
|
||||
#define GPIO_CS_CAN -1
|
||||
#elif PCB_REV == 3
|
||||
#define GPIO_BUTTON D4
|
||||
#define GPIO_LED D3
|
||||
#define GPIO_TRIGGER D6
|
||||
#define GPIO_PUMP D0
|
||||
#define GPIO_CS_CAN D8
|
||||
#elif PCB_REV == 4
|
||||
#define GPIO_BUTTON D4
|
||||
#define GPIO_LED D3
|
||||
#define GPIO_TRIGGER D8
|
||||
#define GPIO_PUMP D0
|
||||
#define GPIO_CS_CAN D8
|
||||
#define GPIO_CE_KLINE D8
|
||||
#endif
|
||||
|
||||
#ifndef HOST_NAME
|
||||
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
|
||||
#endif
|
||||
|
||||
#ifndef OTA_DELAY
|
||||
#define OTA_DELAY 50 // ticks -> 10ms / tick
|
||||
#endif
|
||||
|
||||
#define LUBE_PULSE_LENGHT_MS 160
|
||||
#define LUBE_PULSE_PAUSE_MS 340
|
||||
|
||||
// Pump pulse parameters
|
||||
// -> 2Hz PumpPulse
|
||||
// -> 49.7cc / h @ 2Hz
|
||||
// -> 49.7 ml / h @ 2Hz
|
||||
// -> 828.4µl / min @ 2Hz
|
||||
// -> 828.3µl / 60s
|
||||
// -> 13.81µl / 1s
|
||||
// -> 6.90µl / Pulse
|
||||
#define DEFAULT_PUMP_DOSE 7
|
||||
|
||||
// --- System status enum with sentinel ---
|
||||
typedef enum eSystem_Status
|
||||
{
|
||||
sysStat_Startup,
|
||||
sysStat_Normal,
|
||||
sysStat_Rain,
|
||||
sysStat_Wash,
|
||||
sysStat_Purge,
|
||||
sysStat_Error,
|
||||
sysStat_Shutdown,
|
||||
SYSSTAT_COUNT // <- sentinel (must be last)
|
||||
} tSystem_Status;
|
||||
|
||||
// Enum for different sources of speed input
|
||||
typedef enum SpeedSource_e
|
||||
{
|
||||
#ifdef FEATURE_ENABLE_TIMER
|
||||
SOURCE_TIME,
|
||||
#endif
|
||||
SOURCE_IMPULSE,
|
||||
SOURCE_GPS,
|
||||
SOURCE_CAN,
|
||||
SOURCE_OBD2_KLINE,
|
||||
SOURCE_OBD2_CAN,
|
||||
SPEEDSOURCE_COUNT // <- sentinel (must be last)
|
||||
} SpeedSource_t;
|
||||
|
||||
// Enum for GPS baud rates
|
||||
typedef enum GPSBaudRate_e
|
||||
{
|
||||
BAUD_4800,
|
||||
BAUD_9600,
|
||||
BAUD_19200,
|
||||
BAUD_38400,
|
||||
BAUD_57600,
|
||||
BAUD_115200,
|
||||
GPSBAUDRATE_COUNT // <- sentinel (must be last)
|
||||
} GPSBaudRate_t;
|
||||
|
||||
// Enum for CAN bus sources
|
||||
typedef enum CANSource_e
|
||||
{
|
||||
KTM_890_ADV_R_2021,
|
||||
KTM_1290_SD_R_2023,
|
||||
TRIUMPH_SPEED_TWIN_1200_RS_2025,
|
||||
CANSOURCE_COUNT // <- sentinel (must be last)
|
||||
} CANSource_t;
|
||||
|
||||
// String tables (kept internal to the module)
|
||||
extern const char * const SystemStatusString[SYSSTAT_COUNT];
|
||||
extern const char * const SpeedSourceString[SPEEDSOURCE_COUNT];
|
||||
extern const char * const GPSBaudRateString[GPSBAUDRATE_COUNT];
|
||||
extern const char * const CANSourceString[CANSOURCE_COUNT];
|
||||
|
||||
// Safe getters (centralized bounds check)
|
||||
const char* ToString(SpeedSource_t v);
|
||||
const char* ToString(GPSBaudRate_t v);
|
||||
const char* ToString(CANSource_t v);
|
||||
const char* ToString(tSystem_Status v);
|
||||
|
||||
#define STARTUP_DELAY 2500
|
||||
#define SHUTDOWN_DELAY_MS 2500
|
||||
|
||||
#endif
|
140
Software/include/config.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* @file config.h
|
||||
* @brief Configuration structures and EEPROM API for ChainLube firmware.
|
||||
*
|
||||
* Defines EEPROM layout versions, configuration and persistence data structures,
|
||||
* and the public functions for storing, loading, formatting and validating
|
||||
* configuration/persistence records.
|
||||
*
|
||||
* Notes:
|
||||
* - The system always boots with defaults in RAM; EEPROM is optional.
|
||||
* - DTC handling for EEPROM availability and integrity is centralized in EEPROM_Process().
|
||||
*/
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <I2C_eeprom.h>
|
||||
#include "dtc.h"
|
||||
#include "common.h"
|
||||
|
||||
// Increment when EEPROM structure changes
|
||||
#define EEPROM_STRUCTURE_REVISION 4
|
||||
|
||||
#if PCB_REV == 1 || PCB_REV == 2 || PCB_REV == 3
|
||||
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC64
|
||||
#elif PCB_REV == 4
|
||||
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC256
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief EEPROM request state machine codes.
|
||||
*
|
||||
* Used by globals.requestEEAction to schedule EEPROM operations.
|
||||
*/
|
||||
typedef enum EERequest_e
|
||||
{
|
||||
EE_IDLE = 0,
|
||||
EE_CFG_SAVE,
|
||||
EE_CFG_LOAD,
|
||||
EE_CFG_FORMAT,
|
||||
EE_PDS_SAVE,
|
||||
EE_PDS_LOAD,
|
||||
EE_PDS_FORMAT,
|
||||
EE_FORMAT_ALL,
|
||||
EE_ALL_SAVE,
|
||||
EE_REINITIALIZE
|
||||
} EERequest_t;
|
||||
|
||||
/**
|
||||
* @brief Wear-levelled persistence data block.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t writeCycleCounter;
|
||||
uint32_t tankRemain_microL;
|
||||
uint32_t TravelDistance_highRes_mm;
|
||||
uint32_t odometer_mm;
|
||||
uint32_t odometer;
|
||||
uint32_t checksum;
|
||||
} persistenceData_t;
|
||||
|
||||
/**
|
||||
* @brief User configuration stored in EEPROM.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t EEPROM_Version;
|
||||
uint32_t DistancePerLube_Default;
|
||||
uint32_t DistancePerLube_Rain;
|
||||
uint32_t tankCapacity_ml;
|
||||
uint32_t amountPerDose_microL;
|
||||
uint8_t TankRemindAtPercentage;
|
||||
uint8_t PulsePerRevolution;
|
||||
uint32_t TireWidth_mm;
|
||||
uint32_t TireWidthHeight_Ratio;
|
||||
uint32_t RimDiameter_Inch;
|
||||
uint32_t DistancePerRevolution_mm;
|
||||
uint16_t BleedingPulses;
|
||||
uint16_t WashMode_Distance;
|
||||
uint16_t WashMode_Interval;
|
||||
SpeedSource_t SpeedSource;
|
||||
GPSBaudRate_t GPSBaudRate;
|
||||
CANSource_t CANSource;
|
||||
bool LED_Mode_Flash;
|
||||
uint8_t LED_Max_Brightness;
|
||||
uint8_t LED_Min_Brightness;
|
||||
char wifi_ap_ssid[33];
|
||||
char wifi_ap_password[64];
|
||||
char wifi_client_ssid[33];
|
||||
char wifi_client_password[64];
|
||||
bool wifi_autoconnect;
|
||||
uint32_t checksum;
|
||||
} LubeConfig_t;
|
||||
|
||||
/**
|
||||
* @brief Factory defaults for configuration (in RAM).
|
||||
*/
|
||||
const LubeConfig_t LubeConfig_defaults = {
|
||||
0, 8000, 4000, 320, DEFAULT_PUMP_DOSE, 30, 1, 150, 70, 18, 2000, 25, 500, 10, SOURCE_IMPULSE,
|
||||
BAUD_115200,
|
||||
KTM_890_ADV_R_2021,
|
||||
false,
|
||||
255,
|
||||
5,
|
||||
"ChainLube",
|
||||
QUOTE(WIFI_AP_PASSWORD),
|
||||
QUOTE(WIFI_SSID_CLIENT),
|
||||
QUOTE(WIFI_PASSWORD_CLIENT),
|
||||
true,
|
||||
0};
|
||||
|
||||
/* ==== Public API ==== */
|
||||
|
||||
// Initialization & main process
|
||||
void InitEEPROM();
|
||||
void EEPROM_Process();
|
||||
|
||||
// Config & persistence access
|
||||
void StoreConfig_EEPROM();
|
||||
void GetConfig_EEPROM();
|
||||
void StorePersistence_EEPROM();
|
||||
void GetPersistence_EEPROM();
|
||||
void FormatConfig_EEPROM();
|
||||
void FormatPersistence_EEPROM();
|
||||
void MovePersistencePage_EEPROM(boolean reset);
|
||||
|
||||
// Utilities
|
||||
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len);
|
||||
void dumpEEPROM(uint16_t memoryAddress, uint16_t length);
|
||||
uint32_t ConfigSanityCheck(bool autocorrect = false);
|
||||
bool validateWiFiString(char *string, size_t size);
|
||||
|
||||
/* ==== Externals ==== */
|
||||
|
||||
extern LubeConfig_t LubeConfig;
|
||||
extern persistenceData_t PersistenceData;
|
||||
extern uint16_t eePersistenceAddress;
|
||||
|
||||
#endif // _CONFIG_H_
|
52
Software/include/debugger.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @file debugger.h
|
||||
*
|
||||
* @brief Header file for debugging functions and status in the ChainLube application.
|
||||
*
|
||||
* This file declares functions and status definitions for debugging purposes in the ChainLube project.
|
||||
* It includes functions to print system information, WiFi information, format EEPROM data,
|
||||
* handle debug messages, and manage the status of different debug ports.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _DEBUGGER_H_
|
||||
#define _DEBUGGER_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "webui.h"
|
||||
|
||||
typedef enum DebugStatus_e
|
||||
{
|
||||
disabled,
|
||||
enabled
|
||||
} DebugStatus_t;
|
||||
|
||||
typedef enum DebugPorts_e
|
||||
{
|
||||
dbg_Serial,
|
||||
dbg_Webui,
|
||||
dbg_cntElements
|
||||
} DebugPorts_t;
|
||||
|
||||
const char sDebugPorts[dbg_cntElements][7] = {
|
||||
"Serial",
|
||||
"WebUI"};
|
||||
|
||||
extern DebugStatus_t DebuggerStatus[dbg_cntElements];
|
||||
|
||||
enum LogLevel
|
||||
{
|
||||
LOG_INFO,
|
||||
LOG_WARN,
|
||||
LOG_ERROR
|
||||
};
|
||||
|
||||
void initDebugger();
|
||||
void pushCANDebug(uint32_t id, uint8_t dlc, uint8_t *data);
|
||||
void Debug_pushMessage(const char *format, ...);
|
||||
void SetDebugportStatus(DebugPorts_t port, DebugStatus_t status);
|
||||
void Debug_Process();
|
||||
|
||||
#endif
|
39
Software/include/dtc.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file dtc.h
|
||||
*
|
||||
* @brief Header file for handling Diagnostic Trouble Codes (DTC) in the ChainLube application.
|
||||
*
|
||||
* This file provides definitions and functions for handling Diagnostic Trouble Codes (DTC)
|
||||
* in the ChainLube project. It includes structures for DTC entries, severity levels,
|
||||
* and functions for DTC maintenance and processing. DTCs are used to track system errors and issues.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _DTC_H_
|
||||
#define _DTC_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "dtc_defs.h"
|
||||
|
||||
#define MAX_DTC_STORAGE 6
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DTCNum_t Number;
|
||||
uint32_t timestamp;
|
||||
DTCActive_t active;
|
||||
uint32_t debugVal;
|
||||
} DTCEntry_t;
|
||||
|
||||
void MaintainDTC(DTCNum_t DTC_no, boolean active, uint32_t DebugValue = 0);
|
||||
void ClearDTC(DTCNum_t DTC_no);
|
||||
void ClearAllDTC();
|
||||
DTCNum_t getlastDTC(boolean only_active);
|
||||
DTCNum_t ActiveDTCseverity(DTCSeverity_t severity);
|
||||
DTCSeverity_t getSeverityForDTC(DTCNum_t targetCode);
|
||||
void DTC_Process();
|
||||
|
||||
extern DTCEntry_t DTCStorage[MAX_DTC_STORAGE];
|
||||
#endif
|
95
Software/include/dtc_defs.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @file dtc_defs.h
|
||||
*
|
||||
* @brief Header file for Diagnostic Trouble Code (DTC) definitions in the ChainLube application.
|
||||
*
|
||||
* This file contains definitions for Diagnostic Trouble Codes (DTC) in the ChainLube project.
|
||||
* It includes enums for DTC active status, severity levels, and specific DTC codes.
|
||||
* The file also defines an array of DTC definitions and a timestamp indicating the generation time.
|
||||
*
|
||||
* @note This file is auto-generated by a script on 2025-05-04 12:01:55.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 04.05.2025
|
||||
*/
|
||||
|
||||
#ifndef DTC_DEFS_H
|
||||
#define DTC_DEFS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint32_t DTCNum_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DTC_INACTIVE,
|
||||
DTC_ACTIVE,
|
||||
DTC_PREVIOUS
|
||||
} DTCActive_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DTC_NONE,
|
||||
DTC_INFO,
|
||||
DTC_WARN,
|
||||
DTC_CRITICAL
|
||||
} DTCSeverity_t;
|
||||
|
||||
typedef struct {
|
||||
DTCNum_t code;
|
||||
DTCSeverity_t severity;
|
||||
} DTC_t;
|
||||
|
||||
#define DTC_NO_DTC 0
|
||||
#define DTC_TANK_EMPTY 1
|
||||
#define DTC_TANK_LOW 2
|
||||
#define DTC_NO_EEPROM_FOUND 3
|
||||
#define DTC_EEPROM_CFG_BAD 4
|
||||
#define DTC_EEPROM_PDS_BAD 5
|
||||
#define DTC_EEPROM_PDSADRESS_BAD 6
|
||||
#define DTC_EEPROM_VERSION_BAD 7
|
||||
#define DTC_FLASHFS_ERROR 8
|
||||
#define DTC_FLASHFS_VERSION_ERROR 9
|
||||
#define DTC_NO_GPS_SERIAL 10
|
||||
#define DTC_CAN_TRANSCEIVER_FAILED 11
|
||||
#define DTC_NO_CAN_SIGNAL 12
|
||||
#define DTC_EEPROM_CFG_SANITY 13
|
||||
#define DTC_FAKE_DTC_INFO 14
|
||||
#define DTC_FAKE_DTC_WARN 15
|
||||
#define DTC_FAKE_DTC_CRIT 16
|
||||
#define DTC_OBD2_KLINE_TIMEOUT 17
|
||||
#define DTC_OBD2_CAN_TIMEOUT 18
|
||||
#define DTC_OBD2_CAN_NO_RESPONSE 19
|
||||
#define DTC_OBD2_KLINE_NO_RESPONSE 20
|
||||
#define DTC_OBD2_KLINE_BAD_FRAME 21
|
||||
#define DTC_LAST_DTC 22
|
||||
|
||||
const DTC_t dtc_definitions[] = {
|
||||
{ DTC_NO_DTC , DTC_NONE }, // No Error
|
||||
{ DTC_TANK_EMPTY , DTC_CRITICAL }, // Ölvorrat ist komplett leer. Den Ölvorrat auffüllen und im Menu 'Wartung' zurück setzen
|
||||
{ DTC_TANK_LOW , DTC_WARN }, // Ölvorrat ist unter der Warnschwelle. Den Ölvorrat demnächst auffüllen und im Menu 'Wartung' zurück setzen
|
||||
{ DTC_NO_EEPROM_FOUND , DTC_CRITICAL }, // Es wurde kein EEPROM gefunden. Dies lässt einen Hardware-Defekt vermuten.
|
||||
{ DTC_EEPROM_CFG_BAD , DTC_CRITICAL }, // Die Checksumme der Config-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück
|
||||
{ DTC_EEPROM_PDS_BAD , DTC_CRITICAL }, // Die Checksumme der Betriebsdaten-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück
|
||||
{ DTC_EEPROM_PDSADRESS_BAD , DTC_CRITICAL }, // Die Adresse der Betriebsdaten-Partition im EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück
|
||||
{ DTC_EEPROM_VERSION_BAD , DTC_CRITICAL }, // Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version überein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück
|
||||
{ DTC_FLASHFS_ERROR , DTC_CRITICAL }, // Der Flashspeicher konnte nicht initialisiert werden. Aktualisieren sie Flash & Firmware
|
||||
{ DTC_FLASHFS_VERSION_ERROR , DTC_CRITICAL }, // Die Version des Flashspeicher stimmt nicht mit der Firmware-Version überein. Aktualisieren sie den Flash mit der passenden Update-Datei
|
||||
{ DTC_NO_GPS_SERIAL , DTC_CRITICAL }, // Es wurde kein GPS-Signal über die serielle Schnittstelle empfangen, Prüfen sie die Verbindung und das GPS-Modul
|
||||
{ DTC_CAN_TRANSCEIVER_FAILED , DTC_CRITICAL }, // Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Prüfen Sie die Hardware auf Defekte
|
||||
{ DTC_NO_CAN_SIGNAL , DTC_WARN }, // Es konnte kein CAN-Signal empfangen werden. Prüfen sie die Verbindung und die Einstellungen
|
||||
{ DTC_EEPROM_CFG_SANITY , DTC_WARN }, // Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen
|
||||
{ DTC_FAKE_DTC_INFO , DTC_INFO }, // Ein Dummy-DTC der Schwere "Info" für Debugging-Zwecke
|
||||
{ DTC_FAKE_DTC_WARN , DTC_WARN }, // Ein Dummy-DTC der Schwere "Warnung" für Debugging-Zwecke
|
||||
{ DTC_FAKE_DTC_CRIT , DTC_CRITICAL }, // Ein Dummy-DTC der Schwere "Kritisch" für Debugging-Zwecke
|
||||
{ DTC_OBD2_KLINE_TIMEOUT , DTC_CRITICAL }, // Die Anfrage über OBD2-KLine konnte nicht gesendet werden. Prüfen Sie den K-Line-Treiber (z. B. L9637D) und die Verkabelung.
|
||||
{ DTC_OBD2_CAN_TIMEOUT , DTC_CRITICAL }, // Die Anfrage an das Steuergerät über OBD2-CAN konnte nicht gesendet werden. Prüfen Sie die Verbindung zum CAN-Modul und die OBD2-Konfiguration.
|
||||
{ DTC_OBD2_CAN_NO_RESPONSE , DTC_WARN }, // Es wurde innerhalb der erwarteten Zeit keine Antwort vom Steuergerät über OBD2-CAN empfangen. Prüfen Sie, ob das Fahrzeug OBD2 unterstützt und die Verbindung korrekt ist.
|
||||
{ DTC_OBD2_KLINE_NO_RESPONSE , DTC_WARN }, // Es wurde innerhalb der erwarteten Zeit keine Antwort über OBD2-KLine empfangen. Prüfen Sie die Verbindung zum Steuergerät und die Protokollkompatibilität.
|
||||
{ DTC_OBD2_KLINE_BAD_FRAME , DTC_WARN }, // Das empfangene Frame war unvollständig oder entsprach nicht dem erwarteten OBD2-Format. Möglicherweise inkompatibles Steuergerät.
|
||||
{ DTC_LAST_DTC , DTC_NONE } // Last Error
|
||||
};
|
||||
|
||||
#endif // DTC_DEFS_H
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: 15e9152fb712bc6ed7c3353a05b1b54dc697f3e489a6e1ff42b7e57f0fa094d4
|
85
Software/include/globals.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @file globals.h
|
||||
*
|
||||
* @brief Header file for global variables and enums in the ChainLube application.
|
||||
*
|
||||
* This file contains declarations for global variables and enums used in the ChainLube application.
|
||||
* It includes enums for system status and EEPROM-related requests, as well as a struct for global variables.
|
||||
* The file also defines a struct for constants and initializes it with firmware and required flash version information.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _GLOBALS_H_
|
||||
#define _GLOBALS_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifndef FW_VERSION_MAJOR
|
||||
#define FW_VERSION_MAJOR 0
|
||||
#endif
|
||||
#ifndef FW_VERSION_MINOR
|
||||
#define FW_VERSION_MINOR 0
|
||||
#endif
|
||||
|
||||
#ifndef REQ_FLASH_MAJOR
|
||||
#define REQ_FLASH_MAJOR 0
|
||||
#endif
|
||||
#ifndef REQ_FLASH_MINOR
|
||||
#define REQ_FLASH_MINOR 0
|
||||
#endif
|
||||
|
||||
#ifndef GIT_REV
|
||||
#define GIT_REV "nogit"
|
||||
#endif
|
||||
|
||||
#ifndef FW_VERSION_STR
|
||||
#define FW_VERSION_STR "0.00"
|
||||
#endif
|
||||
#ifndef REQ_FLASH_STR
|
||||
#define REQ_FLASH_STR "0.00"
|
||||
#endif
|
||||
|
||||
typedef struct Globals_s
|
||||
{
|
||||
tSystem_Status systemStatus = sysStat_Startup; /**< Current system status */
|
||||
tSystem_Status resumeStatus = sysStat_Startup; /**< Status to resume after rain mode */
|
||||
uint16_t purgePulses = 0; /**< Number of purge pulses */
|
||||
EERequest_t requestEEAction = EE_IDLE; /**< EEPROM-related request */
|
||||
char DeviceName[33]; /**< Device name */
|
||||
char FlashVersion[10]; /**< Flash version */
|
||||
uint16_t eePersistenceAddress; /**< EEPROM persistence address */
|
||||
uint8_t TankPercentage; /**< Tank percentage */
|
||||
bool hasDTC; /**< Flag indicating the presence of Diagnostic Trouble Codes (DTC) */
|
||||
bool measurementActive; /**< Flag indicating active measurement */
|
||||
uint32_t measuredPulses; /**< Number of measured pulses */
|
||||
bool toggle_wifi;
|
||||
uint16_t isr_debug;
|
||||
} Globals_t;
|
||||
|
||||
extern Globals_t globals; /**< Global variable struct */
|
||||
|
||||
typedef struct Constants_s
|
||||
{
|
||||
uint8_t FW_Version_major; /**< Firmware version major number */
|
||||
uint8_t FW_Version_minor; /**< Firmware version minor number */
|
||||
uint8_t Required_Flash_Version_major; /**< Required flash version major number */
|
||||
uint8_t Required_Flash_Version_minor; /**< Required flash version minor number */
|
||||
char GitHash[11]; /**< Git hash string */
|
||||
} Constants_t;
|
||||
|
||||
const Constants_t constants PROGMEM = {
|
||||
FW_VERSION_MAJOR, FW_VERSION_MINOR, // Firmware_Version
|
||||
REQ_FLASH_MAJOR, REQ_FLASH_MINOR, // Required Flash Version
|
||||
QUOTE(GIT_REV) // Git-Hash-String
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initializes global variables.
|
||||
*/
|
||||
void initGlobals();
|
||||
|
||||
#endif // _GLOBALS_H_
|
36
Software/include/gps.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file gps.h
|
||||
*
|
||||
* @brief Header file for GPS-related functions in the ChainLube application.
|
||||
*
|
||||
* This file contains declarations for functions related to GPS (Global Positioning System) functionality
|
||||
* within the ChainLube application. It includes the initialization of the GPS module and processing of GPS
|
||||
* data to calculate wheel speed. Additionally, it references other necessary header files for configuration,
|
||||
* common definitions, diagnostics, and debugging.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _GPS_H_
|
||||
#define _GPS_H_
|
||||
|
||||
#include <TinyGPSPlus.h>
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "dtc.h"
|
||||
#include "debugger.h"
|
||||
|
||||
/**
|
||||
* @brief Initializes the GPS module.
|
||||
*/
|
||||
void Init_GPS();
|
||||
|
||||
/**
|
||||
* @brief Processes GPS data to calculate wheel speed.
|
||||
*
|
||||
* @return Calculated wheel speed in millimeters per second.
|
||||
*/
|
||||
uint32_t Process_GPS_WheelSpeed();
|
||||
|
||||
#endif // _GPS_H_
|
46
Software/include/led_colors.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file led_colors.h
|
||||
*
|
||||
* @brief Header file defining color values for LEDs in the ChainLube application.
|
||||
*
|
||||
* This file contains color definitions in hexadecimal format for various states and events of LEDs
|
||||
* used in the ChainLube application. It provides a convenient way to reference specific colors for
|
||||
* different visual indications in the system.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _LED_COLORS_H_
|
||||
#define _LED_COLORS_H_
|
||||
|
||||
#define COLOR_RED 0xFF0000
|
||||
#define COLOR_GREEN 0x00FF00
|
||||
#define COLOR_BLUE 0x0000FF
|
||||
#define COLOR_YELLOW 0xFF9600
|
||||
#define COLOR_ORANGE 0xFF2800
|
||||
#define COLOR_TEAL 0x00FF78
|
||||
#define COLOR_CYAN 0x00FFFF
|
||||
#define COLOR_PURPLE 0xB400FF
|
||||
#define COLOR_MAGENTA 0xFF0014
|
||||
#define COLOR_WHITE 0xFFFFFF
|
||||
#define COLOR_BLACK 0x000000
|
||||
#define COLOR_GOLD 0xFFDE1E
|
||||
#define COLOR_PINK 0xF25AFF
|
||||
#define COLOR_AQUA 0x32FFFF
|
||||
#define COLOR_JADE 0x00FF28
|
||||
#define COLOR_AMBER 0xFF6400
|
||||
#define COLOR_WARM_WHITE 0xFDF5E6
|
||||
|
||||
#define LED_DEFAULT_COLOR COLOR_WARM_WHITE
|
||||
#define LED_STARTUP_NORMAL COLOR_WARM_WHITE
|
||||
#define LED_STARTUP_TANKWARN COLOR_AMBER
|
||||
#define LED_NORMAL_COLOR COLOR_GREEN
|
||||
#define LED_RAIN_COLOR COLOR_BLUE
|
||||
#define LED_WASH_COLOR COLOR_JADE
|
||||
#define LED_WIFI_COLOR COLOR_YELLOW
|
||||
#define LED_PURGE_COLOR COLOR_MAGENTA
|
||||
#define LED_ERROR_COLOR COLOR_RED
|
||||
#define LED_SHUTDOWN_COLOR COLOR_CYAN
|
||||
|
||||
#endif /* _LED_COLORS_H_ */
|
35
Software/include/ledcontrol.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// === ledcontrol.h ===
|
||||
#ifndef _LEDCONTROL_H_
|
||||
#define _LEDCONTROL_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "led_colors.h"
|
||||
|
||||
// LED-Muster
|
||||
enum LedPattern
|
||||
{
|
||||
LED_PATTERN_ON,
|
||||
LED_PATTERN_FLASH,
|
||||
LED_PATTERN_FLASH_FAST,
|
||||
LED_PATTERN_BLINK,
|
||||
LED_PATTERN_BLINK_FAST,
|
||||
LED_PATTERN_BREATH,
|
||||
LED_PATTERN_BREATH_REVERSE
|
||||
};
|
||||
|
||||
// Initialisiert die LED-Steuerung
|
||||
void LEDControl_Init(uint8_t pin);
|
||||
|
||||
// Setzt den Basiszustand (Farbe + Pattern), wird verwendet wenn kein Override aktiv ist
|
||||
void LEDControl_SetBasic(uint32_t color, LedPattern pattern);
|
||||
|
||||
// Setzt ein Override mit Timeout (0 = bis explizit gecleart)
|
||||
void LEDControl_SetOverride(uint32_t color, LedPattern pattern, uint32_t durationMs);
|
||||
|
||||
// Hebt das Override wieder auf
|
||||
void LEDControl_ClearOverride();
|
||||
|
||||
// Muss regelmäßig aus loop() aufgerufen werden
|
||||
void LEDControl_Update();
|
||||
|
||||
#endif
|
27
Software/include/lubeapp.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @file lubeapp.h
|
||||
*
|
||||
* @brief Header file for the ChainLube application functions.
|
||||
*
|
||||
* This file contains function declarations related to the main functionality of the ChainLube
|
||||
* application. It includes functions for running the application and generating lubrication pulses.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _LUBEAPP_H_
|
||||
#define _LUBEAPP_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "globals.h"
|
||||
#include "dtc.h"
|
||||
#include "debugger.h"
|
||||
|
||||
void RunLubeApp(uint32_t add_milimeters);
|
||||
void LubePulse();
|
||||
|
||||
#endif /* _LUBEAPP_H_ */
|
10
Software/include/obd2_kline.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _OBD2_KLINE_H_
|
||||
#define _OBD2_KLINE_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// === Funktionen ===
|
||||
void Init_OBD2_KLine(Stream &serial); // Übergib z.B. SoftwareSerial oder Serial1
|
||||
uint32_t Process_OBD2_KLine_Speed(); // liefert mm seit letztem Aufruf
|
||||
|
||||
#endif
|
49
Software/include/sanitycheck.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file sanitycheck.h
|
||||
*
|
||||
* @brief Header file for sanity checks and configuration validation in the ChainLube application.
|
||||
*
|
||||
* This file contains checks and validations to ensure that the configuration and features of the
|
||||
* ChainLube application are compatible with the selected PCB revision and defined parameters.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _SANITYCHECK_H_
|
||||
#define _SANITYCHECK_H_
|
||||
|
||||
#ifndef PCB_REV
|
||||
#error "You must define PCB_REV"
|
||||
#else
|
||||
#if PCB_REV < 1 || PCB_REV > 4
|
||||
#error "Unsupported PCB-Revision"
|
||||
#endif
|
||||
|
||||
#if PCB_REV < 3 && defined(FEATURE_ENABLE_CAN)
|
||||
#error "CAN-Feature unsupported with this PCB-Rev"
|
||||
#endif
|
||||
#if PCB_REV < 4 && defined(DFEATURE_ENABLE_GPS)
|
||||
#error "GPS-Feature unsupported with this PCB-Rev"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ADMIN_PASSWORD
|
||||
#error "You need to define ADMIN_PASSWORD for OTA-Update"
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
|
||||
#ifndef WIFI_PASSWORD_CLIENT
|
||||
#error "You must define an WIFI_PASSWORD for Client-Mode"
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_SSID_CLIENT
|
||||
#error "You must define an WIFI_SSID for Client-Mode"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_AP_PASSWORD
|
||||
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
|
||||
#endif
|
||||
|
||||
#endif // _SANITYCHECK_H_
|
26
Software/include/struct2json.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @file struct2json.h
|
||||
*
|
||||
* @brief Header file for converting structs to JSON objects.
|
||||
*
|
||||
* @note This file is auto-generated by a script on 2025-06-15 11:37:51.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 15.06.2025
|
||||
*/
|
||||
|
||||
#ifndef _STRUCT2JSON_H_
|
||||
#define _STRUCT2JSON_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
void generateJsonObject_LubeConfig(JsonObject data);
|
||||
void generateJsonObject_PersistenceData(JsonObject data);
|
||||
|
||||
|
||||
#endif /* _STRUCT2JSON_H_ */
|
||||
|
||||
// CODEGENERATOR_CHECKSUM: 4702cb49ea55617cbb34715164810bb58d3c3f46fb1653b6f47bd4fd9cb0031e
|
51
Software/include/webui.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file webui.h
|
||||
*
|
||||
* @brief Header file for the web-based user interface (WebUI) in the ChainLube application.
|
||||
*
|
||||
* This file contains declarations for functions related to the initialization and processing of the
|
||||
* web-based user interface (WebUI). It includes the necessary libraries and dependencies for handling
|
||||
* web server functionality, asynchronous JSON operations, and live debugging through WebSockets.
|
||||
*
|
||||
* @author Marcel Peterkau
|
||||
* @date 09.01.2024
|
||||
*/
|
||||
|
||||
#ifndef _WEBUI_H_
|
||||
#define _WEBUI_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <FS.h>
|
||||
#include <LittleFS.h>
|
||||
#include <ESPAsyncTCP.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <Updater.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <AsyncJson.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "globals.h"
|
||||
#include "dtc.h"
|
||||
#include "common.h"
|
||||
#include "debugger.h"
|
||||
#include "struct2json.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
info,
|
||||
success,
|
||||
warning,
|
||||
error
|
||||
} NotificationType_t;
|
||||
|
||||
void initWebUI();
|
||||
void Webserver_Process();
|
||||
void Webserver_Shutdown();
|
||||
|
||||
void Websocket_PushLiveDebug(String Message);
|
||||
void Websocket_PushNotification(String Message, NotificationType_t type);
|
||||
|
||||
void TRACE_OnObdFrame(uint32_t id, bool rx, const uint8_t *d, uint8_t dlc, const char *note);
|
||||
|
||||
#endif // _WEBUI_H_
|
@@ -11,48 +11,116 @@
|
||||
[platformio]
|
||||
extra_configs =
|
||||
wifi_credentials.ini
|
||||
default_envs = pcb_rev_1-4_serial
|
||||
|
||||
[env:d1_mini]
|
||||
[env]
|
||||
platform = espressif8266
|
||||
board = d1_mini
|
||||
framework = arduino
|
||||
|
||||
upload_protocol = esptool
|
||||
upload_speed = 921600
|
||||
;upload_port = ChainLube_DDEFB2
|
||||
;upload_protocol = espota
|
||||
;upload_flags =
|
||||
; --auth=${wifi_cred.admin_password}
|
||||
|
||||
custom_firmware_version = 1.06
|
||||
|
||||
; --- C++17 erzwingen (für if constexpr etc.) ---
|
||||
; Entferne evtl. voreingestelltes -std=gnu++11/14 aus dem Core:
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
-std=gnu++14
|
||||
; Setze C++17 für alle Envs:
|
||||
build_flags =
|
||||
!python git_rev_macro.py
|
||||
-DWIFI_SSID=${wifi_cred.wifi_ssid}
|
||||
-DWIFI_PASSWORD=${wifi_cred.wifi_password}
|
||||
-std=gnu++17
|
||||
-DWIFI_SSID_CLIENT=${wifi_cred.wifi_ssid_client}
|
||||
-DWIFI_PASSWORD_CLIENT=${wifi_cred.wifi_password_client}
|
||||
-DADMIN_PASSWORD=${wifi_cred.admin_password}
|
||||
-DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
|
||||
-DWIFI_AP_IP_GW=10,0,0,1
|
||||
-DFEATURE_ENABLE_WIFI_CLIENT
|
||||
-DFEATURE_ENABLE_REMOTE_DEBUG
|
||||
;-DFEATURE_ENABLE_OLED
|
||||
;-DFEATURE_ENABLE_CAN
|
||||
;-DFEATURE_ENABLE_GPS
|
||||
-DPCB_REV=2
|
||||
|
||||
build_type = debug
|
||||
-DATOMIC_FS_UPDATE
|
||||
-DCAN_DEBUG_MESSAGE
|
||||
;-DFEATURE_ENABLE_WIFI_CLIENT
|
||||
;-DFEATURE_ENABLE_TIMER
|
||||
-DFEATURE_ENABLE_OLED
|
||||
|
||||
board_build.filesystem = littlefs
|
||||
extra_scripts =
|
||||
post:codegen/prepare_littlefs.py
|
||||
pre:codegen/run_pre.py
|
||||
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
monitor_speed = 115200
|
||||
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
lib_ldf_mode = deep
|
||||
lib_deps =
|
||||
olikraus/U8g2 @ ^2.28.8
|
||||
joaolopesf/RemoteDebug @ ^2.1.2
|
||||
fastled/FastLED @ ^3.5.0
|
||||
sstaub/Ticker @ ^4.2.0
|
||||
coryjfowler/mcp_can @ ^1.5.0
|
||||
robtillaart/I2C_EEPROM @ ^1.5.2
|
||||
mikalhart/TinyGPSPlus @ ^1.0.3
|
||||
me-no-dev/ESP Async WebServer @ ^1.2.3
|
||||
lib_deps =
|
||||
olikraus/U8g2 @ ^2.36.5
|
||||
adafruit/Adafruit NeoPixel @ ^1.15.1
|
||||
sstaub/Ticker @ ^4.4.0
|
||||
robtillaart/I2C_EEPROM @ ^1.9.2
|
||||
esphome/ESPAsyncWebServer-esphome @ 3.3.0
|
||||
bblanchon/ArduinoJson @ ^7.4.1
|
||||
coryjfowler/mcp_can @ ^1.5.1
|
||||
mikalhart/TinyGPSPlus @ ^1.1.0
|
||||
|
||||
[env:pcb_rev_1-4_serial]
|
||||
extends = env
|
||||
custom_pcb_revision = 4
|
||||
upload_protocol = esptool
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DPCB_REV=${this.custom_pcb_revision}
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|
||||
[env:pcb_rev_1-4_ota]
|
||||
extends = env
|
||||
custom_pcb_revision = 4
|
||||
upload_protocol = espota
|
||||
upload_port = 10.0.1.14
|
||||
upload_flags =
|
||||
--port=8266
|
||||
--auth=${wifi_cred.admin_password}
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DPCB_REV=${this.custom_pcb_revision}
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|
||||
[env:pcb_rev_1-3_serial]
|
||||
extends = env
|
||||
custom_pcb_revision = 3
|
||||
upload_protocol = esptool
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DPCB_REV=${this.custom_pcb_revision}
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|
||||
[env:pcb_rev_1-3_ota]
|
||||
extends = env
|
||||
custom_pcb_revision = 3
|
||||
upload_protocol = espota
|
||||
upload_port = 10.0.1.14
|
||||
upload_flags =
|
||||
--port=8266
|
||||
--auth=${wifi_cred.admin_password}
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DPCB_REV=${this.custom_pcb_revision}
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|
||||
[env:pcb_rev_1-2_serial]
|
||||
extends = env
|
||||
custom_pcb_revision = 2
|
||||
upload_protocol = esptool
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DPCB_REV=${this.custom_pcb_revision}
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|
||||
[env:pcb_rev_1-2_ota]
|
||||
extends = env
|
||||
custom_pcb_revision = 2
|
||||
upload_protocol = espota
|
||||
upload_port = 10.0.1.14
|
||||
upload_flags =
|
||||
--port=8266
|
||||
--auth=${wifi_cred.admin_password}
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
-DPCB_REV=${this.custom_pcb_revision}
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|