latest :)

This commit is contained in:
lovebird 2025-06-24 13:47:01 +02:00
parent 772904b65d
commit 3ea3fdefd0
116 changed files with 41 additions and 13485 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,32 +0,0 @@
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app

View File

@ -1,674 +0,0 @@
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>.

View File

@ -1,84 +0,0 @@
# Multichannel PID controller
Purpose of this PID controller is to lower overall amperage by cycling periodically through SSRs.
This is based on [osPID](http://ospid.com/blog/download/)
### Hardware
- [Controllino - Mega (Arduino compatible)](https://www.controllino.biz/product/controllino-mega/). [See PIN layout](./vendor/controllino/CONTROLLINO-MEGA-Pinout-1.jpg)
![](./vendor/controllino/mega.jpg)
- Optional: OLED & keypad control
- 8 channels
- Optional: Modbus
- TC sensor module, MAX6675 | MAX31855
## Features
### PID
- Autotune per PID
- Support for multiple TCs (see Marlin firmware)
### Configuration
- Set max Amp
- Set max/min heat time per cell/partition
## Milestones / Todos
- [x] Check/Simulate performance bottle necks for Mega
- [x] Temperature logger, serial & MaxC based
- [ ] Integrate PID/Auto-tune
- [ ] EEprom storage ?
- [x] Debug interface via RS485
- [x] Data - reader via RS232 (Matlab)
- [ ] Configuration (remote / local) -> Control-Freak - HMI
- [-] Model testing/verification
## Edge cases / Errors
- [ ] PID-Partition Timeout : PID didn't reach target with limits
- [ ] PID/Partition Overshooting : PID or operator malfunction
- [ ] PID Auto-tuning timeout : autotuning too long
- [ ] PID/Partition interference : partition overlap noise ?
## Modes
- [ ] Groups (partition groups)
- [ ] Serial (single linked partition group)
- [ ] Remote (HMI & control)
- [x] Master controller, only. Eg: control other PIDs via Modbus
## PP/PH
### New parameters
- [ ] Ramp-time
- [ ] Amp Budget
- [ ] Sub SP hold time
### New behaviours
- [ ] Currently there are multiple issues surfacing regarding the sheetpress. A profile should allow to have multiple target temperature points (eg: 1 hour to hold softening point, 30 mins for holding melting point rage, 10 mins for slightly over melting point : pressing phase) with a holding & ramp time each.
- [ ] The user should be able to adjust these profiles per flake size. For that we should also study the effects of various flake sizes regarding stresses created in the sheets.
### Modbus Implementation
- [-] Should implement broadcast queries : Status (Run/Alarm,...) , SP(s) & PV
### References
- [PID research](https://gitlab.com/plastichub/osr/research#pid-control)
### Hydra tests/experiments
- [x] calc. heat transfer, x & square (with screw | without screw | loaded)
- [x] Inkbird vs Rex
- [x] PID param transfer from E5 to Inkbird, Rexc : NO
- [x] test TC mount variants
- [x] different man. PID params (soak, hysteresis, ..)

Binary file not shown.

Binary file not shown.

View File

@ -1,53 +0,0 @@
/*******************************************************************************
* Thermocouple to serial for MAX31855 example
* Version: 1.00
* Date: 26-12-2011
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is an example of using the MAX31855 library for Arduino to read
* temperature from a thermocouple and send the reading to serial interfacec.
* Please check our wiki (www.rocketscream.com/wiki) for more information on
* using this piece of library.
*
* This example code is licensed under Creative Commons Attribution-ShareAlike
* 3.0 Unported License.
*
* Revision Description
* ======== ===========
* 1.00 Initial public release.
*
*******************************************************************************/
// ***** INCLUDES *****
#include <MAX31855.h>
// ***** PIN DEFINITIONS *****
const unsigned char thermocoupleSO = 12;
const unsigned char thermocoupleCS = 10;
const unsigned char thermocoupleCLK = 13;
MAX31855 MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK);
void setup()
{
Serial.begin(57600);
}
void loop()
{
double temperature;
// Retrieve thermocouple temperature in Degree Celsius
temperature = MAX31855.readThermocouple(CELSIUS);
Serial.print("Thermocouple temperature: ");
Serial.print(temperature);
Serial.println(" Degree Celsius");
// Retrieve cold junction temperature in Degree Celsius
temperature = MAX31855.readJunction(CELSIUS);
Serial.print("Junction temperature: ");
Serial.print(temperature);
Serial.println(" Degree Celsius");
delay(1000);
}

View File

@ -1,53 +0,0 @@
/*******************************************************************************
* Thermocouple to serial for MAX31855 example
* Version: 1.00
* Date: 26-12-2011
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is an example of using the MAX31855 library for Arduino to read
* temperature from a thermocouple and send the reading to serial interfacec.
* Please check our wiki (www.rocketscream.com/wiki) for more information on
* using this piece of library.
*
* This example code is licensed under Creative Commons Attribution-ShareAlike
* 3.0 Unported License.
*
* Revision Description
* ======== ===========
* 1.00 Initial public release.
*
*******************************************************************************/
// ***** INCLUDES *****
#include <MAX31855.h>
// ***** PIN DEFINITIONS *****
const unsigned char thermocoupleSO = 12;
const unsigned char thermocoupleCS = 10;
const unsigned char thermocoupleCLK = 13;
MAX31855 MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK);
void setup()
{
Serial.begin(57600);
}
void loop()
{
double temperature;
// Retrieve thermocouple temperature in Degree Celsius
temperature = MAX31855.readThermocouple(CELSIUS);
Serial.print("Thermocouple temperature: ");
Serial.print(temperature);
Serial.println(" Degree Celsius");
// Retrieve cold junction temperature in Degree Celsius
temperature = MAX31855.readJunction(CELSIUS);
Serial.print("Junction temperature: ");
Serial.print(temperature);
Serial.println(" Degree Celsius");
delay(1000);
}

View File

@ -1,230 +0,0 @@
/*******************************************************************************
* MAX31855 Library
* Version: 1.10
* Date: 24-07-2012
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is a MAX31855 library for Arduino. Please check our wiki
* (www.rocketscream.com/wiki) for more information on using this piece of
* library.
*
* This library is licensed under Creative Commons Attribution-ShareAlike 3.0
* Unported License.
*
* Revision Description
* ======== ===========
* 1.10 Added negative temperature support for both junction & thermocouple.
* 1.00 Initial public release.
*
*******************************************************************************/
#include "MAX31855.h"
MAX31855::MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK)
{
so = SO;
cs = CS;
sck = SCK;
// MAX31855 data output pin
pinMode(so, INPUT);
// MAX31855 chip select input pin
pinMode(cs, OUTPUT);
// MAX31855 clock input pin
pinMode(sck, OUTPUT);
// Default output pins state
digitalWrite(cs, HIGH);
digitalWrite(sck, LOW);
}
/*******************************************************************************
* Name: readThermocouple
* Description: Read the thermocouple temperature either in Degree Celsius or
* Fahrenheit. Internally, the conversion takes place in the
* background within 100 ms. Values are updated only when the CS
* line is high.
*
* Argument Description
* ========= ===========
* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return Description
* ========= ===========
* temperature Temperature of the thermocouple either in Degree Celsius or
* Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or
* FAULT_SHORT_VCC will be returned. These fault values are outside
* of the temperature range the MAX31855 is capable of.
*******************************************************************************/
double MAX31855::readThermocouple(unit_t unit)
{
unsigned long data;
double temperature;
// Initialize temperature
temperature = 0;
// Shift in 32-bit of data from MAX31855
data = readData();
// If fault is detected
if (data & 0x00010000)
{
// Check for fault type (3 LSB)
switch (data & 0x00000007)
{
// Open circuit
case 0x01:
temperature = FAULT_OPEN;
break;
// Thermocouple short to GND
case 0x02:
temperature = FAULT_SHORT_GND;
break;
// Thermocouple short to VCC
case 0x04:
temperature = FAULT_SHORT_VCC;
break;
}
}
// No fault detected
else
{
// Retrieve thermocouple temperature data and strip redundant data
data = data >> 18;
// Bit-14 is the sign
temperature = (data & 0x00001FFF);
// Check for negative temperature
if (data & 0x00002000)
{
// 2's complement operation
// Invert
data = ~data;
// Ensure operation involves lower 13-bit only
temperature = data & 0x00001FFF;
// Add 1 to obtain the positive number
temperature += 1;
// Make temperature negative
temperature *= -1;
}
// Convert to Degree Celsius
temperature *= 0.25;
// If temperature unit in Fahrenheit is desired
if (unit == FAHRENHEIT)
{
// Convert Degree Celsius to Fahrenheit
temperature = (temperature * 9.0/5.0)+ 32;
}
}
return (temperature);
}
/*******************************************************************************
* Name: readJunction
* Description: Read the thermocouple temperature either in Degree Celsius or
* Fahrenheit. Internally, the conversion takes place in the
* background within 100 ms. Values are updated only when the CS
* line is high.
*
* Argument Description
* ========= ===========
* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return Description
* ========= ===========
* temperature Temperature of the cold junction either in Degree Celsius or
* Fahrenheit.
*
*******************************************************************************/
double MAX31855::readJunction(unit_t unit)
{
double temperature;
unsigned long data;
// Shift in 32-bit of data from MAX31855
data = readData();
// Strip fault data bits & reserved bit
data = data >> 4;
// Bit-12 is the sign
temperature = (data & 0x000007FF);
// Check for negative temperature
if (data & 0x00000800)
{
// 2's complement operation
// Invert
data = ~data;
// Ensure operation involves lower 11-bit only
temperature = data & 0x000007FF;
// Add 1 to obtain the positive number
temperature += 1;
// Make temperature negative
temperature *= -1;
}
// Convert to Degree Celsius
temperature *= 0.0625;
// If temperature unit in Fahrenheit is desired
if (unit == FAHRENHEIT)
{
// Convert Degree Celsius to Fahrenheit
temperature = (temperature * 9.0/5.0)+ 32;
}
// Return the temperature
return (temperature);
}
/*******************************************************************************
* Name: readData
* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse
* width is 100 ns. No delay is required in this case.
*
* Argument Description
* ========= ===========
* 1. NIL
*
* Return Description
* ========= ===========
* data 32-bit of data acquired from the MAX31855 chip.
*
*******************************************************************************/
unsigned long MAX31855::readData()
{
int bitCount;
unsigned long data;
// Clear data
data = 0;
// Select the MAX31855 chip
digitalWrite(cs, LOW);
// Shift in 32-bit of data
for (bitCount = 31; bitCount >= 0; bitCount--)
{
digitalWrite(sck, HIGH);
// If data bit is high
if (digitalRead(so))
{
// Need to type cast data type to unsigned long, else compiler will
// truncate to 16-bit
data |= ((unsigned long)1 << bitCount);
}
digitalWrite(sck, LOW);
}
// Deselect MAX31855 chip
digitalWrite(cs, HIGH);
return(data);
}

View File

@ -1,36 +0,0 @@
#ifndef MAX31855_H
#define MAX31855_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define FAULT_OPEN 10000
#define FAULT_SHORT_GND 10001
#define FAULT_SHORT_VCC 10002
enum unit_t
{
CELSIUS,
FAHRENHEIT
};
class MAX31855
{
public:
MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK);
double readThermocouple(unit_t unit);
double readJunction(unit_t unit);
private:
unsigned char so;
unsigned char cs;
unsigned char sck;
unsigned long readData();
};
#endif

View File

@ -1,29 +0,0 @@
#######################################
# Syntax Coloring Map MAX31855
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
MAX31855 KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
readThermocouple KEYWORD2
readJunction KEYWORD2
#######################################
# Instances (KEYWORD2)
#######################################
#######################################
# Constants (LITERAL1)
#######################################
CELSIUS LITERAL1
FAHRENHEIT LITERAL1
FAULT_OPEN LITERAL1
FAULT_SHORT_GND LITERAL1
FAULT_SHORT_VCC LITERAL1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,232 +0,0 @@
{
"packages": [
{
"name": "CONTROLLINO_Boards",
"maintainer": "CONTROLLINO",
"websiteURL": "https://controllino.biz/",
"email": "info@controllino.biz",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"platforms": [
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "1.0.0",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/85e5ff22bb53cb3ffdbefd00f6ae30533db8cf86/Boards/ControllinoHW.zip?raw=true",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:0ca4811376820e2cfad4a6f840f9a05935efdbc7ed79d021c91b008c87cfd234",
"size": "216717",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.8.1-arduino5"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.0.1-arduino5"
}
]
},
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "1.1.0",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/c2f7ac0e27daae484a9d9f99a2ef4d8209002598/Boards/ControllinoHW.zip?raw=true",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:2ed3f3eaadb27da7e1a75063536c9dba3609e26d20c7ceee638cbfde93e10ec1",
"size": "223237",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MAXI Automation" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.8.1-arduino5"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.0.1-arduino5"
}
]
},
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "2.0.0",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/bbf44c9d965e5ff767f14cc8b5aa8f98e1cee681/Boards/ControllinoHW.zip?raw=true",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:d7f79ce738b0608bec3a340252aa79aaa6414b430b0945d5c770601bcb7b47af",
"size": "257287",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MAXI Automation" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.9.2-atmel3.5.3-arduino2"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.3.0-arduino8"
}
]
},
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "2.0.1",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/da2516ea2d6f2a5bb7976d3d06ef779da5685312/Boards/ControllinoHW.zip?raw=true",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:4FDAA6E210F68CFB77C5247F7ADE7C55D0065A2B23D6CD27747A932D0E1D8F43",
"size": "240312",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MAXI Automation" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.9.2-atmel3.5.3-arduino2"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.3.0-arduino8"
}
]
},
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "3.0.0",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/cca67c1cefa77897be062c05827176a3e8be07c2/Boards/ControllinoHW.zip?raw=true",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:653e16df2533b9fc3f360080876a5285a5aad2b7a8753fdf73eba6a7a1ad4dde",
"size": "63054",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MAXI Automation" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.9.2-atmel3.5.3-arduino2"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.3.0-arduino8"
}
]
},
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "3.0.2",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/1b422df4f4d57215d21f15a2c14c8f82d85a69c1/Boards/ControllinoHW.zip?raw=true",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:54122590abc97decb22f9ee698834c999130482eb4801a662fc7e5e4b2b1948f",
"size": "65808",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MAXI Automation" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.9.2-atmel3.5.3-arduino2"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.3.0-arduino8"
}
]
},
{
"name": "CONTROLLINO Boards",
"architecture": "avr",
"version": "3.1.0",
"category": "Contributed",
"url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/raw/master/Boards/ControllinoHW.zip",
"archiveFileName": "ControllinoHW.zip",
"checksum": "SHA-256:3520d650305373537c295874d88805ff49230c00b8db85606ec8a63969259f31",
"size": "65715",
"help": {
"online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues"
},
"boards": [
{ "name": "MINI" },
{ "name": "MAXI" },
{ "name": "MAXI Automation" },
{ "name": "MEGA" }
],
"toolsDependencies": [
{
"packager": "arduino",
"name": "avr-gcc",
"version": "4.9.2-atmel3.5.3-arduino2"
},
{
"packager": "arduino",
"name": "avrdude",
"version": "6.3.0-arduino8"
}
]
}
],
"tools":[]
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
## Sheetpress Partitions

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 190 KiB

View File

@ -1,5 +0,0 @@
Debug
src
__vm
.vs
node_modules

View File

@ -1,51 +0,0 @@
#include "Addon.h"
#include <Streaming.h>
#include <Vector.h>
#include <Arduino.h>
bool Addon::hasFlag(uchar flag)
{
return TEST(flags, flag);
}
void Addon::setFlag(uchar flag)
{
flags = SBI(flags, flag);
}
void Addon::clearFlag(uchar flag)
{
CBI(flags, flag);
}
void Addon::debug(Stream *stream)
{
}
void Addon::info(Stream *stream)
{
}
void Addon::enable()
{
this->clearFlag(DISABLED);
}
void Addon::disable()
{
this->setFlag(DISABLED);
}
bool Addon::enabled()
{
return this->hasFlag(DISABLED);
}
Addon *byId(Addons addons, uchar id)
{
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->id == id)
{
return addon;
}
}
return NULL;
}

View File

@ -1,72 +0,0 @@
#ifndef ADDON_H
#define ADDON_H
#include <WString.h>
#include <Vector.h>
#include "enums.h"
#include "common/macros.h"
#define ADDON_NORMAL 1 << LOOP | 1 << INFO | 1 << SETUP
#ifdef HAS_STATES
#define ADDON_STATED ADDON_NORMAL | 1 << STATE
#else
#define ADDON_STATED ADDON_NORMAL
#endif
class Stream;
class Addon
{
public:
const String name;
const short id;
millis_t now;
millis_t last;
millis_t dt;
Addon(String _name, short _id) : name(_name),
id(_id),
now(0),
last(0),
dt(0)
{
flags = ADDON_NORMAL;
}
Addon(String _name, short _id, short _flags) : name(_name),
id(_id),
flags(_flags)
{
}
virtual void debug(Stream *stream);
virtual void info(Stream *stream);
virtual short setup(){};
virtual short loop(){};
virtual short ok(){};
virtual bool pause(){};
virtual bool resume(){};
virtual bool destroy(){};
virtual String state() { return ""; };
int flags;
void setFlag(uchar flag);
bool hasFlag(uchar flag);
void clearFlag(uchar flag);
void enable();
void disable();
bool enabled();
#ifdef HAS_ADDON_EEP_STORE
void save(void* store);
void restore(void* store);
#endif
};
typedef Vector<Addon *> Addons;
Addon *byId(Addons addons, uchar id);
typedef short (Addon::*AddonFnPtr)(short);
#endif

View File

@ -1,26 +0,0 @@
#ifndef MULTI_PID_CONTROLLER_H
#define MULTI_PID_CONTROLLER_H
#include <Arduino.h>
#include <Streaming.h>
#include "../Addon.h"
#include "../config.h"
#include "./common/macros.h"
#include "./common/ppmath.h"
class Partition;
class MultiPIDController : public Addon
{
public:
MultiPIDController() : Addon(MPID_CTRL_STR, MPIDCTRL, ADDON_STATED)
{
this->setFlag(DEBUG);
}
private:
Partition *partions[MAX_PARTITIONS];
};
#endif

View File

@ -1,28 +0,0 @@
#ifndef PARTITION_H
#define PARTITION_H
#include <max6675.h>
#include "./config.h"
#include "./macros.h"
#include "./time.h"
/***
* The heating cell
*/
class Partition
{
public:
ushort state; // type: PARTITION_STATE
private:
ushort pin; // GPIO
ushort id;
const char name[124]; // for logging
// computation memory
millis_t last_active;
millis_t last_duration;
Partition* next; // for prio/linking
};
#endif

View File

