diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index e8efd8b..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,20 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - # Check GitHub Actions - # Workflow files stored in the default location of `.github/workflows` - - directory: "/" - package-ecosystem: "github-actions" - schedule: - interval: "monthly" - - # Python dependencies. - - directory: "/" - package-ecosystem: "pip" - schedule: - interval: "weekly" diff --git a/.github/workflows/platformio-ci.yaml b/.github/workflows/platformio-ci.yaml deleted file mode 100644 index b10ce65..0000000 --- a/.github/workflows/platformio-ci.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: PlatformIO CI - -on: - pull_request: - branches: ~ - push: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - name: Acquire sources - uses: actions/checkout@v4 - - - name: Cache pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache PlatformIO - uses: actions/cache@v4 - with: - path: ~/.platformio - key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - - - name: Run build - run: pio run diff --git a/.gitignore b/.gitignore index 71f9712..485dee6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ .idea -.pio -.venv* diff --git a/LICENSE b/LICENSE index 810fce6..0f10922 100644 --- a/LICENSE +++ b/LICENSE @@ -1,621 +1,289 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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 +CERN Open Hardware Licence Version 2 - Strongly Reciprocal + + +Preamble + +CERN has developed this licence to promote collaboration among +hardware designers and to provide a legal tool which supports the +freedom to use, study, modify, share and distribute hardware designs +and products based on those designs. Version 2 of the CERN Open +Hardware Licence comes in three variants: CERN-OHL-P (permissive); and +two reciprocal licences: CERN-OHL-W (weakly reciprocal) and this +licence, CERN-OHL-S (strongly reciprocal). + +The CERN-OHL-S is copyright CERN 2020. Anyone is welcome to use it, in +unmodified form only. + +Use of this Licence does not imply any endorsement by CERN of any +Licensor or their designs nor does it imply any involvement by CERN in +their development. + + +1 Definitions + + 1.1 'Licence' means this CERN-OHL-S. + + 1.2 'Compatible Licence' means + + a) any earlier version of the CERN Open Hardware licence, or + + b) any version of the CERN-OHL-S, or + + c) any licence which permits You to treat the Source to which + it applies as licensed under CERN-OHL-S provided that on + Conveyance of any such Source, or any associated Product You + treat the Source in question as being licensed under + CERN-OHL-S. + + 1.3 'Source' means information such as design materials or digital + code which can be applied to Make or test a Product or to + prepare a Product for use, Conveyance or sale, regardless of its + medium or how it is expressed. It may include Notices. + + 1.4 'Covered Source' means Source that is explicitly made available + under this Licence. + + 1.5 'Product' means any device, component, work or physical object, + whether in finished or intermediate form, arising from the use, + application or processing of Covered Source. + + 1.6 'Make' means to create or configure something, whether by + manufacture, assembly, compiling, loading or applying Covered + Source or another Product or otherwise. + + 1.7 'Available Component' means any part, sub-assembly, library or + code which: + + a) is licensed to You as Complete Source under a Compatible + Licence; or + + b) is available, at the time a Product or the Source containing + it is first Conveyed, to You and any other prospective + licensees + + i) as a physical part with sufficient rights and + information (including any configuration and + programming files and information about its + characteristics and interfaces) to enable it either to + be Made itself, or to be sourced and used to Make the + Product; or + ii) as part of the normal distribution of a tool used to + design or Make the Product. + + 1.8 'Complete Source' means the set of all Source necessary to Make + a Product, in the preferred form for making modifications, + including necessary installation and interfacing information + both for the Product, and for any included Available Components. + If the format is proprietary, it must also be made available in + a format (if the proprietary tool can create it) which is + viewable with a tool available to potential licensees and + licensed under a licence approved by the Free Software + Foundation or the Open Source Initiative. Complete Source need + not include the Source of any Available Component, provided that + You include in the Complete Source sufficient information to + enable a recipient to Make or source and use the Available + Component to Make the Product. + + 1.9 'Source Location' means a location where a Licensor has placed + Covered Source, and which that Licensor reasonably believes will + remain easily accessible for at least three years for anyone to + obtain a digital copy. + + 1.10 'Notice' means copyright, acknowledgement and trademark notices, + Source Location references, modification notices (subsection + 3.3(b)) and all notices that refer to this Licence and to the + disclaimer of warranties that are included in the Covered + Source. + + 1.11 'Licensee' or 'You' means any person exercising rights under + this Licence. + + 1.12 'Licensor' means a natural or legal person who creates or + modifies Covered Source. A person may be a Licensee and a + Licensor at the same time. + + 1.13 'Convey' means to communicate to the public or distribute. + + +2 Applicability + + 2.1 This Licence governs the use, copying, modification, Conveying + of Covered Source and Products, and the Making of Products. By + exercising any right granted under this Licence, You irrevocably + accept these terms and conditions. + + 2.2 This Licence is granted by the Licensor directly to You, and + shall apply worldwide and without limitation in time. + + 2.3 You shall not attempt to restrict by contract or otherwise the + rights granted under this Licence to other Licensees. + + 2.4 This Licence is not intended to restrict fair use, fair dealing, + or any other similar right. + + +3 Copying, Modifying and Conveying Covered Source + + 3.1 You may copy and Convey verbatim copies of Covered Source, in + any medium, provided You retain all Notices. + + 3.2 You may modify Covered Source, other than Notices, provided that + You irrevocably undertake to make that modified Covered Source + available from a Source Location should You Convey a Product in + circumstances where the recipient does not otherwise receive a + copy of the modified Covered Source. In each case subsection 3.3 + shall apply. + + You may only delete Notices if they are no longer applicable to + the corresponding Covered Source as modified by You and You may + add additional Notices applicable to Your modifications. + Including Covered Source in a larger work is modifying the + Covered Source, and the larger work becomes modified Covered + Source. + + 3.3 You may Convey modified Covered Source (with the effect that You + shall also become a Licensor) provided that You: + + a) retain Notices as required in subsection 3.2; + + b) add a Notice to the modified Covered Source stating that You + have modified it, with the date and brief description of how + You have modified it; + + c) add a Source Location Notice for the modified Covered Source + if You Convey in circumstances where the recipient does not + otherwise receive a copy of the modified Covered Source; and + + d) license the modified Covered Source under the terms and + conditions of this Licence (or, as set out in subsection + 8.3, a later version, if permitted by the licence of the + original Covered Source). Such modified Covered Source must + be licensed as a whole, but excluding Available Components + contained in it, which remain licensed under their own + applicable licences. + + +4 Making and Conveying Products + +You may Make Products, and/or Convey them, provided that You either +provide each recipient with a copy of the Complete Source or ensure +that each recipient is notified of the Source Location of the Complete +Source. That Complete Source is Covered Source, and You must +accordingly satisfy Your obligations set out in subsection 3.3. If +specified in a Notice, the Product must visibly and securely display +the Source Location on it or its packaging or documentation in the +manner specified in that Notice. + + +5 Research and Development + +You may Convey Covered Source, modified Covered Source or Products to +a legal entity carrying out development, testing or quality assurance +work on Your behalf provided that the work is performed on terms which +prevent the entity from both using the Source or Products for its own +internal purposes and Conveying the Source or Products or any +modifications to them to any person other than You. Any modifications +made by the entity shall be deemed to be made by You pursuant to +subsection 3.2. + + +6 DISCLAIMER AND LIABILITY + + 6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products + are provided 'as is' and any express or implied warranties, + including, but not limited to, implied warranties of + merchantability, of satisfactory quality, non-infringement of + third party rights, and fitness for a particular purpose or use + are disclaimed in respect of any Source or Product to the + maximum extent permitted by law. The Licensor makes no + representation that any Source or Product does not or will not + infringe any patent, copyright, trade secret or other + proprietary right. The entire risk as to the use, quality, and + performance of any Source or Product shall be with You and not + the Licensor. This disclaimer of warranty is an essential part + of this Licence and a condition for the grant of any rights + granted under this Licence. + + 6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to + the maximum extent permitted by law, have no liability for + direct, indirect, special, incidental, consequential, exemplary, + punitive or other damages of any character including, without + limitation, procurement of substitute goods or services, loss of + use, data or profits, or business interruption, however caused + and on any theory of contract, warranty, tort (including + negligence), product liability or otherwise, arising in any way + in relation to the Covered Source, modified Covered Source + and/or the Making or Conveyance of a Product, even if advised of + the possibility of such damages, and You shall hold the + Licensor(s) free and harmless from any liability, costs, + damages, fees and expenses, including claims by third parties, + in relation to such use. + + +7 Patents + + 7.1 Subject to the terms and conditions of this Licence, each + Licensor hereby grants to You a perpetual, worldwide, + non-exclusive, no-charge, royalty-free, irrevocable (except as + stated in subsections 7.2 and 8.4) patent licence to Make, have + Made, use, offer to sell, sell, import, and otherwise transfer + the Covered Source and Products, where such licence applies only + to those patent claims licensable by such Licensor that are + necessarily infringed by exercising rights under the Covered + Source as Conveyed by that Licensor. + + 7.2 If You institute patent litigation against any entity (including + a cross-claim or counterclaim in a lawsuit) alleging that the + Covered Source or a Product constitutes direct or contributory + patent infringement, or You seek any declaration that a patent + licensed to You under this Licence is invalid or unenforceable + then any rights granted to You under this Licence shall + terminate as of the date such process is initiated. + + +8 General + + 8.1 If any provisions of this Licence are or subsequently become + invalid or unenforceable for any reason, the remaining + provisions shall remain effective. + + 8.2 You shall not use any of the name (including acronyms and + abbreviations), image, or logo by which the Licensor or CERN is + known, except where needed to comply with section 3, or where + the use is otherwise allowed by law. Any such permitted use + shall be factual and shall not be made so as to suggest any kind + of endorsement or implication of involvement by the Licensor or + its personnel. + + 8.3 CERN may publish updated versions and variants of this Licence + which it considers to be in the spirit of this version, but may + differ in detail to address new problems or concerns. New + versions will be published with a unique version number and a + variant identifier specifying the variant. If the Licensor has + specified that a given variant applies to the Covered Source + without specifying a version, You may treat that Covered Source + as being released under any version of the CERN-OHL with that + variant. If no variant is specified, the Covered Source shall be + treated as being released under CERN-OHL-S. The Licensor may + also specify that the Covered Source is subject to a specific + version of the CERN-OHL or any later version in which case You + may apply this or any later version of CERN-OHL with the same + variant identifier published by CERN. + + 8.4 This Licence shall terminate with immediate effect if You fail + to comply with any of its terms and conditions. + + 8.5 However, if You cease all breaches of this Licence, then Your + Licence from any Licensor is reinstated unless such Licensor has + terminated this Licence by giving You, while You remain in + breach, a notice specifying the breach and requiring You to cure + it within 30 days, and You have failed to come into compliance + in all material respects by the end of the 30 day period. Should + You repeat the breach after receipt of a cure notice and + subsequent reinstatement, this Licence will terminate + immediately and permanently. Section 6 shall continue to apply + after any termination. + + 8.6 This Licence shall not be enforceable except by a Licensor + acting as such, and third party beneficiary rights are + specifically excluded. diff --git a/LICENSE-hardware b/LICENSE-hardware deleted file mode 100644 index 0f10922..0000000 --- a/LICENSE-hardware +++ /dev/null @@ -1,289 +0,0 @@ -CERN Open Hardware Licence Version 2 - Strongly Reciprocal - - -Preamble - -CERN has developed this licence to promote collaboration among -hardware designers and to provide a legal tool which supports the -freedom to use, study, modify, share and distribute hardware designs -and products based on those designs. Version 2 of the CERN Open -Hardware Licence comes in three variants: CERN-OHL-P (permissive); and -two reciprocal licences: CERN-OHL-W (weakly reciprocal) and this -licence, CERN-OHL-S (strongly reciprocal). - -The CERN-OHL-S is copyright CERN 2020. Anyone is welcome to use it, in -unmodified form only. - -Use of this Licence does not imply any endorsement by CERN of any -Licensor or their designs nor does it imply any involvement by CERN in -their development. - - -1 Definitions - - 1.1 'Licence' means this CERN-OHL-S. - - 1.2 'Compatible Licence' means - - a) any earlier version of the CERN Open Hardware licence, or - - b) any version of the CERN-OHL-S, or - - c) any licence which permits You to treat the Source to which - it applies as licensed under CERN-OHL-S provided that on - Conveyance of any such Source, or any associated Product You - treat the Source in question as being licensed under - CERN-OHL-S. - - 1.3 'Source' means information such as design materials or digital - code which can be applied to Make or test a Product or to - prepare a Product for use, Conveyance or sale, regardless of its - medium or how it is expressed. It may include Notices. - - 1.4 'Covered Source' means Source that is explicitly made available - under this Licence. - - 1.5 'Product' means any device, component, work or physical object, - whether in finished or intermediate form, arising from the use, - application or processing of Covered Source. - - 1.6 'Make' means to create or configure something, whether by - manufacture, assembly, compiling, loading or applying Covered - Source or another Product or otherwise. - - 1.7 'Available Component' means any part, sub-assembly, library or - code which: - - a) is licensed to You as Complete Source under a Compatible - Licence; or - - b) is available, at the time a Product or the Source containing - it is first Conveyed, to You and any other prospective - licensees - - i) as a physical part with sufficient rights and - information (including any configuration and - programming files and information about its - characteristics and interfaces) to enable it either to - be Made itself, or to be sourced and used to Make the - Product; or - ii) as part of the normal distribution of a tool used to - design or Make the Product. - - 1.8 'Complete Source' means the set of all Source necessary to Make - a Product, in the preferred form for making modifications, - including necessary installation and interfacing information - both for the Product, and for any included Available Components. - If the format is proprietary, it must also be made available in - a format (if the proprietary tool can create it) which is - viewable with a tool available to potential licensees and - licensed under a licence approved by the Free Software - Foundation or the Open Source Initiative. Complete Source need - not include the Source of any Available Component, provided that - You include in the Complete Source sufficient information to - enable a recipient to Make or source and use the Available - Component to Make the Product. - - 1.9 'Source Location' means a location where a Licensor has placed - Covered Source, and which that Licensor reasonably believes will - remain easily accessible for at least three years for anyone to - obtain a digital copy. - - 1.10 'Notice' means copyright, acknowledgement and trademark notices, - Source Location references, modification notices (subsection - 3.3(b)) and all notices that refer to this Licence and to the - disclaimer of warranties that are included in the Covered - Source. - - 1.11 'Licensee' or 'You' means any person exercising rights under - this Licence. - - 1.12 'Licensor' means a natural or legal person who creates or - modifies Covered Source. A person may be a Licensee and a - Licensor at the same time. - - 1.13 'Convey' means to communicate to the public or distribute. - - -2 Applicability - - 2.1 This Licence governs the use, copying, modification, Conveying - of Covered Source and Products, and the Making of Products. By - exercising any right granted under this Licence, You irrevocably - accept these terms and conditions. - - 2.2 This Licence is granted by the Licensor directly to You, and - shall apply worldwide and without limitation in time. - - 2.3 You shall not attempt to restrict by contract or otherwise the - rights granted under this Licence to other Licensees. - - 2.4 This Licence is not intended to restrict fair use, fair dealing, - or any other similar right. - - -3 Copying, Modifying and Conveying Covered Source - - 3.1 You may copy and Convey verbatim copies of Covered Source, in - any medium, provided You retain all Notices. - - 3.2 You may modify Covered Source, other than Notices, provided that - You irrevocably undertake to make that modified Covered Source - available from a Source Location should You Convey a Product in - circumstances where the recipient does not otherwise receive a - copy of the modified Covered Source. In each case subsection 3.3 - shall apply. - - You may only delete Notices if they are no longer applicable to - the corresponding Covered Source as modified by You and You may - add additional Notices applicable to Your modifications. - Including Covered Source in a larger work is modifying the - Covered Source, and the larger work becomes modified Covered - Source. - - 3.3 You may Convey modified Covered Source (with the effect that You - shall also become a Licensor) provided that You: - - a) retain Notices as required in subsection 3.2; - - b) add a Notice to the modified Covered Source stating that You - have modified it, with the date and brief description of how - You have modified it; - - c) add a Source Location Notice for the modified Covered Source - if You Convey in circumstances where the recipient does not - otherwise receive a copy of the modified Covered Source; and - - d) license the modified Covered Source under the terms and - conditions of this Licence (or, as set out in subsection - 8.3, a later version, if permitted by the licence of the - original Covered Source). Such modified Covered Source must - be licensed as a whole, but excluding Available Components - contained in it, which remain licensed under their own - applicable licences. - - -4 Making and Conveying Products - -You may Make Products, and/or Convey them, provided that You either -provide each recipient with a copy of the Complete Source or ensure -that each recipient is notified of the Source Location of the Complete -Source. That Complete Source is Covered Source, and You must -accordingly satisfy Your obligations set out in subsection 3.3. If -specified in a Notice, the Product must visibly and securely display -the Source Location on it or its packaging or documentation in the -manner specified in that Notice. - - -5 Research and Development - -You may Convey Covered Source, modified Covered Source or Products to -a legal entity carrying out development, testing or quality assurance -work on Your behalf provided that the work is performed on terms which -prevent the entity from both using the Source or Products for its own -internal purposes and Conveying the Source or Products or any -modifications to them to any person other than You. Any modifications -made by the entity shall be deemed to be made by You pursuant to -subsection 3.2. - - -6 DISCLAIMER AND LIABILITY - - 6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products - are provided 'as is' and any express or implied warranties, - including, but not limited to, implied warranties of - merchantability, of satisfactory quality, non-infringement of - third party rights, and fitness for a particular purpose or use - are disclaimed in respect of any Source or Product to the - maximum extent permitted by law. The Licensor makes no - representation that any Source or Product does not or will not - infringe any patent, copyright, trade secret or other - proprietary right. The entire risk as to the use, quality, and - performance of any Source or Product shall be with You and not - the Licensor. This disclaimer of warranty is an essential part - of this Licence and a condition for the grant of any rights - granted under this Licence. - - 6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to - the maximum extent permitted by law, have no liability for - direct, indirect, special, incidental, consequential, exemplary, - punitive or other damages of any character including, without - limitation, procurement of substitute goods or services, loss of - use, data or profits, or business interruption, however caused - and on any theory of contract, warranty, tort (including - negligence), product liability or otherwise, arising in any way - in relation to the Covered Source, modified Covered Source - and/or the Making or Conveyance of a Product, even if advised of - the possibility of such damages, and You shall hold the - Licensor(s) free and harmless from any liability, costs, - damages, fees and expenses, including claims by third parties, - in relation to such use. - - -7 Patents - - 7.1 Subject to the terms and conditions of this Licence, each - Licensor hereby grants to You a perpetual, worldwide, - non-exclusive, no-charge, royalty-free, irrevocable (except as - stated in subsections 7.2 and 8.4) patent licence to Make, have - Made, use, offer to sell, sell, import, and otherwise transfer - the Covered Source and Products, where such licence applies only - to those patent claims licensable by such Licensor that are - necessarily infringed by exercising rights under the Covered - Source as Conveyed by that Licensor. - - 7.2 If You institute patent litigation against any entity (including - a cross-claim or counterclaim in a lawsuit) alleging that the - Covered Source or a Product constitutes direct or contributory - patent infringement, or You seek any declaration that a patent - licensed to You under this Licence is invalid or unenforceable - then any rights granted to You under this Licence shall - terminate as of the date such process is initiated. - - -8 General - - 8.1 If any provisions of this Licence are or subsequently become - invalid or unenforceable for any reason, the remaining - provisions shall remain effective. - - 8.2 You shall not use any of the name (including acronyms and - abbreviations), image, or logo by which the Licensor or CERN is - known, except where needed to comply with section 3, or where - the use is otherwise allowed by law. Any such permitted use - shall be factual and shall not be made so as to suggest any kind - of endorsement or implication of involvement by the Licensor or - its personnel. - - 8.3 CERN may publish updated versions and variants of this Licence - which it considers to be in the spirit of this version, but may - differ in detail to address new problems or concerns. New - versions will be published with a unique version number and a - variant identifier specifying the variant. If the Licensor has - specified that a given variant applies to the Covered Source - without specifying a version, You may treat that Covered Source - as being released under any version of the CERN-OHL with that - variant. If no variant is specified, the Covered Source shall be - treated as being released under CERN-OHL-S. The Licensor may - also specify that the Covered Source is subject to a specific - version of the CERN-OHL or any later version in which case You - may apply this or any later version of CERN-OHL with the same - variant identifier published by CERN. - - 8.4 This Licence shall terminate with immediate effect if You fail - to comply with any of its terms and conditions. - - 8.5 However, if You cease all breaches of this Licence, then Your - Licence from any Licensor is reinstated unless such Licensor has - terminated this Licence by giving You, while You remain in - breach, a notice specifying the breach and requiring You to cure - it within 30 days, and You have failed to come into compliance - in all material respects by the end of the 30 day period. Should - You repeat the breach after receipt of a cure notice and - subsequent reinstatement, this Licence will terminate - immediately and permanently. Section 6 shall continue to apply - after any termination. - - 8.6 This Licence shall not be enforceable except by a Licensor - acting as such, and third party beneficiary rights are - specifically excluded. diff --git a/Makefile b/Makefile deleted file mode 100644 index db6c16d..0000000 --- a/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -$(eval venvpath := .venv) -$(eval python := $(venvpath)/bin/python) -$(eval pip := $(venvpath)/bin/pip) -$(eval platformio := $(venvpath)/bin/platformio) - - -build: setup-virtualenv - $(platformio) run - -setup-virtualenv: - @test -e $(python) || `command -v virtualenv` --python=python3 $(venvpath) - $(pip) install platformio diff --git a/README.md b/README.md new file mode 100644 index 0000000..426fbb3 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# HaniMandl Hardware + +Ein halbautomatischer Honig-Abfüll-Roboter. + + +## Ressourcen + +- Repository für Firmware und Dokumentation: https://github.com/hiveeyes/hani-mandl + +- [3D-Druck-Dateien] für verschiedene Ausführungsvarianten. + +- Diskussionsforum: [HaniMandl, halbautomatischer Honig-Abfüllbehälter] + +- Weitere Diskussionen über Code, Infos zur Hardware, Fotos und Videos in der [Facebook-Gruppe »Imkerei und Technik. Eigenbau«]. + + +## Lizenzen + +Die HaniMandl Hardware ist unter der Open Hardware Lizenz "CERN-OHL-S" +verfügbar. Für frühere Versionen und einige aktuelle Derivate finden +abweichende Lizenzen Anwendung. + + +[3D-Druck-Dateien]: ./variants +[Facebook-Gruppe »Imkerei und Technik. Eigenbau«]: https://www.facebook.com/groups/139671009967454 +[HaniMandl, halbautomatischer Honig-Abfüllbehälter]: https://community.hiveeyes.org/t/side-project-hanimandl-halbautomatischer-honig-abfullbehalter/768 diff --git a/changelog.md b/changelog.md deleted file mode 100644 index 38ac91a..0000000 --- a/changelog.md +++ /dev/null @@ -1,44 +0,0 @@ -# Change Log -## 2020-08-13, (v0.2.4 bis) v0.2.6 - -Display: -- Logo und Umlaute implementiert -- Stop-Taste verlässt Setup-Untermenüs -- Anzeige der vorherigen Werte im Setup -- minimaler Servowinkel einstellbar -- Reihenfolge der Boot-Meldungen optimiert - -Programmlogik: -- Autokorrektur implementiert -- Kulanzwert für Autokorrektur einstellbar -- Kalibrierung der Waage verbessert - - -## 2020-06-15, v0.2.3 - -Hardware: -- Angepasst an Heltec NEW Wifi Kit 32 mit angepasster Beschaltung - -Programmcode: -- nicht/wenig benutzte Funktionen und Variablen eliminiert - -Display: -- Display-Ausgabe mit sprintf-Formatierung und kleinerem Font -- Play/Pause Symbol zeigt an, ob der Servo aktiv ist -- Boot-Meldung - -Programmlogik: -- Servo wird beim Boot und Umschalten zwischen den Modi auf Minimum gefahren -- Umschaltung zwischen den Modi deaktiviert den Servo -- Der Automatik-Modus muss ebenfalls mit der grünen Taste aktiviert werden: - - ohne Autostart kann die Automatik _nur_ aktiviert werden, wenn ein Glas (oder anderes Gewicht!) auf der Waage steht. - Es kann also ein leeres oder teilweise gefülltes Glas bis zum konfigurierten Wert gefüllt werden. - - bei Autostart wird die Automatik mit grün aktiviert und startet, wenn für 1.5 Sekunden ein leeres Glas auf der Waage steht (Anzeige START). - Damit wird verhindert, dass ein schwankendes Gewicht den Vorgang auslöst. - Ändert sich in den 1.5 Sekunden das Gewicht, wird der Vorgang nicht gestartet! - Mit der roten Taste werden beide Automatiken unterbrochen und der Servo auf Minimum gefahren (Not-Aus). - Auch der Autostart wird damit unterbrochen und muss mit grün neu gestartet werden! - -Diese Änderungen müssen sich in der Praxis noch bewähren, z.B.: -- wird durch Nachtropfen der Autostart unterbrochen? -- soll ein halbvolles Glas über die Automatik (ohne Autostart) weiter befüllt werden? diff --git a/hani-mandl.bin b/hani-mandl.bin deleted file mode 100644 index bf27440..0000000 Binary files a/hani-mandl.bin and /dev/null differ diff --git a/hani-mandl.ino b/hani-mandl.ino deleted file mode 100644 index 1710e5c..0000000 --- a/hani-mandl.ino +++ /dev/null @@ -1,2374 +0,0 @@ -/* - HaniMandl Version 0.2.13 - ------------------------ - Copyright (C) 2018-2023 by Marc Vasterling, Marc Wetzel, Clemens Gruber, Marc Junker, Andreas Holzhammer, Johannes Kuder, Jeremias Bruker - - 2018-05 Marc Vasterling | initiale Version, - veröffentlicht in der Facebook-Gruppe "Imkerei und Technik. Eigenbau", - Marc Vasterling: "meinen Code kann jeder frei verwenden, ändern und hochladen wo er will, solange er nicht seinen eigenen Namen drüber setzt." - 2018-06 Marc Vasterling | verbesserte Version, - ebenfalls veröffentlicht in der Facebook-Gruppe - 2019-01 Marc Wetzel | Refakturierung und Dokumentation, - ebenfalls veröffentlicht in der Facebook-Gruppe - 2019-02 Clemens Gruber | code beautifying mit kleineren Umbenennungen bei Funktionen und Variablen - Anpassung für Heltec WiFi Kit 32 (ESP32 onboard OLED) - - pins bei OLED-Initialisierung geändert - - pins geändert, um Konflikte mit hard wired pins des OLEDs zu vermeiden - 2019-02 Clemens Gruber | Aktivierung der internen pull downs für alle digitalen Eingaenge - 2019-02 Clemens Gruber | "normale" pins zu Vcc / GND geaendert um die Verkabelung etwas einfacher und angenehmer zu machen - 2020-05 Andreas Holzhammer | Anpassungen an das veränderte ;-( pin-Layout der Version 2 des Heltec - wird verkauft als "New Wifi Kit 32" oder "Wifi Kit 32 V2" - 2020-05 Marc Junker | - Erweiterung von Poti auf Rotary Encoder - - alle Serial.prints in #ifdef eingeschlossen - - "Glas" nun als Array mit individuellem Tara - - Korrekturwert und Auswahl der Füllmenge über Drücken & Drehen des Rotary einstellbar - 2020-05 Andreas Holzhammer | - Tara pro abzufüllendem Glas automatisch anpassen (Variable tara_glas) - - Code läuft auch ohne Waage - 2020-06 Andreas Holzhammer | - Code wahlweise mit Heltec V1 oder V2 nutzbar - - Code wahlweise mit Poti oder Rotary nutzbar - - Tara pro Glas einstellbar - - Öffnungswinkel für Maximale Öffnung und Feindosierung im Setup konfigurierbar - - Korrektur und Glasgröße im Automatikmodus per Rotary Encoder Button wählbar - - Preferences löschbar über Setup - - Gewicht blinkt bei Vollautomatik, wenn nicht vollständig gefüllt - - Nicht kalibrierte Waage anzeigen, fehlende Waage anzeigen - - Tara wird nur bei >20g gesetzt, verhindert den Autostart bei leerer Waage - - Tarieren der Waage bei jedem Start bis +-20g. Sonst Warnung - 2020-07 Andreas Holzhammer | Version 0.2.4 - - SCALE_READS auf 2 setzen? ca. 100ms schneller als 3, schwankt aber um +-1g - - Reihenfolge der Boot-Meldungen optimiert, damit nur relevante Warnungen ausgegeben werden - - Autokorrektur implementiert - - LOGO! und Umlaute (Anregung von Johannes Kuder) - - Stop-Taste verlässt Setup-Untermenüs (Anregung von Johannes Kuder) - - Preferences nur bei Änderung speichern - 2020-07 Andreas Holzhammer | Version 0.2.5 - - Anzeige der vorherigen Werte im Setup - - Kulanzwert für Autokorrektur einstellbar - - Setup aufgeräumt, minimaler Servowinkel einstellbar - 2020-07 Andreas Holzhammer | Version 0.2.6 - - Kalibrierung der Waage verbessert; Messewerte runden; Waage "aufheizen" vor Bootscreen - - Aktiver Piezo-Buzzer (Idee von Johannes Kuder) - 2020-07 Johannes Kuder | Version 0.2.7 - - Zählwerk für abgefüllte Gläser und Gewicht (nur im Automatikbetrieb) - 2020-07 Jeremias Bruker | Version 0.2.8 - - "GlasTyp" in allen Menüs und Automatikmodus integriert - - 5 Gläser können vom User im Menüpunkt "Fuellmenge" in Gewicht und GlasTyp konfiguriert werden - und werden nichtflüchtig gespeichert. So kann sich jeder User seine eigenen üblichen 5 Gläser anlegen - - Stabilisierung des Waagenwerts nach Wunsch (define FEHLERKORREKTUR_WAAGE) - - das Kalibriergewicht kann beim Kalibrierungsvorgang vom User verändert - werden (nicht jeder hat 500g als Eichgewicht) und wird nichtflüchtig gespeichert - - rotierendes Hauptmenü - - Umkehrbarer Servo für linksseitige Quetschhähne :-) - 2020-10 Andreas Holzhammer | Version 0.2.8.1 - - Bugfix: Servo konnte im Manuellen Modus unter Minimum bewegt werden - - Glastoleranz über Variable steuerbar auf +-20g angepasst - 2020-12 Andreas Holzhammer | Version 0.2.9.1 - - Fortschrittsanzeige eingebaut - - angepasst an ESP32Servo aus dem Bibliotheksverwalter - 2021-01 Andreas Motl | Version 0.2.9.1 - - PlatformIO-Support an neue Servo-Bibliothek angepasst - 2021-02 Andreas Holzhammer | Version 0.2.10 - - Korrektur zwischen -90 und +20 anpassbar - - Autokorrektur auch ohne Autostart - - Preferences Flash-schonender implementiert - 2021-07 Andreas Holzhammer | Version 0.2.11 - - Credits-Seite - - Fix für Rotary mit Schrittweite > 1 - 2021-11 Andreas Holzhammer | Version 0.2.12 - - Glastoleranz einstellbar - - Komfortverstellung für Füllmengen (1g/5g/25g Schritte) - 2023-01 Clemens Gruber | Version 0.2.13 - - pin-Anpassungen für Hardware-Version V3 des Heltec "WiFi Kit 32 V3" mit wieder mal geändertem pin-Layout - - default HARDWARE_LEVEL ist nun 3 / Heltec V3 - - Anpassungen für den ESP32 Arduino core Version ≥ 2.x - - Display, U8g2: HW statt SW im constructor (ggf. Probleme mit älteren Heltec-Versionen) - - Rotary: de-bouncing code im isr2 auskommentiert, da sie zu Abstürzen führte - - - This code is in the public domain. - - Hinweise zur Hardware - --------------------- - - bei allen digitalen Eingängen sind interne pull downs aktiviert, keine externen-Widerstände nötig! -*/ - -#include -#include -#include /* aus dem Bibliotheksverwalter */ -#include /* aus dem Bibliotheksverwalter: "HX711 Arduino Library" by Bogdan Necula, Andreas Motl */ -#include /* aus dem Bibliotheksverwalter */ -#include /* aus dem BSP von expressif, wird verfügbar wenn das richtige Board ausgewählt ist */ - -// -// Hier den Code auf die verwendete Hardware einstellen -// -#define HARDWARE_LEVEL 3 // 1 = originales Layout mit Schalter auf Pin 19/22/21 - // 2 = Layout für Heltec V2 mit Schalter auf Pin 23/19/22 - // 3 = Layout für Heltec V3 mit komplett anderer Pinbelegung -#define SERVO_ERWEITERT // definieren, falls die Hardware mit dem alten Programmcode mit Poti aufgebaut wurde oder der Servo zu wenig fährt - // Sonst bleibt der Servo in Stop-Position einige Grad offen! Nach dem Update erst prüfen! -#define ROTARY_SCALE 2 // in welchen Schritten springt unser Rotary Encoder. - // Beispiele: KY-040 = 2, HW-040 = 1, für Poti-Betrieb auf 1 setzen -#define USE_ROTARY // Rotary benutzen -#define USE_ROTARY_SW // Taster des Rotary benutzen -//#define USE_POTI // Poti benutzen -> ACHTUNG, im Normalfall auch USE_ROTARY_SW deaktivieren! -//#define FEHLERKORREKTUR_WAAGE // falls Gewichtssprünge auftreten, können diese hier abgefangen werden - // Achtung, kann den Wägeprozess verlangsamen. Vorher Hardware prüfen. -//#define QUETSCHHAHN_LINKS // Servo invertieren, falls der Quetschhahn von links geöffnet wird. Mindestens ein Exemplar bekannt -// -// Ende Benutzereinstellungen! -// - -// -// Ab hier nur verstellen wenn Du genau weisst, was Du tust! -// -//#define isDebug 4 // serielle debug-Ausgabe aktivieren. Mit > 3 wird jeder Messdurchlauf ausgegeben - // mit 4 zusätzlich u.a. Durchlaufzeiten - // mit 5 zusätzlich rotary debug-Infos - // ACHTUNG: zu viel Serieller Output kann einen ISR-Watchdog Reset auslösen! -//#define POTISCALE // Poti simuliert eine Wägezelle, nur für Testbetrieb! -#define MAXIMALGEWICHT 1000 // Maximales Gewicht - -// Ansteuerung der Waage -#define SCALE_READS 2 // Parameter für hx711 Library. Messwert wird aus der Anzahl gemittelt -#define SCALE_GETUNITS(n) (waage_vorhanden ? round(scale.get_units(n)) : simulate_scale(n) ) - -// Ansteuerung Servo -#ifdef QUETSCHHAHN_LINKS -#define SERVO_WRITE(n) servo.write(180-n) -#else -#define SERVO_WRITE(n) servo.write(n) -#endif - -// Rotary Encoder Taster zieht Pegel auf Low, Start/Stop auf High! -#ifdef USE_ROTARY_SW -#define SELECT_SW outputSW -#define SELECT_PEGEL LOW -#else -#define SELECT_SW button_start_pin -#define SELECT_PEGEL HIGH -#endif - -// Betriebsmodi -#define MODE_SETUP 0 -#define MODE_AUTOMATIK 1 -#define MODE_HANDBETRIEB 2 - -// Buzzer Sounds -#define BUZZER_SHORT 1 -#define BUZZER_LONG 2 -#define BUZZER_SUCCESS 3 -#define BUZZER_ERROR 4 - -// ** Definition der pins -// ---------------------- - -// Heltec Version 3 -// -#if HARDWARE_LEVEL == 3 -// OLED fuer Heltec WiFi Kit 32 (ESP32 onboard OLED) -//U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16); -// für den ESP32 Arduino core Version ≥ 2.x brauchen wir HW I2C, mit SW I2C läuft der code zu langsam -U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 21, /* clock=*/ 18, /* data=*/ 17); - -// Rotary Encoder -const int outputA = 47; // Clk -const int outputB = 48; // DT -const int outputSW = 26; - -// Servo -const int servo_pin = 33; - -// 3x Schalter Ein 1 - Aus - Ein 2 -const int switch_betrieb_pin = 40; -const int switch_vcc_pin = 41; // <- Vcc -const int switch_setup_pin = 42; -const int vext_ctrl_pin = 36; // Vext control pin - -// Taster -const int button_start_vcc_pin = 7; // <- Vcc -const int button_start_pin = 6; -const int button_stop_vcc_pin = 5; // <- Vcc -const int button_stop_pin = 4; - -// Poti -//const int poti_pin = 39; - -// Wägezelle-IC -const int hx711_sck_pin = 38; -const int hx711_dt_pin = 39; - -// Buzzer - aktiver Piezo -static int buzzer_pin = 2; - - -#elif HARDWARE_LEVEL == 2 -// -// Heltec Version 2 - -// OLED fuer Heltec WiFi Kit 32 (ESP32 onboard OLED) -//U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16); -// für den ESP32 Arduino core Version ≥ 2.x brauchen wir HW I2C, mit SW I2C läuft der code zu langsam -U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 16, /* clock=*/ 15, /* data=*/ 4); - -// Rotary Encoder -const int outputA = 33; -const int outputB = 26; -const int outputSW = 32; - -// Servo -const int servo_pin = 2; - -// 3x Schalter Ein 1 - Aus - Ein 2 -const int switch_betrieb_pin = 23; -const int switch_vcc_pin = 19; // <- Vcc -const int switch_setup_pin = 22; -const int vext_ctrl_pin = 21; // Vext control pin - -// Taster -const int button_start_vcc_pin = 13; // <- Vcc -const int button_start_pin = 12; -const int button_stop_vcc_pin = 14; // <- Vcc -const int button_stop_pin = 27; - -// Poti -const int poti_pin = 39; - -// Wägezelle-IC -const int hx711_sck_pin = 17; -const int hx711_dt_pin = 5; - -// Buzzer - aktiver Piezo -static int buzzer_pin = 25; - - -#elif HARDWARE_LEVEL == 1 -// -// Heltec Version 1 - -// OLED fuer Heltec WiFi Kit 32 (ESP32 onboard OLED) -U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16); -//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 16, /* clock=*/ 15, /* data=*/ 4); // HW I2C crashed den Code - -// Rotary Encoder -const int outputA = 33; -const int outputB = 26; -const int outputSW = 32; - -// Servo -const int servo_pin = 2; - -// 3x Schalter Ein 1 - Aus - Ein 2 -const int switch_betrieb_pin = 19; -const int switch_vcc_pin = 22; // <- Vcc -const int switch_setup_pin = 21; - -// Taster -const int button_start_vcc_pin = 13; // <- Vcc -const int button_start_pin = 12; -const int button_stop_vcc_pin = 14; // <- Vcc -const int button_stop_pin = 27; - -// Poti -const int poti_pin = 39; - -// Wägezelle-IC -const int hx711_sck_pin = 17; -const int hx711_dt_pin = 5; - -// Buzzer - aktiver Piezo -static int buzzer_pin = 25; -#else -#error Hardware Level nicht definiert! Korrektes #define setzen! -#endif - - -Servo servo; -HX711 scale; -Preferences preferences; - -// Datenstrukturen für Rotary Encoder -struct rotary { - int Value; - int Minimum; - int Maximum; - int Step; -}; -#define SW_WINKEL 0 -#define SW_KORREKTUR 1 -#define SW_MENU 2 -struct rotary rotaries[3]; // Werden in setup() initialisiert -int rotary_select = SW_WINKEL; -static boolean rotating = false; // debounce management für Rotary Encoder - -// Füllmengen für 5 verschiedene Gläser -struct glas { - int Gewicht; - int GlasTyp; //JB - int Tara; - int TripCount; //Kud - int Count; //Kud -}; -const char *GlasTypArray[3] = { "DIB", "TOF", "DEE"};//DIB = DeutscherImkerBund-Glas DEE= DeepTwist-Glas TOF= TwistOff-Glas //JB -struct glas glaeser[5] = { - { 125, 0, -9999, 0, 0 }, - { 250, 1, -9999, 0, 0 }, - { 250, 2, -9999, 0, 0 }, - { 500, 1, -9999, 0, 0 }, - { 500, 0, -9999, 0, 0 } - }; - -// Allgemeine Variablen -int i; // allgemeine Zählvariable -int pos; // aktuelle Position des Poti bzw. Rotary -int gewicht; // aktuelles Gewicht -int tara; // Tara für das ausgewählte Glas, für Automatikmodus -int tara_glas; // Tara für das aktuelle Glas, falls Glasgewicht abweicht -long gewicht_leer; // Gewicht der leeren Waage -float faktor; // Skalierungsfaktor für Werte der Waage -int fmenge; // ausgewählte Füllmenge -int fmenge_index; // Index in gläser[] -int korrektur; // Korrekturwert für Abfüllmenge -int autostart; // Vollautomatik ein/aus -int autokorrektur; // Autokorrektur ein/aus -int kulanz_gr; // gewollte Überfüllung im Autokorrekturmodus in Gramm -int winkel; // aktueller Servo-Winkel -int winkel_hard_min = 0; // Hard-Limit für Servo -int winkel_hard_max = 180; // Hard-Limit für Servo -int winkel_min = 0; // konfigurierbar im Setup -int winkel_max = 85; // konfigurierbar im Setup -int winkel_fein = 35; // konfigurierbar im Setup -float fein_dosier_gewicht = 60; // float wegen Berechnung des Schliesswinkels -int servo_aktiv = 0; // Servo aktivieren ja/nein -int kali_gewicht = 500; // frei wählbares Gewicht zum kalibrieren -char ausgabe[30]; // Fontsize 12 = 13 Zeichen maximal in einer Zeile -int modus = -1; // Bei Modus-Wechsel den Servo auf Minimum fahren -int auto_aktiv = 0; // Für Automatikmodus - System ein/aus? -int waage_vorhanden = 0; // HX711 nicht ansprechen, wenn keine Waage angeschlossen ist, sonst Crash -long preferences_chksum; // Checksumme, damit wir nicht sinnlos Prefs schreiben -int buzzermode = 0; // 0 = aus, 1 = ein. TODO: Tastentöne als buzzermode 2? -bool gezaehlt = true; // Kud Zähl-Flag -bool setup_modern = 1; // Setup als rotierendes Menu -int glastoleranz = 20; // Gewicht für autostart darf um +-20g schwanken, insgesamt also 40g! - -// Simuliert die Dauer des Wägeprozess, wenn keine Waage angeschlossen ist. Wirkt sich auf die Blinkfrequenz im Automatikmodus aus. -long simulate_scale(int n) { - long sim_gewicht = 9500; - while (n-- >= 1) { - delay(10); // empirisch ermittelt. n=2: 10, n=3: 40, n=4: 50 - } -#ifdef POTISCALE - sim_gewicht = (map(analogRead(poti_pin), 0, 4095, 0, 700)); -#endif - return sim_gewicht; -} - -#ifdef USE_ROTARY_SW -// Rotary Taster. Der Interrupt kommt nur im Automatikmodus zum Tragen und nur wenn der Servo inaktiv ist. -// Der Taster schaltet in einen von drei Modi, in denen unterschiedliche Werte gezählt werden. -void IRAM_ATTR isr1() { - static unsigned long last_interrupt_time = 0; - unsigned long interrupt_time = millis(); - - if (interrupt_time - last_interrupt_time > 300) { // If interrupts come faster than 300ms, assume it's a bounce and ignore - if ( modus == MODE_AUTOMATIK && servo_aktiv == 0 ) { // nur im Automatik-Modus interessiert uns der Click - rotary_select = (rotary_select + 1) % 3; -#ifdef isDebug - Serial.print("Rotary Button changed to "); - Serial.println(rotary_select); -#endif - } - last_interrupt_time = interrupt_time; - } -} -#endif - -#ifdef USE_ROTARY -// Rotary Encoder. Zählt in eine von drei Datenstrukturen: -// SW_WINKEL = Einstellung des Servo-Winkels -// SW_KORREKTUR = Korrekturfaktor für Füllgewicht -// SW_MENU = Zähler für Menuauswahlen -void IRAM_ATTR isr2() { - static int aState; - static int aLastState = 2; // reale Werte sind 0 und 1 - -// auskommentiert, da vermutlich das delay in der isr-Funktion ein reset ab ESP32 Arduino core Version ≥ 2.x auslöst -// beobachten, ob damit das bouncing ein Problem wird, in rudimentären Tests konnte ich (cg) nichts negatives beobachten -// if ( rotating ) delay (1); // wait a little until the bouncing is done - - aState = digitalRead(outputA); // Reads the "current" state of the outputA - if (aState != aLastState) { - // If the outputB state is different to the outputA state, that means the encoder is rotating clockwise - if (digitalRead(outputB) != aState) { - rotaries[rotary_select].Value -= rotaries[rotary_select].Step; - } else { // counter-clockwise - rotaries[rotary_select].Value += rotaries[rotary_select].Step; - } - rotaries[rotary_select].Value = constrain( rotaries[rotary_select].Value, rotaries[rotary_select].Minimum, rotaries[rotary_select].Maximum ); - rotating = false; -#ifdef isDebug -#if isDebug >= 5 - Serial.print(" Rotary Value changed to "); - Serial.println(getRotariesValue(rotary_select)); -#endif -#endif - } - aLastState = aState; // Updates the previous state of the outputA with the current state -} -#endif - -// -// Skalierung des Rotaries für verschiedene Rotary Encoder oder Simulation über Poti -int getRotariesValue( int rotary_mode ) { -#ifdef USE_ROTARY - return ( (rotaries[rotary_mode].Value - (rotaries[rotary_mode].Value % (rotaries[rotary_mode].Step*ROTARY_SCALE) )) / ROTARY_SCALE ); -#elif defined USE_POTI - int poti_min = (rotaries[rotary_mode].Minimum / ROTARY_SCALE); - int poti_max = (rotaries[rotary_mode].Maximum / ROTARY_SCALE); - if( rotaries[rotary_mode].Step > 0 ) { - return (map(analogRead(poti_pin), 0, 4095, poti_min, poti_max)); - } else { - return (map(analogRead(poti_pin), 0, 4095, poti_max, poti_min)); - } -#else -#error Weder Rotary noch Poti aktiviert! -#endif -} -void setRotariesValue( int rotary_mode, int rotary_value ) { - rotaries[rotary_mode].Value = rotary_value * ROTARY_SCALE; -} -void initRotaries( int rotary_mode, int rotary_value, int rotary_min, int rotary_max, int rotary_step ) { - rotaries[rotary_mode].Value = rotary_value * ROTARY_SCALE; - rotaries[rotary_mode].Minimum = rotary_min * ROTARY_SCALE; - rotaries[rotary_mode].Maximum = rotary_max * ROTARY_SCALE; - rotaries[rotary_mode].Step = rotary_step; - -#ifdef isDebug - Serial.print("initRotaries..."); - Serial.print(" Rotary Mode: "); Serial.print(rotary_mode); - Serial.print(" rotary_value: "); Serial.print(rotary_value); - Serial.print(" Value: "); Serial.print(rotaries[rotary_mode].Value); - Serial.print(" Min: "); Serial.print(rotaries[rotary_mode].Minimum); - Serial.print(" Max: "); Serial.print(rotaries[rotary_mode].Maximum); - Serial.print(" Step: "); Serial.print(rotaries[rotary_mode].Step); - Serial.print(" Scale: "); Serial.println(ROTARY_SCALE); -#endif -} -// Ende Funktionen für den Rotary Encoder -// - - -void getPreferences(void) { - preferences.begin("EEPROM", false); // Parameter aus dem EEPROM lesen - - faktor = preferences.getFloat("faktor", 0.0); // falls das nicht gesetzt ist -> Waage ist nicht kalibriert - pos = preferences.getUInt("pos", 0); - gewicht_leer = preferences.getUInt("gewicht_leer", 0); - korrektur = preferences.getUInt("korrektur", 0); - autostart = preferences.getUInt("autostart", 0); - autokorrektur = preferences.getUInt("autokorrektur", 0); - kulanz_gr = preferences.getUInt("kulanz_gr", 5); - fmenge_index = preferences.getUInt("fmenge_index", 3); - winkel_min = preferences.getUInt("winkel_min", winkel_min); - winkel_max = preferences.getUInt("winkel_max", winkel_max); - winkel_fein = preferences.getUInt("winkel_fein", winkel_fein); - buzzermode = preferences.getUInt("buzzermode", buzzermode); - kali_gewicht = preferences.getUInt("kali_gewicht", kali_gewicht); //JB - setup_modern = preferences.getUInt("setup_modern", setup_modern); - glastoleranz = preferences.getUInt("glastoleranz", glastoleranz); - - preferences_chksum = faktor + pos + gewicht_leer + korrektur + autostart + autokorrektur + fmenge_index + winkel_min + winkel_max + winkel_fein + kulanz_gr + buzzermode + kali_gewicht + setup_modern + glastoleranz; - - i = 0; - int ResetGewichte[] = {125,250,250,500,500,}; - int ResetGlasTyp[] = {0,1,2,1,0,}; - while( i < 5) { - sprintf(ausgabe, "Gewicht%d", i); //JB - glaeser[i].Gewicht = preferences.getInt(ausgabe, ResetGewichte[i]); //JB - preferences_chksum += glaeser[i].Gewicht; //JB - - sprintf(ausgabe, "GlasTyp%d", i); //JB - glaeser[i].GlasTyp = preferences.getInt(ausgabe, ResetGlasTyp[i]); //JB - preferences_chksum += glaeser[i].GlasTyp; //JB - - sprintf(ausgabe, "Tara%d", i); - glaeser[i].Tara= preferences.getInt(ausgabe, -9999); - preferences_chksum += glaeser[i].Tara; - - sprintf(ausgabe, "TripCount%d", i); //Kud - glaeser[i].TripCount = preferences.getInt(ausgabe, 0);//Kud - preferences_chksum += glaeser[i].TripCount; - - sprintf(ausgabe, "Count%d", i); //Kud - glaeser[i].Count = preferences.getInt(ausgabe, 0);//Kud - preferences_chksum += glaeser[i].Count; - i++; - } - - preferences.end(); - -#ifdef isDebug - Serial.println("get Preferences:"); - Serial.print("pos = "); Serial.println(pos); - Serial.print("faktor = "); Serial.println(faktor); - Serial.print("gewicht_leer = "); Serial.println(gewicht_leer); - Serial.print("korrektur = "); Serial.println(korrektur); - Serial.print("autostart = "); Serial.println(autostart); - Serial.print("autokorrektur = ");Serial.println(autokorrektur); - Serial.print("kulanz_gr = "); Serial.println(kulanz_gr); - Serial.print("fmenge_index = "); Serial.println(fmenge_index); - Serial.print("winkel_min = "); Serial.println(winkel_min); - Serial.print("winkel_max = "); Serial.println(winkel_max); - Serial.print("winkel_fein = "); Serial.println(winkel_fein); - Serial.print("buzzermode = "); Serial.println(buzzermode); - Serial.print("kali_gewicht = "); Serial.println(kali_gewicht);//JB - Serial.print("setup_modern = "); Serial.println(setup_modern); - Serial.print("glastoleranz = "); Serial.println(glastoleranz); - - i = 0; - while( i < 5 ) { - sprintf(ausgabe, "Gewicht%d = ", i); - Serial.print(ausgabe); - Serial.println(glaeser[i].Gewicht); - - sprintf(ausgabe, "GlasTyp%d = ", i); - Serial.print(ausgabe); - Serial.println(GlasTypArray[glaeser[i].GlasTyp]); - - sprintf(ausgabe, "Tara%d = ", i); - Serial.print(ausgabe); - Serial.println(glaeser[i].Tara); - - i++; - } - Serial.print("Checksumme:"); - Serial.println(preferences_chksum); -#endif -} - -void setPreferences(void) { - long preferences_newchksum; - int winkel = getRotariesValue(SW_WINKEL); - int i; - - preferences.begin("EEPROM", false); - - // Winkel-Einstellung separat behandeln, ändert sich häufig - if ( winkel != preferences.getUInt("pos", 0) ) { - preferences.putUInt("pos", winkel); -#ifdef isDebug - Serial.print("winkel gespeichert: "); - Serial.println(winkel); -#endif - } - - // Counter separat behandeln, ändert sich häufig - for ( i=0 ; i < 5; i++ ) { - sprintf(ausgabe, "TripCount%d", i); - if ( glaeser[i].TripCount != preferences.getInt(ausgabe, 0) ) - preferences.putInt(ausgabe, glaeser[i].TripCount); - sprintf(ausgabe, "Count%d", i); - if ( glaeser[i].Count != preferences.getInt(ausgabe, 0) ) - preferences.putInt(ausgabe, glaeser[i].Count); -#ifdef isDebug - Serial.print("Counter gespeichert: Index "); - Serial.print(i); - Serial.print(" Trip "); - Serial.print(glaeser[fmenge_index].TripCount); - Serial.print(" Gesamt "); - Serial.println(glaeser[fmenge_index].Count); -#endif - } - - // Den Rest machen wir gesammelt, das ist eher statisch - preferences_newchksum = faktor + gewicht_leer + korrektur + autostart + autokorrektur + - fmenge_index + winkel_min + winkel_max + winkel_fein + kulanz_gr + - buzzermode + kali_gewicht + setup_modern + glastoleranz; - i = 0; - while( i < 5 ) { - preferences_newchksum += glaeser[i].Gewicht;//JB - preferences_newchksum += glaeser[i].GlasTyp;//JB - preferences_newchksum += glaeser[i].Tara; -// preferences_newchksum += glaeser[i].TripCount;//Kud -// preferences_newchksum += glaeser[i].Count;//Kud - i++; - } - - if( preferences_newchksum == preferences_chksum ) { -#ifdef isDebug -// Serial.println("Preferences unverändert"); -#endif - return; - } - preferences_chksum = preferences_newchksum; - -// preferences.begin("EEPROM", false); - preferences.putFloat("faktor", faktor); - preferences.putUInt("gewicht_leer", gewicht_leer); -// preferences.putUInt("pos", winkel); - preferences.putUInt("korrektur", korrektur); - preferences.putUInt("autostart", autostart); - preferences.putUInt("autokorrektur", autokorrektur); - preferences.putUInt("kulanz_gr", kulanz_gr); - preferences.putUInt("winkel_min", winkel_min); - preferences.putUInt("winkel_max", winkel_max); - preferences.putUInt("winkel_fein", winkel_fein); - preferences.putUInt("fmenge_index", fmenge_index); - preferences.putUInt("buzzermode", buzzermode); - preferences.putUInt("kali_gewicht", kali_gewicht);//JB - preferences.putUInt("setup_modern", setup_modern); - preferences.putUInt("glastoleranz", glastoleranz); - - i = 0; - while( i < 5 ) { - sprintf(ausgabe, "Gewicht%d", i); - preferences.putInt(ausgabe, glaeser[i].Gewicht); - sprintf(ausgabe, "GlasTyp%d", i); - preferences.putInt(ausgabe, glaeser[i].GlasTyp); - sprintf(ausgabe, "Tara%d", i); - preferences.putInt(ausgabe, glaeser[i].Tara); -// sprintf(ausgabe, "TripCount%d", i); -// preferences.putInt(ausgabe, glaeser[i].TripCount);//Kud -// sprintf(ausgabe, "Count%d", i); -// preferences.putInt(ausgabe, glaeser[i].Count);//Kud - i++; - } - preferences.end(); - -#ifdef isDebug - Serial.println("Set Preferences:"); - Serial.print("pos = "); Serial.println(winkel); - Serial.print("faktor = "); Serial.println(faktor); - Serial.print("gewicht_leer = "); Serial.println(gewicht_leer); - Serial.print("korrektur = "); Serial.println(korrektur); - Serial.print("autostart = "); Serial.println(autostart); - Serial.print("autokorrektur = ");Serial.println(autokorrektur); - Serial.print("kulanz_gr = "); Serial.println(kulanz_gr); - Serial.print("fmenge_index = "); Serial.println(fmenge_index); - Serial.print("winkel_min = "); Serial.println(winkel_min); - Serial.print("winkel_max = "); Serial.println(winkel_max); - Serial.print("winkel_fein = "); Serial.println(winkel_fein); - Serial.print("buzzermode = "); Serial.println(buzzermode); - Serial.print("kali_gewicht = "); Serial.println(kali_gewicht); //JB - Serial.print("setup_modern = "); Serial.println(setup_modern); - Serial.print("glastoleranz = "); Serial.println(glastoleranz); - - i = 0; - while( i < 5 ) { - sprintf(ausgabe, "Gewicht%d = ", i); - Serial.print(ausgabe); Serial.println(glaeser[i].Gewicht); - sprintf(ausgabe, "GlasTyp%d = ", i); - Serial.print(ausgabe); Serial.println(GlasTypArray[glaeser[i].GlasTyp]); - sprintf(ausgabe, "Tara%d = ", i); - Serial.print(ausgabe); Serial.println(glaeser[i].Tara); - i++; - } -#endif -} - -void setupTripCounter(void) { //Kud - int j; - i = 1; - float TripAbfuellgewicht = 0; - - while (i > 0) { //Erster Screen: Anzahl pro Glasgröße - j = 0; - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - //verlasse Screen - i = 0; - delay(250); - } - - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - while ( j < 5 ) { - u8g2.setCursor(1, 10 + (j * 13)); - sprintf(ausgabe, "%4dg%3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - u8g2.print(ausgabe); - u8g2.setCursor(50, 10 + (j * 13)); - sprintf(ausgabe, "%5d St.", glaeser[j].TripCount); - u8g2.print(ausgabe); - j++; - } - u8g2.sendBuffer(); - delay(100); - } - - i = 1; - while (i > 0) { //Zweiter Screen: Gewicht pro Glasgröße - j = 0; - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - //verlasse Screen - i = 0; - delay(250); - } - - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - while ( j < 5 ) { - u8g2.setCursor(1, 10 + (j * 13)); - sprintf(ausgabe, "%4dg%3s", glaeser[j].Gewicht,GlasTypArray[glaeser[j].GlasTyp]); - u8g2.print(ausgabe); - u8g2.setCursor(65, 10 + (j * 13)); - // Serial.println(glaeser[j].Gewicht); - // Serial.print("\t"); - // Serial.print(glaeser[j].TripCount); - // Serial.print("\t"); - // Serial.print(glaeser[j].Gewicht * glaeser[j].TripCount / 1000.0); - // Serial.println(); - - sprintf(ausgabe, "%5.1fkg", glaeser[j].Gewicht * glaeser[j].TripCount / 1000.0); - u8g2.print(ausgabe); - j++; - } - u8g2.sendBuffer(); - delay(100); - } - - i = 1; - while (i > 0) { //Dritter Screen: Gesamtgewicht - TripAbfuellgewicht = 0; - j = 0; - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - //verlasse Screen - i = 0; - delay(250); - } - - while ( j < 5) { - TripAbfuellgewicht += glaeser[j].Gewicht * glaeser[j].TripCount / 1000.0; - j++; - } - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB14_tf); - u8g2.setCursor(5, 15); - u8g2.print("Summe Trip:"); - u8g2.setFont(u8g2_font_courB18_tf); - u8g2.setCursor(10, 50); - sprintf(ausgabe, "%5.1fkg", TripAbfuellgewicht); - u8g2.print(ausgabe); - u8g2.sendBuffer(); - delay(100); - } - - i = 1; - while (i > 0) { //Vierter Screen: Zurücksetzen - initRotaries(SW_MENU, 1, 0, 1, -1); - - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - pos = getRotariesValue(SW_MENU); - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - u8g2.setCursor(10, 12); u8g2.print("Reset"); - u8g2.setCursor(10, 28); u8g2.print("Abbrechen"); - - u8g2.setCursor(0, 12 + ((pos) * 16)); - u8g2.print("*"); - u8g2.sendBuffer(); - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - u8g2.setCursor(105, 12 + ((pos) * 16)); - u8g2.print("OK"); - u8g2.sendBuffer(); - if ( pos == 0) { - j = 0; - while ( j < 5 ) { - glaeser[j].TripCount = 0; - j++; - } - setPreferences(); - } - delay(1000); - i = 0; - } - } - } -} - -void setupCounter(void) { //Kud - int j; - i = 1; - float Abfuellgewicht = 0; - - while (i > 0) { //Erster Screen: Anzahl pro Glasgröße - j = 0; - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - //verlasse Screen - i = 0; - delay(250); - } - - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - while ( j < 5 ) { - u8g2.setCursor(1, 10 + (j * 13)); - sprintf(ausgabe, "%4dg%3s", glaeser[j].Gewicht,GlasTypArray[glaeser[j].GlasTyp]); - u8g2.print(ausgabe); - u8g2.setCursor(50, 10 + (j * 13)); - sprintf(ausgabe, "%5d St.", glaeser[j].Count); - u8g2.print(ausgabe); - j++; - } - u8g2.sendBuffer(); - delay(100); - } - - i = 1; - while (i > 0) { //Zweiter Screen: Gewicht pro Glasgröße - j = 0; - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - //verlasse Screen - i = 0; - delay(250); - } - - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - while ( j < 5) { - u8g2.setCursor(1, 10 + (j * 13)); - sprintf(ausgabe, "%4dg%3s", glaeser[j].Gewicht,GlasTypArray[glaeser[j].GlasTyp]); - u8g2.print(ausgabe); - u8g2.setCursor(65, 10 + (j * 13)); - // Serial.println(glaeser[j].Gewicht); - // Serial.print("\t"); - // Serial.print(glaeser[j].Count); - // Serial.print("\t"); - // Serial.print(glaeser[j].Gewicht * glaeser[j].Count / 1000.0); - // Serial.println(); - - sprintf(ausgabe, "%5.1fkg", glaeser[j].Gewicht * glaeser[j].Count / 1000.0); - u8g2.print(ausgabe); - j++; - } - u8g2.sendBuffer(); - delay(100); - } - - i = 1; - while (i > 0) { //Dritter Screen: Gesamtgewicht - Abfuellgewicht = 0; - j = 0; - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - //verlasse Screen - i = 0; - delay(250); - } - - while ( j < 5 ) { - Abfuellgewicht += glaeser[j].Gewicht * glaeser[j].Count / 1000.0; - j++; - } - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB14_tf); - u8g2.setCursor(1, 15); - u8g2.print("Summe:"); - u8g2.setFont(u8g2_font_courB18_tf); - u8g2.setCursor(10, 50); - sprintf(ausgabe, "%5.1fkg", Abfuellgewicht); - u8g2.print(ausgabe); - u8g2.sendBuffer(); - delay(100); - } - - i = 1; - while (i > 0) { //Vierter Screen: Zurücksetzen - initRotaries(SW_MENU, 1, 0, 1, -1); - - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - pos = getRotariesValue(SW_MENU); - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - u8g2.setCursor(10, 12); u8g2.print("Reset"); - u8g2.setCursor(10, 28); u8g2.print("Abbrechen"); - - u8g2.setCursor(0, 12 + ((pos) * 16)); - u8g2.print("*"); - u8g2.sendBuffer(); - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - u8g2.setCursor(105, 12 + ((pos) * 16)); - u8g2.print("OK"); - u8g2.sendBuffer(); - if ( pos == 0) { - j = 0; - while ( j < 5 ) { - glaeser[j].Count = 0; - glaeser[j].TripCount = 0; - j++; - } - setPreferences(); - - } - delay(1000); - i = 0; - } - } - } -} - - -void setupTara(void) { - int j; - tara = 0; - - initRotaries( SW_MENU, fmenge_index, 0, 4, -1 ); // Set Encoder to Menu Mode, four Selections, inverted count - - i = 0; - while ( i == 0 ) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ( digitalRead(SELECT_SW) == SELECT_PEGEL ) { - tara = (int(SCALE_GETUNITS(10))); - if ( tara > 20 ) { // Gläser müssen mindestens 20g haben - glaeser[getRotariesValue(SW_MENU)].Tara = tara; - } - i++; - } - - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - - j = 0; - while( j < 5 ) { - u8g2.setCursor(3, 10+(j*13)); - if ( glaeser[j].Gewicht < 1000 ) { - sprintf(ausgabe, " %3d-%3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - } else { - sprintf(ausgabe, " %3s-%3s", "1kg", GlasTypArray[glaeser[j].GlasTyp]); - } - u8g2.print(ausgabe); - u8g2.setCursor(75, 10+(j*13)); - if ( glaeser[j].Tara > 0 ) { - sprintf(ausgabe, " %4dg", glaeser[j].Tara); - u8g2.print(ausgabe); - } else { - u8g2.print(" fehlt"); - } - j++; - } - u8g2.setCursor(0, 10+(getRotariesValue(SW_MENU)*13) ); - u8g2.print("*"); - u8g2.sendBuffer(); - } - delay(2000); -} - - -void setupCalibration(void) { - float gewicht_raw; - - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB12_tf); - u8g2.setCursor(0, 12); u8g2.print("Bitte Waage"); - u8g2.setCursor(0, 28); u8g2.print("leeren"); - u8g2.setCursor(0, 44); u8g2.print("und mit OK"); - u8g2.setCursor(0, 60); u8g2.print("bestätigen"); - u8g2.sendBuffer(); - - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - scale.set_scale(); - scale.tare(10); - delay(500); - i = 0; - } - } - - u8g2.setFont(u8g2_font_courB12_tf); - initRotaries( SW_MENU, kali_gewicht, 100, 9999, 1 ); - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - kali_gewicht = getRotariesValue(SW_MENU); - - int blinktime = (millis()/10) % 5; - u8g2.clearBuffer(); - u8g2.setCursor(0, 12);u8g2.print("Bitte "); - - if (blinktime < 3) { - sprintf(ausgabe, "%dg", kali_gewicht); - } else { - sprintf(ausgabe, " "); - } - u8g2.print(ausgabe); - u8g2.setCursor(0, 28); u8g2.print("aufstellen"); - u8g2.setCursor(0, 44); u8g2.print("und mit OK"); - u8g2.setCursor(0, 60); u8g2.print("bestätigen"); - u8g2.sendBuffer(); - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - u8g2.clearBuffer(); - u8g2.setCursor(0, 12);u8g2.print("Bitte "); - sprintf(ausgabe, "%dg", kali_gewicht); - u8g2.print(ausgabe); - u8g2.setCursor(0, 28); u8g2.print("aufstellen"); - u8g2.setCursor(0, 44); u8g2.print("und mit OK"); - u8g2.setCursor(0, 60); u8g2.print("bestätigen"); - u8g2.sendBuffer(); - gewicht_raw = scale.get_units(10); - faktor = gewicht_raw / kali_gewicht; - scale.set_scale(faktor); - gewicht_leer = scale.get_offset(); // Leergewicht der Waage speichern -#ifdef isDebug - Serial.print("kalibrier_gewicht = "); - Serial.println(kali_gewicht); - Serial.print("gewicht_leer = "); - Serial.println(gewicht_leer); - Serial.print("gewicht_raw = "); - Serial.println(gewicht_raw); - Serial.print(" Faktor = "); - Serial.println(faktor); -#endif - delay(1000); - i = 0; - } - } -} - -void setupKorrektur(void) { - int korrektur_alt = korrektur; - - rotary_select = SW_KORREKTUR; - - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) { - setRotariesValue(SW_KORREKTUR, korrektur_alt); - korrektur = korrektur_alt; - rotary_select = SW_MENU; - return; - } - - korrektur = getRotariesValue(SW_KORREKTUR); - u8g2.setFont(u8g2_font_courB12_tf); - u8g2.clearBuffer(); - u8g2.setCursor(10, 12); - u8g2.print("Korrektur"); - u8g2.setCursor(40, 28); - u8g2.print(korrektur); - - u8g2.setCursor(10, 48); // A.P. - u8g2.print("alter Wert"); // A.P. - u8g2.setCursor(40, 64); // A.P. - u8g2.print(korrektur_alt); // A.P. - - u8g2.sendBuffer(); - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - u8g2.setCursor(100, 28); - u8g2.print("OK"); - u8g2.sendBuffer(); - delay(1000); - i = 0; - } - } - rotary_select = SW_MENU; -} - -void setupServoWinkel(void) { - int menuitem; - int lastmin = winkel_min; - int lastfein = winkel_fein; - int lastmax = winkel_max; - int wert_alt; - bool wert_aendern = false; - bool servo_live = false; - - initRotaries(SW_MENU, 0, 0, 4, -1); - - u8g2.setFont(u8g2_font_courB10_tf); - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) { - winkel_min = lastmin; - winkel_fein = lastfein; - winkel_max = lastmax; - if ( servo_live == true ) SERVO_WRITE(winkel_min); - return; - } - - if ( wert_aendern == false ) { - menuitem = getRotariesValue(SW_MENU); - } else { - switch (menuitem) { - case 0: servo_live = getRotariesValue(SW_MENU); - break; - case 1: winkel_min = getRotariesValue(SW_MENU); - if ( servo_live == true ) SERVO_WRITE(winkel_min); - break; - case 2: winkel_fein = getRotariesValue(SW_MENU); - if ( servo_live == true ) SERVO_WRITE(winkel_fein); - break; - case 3: winkel_max = getRotariesValue(SW_MENU); - if ( servo_live == true ) SERVO_WRITE(winkel_max); - break; - } - } - - u8g2.clearBuffer(); - u8g2.setCursor(10, 23); sprintf(ausgabe,"Minimum %3d", winkel_min); u8g2.print(ausgabe); - u8g2.setCursor(10, 36); sprintf(ausgabe,"Feindos. %3d", winkel_fein); u8g2.print(ausgabe); - u8g2.setCursor(10, 49); sprintf(ausgabe,"Maximum %3d", winkel_max); u8g2.print(ausgabe); - u8g2.setCursor(10, 62); u8g2.print( "Speichern"); - - if ( wert_aendern == false ) { - u8g2.setCursor(10, 10); sprintf(ausgabe,"Livesetup %3s", (servo_live==false?"aus":"ein")); u8g2.print(ausgabe); - u8g2.setCursor( 0, 10+(menuitem*13)); u8g2.print("*"); - } else { - if ( menuitem != 0 ) { - u8g2.setCursor(10, 10); sprintf(ausgabe," vorher: %3d", wert_alt); u8g2.print(ausgabe); - } else { - u8g2.setCursor(10, 10); sprintf(ausgabe,"Livesetup %3s", (servo_live==false?"aus":"ein")); u8g2.print(ausgabe); - } - u8g2.setFont(u8g2_font_open_iconic_arrow_1x_t); - u8g2.drawGlyph(0, 10+(menuitem*13), 0x42); - u8g2.setFont(u8g2_font_courB10_tf); - } - u8g2.sendBuffer(); - - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) - && (menuitem < 4 ) - && (wert_aendern == false) ) { - - // debounce - delay(10); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) - ; - delay(10); - - switch (menuitem) { - case 0: initRotaries(SW_MENU, servo_live, 0, 1, 1); - break; - case 1: initRotaries(SW_MENU, winkel_min, winkel_hard_min, winkel_fein, 1); - wert_alt = lastmin; - break; - case 2: initRotaries(SW_MENU, winkel_fein, winkel_min, winkel_max, 1); - wert_alt = lastfein; - break; - case 3: initRotaries(SW_MENU, winkel_max, winkel_fein, winkel_hard_max, 1); - wert_alt = lastmax; - break; - } - wert_aendern = true; - } - - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) - && (menuitem < 4 ) - && (wert_aendern == true) ) { - - // debounce - delay(10); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) - ; - delay(10); - - if ( servo_live == true ) - SERVO_WRITE(winkel_min); - initRotaries(SW_MENU, menuitem, 0, 4, -1); - wert_aendern = false; - } - - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) && (menuitem == 4) ) { - u8g2.setCursor(108, 10+(menuitem*13)); - u8g2.print("OK"); - u8g2.sendBuffer(); - delay(1000); - i = 0; - } - } -} - -void setupAutomatik(void) { - int menuitem; - int lastautostart = autostart; - int lastglastoleranz = glastoleranz; - int lastautokorrektur = autokorrektur; - int lastkulanz = kulanz_gr; - bool wert_aendern = false; - - initRotaries(SW_MENU, 0, 0, 4, -1); - - u8g2.setFont(u8g2_font_courB10_tf); - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) { - autostart = lastautostart; - autokorrektur = lastautokorrektur; - kulanz_gr = lastkulanz; - glastoleranz = lastglastoleranz; - return; - } - - if ( wert_aendern == false ) { - menuitem = getRotariesValue(SW_MENU); -// if ( menuitem == 3 ) -// menuitem = 4; // Eine Zeile Abstand zu "Speichern" - } else { - switch (menuitem) { - case 0: autostart = getRotariesValue(SW_MENU); - break; - case 1: glastoleranz = getRotariesValue(SW_MENU); - break; - case 2: autokorrektur = getRotariesValue(SW_MENU); - break; - case 3: kulanz_gr = getRotariesValue(SW_MENU); - break; - } - } - - // Menu - u8g2.clearBuffer(); - u8g2.setCursor(10, 10); sprintf(ausgabe,"Autostart %3s", (autostart==0?"aus":"ein")); u8g2.print(ausgabe); - u8g2.setCursor(10, 23); sprintf(ausgabe,"Glastol. %c%2dg", 177, glastoleranz); u8g2.print(ausgabe); - u8g2.setCursor(10, 36); sprintf(ausgabe,"Autokorr. %3s", (autokorrektur==0?"aus":"ein")); u8g2.print(ausgabe); - u8g2.setCursor(10, 49); sprintf(ausgabe,"-> Kulanz %2dg", kulanz_gr); u8g2.print(ausgabe); - u8g2.setCursor(10, 62); u8g2.print( "Speichern"); - - // Positionsanzeige im Menu. "*" wenn nicht ausgewählt, Pfeil wenn ausgewählt - if ( wert_aendern == false ) { - u8g2.setCursor(0, 10+(menuitem*13)); u8g2.print("*"); - } else { - u8g2.setFont(u8g2_font_open_iconic_arrow_1x_t); - u8g2.drawGlyph(0, 10+(menuitem*13), 0x42); - u8g2.setFont(u8g2_font_courB10_tf); - } - u8g2.sendBuffer(); - - // Menupunkt zum Ändern ausgewählt - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) - && (menuitem < 4 ) - && (wert_aendern == false) ) { - - // debounce - delay(10); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) - ; - delay(10); - - switch (menuitem) { - case 0: initRotaries(SW_MENU, autostart, 0, 1, 1); - break; - case 1: initRotaries(SW_MENU, glastoleranz, 0, 99, 1); - break; - case 2: initRotaries(SW_MENU, autokorrektur, 0, 1, 1); - break; - case 3: initRotaries(SW_MENU, kulanz_gr, 0, 99, 1); - break; - } - wert_aendern = true; - } - - // Änderung im Menupunkt übernehmen - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) - && (menuitem < 4 ) - && (wert_aendern == true) ) { - - // debounce - delay(10); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) - ; - delay(10); - - initRotaries(SW_MENU, menuitem, 0, 4, -1); - wert_aendern = false; - } - - // Menu verlassen - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) && (menuitem == 4) ) { - u8g2.setCursor(108, 10+(menuitem*13)); - u8g2.print("OK"); - u8g2.sendBuffer(); - delay(1000); - i = 0; - } - } -} - -void setupFuellmenge(void) { - int j,k; - int blinktime; - initRotaries(SW_MENU, fmenge_index, 0, 4, -1); - - u8g2.setFont(u8g2_font_courB10_tf); - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - pos = getRotariesValue(SW_MENU); - u8g2.clearBuffer(); - j = 0; - while( j < 5 ) { - u8g2.setCursor(10, 10+(j*13)); - sprintf(ausgabe, "%4dg %3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - u8g2.print(ausgabe); - j++; - } - u8g2.setCursor(0, 10+(getRotariesValue(SW_MENU)*13)); - u8g2.print("*"); - u8g2.sendBuffer(); - - if ( digitalRead(SELECT_SW) == SELECT_PEGEL ) { // Füllmenge gewählt - delay(500); - -// initRotaries(SW_MENU, glaeser[pos].Gewicht, 30, 1000, 5); - initRotaries(SW_MENU, weight2step( glaeser[pos].Gewicht) , 25, weight2step(MAXIMALGEWICHT), 1); - k = 1; - while (k > 0){ - - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - blinktime = (millis()/10) % 5; -// glaeser[pos].Gewicht = getRotariesValue(SW_MENU); - glaeser[pos].Gewicht = step2weight( getRotariesValue(SW_MENU) ); - u8g2.clearBuffer(); - - j = 0; - while( j < 5 ) { - u8g2.setCursor(10, 10+(j*13)); - if (j == pos){ - if (blinktime < 3) { - sprintf(ausgabe, "%4dg %3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - } else { - sprintf(ausgabe, "%5s %3s"," ",GlasTypArray[glaeser[j].GlasTyp]); - } - } else { - sprintf(ausgabe, "%4dg %3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - } - u8g2.print(ausgabe); - j++; - } - u8g2.sendBuffer(); - - if ( digitalRead(SELECT_SW) == SELECT_PEGEL ) { // Gewicht bestätigt - delay(500); - - initRotaries(SW_MENU, glaeser[pos].GlasTyp, 0, 2, 1); - while (k > 0){ - if ((digitalRead(button_stop_pin)) == HIGH) - return; - blinktime = (millis()/10) % 5; - glaeser[pos].GlasTyp = getRotariesValue(SW_MENU); - u8g2.clearBuffer(); - - j = 0; - while( j < 5 ) { - u8g2.setCursor(10, 10+(j*13)); - if (j == pos){ - if (blinktime < 3) { - sprintf(ausgabe, "%4dg %3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - } else { - sprintf(ausgabe, "%4dg %3s",glaeser[pos].Gewicht," "); - } - } else { - sprintf(ausgabe, "%4dg %3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - } - u8g2.print(ausgabe); - j++; - } - u8g2.sendBuffer(); - - if ( digitalRead(SELECT_SW) == SELECT_PEGEL ) { //GlasTyp bestätigt - u8g2.clearBuffer(); - j = 0; - while( j < 5 ) { - u8g2.setCursor(10, 10+(j*13)); - sprintf(ausgabe, "%4dg %3s", glaeser[j].Gewicht, GlasTypArray[glaeser[j].GlasTyp]); - u8g2.print(ausgabe); - j++; - } - - u8g2.setCursor(0, 10+(13*pos)); - u8g2.print("*"); - u8g2.sendBuffer(); - delay(1000); - k = 0; //raus - } - } - } - } - fmenge = glaeser[pos].Gewicht; - tara = glaeser[pos].Tara; - fmenge_index = pos; - i = 0; - } - } -} - -void setupParameter(void) { - int menuitem; - int lastbuzzer = buzzermode; - int lastsetup = setup_modern; - bool wert_aendern = false; - - initRotaries(SW_MENU, 0, 0, 2, -1); - - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) { - buzzermode = lastbuzzer; - setup_modern = lastsetup; - return; - } - - if ( wert_aendern == false ) { - menuitem = getRotariesValue(SW_MENU); - if ( menuitem == 2 ) - menuitem = 4; // Eine Zeile Abstand zu "Speichern" - } else { - switch (menuitem) { - case 0: buzzermode = getRotariesValue(SW_MENU); - break; - case 1: setup_modern = getRotariesValue(SW_MENU); - break; - } - } - - // Menu - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - sprintf(ausgabe,"Buzzer %3s", (buzzermode==0?"aus":"ein")); - u8g2.setCursor(10, 10); u8g2.print(ausgabe); - sprintf(ausgabe,"Menu %6s", (setup_modern==0?" Liste":"Scroll")); - u8g2.setCursor(10, 23); u8g2.print(ausgabe); - u8g2.setCursor(10, 62); u8g2.print("Speichern"); - - // Positionsanzeige im Menu. "*" wenn nicht ausgewählt, Pfeil wenn ausgewählt - if ( wert_aendern == false ) { - u8g2.setCursor(0, 10+((menuitem)*13)); u8g2.print("*"); - } else { - u8g2.setCursor(0, 10+((menuitem)*13)); u8g2.print("-"); - } - u8g2.sendBuffer(); - - // Menupunkt zum Ändern ausgewählt - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) - && (menuitem < 2 ) - && (wert_aendern == false) ) { - - // debounce - delay(10); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) - ; - delay(10); - - switch (menuitem) { - case 0: initRotaries(SW_MENU, buzzermode, 0, 1, 1); - break; - case 1: initRotaries(SW_MENU, setup_modern, 0, 1, 1); - break; - } - wert_aendern = true; - } - - // Änderung im Menupunkt übernehmen - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) - && (menuitem < 2 ) - && (wert_aendern == true) ) { - - // debounce - delay(10); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) - ; - delay(10); - - initRotaries(SW_MENU, menuitem, 0, 2, -1); - wert_aendern = false; - } - - // Menu verlassen - if ( (digitalRead(SELECT_SW) == SELECT_PEGEL) && (menuitem == 4) ) { - u8g2.setCursor(108, 10+(menuitem*13)); - u8g2.print("OK"); - u8g2.sendBuffer(); - - delay(1000); - i = 0; - } - } -} - -void setupClearPrefs(void) { - initRotaries(SW_MENU, 1, 0, 1, -1); - - i = 1; - while (i > 0) { - if ((digitalRead(button_stop_pin)) == HIGH) - return; - - pos = getRotariesValue(SW_MENU); - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - u8g2.setCursor(10, 12); u8g2.print("Löschen"); - u8g2.setCursor(10, 28); u8g2.print("Zurück!"); - - u8g2.setCursor(0, 12+((pos)*16)); - u8g2.print("*"); - u8g2.sendBuffer(); - - if ((digitalRead(SELECT_SW)) == SELECT_PEGEL) { - u8g2.setCursor(105, 12+((pos)*16)); - u8g2.print("OK"); - u8g2.sendBuffer(); - if ( pos == 0) { - preferences.begin("EEPROM", false); - preferences.clear(); - preferences.end(); - // gelöschte Werte einlesen, sonst bleiben die Variablen erhalten - getPreferences(); - } - delay(1000); - i = 0; - } - } -} - -void processSetup(void) { - if ( setup_modern == 0 ) - processSetupList(); - else - processSetupScroll(); -} - -void processSetupList(void) { - if ( modus != MODE_SETUP ) { - modus = MODE_SETUP; - winkel = winkel_min; // Hahn schliessen - servo_aktiv = 0; // Servo-Betrieb aus - SERVO_WRITE(winkel); - rotary_select = SW_MENU; - initRotaries(SW_MENU, 0, 0, 9, -1); - } - - int menuitem = getRotariesValue(SW_MENU); - - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.clearBuffer(); - if( menuitem < 5 ) { - u8g2.setCursor(10, 10); u8g2.print("Tara"); - u8g2.setCursor(10, 23); u8g2.print("Kalibrieren"); - u8g2.setCursor(10, 36); u8g2.print("Korrektur"); - u8g2.setCursor(10, 49); u8g2.print("Füllmenge"); - u8g2.setCursor(10, 62); u8g2.print("Automatik"); - u8g2.setFont(u8g2_font_open_iconic_arrow_2x_t); - u8g2.drawGlyph(112, 64, 0x40); - } else { - u8g2.setCursor(10, 10); u8g2.print("Servowinkel"); - u8g2.setCursor(10, 23); u8g2.print("Parameter"); - u8g2.setCursor(10, 36); u8g2.print("Zähler");//Kud - u8g2.setCursor(10, 49); u8g2.print("Zähler Trip");//Kud - u8g2.setCursor(10, 62); u8g2.print("Clear Prefs"); - u8g2.setFont(u8g2_font_open_iconic_arrow_2x_t); - u8g2.drawGlyph(112, 16, 0x43); - } - u8g2.setFont(u8g2_font_courB10_tf); - u8g2.setCursor(0, 10 + (((menuitem)%5) * 13)); - u8g2.print("*"); - u8g2.sendBuffer(); - - if ( digitalRead(SELECT_SW) == SELECT_PEGEL ) { - // sollte verhindern, dass ein Tastendruck gleich einen Unterpunkt wählt - delay(250); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) { - } -#ifdef isDebug - Serial.print("Setup Position: "); - Serial.println(menuitem); -#endif - - int lastpos = menuitem; - if (menuitem == 0) setupTara(); // Tara - if (menuitem == 1) setupCalibration(); // Kalibrieren - if (menuitem == 2) setupKorrektur(); // Korrektur - if (menuitem == 3) setupFuellmenge(); // Füllmenge - if (menuitem == 4) setupAutomatik(); // Autostart/Autokorrektur konfigurieren - if (menuitem == 5) setupServoWinkel(); // Servostellungen Minimum, Maximum und Feindosierung - if (menuitem == 6) setupParameter(); // Sonstige Einstellungen - if (menuitem == 7) setupCounter(); // Kud Zählwerk Trip - if (menuitem == 8) setupTripCounter(); // Kud Zählwerk - setPreferences(); - - if (menuitem == 9) setupClearPrefs(); // EEPROM löschen - initRotaries(SW_MENU, lastpos, 0, 9, -1); // Menu-Parameter könnten verstellt worden sein - } -} -void processSetupScroll(void) { - if ( modus != MODE_SETUP ) { - modus = MODE_SETUP; - winkel = winkel_min; // Hahn schliessen - servo_aktiv = 0; // Servo-Betrieb aus - SERVO_WRITE(winkel); - rotary_select = SW_MENU; - initRotaries(SW_MENU, 124, 0,255, -1); - } - int MenuepunkteAnzahl = 10; - const char *menuepunkte[] = { - " Tarawerte","Kalibrieren"," Korrektur"," Füllmenge"," Automatik"," Servoeinst."," Parameter"," Zählwerk","ZählwerkTrip","Clear Prefs" - }; - int menuitem = getRotariesValue(SW_MENU); - menuitem = menuitem % MenuepunkteAnzahl; - - u8g2.clearBuffer(); - //obere Zeile - int oberpos = menuitem-1; - if (menuitem == 0) - oberpos = (MenuepunkteAnzahl-1); - - u8g2.setFont(u8g2_font_courB08_tf); - u8g2.setCursor(30,12); - u8g2.print(menuepunkte[oberpos]); - - //untere Zeile - int unterpos = menuitem+1; - if (unterpos == MenuepunkteAnzahl) - unterpos=0; - u8g2.setCursor(30,62); - u8g2.print(menuepunkte[unterpos]); - - //Mittelzeile - u8g2.drawLine(1, 20, 120, 20); - u8g2.setFont(u8g2_font_courB12_tf); - u8g2.setCursor(6, 38); - u8g2.print(menuepunkte[menuitem]); - u8g2.drawLine(1, 47, 120, 47); - - u8g2.sendBuffer(); - int lastpos = menuitem; - - if ( digitalRead(SELECT_SW) == SELECT_PEGEL ) { - // sollte verhindern, dass ein Tastendruck gleich einen Unterpunkt wählt - delay(250); - while( digitalRead(SELECT_SW) == SELECT_PEGEL ) {} -#ifdef isDebug - Serial.print("Setup Position: "); - Serial.println(menuitem); -#endif - - int lastpos = menuitem; - if (menuitem == 0) setupTara(); // Tara - if (menuitem == 1) setupCalibration(); // Kalibrieren - if (menuitem == 2) setupKorrektur(); // Korrektur - if (menuitem == 3) setupFuellmenge(); // Füllmenge - if (menuitem == 4) setupAutomatik(); // Autostart/Autokorrektur konfigurieren - if (menuitem == 5) setupServoWinkel(); // Servostellungen Minimum, Maximum und Feindosierung - if (menuitem == 6) setupParameter(); // Sonstige Einstellungen - if (menuitem == 7) setupCounter(); // Kud Zählwerk - if (menuitem == 8) setupTripCounter(); // Kud Zählwerk Trip - setPreferences(); - - if (menuitem == 9) setupClearPrefs(); // EEPROM löschen - initRotaries(SW_MENU,lastpos, 0,255, -1); // Menu-Parameter könnten verstellt worden sein - } -} - -void processAutomatik(void) -{ - int zielgewicht; // Glas + Korrektur - long blinktime; - static int autokorrektur_gr = 0; - int erzwinge_servo_aktiv = 0; - boolean voll = false; //Kud - - static int gewicht_vorher; // Gewicht des vorher gefüllten Glases - static int sammler_num = 5; // Anzahl identischer Messungen für Nachtropfen - - if ( modus != MODE_AUTOMATIK ) { - modus = MODE_AUTOMATIK; - winkel = winkel_min; // Hahn schliessen - servo_aktiv = 0; // Servo-Betrieb aus - SERVO_WRITE(winkel); - auto_aktiv = 0; // automatische Füllung starten - tara_glas = 0; - rotary_select = SW_WINKEL; // Einstellung für Winkel über Rotary - initRotaries(SW_MENU, fmenge_index, 0, 4, 1); - gewicht_vorher = glaeser[fmenge_index].Gewicht + korrektur; -// autokorrektur_gr = 0; - } - - pos = getRotariesValue(SW_WINKEL); - // nur bis winkel_fein regeln, oder über initRotaries lösen? - if ( pos < ((winkel_fein*100)/winkel_max) ) { - pos = ((winkel_fein*100)/winkel_max); - setRotariesValue(SW_WINKEL, pos); - } - -#ifdef USE_ROTARY // TODO: kann das Poti hier überhaupt etwas ändern? - korrektur = getRotariesValue(SW_KORREKTUR); - fmenge_index = getRotariesValue(SW_MENU); -#endif - fmenge = glaeser[fmenge_index].Gewicht; - tara = glaeser[fmenge_index].Tara; - if ( tara <= 0 ) - auto_aktiv = 0; - - // wir starten nur, wenn das Tara für die Füllmenge gesetzt ist! - // Ein erneuter Druck auf Start erzwingt die Aktivierung des Servo - if (((digitalRead(button_start_pin)) == HIGH) && (tara > 0)) { - // debounce - delay(10); - while( digitalRead(button_start_pin) == HIGH ) - ; - delay(10); - - if ( auto_aktiv == 1 ) { - erzwinge_servo_aktiv = 1; -#ifdef isDebug - Serial.println("erzwinge Servo aktiv"); -#endif - } - auto_aktiv = 1; // automatisches Füllen aktivieren - rotary_select = SW_WINKEL; // falls während der Parameter-Änderung auf Start gedrückt wurde - setPreferences(); // falls Parameter über den Rotary verändert wurden - } - - if ((digitalRead(button_stop_pin)) == HIGH) { - winkel = winkel_min; - servo_aktiv = 0; - auto_aktiv = 0; - tara_glas = 0; -// autokorrektur_gr = 0; - } - -// Fehlerkorrektur der Waage, falls Gewicht zu sehr schwankt -#ifdef FEHLERKORREKTUR_WAAGE - int Vergleichsgewicht = (int(SCALE_GETUNITS(SCALE_READS))) - tara; - for (byte j = 0 ; j < 3; j++) { // Anzahl der Wiederholungen, wenn Abweichung zu hoch - gewicht = (int(SCALE_GETUNITS(SCALE_READS))) - tara; - if (abs(gewicht - Vergleichsgewicht) < 50) // Abweichung für Fehlererkennung - break; - delay(100); - } -#else - gewicht = (int(SCALE_GETUNITS(SCALE_READS))) - tara; -#endif - - // Glas entfernt -> Servo schliessen - if (gewicht < -20) { - winkel = winkel_min; - servo_aktiv = 0; - tara_glas = 0; - if ( autostart != 1 ) { // Autostart nicht aktiv - auto_aktiv = 0; - } - } - - // Automatik ein, leeres Glas aufgesetzt, Servo aus -> Glas füllen - if ((auto_aktiv == 1) && (abs(gewicht) <= glastoleranz) && (servo_aktiv == 0)) { - rotary_select = SW_WINKEL; // falls während der Parameter-Änderung ein Glas aufgesetzt wird - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB24_tf); - u8g2.setCursor(15, 43); - u8g2.print("START"); - u8g2.sendBuffer(); - // kurz warten und prüfen ob das Gewicht nicht nur eine zufällige Schwankung war - delay(1500); - gewicht = (int(SCALE_GETUNITS(SCALE_READS))) - tara; - - if ( abs(gewicht) <= glastoleranz ) { - tara_glas = gewicht; -#ifdef isDebug - Serial.print("gewicht: "); Serial.print(gewicht); - Serial.print(" gewicht_vorher: "); Serial.print(gewicht_vorher); - Serial.print(" zielgewicht: "); Serial.print(fmenge + korrektur + tara_glas + autokorrektur_gr); - Serial.print(" kulanz: "); Serial.print(kulanz_gr); - Serial.print(" Autokorrektur: "); Serial.println(autokorrektur_gr); -#endif - servo_aktiv = 1; - sammler_num = 0; - voll = false; //Kud - gezaehlt = false; //Kud - buzzer(BUZZER_SHORT); - } - } - zielgewicht = fmenge + korrektur + tara_glas + autokorrektur_gr; - - // Anpassung des Autokorrektur-Werts - if ( autokorrektur == 1 ) - { - if ( (auto_aktiv == 1) // Automatik ist aktiviert - && (servo_aktiv == 0 ) && (winkel == winkel_min) // Hahn ist geschlossen - && (gewicht >= zielgewicht ) // Glas ist voll - && (sammler_num <= 5) // tropfmenge noch nicht erfasst - ) { - voll = true;//Kud - if ( (gewicht == gewicht_vorher) && (sammler_num < 5) ) { // wir wollen 5x das identische Gewicht sehen - sammler_num++; - } else if ( gewicht != gewicht_vorher ) { // sonst gewichtsänderung nachführen - gewicht_vorher = gewicht; - sammler_num = 0; - } else if ( sammler_num == 5 ) { // gewicht ist 5x identisch, autokorrektur bestimmen - autokorrektur_gr = (fmenge + kulanz_gr + tara_glas) - (gewicht - autokorrektur_gr); - if ( korrektur + autokorrektur_gr > kulanz_gr ) { // Autokorrektur darf nicht überkorrigieren, max Füllmenge plus Kulanz - autokorrektur_gr = kulanz_gr - korrektur; -#ifdef isDebug - Serial.print("Autokorrektur begrenzt auf "); - Serial.println(autokorrektur_gr); -#endif - } - buzzer(BUZZER_SUCCESS); - sammler_num++; // Korrekturwert für diesen Durchlauf erreicht - } - - if ((voll == true) && (gezaehlt == false)) { //Kud - glaeser[fmenge_index].TripCount++; - glaeser[fmenge_index].Count++; -// setPreferences(); // machen wir am Ende - gezaehlt = true; - } -#ifdef isDebug - Serial.print("Nachtropfen:"); - Serial.print(" gewicht: "); Serial.print(gewicht); - Serial.print(" gewicht_vorher: "); Serial.print(gewicht_vorher); - Serial.print(" sammler_num: "); Serial.print(sammler_num); - Serial.print(" Korrektur: "); Serial.println(autokorrektur_gr); - Serial.print(" Zähler Trip: "); Serial.print(glaeser[fmenge_index].TripCount); //Kud - Serial.print(" Zähler: "); Serial.println(glaeser[fmenge_index].Count); //Kud -#endif - } - } - - // Glas ist teilweise gefüllt. Start wird über Start-Taster erzwungen - if ((auto_aktiv == 1) && (gewicht > 5) && (erzwinge_servo_aktiv == 1) ) { - servo_aktiv = 1; - voll = false; //Kud - gezaehlt = false;//Kud - buzzer(BUZZER_SHORT); - } - - if (servo_aktiv == 1) { - winkel = ((winkel_max * pos) / 100); - } - - if ((servo_aktiv == 1) && (( zielgewicht - gewicht ) <= fein_dosier_gewicht)) { - winkel = ( ((winkel_max*pos) / 100) * ((zielgewicht-gewicht) / fein_dosier_gewicht) ); - } - - if ((servo_aktiv == 1) && (winkel <= winkel_fein)) { - winkel = winkel_fein; - } - - // Glas ist voll - if ((servo_aktiv == 1) && (gewicht >= zielgewicht)) { - winkel = winkel_min; - servo_aktiv = 0; - - if (gezaehlt == false) { //Kud - glaeser[fmenge_index].TripCount++; - glaeser[fmenge_index].Count++; -// setPreferences(); machen wir am Ende - gezaehlt = true; - } - if ( autostart != 1 ) // autostart ist nicht aktiv, kein weiterer Start - auto_aktiv = 0; - if ( autokorrektur == 1 ) // autokorrektur, gewicht merken - gewicht_vorher = gewicht; - buzzer(BUZZER_SHORT); - } - - SERVO_WRITE(winkel); - -#ifdef isDebug -#if isDebug >= 4 - Serial.print("Automatik:"); - Serial.print(" Gewicht: "); Serial.print(gewicht); - Serial.print(" Winkel: "); Serial.print(winkel); -// Serial.print(" Dauer "); Serial.print(millis() - scaletime); -// Serial.print(" Füllmenge: "); Serial.print(fmenge); -// Serial.print(" Korrektur: "); Serial.print(korrektur); -// Serial.print(" Tara_glas:"); Serial.print(tara_glas); - Serial.print(" Autokorrektur: "); Serial.print(autokorrektur_gr); - Serial.print(" Zielgewicht "); Serial.print(zielgewicht); -// Serial.print(" Erzwinge Servo: "); Serial.print(erzwinge_servo_aktiv); -// Serial.print(" servo_aktiv "); Serial.print(servo_aktiv); - Serial.print(" auto_aktiv "); Serial.println(auto_aktiv); -#endif -#endif - u8g2.clearBuffer(); - - // Gewicht blinkt, falls unter der definierten Füllmenge - // Korrekturfaktor und Füllmenge blinken, wenn sie über den Rotary verstellt werden - blinktime = (millis()/10) % 5; - - // wenn kein Tara für unser Glas definiert ist, wird kein Gewicht sondern eine Warnung ausgegeben - if ( tara > 0 ) { - // kein Glas aufgestellt - if ( gewicht < -20 ) { - u8g2.setFont(u8g2_font_courB12_tf); - u8g2.setCursor(28, 30); u8g2.print("Bitte Glas"); - u8g2.setCursor(28, 44); u8g2.print("aufstellen"); - } else { - u8g2.setCursor(10, 42); - u8g2.setFont(u8g2_font_courB24_tf); - - if( (autostart == 1) && (auto_aktiv == 1 ) && (servo_aktiv == 0) && (gewicht >= -5) && (gewicht - tara_glas < fmenge) && (blinktime < 2) ) { - sprintf(ausgabe,"%5s", " "); - } else { - sprintf(ausgabe,"%5dg", gewicht - tara_glas); - } - u8g2.print(ausgabe); - } - } else { - u8g2.setCursor(42, 38); - u8g2.setFont(u8g2_font_courB14_tf); - sprintf(ausgabe,"%6s", "no tara!"); - u8g2.print(ausgabe); - } - - // Play/Pause Icon, ob die Automatik aktiv ist - u8g2.setFont(u8g2_font_open_iconic_play_2x_t); - u8g2.drawGlyph(0, 40, (auto_aktiv==1)?0x45:0x44 ); - - u8g2.setFont(u8g2_font_courB12_tf); - // Zeile oben, Öffnungswinkel absolut und Prozent, Anzeige Autostart - u8g2.setCursor(0, 11); - sprintf(ausgabe,"W=%-3d %2s %3d%%", winkel, (autostart==1)?"AS":" ", pos); - u8g2.print(ausgabe); - - u8g2.setFont(u8g2_font_courB10_tf); - // Zeile unten, aktuell zu verstellende Werte blinken. - // Verstellung nur wenn Automatik inaktiv, gesteuert über Interrupt-Funktion - - if(servo_aktiv == 1) { - int progressbar = 128.0*((float)gewicht/(float)zielgewicht); - progressbar = constrain(progressbar,0,128); - - u8g2.drawFrame(0, 50, 128, 14 ); - u8g2.drawBox (0, 50, progressbar, 14 ); - } - else - { - if( autokorrektur == 1 ){ - u8g2.setCursor( 0, 64); - u8g2.print("a"); - u8g2.setCursor(10, 64); - } else { - u8g2.setCursor( 0, 64); - } - - if( rotary_select == SW_KORREKTUR && blinktime < 2 ) { - if (glaeser[fmenge_index].Gewicht > 999){ - sprintf(ausgabe,"k= %s %3s-%3s",(autokorrektur==1)?"":" ", "1kg", GlasTypArray[glaeser[fmenge_index].GlasTyp] ); - } else { - sprintf(ausgabe,"k= %s %3d-%3s",(autokorrektur==1)?"":" ", glaeser[fmenge_index].Gewicht, GlasTypArray[glaeser[fmenge_index].GlasTyp] ); - } - } else if ( rotary_select == SW_MENU && blinktime < 2 ) { - sprintf(ausgabe,"k=%-3d" , korrektur + autokorrektur_gr); - } else { - if (glaeser[fmenge_index].Gewicht > 999){ - sprintf(ausgabe,"k=%-3d%s %3s-%3s", korrektur + autokorrektur_gr, (autokorrektur==1)?"":" ", "1kg", GlasTypArray[glaeser[fmenge_index].GlasTyp] ); - } else { - sprintf(ausgabe,"k=%-3d%s %3d-%3s", korrektur + autokorrektur_gr, (autokorrektur==1)?"":" ", glaeser[fmenge_index].Gewicht, GlasTypArray[glaeser[fmenge_index].GlasTyp] ); - } - } - u8g2.print(ausgabe); - } - - u8g2.sendBuffer(); - - setPreferences(); -} - -void processHandbetrieb(void) -{ - static unsigned long scaletime; - static unsigned long dauer; - - if ( modus != MODE_HANDBETRIEB ) { - modus = MODE_HANDBETRIEB; - winkel = winkel_min; // Hahn schliessen - servo_aktiv = 0; // Servo-Betrieb aus - SERVO_WRITE(winkel); - rotary_select = SW_WINKEL; - tara = 0; - } - - pos = getRotariesValue(SW_WINKEL); - gewicht = SCALE_GETUNITS(SCALE_READS) - tara; - - if ((digitalRead(button_start_pin)) == HIGH) { - servo_aktiv = 1; - } - - if ((digitalRead(button_stop_pin)) == HIGH) { - servo_aktiv = 0; - } - -#ifdef USE_ROTARY_SW - if ( ((digitalRead(outputSW)) == LOW) /*&& (tara == 0) */ ) { // sonst muss der Taster entprellt werden! - tara = SCALE_GETUNITS(SCALE_READS); - } -#endif - - if (servo_aktiv == 1) { - winkel = ((winkel_max * pos) / 100); - } else { - winkel = winkel_min; - } - winkel = constrain(winkel, winkel_min, winkel_max); - SERVO_WRITE(winkel); - -#ifdef isDebug -#if isDebug >= 4 - Serial.print("Handbetrieb:"); - Serial.print(" Gewicht "); Serial.print(gewicht); - Serial.print(" Winkel "); Serial.print(winkel); - Serial.print(" Dauer "); Serial.print(millis() - scaletime); - Serial.print(" servo_aktiv "); Serial.println(servo_aktiv); -#endif -#endif - scaletime = millis(); - // Ausgabe OLED. Dauert ca. 170ms - u8g2.clearBuffer(); - - u8g2.setFont(u8g2_font_courB24_tf); - u8g2.setCursor(10, 42); - sprintf(ausgabe,"%5dg", gewicht); -// sprintf(ausgabe,"%5dg", dauer); - u8g2.print(ausgabe); - - u8g2.setFont(u8g2_font_open_iconic_play_2x_t); - u8g2.drawGlyph(0, 40, (servo_aktiv==1)?0x45:0x44 ); - - u8g2.setFont(u8g2_font_courB12_tf); - u8g2.setCursor(0, 11); - sprintf(ausgabe,"W=%-3d %3d%%", winkel, pos); - u8g2.print(ausgabe); - u8g2.setCursor(0, 64); - sprintf(ausgabe, "Manuell %s", (tara>0?"Tara":" ")); - u8g2.print(ausgabe); - - u8g2.sendBuffer(); - - setPreferences(); -// u8g2.updateDisplayArea(4,2,12,6); // schneller aber ungenaue Displayausgabe. - dauer = millis() - scaletime; -} - -void setup() -{ - // enable internal pull downs for digital inputs - pinMode(button_start_pin, INPUT_PULLDOWN); - pinMode(button_stop_pin, INPUT_PULLDOWN); - pinMode(switch_betrieb_pin, INPUT_PULLDOWN); - pinMode(switch_setup_pin, INPUT_PULLDOWN); -#if HARDWARE_LEVEL == 2 - pinMode(vext_ctrl_pin, INPUT_PULLDOWN); -#endif - - Serial.begin(115200); - while (!Serial) { - } -#ifdef isDebug - Serial.println("Hanimandl Start"); -#endif - -// Rotary -#ifdef USE_ROTARY_SW - pinMode(outputSW, INPUT_PULLUP); - attachInterrupt(outputSW, isr1, FALLING); -#endif -#ifdef USE_ROTARY - pinMode(outputA,INPUT); - pinMode(outputB,INPUT); - attachInterrupt(outputA, isr2, CHANGE); -#endif - -// switch Vcc / GND on normal pins for convenient wiring -// output is 3.3V for VCC - digitalWrite (switch_vcc_pin, HIGH); - digitalWrite (button_start_vcc_pin, HIGH); - digitalWrite (button_stop_vcc_pin, HIGH); - -// pinMode (_GND, OUTPUT); // turn on GND pin first (important!) -// turn on VCC power - pinMode (switch_vcc_pin, OUTPUT); - pinMode (button_start_vcc_pin, OUTPUT); - pinMode (button_stop_vcc_pin, OUTPUT); - -// Buzzer - pinMode(buzzer_pin, OUTPUT); - -// short delay to let chip power up - delay (100); - -// Preferences aus dem EEPROM lesen - getPreferences(); - -// Servo initialisieren und schliessen -#ifdef SERVO_ERWEITERT - servo.attach(servo_pin, 750, 2500); // erweiterte Initialisierung, steuert nicht jeden Servo an -#else - servo.attach(servo_pin, 1000, 2000); // default Werte. Achtung, steuert den Nullpunkt weniger weit aus! -#endif - SERVO_WRITE(winkel_min); - -// Waage erkennen - machen wir vor dem Boot-Screen, dann hat sie 3 Sekunden Zeit zum aufwärmen - scale.begin(hx711_dt_pin, hx711_sck_pin); - if (scale.wait_ready_timeout(1000)) { // Waage angeschlossen? - scale.power_up(); - waage_vorhanden = 1; -#ifdef isDebug - Serial.println("Waage erkannt"); -#endif - } - -// Boot Screen - u8g2.setBusClock(800000); // experimental - u8g2.begin(); - u8g2.enableUTF8Print(); - u8g2.clearBuffer(); - print_logo(); - buzzer(BUZZER_SHORT); - delay(2000); - print_credits(); - delay(4000); - -// Setup der Waage, Skalierungsfaktor setzen - if (waage_vorhanden ==1 ) { // Waage angeschlossen? - if ( faktor == 0 ) { // Vorhanden aber nicht kalibriert - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB18_tf); - u8g2.setCursor( 24, 24); u8g2.print("Nicht"); - u8g2.setCursor( 10, 56); u8g2.print("kalibr."); - u8g2.sendBuffer(); -#ifdef isDebug - Serial.println("Waage nicht kalibriert!"); -#endif - delay(2000); - } else { // Tara und Skalierung setzen - scale.set_scale(faktor); - scale.set_offset(long(gewicht_leer)); -#ifdef isDebug - Serial.println("Waage initialisiert"); -#endif - } - } else { // Keine Waage angeschlossen - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB24_tf); - u8g2.setCursor( 14, 24); u8g2.print("Keine"); - u8g2.setCursor( 6, 56); u8g2.print("Waage!"); - u8g2.sendBuffer(); - buzzer(BUZZER_ERROR); -#ifdef isDebug - Serial.println("Keine Waage!"); -#endif - delay(2000); - } - -// initiale Kalibrierung des Leergewichts wegen Temperaturschwankungen -// Falls mehr als 20g Abweichung steht vermutlich etwas auf der Waage. - if (waage_vorhanden == 1) { - gewicht = SCALE_GETUNITS(SCALE_READS); - if ( (gewicht > -20) && (gewicht < 20) ) { - scale.tare(10); - buzzer(BUZZER_SUCCESS); -#ifdef isDebug - Serial.print("Tara angepasst um: "); - Serial.println(gewicht); -#endif - } else if (faktor != 0) { - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_courB18_tf); - u8g2.setCursor( 24, 24); u8g2.print("Waage"); - u8g2.setCursor( 10, 56); u8g2.print("leeren!"); - u8g2.sendBuffer(); -#ifdef isDebug - Serial.print("Gewicht auf der Waage: "); - Serial.println(gewicht); -#endif - delay(5000); - - // Neuer Versuch, falls Gewicht entfernt wurde - gewicht = SCALE_GETUNITS(SCALE_READS); - if ( (gewicht > -20) && (gewicht < 20) ) { - scale.tare(10); - buzzer(BUZZER_SUCCESS); -#ifdef isDebug - Serial.print("Tara angepasst um: "); - Serial.println(gewicht); -#endif - } else { // Warnton ausgeben - buzzer(BUZZER_LONG); - } - } - } - -// die drei Datenstrukturen des Rotaries initialisieren - initRotaries(SW_WINKEL, 0, 0, 100, 5 ); // Winkel - initRotaries(SW_KORREKTUR, 0, -90, 20, 1 ); // Korrektur - initRotaries(SW_MENU, 0, 0, 7, 1 ); // Menuauswahlen - -// Parameter aus den Preferences für den Rotary Encoder setzen - setRotariesValue(SW_WINKEL, pos); - setRotariesValue(SW_KORREKTUR, korrektur); - setRotariesValue(SW_MENU, fmenge_index); -} - -void loop() -{ - rotating = true; // debounce Management - - // Setup Menu - if ((digitalRead(switch_setup_pin)) == HIGH) - processSetup(); - - // Automatik-Betrieb - if ((digitalRead(switch_betrieb_pin)) == HIGH) - processAutomatik(); - - // Handbetrieb - if ((digitalRead(switch_betrieb_pin) == LOW) - && (digitalRead(switch_setup_pin) == LOW)) - processHandbetrieb(); -} - -void print_credits() { - u8g2.clearBuffer(); - u8g2.setFont(u8g2_font_helvB08_tf); - u8g2.setCursor(0, 10); u8g2.print("Idee: M. Vasterling"); - u8g2.setCursor(0, 23); u8g2.print("Code: M. Vasterling, M."); - u8g2.setCursor(0, 36); u8g2.print("Wetzel, C. Gruber, A."); - u8g2.setCursor(0, 49); u8g2.print("Holzhammer, M. Junker,"); - u8g2.setCursor(0, 62); u8g2.print("J. Kuder, J. Bruker"); - u8g2.sendBuffer(); -} - -void print_logo() { - const unsigned char logo_biene1[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, - 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x60, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC1, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x70, 0x00, 0xF0, 0xFF, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x80, 0xFF, 0xFF, 0x0F, 0x00, 0xFF, 0xFF, 0x80, 0xF1, 0x47, 0xF0, 0x07, 0x00, 0x3E, 0xE0, 0xFF, 0xFF, 0x07, - 0xF9, 0x07, 0x7E, 0x00, 0x00, 0x78, 0xF0, 0x03, 0xE0, 0x1F, 0xF8, 0x07, 0x1F, 0x00, 0x00, 0x70, 0x3C, 0x00, 0x00, 0xFE, 0x38, 0xC0, 0x03, 0x00, - 0x00, 0xF0, 0x0E, 0x00, 0x00, 0xF8, 0x03, 0xF8, 0x00, 0x00, 0x00, 0xE0, 0x06, 0x00, 0x00, 0xC0, 0x0F, 0x7C, 0x00, 0x00, 0x00, 0xE0, 0x06, 0x00, - 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x00, 0xFC, 0x07, 0x00, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x03, - 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x07, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x07, 0x00, 0x00, 0x0F, - 0x0F, 0x00, 0x00, 0x78, 0x78, 0xE0, 0x3F, 0x00, 0xC0, 0x07, 0x3E, 0x00, 0x80, 0xFF, 0x3C, 0xC0, 0x7F, 0x00, 0xF0, 0x01, 0xFC, 0x00, 0xE0, 0xFF, - 0x1C, 0x80, 0xFF, 0x01, 0x7E, 0x00, 0xF0, 0xFF, 0xFF, 0x3F, 0x0E, 0x00, 0xFE, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x0F, 0x00, 0xC0, 0x1F, - 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x07, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x80, 0x03, 0x80, 0x03, 0xE0, 0x00, 0x70, 0x00, 0x00, 0x00, 0xC0, - 0x01, 0xC0, 0x03, 0xC0, 0x01, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x81, 0xC3, 0x01, 0xC0, 0x01, 0x00, 0x00, 0x70, 0x00, 0xE0, 0xF1, 0x8F, - 0x03, 0x80, 0x03, 0x00, 0x00, 0x38, 0x00, 0xF0, 0xFC, 0x9F, 0x07, 0x00, 0x07, 0x00, 0x00, 0x1C, 0x00, 0xF8, 0x1C, 0x1C, 0x0F, 0x00, 0x06, 0x00, - 0x00, 0x1C, 0x00, 0xFE, 0x00, 0x00, 0x1F, 0x00, 0x0C, 0x00, 0x00, 0x0E, 0x00, 0xF7, 0x00, 0x00, 0x7F, 0x00, 0x0C, 0x00, 0x00, 0x06, 0x80, 0x73, - 0x00, 0x00, 0xE6, 0x00, 0x0C, 0x00, 0x00, 0x07, 0xE0, 0x71, 0x00, 0x00, 0xC6, 0x03, 0x0C, 0x00, 0x00, 0x07, 0x70, 0x70, 0xF0, 0x0F, 0x86, 0x07, - 0x0C, 0x00, 0x00, 0x03, 0x3C, 0x70, 0xFC, 0x3F, 0x06, 0x1F, 0x0E, 0x00, 0x00, 0x03, 0x1E, 0x70, 0xFE, 0x3F, 0x06, 0xFC, 0x07, 0x00, 0x00, 0x87, - 0x0F, 0x70, 0x1E, 0x38, 0x06, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x03, 0xF0, 0x00, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x00, 0xFC, 0x00, 0xF0, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x80, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x0F, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x9F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3B, 0x9C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, - 0x07, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0D, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - u8g2.clearBuffer(); - u8g2.drawXBM(0,0,80,64,logo_biene1); - u8g2.setFont(u8g2_font_courB14_tf); - u8g2.setCursor(85, 27); u8g2.print("HANI"); - u8g2.setCursor(75, 43); u8g2.print("MANDL"); - u8g2.setFont(u8g2_font_courB08_tf); - u8g2.setCursor(77, 64); u8g2.print("v.0.2.13"); - u8g2.sendBuffer(); -} - -// Wir nutzen einen aktiven Summer, damit entfällt die tone Library, die sich sowieso mit dem Servo beisst. -void buzzer(byte type) { - if (buzzermode == 1) { - switch (type) { - case BUZZER_SHORT: //short - digitalWrite(buzzer_pin,HIGH); - delay(100); - digitalWrite(buzzer_pin,LOW); - break; - - case BUZZER_LONG: //long - digitalWrite(buzzer_pin,HIGH); - delay(500); - digitalWrite(buzzer_pin,LOW); - break; - - case BUZZER_SUCCESS: //success - digitalWrite(buzzer_pin,HIGH); - delay(100); - digitalWrite(buzzer_pin,LOW); - delay(100); - digitalWrite(buzzer_pin,HIGH); - delay(100); - digitalWrite(buzzer_pin,LOW); - delay(100); - digitalWrite(buzzer_pin,HIGH); - delay(100); - digitalWrite(buzzer_pin,LOW); - break; - - case BUZZER_ERROR: //error - digitalWrite(buzzer_pin,HIGH); - delay(1500); - digitalWrite(buzzer_pin,LOW); - break; - } - } -} - -// Supportfunktionen für stufenweise Gewichtsverstellung -int step2weight( int step ) { - int sum = 0; - - if ( step > 210 ) { sum += (step-210)*1000; step -= (step-210); } - if ( step > 200 ) { sum += (step-200)* 500; step -= (step-200); } - if ( step > 160 ) { sum += (step-160)* 100; step -= (step-160); } - if ( step > 140 ) { sum += (step-140)* 25; step -= (step-140); } - if ( step > 50 ) { sum += (step- 50)* 5; step -= (step- 50); } - sum += step; - - return sum; -} -int weight2step ( int sum ) { - int step = 0; - - if ( sum > 10000 ) { step += (sum-10000)/1000; sum -= ((sum-10000)); } - if ( sum > 5000 ) { step += (sum-5000)/500; sum -= ((sum-5000)); } - if ( sum > 1000 ) { step += (sum-1000)/100; sum -= ((sum-1000)); } - if ( sum > 500 ) { step += (sum-500)/25; sum -= ((sum-500)); } - if ( sum > 50 ) { step += (sum-50)/5; sum -= (sum-50); } - step += sum; - - return step; -} diff --git a/platformio.ini b/platformio.ini deleted file mode 100644 index 1cf40ab..0000000 --- a/platformio.ini +++ /dev/null @@ -1,24 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[platformio] -src_dir = . - -[env:heltec] -platform = espressif32 -board = heltec_wifi_kit_32 -framework = arduino - -monitor_speed = 115200 - -lib_deps = - HX711@^0.7.4 - U8g2@^2.28.6 - ESP32Servo@^0.9.0 diff --git a/readme.md b/readme.md deleted file mode 100644 index c7d8d09..0000000 --- a/readme.md +++ /dev/null @@ -1,222 +0,0 @@ -![image](https://github.com/ClemensGruber/hani-mandl/workflows/PlatformIO%20CI/badge.svg) -![image](https://img.shields.io/github/v/tag/ClemensGruber/hani-mandl.svg) - -# HaniMandl - -Ein halbautomatischer Honig-Abfüll-Roboter. - -Websites: -- Code, Infos zur Hardware, Fotos und Videos initial publiziert in der Facebook-Gruppe ["Imkerei und Technik. Eigenbau"](https://www.facebook.com/groups/139671009967454) -- Weitere Infos unter: [HaniMandl, halbautomatischer Honig-Abfüllbehälter](https://community.hiveeyes.org/t/side-project-hanimandl-halbautomatischer-honig-abfullbehalter/768) - ---- - -# Anleitung - -## Einstellungen im Arduino-Code - -Das Verhalten des Codes wird über mehrere `#define`-Variablen gesteuert. - -``` -#define HARDWARE_LEVEL 2 - 1 für originales pinout Layout mit Schalter auf Pin 19/22/21 - 2 für neues Layout für "New Heltec Wifi Kit 32" (V2) mit Schalter auf Pin 23/19/22 - -#define SERVO_ERWEITERT - aktivieren, falls ein Automat mit Software 0.1.4 aktualisiert wird und der Servo nicht ganz schliesst - oder der Servo generell nicht weit genug bewegt wird. - Der neue Code verwendet default-Werte für die Ansteuerung des Servos, um mehr Servos anzusprechen. Der - 0.1.4 Code hatte spezielle Werte, bei denen die 0-Stellung niedriger war. - Über dieses Define können die Werte des 0.1.4 Codes aktiviert werden. Alternative: Hardware anpassen - -#define ROTARY_SCALE 2 - Verschiedene Rotary Encoder liefern unterschiedliche Increments pro Stufe. Das kann hier angepasst werden. - Beispiele: KY-040 = 2, HW-040 = 1 - Falls kein Rotary Encoder genutzt wird, sollte das define auf 1 gesetzt werden - -#define USE_ROTARY - aktivieren, wenn ein Rotary Encoder für die Steuerung des Interface genutzt wird. - -#define USE_ROTARY_SW // Taster des Rotary benutzen - aktivieren, wenn der Rotary auch eine Tastfunktion hat. - ACHTUNG: falls ein Poti (siehe unten) genutzt wird, sollte diese Variable deaktiviert werden! - Ausnahme: es wird ein dritter Taster eingebaut. Nicht unterstützt! - -#define USE_POTI // Poti benutzen -> ACHTUNG, im Normalfall auch USE_ROTARY_SW deaktivieren! - aktivieren, wenn ein Poti statt eines Rotary für die Steuerung des Interface genutzt wird - Es wird dringend empfohlen, einen Rotary Encoder zu benutzen! - -#define FEHLERKORREKTUR_WAAGE // falls Gewichtssprünge auftreten, können diese hier abgefangen werden - Achtung, kann den Wägeprozess verlangsamen. Vorher Wägezellen/HX711 prüfen! - -#define QUETSCHHAHN_LINKS - Servo invertieren, falls der Quetschhahn von links geöffnet wird. Mindestens ein Exemplar eines solchen Eimers ist bekannt -``` -Die weiteren defines und Variablen müssen bei einer Standard-Schaltung nicht angepasst werden. - - -## Hardware-Aufbau - -Es wird empfohlen, den Servo erst nach dem ersten Einschalten der Elektronik mit dem Quetschhahn zu verbinden! -Der Servo fährt automatisch in die Nullstellung. Danach kann das Gestänge verbunden werden und über das Servo-Setup -können die Servo-Positionen fein eingestellt werden. - -## Betrieb - -Grundsätzlich: Als Drehregler wird entweder ein Poti oder ein Rotary Encoder eingesetzt. -Bei Benutzung eines Rotary Encoders mit Taster wirkt der Taster aus Auswahl-Taste. -Wird ein Poti oder Rotary Encoder ohne Taster verwendet, wird der grüne Button im Setup als Auswahl -genutzt. Die Funktion "Tara" im Handbetrieb und die direkte Verstellung des Korrekturwerts und -der Füllmenge im Automatikmodus stehen nur bei einem Rotary Encoder mit integriertem Taster zur Verfügung! - - -Setup ------ -In Schalterstellung II (oder I je nachdem wie der 3-fach-Schalter verbaut wurde) könnne verschiedene -Grundeinstellungen vorgenommen werden: - -1. Tara -Für jede Füllmenge bzw. das entsprechende Glas kann ein Leergewicht ("Tara") definiert werden. -Die hinterlegten Tara-Werte werden im Menu angezeigt. -Einstellung: Füllmenge wählen, leeres Glas aufstellen und über die Auswahl-Taste speichern - -2. Kalibieren -Menügeführte Kalibrierung der Wägezelle - -3. Korrektur -Einstellen des Korrekturwerts. Je nach Temperatur und Konsistenz des Honigs bzw. Füllmenge im -Abfüllbehälter wird durch die Trägheit des Systems der eingestellte Wert überschritten. -Der Korrekturwert dient dazu, das anzupassen bzw. ein paar Gramm mehr einzufüllen, um die Richtlinien -zu erfüllen. -Wert über Drehregler einstellen und mit Auswahl bestätigen - -4. Füllmenge -Auswahl der Abfüllmenge - -5. Automatik -Einstellen der beiden Automatiken "Autostart" und "Autokorrektur" sowie des Kulanzwerts für die Autokorrektur. -- Autostart beginnt den Füllvorgang, wenn ein passendes, leeres Glas aufgesetzt wird -- Autokorrektur ermittelt einen automatischen Korrekturwert, um die Gläser bei sinkendem Druck im Behälter - bis zur Füllmenge + Kulanz zu befüllen - -6. Servowinkel -Definition der minimalen und maximalen Öffnungswinkel des Servos sowie des Winkels für die Feindosierung. -Der minimale Öffnungswinkel sollte den Quetschhahn mit minimalem Spiel schliessen. -Der maximale Öffnungswinkel begrenzt den Hub des Servos, um den Servo an die Mechanik anzupassen. -Der Servo bleibt bis zum Erreichen des Zielgewichts (Füllmenge + Korrektur) mindestens bis zum Winkel Feindosierung -geöffnet und schliesst danach vollständig. Sollte je nach Konsistenz angepasst werden. Ein größerer Wert hier -führt zu einer schnelleren Füllung, ein kleinerer Wert zu genaueren Mengen. - -Einstellung: Im Handbetrieb den Servo langsam auf die gewünschte Öffnung fahren. Den Wert unter "W=" dann hier -einstellen. -Über den Punkt "Livesetup" können die Winkel auch direkt aus dem Setup angefahren werden. Vorsicht bei Verwendung -mit einem Poti, oder bei gefülltem Abfüllbehälter! - -7. Clear Pref's -Setzt alle Voreinstellungen (nach Bestätigung) zurück. -Danach muss die Kalibrierung der Waage wiederholt und alle Werte neu gesetzt werden! - -Handbetrieb ------------ -Im Handbetrieb wird der Öffnungswinkel des Servo direkt über den Drehregler bestimmt. Der absolute und -relative Servo-Winkel werden in der oberen Zeile angezeigt. - -Der Servo wird über die grüne Taste aktiviert und über rote Taste deaktivert. Der aktuelle Zustand wird -über das Play/Pause Symbol links angezeigt. - -Das Gewicht wird permanent angezeigt. Über den Auswahl-Taster kann das aktuelle Gewicht als Tara eingestellt -werden, d.h. die Waage springt auf Null und zählt ab dem aktuellen Gewicht. Zurückgestellt wird über einen -Tastendruck bei leerer Waage. - -Der Modus dient zum manuellen Füllen und zum ermitteln der Werte für den maximalen und minimalen Winkel -des Servos für das Setup. - -Automatik ---------- -Der Automatik-Modus hat zwei Betriebsarten, die über das Setup "Autostart" gewählt werden. Der aktive -Autostart wird in der obersten Zeile mit "AS" angezeigt. Ausserdem sind dort der absolute und relative -Öffnungswinkel zu finden. - -Die untere Zeile zeigt die Werte für die Korrektur und die Füllmenge. Eine aktive Autokorrektur ist dort -erkennbar, weil der Korrekturwert dort statt "k=" mit "ak=" angegeben wird. - -Der Automatik-Modus muss über die grüne Taste aktiviert werden. Rot stoppt die Automatik und schliesst -den Servo. -Über den Drehregler kann der Öffnungswinkel des Servos begrenzt werden. - -Autostart nicht aktiv ---------------------- -Wenn der Autostart nicht aktiv ist, dann startet der Servo nur, wenn ein leeres oder teilweise gefülltes -Glas auf der Waage steht. Dieses Glas wird bis zur eingestellten Füllmenge befüllt, dann stoppt das -Programm. - -Eine erneute Befüllung muss wieder mit der grünen Taste aktiviert werden (Halbautomatik). - -**Achtung:** Da auch teilgefüllte Gläser befüllt werden, kann ein abweichendes Gewicht des leeren Glases nicht -berücksichtigt werden! Ein halb volles 125g Glas kann die Befüllung mit 500g auslösen... - -Autostart aktiv ---------------- -Der Autostart-Modus wird ebenfalls über die grüne Taste aktiviert (Play/Pause Symbol). - -Danach startet der Füll-Vorgang automatisch, sobald ein passendes, leeres Glas aufgesetzt wird. Wenn das -gefüllte Glas entnommen wird und ein weiteres Glas aufgesetzt wird, startet der nächste Füll-Vorgang ohne -weitere Bestätigung (Vollautomatik). - -Das Gewicht das Glases wird als Tara für diesen Füllvorgang genutzt, um Schwankungen der leeren Gläser -auszugleichen. - -Ein teilgefülltes Glas wird nicht befüllt! Durch erneutes Drücken der Start-Taste wird die Befüllung erzwungen. - -Wenn kein Füllvorgang aktiv ist (der Hahn also geschlossen ist), kann in beiden Modi über den Auswahl-Taster -direkt der Korrekturwert und die Füllmenge zur Verstellung angewählt werden. Der jeweils zu verstellende -Wert blinkt. - -Autokorrektur -------------- -Die aktive Autokorrektur (Anzeige "ak=" unten links) führt die Füllmenge automatisch mit dem sinkenden Druck -im Abfüllbehälter nach. Das Zielgewicht wird im Automatik-Setup über die Kulanz eingestellt (Füllmenge + Kulanz). - - -## Notizen -- Das Projekt wurde auf dem [Heltec WiFi Kit 32](https://community.hiveeyes.org/t/heltec-wifi-kit-32-esp32-mit-kleinem-oled/1498), einem ESP32 mit OLED-Display entwickelt, sollte jedoch auch auf anderen ESP32 Geräten lauffähig sein. -- Bitte nutzt die neueste Version der HX711 Bibliothek von https://github.com/bogde/HX711, die ältere war nicht ohne weiteres auf einem ESP32 lauffähig. - - -## Firmware bauen - -Just type: -``` -make -``` - -After successfully building it, you will find firmware images at - -- .pio/build/heltec/firmware.bin -- .pio/build/heltec/firmware.elf - - -## Binär-Datei `hani-mandl.bin` - -Die Datei `hani-mandl.bin` wurde mit folgenden Parametern für das Board Heltec ESP32 Arduino > Wifi Kit 32 compiliert: - -``` -#define HARDWARE_LEVEL 2 // 1 = originales Layout mit Schalter auf Pin 19/22/21 - // 2 = Layout für V2 mit Schalter auf Pin 23/19/22 -#define SERVO_ERWEITERT // definieren, falls die Hardware mit dem alten Programmcode mit Poti aufgebaut wurde oder der Servo zu wenig fährt - // Sonst bleibt der Servo in Stop-Position einige Grad offen! Nach dem Update erst prüfen! -#define ROTARY_SCALE 2 // in welchen Schritten springt unser Rotary Encoder. - // Beispiele: KY-040 = 2, HW-040 = 1, für Poti-Betrieb auf 1 setzen -#define USE_ROTARY // Rotary benutzen -#define USE_ROTARY_SW // Taster des Rotary benutzen -``` - -Eine Anleitung zum Flashen der Binär-Datei gibt es unter -http://hanimandl.de/2020/12/23/firmware-binary-flashen/ - - -## Lizenzen - -HaniMandl steht unter den Open Source Initiative (OSI) Lizenzen "GPLv3" -und "CERN-OHL-S". Bei früheren Versionen und einigen aktuellen Derivaten -sind keine Lizenzen definiert. diff --git a/historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl-wiring_corresponding-to-code-v0.1.3.fzz b/upstream/hani-mandl-wiring_corresponding-to-code-v0.1.3.fzz similarity index 100% rename from historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl-wiring_corresponding-to-code-v0.1.3.fzz rename to upstream/hani-mandl-wiring_corresponding-to-code-v0.1.3.fzz diff --git a/historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.0.1.ino b/upstream/hani-mandl_v0.0.1.ino similarity index 100% rename from historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.0.1.ino rename to upstream/hani-mandl_v0.0.1.ino diff --git a/historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.0.2.ino b/upstream/hani-mandl_v0.0.2.ino similarity index 100% rename from historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.0.2.ino rename to upstream/hani-mandl_v0.0.2.ino diff --git a/historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.1.0.ino b/upstream/hani-mandl_v0.1.0.ino similarity index 100% rename from historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.1.0.ino rename to upstream/hani-mandl_v0.1.0.ino diff --git a/historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.1.2.ino b/upstream/hani-mandl_v0.1.2.ino similarity index 100% rename from historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.1.2.ino rename to upstream/hani-mandl_v0.1.2.ino diff --git a/historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.1.3.ino b/upstream/hani-mandl_v0.1.3.ino similarity index 100% rename from historic_copy-fb-group_imkerei-technik-eigenbau/hani-mandl_v0.1.3.ino rename to upstream/hani-mandl_v0.1.3.ino diff --git a/parts-3d-printing/readme.md b/variants/README.md similarity index 100% rename from parts-3d-printing/readme.md rename to variants/README.md diff --git a/parts-3d-printing/variante-1_heilbronn/anlenkstange.stl b/variants/variante-1_heilbronn/anlenkstange.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/anlenkstange.stl rename to variants/variante-1_heilbronn/anlenkstange.stl diff --git a/parts-3d-printing/variante-1_heilbronn/bodenplatte.stl b/variants/variante-1_heilbronn/bodenplatte.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/bodenplatte.stl rename to variants/variante-1_heilbronn/bodenplatte.stl diff --git a/parts-3d-printing/variante-1_heilbronn/distanzplaettchen-oben.stl b/variants/variante-1_heilbronn/distanzplaettchen-oben.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/distanzplaettchen-oben.stl rename to variants/variante-1_heilbronn/distanzplaettchen-oben.stl diff --git a/parts-3d-printing/variante-1_heilbronn/distanzplaettchen-unten.stl b/variants/variante-1_heilbronn/distanzplaettchen-unten.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/distanzplaettchen-unten.stl rename to variants/variante-1_heilbronn/distanzplaettchen-unten.stl diff --git a/parts-3d-printing/variante-1_heilbronn/gehaeuse.stl b/variants/variante-1_heilbronn/gehaeuse.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/gehaeuse.stl rename to variants/variante-1_heilbronn/gehaeuse.stl diff --git a/parts-3d-printing/variante-1_heilbronn/hanimandl-heilbronn-1.jpg b/variants/variante-1_heilbronn/hanimandl-heilbronn-1.jpg similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/hanimandl-heilbronn-1.jpg rename to variants/variante-1_heilbronn/hanimandl-heilbronn-1.jpg diff --git a/parts-3d-printing/variante-1_heilbronn/hanimandl-heilbronn-2.jpg b/variants/variante-1_heilbronn/hanimandl-heilbronn-2.jpg similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/hanimandl-heilbronn-2.jpg rename to variants/variante-1_heilbronn/hanimandl-heilbronn-2.jpg diff --git a/parts-3d-printing/variante-1_heilbronn/hanimandl-heilbronn-3.jpg b/variants/variante-1_heilbronn/hanimandl-heilbronn-3.jpg similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/hanimandl-heilbronn-3.jpg rename to variants/variante-1_heilbronn/hanimandl-heilbronn-3.jpg diff --git a/parts-3d-printing/variante-1_heilbronn/klemmring.stl b/variants/variante-1_heilbronn/klemmring.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/klemmring.stl rename to variants/variante-1_heilbronn/klemmring.stl diff --git a/parts-3d-printing/variante-1_heilbronn/readme.md b/variants/variante-1_heilbronn/readme.md similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/readme.md rename to variants/variante-1_heilbronn/readme.md diff --git a/parts-3d-printing/variante-1_heilbronn/servoarm.stl b/variants/variante-1_heilbronn/servoarm.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/servoarm.stl rename to variants/variante-1_heilbronn/servoarm.stl diff --git a/parts-3d-printing/variante-1_heilbronn/servohalter.stl b/variants/variante-1_heilbronn/servohalter.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/servohalter.stl rename to variants/variante-1_heilbronn/servohalter.stl diff --git a/parts-3d-printing/variante-1_heilbronn/waegeplatte.stl b/variants/variante-1_heilbronn/waegeplatte.stl similarity index 100% rename from parts-3d-printing/variante-1_heilbronn/waegeplatte.stl rename to variants/variante-1_heilbronn/waegeplatte.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.jpg b/variants/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.jpg similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.jpg rename to variants/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.jpg diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.stl b/variants/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/hahn/hahn.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/mutter.stl b/variants/variante-2_hamburg/hanimadl-ds3218/hahn/mutter.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/mutter.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/hahn/mutter.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/schieber.stl b/variants/variante-2_hamburg/hanimadl-ds3218/hahn/schieber.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hahn/schieber.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/hahn/schieber.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/halter.stl b/variants/variante-2_hamburg/hanimadl-ds3218/halter.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/halter.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/halter.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hanimadl.jpg b/variants/variante-2_hamburg/hanimadl-ds3218/hanimadl.jpg similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/hanimadl.jpg rename to variants/variante-2_hamburg/hanimadl-ds3218/hanimadl.jpg diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/schelle.stl b/variants/variante-2_hamburg/hanimadl-ds3218/schelle.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/schelle.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/schelle.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/schieberarm.stl b/variants/variante-2_hamburg/hanimadl-ds3218/schieberarm.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/schieberarm.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/schieberarm.stl diff --git a/parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/servoarm.stl b/variants/variante-2_hamburg/hanimadl-ds3218/servoarm.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/hanimadl-ds3218/servoarm.stl rename to variants/variante-2_hamburg/hanimadl-ds3218/servoarm.stl diff --git a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.jpg b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.jpg similarity index 100% rename from parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.jpg rename to variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.jpg diff --git a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.step b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.step similarity index 100% rename from parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.step rename to variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.step diff --git a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.stl b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.stl rename to variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/hahn.stl diff --git "a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/k\303\266rper12.stl" "b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/k\303\266rper12.stl" similarity index 100% rename from "parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/k\303\266rper12.stl" rename to "variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/k\303\266rper12.stl" diff --git a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/schelle.stl b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/schelle.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/schelle.stl rename to variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/schelle.stl diff --git a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/schieber.stl b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/schieber.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/schieber.stl rename to variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/schieber.stl diff --git a/parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/schubkappe.stl b/variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/schubkappe.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/nachzeichnung-kunstoffhahn/schubkappe.stl rename to variants/variante-2_hamburg/nachzeichnung-kunstoffhahn/schubkappe.stl diff --git a/parts-3d-printing/variante-2_hamburg/va-hahn/va-befestigungskappe_1.png b/variants/variante-2_hamburg/va-hahn/va-befestigungskappe_1.png similarity index 100% rename from parts-3d-printing/variante-2_hamburg/va-hahn/va-befestigungskappe_1.png rename to variants/variante-2_hamburg/va-hahn/va-befestigungskappe_1.png diff --git a/parts-3d-printing/variante-2_hamburg/va-hahn/va-befestigungskappe_2.png b/variants/variante-2_hamburg/va-hahn/va-befestigungskappe_2.png similarity index 100% rename from parts-3d-printing/variante-2_hamburg/va-hahn/va-befestigungskappe_2.png rename to variants/variante-2_hamburg/va-hahn/va-befestigungskappe_2.png diff --git a/parts-3d-printing/variante-2_hamburg/va-hahn/va-befestigungskappe_3.png b/variants/variante-2_hamburg/va-hahn/va-befestigungskappe_3.png similarity index 100% rename from parts-3d-printing/variante-2_hamburg/va-hahn/va-befestigungskappe_3.png rename to variants/variante-2_hamburg/va-hahn/va-befestigungskappe_3.png diff --git a/parts-3d-printing/variante-2_hamburg/va-hahn/va-schieber.step b/variants/variante-2_hamburg/va-hahn/va-schieber.step similarity index 100% rename from parts-3d-printing/variante-2_hamburg/va-hahn/va-schieber.step rename to variants/variante-2_hamburg/va-hahn/va-schieber.step diff --git a/parts-3d-printing/variante-2_hamburg/va-hahn/verbindungskappe.stl b/variants/variante-2_hamburg/va-hahn/verbindungskappe.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/va-hahn/verbindungskappe.stl rename to variants/variante-2_hamburg/va-hahn/verbindungskappe.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-hahn.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-hahn.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-hahn.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-hahn.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-halter.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-halter.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-halter.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-halter.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-modell.jpg b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-modell.jpg similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-modell.jpg rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-modell.jpg diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-mutter.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-mutter.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-mutter.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-mutter.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schelle.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schelle.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schelle.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schelle.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieber.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieber.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieber.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieber.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieberarm.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieberarm.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieberarm.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-schieberarm.stl diff --git a/parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-servoarm.stl b/variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-servoarm.stl similarity index 100% rename from parts-3d-printing/variante-2_hamburg/xxs-modell-mit-sg90/xxs-servoarm.stl rename to variants/variante-2_hamburg/xxs-modell-mit-sg90/xxs-servoarm.stl diff --git a/parts-3d-printing/variante-3_woerth/hanimandel-woerth-1.jpg b/variants/variante-3_woerth/hanimandel-woerth-1.jpg similarity index 100% rename from parts-3d-printing/variante-3_woerth/hanimandel-woerth-1.jpg rename to variants/variante-3_woerth/hanimandel-woerth-1.jpg diff --git a/parts-3d-printing/variante-3_woerth/hanimandel-woerth-2.jpg b/variants/variante-3_woerth/hanimandel-woerth-2.jpg similarity index 100% rename from parts-3d-printing/variante-3_woerth/hanimandel-woerth-2.jpg rename to variants/variante-3_woerth/hanimandel-woerth-2.jpg diff --git a/parts-3d-printing/variante-3_woerth/hanimandel-woerth-3.jpg b/variants/variante-3_woerth/hanimandel-woerth-3.jpg similarity index 100% rename from parts-3d-printing/variante-3_woerth/hanimandel-woerth-3.jpg rename to variants/variante-3_woerth/hanimandel-woerth-3.jpg diff --git a/parts-3d-printing/variante-3_woerth/hanimandel-woerth-4.jpg b/variants/variante-3_woerth/hanimandel-woerth-4.jpg similarity index 100% rename from parts-3d-printing/variante-3_woerth/hanimandel-woerth-4.jpg rename to variants/variante-3_woerth/hanimandel-woerth-4.jpg diff --git a/parts-3d-printing/variante-3_woerth/servo-arm-1.stl b/variants/variante-3_woerth/servo-arm-1.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/servo-arm-1.stl rename to variants/variante-3_woerth/servo-arm-1.stl diff --git a/parts-3d-printing/variante-3_woerth/servo-arm-2.stl b/variants/variante-3_woerth/servo-arm-2.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/servo-arm-2.stl rename to variants/variante-3_woerth/servo-arm-2.stl diff --git a/parts-3d-printing/variante-3_woerth/servo-halterung-1-oben.stl b/variants/variante-3_woerth/servo-halterung-1-oben.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/servo-halterung-1-oben.stl rename to variants/variante-3_woerth/servo-halterung-1-oben.stl diff --git a/parts-3d-printing/variante-3_woerth/servo-halterung-2-unten.stl b/variants/variante-3_woerth/servo-halterung-2-unten.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/servo-halterung-2-unten.stl rename to variants/variante-3_woerth/servo-halterung-2-unten.stl diff --git a/parts-3d-printing/variante-3_woerth/waage-1a-oben-oled1.3.stl b/variants/variante-3_woerth/waage-1a-oben-oled1.3.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/waage-1a-oben-oled1.3.stl rename to variants/variante-3_woerth/waage-1a-oben-oled1.3.stl diff --git a/parts-3d-printing/variante-3_woerth/waage-1b-oben-oled0.96.stl b/variants/variante-3_woerth/waage-1b-oben-oled0.96.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/waage-1b-oben-oled0.96.stl rename to variants/variante-3_woerth/waage-1b-oben-oled0.96.stl diff --git a/parts-3d-printing/variante-3_woerth/waage-2-waageplattform.stl b/variants/variante-3_woerth/waage-2-waageplattform.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/waage-2-waageplattform.stl rename to variants/variante-3_woerth/waage-2-waageplattform.stl diff --git a/parts-3d-printing/variante-3_woerth/waage-3-unten.stl b/variants/variante-3_woerth/waage-3-unten.stl similarity index 100% rename from parts-3d-printing/variante-3_woerth/waage-3-unten.stl rename to variants/variante-3_woerth/waage-3-unten.stl diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-1.jpg b/variants/variante-5_dresden/hanimandl-dresden-1.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-1.jpg rename to variants/variante-5_dresden/hanimandl-dresden-1.jpg diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-2.jpg b/variants/variante-5_dresden/hanimandl-dresden-2.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-2.jpg rename to variants/variante-5_dresden/hanimandl-dresden-2.jpg diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-3.jpg b/variants/variante-5_dresden/hanimandl-dresden-3.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-3.jpg rename to variants/variante-5_dresden/hanimandl-dresden-3.jpg diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-4.jpg b/variants/variante-5_dresden/hanimandl-dresden-4.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-4.jpg rename to variants/variante-5_dresden/hanimandl-dresden-4.jpg diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-5.jpg b/variants/variante-5_dresden/hanimandl-dresden-5.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-5.jpg rename to variants/variante-5_dresden/hanimandl-dresden-5.jpg diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-6.jpg b/variants/variante-5_dresden/hanimandl-dresden-6.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-6.jpg rename to variants/variante-5_dresden/hanimandl-dresden-6.jpg diff --git a/parts-3d-printing/variante-5_dresden/hanimandl-dresden-7.jpg b/variants/variante-5_dresden/hanimandl-dresden-7.jpg similarity index 100% rename from parts-3d-printing/variante-5_dresden/hanimandl-dresden-7.jpg rename to variants/variante-5_dresden/hanimandl-dresden-7.jpg diff --git a/parts-3d-printing/variante-5_dresden/readme.md b/variants/variante-5_dresden/readme.md similarity index 100% rename from parts-3d-printing/variante-5_dresden/readme.md rename to variants/variante-5_dresden/readme.md diff --git a/wiring-fritzing/hani-mandl-wiring_esp32_v0.2_experimental.fzz b/wiring/fritzing/hani-mandl-wiring_esp32_v0.2_experimental.fzz similarity index 100% rename from wiring-fritzing/hani-mandl-wiring_esp32_v0.2_experimental.fzz rename to wiring/fritzing/hani-mandl-wiring_esp32_v0.2_experimental.fzz diff --git a/wiring-fritzing/hani-mandl-wiring_esp32_v0.2_experimental.png b/wiring/fritzing/hani-mandl-wiring_esp32_v0.2_experimental.png similarity index 100% rename from wiring-fritzing/hani-mandl-wiring_esp32_v0.2_experimental.png rename to wiring/fritzing/hani-mandl-wiring_esp32_v0.2_experimental.png diff --git a/wiring-fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.fzz b/wiring/fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.fzz similarity index 100% rename from wiring-fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.fzz rename to wiring/fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.fzz diff --git a/wiring-fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.png b/wiring/fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.png similarity index 100% rename from wiring-fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.png rename to wiring/fritzing/hani-mandl-wiring_heltec_v0.5_netzteil.png diff --git a/wiring-fritzing/hani-mandl-wiring_heltec_v0.5_usb.fzz b/wiring/fritzing/hani-mandl-wiring_heltec_v0.5_usb.fzz similarity index 100% rename from wiring-fritzing/hani-mandl-wiring_heltec_v0.5_usb.fzz rename to wiring/fritzing/hani-mandl-wiring_heltec_v0.5_usb.fzz diff --git a/wiring-fritzing/hani-mandl-wiring_heltec_v0.5_usb.png b/wiring/fritzing/hani-mandl-wiring_heltec_v0.5_usb.png similarity index 100% rename from wiring-fritzing/hani-mandl-wiring_heltec_v0.5_usb.png rename to wiring/fritzing/hani-mandl-wiring_heltec_v0.5_usb.png diff --git a/wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.fzz b/wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.fzz similarity index 100% rename from wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.fzz rename to wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.fzz diff --git a/wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.png b/wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.png similarity index 100% rename from wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.png rename to wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_pot.png diff --git a/wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.fzz b/wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.fzz similarity index 100% rename from wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.fzz rename to wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.fzz diff --git a/wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.jpg b/wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.jpg similarity index 100% rename from wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.jpg rename to wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-and-v2_rotary.jpg diff --git a/wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.fzz b/wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.fzz similarity index 100% rename from wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.fzz rename to wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.fzz diff --git a/wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.png b/wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.png similarity index 100% rename from wiring-fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.png rename to wiring/fritzing/historic/hani-mandl-wiring_heltec-v1-only_pot.png