@ -1,54 +0,0 @@
/*
* Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328
* Original code by Jesse Tane for http://labs.ideo.com August 2008
* Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support
* Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop
* Modified Oct 2009 by Dan Clemens to work with timer1 of the ATMega1280 or Arduino Mega
* Modified April 2012 by Paul Stoffregen
* Modified again, June 2014 by Paul Stoffregen
* Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality
*
* This is free software. You can redistribute it and/or modify it under
* the terms of Creative Commons Attribution 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#include "TimerOne.h"
TimerOne Timer1; // preinstatiate
unsigned short TimerOne::pwmPeriod = 0;
unsigned char TimerOne::clockSelectBits = 0;
void (*TimerOne::isrCallback)() = TimerOne::isrDefaultUnused;
// interrupt service routine that wraps a user defined function supplied by attachInterrupt
#if defined (__AVR_ATtiny85__)
ISR(TIMER1_COMPA_vect)
{
Timer1.isrCallback();
}
#elif defined(__AVR__)
ISR(TIMER1_OVF_vect)
{
Timer1.isrCallback();
}
#elif defined(__arm__) && defined(CORE_TEENSY)
void ftm1_isr(void)
{
uint32_t sc = FTM1_SC;
#ifdef KINETISL
if (sc & 0x80) FTM1_SC = sc;
#else
if (sc & 0x80) FTM1_SC = sc & 0x7F;
#endif
Timer1.isrCallback();
}
#endif
void TimerOne::isrDefaultUnused()
{
}

View File

@ -1,485 +0,0 @@
/*
* Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328
* Original code by Jesse Tane for http://labs.ideo.com August 2008
* Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support
* Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop
* Modified April 2012 by Paul Stoffregen - portable to other AVR chips, use inline functions
* Modified again, June 2014 by Paul Stoffregen - support Teensy 3.x & even more AVR chips
* Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality
*
*
* This is free software. You can redistribute it and/or modify it under
* the terms of Creative Commons Attribution 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#ifndef TimerOne_h_
#define TimerOne_h_
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "config/known_16bit_timers.h"
#if defined (__AVR_ATtiny85__)
#define TIMER1_RESOLUTION 256UL // Timer1 is 8 bit
#elif defined(__AVR__)
#define TIMER1_RESOLUTION 65536UL // Timer1 is 16 bit
#else
#define TIMER1_RESOLUTION 65536UL // assume 16 bits for non-AVR chips
#endif
// Placing nearly all the code in this .h file allows the functions to be
// inlined by the compiler. In the very common case with constant values
// the compiler will perform all calculations and simply write constants
// to the hardware registers (for example, setPeriod).
class TimerOne
{
#if defined (__AVR_ATtiny85__)
public:
//****************************
// Configuration
//****************************
void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) {
TCCR1 = _BV(CTC1); //clear timer1 when it matches the value in OCR1C
TIMSK |= _BV(OCIE1A); //enable interrupt when OCR1A matches the timer value
setPeriod(microseconds);
}
void setPeriod(unsigned long microseconds) __attribute__((always_inline)) {
const unsigned long cycles = microseconds * ratio;
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = _BV(CS10);
pwmPeriod = cycles;
} else
if (cycles < TIMER1_RESOLUTION * 2UL) {
clockSelectBits = _BV(CS11);
pwmPeriod = cycles / 2;
} else
if (cycles < TIMER1_RESOLUTION * 4UL) {
clockSelectBits = _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 4;
} else
if (cycles < TIMER1_RESOLUTION * 8UL) {
clockSelectBits = _BV(CS12);
pwmPeriod = cycles / 8;
} else
if (cycles < TIMER1_RESOLUTION * 16UL) {
clockSelectBits = _BV(CS12) | _BV(CS10);
pwmPeriod = cycles / 16;
} else
if (cycles < TIMER1_RESOLUTION * 32UL) {
clockSelectBits = _BV(CS12) | _BV(CS11);
pwmPeriod = cycles / 32;
} else
if (cycles < TIMER1_RESOLUTION * 64UL) {
clockSelectBits = _BV(CS12) | _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 64UL;
} else
if (cycles < TIMER1_RESOLUTION * 128UL) {
clockSelectBits = _BV(CS13);
pwmPeriod = cycles / 128;
} else
if (cycles < TIMER1_RESOLUTION * 256UL) {
clockSelectBits = _BV(CS13) | _BV(CS10);
pwmPeriod = cycles / 256;
} else
if (cycles < TIMER1_RESOLUTION * 512UL) {
clockSelectBits = _BV(CS13) | _BV(CS11);
pwmPeriod = cycles / 512;
} else
if (cycles < TIMER1_RESOLUTION * 1024UL) {
clockSelectBits = _BV(CS13) | _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 1024;
} else
if (cycles < TIMER1_RESOLUTION * 2048UL) {
clockSelectBits = _BV(CS13) | _BV(CS12);
pwmPeriod = cycles / 2048;
} else
if (cycles < TIMER1_RESOLUTION * 4096UL) {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS10);
pwmPeriod = cycles / 4096;
} else
if (cycles < TIMER1_RESOLUTION * 8192UL) {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11);
pwmPeriod = cycles / 8192;
} else
if (cycles < TIMER1_RESOLUTION * 16384UL) {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 16384;
} else {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10);
pwmPeriod = TIMER1_RESOLUTION - 1;
}
OCR1A = pwmPeriod;
OCR1C = pwmPeriod;
TCCR1 = _BV(CTC1) | clockSelectBits;
}
//****************************
// Run Control
//****************************
void start() __attribute__((always_inline)) {
TCCR1 = 0;
TCNT1 = 0;
resume();
}
void stop() __attribute__((always_inline)) {
TCCR1 = _BV(CTC1);
}
void restart() __attribute__((always_inline)) {
start();
}
void resume() __attribute__((always_inline)) {
TCCR1 = _BV(CTC1) | clockSelectBits;
}
//****************************
// PWM outputs
//****************************
//Not implemented yet for ATTiny85
//TO DO
//****************************
// Interrupt Function
//****************************
void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {
isrCallback = isr;
TIMSK |= _BV(OCIE1A);
}
void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) {
if(microseconds > 0) setPeriod(microseconds);
attachInterrupt(isr);
}
void detachInterrupt() __attribute__((always_inline)) {
//TIMSK = 0; // Timer 0 and Timer 1 both use TIMSK register so setting it to 0 will override settings for Timer1 as well
TIMSK &= ~_BV(OCIE1A);
}
static void (*isrCallback)();
static void isrDefaultUnused();
private:
static unsigned short pwmPeriod;
static unsigned char clockSelectBits;
static const byte ratio = (F_CPU)/ ( 1000000 );
#elif defined(__AVR__)
public:
//****************************
// Configuration
//****************************
void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) {
TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer
TCCR1A = 0; // clear control register A
setPeriod(microseconds);
}
void setPeriod(unsigned long microseconds) __attribute__((always_inline)) {
const unsigned long cycles = (F_CPU / 2000000) * microseconds;
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = _BV(CS10);
pwmPeriod = cycles;
} else
if (cycles < TIMER1_RESOLUTION * 8) {
clockSelectBits = _BV(CS11);
pwmPeriod = cycles / 8;
} else
if (cycles < TIMER1_RESOLUTION * 64) {
clockSelectBits = _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 64;
} else
if (cycles < TIMER1_RESOLUTION * 256) {
clockSelectBits = _BV(CS12);
pwmPeriod = cycles / 256;
} else
if (cycles < TIMER1_RESOLUTION * 1024) {
clockSelectBits = _BV(CS12) | _BV(CS10);
pwmPeriod = cycles / 1024;
} else {
clockSelectBits = _BV(CS12) | _BV(CS10);
pwmPeriod = TIMER1_RESOLUTION - 1;
}
ICR1 = pwmPeriod;
TCCR1B = _BV(WGM13) | clockSelectBits;
}
//****************************
// Run Control
//****************************
void start() __attribute__((always_inline)) {
TCCR1B = 0;
TCNT1 = 0; // TODO: does this cause an undesired interrupt?
resume();
}
void stop() __attribute__((always_inline)) {
TCCR1B = _BV(WGM13);
}
void restart() __attribute__((always_inline)) {
start();
}
void resume() __attribute__((always_inline)) {
TCCR1B = _BV(WGM13) | clockSelectBits;
}
//****************************
// PWM outputs
//****************************
void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) {
unsigned long dutyCycle = pwmPeriod;
dutyCycle *= duty;
dutyCycle >>= 10;
if (pin == TIMER1_A_PIN) OCR1A = dutyCycle;
#ifdef TIMER1_B_PIN
else if (pin == TIMER1_B_PIN) OCR1B = dutyCycle;
#endif
#ifdef TIMER1_C_PIN
else if (pin == TIMER1_C_PIN) OCR1C = dutyCycle;
#endif
}
void pwm(char pin, unsigned int duty) __attribute__((always_inline)) {
if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); }
#ifdef TIMER1_B_PIN
else if (pin == TIMER1_B_PIN) { pinMode(TIMER1_B_PIN, OUTPUT); TCCR1A |= _BV(COM1B1); }
#endif
#ifdef TIMER1_C_PIN
else if (pin == TIMER1_C_PIN) { pinMode(TIMER1_C_PIN, OUTPUT); TCCR1A |= _BV(COM1C1); }
#endif
setPwmDuty(pin, duty);
TCCR1B = _BV(WGM13) | clockSelectBits;
}
void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) {
if (microseconds > 0) setPeriod(microseconds);
pwm(pin, duty);
}
void disablePwm(char pin) __attribute__((always_inline)) {
if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1);
#ifdef TIMER1_B_PIN
else if (pin == TIMER1_B_PIN) TCCR1A &= ~_BV(COM1B1);
#endif
#ifdef TIMER1_C_PIN
else if (pin == TIMER1_C_PIN) TCCR1A &= ~_BV(COM1C1);
#endif
}
//****************************
// Interrupt Function
//****************************
void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {
isrCallback = isr;
TIMSK1 = _BV(TOIE1);
}
void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) {
if(microseconds > 0) setPeriod(microseconds);
attachInterrupt(isr);
}
void detachInterrupt() __attribute__((always_inline)) {
TIMSK1 = 0;
}
static void (*isrCallback)();
static void isrDefaultUnused();
private:
// properties
static unsigned short pwmPeriod;
static unsigned char clockSelectBits;
#elif defined(__arm__) && defined(CORE_TEENSY)
#if defined(KINETISK)
#define F_TIMER F_BUS
#elif defined(KINETISL)
#define F_TIMER (F_PLL/2)
#endif
public:
//****************************
// Configuration
//****************************
void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) {
setPeriod(microseconds);
}
void setPeriod(unsigned long microseconds) __attribute__((always_inline)) {
const unsigned long cycles = (F_TIMER / 2000000) * microseconds;
// A much faster if-else
// This is like a binary serch tree and no more than 3 conditions are evaluated.
// I haven't checked if this becomes significantly longer ASM than the simple ladder.
// It looks very similar to the ladder tho: same # of if's and else's
/*
// This code does not work properly in all cases :(
// https://github.com/PaulStoffregen/TimerOne/issues/17
if (cycles < TIMER1_RESOLUTION * 16) {
if (cycles < TIMER1_RESOLUTION * 4) {
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = 0;
pwmPeriod = cycles;
}else{
clockSelectBits = 1;
pwmPeriod = cycles >> 1;
}
}else{
if (cycles < TIMER1_RESOLUTION * 8) {
clockSelectBits = 3;
pwmPeriod = cycles >> 3;
}else{
clockSelectBits = 4;
pwmPeriod = cycles >> 4;
}
}
}else{
if (cycles > TIMER1_RESOLUTION * 64) {
if (cycles > TIMER1_RESOLUTION * 128) {
clockSelectBits = 7;
pwmPeriod = TIMER1_RESOLUTION - 1;
}else{
clockSelectBits = 7;
pwmPeriod = cycles >> 7;
}
}
else{
if (cycles > TIMER1_RESOLUTION * 32) {
clockSelectBits = 6;
pwmPeriod = cycles >> 6;
}else{
clockSelectBits = 5;
pwmPeriod = cycles >> 5;
}
}
}
*/
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = 0;
pwmPeriod = cycles;
} else
if (cycles < TIMER1_RESOLUTION * 2) {
clockSelectBits = 1;
pwmPeriod = cycles >> 1;
} else
if (cycles < TIMER1_RESOLUTION * 4) {
clockSelectBits = 2;
pwmPeriod = cycles >> 2;
} else
if (cycles < TIMER1_RESOLUTION * 8) {
clockSelectBits = 3;
pwmPeriod = cycles >> 3;
} else
if (cycles < TIMER1_RESOLUTION * 16) {
clockSelectBits = 4;
pwmPeriod = cycles >> 4;
} else
if (cycles < TIMER1_RESOLUTION * 32) {
clockSelectBits = 5;
pwmPeriod = cycles >> 5;
} else
if (cycles < TIMER1_RESOLUTION * 64) {
clockSelectBits = 6;
pwmPeriod = cycles >> 6;
} else
if (cycles < TIMER1_RESOLUTION * 128) {
clockSelectBits = 7;
pwmPeriod = cycles >> 7;
} else {
clockSelectBits = 7;
pwmPeriod = TIMER1_RESOLUTION - 1;
}
uint32_t sc = FTM1_SC;
FTM1_SC = 0;
FTM1_MOD = pwmPeriod;
FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_CPWMS | clockSelectBits | (sc & FTM_SC_TOIE);
}
//****************************
// Run Control
//****************************
void start() __attribute__((always_inline)) {
stop();
FTM1_CNT = 0;
resume();
}
void stop() __attribute__((always_inline)) {
FTM1_SC = FTM1_SC & (FTM_SC_TOIE | FTM_SC_CPWMS | FTM_SC_PS(7));
}
void restart() __attribute__((always_inline)) {
start();
}
void resume() __attribute__((always_inline)) {
FTM1_SC = (FTM1_SC & (FTM_SC_TOIE | FTM_SC_PS(7))) | FTM_SC_CPWMS | FTM_SC_CLKS(1);
}
//****************************
// PWM outputs
//****************************
void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) {
unsigned long dutyCycle = pwmPeriod;
dutyCycle *= duty;
dutyCycle >>= 10;
if (pin == TIMER1_A_PIN) {
FTM1_C0V = dutyCycle;
} else if (pin == TIMER1_B_PIN) {
FTM1_C1V = dutyCycle;
}
}
void pwm(char pin, unsigned int duty) __attribute__((always_inline)) {
setPwmDuty(pin, duty);
if (pin == TIMER1_A_PIN) {
*portConfigRegister(TIMER1_A_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;
} else if (pin == TIMER1_B_PIN) {
*portConfigRegister(TIMER1_B_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;
}
}
void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) {
if (microseconds > 0) setPeriod(microseconds);
pwm(pin, duty);
}
void disablePwm(char pin) __attribute__((always_inline)) {
if (pin == TIMER1_A_PIN) {
*portConfigRegister(TIMER1_A_PIN) = 0;
} else if (pin == TIMER1_B_PIN) {
*portConfigRegister(TIMER1_B_PIN) = 0;
}
}
//****************************
// Interrupt Function
//****************************
void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {
isrCallback = isr;
FTM1_SC |= FTM_SC_TOIE;
NVIC_ENABLE_IRQ(IRQ_FTM1);
}
void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) {
if(microseconds > 0) setPeriod(microseconds);
attachInterrupt(isr);
}
void detachInterrupt() __attribute__((always_inline)) {
FTM1_SC &= ~FTM_SC_TOIE;
NVIC_DISABLE_IRQ(IRQ_FTM1);
}
static void (*isrCallback)();
static void isrDefaultUnused();
private:
// properties
static unsigned short pwmPeriod;
static unsigned char clockSelectBits;
#undef F_TIMER
#endif
};
extern TimerOne Timer1;
#endif

View File

@ -1,9 +0,0 @@
#ifndef VERSION_H
#define VERSION_H
#define VERSION "0.7|2f05843f89b2b8f6d75276ba363f7c2e17383e0b"
#define CID "47"
#endif

View File

@ -1,59 +0,0 @@
#ifndef CURRENT_SENSOR_H
#define CURRENT_SENSOR_H
#include <Arduino.h>
#include <Streaming.h>
#include "../Addon.h"
#include "../config.h"
#include "../common/macros.h"
#include "../common/ppmath.h"
class CurrentSensor : public Addon
{
public:
CurrentSensor(short _pin) : pin(_pin),
load(0),
Addon(CURRENT_SENSOR_STR, CURRENT_SENSOR)
{
// this->setFlag(DEBUG);
}
short setup()
{
pinMode(pin, INPUT);
loop();
}
short loop()
{
if (now - last > MOTOR_LOAD_READ_INTERVAL)
{
load = digitalRead(pin);
last = now;
}
return load;
}
short ok()
{
return !load;
}
void debug(Stream *stream)
{
*stream << this->name << ":" << ok();
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Pin:" << pin);
}
millis_t lastOverload;
protected:
short pin;
short load;
};
#endif

View File

@ -1,56 +0,0 @@
#ifndef DIRECTION_SWITCH_H
#define DIRECTION_SWITCH_H
#include "../config.h"
#include "../components/3PosAnalog.h"
#include "../Addon.h"
#include <Streaming.h>
#include "../common/macros.h"
class DirectionSwitch : public Addon
{
public:
Pos3Analog dir_switch;
DirectionSwitch() : dir_switch(DIR_SWITCH_UP_PIN, DIR_SWITCH_DOWN_PIN),
Addon(DIRECTION_SWITCH_STR, DIRECTION_SWITCH)
{
}
void debug(Stream *stream)
{
*stream << this->name << ":" << SPACE(dir_switch.switch_pos) << SPACE(dir_switch.last_switch);
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Up Pin:" << DIR_SWITCH_UP_PIN) << SPACE("\t | Down Pin :" << DIR_SWITCH_DOWN_PIN);
}
short setup()
{
dir_switch.setup();
return loop();
}
short loop()
{
if (now - dt > ANALOG_READ_INTERVAL)
{
_value = dir_switch.loop();
dt = now;
}
return _value;
}
short value()
{
return _value;
}
short last()
{
return dir_switch.last_switch;
}
private:
short _value;
};
#endif

View File

@ -1,40 +0,0 @@
#ifndef MOTOR_TEMPERATURE_H
#define MOTOR_TEMPERATURE_H
#include <Arduino.h>
#include "Addon.h"
#include "config.h"
#include <Streaming.h>
#include "../common/macros.h"
#include "TemperatureSensor.h"
class MotorTemperature : public Addon
{
private:
TemperatureSensor sensor;
public:
MotorTemperature() : sensor(MOTOR_TEMPERTURE_SCK_PIN, MOTOR_TEMPERTURE_CS_PIN, MOTOR_TEMPERTURE_SO_PIN, MOTOR_TEMPERTURE_MAX, MOTOR_TEMPERTURE_INTERVAL),
Addon(MOTOR_TEMPERATURE_STR, MOTOR_TEMPERATURE) {}
virtual short ok()
{
return sensor.ok();
}
void debug(Stream *stream)
{
// *stream << this->name << ":" << this->ok();
}
void info(Stream *stream)
{
/*
*stream << this->name << "\n\t : " <<
SPACE("Pin SCK:" << MOTOR_TEMPERTURE_SCK_PIN ) <<
SPACE("Pin CS :" << MOTOR_TEMPERTURE_CS_PIN ) <<
SPACE("Pin SO:" << MOTOR_TEMPERTURE_SO_PIN ) <<
SPACE("Max" << MOTOR_TEMPERTURE_MAX ) <<
SPACE("Interval" << MOTOR_TEMPERTURE_INTERVAL );
*/
}
};
#endif

View File

@ -1,148 +0,0 @@
#ifndef OPERATION_MODE_SWITCH_H
#define OPERATION_MODE_SWITCH_H
#ifdef HAS_STATES
#include <ArduinoJson.h>
#endif
#ifndef OP_MODE_ANALOG
#include <Bounce2.h>
#endif
#include "../config.h"
#include "../Addon.h"
#include <Streaming.h>
#include "../common/macros.h"
#include "../common/ppmath.h"
class OperationModeSwitch : public Addon
{
public:
short pin1;
#ifdef OP_MODE_ANALOG
ushort level1;
ushort level2;
ushort level3;
OperationModeSwitch(short _pin1, ushort _level1, ushort _level2, ushort _level3) : pin1(_pin1),
level1(_level1),
level2(_level2),
level3(_level3),
Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH)
{
//setFlag(DEBUG);
}
#ifdef HAS_STATES
String state()
{
const int capacity = JSON_OBJECT_SIZE(2);
StaticJsonDocument<capacity> doc;
doc['0'] = id;
doc['1'] = value();
return doc.as<String>();
}
#endif
void debug(Stream *stream)
{
//*stream << this->name << SPACE(value());
}
void info(Stream *stream)
{
//*stream << this->name << "\n\t ";
}
short value()
{
ushort value = analogRead(pin1);
if (RANGE(value, level1 - 10, level1 + 10))
{
return OP_DEBUG;
}
if (RANGE(value, level2 - 10, level2 + 10))
{
return OP_NORMAL;
}
if (RANGE(value, level3 - 10, level3 + 10))
{
return OP_SERVICE;
}
return OP_NONE;
}
short setup()
{
}
short loop()
{
// Serial.println(analogRead(pin1));
}
#else
Bounce debouncer1;
Bounce debouncer2;
Bounce debouncer3;
short pin1;
short pin2;
short pin3;
OperationModeSwitch(short _pin1, short _pin2, short _pin3) : pin1(_pin1), // 1-2
pin2(_pin2), // 5-6
pin3(_pin3), // 9-10
Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH)
{
}
void debug(Stream *stream)
{
*stream << this->name << ": PIN1 " << SPACE(!debouncer1.read()) << ": PIN2 " << SPACE(!debouncer2.read()) << ": PIN3 " << SPACE(!debouncer3.read());
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : ";
}
short value()
{
if (!debouncer1.read())
{
return OP_DEBUG;
}
if (!debouncer2.read())
{
return OP_NORMAL;
}
if (!debouncer3.read())
{
return OP_SERVICE;
}
return OP_NONE;
}
short setup()
{
this->debouncer1 = Bounce();
this->debouncer1.attach(this->pin1, INPUT_PULLUP);
this->debouncer1.interval(25);
this->debouncer2 = Bounce();
this->debouncer2.attach(this->pin2, INPUT_PULLUP);
this->debouncer2.interval(25);
this->debouncer3 = Bounce();
this->debouncer3.attach(this->pin3, INPUT_PULLUP);
this->debouncer3.interval(25);
}
short loop()
{
this->debouncer1.update();
this->debouncer2.update();
this->debouncer3.update();
}
#endif
};
#endif

View File

@ -1,30 +0,0 @@
#ifndef RESET_H
#define RESET_H
// This module uses currently a normally closed momentary button.
static millis_t sw_reset_TS = 0;
static void reset_setup()
{
pinMode(RESET_PIN, INPUT_PULLUP);
sw_reset_TS = millis();
}
static void reset_loop()
{
if (millis() - sw_reset_TS > RESET_INTERVAL) {
#if RESET_NC == true
// globals.isReset = digitalRead(RESET_PIN);
#else
// globals.isReset = !digitalRead(RESET_PIN);
#endif
sw_reset_TS = millis();
// if(globals.isReset && DEBUG){
// Serial.println("reset");
// }
}
}
#endif

View File

@ -1,110 +0,0 @@
#ifndef STATUS_H
#define STATUS_H
#include "../addon.h"
#include "../types.h"
#include "../common/macros.h"
#include <Arduino.h>
class Status : public Addon
{
public:
Status(short _errorPin, short _okPin) : errorPin(_errorPin),
okPin(_okPin),
status_blink_TS(0),
doBlink(false),
last_blink(true),
blink_start_ts(0),
max_blink_time(HOUR_MS),
Addon(STATUS_STR, STATUS)
{
}
short setup()
{
pinMode(okPin, OUTPUT);
pinMode(errorPin, OUTPUT);
}
short loop()
{
if (now - status_blink_TS > 1000)
{
status_blink_TS = millis();
last_blink = !last_blink;
if (doBlink)
{
digitalWrite(errorPin, last_blink);
}
if (now - blink_start_ts > max_blink_time)
{
doBlink = false;
}
}
}
void status_blink(bool blink)
{
if (!doBlink && blink)
{
blink_start_ts = millis();
}
doBlink = blink;
}
void setStatusAllOn()
{
if (doBlink)
{
return;
}
digitalWrite(errorPin, HIGH);
digitalWrite(okPin, HIGH);
}
void setStatusAllOff()
{
if (doBlink)
{
return;
}
digitalWrite(errorPin, LOW);
digitalWrite(okPin, LOW);
}
void setStatus(bool error)
{
if (doBlink)
{
return;
}
if (error)
{
digitalWrite(errorPin, HIGH);
digitalWrite(okPin, LOW);
}
else
{
digitalWrite(okPin, HIGH);
digitalWrite(errorPin, LOW);
}
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Error Pin:" << errorPin) << SPACE("\t | Ok Pin :" << okPin);
}
private:
millis_t status_blink_TS;
bool doBlink;
bool last_blink;
millis_t blink_start_ts;
millis_t max_blink_time;
short okPin;
short errorPin;
};
#endif

View File

@ -1,42 +0,0 @@
#ifndef TEMPERATURE_SENSOR_H
#define TEMPERATURE_SENSOR_H
#include <max6675.h>
#include "../config.h"
#include "../macros.h"
#include "../time.h"
class TemperatureSensor
{
public:
TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)),
temperature(),
temperature_TS(millis()),
maxTemp(_max),
interval(_interval) {}
bool ok()
{
return temperature < maxTemp;
}
void loop()
{
if (millis() - temperature_TS > interval)
{
temperature_TS = millis();
temperature = ktc.readCelsius();
}
}
private:
MAX6675 ktc;
short temperature;
short maxTemp;
short interval;
millis_t temperature_TS;
};
#endif

View File

@ -1,192 +0,0 @@
#include <Vector.h>
#include <Streaming.h>
#include <Arduino.h>
#include "app.h"
#include "features.h"
#include <MemoryFree.h>
#include "Version.h"
// #define DEBUG_MEM
static Addon *addonsArray[10];
#ifdef HAS_STATES
short App::appState(short nop)
{
uchar s = addons.size();
uchar si = 0;
String out = "";
uchar l = numByFlag(STATE);
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (!!(addon->hasFlag(STATE)))
{
si++;
out += addon->state();
if (si < l)
{
out += ",";
}
}
}
const char *response = Bridge::CreateResponse(STATE_RESPONSE_CODE, 0, out.c_str());
Serial.write(response);
}
#endif
short App::ok()
{
return E_OK;
}
App::App() : Addon("APP", APP, 1 << STATE),
#ifdef HAS_STATUS
status(new Status(STATUS_ERROR_PIN, STATUS_OK_PIN)),
#endif
cSensor(new CurrentSensor(CURRENT_SENSOR_PIN))
{
}
short App::getAppState(short val)
{
return _state;
}
void (*resetFunction)(void) = 0; // Self reset (to be used with watchdog)
void printMem()
{
Serial.print("mem: ");
Serial.print(freeMemory());
Serial.println('--');
}
short App::setup()
{
Serial.begin(DEBUG_BAUD_RATE);
Serial.print("Booting Firmware ...................... \n\n");
Serial.print(FIRMWARE_VERSION);
Serial.print(" | ");
Serial.print(VERSION);
Serial.print(" | ");
Serial.print(CID);
Serial.println(" - \n");
addons.setStorage(addonsArray);
setup_addons();
#ifdef MEARSURE_PERFORMANCE
printPerfTS = 0;
addonLoopTime = 0;
bridgeLoopTime = 0;
#endif
debugTS = 0;
loopTS = 0;
_state = 0;
#ifdef DEBUG_MEM
timer.every(
5000, [](App *app) -> void {
printMem();
},
this);
#endif
}
void App::onError(int error)
{
if (_state != ERROR)
{
#ifdef HAS_STATUS
status->status_blink(true);
#endif
_state = ERROR;
}
}
short App::loop()
{
timer.tick();
now = millis();
loop_addons();
loop_com();
loop_pid();
delay(LOOP_DELAY);
}
void App::loop_com()
{
if (millis() - comTS > 300)
{
#if defined(HAS_BRIDGE) && defined(HAS_SERIAL)
PPSerial::Message *msg = serialBridge->read();
if (msg)
{
switch (msg->verb)
{
case Bridge::EC_METHOD:
{
char *strings[3];
char *ptr = NULL;
byte index = 0;
ptr = strtok(msg->payload, ":");
while (ptr != NULL && index < 4)
{
strings[index] = ptr;
index++;
ptr = strtok(NULL, ":");
}
int id = atoi(strings[0]);
char *_method = strings[1];
SKeyVal *method = VSL::instance()->hasMethod(id, _method);
if (method)
{
int arg = atoi(strings[2]);
Addon *addon = (Addon *)method->instance;
AddonFnPtr ptr = method->mPtr;
short ret = (addon->*ptr)(arg);
if (TEST(msg->flags, Bridge::STATE))
{
#ifdef HAS_STATES
this->appState(0);
#endif
}
else if (TEST(msg->flags, Bridge::RECEIPT))
{
#ifdef BRIDGE_HAS_RESPONSE
const char *response = Bridge::CreateResponse(msg->id, 0, ret);
Serial.write(response);
#endif
}
if (TEST(msg->flags, Bridge::DEBUG))
{
// Serial.println("Called command");
}
}
else
{
VSL::instance()->debug();
if (TEST(msg->flags, Bridge::DEBUG))
{
/*
Serial.print("Incoming message, cant find class & method ");
Serial.print(_class);
Serial.print(":");
Serial.print(_method);
Serial.print("\n");
*/
}
}
break;
}
}
msg->payload = NULL;
}
#endif
comTS = millis();
}
}

View File

@ -1,97 +0,0 @@
#ifndef APP_H
#define APP_H
#include "config.h"
#include <Vector.h>
#include "types.h"
#include "Addon.h"
#include "common/timer.h"
class DirectionSwitch;
class CurrentSensor;
class Status;
class PPSerial;
class ModbusBridge;
class App : public Addon
{
public:
App();
DirectionSwitch *dirSwitch;
CurrentSensor *cSensor;
Status *status;
PPSerial *serialBridge;
ModbusBridge *modbusBridge;
Addon *byId(short id);
short setup();
short loop();
short debug();
short info();
short ok();
void loop_service();
void loop_com();
void loop_simulate();
void loop_pid();
void loop_addons();
void setup_addons();
void onDidSetupAddons();
ushort numByFlag(ushort flag);
short shred(short value = 0);
ushort loopShred();
void loopShredCancel();
void onError(int error);
Vector<Addon *> addons;
// bridge
short setFlag(ushort addonId, ushort flag);
#ifdef HAS_STATES
short appState(short nop = 0);
String state();
#endif
millis_t loopTS;
millis_t wait;
millis_t comTS;
millis_t waitTS;
Timer<10, millis> timer; // 10 concurrent tasks, using micros as resolution
enum APP_STATE
{
RESET = 0,
REMOTE = 2,
LOCAL = 3,
TEST = 3,
ERROR = 5
};
short _state;
short _error;
short getLastError(short val = 0){
return _error;
}
short setLastError(short val = 0);
short setAppState(short newState);
short getAppState(short val);
private:
#ifdef MEARSURE_PERFORMANCE
millis_t addonLoopTime;
millis_t bridgeLoopTime;
millis_t printPerfTS;
#endif
millis_t debugTS;
};
#endif

View File

@ -1,150 +0,0 @@
#include <Vector.h>
#include <Streaming.h>
#include <Arduino.h>
#include "app.h"
#include "config.h"
#include "types.h"
#include "common/macros.h"
#include "Addon.h"
#include "features.h"
void App::onDidSetupAddons(){
#ifdef HAS_STATUS
status->setStatusAllOn();
delay(SECS * 2);
status->setStatusAllOff();
status->setStatus(false);
#endif
}
short App::setFlag(ushort addonId, ushort flag)
{
Addon *addon = byId(addonId);
if (addon)
{
addon->setFlag(flag);
return E_OK;
}
return ERROR_WARNING;
}
ushort App::numByFlag(ushort flag)
{
uchar s = addons.size();
uchar l = 0;
String out = "";
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (!!(addon->hasFlag(flag)))
{
l++;
}
}
return l;
}
short App::debug()
{
#ifndef MEARSURE_PERFORMANCE
if (millis() - debugTS > DEBUG_INTERVAL)
{
uchar s = addons.size();
uchar nb = 0;
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(DEBUG))
{
(addon->debug)(&Serial);
Serial.println("\n");
nb++;
}
}
if (nb)
{
Serial.println("\n");
}
debugTS = millis();
}
#endif
}
short App::info()
{
Serial.print("Addon configuration : \n\n");
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(INFO))
{
addon->info(&Serial);
Serial << "\n";
}
}
}
Addon *App::byId(short id)
{
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->id == id)
{
return addon;
}
}
return NULL;
}
void App::setup_addons()
{
#ifdef HAS_STATUS
addons.push_back((Addon *)status);
#endif
addons.push_back((Addon *)cSensor);
addons.push_back((Addon *)this);
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(SETUP))
{
addon->setup();
}
}
onDidSetupAddons();
}
void App::loop_addons()
{
#ifdef MEARSURE_PERFORMANCE
millis_t now = millis();
#endif
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(LOOP))
{
addon->now = now;
addon->loop();
}
}
#ifdef MEARSURE_PERFORMANCE
addonLoopTime = millis() - now;
if (millis() - printPerfTS > 3000)
{
printPerfTS = now;
Serial << SPACE("Addon loop time") << addonLoopTime << "\n";
}
#endif
debug();
}

View File

@ -1,2 +0,0 @@
#include "app.h"

View File

@ -1,161 +0,0 @@
#include <PID_v1.h>
#include <PID_AutoTune_v0.h>
byte ATuneModeRemember=2;
double input=80, output=50, setpoint=180;
double kp=2,ki=0.5,kd=2;
double kpmodel=1.5, taup=100, theta[50];
double outputStart=5;
double aTuneStep=50, aTuneNoise=1, aTuneStartValue=100;
unsigned int aTuneLookBack=20;
boolean tuning = false;
unsigned long modelTime, serialTime;
PID myPID(&input, &output, &setpoint,kp,ki,kd, DIRECT);
PID_ATune aTune(&input, &output);
//set to false to connect to the real world
boolean useSimulation = true;
void setup()
{
if(useSimulation)
{
for(byte i=0;i<50;i++)
{
theta[i]=outputStart;
}
modelTime = 0;
}
//Setup the pid
myPID.SetMode(AUTOMATIC);
if(tuning)
{
tuning=false;
changeAutoTune();
tuning=true;
}
serialTime = 0;
Serial.begin(9600);
}
void loop()
{
unsigned long now = millis();
if(!useSimulation)
{ //pull the input in from the real world
input = analogRead(0);
}
if(tuning)
{
byte val = (aTune.Runtime());
if (val!=0)
{
tuning = false;
}
if(!tuning)
{ //we're done, set the tuning parameters
kp = aTune.GetKp();
ki = aTune.GetKi();
kd = aTune.GetKd();
myPID.SetTunings(kp,ki,kd);
AutoTuneHelper(false);
}
}
else myPID.Compute();
if(useSimulation)
{
theta[30]=output;
if(now>=modelTime)
{
modelTime +=100;
DoModel();
}
}
else
{
analogWrite(0,output);
}
//send-receive with processing if it's time
if(millis()>serialTime)
{
SerialReceive();
SerialSend();
serialTime+=500;
}
}
void changeAutoTune()
{
if(!tuning)
{
//Set the output to the desired starting frequency.
output=aTuneStartValue;
aTune.SetNoiseBand(aTuneNoise);
aTune.SetOutputStep(aTuneStep);
aTune.SetLookbackSec((int)aTuneLookBack);
AutoTuneHelper(true);
tuning = true;
}
else
{ //cancel autotune
aTune.Cancel();
tuning = false;
AutoTuneHelper(false);
}
}
void AutoTuneHelper(boolean start)
{
if(start)
ATuneModeRemember = myPID.GetMode();
else
myPID.SetMode(ATuneModeRemember);
}
void SerialSend()
{
Serial.print("setpoint: ");Serial.print(setpoint); Serial.print(" ");
Serial.print("input: ");Serial.print(input); Serial.print(" ");
Serial.print("output: ");Serial.print(output); Serial.print(" ");
if(tuning){
Serial.println("tuning mode");
} else {
Serial.print("kp: ");Serial.print(myPID.GetKp());Serial.print(" ");
Serial.print("ki: ");Serial.print(myPID.GetKi());Serial.print(" ");
Serial.print("kd: ");Serial.print(myPID.GetKd());Serial.println();
}
}
void SerialReceive()
{
if(Serial.available())
{
char b = Serial.read();
Serial.flush();
if((b=='1' && !tuning) || (b!='1' && tuning))changeAutoTune();
}
}
void DoModel()
{
//cycle the dead time
for(byte i=0;i<49;i++)
{
theta[i] = theta[i+1];
}
//compute the input
input = (kpmodel / taup) *(theta[0]-outputStart) + input*(1-1/taup) + ((float)random(-10,10))/100;
}

View File

@ -1,196 +0,0 @@
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <PID_AutoTune_v0.h>
PID_ATune::PID_ATune(double* Input, double* Output)
{
input = Input;
output = Output;
controlType =0 ; //default to PI
noiseBand = 0.5;
running = false;
oStep = 30;
SetLookbackSec(10);
lastTime = millis();
}
void PID_ATune::Cancel()
{
running = false;
}
int PID_ATune::Runtime()
{
justevaled=false;
if(peakCount>9 && running)
{
running = false;
FinishUp();
return 1;
}
unsigned long now = millis();
if((now-lastTime)<sampleTime) return false;
lastTime = now;
double refVal = *input;
justevaled=true;
if(!running)
{ //initialize working variables the first time around
peakType = 0;
peakCount=0;
justchanged=false;
absMax=refVal;
absMin=refVal;
setpoint = refVal;
running = true;
outputStart = *output;
*output = outputStart+oStep;
}
else
{
if(refVal>absMax)absMax=refVal;
if(refVal<absMin)absMin=refVal;
}
//oscillate the output base on the input's relation to the setpoint
if(refVal>setpoint+noiseBand) *output = outputStart-oStep;
else if (refVal<setpoint-noiseBand) *output = outputStart+oStep;
//bool isMax=true, isMin=true;
isMax=true;isMin=true;
//id peaks
for(int i=nLookBack-1;i>=0;i--)
{
double val = lastInputs[i];
if(isMax) isMax = refVal>val;
if(isMin) isMin = refVal<val;
lastInputs[i+1] = lastInputs[i];
}
lastInputs[0] = refVal;
if(nLookBack<9)
{ //we don't want to trust the maxes or mins until the inputs array has been filled
return 0;
}
if(isMax)
{
if(peakType==0)peakType=1;
if(peakType==-1)
{
peakType = 1;
justchanged=true;
peak2 = peak1;
}
peak1 = now;
peaks[peakCount] = refVal;
}
else if(isMin)
{
if(peakType==0)peakType=-1;
if(peakType==1)
{
peakType=-1;
peakCount++;
justchanged=true;
}
if(peakCount<10)peaks[peakCount] = refVal;
}
if(justchanged && peakCount>2)
{ //we've transitioned. check if we can autotune based on the last peaks
double avgSeparation = (abs(peaks[peakCount-1]-peaks[peakCount-2])+abs(peaks[peakCount-2]-peaks[peakCount-3]))/2;
if( avgSeparation < 0.05*(absMax-absMin))
{
FinishUp();
running = false;
return 1;
}
}
justchanged=false;
return 0;
}
void PID_ATune::FinishUp()
{
*output = outputStart;
//we can generate tuning parameters!
Ku = 4*(2*oStep)/((absMax-absMin)*3.14159);
Pu = (double)(peak1-peak2) / 1000;
}
double PID_ATune::GetKp()
{
return controlType==1 ? 0.6 * Ku : 0.4 * Ku;
}
double PID_ATune::GetKi()
{
return controlType==1? 1.2*Ku / Pu : 0.48 * Ku / Pu; // Ki = Kc/Ti
}
double PID_ATune::GetKd()
{
return controlType==1? 0.075 * Ku * Pu : 0; //Kd = Kc * Td
}
void PID_ATune::SetOutputStep(double Step)
{
oStep = Step;
}
double PID_ATune::GetOutputStep()
{
return oStep;
}
void PID_ATune::SetControlType(int Type) //0=PI, 1=PID
{
controlType = Type;
}
int PID_ATune::GetControlType()
{
return controlType;
}
void PID_ATune::SetNoiseBand(double Band)
{
noiseBand = Band;
}
double PID_ATune::GetNoiseBand()
{
return noiseBand;
}
void PID_ATune::SetLookbackSec(int value)
{
if (value<1) value = 1;
if(value<25)
{
nLookBack = value * 4;
sampleTime = 250;
}
else
{
nLookBack = 100;
sampleTime = value*10;
}
}
int PID_ATune::GetLookbackSec()
{
return nLookBack * sampleTime / 1000;
}

View File

@ -1,55 +0,0 @@
#ifndef PID_AutoTune_v0
#define PID_AutoTune_v0
#define LIBRARY_VERSION 0.0.1
class PID_ATune
{
public:
//commonly used functions **************************************************************************
PID_ATune(double*, double*); // * Constructor. links the Autotune to a given PID
int Runtime(); // * Similar to the PID Compue function, returns non 0 when done
void Cancel(); // * Stops the AutoTune
void SetOutputStep(double); // * how far above and below the starting value will the output step?
double GetOutputStep(); //
void SetControlType(int); // * Determies if the tuning parameters returned will be PI (D=0)
int GetControlType(); // or PID. (0=PI, 1=PID)
void SetLookbackSec(int); // * how far back are we looking to identify peaks
int GetLookbackSec(); //
void SetNoiseBand(double); // * the autotune will ignore signal chatter smaller than this value
double GetNoiseBand(); // this should be acurately set
double GetKp(); // * once autotune is complete, these functions contain the
double GetKi(); // computed tuning parameters.
double GetKd(); //
private:
void FinishUp();
bool isMax, isMin;
double *input, *output;
double setpoint;
double noiseBand;
int controlType;
bool running;
unsigned long peak1, peak2, lastTime;
int sampleTime;
int nLookBack;
int peakType;
double lastInputs[101];
double peaks[10];
int peakCount;
bool justchanged;
bool justevaled;
double absMax, absMin;
double oStep;
double outputStart;
double Ku, Pu;
};
#endif

View File

@ -1,121 +0,0 @@
#include "bridge.h"
#include <Vector.h>
#include <Streaming.h>
#include "constants.h"
typedef struct
{
short key;
char *value;
} TAddons;
const TAddons addonsDict[]{};
static VSL *_instance;
class SKeyVal;
SKeyVal *clazzMaps[20];
Vector<SKeyVal *> clazzes;
class SKeyValS
{
public:
void *instance;
ushort id;
SKeyValS() {}
SKeyValS(void *_instance, ushort _id) : instance(_instance),
id(_id) {}
};
char *getAddonName(short key)
{
for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i)
{
if (addonsDict[i].key == key)
{
return addonsDict[i].value;
}
}
return NULL;
}
short getAddonKey(String name)
{
for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i)
{
if (name.equals(String(addonsDict[i].value)))
{
return addonsDict[i].value;
}
}
return -1;
}
void VSL::init()
{
_instance = new VSL();
clazzes.setStorage(clazzMaps);
}
VSL *VSL::instance()
{
if (!_instance)
{
VSL::init();
}
return _instance;
}
SKeyVal *VSL::hasMethod(ushort id, String methodName)
{
uchar s = clazzes.size();
for (uchar i = 0; i < s; i++)
{
SKeyVal *val = clazzes.at(i);
if (val->key == id && val->methodName.equals(methodName))
{
return val;
}
}
return NULL;
}
void VSL::debug()
{
#ifdef BRIDGE_DEBUG
uchar s = clazzes.size();
for (uchar i = 0; i < s; i++)
{
SKeyVal *val = clazzes.at(i);
Serial.print(val->className);
Serial.print(":");
Serial.print(val->methodName);
Serial.print("\n");
}
#endif
}
SKeyVal *VSL::registerMemberFunction(ushort id, Addon *clazz, char *method, AddonFnPtr ptr, char *ret)
{
SKeyVal *meth = hasMethod(id, method);
if (meth)
{
#ifdef BRIDGE_DEBUG
Serial << "Register class member: "
<< SPACE(name << "::" << method)
<< "already registered! \n";
#endif
}
else
{
#ifdef BRIDGE_DEBUG
if (!getAddonKey(name))
{
Serial.println("invalid addon key");
}
#endif
meth = new SKeyVal(id, clazz, method, ptr);
//Serial << "Register member method:"
// << SPACE(meth->className << "::" << meth->methodName)
// << "\n";
clazzes.push_back(meth);
}
}

View File

@ -1,81 +0,0 @@
#ifndef BRDIGE_H
#define BRIDGE_H
#include "Addon.h"
#include <WString.h>
class App;
class SKeyVal;
class SKeyValS;
class SKeyVal
{
public:
short key;
void *instance;
String methodName;
AddonFnPtr mPtr;
SKeyVal() {}
SKeyVal(ushort _key, void *_instance, String _methodName, AddonFnPtr _mPtr) : key(_key),
instance(_instance),
methodName(_methodName),
mPtr(_mPtr) {}
};
class VSL
{
public:
SKeyVal *registerMemberFunction(
ushort id,
Addon *clazz,
char *method,
AddonFnPtr ptr,
char *ret);
static void init();
static VSL *instance();
SKeyVal *VSL::hasMethod(ushort id, String method);
void debug();
};
#define REGISTER_CLASS_MEMBER_FN(id, inst, methodName, method, ret) \
{ \
VSL::instance()->registerMemberFunction(id, inst, methodName, method, "2"); \
}
#endif
namespace Bridge
{
static const char *START_STR = "<<";
static const char *END_STR = ">>";
static const char RESPONSE_DEL = ';';
static const char *CreateResponse(short id, short error, short ret)
{
static char response[1024] = {'\0'};
snprintf(response, sizeof(response), "%s%d%c%d%c%d%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR);
return response;
}
static const char *CreateResponse(short id, short error, const char *ret)
{
static char response[1024] = {'\0'};
snprintf(response, sizeof(response), "%s%d%c%d%c%s%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR);
return response;
}
enum ECALLS
{
EC_COMMAND = 1,
EC_METHOD = 2,
EC_FUNC = 3,
EC_USER = 10
};
enum MessageFlags
{
NEW = 1,
PROCESSING = 2,
PROCESSED = 3,
DEBUG = 4,
RECEIPT = 5,
STATE = 6
};
} // namespace Bridge

View File

@ -1,512 +0,0 @@
#ifndef PIN_H
#define PIN_H
// this class doesn't outperform fastgpio but is works with AtmelMega
#include <Arduino.h>
#define DDR_HIGH (*_DDR |= _offset) ///< Set the DDR register to HIGH for the pin
#define DDR_TOGGLE (*_DDR ^= _offset) ///< Set the DDR register to the inverse for the pin
#define DDR_LOW (*_DDR &= _ioffset) ///< Set the DDR register to LOW for the pin
#define PORT_HIGH (*_PORT |= _offset) ///< Set the PORT register to HIGH for the pin
#define PORT_TOGGLE (*_PORT ^= _offset) ///< Set the PORT register to the inverse for the pin
#define PORT_LOW (*_PORT &= _ioffset) ///< Set the PORT register to LOW for the pin
#define DDR_ON (*_DDR & _offset) ///< Get the DDR register for the pin (HIGH, LOW) with other pins forced to 0
#define DDR_OFF (*_DDR | _ioffset) ///< Get the DDR register for the pin (HIGH, LOW) with other pins forced to 1
#define PORT_ON (*_PORT & _offset) ///< Get the PORT register for the pin (HIGH, LOW) with other pins forced to 0
#define PORT_OFF (*_PORT | _ioffset) ///< Get the PORT register for the pin (HIGH, LOW) with other pins forced to 1
#define PIN_ON (*_PIN & _offset) ///< Get the PIN register for the pin (HIGH, LOW) with other pins forced to 0
#define PIN_OFF (*_PIN | _ioffset) ///< Get the PIN register for the pin (HIGH, LOW) with other pins forced to 1
class Pin
{
public:
Pin(uint8_t number)
{
_number = number;
_offset = digitalPinToBitMask(_number);
_ioffset = ~_offset;
_timer = digitalPinToTimer(_number);
_PIN = portInputRegister(digitalPinToPort(_number));
_PORT = portOutputRegister(digitalPinToPort(_number));
_DDR = portModeRegister(digitalPinToPort(_number));
}
/**
Custom board constructor
getAnalogValue() and setDutyCycle(int value) not supported
@param number pin number written on board
@param offset bit mask used to access pin in registers
@param timer timer for pin
@param PIN input register for pin
@param PORT data register for pin
@param DDR data direction register for pin
*/
Pin(uint8_t number, uint8_t offset, uint8_t timer, volatile uint8_t *PIN, volatile uint8_t *PORT, volatile uint8_t *DDR)
{
_number = number;
_offset = offset;
_ioffset = ~_offset;
_timer = timer;
_PIN = PIN;
_PORT = PORT;
_DDR = DDR;
}
// ################################# Operators #################################
/**
Get the value of the pin from the PIN register
@return true if the value of the pin is HIGH, false otherwise
*/
operator bool() const
{
return bool(PIN_ON);
}
/**
Set the pin state
@param state the state of the pin (HIGH, LOW)
*/
Pin &operator=(uint8_t state)
{
uint8_t oldSREG = SREG;
cli();
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
return *this;
}
// ################################# Getters #################################
/**
Get the pin number
@return pin number
*/
uint8_t getNumber()
{
return _number;
}
/**
Get the pin offset
@return pin offset
*/
uint8_t getOffset()
{
return _offset;
}
/**
Get the inverse pin offset
@return inverse pin offset
*/
uint8_t getInverseOffset()
{
return _ioffset;
}
/**
Get the pin timer
@return pin timer
*/
uint8_t getTimer()
{
return _timer;
}
/**
Get a pointer to the PIN register
@return pointer to the PIN register
*/
volatile uint8_t *getPIN()
{
return _PIN;
}
/**
Get a pointer to the PORT register
@return pointer to the PORT register
*/
volatile uint8_t *getPORT()
{
return _PORT;
}
/**
Get a pointer to the DDR register
@return pointer to the DDR register
*/
volatile uint8_t *getDDR()
{
return _DDR;
}
/**
Get the mode of the pin from the DDR register
@return mode of the pin (OUTPUT, INPUT)
*/
uint8_t getMode()
{
if (DDR_ON)
{
return OUTPUT;
}
else
{
return INPUT;
}
}
/**
Get the state of the pin from the PORT register
@return state of the pin (HIGH, LOW)
*/
uint8_t getState()
{
if (PORT_ON)
{
return HIGH;
}
else
{
return LOW;
}
}
/**
Get the value of the pin from the PIN register
@return value of the pin (HIGH, LOW)
*/
uint8_t getValue()
{
if (PIN_ON)
{
return HIGH;
}
else
{
return LOW;
}
}
/**
Get the analog value of the pin
@return analog value of the pin (0-1023)
*/
uint16_t getAnalogValue()
{
return analogRead(_number);
}
/**
Set the pin mode and pin state
@param mode the mode of the pin (OUTPUT, INPUT)
@param state the state of the pin (HIGH, LOW)
*/
void set(uint8_t mode, uint8_t state)
{
uint8_t oldSREG = SREG;
cli();
if (mode == INPUT)
{
DDR_LOW;
}
else
{
DDR_HIGH;
}
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
}
/**
Set the pin mode
@param mode the mode of the pin (OUTPUT, INPUT)
*/
void setMode(uint8_t mode)
{
uint8_t oldSREG = SREG;
cli();
if (mode == INPUT)
{
DDR_LOW;
}
else
{
DDR_HIGH;
}
SREG = oldSREG;
}
/**
Set the pin state
@param state the state of the pin (HIGH, LOW)
*/
void setState(uint8_t state)
{
uint8_t oldSREG = SREG;
cli();
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
}
// #################### Input ####################
void setInput()
{
uint8_t oldSREG = SREG;
cli();
DDR_LOW;
SREG = oldSREG;
}
/**
Set the pin pullup resistor to on
*/
void setPullupOn()
{
uint8_t oldSREG = SREG;
cli();
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin pullup resistor to off
*/
void setPullupOff()
{
uint8_t oldSREG = SREG;
cli();
PORT_LOW;
SREG = oldSREG;
}
/**
Set the pin mode to input and the pin pullup resistor to on
*/
void setInputPullupOn()
{
uint8_t oldSREG = SREG;
cli();
DDR_LOW;
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin mode to input and the pin pullup resistor to off
*/
void setInputPullupOff()
{
uint8_t oldSREG = SREG;
cli();
DDR_LOW;
PORT_LOW;
SREG = oldSREG;
}
// #################### Output ####################
/**
Set the pin mode to output
*/
void setOutput()
{
uint8_t oldSREG = SREG;
cli();
DDR_HIGH;
SREG = oldSREG;
}
/**
Set the pin output to HIGH
*/
void setHigh()
{
uint8_t oldSREG = SREG;
cli();
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin output to LOW
*/
void setLow()
{
uint8_t oldSREG = SREG;
cli();
PORT_LOW;
SREG = oldSREG;
}
/**
Set the pin mode to output and the pin output to HIGH
*/
void setOutputHigh()
{
uint8_t oldSREG = SREG;
cli();
DDR_HIGH;
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin mode to output and the pin output to LOW
*/
void setOutputLow()
{
uint8_t oldSREG = SREG;
cli();
DDR_HIGH;
PORT_LOW;
SREG = oldSREG;
}
/**
Set the PWM duty cycle
@param value the duty cycle (0-255)
*/
void setDutyCycle(int value)
{
analogWrite(_number, value);
}
// ################################# Utilities #################################
/**
Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT)
*/
void toggleMode()
{
uint8_t oldSREG = SREG;
cli();
DDR_TOGGLE;
SREG = oldSREG;
}
/**
Toggle the pin state (HIGH -> LOW, LOW -> HIGH)
*/
void toggleState()
{
uint8_t oldSREG = SREG;
cli();
PORT_TOGGLE;
SREG = oldSREG;
}
// #################### RC Timer ####################
/**
Set the pin mode to input and decrement a counter until the pin goes HIGH or the counter reaches 0 then set the pin mode to output and return the counter value
@param count the initial value for the counter to start at (0-65535)
@return the value remaining on the counter when the pin state went to HIGH or 0 if the counter reached 0
*/
volatile unsigned int rcTimer(volatile unsigned int count)
{
uint8_t status;
asm volatile(
// Save interupt status and disable interupts
"in %[status], __SREG__ \n\t" // Store current interupt status in variable 's'
"cli \n\t" // Disable interupts
// Set Pin to input mode to start charging capacitor
"ld __tmp_reg__, %a[_DDR] \n\t" // Load the DDR register into r0 (__tmp_reg__)
"and __tmp_reg__, %[_ioffset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__)
"st %a[_DDR], __tmp_reg__ \n\t" // Store r0 (__tmp_reg__) in the DDR register
// Count time before Pin becomes high
"loop%=: \n\t" // Label for looping
//"ld __tmp_reg__,%a[_PIN] \n\t" // Load the PIN register into r0 (__tmp_reg__)
"and __tmp_reg__, %[_offset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__)
"brne end%= \n\t" // End the loop if r0 (__tmp_reg__) is not equal to zero by branching to label 'end'
"dec %[count] \n\t" // Decrement the value of 'count' by one
"brne loop%= \n\t" // If the value of 'count' is not equal to zero continue the loop by branching to label 'loop'
// Done counting
"end%=: \n\t" // Label for ending loop
// Set Pin to output mode to start discharging capacitor
"ld __tmp_reg__, %a[_DDR] \n\t" // Load the DDR register into r0 (__tmp_reg__)
"or __tmp_reg__, %[_offset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__)
"st %a[_DDR], __tmp_reg__ \n\t" // Store r0 (__tmp_reg__) in the PORT register
// Restore interupt status
"out __SREG__, %[status] \n\t" // Load interupt status from variable 's'
// Outputs
:
[ count ] "+r"(count), // The value the counter was at when the pin went high
[ status ] "=&r"(status) // The interupt status
// Inputs
:
[ _DDR ] "e"(_DDR), // The address of the DDR register for the pin
[ _PIN ] "e"(_PIN), // The address of the PIN register for the pin
[ _offset ] "r"(_offset), // The bit mask used to access pin in registers
[ _ioffset ] "r"(_ioffset) // The inverse bit mask used to access pin in registers
);
return count;
}
private:
uint8_t _number;
uint8_t _offset;
uint8_t _ioffset;
uint8_t _timer;
volatile uint8_t *_PIN;
volatile uint8_t *_PORT;
volatile uint8_t *_DDR;
};
#endif

View File

@ -1,469 +0,0 @@
#ifndef PIN_GROUP_H
#define PIN_GROUP_H
#include "Pin.h"
/**
Class for simultaneous operations on Arduino I/O pins
*/
class PinGroup
{
public:
template <size_t N>
PinGroup(Pin (&pins)[N])
{
_offset = pins[0].getOffset();
_PIN = pins[0].getPIN();
_PORT = pins[0].getPORT();
_DDR = pins[0].getDDR();
_numbers[0] = pins[0].getNumber();
_valid = true;
for (int i = 1; i < N; i++)
{
if (_DDR != pins[i].getDDR())
{
_valid = false;
}
_offset |= pins[i].getOffset();
_numbers[i] = pins[i].getNumber();
}
_ioffset = ~_offset;
}
// ################################# Operators #################################
/**
Compare the value of the pin
@param value the state of the pin (HIGH, LOW)
@return true if the value of all of the pins are equal to the value passed in, false otherwise
*/
bool operator==(uint8_t value)
{
uint8_t status = *_PIN;
if ((status & _offset) == _offset)
{
return (value == HIGH);
}
else if ((status | _ioffset) == _ioffset)
{
return (value == LOW);
}
else
{
return false;
}
}
/**
Compare the value of the pin
@param value the state of the pin (HIGH, LOW)
@return true if the value of all of the pins are not equal to the value passed in, false otherwise
*/
bool operator!=(uint8_t value)
{
uint8_t status = *_PIN;
if ((status & _offset) == _offset)
{
return (value == LOW);
}
else if ((status | _ioffset) == _ioffset)
{
return (value == HIGH);
}
else
{
return false;
}
}
/**
Set the pin state
@param state the state of the pin (HIGH, LOW)
*/
PinGroup &operator=(uint8_t state)
{
oldSREG = SREG;
cli();
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
return *this;
}
// ################################# Getters #################################
/**
Get the pin numbers
@return array of pin numbers
*/
uint8_t *getNumbers()
{
return _numbers;
}
/**
Get the pin offset
@return pin offset
*/
uint8_t getOffset()
{
return _offset;
}
/**
Get the inverse pin offset
@return inverse pin offset
*/
uint8_t getInverseOffset()
{
return _ioffset;
}
/**
Get a pointer to the PIN register
@return pointer to the PIN register
*/
volatile uint8_t *getPIN()
{
return _PIN;
}
/**
Get a pointer to the PORT register
@return pointer to the PORT register
*/
volatile uint8_t *getPORT()
{
return _PORT;
}
/**
Get a pointer to the DDR register
@return pointer to the DDR register
*/
volatile uint8_t *getDDR()
{
return _DDR;
}
/**
Get the mode of the pin from the DDR register
@return mode of the pin (OUTPUT, INPUT, -1)
*/
uint8_t getMode()
{
uint8_t status = *_DDR;
if ((status & _offset) == _offset)
{
return OUTPUT;
}
else if ((status | _ioffset) == _ioffset)
{
return INPUT;
}
else
{
return -1;
}
}
/**
Get the state of the pin from the PORT register
@return state of the pin (HIGH, LOW, -1)
*/
uint8_t getState()
{
uint8_t status = *_PORT;
if ((status & _offset) == _offset)
{
return HIGH;
}
else if ((status | _ioffset) == _ioffset)
{
return LOW;
}
else
{
return -1;
}
}
/**
Get the value of the pin from the PIN register
@return value of the pin (HIGH, LOW, -1)
*/
uint8_t getValue()
{
uint8_t status = *_PIN;
if ((status & _offset) == _offset)
{
return HIGH;
}
else if ((status | _ioffset) == _ioffset)
{
return LOW;
}
else
{
return -1;
}
}
/**
Check the group to ensure all pins use the same registers
@return true if the pins in the group all use the same registers, false otherwise
*/
bool isValid()
{
return _valid;
}
// ################################# Setters #################################
// #################### Generic ####################
/**
Set the pin mode and pin state
@param mode the mode of the pin (OUTPUT, INPUT)
@param state the state of the pin (HIGH, LOW)
*/
void set(uint8_t mode, uint8_t state)
{
oldSREG = SREG;
cli();
if (mode == INPUT)
{
DDR_LOW;
}
else
{
DDR_HIGH;
}
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
}
/**
Set the pin mode
@param mode the mode of the pin (OUTPUT, INPUT)
*/
void setMode(uint8_t mode)
{
oldSREG = SREG;
cli();
if (mode == INPUT)
{
DDR_LOW;
}
else
{
DDR_HIGH;
}
SREG = oldSREG;
}
/**
Set the pin state
@param state the state of the pin (HIGH, LOW)
*/
void setState(uint8_t state)
{
oldSREG = SREG;
cli();
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
}
// #################### Input ####################
/**
Set the pin mode to input
*/
void setInput()
{
oldSREG = SREG;
cli();
DDR_LOW;
SREG = oldSREG;
}
/**
Set the pin pullup resistor to on
*/
void setPullupOn()
{
oldSREG = SREG;
cli();
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin pullup resistor to off
*/
void setPullupOff()
{
oldSREG = SREG;
cli();
PORT_LOW;
SREG = oldSREG;
}
/**
Set the pin mode to input and the pin pullup resistor to on
*/
void setInputPullupOn()
{
oldSREG = SREG;
cli();
DDR_LOW;
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin mode to input and the pin pullup resistor to off
*/
void setInputPullupOff()
{
oldSREG = SREG;
cli();
DDR_LOW;
PORT_LOW;
SREG = oldSREG;
}
// #################### Output ####################
/**
Set the pin mode to output
*/
void setOutput()
{
oldSREG = SREG;
cli();
DDR_HIGH;
SREG = oldSREG;
}
/**
Set the pin output to HIGH
*/
void setHigh()
{
oldSREG = SREG;
cli();
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin output to LOW
*/
void setLow()
{
oldSREG = SREG;
cli();
PORT_LOW;
SREG = oldSREG;
}
/**
Set the pin mode to output and the pin output to HIGH
*/
void setOutputHigh()
{
oldSREG = SREG;
cli();
DDR_HIGH;
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin mode to output and the pin output to LOW
*/
void setOutputLow()
{
oldSREG = SREG;
cli();
DDR_HIGH;
PORT_LOW;
SREG = oldSREG;
}
// ################################# Utilities #################################
// #################### Toggle ####################
/**
Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT)
*/
void toggleMode()
{
oldSREG = SREG;
cli();
DDR_TOGGLE;
SREG = oldSREG;
}
/**
Toggle the pin state (HIGH -> LOW, LOW -> HIGH)
*/
void toggleState()
{
oldSREG = SREG;
cli();
PORT_TOGGLE;
SREG = oldSREG;
}
private:
uint8_t _numbers[8];
uint8_t _offset;
uint8_t _ioffset;
bool _valid;
uint8_t oldSREG;
volatile uint8_t *_PIN;
volatile uint8_t *_PORT;
volatile uint8_t *_DDR;
};

View File

@ -1,98 +0,0 @@
#ifndef MACROS_H
#define MACROS_H
#include "../types.h"
// Macros for adding
#define INC_0 1
#define INC_1 2
#define INC_2 3
#define INC_3 4
#define INC_4 5
#define INC_5 6
#define INC_6 7
#define INC_7 8
#define INC_8 9
#define INCREMENT_(n) INC_ ##n
#define INCREMENT(n) INCREMENT_(n)
// Macros for subtracting
#define DEC_1 0
#define DEC_2 1
#define DEC_3 2
#define DEC_4 3
#define DEC_5 4
#define DEC_6 5
#define DEC_7 6
#define DEC_8 7
#define DEC_9 8
#define DECREMENT_(n) DEC_ ##n
#define DECREMENT(n) DECREMENT_(n)
// compiler - & C quirks
#define FORCE_INLINE __attribute__((always_inline)) inline
#define _UNUSED __attribute__((unused))
// fallback noop
#define NOOP do{} while(0)
//Option testing
#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
// time
#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))
#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)
#define HOUR_MS ((millis_t)1000 * (millis_t)(60 * 60))
#define MIN_MS ((millis_t)1000 * (millis_t)(60))
#define SECS ((millis_t)1000)
// bit masks
#undef _BV
#define _BV(b) (1 << (b))
#define TEST(n,b) !!((n)&_BV(b))
#define SBI(n,b) (n |= _BV(b))
#define CBI(n,b) (n &= ~_BV(b))
#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
#define _BV32(b) (1UL << (b))
#define TEST32(n,b) !!((n)&_BV32(b))
#define SBI32(n,b) (n |= _BV32(b))
#define CBI32(n,b) (n &= ~_BV32(b))
#define SIGN(a) ((a>0)-(a<0))
// math basics
#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H))
#define NUMERIC(a) WITHIN(a, '0', '9')
#define DECIMAL(a) (NUMERIC(a) || a == '.')
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+')
#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+')
#define COUNT(a) (sizeof(a)/sizeof(*a))
#define ZERO(a) memset(a,0,sizeof(a))
#define COPY(a,b) memcpy(a,b,MIN(sizeof(a),sizeof(b)))
// #define M_PI 3.14159265358979323846f
#define RADIANS(d) ((d)*M_PI/180.0f)
#define DEGREES(r) ((r)*180.0f/M_PI)
#define CEILING(x,y) (((x) + (y) - 1) / (y))
// Macros for initializing arrays
#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 }
#define ARRAY_5(v1, v2, v3, v4, v5, ...) { v1, v2, v3, v4, v5 }
#define ARRAY_4(v1, v2, v3, v4, ...) { v1, v2, v3, v4 }
#define ARRAY_3(v1, v2, v3, ...) { v1, v2, v3 }
#define ARRAY_2(v1, v2, ...) { v1, v2 }
#define ARRAY_1(v1, ...) { v1 }
#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__)
#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__)
#define SPACE(A) " " << A << " "
#endif

View File

@ -1,14 +0,0 @@
#ifndef PPMATH_H
#define PPMATH_H
template <typename T>
T clamp(const T &value, const T &low, const T &high)
{
return value < low ? low : (value > high ? high : value);
}
#define RANGE(i, min, max) ((i > min) && (i < max)) ? true : false
#define NCLAMP(x, min, max) (x - min) / (max - min)
#endif

View File

@ -1,136 +0,0 @@
#ifndef TIMER_H
#define TIMER_H
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include "macros.h"
#ifndef TIMER_MAX_TASKS
#define TIMER_MAX_TASKS 0x10
#endif
template <
size_t max_tasks = TIMER_MAX_TASKS, /* max allocated tasks */
unsigned long (*time_func)() = millis /* time function for timer */
>
class Timer
{
public:
typedef bool (*handler_t)(void *opaque); /* task handler func signature */
/* Calls handler with opaque as argument in delay units of time */
bool
in(unsigned long delay, handler_t h, void *opaque = NULL)
{
return add_task(time_func(), delay, h, opaque);
}
/* Calls handler with opaque as argument at time */
bool
at(unsigned long time, handler_t h, void *opaque = NULL)
{
const unsigned long now = time_func();
return add_task(now, time - now, h, opaque);
}
/* Calls handler with opaque as argument every interval units of time */
bool
every(unsigned long interval, handler_t h, void *opaque = NULL)
{
return add_task(time_func(), interval, h, opaque, interval);
}
/* Ticks the timer forward - call this function in loop() */
void
tick()
{
tick(time_func());
}
/* Ticks the timer forward - call this function in loop() */
inline void
tick(unsigned long t)
{
for (size_t i = 0; i < max_tasks; ++i)
{
struct task *const task = &tasks[i];
const unsigned long duration = t - task->start;
if (task->handler && duration >= task->expires)
{
task->repeat = task->handler(task->opaque) && task->repeat;
if (task->repeat)
task->start = t;
else
remove(task);
}else{
}
}
}
private:
struct task
{
handler_t handler; /* task handler callback func */
void *opaque; /* argument given to the callback handler */
unsigned long start,
expires, /* when the task expires */
repeat; /* repeat task */
} tasks[max_tasks];
inline void
remove(struct task *task)
{
task->handler = NULL;
task->opaque = NULL;
task->start = 0;
task->expires = 0;
task->repeat = 0;
}
inline struct task *
next_task_slot()
{
for (size_t i = 0; i < max_tasks; ++i)
{
struct task *const slot = &tasks[i];
if (slot->handler == NULL)
return slot;
}
return NULL;
}
inline struct task *
add_task(unsigned long start, unsigned long expires,
handler_t h, void *opaque, bool repeat = 0)
{
struct task *const slot = next_task_slot();
if (!slot){
return NULL;
}
slot->handler = h;
slot->opaque = opaque;
slot->start = start;
slot->expires = expires;
slot->repeat = repeat;
return slot;
}
};
/* create a timer with the default settings */
inline Timer<>
timer_create_default()
{
return Timer<>();
}
#endif

View File

@ -1,80 +0,0 @@
#ifndef POS3_ANALOG_H
#define POS3_ANALOG_H
#include <Arduino.h>
#include "../enums.h"
#include "../common/ppmath.h"
class Pos3Analog
{
public:
Pos3Analog(short _upPin, short _downPin) : upPin(_upPin), downPin(_downPin)
{
}
short setup()
{
pinMode(upPin, INPUT_PULLUP);
pinMode(downPin, INPUT_PULLUP);
last_switch = loop();
return 0;
}
short loop()
{
uchar newDirection = this->read();
if (newDirection != this->switch_pos)
{
this->last_switch = this->switch_pos;
}
this->switch_pos = newDirection;
return this->switch_pos;
}
short last_switch = -1; // Track last switch position
short switch_pos = -1; // Current switch position
short upPin;
short downPin;
private:
uchar read()
{
bool up = RANGE(analogRead(upPin), 240, 260);
bool down = RANGE(analogRead(downPin), 240, 260);
uchar newDirection = 0;
if (up)
{
newDirection = POS3_DIRECTION::UP;
}
if (down)
{
newDirection = POS3_DIRECTION::DOWN;
}
if (!up && !down)
{
newDirection = POS3_DIRECTION::MIDDLE;
}
if (up && down)
{
newDirection = POS3_DIRECTION::INVALID;
}
return newDirection;
}
bool changed()
{
return last_switch != switch_pos;
}
bool clear()
{
return last_switch = switch_pos;
}
};
#endif

View File

@ -1,81 +0,0 @@
#ifndef POS3_H
#define POS3_H
#include <Bounce2.h>
#include "../enums.h"
class Pos3
{
public:
Pos3(int _upPin, int _downPin) : upPin(_upPin), downPin(_downPin)
{
}
int setup()
{
this->debouncerUp = Bounce();
this->debouncerUp.attach(this->upPin, INPUT_PULLUP);
this->debouncerUp.interval(25);
this->debouncerDown = Bounce();
this->debouncerDown.attach(this->downPin, INPUT_PULLUP);
this->debouncerDown.interval(25);
return 0;
}
int loop()
{
int newDirection = this->read();
if (newDirection != this->switch_pos)
{
this->last_switch = this->switch_pos;
}
this->switch_pos = newDirection;
return this->switch_pos;
}
int last_switch = -1; // Track last switch position
int switch_pos = -1; // Current switch position
protected:
int upPin;
int downPin;
Bounce debouncerUp;
Bounce debouncerDown;
private:
int read()
{
this->debouncerUp.update();
this->debouncerDown.update();
bool up = this->debouncerUp.read() == 0 ? true : false;
bool down = this->debouncerDown.read() == 0 ? true : false;
int newDirection = 0;
if (up)
{
newDirection = POS3_DIRECTION::UP;
}
if (down)
{
newDirection = POS3_DIRECTION::DOWN;
}
if (!up && !down)
{
newDirection = POS3_DIRECTION::MIDDLE;
}
if (up && down)
{
newDirection = POS3_DIRECTION::INVALID;
}
return newDirection;
}
};
#endif

View File

@ -1,42 +0,0 @@
#ifndef TEMPERATURE_SENSOR_H
#define TEMPERATURE_SENSOR_H
#include <max6675.h>
#include "../config.h"
#include "../macros.h"
#include "../time.h"
class TemperatureSensor
{
public:
TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)),
temperature(),
temperature_TS(millis()),
maxTemp(_max),
interval(_interval) {}
bool ok()
{
return temperature < maxTemp;
}
void loop()
{
if (millis() - temperature_TS > interval)
{
temperature_TS = millis();
temperature = ktc.readCelsius();
}
}
private:
MAX6675 ktc;
short temperature;
short maxTemp;
short interval;
millis_t temperature_TS;
};
#endif

View File

@ -1,91 +0,0 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "enums.h"
#include "common/macros.h"
#include <Controllino.h>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Core settings
//
#define LOOP_DELAY 500 // Our frame time, exluding delays in some places
#define BOOT_DELAY 1000 // Wait at least this amount in ms after boot before doing anything
// Please consider to set this to false for production - especially with the full feature set since this is requiring extra
// time for the serial communication and will affect the overall framerate/performance
// #define DEBUG true
#define DEBUG_INTERVAL 1000
#define DEBUG_BAUD_RATE 19200 // Serial port speed
#define RELAY_ON 0 // The relay bank's on value (eg: normally closed)
#define RELAY_OFF 255 // The relay bank's off value (eg: normally closed)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Machine settings
//
// #define USE_MEGA // On Arduino Uno we have only limited ports which are not enough to enable all features.
#define USE_CONTROLLINO
// #define HAS_AUTOREVERSE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// General switches
// Reset button - uncomment to activate. This will unlock the fatal state in case of jamming or other problems.
//#define HAS_RESET
#define RESET_PIN 3
#define RESET_DELAY 1000 // Time to wait when reset has been hit or hold. This is good to give the system some time
#define RESET_FATAL true // Makes the reset button act as emergency button. User has to go into stop positon first to unlock it again otherwise it keeps spinning after the RESET_DELAY
#define RESET_INTERVAL 300 // Interval to read the NC reset button
#define RESET_NC true // Toggles the reset button type between NC and NO
// Operation Mode Switch
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Heating Cell/Partition
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Feedback
// Status LEDS (ok, error) - uncomment to activate
#define HAS_STATUS
#define STATUS_OK_PIN CONTROLLINO_D2
#define STATUS_ERROR_PIN CONTROLLINO_D3
#define FIRMWARE_VERSION 0.7
////////////////////////////////////////////////////////////////
//
// HMI Bridge
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// externals
//
// pull in internal constants
#include "constants.h"
// pull in internal configs
#include "config_adv.h"
// The user_config.h is initially added to the github repository but changes will be ignored via .gitignore. Please keep this file safe and possibly
// on a per tenant base stored. You can override parameters in this file by using #undef SOME_PARAMETER and then re-define again if needed, otherwise disable
// default features by using #undef FEATURE_OR_PARAMETER.
// This presents the possibilty to play with the code whilst staying in the loop with latest updates.
#include "user_config.h"
// At last we check all configs and spit compiler errors
#include "config_validator.h"
#endif

View File

@ -1,153 +0,0 @@
#ifndef known_16bit_timers_header_
#define known_16bit_timers_header_
// Wiring-S
//
#if defined(__AVR_ATmega644P__) && defined(WIRING)
#define TIMER1_A_PIN 5
#define TIMER1_B_PIN 4
#define TIMER1_ICP_PIN 6
// Teensy 2.0
//
#elif defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY)
#define TIMER1_A_PIN 14
#define TIMER1_B_PIN 15
#define TIMER1_C_PIN 4
#define TIMER1_ICP_PIN 22
#define TIMER1_CLK_PIN 11
#define TIMER3_A_PIN 9
#define TIMER3_ICP_PIN 10
// Teensy++ 2.0
#elif defined(__AVR_AT90USB1286__) && defined(CORE_TEENSY)
#define TIMER1_A_PIN 25
#define TIMER1_B_PIN 26
#define TIMER1_C_PIN 27
#define TIMER1_ICP_PIN 4
#define TIMER1_CLK_PIN 6
#define TIMER3_A_PIN 16
#define TIMER3_B_PIN 15
#define TIMER3_C_PIN 14
#define TIMER3_ICP_PIN 17
#define TIMER3_CLK_PIN 13
// Teensy 3.0
//
#elif defined(__MK20DX128__)
#define TIMER1_A_PIN 3
#define TIMER1_B_PIN 4
#define TIMER1_ICP_PIN 4
// Teensy 3.1 / Teensy 3.2
//
#elif defined(__MK20DX256__)
#define TIMER1_A_PIN 3
#define TIMER1_B_PIN 4
#define TIMER1_ICP_PIN 4
#define TIMER3_A_PIN 32
#define TIMER3_B_PIN 25
#define TIMER3_ICP_PIN 32
// Teensy 3.5 / Teensy 3.6
//
#elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
#define TIMER1_A_PIN 3
#define TIMER1_B_PIN 4
#define TIMER1_ICP_PIN 4
#define TIMER3_A_PIN 29
#define TIMER3_B_PIN 30
#define TIMER3_ICP_PIN 29
// Teensy-LC
//
#elif defined(__MKL26Z64__)
#define TIMER1_A_PIN 16
#define TIMER1_B_PIN 17
#define TIMER1_ICP_PIN 17
#define TIMER3_A_PIN 3
#define TIMER3_B_PIN 4
#define TIMER3_ICP_PIN 4
// Arduino Mega
//
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define TIMER1_A_PIN 11
#define TIMER1_B_PIN 12
#define TIMER1_C_PIN 13
#define TIMER3_A_PIN 5
#define TIMER3_B_PIN 2
#define TIMER3_C_PIN 3
#define TIMER4_A_PIN 6
#define TIMER4_B_PIN 7
#define TIMER4_C_PIN 8
#define TIMER4_ICP_PIN 49
#define TIMER5_A_PIN 46
#define TIMER5_B_PIN 45
#define TIMER5_C_PIN 44
#define TIMER3_ICP_PIN 48
#define TIMER3_CLK_PIN 47
// Arduino Leonardo, Yun, etc
//
#elif defined(__AVR_ATmega32U4__)
#define TIMER1_A_PIN 9
#define TIMER1_B_PIN 10
#define TIMER1_C_PIN 11
#define TIMER1_ICP_PIN 4
#define TIMER1_CLK_PIN 12
#define TIMER3_A_PIN 5
#define TIMER3_ICP_PIN 13
// Uno, Duemilanove, LilyPad, etc
//
#elif defined (__AVR_ATmega168__) || defined (__AVR_ATmega328P__)
#define TIMER1_A_PIN 9
#define TIMER1_B_PIN 10
#define TIMER1_ICP_PIN 8
#define TIMER1_CLK_PIN 5
// Sanguino
//
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__)
#define TIMER1_A_PIN 13
#define TIMER1_B_PIN 12
#define TIMER1_ICP_PIN 14
#define TIMER1_CLK_PIN 1
// Wildfire - Wicked Devices
//
#elif defined(__AVR_ATmega1284P__) && defined(WILDFIRE_VERSION) && WILDFIRE_VERSION >= 3
#define TIMER1_A_PIN 5 // PD5
#define TIMER1_B_PIN 8 // PD4
#define TIMER1_ICP_PIN 6 // PD6
#define TIMER1_CLK_PIN 23 // PB1
#define TIMER3_A_PIN 12 // PB6
#define TIMER3_B_PIN 13 // PB7
#define TIMER3_ICP_PIN 9 // PB5
#define TIMER3_CLK_PIN 0 // PD0
#elif defined(__AVR_ATmega1284P__) && defined(WILDFIRE_VERSION) && WILDFIRE_VERSION < 3
#define TIMER1_A_PIN 5 // PD5
#define TIMER1_B_PIN 4 // PD4
#define TIMER1_ICP_PIN 6 // PD6
#define TIMER1_CLK_PIN 15 // PB1
#define TIMER3_A_PIN 12 // PB6
#define TIMER3_B_PIN 13 // PB7
#define TIMER3_ICP_PIN 11 // PB5
#define TIMER3_CLK_PIN 0 // PD0
// Mighty-1284 - Maniacbug
//
#elif defined(__AVR_ATmega1284P__)
#define TIMER1_A_PIN 12 // PD5
#define TIMER1_B_PIN 13 // PD4
#define TIMER1_ICP_PIN 14 // PD6
#define TIMER1_CLK_PIN 1 // PB1
#define TIMER3_A_PIN 6 // PB6
#define TIMER3_B_PIN 7 // PB7
#define TIMER3_ICP_PIN 5 // PB5
#define TIMER3_CLK_PIN 8 // PD0
#endif
#endif

View File

@ -1,21 +0,0 @@
#ifndef CONFIG_ADV_H
#define CONFIG_ADV_H
// Error codes
//
#define E_MSG_OK "Ok"
// common operating failures
#define E_OK 0 //all good
#define E_STUCK 100 //Shredder stuck
// power failures
// sensor failures
////////////////////////////
//
// sub system failures
#endif

View File

@ -1,7 +0,0 @@
#ifndef CONFIG_VALIDATOR
#define CONFIG_VALIDATOR
#include "common/macros.h"
#endif

View File

@ -1,19 +0,0 @@
#ifndef CONSTANTS_H
#define CONSTANTS_H
#include "enums.h"
/////////////////////////////////////////////////////////////////////////
//
// Addons
//
#define CURRENT_SENSOR_STR "CurrentSensor"
#define ENCLOSURE_SENSOR_STR "EnclosureSensor"
#define POWER_STR "Power"
#define OPERATION_MODE_SWITCH_STR "OperationModeSwitch"
#define APP_STR "App"
#define STATUS_STR "Status LED"
#define MPID_CTRL_STR "Multi - PID Controller"
#endif

View File

@ -1,89 +0,0 @@
#ifndef ENUMS_H
#define ENUMS_H
enum PIN_TYPE
{
ANALOG,
DIGITAL
};
enum BOARD
{
UNO,
MEGA
};
enum PARTITION_STATE
{
OFF = 0,
HEATING = 1
AUTO_TUNING = 2,
AUTO = 3,
DISABLED = 4,
ERROR = 10
};
enum CONTROL_MODE
{
OP_PANEL = 1, // OLED & Keypad
EXTERN = 2 // RS485
};
enum RUN_MODE
{
PID = 0, // Normal PID mode
MANUAL = 1, // Debugging / Operator
TEST = 2, // Run remote tests
ERROR = 3
LOCKED = 4
};
enum ADDON_FLAGS
{
DEBUG = 1,
INFO = 2,
LOOP = 3,
DISABLED = 4,
SETUP = 5,
MAIN = 6,
STATE = 7
};
enum ADDONS
{
ENCLOSURE_SENSOR = 6,
DIP_SWITCH = 10,
POWER = 11,
OPERATION_MODE_SWITCH = 20,
SERIAL_BRIDGE = 23,
APP = 25,
MODBUS_BRIDGE = 26,
CURRENT_SENSOR = 32,
STATUS = 33,
MPIDCTRL = 34,
LAST = 64
};
enum POWER_CIRCUIT
{
POWER_1 = 0,
POWER_2 = 1,
POWER_3 = 1
};
enum OPERATION_MODE
{
OP_NONE = 0,
OP_NORMAL = 1,
OP_DEBUG = 2,
OP_SERVICE = 3,
OP_TEST
};
enum ERROR
{
ERROR_OK = 0,
ERROR_WARNING = 1,
ERROR_FATAL = 2
};
#endif

View File

@ -1,14 +0,0 @@
#ifndef FEATURES_H
#define FEATURES_H
#ifdef HAS_RESET
#include "reset.h"
#endif
#include "addons/CurrentSensor.h"
#ifdef HAS_STATUS
#include "addons/Status.h"
#endif
#endif

View File

@ -1,12 +0,0 @@
#include "app.h"
App app = App();
void setup(){
app.setup();
app.info();
Serial.println("------------------ Ready -------------------------------------- ");
}
void loop(){
app.loop();
}

View File

@ -1,28 +0,0 @@
{
"name": "@plastichub/pid-firmware",
"version": "0.1",
"description": "",
"main": "index.js",
"cid": 0,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/plastichub/osr/firmware.git"
},
"keywords": [
"precious",
"plastic"
],
"author": "PlasticHUB",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://gitlab.com/plastichub/osr/firmware/issues"
},
"homepage": "https://gitlab.com/plastichub/osr/firmware#readme",
"dependencies": {
"@xblox/fs": "^0.13.19",
"simple-git": "^1.131.0"
}
}

View File

@ -1,93 +0,0 @@
#include "ppmath_statistics.h"
Statistic::Statistic()
{
clear();
}
// resets all counters
void Statistic::clear()
{
_cnt = 0;
_sum = 0;
_min = 0;
_max = 0;
#ifdef STAT_USE_STDEV
_ssqdif = 0.0; // not _ssq but sum of square differences
// which is SUM(from i = 1 to N) of
// (f(i)-_ave_N)**2
#endif
}
// adds a new value to the data-set
void Statistic::add(const float value)
{
if (_cnt == 0)
{
_min = value;
_max = value;
}
else
{
if (value < _min)
_min = value;
else if (value > _max)
_max = value;
}
_sum += value;
_cnt++;
#ifdef STAT_USE_STDEV
if (_cnt > 1)
{
float _store = (_sum / _cnt - value);
_ssqdif = _ssqdif + _cnt * _store * _store / (_cnt - 1);
// ~10% faster but limits the amount of samples to 65K as _cnt*_cnt overflows
// float _store = _sum - _cnt * value;
// _ssqdif = _ssqdif + _store * _store / (_cnt*_cnt - _cnt);
}
#endif
}
// returns the average of the data-set added sofar
float Statistic::average() const
{
if (_cnt == 0)
return NAN; // original code returned 0
return _sum / _cnt;
}
// Population standard deviation = s = sqrt [ S ( Xi - <20> )2 / N ]
// http://www.suite101.com/content/how-is-standard-deviation-used-a99084
#ifdef STAT_USE_STDEV
float Statistic::variance() const
{
if (_cnt == 0)
return NAN; // otherwise DIV0 error
return _ssqdif / _cnt;
}
float Statistic::mean() const
{
if (_cnt == 0)
return NAN; // otherwise DIV0 error
return this->sum() / _cnt;
}
float Statistic::pop_stdev() const
{
if (_cnt == 0)
return NAN; // otherwise DIV0 error
return sqrt(_ssqdif / _cnt);
}
float Statistic::unbiased_stdev() const
{
if (_cnt < 2)
return NAN; // otherwise DIV0 error
return sqrt(_ssqdif / (_cnt - 1));
}
#endif
// END OF FILE

View File

@ -1,116 +0,0 @@
#ifndef PPMATH_STATISTICS_H
#define PPMATH_STATISTICS_H
#include <Arduino.h>
#include <math.h>
#define STAT_USE_STDEV
#ifdef __cplusplus
// C++11 solution that is standards compliant. Return type is deduced automatically
template <class L, class R>
static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs)
{
return lhs < rhs ? lhs : rhs;
}
template <class L, class R>
static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs)
{
return lhs > rhs ? lhs : rhs;
}
template <class T>
static inline constexpr const T ABS(const T v)
{
return v >= 0 ? v : -v;
}
#else
// Using GCC extensions, but Travis GCC version does not like it and gives
// "error: statement-expressions are not allowed outside functions nor in template-argument lists"
#define MIN(a, b) \
({__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a < _b ? _a : _b; })
#define MAX(a, b) \
({__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a > _b ? _a : _b; })
#define ABS(a) \
({__typeof__(a) _a = (a); \
_a >= 0 ? _a : -_a; })
#endif
class Statistic
{
public:
Statistic(); // "switches on/off" stdev run time
void clear(); // "switches on/off" stdev run time
void add(const float);
// returns the number of values added
uint32_t count() const { return _cnt; }; // zero if empty
float sum() const { return _sum; }; // zero if empty
float minimum() const { return _min; }; // zero if empty
float maximum() const { return _max; }; // zero if empty
float average() const; // NAN if empty
float mean() const; // zero if empty
#ifdef STAT_USE_STDEV
float variance() const; // NAN if empty
float pop_stdev() const; // population stdev // NAN if empty
float unbiased_stdev() const; // NAN if empty
#endif
protected:
uint32_t _cnt;
float _sum;
float _min;
float _max;
#ifdef STAT_USE_STDEV
float _ssqdif; // sum of squares difference
#endif
};
/**
* Returns the kth q-quantile.
* @link http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population
* ie: median is 1st 2-quantile
* ie: upper quartile is 3rd 4-quantile
* @return {Number} q-quantile of values.
*/
/*
const quantile = (arr: number[], i: number, n: number) => {
if (i === 0) return Math.min.apply(null, arr);
if (i === n) return Math.max.apply(null, arr);
let sorted = arr.slice(0);
sorted.sort((a, b) => a - b);
let index = sorted.length * i / n;
if (index % 1 === 0) {
return 0.5 * sorted[index - 1] + 0.5 * sorted[index];
}
return sorted[~~index];
};
export const median = (arr: number[]) => quantile(arr, 1, 2);
export const sum = (arr: number[]) => arr.reduce((a, b) => a + b, 0);
export const mean = (arr: number[]) => sum(arr) / arr.length;
// sqare errors along mean
const sdiff = (arr: number[], mean: number) => arr.map((v) =>
Math.pow(v - mean, 2)
);
export const standardDeviation = (arr: number[]) =>
Math.sqrt(mean(sdiff(arr, mean(arr))));
*/
#endif

View File

@ -1,11 +0,0 @@
#ifndef TYPES_H
#define TYPES_H
#include <stdint.h>
typedef unsigned long millis_t;
typedef unsigned short ushort;
typedef unsigned char uchar;
#endif

View File

@ -1,4 +0,0 @@
#ifndef USER_CONFIG_H
#define USER_CONFIG_H
#endif

View File

@ -1,88 +0,0 @@
/**
@file
CRC Computations
@defgroup util_crc16 "util/crc16.h": CRC Computations
@code#include "util/crc16.h"@endcode
This header file provides functions for calculating
cyclic redundancy checks (CRC) using common polynomials.
Modified by Doc Walker to be processor-independent (removed inline
assembler to allow it to compile on SAM3X8E processors).
@par References:
Jack Crenshaw's "Implementing CRCs" article in the January 1992 issue of @e
Embedded @e Systems @e Programming. This may be difficult to find, but it
explains CRC's in very clear and concise terms. Well worth the effort to
obtain a copy.
*/
/* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz
Copyright (c) 2005, 2007 Joerg Wunsch
Copyright (c) 2013 Dave Hylands
Copyright (c) 2013 Frederic Nadeau
Copyright (c) 2015 Doc Walker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
#ifndef _UTIL_CRC16_H_
#define _UTIL_CRC16_H_
/** @ingroup util_crc16
Processor-independent CRC-16 calculation.
Polynomial: x^16 + x^15 + x^2 + 1 (0xA001)<br>
Initial value: 0xFFFF
This CRC is normally used in disk-drive controllers.
@param uint16_t crc (0x0000..0xFFFF)
@param uint8_t a (0x00..0xFF)
@return calculated CRC (0x0000..0xFFFF)
*/
uint16_t crc16_update(uint16_t crc, uint8_t a);
/*{
int i;
crc ^= a;
for (i = 0; i < 8; ++i)
{
if (crc & 1)
crc = (crc >> 1) ^ 0xA001;
else
crc = (crc >> 1);
}
return crc;
}
*/
#endif /* _UTIL_CRC16_H_ */

View File

@ -1,64 +0,0 @@
/**
@file
Utility Functions for Manipulating Words
@defgroup util_word "util/word.h": Utility Functions for Manipulating Words
@code#include "util/word.h"@endcode
This header file provides utility functions for manipulating words.
*/
/*
word.h - Utility Functions for Manipulating Words
This file is part of ModbusMaster.
ModbusMaster 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.
ModbusMaster 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 ModbusMaster. If not, see <http://www.gnu.org/licenses/>.
Written by Doc Walker (Rx)
Copyright © 2009-2015 Doc Walker <4-20ma at wvfans dot net>
*/
#ifndef _UTIL_WORD_H_
#define _UTIL_WORD_H_
/** @ingroup util_word
Return low word of a 32-bit integer.
@param uint32_t ww (0x00000000..0xFFFFFFFF)
@return low word of input (0x0000..0xFFFF)
*/
static inline uint16_t lowWord(uint32_t ww)
{
return (uint16_t) ((ww) & 0xFFFF);
}
/** @ingroup util_word
Return high word of a 32-bit integer.
@param uint32_t ww (0x00000000..0xFFFFFFFF)
@return high word of input (0x0000..0xFFFF)
*/
static inline uint16_t highWord(uint32_t ww)
{
return (uint16_t) ((ww) >> 16);
}
#endif /* _UTIL_WORD_H_ */

View File

@ -1,34 +0,0 @@
const read = require('@xblox/fs/read');
const write = require('@xblox/fs/write');
const path = require('path');
const cwd = path.resolve('../../');
const pkgVersion = read.sync('package.json', 'json').version;
const cid = read.sync('package.json', 'json').cid;
async function status(workingDir) {
const git = require('simple-git/promise');
let statusSummary = null;
try {
statusSummary = await git(workingDir).log();
}
catch (e) {
// handle the error
}
return statusSummary;
}
status(cwd).then((status) => {
const version =
`#ifndef VERSION_H \n
#define VERSION_H \n
#define VERSION "${pkgVersion}|${status.latest.hash}"\n
#define CID "${cid}"\n
#endif`;
write.sync('./Version.h', version);
console.log(version);
}
);

View File

@ -1,788 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@sindresorhus/df@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-1.0.1.tgz#c69b66f52f6fcdd287c807df210305dbaf78500d"
integrity sha1-xptm9S9vzdKHyAffIQMF2694UA0=
"@sindresorhus/df@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-2.1.0.tgz#d208cf27e06f0bb476d14d7deccd7d726e9aa389"
integrity sha1-0gjPJ+BvC7R20U197M19cm6ao4k=
dependencies:
execa "^0.2.2"
"@types/minimatch@^3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
"@xblox/core@0.0.18":
version "0.0.18"
resolved "https://registry.yarnpkg.com/@xblox/core/-/core-0.0.18.tgz#6513807ba2982c6b274b3e3972bec312dfb2c8da"
integrity sha1-ZROAe6KYLGsnSz45cr7DEt+yyNo=
dependencies:
base-64 "^0.1.0"
jsonpath "^0.2.11"
qs "^6.4.0"
reflect-metadata "^0.1.10"
"@xblox/fs@^0.13.19":
version "0.13.19"
resolved "https://registry.yarnpkg.com/@xblox/fs/-/fs-0.13.19.tgz#7231ac9bc186a15a48d04a9c4d86c7ff651f8740"
integrity sha512-211yh3Zkm0AIMjNfhOhGzw+vTWH+O4zMivktjW0M+l5mJkyM2f92Pw/GBvxFAOWR2Fryn2NfCIF1GiQIRYdTEQ==
dependencies:
"@types/minimatch" "^3.0.3"
"@xblox/core" "0.0.18"
denodeify "^1.2.1"
errno "^0.1.4"
mime "^2.0.3"
minimatch "^3.0.4"
mkdirp "^0.5.1"
progress-stream "^1.2.0"
q "^1.4.1"
rimraf "^2.6.2"
throttle "^1.0.3"
trash "^4.0.1"
write-file-atomic "^1.3.1"
JSONSelect@0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/JSONSelect/-/JSONSelect-0.4.0.tgz#a08edcc67eb3fcbe99ed630855344a0cf282bb8d"
integrity sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=
array-union@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=
dependencies:
array-uniq "^1.0.1"
array-uniq@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
base-64@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb"
integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
cjson@~0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/cjson/-/cjson-0.2.1.tgz#73cd8aad65d9e1505f9af1744d3b79c1527682a5"
integrity sha1-c82KrWXZ4VBfmvF0TTt5wVJ2gqU=
colors@0.5.x:
version "0.5.1"
resolved "https://registry.yarnpkg.com/colors/-/colors-0.5.1.tgz#7d0023eaeb154e8ee9fce75dcb923d0ed1667774"
integrity sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
cross-spawn-async@^2.1.1:
version "2.2.5"
resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc"
integrity sha1-hF/wwINKPe2dFg2sptOQkGuyiMw=
dependencies:
lru-cache "^4.0.0"
which "^1.2.8"
cross-spawn@^6.0.0:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
dependencies:
nice-try "^1.0.4"
path-key "^2.0.1"
semver "^5.5.0"
shebang-command "^1.2.0"
which "^1.2.9"
debug@2:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
dependencies:
ms "2.0.0"
debug@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
dependencies:
ms "^2.1.1"
denodeify@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/denodeify/-/denodeify-1.2.1.tgz#3a36287f5034e699e7577901052c2e6c94251631"
integrity sha1-OjYof1A05pnnV3kBBSwubJQlFjE=
dir-glob@^2.0.0:
version "2.2.2"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4"
integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==
dependencies:
path-type "^3.0.0"
ebnf-parser@~0.1.9:
version "0.1.10"
resolved "https://registry.yarnpkg.com/ebnf-parser/-/ebnf-parser-0.1.10.tgz#cd1f6ba477c5638c40c97ed9b572db5bab5d8331"
integrity sha1-zR9rpHfFY4xAyX7ZtXLbW6tdgzE=
errno@^0.1.4:
version "0.1.7"
resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618"
integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==
dependencies:
prr "~1.0.1"
escape-string-applescript@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/escape-string-applescript/-/escape-string-applescript-2.0.0.tgz#760bca838668e408fe5ee52ce42caf7cb46c5273"
integrity sha1-dgvKg4Zo5Aj+XuUs5CyvfLRsUnM=
escodegen@0.0.21:
version "0.0.21"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-0.0.21.tgz#53d652cfa1030388279458a5266c5ffc709c63c3"
integrity sha1-U9ZSz6EDA4gnlFilJmxf/HCcY8M=
dependencies:
esprima "~1.0.2"
estraverse "~0.0.4"
optionalDependencies:
source-map ">= 0.1.2"
escodegen@~0.0.24:
version "0.0.28"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-0.0.28.tgz#0e4ff1715f328775d6cab51ac44a406cd7abffd3"
integrity sha1-Dk/xcV8yh3XWyrUaxEpAbNer/9M=
dependencies:
esprima "~1.0.2"
estraverse "~1.3.0"
optionalDependencies:
source-map ">= 0.1.2"
esprima@1.0.x, esprima@~1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad"
integrity sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=
esprima@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.2.tgz#76a0fd66fcfe154fd292667dc264019750b1657b"
integrity sha1-dqD9Zvz+FU/SkmZ9wmQBl1CxZXs=
estraverse@~0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-0.0.4.tgz#01a0932dfee574684a598af5a67c3bf9b6428db2"
integrity sha1-AaCTLf7ldGhKWYr1pnw7+bZCjbI=
estraverse@~1.3.0:
version "1.3.2"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.3.2.tgz#37c2b893ef13d723f276d878d60d8535152a6c42"
integrity sha1-N8K4k+8T1yPydth41g2FNRUqbEI=
execa@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
integrity sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==
dependencies:
cross-spawn "^6.0.0"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"
execa@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.2.2.tgz#e2ead472c2c31aad6f73f1ac956eef45e12320cb"
integrity sha1-4urUcsLDGq1vc/GslW7vReEjIMs=
dependencies:
cross-spawn-async "^2.1.1"
npm-run-path "^1.0.0"
object-assign "^4.0.1"
path-key "^1.0.0"
strip-eof "^1.0.0"
fs-extra@^0.30.0:
version "0.30.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0"
integrity sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=
dependencies:
graceful-fs "^4.1.2"
jsonfile "^2.1.0"
klaw "^1.0.0"
path-is-absolute "^1.0.0"
rimraf "^2.2.8"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
get-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=
glob@^7.1.2, glob@^7.1.3:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
globby@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-7.1.1.tgz#fb2ccff9401f8600945dfada97440cca972b8680"
integrity sha1-+yzP+UAfhgCUXfral0QMypcrhoA=
dependencies:
array-union "^1.0.1"
dir-glob "^2.0.0"
glob "^7.1.2"
ignore "^3.3.5"
pify "^3.0.0"
slash "^1.0.0"
graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
ignore@^3.3.5:
version "3.3.10"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@^2.0.3, inherits@~2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
jison-lex@0.2.x:
version "0.2.1"
resolved "https://registry.yarnpkg.com/jison-lex/-/jison-lex-0.2.1.tgz#ac4b815e8cce5132eb12b5dfcfe8d707b8844dfe"
integrity sha1-rEuBXozOUTLrErXfz+jXB7iETf4=
dependencies:
lex-parser "0.1.x"
nomnom "1.5.2"
jison@0.4.13:
version "0.4.13"
resolved "https://registry.yarnpkg.com/jison/-/jison-0.4.13.tgz#9041707d62241367f58834532b9f19c2c36fac78"
integrity sha1-kEFwfWIkE2f1iDRTK58ZwsNvrHg=
dependencies:
JSONSelect "0.4.0"
cjson "~0.2.1"
ebnf-parser "~0.1.9"
escodegen "0.0.21"
esprima "1.0.x"
jison-lex "0.2.x"
lex-parser "~0.1.3"
nomnom "1.5.2"
jsonfile@^2.1.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug=
optionalDependencies:
graceful-fs "^4.1.6"
jsonpath@^0.2.11:
version "0.2.12"
resolved "https://registry.yarnpkg.com/jsonpath/-/jsonpath-0.2.12.tgz#5bf9d911fb4616c1e3370beceb9f0db24ae34cd2"
integrity sha1-W/nZEftGFsHjNwvs658NskrjTNI=
dependencies:
esprima "1.2.2"
jison "0.4.13"
static-eval "0.2.3"
underscore "1.7.0"
klaw@^1.0.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
integrity sha1-QIhDO0azsbolnXh4XY6W9zugJDk=
optionalDependencies:
graceful-fs "^4.1.9"
lex-parser@0.1.x, lex-parser@~0.1.3:
version "0.1.4"
resolved "https://registry.yarnpkg.com/lex-parser/-/lex-parser-0.1.4.tgz#64c4f025f17fd53bfb45763faeb16f015a747550"
integrity sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA=
lru-cache@^4.0.0:
version "4.1.5"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
dependencies:
pseudomap "^1.0.2"
yallist "^2.1.2"
mime@^2.0.3:
version "2.4.5"
resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.5.tgz#d8de2ecb92982dedbb6541c9b6841d7f218ea009"
integrity sha512-3hQhEUF027BuxZjQA3s7rIv/7VCQPa27hN9u9g87sEkWaKwQPuXOkVKtOeiyUrnWqTDiOs8Ed2rwg733mB0R5w==
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
mkdirp@^0.5.1:
version "0.5.5"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
dependencies:
minimist "^1.2.5"
mount-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mount-point/-/mount-point-3.0.0.tgz#665cb9edebe80d110e658db56c31d0aef51a8f97"
integrity sha1-Zly57evoDREOZY21bDHQrvUaj5c=
dependencies:
"@sindresorhus/df" "^1.0.1"
pify "^2.3.0"
pinkie-promise "^2.0.1"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
ms@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
nice-try@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
nomnom@1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.5.2.tgz#f4345448a853cfbd5c0d26320f2477ab0526fe2f"
integrity sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=
dependencies:
colors "0.5.x"
underscore "1.1.x"
npm-run-path@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-1.0.0.tgz#f5c32bf595fe81ae927daec52e82f8b000ac3c8f"
integrity sha1-9cMr9ZX+ga6Sfa7FLoL4sACsPI8=
dependencies:
path-key "^1.0.0"
npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=
dependencies:
path-key "^2.0.0"
object-assign@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
object-keys@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336"
integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
os-homedir@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M=
p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=
p-map@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b"
integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==
p-try@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
path-key@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-1.0.0.tgz#5d53d578019646c0d68800db4e146e6bdc2ac7af"
integrity sha1-XVPVeAGWRsDWiADbThRua9wqx68=
path-key@^2.0.0, path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
path-type@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==
dependencies:
pify "^3.0.0"
pify@^2.2.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw=
pify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"
integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=
pinkie-promise@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa"
integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o=
dependencies:
pinkie "^2.0.0"
pinkie@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
progress-stream@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/progress-stream/-/progress-stream-1.2.0.tgz#2cd3cfea33ba3a89c9c121ec3347abe9ab125f77"
integrity sha1-LNPP6jO6OonJwSHsM0er6asSX3c=
dependencies:
speedometer "~0.1.2"
through2 "~0.2.3"
prr@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY=
pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=
q@^1.4.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
qs@^6.4.0:
version "6.9.3"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.3.tgz#bfadcd296c2d549f1dffa560619132c977f5008e"
integrity sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==
"readable-stream@>= 0.3.0":
version "3.6.0"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
dependencies:
inherits "^2.0.3"
string_decoder "^1.1.1"
util-deprecate "^1.0.1"
readable-stream@~1.1.9:
version "1.1.14"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk=
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"
reflect-metadata@^0.1.10:
version "0.1.13"
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"
integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==
rimraf@^2.2.8, rimraf@^2.6.2:
version "2.7.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
dependencies:
glob "^7.1.3"
run-applescript@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-3.2.0.tgz#73fb34ce85d3de8076d511ea767c30d4fdfc918b"
integrity sha512-Ep0RsvAjnRcBX1p5vogbaBdAGu/8j/ewpvGqnQYunnLd9SM0vWcPJewPKNnWFggf0hF0pwIgwV5XK7qQ7UZ8Qg==
dependencies:
execa "^0.10.0"
safe-buffer@~5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
semver@^5.5.0:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=
dependencies:
shebang-regex "^1.0.0"
shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
signal-exit@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
simple-git@^1.131.0:
version "1.132.0"
resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.132.0.tgz#53ac4c5ec9e74e37c2fd461e23309f22fcdf09b1"
integrity sha512-xauHm1YqCTom1sC9eOjfq3/9RKiUA9iPnxBbrY2DdL8l4ADMu0jjM5l5lphQP5YWNqAL2aXC/OeuQ76vHtW5fg==
dependencies:
debug "^4.0.1"
slash@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=
slide@^1.1.5:
version "1.1.6"
resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707"
integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=
"source-map@>= 0.1.2":
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
speedometer@~0.1.2:
version "0.1.4"
resolved "https://registry.yarnpkg.com/speedometer/-/speedometer-0.1.4.tgz#9876dbd2a169d3115402d48e6ea6329c8816a50d"
integrity sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=
static-eval@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/static-eval/-/static-eval-0.2.3.tgz#023f17ac9fee426ea788c12ea39206dc175f8b2a"
integrity sha1-Aj8XrJ/uQm6niMEuo5IG3Bdfiyo=
dependencies:
escodegen "~0.0.24"
"stream-parser@>= 0.0.2":
version "0.3.1"
resolved "https://registry.yarnpkg.com/stream-parser/-/stream-parser-0.3.1.tgz#1618548694420021a1182ff0af1911c129761773"
integrity sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M=
dependencies:
debug "2"
string_decoder@^1.1.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
dependencies:
safe-buffer "~5.2.0"
string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=
strip-eof@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=
throttle@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/throttle/-/throttle-1.0.3.tgz#8a32e4a15f1763d997948317c5ebe3ad8a41e4b7"
integrity sha1-ijLkoV8XY9mXlIMXxevjrYpB5Lc=
dependencies:
readable-stream ">= 0.3.0"
stream-parser ">= 0.0.2"
through2@~0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-0.2.3.tgz#eb3284da4ea311b6cc8ace3653748a52abf25a3f"
integrity sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=
dependencies:
readable-stream "~1.1.9"
xtend "~2.1.1"
trash@^4.0.1:
version "4.3.0"
resolved "https://registry.yarnpkg.com/trash/-/trash-4.3.0.tgz#6ebeecdea4d666b06e389b47d135ea88e1de5075"
integrity sha512-f36TKwIaBiXm63xSrn8OTNghg5CYHBsFVJvcObMo76LRpgariuRi2CqXQHw1VzfeximD0igdGaonOG6N760BtQ==
dependencies:
escape-string-applescript "^2.0.0"
fs-extra "^0.30.0"
globby "^7.1.1"
p-map "^1.2.0"
p-try "^1.0.0"
pify "^3.0.0"
run-applescript "^3.0.0"
uuid "^3.1.0"
xdg-trashdir "^2.1.1"
underscore@1.1.x:
version "1.1.7"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.1.7.tgz#40bab84bad19d230096e8d6ef628bff055d83db0"
integrity sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=
underscore@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209"
integrity sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=
user-home@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f"
integrity sha1-nHC/2Babwdy/SGBODwS4tJzenp8=
dependencies:
os-homedir "^1.0.0"
util-deprecate@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
uuid@^3.1.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
which@^1.2.8, which@^1.2.9:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
dependencies:
isexe "^2.0.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
write-file-atomic@^1.3.1:
version "1.3.4"
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f"
integrity sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=
dependencies:
graceful-fs "^4.1.11"
imurmurhash "^0.1.4"
slide "^1.1.5"
xdg-basedir@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-2.0.0.tgz#edbc903cc385fc04523d966a335504b5504d1bd2"
integrity sha1-7byQPMOF/ARSPZZqM1UEtVBNG9I=
dependencies:
os-homedir "^1.0.0"
xdg-trashdir@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/xdg-trashdir/-/xdg-trashdir-2.1.1.tgz#59a60aaf8e6f9240c1daed9a0944b2f514c27d8e"
integrity sha512-KcVhPaOu2ZurYNHSRTf1+ZHORkTZGCQ+u0JHN17QixRISJq4pXOnjt/lQcehvtHL5QAKhSzKgyjrcNnPdkPBHA==
dependencies:
"@sindresorhus/df" "^2.1.0"
mount-point "^3.0.0"
pify "^2.2.0"
user-home "^2.0.0"
xdg-basedir "^2.0.0"
xtend@~2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b"
integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os=
dependencies:
object-keys "~0.4.0"
yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=

View File

@ -1,26 +0,0 @@
## Remarks on the network
*Plasticbay - Scotland (yeah)*
Well I have mentioned a few times that there was a problem with the strategy of overshooting melting temperature by 50 or 60 deg C. It generates fumes and degrades the plastics seriously. I am very concerned by this advice and I am basically told to just get on with it. Here a little explanation of what is going on:
You may know that plastic is a good thermal insulant, meaning its thermal conductivity is low. That means that if you heat up a mass from the outside, it will take a long time to be at the same temperature in the inside. The gradient between the core and the outside of what you want to melt is depending of the thermal conductivity. For the sake of simplicity, lets say the "instantaneous" thermal gradient needed to melt your example is 60 deg C.
So to get the inside to melt, either (1) you heat up to the melting temperature or just above and wait that the heat transfers inside let say it takes 12h or (2) you rise the outside temperature 60 degrees above the melting temperature so "relatively" quickly the inside reaches the melting temperature.
(2) is what the Team is advising and I am firmly against it because while you do that, the outside of the mass (here sheet) is at 220-240 degs, the mass that is overheated generates a lot of fumes and looses its chemical properties and basically its capacity to bond. That's why many complain that the sheets have a random output. All the charts should be changed with a proper time-to-temperature-to-mass output. I find the current advice dangerous.
---
*RENN*
Hi there,
I am starting my sheetpress workplace and I just run our machine yesterday and the result was bad :(
It didn't melt properly, some parts didnt melted at all. (It didnt burn)
I want to know why it failed.
I followed the guide from preciousplastic official site. (see the pic)
I melted HDPE in 220 degree for 1 hour (for 22MM thickness)
I know the melting point of HDPE is 120 degree but I just followed the guide.
Do you guys think the temperature was wrong?

View File

@ -1,86 +0,0 @@
#include "AnalogButton_local.h"
//#include "WProgram.h"
#include "Arduino.h"
AnalogButton::AnalogButton(uint8_t analogPin, int buttonValueReturn,
int buttonValueUp, int buttonValueDown, int buttonValueOk)
{
// Store analog pin used to multiplex push button
buttonPin = analogPin;
// Add upper bound of tolerance for variation againts resistor values, temperature
// and other possible drift
buttonValueThresholdReturn = TOLERANCE*buttonValueReturn;
buttonValueThresholdUp = TOLERANCE*buttonValueUp;
buttonValueThresholdDown = TOLERANCE*buttonValueDown;
buttonValueThresholdOk = TOLERANCE*buttonValueOk;
}
button_t AnalogButton::read(void)
{
int buttonValue;
buttonValue = analogRead(buttonPin);
if (buttonValue >= BUTTON_NONE_THRESHOLD) return BUTTON_NONE;
if (buttonValue <= buttonValueThresholdReturn) return BUTTON_RETURN;
if (buttonValue <= buttonValueThresholdUp) return BUTTON_UP;
if (buttonValue <= buttonValueThresholdDown) return BUTTON_DOWN;
if (buttonValue <= buttonValueThresholdOk) return BUTTON_OK;
return BUTTON_NONE;
}
button_t AnalogButton::get(void)
{
static button_t buttonMask;
static buttonState_t buttonState;
static unsigned long debounceTimer;
button_t buttonValue;
button_t buttonStatus;
// Initialize button status
buttonStatus = BUTTON_NONE;
switch (buttonState)
{
case BUTTON_STATE_SCAN:
// Retrieve current button value
buttonValue = read();
// If button press is detected
if (buttonValue != BUTTON_NONE)
{
// Store current button press value
buttonMask = buttonValue;
// Retrieve current time
debounceTimer = millis();
debounceTimer += DEBOUNCE_PERIOD;
// Proceed to button debounce state
buttonState = BUTTON_STATE_DEBOUNCE;
}
break;
case BUTTON_STATE_DEBOUNCE:
if (read() == buttonMask)
{
// If debounce period is completed
if (millis() >= debounceTimer)
{
buttonStatus = buttonMask;
// Proceed to wait for the button to be released
buttonState = BUTTON_STATE_RELEASE;
}
}
break;
case BUTTON_STATE_RELEASE:
if (read() == BUTTON_NONE)
{
buttonMask = BUTTON_NONE;
buttonState = BUTTON_STATE_SCAN;
}
break;
}
return (buttonStatus);
}

View File

@ -1,47 +0,0 @@
#ifndef AnalogButton_h
#define AnalogButton_h
#include <inttypes.h>
enum button_t
{
BUTTON_NONE,
BUTTON_RETURN,
BUTTON_UP,
BUTTON_DOWN,
BUTTON_OK
};
enum buttonState_t
{
BUTTON_STATE_SCAN,
BUTTON_STATE_DEBOUNCE,
BUTTON_STATE_RELEASE
};
#define BUTTON_NONE_THRESHOLD 1000
#define TOLERANCE 1.1
#define DEBOUNCE_PERIOD 100
class AnalogButton
{
public:
AnalogButton(uint8_t analogPin, int buttonValueReturn,
int buttonValueUp, int buttonValueDown,
int buttonValueOk);
button_t get(void);
private:
button_t read(void);
// Analog pin used as button multiplexer
uint8_t buttonPin;
// Upper boound ADC value for each button
int buttonValueThresholdReturn;
int buttonValueThresholdUp;
int buttonValueThresholdDown;
int buttonValueThresholdOk;
};
#endif

View File

@ -1,20 +0,0 @@
#include <EEPROM.h>
#include <Arduino.h> // for type definitions
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}
template <class T> int EEPROM_readAnything(int ee, T& value)
{
byte* p = (byte*)(void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}

View File

@ -1,230 +0,0 @@
/*******************************************************************************
* MAX31855 Library
* Version: 1.10
* Date: 24-07-2012
* Company: Rocket Scream Electronics
* Website: www.rocketscream.com
*
* This is a MAX31855 library for Arduino. Please check our wiki
* (www.rocketscream.com/wiki) for more information on using this piece of
* library.
*
* This library is licensed under Creative Commons Attribution-ShareAlike 3.0
* Unported License.
*
* Revision Description
* ======== ===========
* 1.10 Added negative temperature support for both junction & thermocouple.
* 1.00 Initial public release.
*
*******************************************************************************/
#include "MAX31855_local.h"
MAX31855::MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK)
{
so = SO;
cs = CS;
sck = SCK;
// MAX31855 data output pin
pinMode(so, INPUT);
// MAX31855 chip select input pin
pinMode(cs, OUTPUT);
// MAX31855 clock input pin
pinMode(sck, OUTPUT);
// Default output pins state
digitalWrite(cs, HIGH);
digitalWrite(sck, LOW);
}
/*******************************************************************************
* Name: readThermocouple
* Description: Read the thermocouple temperature either in Degree Celsius or
* Fahrenheit. Internally, the conversion takes place in the
* background within 100 ms. Values are updated only when the CS
* line is high.
*
* Argument Description
* ========= ===========
* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return Description
* ========= ===========
* temperature Temperature of the thermocouple either in Degree Celsius or
* Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or
* FAULT_SHORT_VCC will be returned. These fault values are outside
* of the temperature range the MAX31855 is capable of.
*******************************************************************************/
double MAX31855::readThermocouple(unit_t unit)
{
unsigned long data;
double temperature;
// Initialize temperature
temperature = 0;
// Shift in 32-bit of data from MAX31855
data = readData();
// If fault is detected
if (data & 0x00010000)
{
// Check for fault type (3 LSB)
switch (data & 0x00000007)
{
// Open circuit
case 0x01:
temperature = FAULT_OPEN;
break;
// Thermocouple short to GND
case 0x02:
temperature = FAULT_SHORT_GND;
break;
// Thermocouple short to VCC
case 0x04:
temperature = FAULT_SHORT_VCC;
break;
}
}
// No fault detected
else
{
// Retrieve thermocouple temperature data and strip redundant data
data = data >> 18;
// Bit-14 is the sign
temperature = (data & 0x00001FFF);
// Check for negative temperature
if (data & 0x00002000)
{
// 2's complement operation
// Invert
data = ~data;
// Ensure operation involves lower 13-bit only
temperature = data & 0x00001FFF;
// Add 1 to obtain the positive number
temperature += 1;
// Make temperature negative
temperature *= -1;
}
// Convert to Degree Celsius
temperature *= 0.25;
// If temperature unit in Fahrenheit is desired
if (unit == FAHRENHEIT)
{
// Convert Degree Celsius to Fahrenheit
temperature = (temperature * 9.0 / 5.0) + 32;
}
}
return (temperature);
}
/*******************************************************************************
* Name: readJunction
* Description: Read the thermocouple temperature either in Degree Celsius or
* Fahrenheit. Internally, the conversion takes place in the
* background within 100 ms. Values are updated only when the CS
* line is high.
*
* Argument Description
* ========= ===========
* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT
*
* Return Description
* ========= ===========
* temperature Temperature of the cold junction either in Degree Celsius or
* Fahrenheit.
*
*******************************************************************************/
double MAX31855::readJunction(unit_t unit)
{
double temperature;
unsigned long data;
// Shift in 32-bit of data from MAX31855
data = readData();
// Strip fault data bits & reserved bit
data = data >> 4;
// Bit-12 is the sign
temperature = (data & 0x000007FF);
// Check for negative temperature
if (data & 0x00000800)
{
// 2's complement operation
// Invert
data = ~data;
// Ensure operation involves lower 11-bit only
temperature = data & 0x000007FF;
// Add 1 to obtain the positive number
temperature += 1;
// Make temperature negative
temperature *= -1;
}
// Convert to Degree Celsius
temperature *= 0.0625;
// If temperature unit in Fahrenheit is desired
if (unit == FAHRENHEIT)
{
// Convert Degree Celsius to Fahrenheit
temperature = (temperature * 9.0 / 5.0) + 32;
}
// Return the temperature
return (temperature);
}
/*******************************************************************************
* Name: readData
* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse
* width is 100 ns. No delay is required in this case.
*
* Argument Description
* ========= ===========
* 1. NIL
*
* Return Description
* ========= ===========
* data 32-bit of data acquired from the MAX31855 chip.
*
*******************************************************************************/
unsigned long MAX31855::readData()
{
int bitCount;
unsigned long data;
// Clear data
data = 0;
// Select the MAX31855 chip
digitalWrite(cs, LOW);
// Shift in 32-bit of data
for (bitCount = 31; bitCount >= 0; bitCount--)
{
digitalWrite(sck, HIGH);
// If data bit is high
if (digitalRead(so))
{
// Need to type cast data type to unsigned long, else compiler will
// truncate to 16-bit
data |= ((unsigned long)1 << bitCount);
}
digitalWrite(sck, LOW);
}
// Deselect MAX31855 chip
digitalWrite(cs, HIGH);
return (data);
}

View File

@ -1,35 +0,0 @@
#ifndef MAX31855_H
#define MAX31855_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define FAULT_OPEN 10000
#define FAULT_SHORT_GND 10001
#define FAULT_SHORT_VCC 10002
enum unit_t
{
CELSIUS,
FAHRENHEIT
};
class MAX31855
{
public:
MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK);
double readThermocouple(unit_t unit);
double readJunction(unit_t unit);
private:
unsigned char so;
unsigned char cs;
unsigned char sck;
unsigned long readData();
};
#endif

View File

@ -1,235 +0,0 @@
/**********************************************************************************************
* Arduino PID AutoTune Library - Version 0.0.0
* by Brett Beauregard <br3ttb@gmail.com> brettbeauregard.com
*
* This Library is ported from the AutotunerPID Toolkit by William Spinelli
* (http://www.mathworks.com/matlabcentral/fileexchange/4652)
* Copyright (c) 2004
*
* This Library is licensed under the BSD License:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
**********************************************************************************************/
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "PID_AutoTune_v0_local.h" //renamed to avoid conflict if Autotune library is installed on IDE
PID_ATune::PID_ATune(double *Input, double *Output)
{
input = Input;
output = Output;
controlType = 0; //default to PI
noiseBand = 0.5;
running = false;
oStep = 30;
SetLookbackSec(10);
lastTime = millis();
}
void PID_ATune::Cancel()
{
running = false;
}
int PID_ATune::Runtime()
{
justevaled = false;
if (peakCount > 9 && running)
{
running = false;
FinishUp();
return 1;
}
unsigned long now = millis();
if ((now - lastTime) < (unsigned long)sampleTime)
return false;
lastTime = now;
double refVal = *input;
justevaled = true;
if (!running)
{ //initialize working variables the first time around
peakType = 0;
peakCount = 0;
justchanged = false;
absMax = refVal;
absMin = refVal;
setpoint = refVal;
running = true;
initCount = 0;
outputStart = *output;
*output = outputStart + oStep;
}
else
{
if (refVal > absMax)
absMax = refVal;
if (refVal < absMin)
absMin = refVal;
}
//oscillate the output base on the input's relation to the setpoint
if (refVal > setpoint + noiseBand)
*output = outputStart - oStep;
else if (refVal < setpoint - noiseBand)
*output = outputStart + oStep;
//bool isMax=true, isMin=true;
isMax = true;
isMin = true;
//id peaks
for (int i = nLookBack - 1; i >= 0; i--)
{
double val = lastInputs[i];
if (isMax)
isMax = refVal > val;
if (isMin)
isMin = refVal < val;
lastInputs[i + 1] = lastInputs[i];
}
lastInputs[0] = refVal;
if (nLookBack < 9)
{ //we don't want to trust the maxes or mins until the inputs array has been filled
initCount++;
return 0;
}
if (isMax)
{
if (peakType == 0)
peakType = 1;
if (peakType == -1)
{
peakType = 1;
justchanged = true;
peak2 = peak1;
}
peak1 = now;
peaks[peakCount] = refVal;
}
else if (isMin)
{
if (peakType == 0)
peakType = -1;
if (peakType == 1)
{
peakType = -1;
peakCount++;
justchanged = true;
}
if (peakCount < 10)
peaks[peakCount] = refVal;
}
if (justchanged && peakCount > 2)
{ //we've transitioned. check if we can autotune based on the last peaks
double avgSeparation = (abs(peaks[peakCount - 1] - peaks[peakCount - 2]) + abs(peaks[peakCount - 2] - peaks[peakCount - 3])) / 2;
if (avgSeparation < 0.05 * (absMax - absMin))
{
FinishUp();
running = false;
return 1;
}
}
justchanged = false;
return 0;
}
void PID_ATune::FinishUp()
{
*output = outputStart;
//we can generate tuning parameters!
Ku = 4 * oStep / ((absMax - absMin) * 3.14159);
Pu = (double)(peak1 - peak2) / 1000;
}
double PID_ATune::GetKp()
{
return controlType == 1 ? 0.6 * Ku : 0.4 * Ku;
}
double PID_ATune::GetKi()
{
return controlType == 1 ? 1.2 * Ku / Pu : 0.48 * Ku / Pu; // Ki = Kc/Ti
}
double PID_ATune::GetKd()
{
return controlType == 1 ? 0.075 * Ku * Pu : 0; //Kd = Kc * Td
}
void PID_ATune::SetOutputStep(double Step)
{
oStep = Step;
}
double PID_ATune::GetOutputStep()
{
return oStep;
}
void PID_ATune::SetControlType(int Type) //0=PI, 1=PID
{
controlType = Type;
}
int PID_ATune::GetControlType()
{
return controlType;
}
void PID_ATune::SetNoiseBand(double Band)
{
noiseBand = Band;
}
double PID_ATune::GetNoiseBand()
{
return noiseBand;
}
void PID_ATune::SetLookbackSec(int value)
{
if (value < 1)
value = 1;
if (value < 25)
{
nLookBack = value * 4;
sampleTime = 250;
}
else
{
nLookBack = 100;
sampleTime = value * 10;
}
}
int PID_ATune::GetLookbackSec()
{
return nLookBack * sampleTime / 1000;
}

View File

@ -1,53 +0,0 @@
#ifndef PID_AutoTune_v0
#define PID_AutoTune_v0
#define LIBRARY_VERSION 0.0.0
class PID_ATune
{
public:
//commonly used functions **************************************************************************
PID_ATune(double *, double *); // * Constructor. links the Autotune to a given PID
int Runtime(); // * Similar to the PID Compue function, returns non 0 when done
void Cancel(); // * Stops the AutoTune
void SetOutputStep(double); // * how far above and below the starting value will the output step?
double GetOutputStep(); //
void SetControlType(int); // * Determies if the tuning parameters returned will be PI (D=0)
int GetControlType(); // or PID. (0=PI, 1=PID)
void SetLookbackSec(int); // * how far back are we looking to identify peaks
int GetLookbackSec(); //
void SetNoiseBand(double); // * the autotune will ignore signal chatter smaller than this value
double GetNoiseBand(); // this should be acurately set
double GetKp(); // * once autotune is complete, these functions contain the
double GetKi(); // computed tuning parameters.
double GetKd(); //
private:
void FinishUp();
bool isMax, isMin;
double *input, *output;
double setpoint;
double noiseBand;
int controlType;
bool running;
unsigned long peak1, peak2, lastTime;
int sampleTime;
int nLookBack;
int peakType;
double lastInputs[100];
double peaks[10];
int peakCount;
bool justchanged;
bool justevaled;
int initCount;
double absMax, absMin;
double oStep;
double outputStart;
double Ku, Pu;
};
#endif

View File

@ -1,192 +0,0 @@
/**********************************************************************************************
* Arduino PID Library - Version 1.0.1
* by Brett Beauregard <br3ttb@gmail.com> brettbeauregard.com
*
* This Library is licensed under a GPLv3 License
**********************************************************************************************/
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "PID_v1_local.h" //renamed to avoid conflict if PID library is installed on IDE
/*Constructor (...)*********************************************************
* The parameters specified here are those for for which we can't set up
* reliable defaults, so we need to have the user set them.
***************************************************************************/
PID::PID(double* Input, double* Output, double* Setpoint,
double Kp, double Ki, double Kd, int ControllerDirection)
{
PID::SetOutputLimits(0, 255); //default output limit corresponds to
//the arduino pwm limits
SampleTime = 100; //default Controller Sample Time is 0.1 seconds
PID::SetControllerDirection(ControllerDirection);
PID::SetTunings(Kp, Ki, Kd);
lastTime = millis()-SampleTime;
inAuto = false;
myOutput = Output;
myInput = Input;
mySetpoint = Setpoint;
}
/* Compute() **********************************************************************
* This, as they say, is where the magic happens. this function should be called
* every time "void loop()" executes. the function will decide for itself whether a new
* pid Output needs to be computed
**********************************************************************************/
void PID::Compute()
{
if(!inAuto) return;
unsigned long now = millis();
unsigned long timeChange = (now - lastTime);
if(timeChange>=(unsigned long)SampleTime)
{
/*Compute all the working error variables*/
double input = *myInput;
double error = *mySetpoint - input;
ITerm+= (ki * error);
if(ITerm > outMax) ITerm= outMax;
else if(ITerm < outMin) ITerm= outMin;
double dInput = (input - lastInput);
/*Compute PID Output*/
double output = kp * error + ITerm- kd * dInput;
if(output > outMax) output = outMax;
else if(output < outMin) output = outMin;
*myOutput = output;
/*Remember some variables for next time*/
lastInput = input;
lastTime = now;
}
}
/* SetTunings(...)*************************************************************
* This function allows the controller's dynamic performance to be adjusted.
* it's called automatically from the constructor, but tunings can also
* be adjusted on the fly during normal operation
******************************************************************************/
void PID::SetTunings(double Kp, double Ki, double Kd)
{
if (Kp<0 || Ki<0 || Kd<0) return;
dispKp = Kp; dispKi = Ki; dispKd = Kd;
double SampleTimeInSec = ((double)SampleTime)/1000;
kp = Kp;
ki = Ki * SampleTimeInSec;
kd = Kd / SampleTimeInSec;
if(controllerDirection ==REVERSE)
{
kp = (0 - kp);
ki = (0 - ki);
kd = (0 - kd);
}
}
/* SetSampleTime(...) *********************************************************
* sets the period, in Milliseconds, at which the calculation is performed
******************************************************************************/
void PID::SetSampleTime(int NewSampleTime)
{
if (NewSampleTime > 0)
{
double ratio = (double)NewSampleTime
/ (double)SampleTime;
ki *= ratio;
kd /= ratio;
SampleTime = (unsigned long)NewSampleTime;
}
}
/* SetOutputLimits(...)****************************************************
* This function will be used far more often than SetInputLimits. while
* the input to the controller will generally be in the 0-1023 range (which is
* the default already,) the output will be a little different. maybe they'll
* be doing a time window and will need 0-8000 or something. or maybe they'll
* want to clamp it from 0-125. who knows. at any rate, that can all be done
* here.
**************************************************************************/
void PID::SetOutputLimits(double Min, double Max)
{
if(Min >= Max) return;
outMin = Min;
outMax = Max;
if(inAuto)
{
if(*myOutput > outMax) *myOutput = outMax;
else if(*myOutput < outMin) *myOutput = outMin;
if(ITerm > outMax) ITerm= outMax;
else if(ITerm < outMin) ITerm= outMin;
}
}
/* SetMode(...)****************************************************************
* Allows the controller Mode to be set to manual (0) or Automatic (non-zero)
* when the transition from manual to auto occurs, the controller is
* automatically initialized
******************************************************************************/
void PID::SetMode(int Mode)
{
bool newAuto = (Mode == AUTOMATIC);
if(newAuto == !inAuto)
{ /*we just went from manual to auto*/
PID::Initialize();
}
inAuto = newAuto;
}
/* Initialize()****************************************************************
* does all the things that need to happen to ensure a bumpless transfer
* from manual to automatic mode.
******************************************************************************/
void PID::Initialize()
{
ITerm = *myOutput;
lastInput = *myInput;
if(ITerm > outMax) ITerm = outMax;
else if(ITerm < outMin) ITerm = outMin;
}
/* SetControllerDirection(...)*************************************************
* The PID will either be connected to a DIRECT acting process (+Output leads
* to +Input) or a REVERSE acting process(+Output leads to -Input.) we need to
* know which one, because otherwise we may increase the output when we should
* be decreasing. This is called from the constructor.
******************************************************************************/
void PID::SetControllerDirection(int Direction)
{
if(inAuto && Direction !=controllerDirection)
{
kp = (0 - kp);
ki = (0 - ki);
kd = (0 - kd);
}
controllerDirection = Direction;
}
/* Status Funcions*************************************************************
* Just because you set the Kp=-1 doesn't mean it actually happened. these
* functions query the internal state of the PID. they're here for display
* purposes. this are the functions the PID Front-end uses for example
******************************************************************************/
double PID::GetKp(){ return dispKp; }
double PID::GetKi(){ return dispKi;}
double PID::GetKd(){ return dispKd;}
int PID::GetMode(){ return inAuto ? AUTOMATIC : MANUAL;}
int PID::GetDirection(){ return controllerDirection;}

Some files were not shown because too many files have changed in this diff Show More