diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..04cd745
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,4 @@
+# These are supported funding model platforms
+
+ko_fi: jojo1220
+custom: https://paypal.me/jojos1220
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..f39a023
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,26 @@
+---
+name: Bug report
+about: Create a bug report to help us improve
+title: ''
+labels: 'bug'
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Additional context**
+Add any other context about the problem here.
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..0611efe
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,19 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: feature
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
\ No newline at end of file
diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml
new file mode 100644
index 0000000..022ddba
--- /dev/null
+++ b/.github/workflows/dependabot.yml
@@ -0,0 +1,20 @@
+name: PlatformIO Dependabot
+
+on:
+ workflow_dispatch: # option to manually trigger the workflow
+ pull_request: # option to run on pull-request
+ schedule:
+ # Runs every day at 00:00
+ - cron: '0 0 * * *'
+
+jobs:
+ dependabot:
+ runs-on: ubuntu-latest
+ name: run PlatformIO Dependabot
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ - name: run PlatformIO Dependabot
+ uses: peterus/platformio_dependabot@v1
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..dd1efb8
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,17 @@
+name: 'Close stale issues and PR'
+on:
+ schedule:
+ - cron: '30 6 * * *'
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v9
+ with:
+ stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
+ stale-pr-message: 'This PR is marked as stale because it has been open 45 days with no activity. You can remove stale label or comment if this PR is still valid.'
+ close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
+ days-before-stale: 30
+ days-before-close: 5
+ days-before-pr-close: -1
\ No newline at end of file
diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
new file mode 100644
index 0000000..f8462f3
--- /dev/null
+++ b/.github/workflows/workflow.yml
@@ -0,0 +1,31 @@
+name: PlatformIO CI
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cache/pip
+ ~/.platformio/.cache
+ key: ${{ runner.os }}-pio
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.11'
+ - name: Install PlatformIO Core
+ run: pip install --upgrade platformio
+
+ - name: Build PlatformIO Project Environment esp32Arduino
+ run: pio run -e esp32ARDUINO
+
+ - name: Build PlatformIO Project Environment esp32dev
+ run: pio run -e esp32dev
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..89cc49c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.pio
+.vscode/.browse.c_cpp.db*
+.vscode/c_cpp_properties.json
+.vscode/launch.json
+.vscode/ipch
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..080e70d
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,10 @@
+{
+ // See http://go.microsoft.com/fwlink/?LinkId=827846
+ // for the documentation about the extensions.json format
+ "recommendations": [
+ "platformio.platformio-ide"
+ ],
+ "unwantedRecommendations": [
+ "ms-vscode.cpptools-extension-pack"
+ ]
+}
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..795087c
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,427 @@
+Attribution-ShareAlike 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution-ShareAlike 4.0 International Public
+License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-ShareAlike 4.0 International Public License ("Public
+License"). To the extent this Public License may be interpreted as a
+contract, You are granted the Licensed Rights in consideration of Your
+acceptance of these terms and conditions, and the Licensor grants You
+such rights in consideration of benefits the Licensor receives from
+making the Licensed Material available under these terms and
+conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+
+ c. BY-SA Compatible License means a license listed at
+ creativecommons.org/compatiblelicenses, approved by Creative
+ Commons as essentially the equivalent of this Public License.
+
+ d. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ e. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ g. License Elements means the license attributes listed in the name
+ of a Creative Commons Public License. The License Elements of this
+ Public License are Attribution and ShareAlike.
+
+ h. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ i. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ j. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ k. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ l. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ m. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part; and
+
+ b. produce, reproduce, and Share Adapted Material.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. Additional offer from the Licensor -- Adapted Material.
+ Every recipient of Adapted Material from You
+ automatically receives an offer from the Licensor to
+ exercise the Licensed Rights in the Adapted Material
+ under the conditions of the Adapter's License You apply.
+
+ c. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+ b. ShareAlike.
+
+ In addition to the conditions in Section 3(a), if You Share
+ Adapted Material You produce, the following conditions also apply.
+
+ 1. The Adapter's License You apply must be a Creative Commons
+ license with the same License Elements, this version or
+ later, or a BY-SA Compatible License.
+
+ 2. You must include the text of, or the URI or hyperlink to, the
+ Adapter's License You apply. You may satisfy this condition
+ in any reasonable manner based on the medium, means, and
+ context in which You Share Adapted Material.
+
+ 3. You may not offer or impose any additional or different terms
+ or conditions on, or apply any Effective Technological
+ Measures to, Adapted Material that restrict exercise of the
+ rights granted under the Adapter's License You apply.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material,
+ including for purposes of Section 3(b); and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+
+=======================================================================
+
+Creative Commons is not a party to its public licenses.
+Notwithstanding, Creative Commons may elect to apply one of its public
+licenses to material it publishes and in those instances will be
+considered the “Licensor.” The text of the Creative Commons public
+licenses is dedicated to the public domain under the CC0 Public Domain
+Dedication. Except for the limited purpose of indicating that material
+is shared under a Creative Commons public license or as otherwise
+permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the public
+licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9013b1d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,219 @@
+
+
+# TurningTurnTable
+
+
+
+
+
Figure 1: Overview of the functional turning assembly with happy jellyfish
+
+
+[![PlatformIO CI][build-shield]][build-url]
+![License][license-url]
+[![Release Version][realease-shield]][release-url]
+[![Release Date][releasedate-shield]][releasedate-url]
+[![Last commit][lastcommit-shield]][lastcommit-url]
+[![Contributors][contributors-shield]][contributors-url]
+[![vscode.dev preview][vscode-dev-shield]][vscode-dev-url]
+[![Dependabot][depandbot-shield]][depandbot-url]
+[![GitHub Actions][githubactions-shield]][githubactions-url]
+[![PayPal][Paypal-shield]][paypal-url]
+[![Ko-Fi][Ko-Fi-shield]][Ko-Fi-url]
+
+## About this Project and Repository
+Welcome to the source code repository for the TurningTurnTable project, built on ESP32 for the dynamic control of the autonomous Turntable.
+
+For a comprehensive assembly guide and additional project details, please refer to the Contact section, where you'll find project links leading to detailed instructions on Instructables.
+
+### Features
+
+**Autonomous Mode:** The standout feature is the autonomous mode, which rotates the turntable at a specified angle and triggers the connected device via BLE to take a picture. Depending on the setup, up to 64 pictures of the object can be captured.
+
+**Hand Mode:** Is the automatic mode not suitable for your needs? You can manually control the turntable through the menu, adjusting it to a specific angle or rotating it infinitely in any direction.
+
+**Control by OLED-Display and Encoder:** The turntable is fully controlled through an integrated OLED display and encoder. In addition to switching between Auto and Manual modes, you can set parameters such as stepper acceleration/speed and the stepper angle between pictures. You can also check the BLE connection to your device and take a test screenshot.
+
+
+
+ Table of Contents
+
+ - About this Project/Repository
+ - Getting Started
+ - Roadmap
+ - Contributing
+ - License
+ - Contact
+ - Acknowledgments
+ - Support
+
+
+
+Happy tinkering and making picutes! 🚀🛠️💡
+
+## Getting Started
+
+Before you begin, ensure you have the following components (or their equivalents) available.
+
+The base component is an ESP32 board with a prototyping shield, similar to an Arduino. You can also use a NodeMCU-specific board, which functions similarly but has different pin definitions. A stepper motor driver and stepper motor are connected to this board for motion control. An OLED display and encoder are installed for operating the assembly. The project uses the internal Arduino power supply and an external 12V power adapter to operate the stepper motor driver. To complete the setup, you will need some M3/M4 screws, nuts, washers, heat inserts, bearings, and cables. For wiring, refer to the pins.h file, which describes the pins used for the specific board and interface.
+
+For detailed assembly instructions, refer to the Instructable guide and the CULTS3D homepage in the Contact section.
+
+![20240707_104415](https://github.com/JoJos1220/TurningTurnTable_private/assets/97045955/09ae8746-ba03-49b8-b9f8-012695f01e56)
+
+**Figure 2: Hardware Setup -> ESP32 "Arduino", NEMA 17 Pancake Stepper, Stepper-Motor Driver Board and some connector cables**
+_____________________________________________________________________________________________________________
+### Preparing 3D-printed parts
+
+The STL files and a detailed 3D printing overview of the project are available for download on Cults3D:
+
+Link to Cults3D: [![Cults3D][cults3d-shield]][cults3d-url]
+
+Feel free to explore my other projects as well 🚀.
+
+_____________________________________________________________________________________________________________
+
+After preparing the parts, start by assembling the base plate. Insert the heat inserts into their designated spots and then place the bearings into the gaps on the base plate. Next, attach the front plate mount. For the front plate, install the OLED display and the encoder, securing them with screws and heat inserts. Once the hardware assembly is complete, move on to the electronics, starting with the Arduino-like ESP32 board and the prototyping shield. Then, install the stepper motor and the stepper motor driver. Depending on the stepper motor used, either print the alternative stepper motor adapter plate for the NEMA 17 Pancake Stepper or mount the 28BYJ-48 directly in place. Finally, complete the assembly by adding heat inserts to the top part and screwing the gear into place.
+
+![20240610_195708](https://github.com/JoJos1220/TurningTurnTable_private/assets/97045955/6a7f185e-af64-4c54-9e0e-f220f1c365e0)
+
+**Figure 3a: Hardware Schematics**
+
+![Electrical_Wiring_Schematic](https://github.com/JoJos1220/TurningTurnTable_private/assets/97045955/f1f520b2-62a7-44f9-9073-60708838191a)
+
+**Figure 3b: Electrical Wiring Schematics**
+
+(back to top)
+
+_____________________________________________________________________________________________________________
+
+# Comissioning
+Before flashing the software onto the ESP32, pre-define your specific hardware setup in the "platformio.ini" file and set the project-specific parameters in the "TurningTurnTablePARAMETERS.h" file.
+
+The most critical sections in the "platformio.ini" file:
+
+```
+[platformio]
+default_envs = esp32ARDUINO ; Selecting your specific Default Environment for Software Build
+
+[env:esp32xxxxxxxxxxxx]
+build_flags =
+ -D ESP32dev_ARDUINO ; Defining Electronic Board
+ -D _17HS08 ; Defining Used Stepper Type in FULLStep Mode(_17HS08 or _28BYJ48)
+ ; Stepper Operation Mode is Setup in TurningTurnTablePARAMETERS.h
+
+```
+
+Most specific sections in the TurningTurnTablePARAMETERS.h file:
+
+```
+// Defining Stepper Operation Mode on your specific connection/operation Purpose
+#define StepperOperation 2 // 0 == FULL4WIRE; 1 == HALF4WIRE; 2 == DRIVER Stage with 16 MicroSteps
+
+```
+
+
+When you power on the turntable, it should start up, displaying the boot screen on the OLED display. The turntable is now ready for operation, and you can control it using the encoder and your smartphone.
+
+![000_RestartScreen](https://github.com/JoJos1220/TurningTurnTable_private/assets/97045955/bbe95326-75c8-4588-8123-16dcb9207b01)
+
+**Figure 4: OLED-Boot Screen**
+
+## Roadmap
+
+The initial release of this project introduces a fully functional prototype to the open-source community.
+
+Future updates will incorporate additional features based on community feedback, and the roadmap will be continuously updated.
+
+- Enhancing support for various displays
+
+- Remote control functionality for turntable operation
+
+- Integration of internal power source capabilities
+
+(back to top)
+
+## Contributing
+
+Everybody is welcome to contribute the project - regardless of the experience level!
+
+1) fork the repository
+2) clone your fork on your PC
+3) create a branch for your changes
+4) add you changes
+5) commit and push
+6) create a pull request
+
+(back to top)
+
+## License
+
+Creative Commons Attribution Share Alike 4.0
+
+[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC_BY--NC--ND_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)
+
+See also [LICENSE](LICENSE.md) for more information about license rights and limitations.
+
+(back to top)
+
+## Contact
+
+Project Link [![Github][github-shield]][github-url]
+
+Project Link [![Instructables][instructables-shield]][instructables-url]
+
+Projekt Link [![Cults3D][cults3d-shield]][cults3d-url]
+
+(back to top)
+
+## Acknowledgments
+For more detailed information about the Project, please check the Instructables Link given within the Contact section.
+
+## Support
+
+You Like the Project and want to Support me and my work?
+
+Well, I like coffee ;) Maybe we got a deal?
+
+[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)][Ko-Fi-url]
+
+[![Donate with PayPal](https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png)][paypal-url]
+
+
+
+
+
+
Figure 5: Happy-Turning-Puppy :)
+
+
+(back to top)
+
+
+
+[instructables-shield]: https://img.shields.io/badge/Instructables-jojo__1220-blue?logo=instructables
+[instructables-url]: https://www.instructables.com/360-Smartphone-Photography-With-BLE-ESP32-Controll/
+[github-shield]: https://img.shields.io/badge/GitHub-Jojos1220-black?logo=github
+[github-url]: https://github.com/JoJos1220/TurningTurnTable
+[cults3d-shield]: https://img.shields.io/badge/cults3D-JOJO__1220-pink.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH6AcIBTkVJMVsCgAAAkxJREFUOI2llD9oU1EUxr97X9KkIY0+bU1an2QwVLCQdKhU8E9FBefgYKFUHBzSwUmqoxBwEaFDh2QpdBAcpFksSlsEU8Q6RMQ/TUtIwJS2aVPS1sYkTV/ePQ7PJn1JFcRvu/ee+7vnfPfcy4iI8J8y/W2xXCDks4TyT8DhZGg5wf4NEg2rmA2pcLgY7K0MPzIEWWG4+cQCh6sORofo4wuVQv4SfXtdMcx/iqgU9BYom9QM8w2Q+akKhfylhsB9fXim0si1omGd15exMFNBt98EczNDcbvR894BE9q7OFLvxZ89Wf4sEJ/WMPNUHzvPcNx4YIa7R6rGyCcZVr5o1e2GTCaGy5BPMdwZt+L+22YEIlZYWw43fjUuEA2rxkwmhsvYSBECEWs10CYz9I9akIkLA2BrhXD1XhMiD8s1yG6ekIhquPvcino12Vi1lHRMQ+47YSMp0HlFwuUhM7IJoUPSMYGjHRxtp40+7+4Q1hMC7h6p2jcA0D9qgdkKeC5I+DpZ0SFbywSL3ZhBNKRiNqzi9pgFANAXMOPcLRO2VwkdXfphssKQz5JurOLj2FwyXqfi4/Bckgy3YpNZFQAA8WkNssJ/Q7wcSjfHq8d7NYiXY2eNsPhGa/BpX3PjKjwXpVrb57OCgt4CzU/VWj0RrdDI9SKl5oztn0sLmgyWaWygRERE7OBXsJ4QePloD4UcQfFx2FsZku80bC4ROvskHHMzZOIC6ZjA+UETegfNcDgZDJCDsLVFAaHpZR1x6ZszCwLH3RztZznsbbWX/Au343MY0yo+PwAAAABJRU5ErkJggg==
+[cults3d-url]: https://cults3d.com/de/modell-3d/gadget/360-autonomus-bluetooth-controlled-turningturntable-a3e1ec866f3f3dc38452
+[vscode-dev-shield]: https://img.shields.io/badge/preview%20in-vscode.dev-blue
+[vscode-dev-url]: https://open.vscode.dev/JoJos1220/TurningTurnTable
+
+[license-url]:https://img.shields.io/github/license/Jojos1220/TurningTurnTable?style=flat-square
+[build-shield]: https://github.com/JoJos1220/TurningTurnTable_private/actions/workflows/workflow.yml/badge.svg
+[build-url]: https://github.com/JoJos1220/TurningTurnTable_private/actions/workflows/workflow.yml
+[contributors-shield]: https://img.shields.io/github/contributors/JoJo1220/TurningTurnTable
+[contributors-url]: https://github.com/JoJo1220/TurningTurnTable/graphs/contributors
+[realease-shield]: https://img.shields.io/github/release/JoJos1220/TurningTurnTable.svg?style=plastic
+[release-url]: https://github.com/JoJos1220/TurningTurnTable/releases/latest
+[releasedate-shield]: https://img.shields.io/github/release-date/JoJos1220/TurningTurnTable.svg?style=plastic
+[releasedate-url]: https://github.com/JoJos1220/TurningTurnTable/releases/latest/
+[lastcommit-shield]: https://img.shields.io/github/last-commit/JoJos1220/TurningTurnTable?style=plastic
+[lastcommit-url]: https://github.com/JoJos1220/TurningTurnTable/tree
+[depandbot-shield]: https://img.shields.io/badge/dependabot-025E8C?style=for-the-badge&logo=dependabot&logoColor=white
+[depandbot-url]:https://github.com/JoJos1220/TurningTurnTable_private/actions/workflows/dependabot.yml
+[githubactions-shield]: https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white
+[githubactions-url]:https://github.com/JoJos1220/TurningTurnTable_private/actions
+[paypal-shield]: https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white
+[paypal-url]: https://www.paypal.com/donate/?hosted_button_id=8CTAKMUENCF46
+[Ko-Fi-shield]: https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white
+[Ko-Fi-url]: https://ko-fi.com/G2G3OAILE
diff --git a/doc/28byj-48_stepper_dataheet.pdf b/doc/28byj-48_stepper_dataheet.pdf
new file mode 100644
index 0000000..fcc0416
Binary files /dev/null and b/doc/28byj-48_stepper_dataheet.pdf differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTableExplosionsansicht.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTableExplosionsansicht.jpg
new file mode 100644
index 0000000..5cbf0c4
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTableExplosionsansicht.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Default.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Default.jpg
new file mode 100644
index 0000000..e875b98
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Default.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_FrontPlate.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_FrontPlate.jpg
new file mode 100644
index 0000000..da2fa52
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_FrontPlate.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_1.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_1.jpg
new file mode 100644
index 0000000..28a8121
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_1.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_10a.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_10a.jpg
new file mode 100644
index 0000000..f6bd0f1
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_10a.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_10b.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_10b.jpg
new file mode 100644
index 0000000..df22566
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_10b.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_11.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_11.jpg
new file mode 100644
index 0000000..16d2dea
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_11.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_12.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_12.jpg
new file mode 100644
index 0000000..941f653
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_12.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_13.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_13.jpg
new file mode 100644
index 0000000..8bfd498
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_13.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_14.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_14.jpg
new file mode 100644
index 0000000..a7e525d
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_14.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_15.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_15.jpg
new file mode 100644
index 0000000..edf3d6b
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_15.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_16.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_16.jpg
new file mode 100644
index 0000000..ab5e234
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_16.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_17.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_17.jpg
new file mode 100644
index 0000000..535235d
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_17.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_2.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_2.jpg
new file mode 100644
index 0000000..8c9a598
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_2.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_3.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_3.jpg
new file mode 100644
index 0000000..c3a0ec8
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_3.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_4.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_4.jpg
new file mode 100644
index 0000000..03a36d4
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_4.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_4a.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_4a.jpg
new file mode 100644
index 0000000..2476b5d
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_4a.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_5.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_5.jpg
new file mode 100644
index 0000000..7f9afdc
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_5.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_1.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_1.jpg
new file mode 100644
index 0000000..834d931
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_1.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_2.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_2.jpg
new file mode 100644
index 0000000..50e40b6
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_2.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_3.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_3.jpg
new file mode 100644
index 0000000..d4c5881
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_3.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_4.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_4.jpg
new file mode 100644
index 0000000..1eb7056
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_6_4.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_7.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_7.jpg
new file mode 100644
index 0000000..83d48a9
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_7.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_8.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_8.jpg
new file mode 100644
index 0000000..d7a47b2
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_8.jpg differ
diff --git a/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_9.jpg b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_9.jpg
new file mode 100644
index 0000000..25b1fad
Binary files /dev/null and b/doc/Bilder/000_SW_Composer/TurningTurnTable_Step_9.jpg differ
diff --git "a/doc/Bilder/000_SW_Composer/TurningTurntableSt\303\274cklsite3DPrintedParts.jpg" "b/doc/Bilder/000_SW_Composer/TurningTurntableSt\303\274cklsite3DPrintedParts.jpg"
new file mode 100644
index 0000000..0874b7b
Binary files /dev/null and "b/doc/Bilder/000_SW_Composer/TurningTurntableSt\303\274cklsite3DPrintedParts.jpg" differ
diff --git "a/doc/Bilder/000_SW_Composer/TurningTurntableSt\303\274cklsiteZukaufteile.jpg" "b/doc/Bilder/000_SW_Composer/TurningTurntableSt\303\274cklsiteZukaufteile.jpg"
new file mode 100644
index 0000000..34336bb
Binary files /dev/null and "b/doc/Bilder/000_SW_Composer/TurningTurntableSt\303\274cklsiteZukaufteile.jpg" differ
diff --git a/doc/Bilder/001_CURA/AG_TurningTurnTable_SmallGEAR_v0.3.png b/doc/Bilder/001_CURA/AG_TurningTurnTable_SmallGEAR_v0.3.png
new file mode 100644
index 0000000..2da9922
Binary files /dev/null and b/doc/Bilder/001_CURA/AG_TurningTurnTable_SmallGEAR_v0.3.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_BASE_v0.1.png b/doc/Bilder/001_CURA/TurningTurnTable_BASE_v0.1.png
new file mode 100644
index 0000000..ffbb0bc
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_BASE_v0.1.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_BEARINGINLET.png b/doc/Bilder/001_CURA/TurningTurnTable_BEARINGINLET.png
new file mode 100644
index 0000000..3ad6b1b
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_BEARINGINLET.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_BigGEAR_v0.1.png b/doc/Bilder/001_CURA/TurningTurnTable_BigGEAR_v0.1.png
new file mode 100644
index 0000000..51d78b4
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_BigGEAR_v0.1.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_FEET_v0.1.png b/doc/Bilder/001_CURA/TurningTurnTable_FEET_v0.1.png
new file mode 100644
index 0000000..a3a9f21
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_FEET_v0.1.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_FRONTMOUNTINGPLATE_v0.2.png b/doc/Bilder/001_CURA/TurningTurnTable_FRONTMOUNTINGPLATE_v0.2.png
new file mode 100644
index 0000000..554c79c
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_FRONTMOUNTINGPLATE_v0.2.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_SmallGEAR_v0.2.png b/doc/Bilder/001_CURA/TurningTurnTable_SmallGEAR_v0.2.png
new file mode 100644
index 0000000..5d9eba2
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_SmallGEAR_v0.2.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_StepperHolder_v0.1.png b/doc/Bilder/001_CURA/TurningTurnTable_StepperHolder_v0.1.png
new file mode 100644
index 0000000..528e431
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_StepperHolder_v0.1.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_TOPDistance_v0.1.png b/doc/Bilder/001_CURA/TurningTurnTable_TOPDistance_v0.1.png
new file mode 100644
index 0000000..1ef52f2
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_TOPDistance_v0.1.png differ
diff --git a/doc/Bilder/001_CURA/TurningTurnTable_TOP_v0.1.png b/doc/Bilder/001_CURA/TurningTurnTable_TOP_v0.1.png
new file mode 100644
index 0000000..de86e80
Binary files /dev/null and b/doc/Bilder/001_CURA/TurningTurnTable_TOP_v0.1.png differ
diff --git a/doc/Bilder/002_MenuScreens/000_RestartScreen.png b/doc/Bilder/002_MenuScreens/000_RestartScreen.png
new file mode 100644
index 0000000..64c5c9f
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/000_RestartScreen.png differ
diff --git a/doc/Bilder/002_MenuScreens/001_MainMenu.png b/doc/Bilder/002_MenuScreens/001_MainMenu.png
new file mode 100644
index 0000000..5ca0c64
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/001_MainMenu.png differ
diff --git a/doc/Bilder/002_MenuScreens/002_AutoMode.png b/doc/Bilder/002_MenuScreens/002_AutoMode.png
new file mode 100644
index 0000000..4ca8dda
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/002_AutoMode.png differ
diff --git a/doc/Bilder/002_MenuScreens/003_HandMode.png b/doc/Bilder/002_MenuScreens/003_HandMode.png
new file mode 100644
index 0000000..e8a6e94
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/003_HandMode.png differ
diff --git a/doc/Bilder/002_MenuScreens/004_Settings.png b/doc/Bilder/002_MenuScreens/004_Settings.png
new file mode 100644
index 0000000..1e9a08e
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/004_Settings.png differ
diff --git a/doc/Bilder/002_MenuScreens/005_SetupAccelValue.png b/doc/Bilder/002_MenuScreens/005_SetupAccelValue.png
new file mode 100644
index 0000000..d928f3f
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/005_SetupAccelValue.png differ
diff --git a/doc/Bilder/002_MenuScreens/006_SetAccelValue.png b/doc/Bilder/002_MenuScreens/006_SetAccelValue.png
new file mode 100644
index 0000000..0d67232
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/006_SetAccelValue.png differ
diff --git a/doc/Bilder/002_MenuScreens/007_SetupVelValue.png b/doc/Bilder/002_MenuScreens/007_SetupVelValue.png
new file mode 100644
index 0000000..287ab27
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/007_SetupVelValue.png differ
diff --git a/doc/Bilder/002_MenuScreens/008_SetVellValue.png b/doc/Bilder/002_MenuScreens/008_SetVellValue.png
new file mode 100644
index 0000000..292b3fc
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/008_SetVellValue.png differ
diff --git a/doc/Bilder/002_MenuScreens/009_AutoSettings.png b/doc/Bilder/002_MenuScreens/009_AutoSettings.png
new file mode 100644
index 0000000..ad83e1c
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/009_AutoSettings.png differ
diff --git a/doc/Bilder/002_MenuScreens/010_TestBLEScreenshot.png b/doc/Bilder/002_MenuScreens/010_TestBLEScreenshot.png
new file mode 100644
index 0000000..6c9ff6d
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/010_TestBLEScreenshot.png differ
diff --git a/doc/Bilder/002_MenuScreens/011_StepperAngleSelect.png b/doc/Bilder/002_MenuScreens/011_StepperAngleSelect.png
new file mode 100644
index 0000000..1e5695b
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/011_StepperAngleSelect.png differ
diff --git a/doc/Bilder/002_MenuScreens/012_PicDelayTime.png b/doc/Bilder/002_MenuScreens/012_PicDelayTime.png
new file mode 100644
index 0000000..f09f901
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/012_PicDelayTime.png differ
diff --git a/doc/Bilder/002_MenuScreens/013_SetPicDelayTime.png b/doc/Bilder/002_MenuScreens/013_SetPicDelayTime.png
new file mode 100644
index 0000000..f41ca3c
Binary files /dev/null and b/doc/Bilder/002_MenuScreens/013_SetPicDelayTime.png differ
diff --git a/doc/Electrical_Wiring_Schematic.png b/doc/Electrical_Wiring_Schematic.png
new file mode 100644
index 0000000..0869215
Binary files /dev/null and b/doc/Electrical_Wiring_Schematic.png differ
diff --git a/platformio.ini b/platformio.ini
new file mode 100644
index 0000000..0beacd2
--- /dev/null
+++ b/platformio.ini
@@ -0,0 +1,52 @@
+; PlatformIO Project Configuration File for TurningTurntable Project by Jojo1220
+
+[platformio]
+description = TurningTurntable by Jojo1220
+
+; "Arduino-looking"-ESP32 Board
+[env:esp32ARDUINO]
+platform = espressif32 @ 6.7.0
+board = esp32dev
+board_build.f_cpu = 240000000L
+board_build.f_flash = 80000000L
+board_build.partitions = huge_app.csv
+board_upload.flash_size=4MB
+board_build.flash_mode = qio ; Or QOUT
+framework = arduino
+upload_speed = 921600
+monitor_speed = 115200
+build_type = release
+build_flags =
+ -D ESP32dev_ARDUINO ; Defining Electronic Board
+ -D _17HS08 ; Defining Used Stepper Type in FULLStep Mode(_17HS08 or _28BYJ48)
+ ; Stepper Operation Mode is Setup in TurningTurnTablePARAMETERS.h
+ -D SERIAL_OUTPUT_DEBUGGING
+ -D SERIAL_OUTPUT_INFORMATION
+lib_deps =
+ waspinator/AccelStepper@^1.64
+ olikraus/U8g2@^2.35.17
+ https://github.com/JoJos1220/RotaryEncoder.git ;Forked Libary from mathertel/RotaryEncoder@^1.5.3
+
+; ESP32 DevelopementBoard
+[env:esp32dev]
+platform = espressif32 @ 6.7.0
+board = esp32dev
+board_build.f_cpu = 240000000L
+board_build.f_flash = 80000000L
+board_build.partitions = huge_app.csv
+board_upload.flash_size=4MB
+board_build.flash_mode = qio ; Or QOUT
+framework = arduino
+upload_speed = 921600
+monitor_speed = 115200
+build_type = release
+build_flags =
+ -D ESP32dev_Board ; Defining Electronic Board
+ -D _17HS08 ; Defining Used Stepper Type in FULLStep Mode(_17HS08 or _28BYJ48)
+ ; Stepper Operation Mode is Setup in TurningTurnTablePARAMETERS.h
+ -D SERIAL_OUTPUT_DEBUGGING
+ -D SERIAL_OUTPUT_INFORMATION
+lib_deps =
+ waspinator/AccelStepper@^1.64
+ olikraus/U8g2@^2.35.17
+ https://github.com/JoJos1220/RotaryEncoder.git ;Forked Libary from mathertel/RotaryEncoder@^1.5.3
diff --git a/src/BLEIntegration.cpp b/src/BLEIntegration.cpp
new file mode 100644
index 0000000..4532a88
--- /dev/null
+++ b/src/BLEIntegration.cpp
@@ -0,0 +1,88 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: BLEIntegration.cpp
+ Purpose: See BLEIntegration.h
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: See BLEIntegration.h
+******************************************v1.0.0****************************************************/
+
+#include "BLEIntegration.h"
+
+/*-----------------------------------------------------------------------------
+ * BLE Specific Variable Initialization
+ * ----------------------------------------------------------------------------
+*/
+BLEHIDDevice* hid;
+BLECharacteristic* input;
+BLECharacteristic* output;
+BLECharacteristic* inputVolume;
+BLECharacteristic* outputVolume;
+bool connected = false;
+
+/*-----------------------------------------------------------------------------
+ * Class: MyCallbacks::onConnect() BLE Function
+ * ----------------------------------------------------------------------------
+*/
+void MyCallbacks::onConnect(BLEServer* pServer){
+ connected = true;
+ BLE2902* desc = (BLE2902*)input->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
+ desc->setNotifications(true);
+
+ BLE2902* descv = (BLE2902*)inputVolume->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
+ descv->setNotifications(true);
+} // MyCallbacks::onConnect()
+
+/*-----------------------------------------------------------------------------
+ * Class: MyCallbacks::onDisconnect() BLE Function
+ * ----------------------------------------------------------------------------
+*/
+void MyCallbacks::onDisconnect(BLEServer* pServer){
+ connected = false;
+ BLE2902* desc = (BLE2902*)input->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
+ desc->setNotifications(false);
+
+ BLE2902* descv = (BLE2902*)inputVolume->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
+ descv->setNotifications(false);
+} // MyCallbacks::onDisconnect()
+
+/*-----------------------------------------------------------------------------
+ * taskServer() BLE Handler Function
+ * ----------------------------------------------------------------------------
+*/
+void taskServer(void*){
+ BLEDevice::init("TurningTurnTable");
+ BLEServer *pServer = BLEDevice::createServer();
+ pServer->setCallbacks(new MyCallbacks());
+
+ hid = new BLEHIDDevice(pServer);
+ inputVolume = hid->inputReport(1); // <-- input REPORTID from report map
+ outputVolume = hid->outputReport(1); // <-- output REPORTID from report map
+
+ input = hid->inputReport(2); // <-- input REPORTID from report map
+ output = hid->outputReport(2); // <-- output REPORTID from report map
+
+ std::string name = "Jojo1220";
+ hid->manufacturer()->setValue(name);
+
+ hid->pnp(0x02, 0xe502, 0xa111, 0x0210);
+ hid->hidInfo(0x00,0x02);
+
+ hid->reportMap((uint8_t*)keyboardHidDescriptor, sizeof(keyboardHidDescriptor));
+ hid->startServices();
+
+
+ BLESecurity *pSecurity = new BLESecurity();
+ pSecurity->setKeySize();
+ pSecurity->setAuthenticationMode(ESP_LE_AUTH_BOND);
+
+
+ BLEAdvertising *pAdvertising = pServer->getAdvertising();
+ pAdvertising->setAppearance(HID_KEYBOARD);
+ pAdvertising->addServiceUUID(hid->hidService()->getUUID());
+ pAdvertising->start();
+ hid->setBatteryLevel(7);
+
+ delay(portMAX_DELAY);
+} // taskServer()
diff --git a/src/BLEIntegration.h b/src/BLEIntegration.h
new file mode 100644
index 0000000..f2af755
--- /dev/null
+++ b/src/BLEIntegration.h
@@ -0,0 +1,129 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: BLEIntegration.h
+ Purpose: BLEIntegration.h File for Bluetooth Low Energie functions of TurningTurnTable Project
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef BLEINTEGRATION_H
+#define BLEINTEGRATION_H
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/*-----------------------------------------------------------------------------
+ * Function Header Definition
+ * ----------------------------------------------------------------------------
+*/
+void taskServer(void*);
+
+/*-----------------------------------------------------------------------------
+ * Global Structur/ Type Definition
+ * ----------------------------------------------------------------------------
+*/
+typedef struct
+{
+ // uint8_t reportId; // Report ID = 0x02 (2)
+ // Collection: CA:ConsumerControl
+ uint16_t ConsumerControl; // Value = 0 to 572
+} inputConsumer_t;
+
+typedef struct
+{
+// uint8_t reportId; // Report ID = 0x02 (2)
+ // Collection: CA:Keyboard
+ uint8_t KB_KeyboardKeyboardLeftControl : 1; // Usage 0x000700E0: Keyboard Left Control, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardLeftShift : 1; // Usage 0x000700E1: Keyboard Left Shift, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardLeftAlt : 1; // Usage 0x000700E2: Keyboard Left Alt, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardLeftGui : 1; // Usage 0x000700E3: Keyboard Left GUI, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardRightControl : 1; // Usage 0x000700E4: Keyboard Right Control, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardRightShift : 1; // Usage 0x000700E5: Keyboard Right Shift, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardRightAlt : 1; // Usage 0x000700E6: Keyboard Right Alt, Value = 0 to 1
+ uint8_t KB_KeyboardKeyboardRightGui : 1; // Usage 0x000700E7: Keyboard Right GUI, Value = 0 to 1
+ uint8_t Key; // Value = 0 to 101
+} inputKeyboard_t;
+
+/*-----------------------------------------------------------------------------
+ * Global Variable Definition
+ * ----------------------------------------------------------------------------
+*/
+static uint8_t idleRate; /* in 4 ms units */
+
+static inputConsumer_t consumer_Report{};
+static inputKeyboard_t keyboard_report{}; // sent to PC
+
+extern BLEHIDDevice* hid;
+extern BLECharacteristic* input;
+extern BLECharacteristic* output;
+extern BLECharacteristic* inputVolume;
+extern BLECharacteristic* outputVolume;
+extern bool connected;
+
+const uint8_t keyboardHidDescriptor[] = {
+ 0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
+ 0x09, 0x01, // USAGE (Consumer Control)
+ 0xa1, 0x01, // COLLECTION (Application)
+ 0x85, 0x01, // REPORT_ID (1)
+ 0x19, 0x00, // USAGE_MINIMUM (Unassigned)
+ 0x2a, 0x3c, 0x02, // USAGE_MAXIMUM (AC Format)
+ 0x15, 0x00, // LOGICAL_MINIMUM (0)
+ 0x26, 0x3c, 0x02, // LOGICAL_MAXIMUM (572)
+ 0x95, 0x01, // REPORT_COUNT (1)
+ 0x75, 0x10, // REPORT_SIZE (16)
+ 0x81, 0x00, // INPUT (Data,Var,Abs)
+ 0xc0, // END_COLLECTION
+ 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
+ 0x09, 0x06, // USAGE (Keyboard)
+ 0xa1, 0x01, // COLLECTION (Application)
+ 0x85, 0x02, // REPORT_ID (2)
+ 0x05, 0x07, // USAGE_PAGE (Keyboard)
+ 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
+ 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
+ 0x15, 0x00, // LOGICAL_MINIMUM (0)
+ 0x25, 0x01, // LOGICAL_MAXIMUM (1)
+ 0x75, 0x01, // REPORT_SIZE (1)
+ 0x95, 0x08, // REPORT_COUNT (8)
+ 0x81, 0x02, // INPUT (Data,Var,Abs)
+ 0x95, 0x01, // REPORT_COUNT (1)
+ 0x75, 0x08, // REPORT_SIZE (8)
+ 0x25, 0x65, // LOGICAL_MAXIMUM (101)
+ 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
+ 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
+ 0x81, 0x00, // INPUT (Data,Ary,Abs)
+ 0xc0 // END_COLLECTION
+};
+
+/*-----------------------------------------------------------------------------
+ * Custom Class MyCallbacks() Definition
+ * ----------------------------------------------------------------------------
+*/
+class MyCallbacks : public BLEServerCallbacks {
+ public:
+ void onConnect(BLEServer* pServer);
+ void onDisconnect(BLEServer* pServer);
+};
+
+#endif // BLEIntegration.h
\ No newline at end of file
diff --git a/src/CustomDebugging.cpp b/src/CustomDebugging.cpp
new file mode 100644
index 0000000..1748913
--- /dev/null
+++ b/src/CustomDebugging.cpp
@@ -0,0 +1,17 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: CustomDebugging.cpp
+ Purpose: See CutomDebugging.h
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: See CustomDebugging.h
+******************************************v1.0.0****************************************************/
+
+#include "CustomDebugging.h"
+
+/*-----------------------------------------------------------------------------
+ * ONLY for Debugging Purpose!
+ * File is reserverd for further Debugging Features - if necessary!
+ * ----------------------------------------------------------------------------
+*/
diff --git a/src/CustomDebugging.h b/src/CustomDebugging.h
new file mode 100644
index 0000000..e34caf8
--- /dev/null
+++ b/src/CustomDebugging.h
@@ -0,0 +1,58 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: CustomDebugging.h
+ Purpose: CutomDebugging.h File for Debugging of TurningTurnTable Project
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef CUSTOMDEBUGGING_H
+#define CUSTOMDEBUGGING_H
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+
+#include
+
+
+/*-----------------------------------------------------------------------------
+ * Debugging Serial Declaration
+ * ----------------------------------------------------------------------------
+*/
+
+// Defining DEBUG Output Level for Console
+#ifdef SERIAL_OUTPUT_DEBUGGING
+ #define DEBUG_SERIAL Serial
+#else
+ #define DEBUG_SERIAL if(0) Serial
+#endif
+
+// Defining INFORMATION Output Level for Console
+#ifdef SERIAL_OUTPUT_INFORMATION
+ #define DEBUG_SERIAL_INFORMATION Serial
+#else
+ #define DEBUG_SERIAL_INFORMATION if(0) Serial
+#endif
+
+// Several More Debug Levels are Possible e.g.
+// #define DEBUG_SERIAL_Information if(SERIAL_OUTPUT_DEBUGGING)Serial
+
+/*-----------------------------------------------------------------------------
+ * Function Header Declaration
+ * ----------------------------------------------------------------------------
+*/
+
+
+#endif // CustomDebugging.h
\ No newline at end of file
diff --git a/src/OLEDIntegration.cpp b/src/OLEDIntegration.cpp
new file mode 100644
index 0000000..4510c42
--- /dev/null
+++ b/src/OLEDIntegration.cpp
@@ -0,0 +1,529 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: OLEDIntegration.cpp
+ Purpose: See OLEDIntegration.h
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: See OLEDIntegration.h
+******************************************v1.0.0****************************************************/
+
+#include "OLEDIntegration.h"
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Variables
+ * ----------------------------------------------------------------------------
+*/
+// Setup OLED Display
+U8G2_SH1106_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);
+
+// Setup Global Menu Variable
+int selectedMenu = MENUMAIN;
+
+// Extern Defined char* Variable because of Change during Runtime to Actual Value
+const char* menuSTEPaCC_items[NUM_MENUSTEPACC_ITEMS]{
+ placeHolder,
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+const char* menuSTEPvEL_items[NUM_MENUSTEPVEL_ITEMS]{
+ placeHolder,
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+const char* menuPicDelay_items[NUM_MENUPICDEL_ITEMS]{
+ placeHolder,
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+/*-----------------------------------------------------------------------------
+ * OLEDSetup() Function with Logo and "Hello" call at Startup
+ * ----------------------------------------------------------------------------
+*/
+void OLEDSetup(void){
+ /* Display Specific Sourcecode */
+ u8g2.begin();
+ u8g2.clearBuffer();
+
+ u8g2.firstPage();
+ do {
+ u8g2.drawHLine(10,0,108);
+ u8g2.drawHLine(10,63,108);
+
+ u8g2.setFont(u8g2_font_ncenB10_tr);
+ u8g2.drawStr(10,24,"TurnTable");
+ u8g2.drawStr(10,24+12, "by");
+ u8g2.drawStr(10,24+24, "Jojo1220");
+
+ } while ( u8g2.nextPage() );
+
+} // OLEDSetup()
+
+/*-----------------------------------------------------------------------------
+ * OLEDMainMenu() Function for Menu Navigation called with seperate Task Function
+ * ----------------------------------------------------------------------------
+*/
+void OLEDMainMenu(int _selected, float* _parMaxSpeed, float* _parAccel){
+ bool updated = false;
+ u8g2.firstPage();
+ do {
+ u8g2.setFont(u8g2_font_ncenB10_tr);
+
+ // Set MAX Shown Menu Entrys depending on MaxMenuCount() Elements from given const list
+ int i_max = 0;
+ if(getMaxMenuCount() < MAX_SHOWN_MENU_Entrys){
+ i_max = getMaxMenuCount();
+ }else{
+ i_max = MAX_SHOWN_MENU_Entrys;
+ }
+
+ // within the For LOOP the Menu Items are placed dynamically!
+ // Menu Header & Design is done after this for loop!
+ if((getMenuSelected() != MENUACCSETTING) && (getMenuSelected() != MENUSPEEDSETTING) && (getMenuSelected() != MENUPICDELAYSETTING)){
+ for(int i = 0; i> Draw a Frame on the Menu-Item
+ if(menuItemIndex == _selected) {
+ // set Font == BOLT
+ u8g2.setFontMode(1);
+ u8g2.drawFrame(0, 20 + 16 * i, u8g2.getDisplayWidth(), 16);
+ }else{
+ // set Font to NORMAL
+ u8g2.setFontMode(0);
+ }
+ if(getMenuSelected() == MENUMAIN){
+ u8g2.drawStr(5, 32 + 16 * i, menuMAIN_items[menuItemIndex]);
+ }else if(getMenuSelected() == MENUAUTOMODE){
+ u8g2.drawStr(5, 32 + 16 * i, menuAutoMode_items[menuItemIndex]);
+ }else if(getMenuSelected() == MENUHANDMODE){
+ u8g2.drawStr(5, 32 + 16 * i, menuHandMode_items[menuItemIndex]);
+ }else if(getMenuSelected() == MENUSETTINGS){
+ u8g2.drawStr(5, 32 + 16 * i, menuSETTINGS_items[menuItemIndex]);
+ }else if(getMenuSelected() == MENUAUTOMODESETTINGS){
+ u8g2.drawStr(5, 32 + 16 * i, menuAtuoModeSettings_items[menuItemIndex]);
+ }/*else if(getMenuSelected() == MENUACCSETTING){
+ Not in Menu Settings Included!
+ }*//*else if(getMenuSelected() == MENUSPEEDSETTING){
+ Not in Menu Settings Included!
+ }*/else if(getMenuSelected() == MENUTESTSCREENSHOT){
+ u8g2.drawStr(5, 32 + 16 * i, menuTestBLEScreens_items[menuItemIndex]);
+ }else if(getMenuSelected() == MENUAUTOMODESTEPPERANGLE){
+ u8g2.drawStr(5, 32 + 16 * i, menuStepperAngle_items[menuItemIndex]);
+ }else if(getMenuSelected() == MENUPICTUREDELAY){
+
+ if((strcmp(menuPicDelay_items[menuItemIndex], placeHolder) == 0)){
+ // Set the Cursor, based on Menu Item Number called
+ u8g2.setCursor(5, 32 + 16 * i);
+ u8g2.print(systemParameters.pictureDelay,10);
+ u8g2.print(" ms");
+ }else{
+ u8g2.drawStr(5, 32 + 16 * i, menuPicDelay_items[menuItemIndex]);
+ }
+
+ }else if(getMenuSelected() == MENUACCELERATION){
+
+ if((strcmp(menuSTEPaCC_items[menuItemIndex], placeHolder) == 0)){
+ // Set the Cursor, based on Menu Item Number called
+ u8g2.setCursor(5, 32 + 16 * i);
+ u8g2.print(systemParameters.maxStepperAccel,1);
+ u8g2.print(" steps/s2");
+ }else{
+ u8g2.drawStr(5, 32 + 16 * i, menuSTEPaCC_items[menuItemIndex]);
+ }
+
+ }else if(getMenuSelected() == MENUSPEED){
+ if((strcmp(menuSTEPvEL_items[menuItemIndex], placeHolder) == 0)){
+ // Set the Cursor, based on Menu Item Number called
+ u8g2.setCursor(5, 32 + 16 * i);
+ u8g2.print(systemParameters.maxStepperSpeed,1);
+ u8g2.print(" steps/s");
+ }else{
+ u8g2.drawStr(5, 32 + 16 * i, menuSTEPvEL_items[menuItemIndex]);
+ }
+ }
+ }
+ }
+ // Set Display Header & Parameter Changes here:
+ if(getMenuSelected() == MENUMAIN){
+ u8g2.drawStr(5, 12, menuMAIN_Header);
+ }else if(getMenuSelected() == MENUSETTINGS){
+ u8g2.drawStr(5, 12, menuSETTINGS_Header);
+ }else if(getMenuSelected() == MENUAUTOMODE){
+ u8g2.drawStr(5, 12, menuAutoMode_Header);
+ }else if(getMenuSelected() == MENUHANDMODE){
+ u8g2.drawStr(5, 12, menuHandMode_Header);
+ } else if(getMenuSelected() == MENUACCSETTING){
+ u8g2.drawStr(5, 12, menuAccSettings_Header);
+ if(!updated){
+ systemParameters.maxStepperAccel = systemParameters.maxStepperAccel + _selected;
+ if(systemParameters.maxStepperAccel < MINSTEPPERACCELERATION){
+ systemParameters.maxStepperAccel = MINSTEPPERACCELERATION;
+ }else if(systemParameters.maxStepperAccel > MAXSTEPPERACCELERATION){
+ systemParameters.maxStepperAccel = MAXSTEPPERACCELERATION;
+ }
+ updated = true; // Set Parameter Update to TRUE
+ }
+ u8g2.setCursor(5,32);
+ u8g2.print(systemParameters.maxStepperAccel,1);
+ u8g2.print(" steps/s2");
+ }else if(getMenuSelected() == MENUSPEEDSETTING){
+ u8g2.drawStr(5, 12, menuVelSettings_Header);
+ if(!updated){
+ systemParameters.maxStepperSpeed = systemParameters.maxStepperSpeed + _selected;
+ if(systemParameters.maxStepperSpeed < MINSTEPPERSPEED){
+ systemParameters.maxStepperSpeed = MINSTEPPERSPEED;
+ }else if(systemParameters.maxStepperSpeed > MAXSTEPPERSPEED){
+ systemParameters.maxStepperSpeed = MAXSTEPPERSPEED;
+ }
+ updated = true; // Set Parameter Update to TRUE
+ }
+ u8g2.setCursor(5,32);
+ u8g2.print(systemParameters.maxStepperSpeed,1);
+ u8g2.print(" steps/s");
+ }else if(getMenuSelected() == MENUTESTSCREENSHOT){
+ u8g2.drawStr(5, 12, menuTestBLEScreens_Header);
+ }else if(getMenuSelected() == MENUSPEED){
+ u8g2.drawStr(5, 12, menuSpeed_Header);
+ }else if(getMenuSelected() == MENUAUTOMODESETTINGS){
+ u8g2.drawStr(5, 12, menuAutoModeSettings_Header);
+ }else if(getMenuSelected() == MENUACCELERATION){
+ u8g2.drawStr(5, 12, menuAccSettings_Header);
+ }else if(getMenuSelected() == MENUAUTOMODESTEPPERANGLE){
+ u8g2.drawStr(5, 12, menuStepperAngle_Header);
+ }else if(getMenuSelected() == MENUPICTUREDELAY){
+ u8g2.drawStr(5,12, menuPicDelay_Header);
+ }else if(getMenuSelected() == MENUPICDELAYSETTING){
+ u8g2.drawStr(5, 12, menuPictureDelay_Header);
+ if(!updated){
+ systemParameters.pictureDelay = systemParameters.pictureDelay + _selected;
+ if(systemParameters.pictureDelay < MINPICTUREDELAY){
+ systemParameters.pictureDelay = MINPICTUREDELAY;
+ }else if(systemParameters.pictureDelay > MAXDPICTUREDELAY){
+ systemParameters.pictureDelay = MAXDPICTUREDELAY;
+ }
+ updated = true; // Set Parameter Update to TRUE
+ }
+ u8g2.setCursor(5,32);
+ u8g2.print(systemParameters.pictureDelay,10);
+ u8g2.print(" ms");
+ }
+ // Corner Illumination Effect:
+ // Left UP
+ u8g2.drawLine(0, 0, 5, 0);
+ u8g2.drawLine(0, 0, 0, 5);
+
+ // Right UP
+ u8g2.drawLine(122, 0, 127, 0);
+ u8g2.drawLine(127, 0, 127, 5);
+
+ // Left DOWN
+ u8g2.drawLine(0, 58, 0, 63);
+ u8g2.drawLine(0, 63, 5, 63);
+
+ // Right DOWN
+ u8g2.drawLine(122, 63, 127, 63);
+ u8g2.drawLine(127, 63, 127, 58);
+
+ } while (u8g2.nextPage());
+
+} // OLEDMainMenu()
+
+/*-----------------------------------------------------------------------------
+ * MenuSelector() Function for determining which Menu Item is selected
+ * ----------------------------------------------------------------------------
+*/
+void MenuSelector(int _value, bool* _spacingTriggerd, long* _StepperWay, bool* _StartAutoMode, bool* _hitBLEScreenshot, long* _way, bool* _StepperRunning, int* _InfiniteMode){
+
+ /* Definition if MAINMenu has changed
+ */
+ if((getMenuSelected() == MENUMAIN) && _value == 0){
+ setMenuSelected(MENUAUTOMODE);
+ }else if((getMenuSelected() == MENUMAIN)&& _value == 1){
+ setMenuSelected(MENUHANDMODE);
+ }else if((getMenuSelected() == MENUMAIN)&& _value == 2){
+ setMenuSelected(MENUSETTINGS);
+ }else if((getMenuSelected() == MENUMAIN)&& _value == 3){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if SubMenu MainMenu -->> MENUAUTOMODE has changed
+ */
+ else if((getMenuSelected() == MENUAUTOMODE) && _value == 0){
+ DEBUG_SERIAL.println("Start Auto-Prozess");
+ *_InfiniteMode = 3;
+ *_StartAutoMode = true;
+ }else if((getMenuSelected() == MENUAUTOMODE) && _value == 1){
+ DEBUG_SERIAL.println("STOPP Auto-Prozess");
+ *_InfiniteMode = 3;
+ *_StartAutoMode = false;
+ }else if((getMenuSelected() == MENUAUTOMODE) && _value == 2){
+ setMenuSelected(MENUMAIN);
+ }else if((getMenuSelected() == MENUAUTOMODE) && _value == 3){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if Submenu MainMenu -->> HAND-Mode has changed
+ */
+ else if((getMenuSelected() == MENUHANDMODE) && _value == 0){
+ //DEBUG_SERIAL.println("Positive Infinite Mode started!");
+ *_InfiniteMode = 1;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 1){
+ *_way = TURNQUART;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 2){
+ *_way = TURNSIXTE;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 3){
+ *_way = TURNSIXTY;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 4){
+ *_way = -TURNSIXTY;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 5){
+ *_way = -TURNSIXTE;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 6){
+ *_way = -TURNQUART;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 7){
+ //DEBUG_SERIAL.println("Negative Infinite Mode started!");
+ *_InfiniteMode = 2;
+ *_StepperRunning = false;
+ *_spacingTriggerd = true; // Quite annoying solution to avoid display Update during Hand Mode
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 8){
+ *_InfiniteMode = 3;
+ setMenuSelected(MENUMAIN);
+ }else if((getMenuSelected() == MENUHANDMODE) && _value == 9){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if SubMenu MainMenu -->> SETTINGS has changed
+ */
+ else if((getMenuSelected() == MENUSETTINGS) && _value == 0){
+ setMenuSelected(MENUAUTOMODESETTINGS);
+ }else if((getMenuSelected() == MENUSETTINGS) && _value == 1){
+ setMenuSelected(MENUACCELERATION);
+ }else if((getMenuSelected() == MENUSETTINGS) && _value == 2){
+ setMenuSelected(MENUSPEED);
+ }else if((getMenuSelected() == MENUSETTINGS) && _value == 3){
+ setMenuSelected(MENUMAIN);
+ }else if((getMenuSelected() == MENUSETTINGS) && _value == 4){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if SubMenu MainMenu -->> Settings -->> MENUAUTOMODESETTINGS has changed
+ */
+ else if((getMenuSelected() == MENUAUTOMODESETTINGS) && _value == 0){
+ setMenuSelected(MENUAUTOMODESTEPPERANGLE);
+ }else if((getMenuSelected() == MENUAUTOMODESETTINGS) && _value == 1){
+ setMenuSelected(MENUTESTSCREENSHOT);
+ }else if((getMenuSelected() == MENUAUTOMODESETTINGS) && _value == 2){
+ setMenuSelected(MENUPICTUREDELAY);
+ } else if((getMenuSelected() == MENUAUTOMODESETTINGS) && _value == 3){
+ setMenuSelected(MENUSETTINGS);
+ }else if((getMenuSelected() == MENUAUTOMODESETTINGS) && _value == 4){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if SubMenu MainMenu -->> Settings -->> MENUACCELERATION has changed
+ */
+ else if((getMenuSelected() == MENUACCELERATION) && _value == 0){
+ setMenuSelected(MENUACCSETTING);
+ }else if((getMenuSelected() == MENUACCELERATION) && _value == 1){
+ setMenuSelected(MENUSETTINGS);
+ }else if((getMenuSelected() == MENUACCELERATION) && _value == 2){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if SubMenu MainMenu -->> Settings -->> MENUSPEED has changed
+ */
+ else if((getMenuSelected() == MENUSPEED) && _value == 0){
+ setMenuSelected(MENUSPEEDSETTING);
+ }else if((getMenuSelected() == MENUSPEED) && _value == 1){
+ setMenuSelected(MENUSETTINGS);
+ }else if((getMenuSelected() == MENUSPEED) && _value == 2){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Set Stepper Acc. if Submenu MainMenu -->> Settings -->> MENUACCELERATION -->> MENUACCSETTINGS
+ */
+ else if((getMenuSelected() == MENUACCSETTING)){
+
+ preferencesBegin();
+ preferences.putFloat(MAXACC_KEY, systemParameters.maxStepperAccel);
+ preferences.end();
+
+ setMenuSelected(MENUACCELERATION);
+ }
+ /* Set Stepper Velocity if Submenu MainMenu -->> Settings -->> MENUSPEED -->> MENUSPEEDSETTING
+ */
+ else if((getMenuSelected() == MENUSPEEDSETTING)){
+
+ preferencesBegin();
+ preferences.putFloat(MAXVEL_KEY, systemParameters.maxStepperSpeed);
+ preferences.end();
+
+ setMenuSelected(MENUSPEED);
+ }
+ /* Definition if Submenu MainMenu ->> Settings -->> MenuAutoModeSettings -->> TEST BLE Screenshot Function
+ */
+ else if((getMenuSelected() == MENUTESTSCREENSHOT) && _value == 0){
+ *_hitBLEScreenshot = true;
+ }else if((getMenuSelected() == MENUTESTSCREENSHOT) && _value == 1){
+ setMenuSelected(MENUAUTOMODESETTINGS);
+ }else if((getMenuSelected() == MENUTESTSCREENSHOT) && _value == 2){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if Submenu MainMenu ->> Settings -->> MenuAutoModeSettings -->> AutoModeStepperAngle
+ */
+ else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 0){
+ *_StepperWay = TURNFULL; // Stepper Angle Selected: 1: 360°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNFULL);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNFULL");
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 1){
+ *_StepperWay = TURNHALF; // Stepper Angle Selected: 2: 180°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNHALF);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNHALF");
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 2){
+ *_StepperWay = TURNQUART; // Stepper Angle Selected: 4: 90°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNQUART);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNQUART");
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 3){
+ *_StepperWay = TURNEIGHT; // Stepper Angle Selected: 8: 45°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNEIGHT);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNEIGHT");
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 4){
+ *_StepperWay = TURNSIXTE; // Stepper Angle Selected: 16: 22,5°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNSIXTE);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNSIXTE");
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 5){
+ *_StepperWay = TURNTHIRT; // Stepper Angle Selected: 32: 11,25°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNTHIRT);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNTHIRT");
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 6){
+ *_StepperWay = TURNSIXTY; // Stepper Angle Selected: 64: 5,625°
+
+ preferencesBegin();
+ preferences.putLong(STEPCOUNT_KEY, TURNSIXTY);
+ preferences.end();
+
+ DEBUG_SERIAL.println("TURNSIXTY") ;
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 7){
+ setMenuSelected(MENUAUTOMODESETTINGS);
+ }else if((getMenuSelected() == MENUAUTOMODESTEPPERANGLE) && _value == 8){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Definition if Submenu MainMenu ->> Settings -->> MenuAutoModeSettings -->> PictureDelay
+ */else if((getMenuSelected() == MENUPICTUREDELAY) && _value == 0){
+ setMenuSelected(MENUPICDELAYSETTING);
+ }else if((getMenuSelected() == MENUPICTUREDELAY) && _value == 1){
+ setMenuSelected(MENUAUTOMODESETTINGS);
+ }else if((getMenuSelected() == MENUPICTUREDELAY) && _value == 2){
+ // Do Nothing -->> It is only for spacing!
+ *_spacingTriggerd = true;
+ }
+ /* Set Picture Delay if Submenu MainMenu -->> Settings -->> AutoModeSettings -->> MENUPICTUREDELAY -->> MENUPICDELAYSETTING
+ */
+ else if((getMenuSelected() == MENUPICDELAYSETTING)){
+
+ preferencesBegin();
+ preferences.putULong(PICDELAY_KEY, systemParameters.pictureDelay);
+ preferences.end();
+
+ setMenuSelected(MENUPICTUREDELAY);
+ }
+} // MenuSelector()
+
+
+/*-----------------------------------------------------------------------------
+ * setMenuSelected() Function to set selected Item:
+ * After this function call, the OLED needs to be actualized by calling Task
+ * Function MenuSelector()
+ * ----------------------------------------------------------------------------
+*/
+void setMenuSelected(int _value){
+ selectedMenu = _value;
+
+ // Refresh OLED Menu after slectedMenu has been changed
+}
+
+/*-----------------------------------------------------------------------------
+ * getMenuSelected() Function give back the selected Item
+ * ----------------------------------------------------------------------------
+*/
+int getMenuSelected(void){
+ return selectedMenu;
+}
+
+/*-----------------------------------------------------------------------------
+ * getMaxMenuCount() Function for getting Back MAX. Count of Menu Items selected
+ * ----------------------------------------------------------------------------
+*/
+int getMaxMenuCount(void){
+ if(selectedMenu == MENUMAIN){
+ return NUM_MENUMAIN_ITEMS;
+ }else if(selectedMenu == MENUAUTOMODE){
+ return NUM_MENUAutoMode_ITEMS;
+ }else if(selectedMenu == MENUHANDMODE){
+ return NUM_MENUHandMode_ITEMS;
+ }else if(selectedMenu == MENUSETTINGS){
+ return NUM_MENUSETTINGS_ITEMS;
+ }else if(selectedMenu == MENUACCELERATION){
+ return NUM_MENUSTEPACC_ITEMS;
+ }else if(selectedMenu == MENUAUTOMODESETTINGS){
+ return NUM_MENUAutoModeSettings_ITEMS;
+ }else if(selectedMenu == MENUACCSETTING){
+ return NUM_MENUAccSettings_ITEMS;
+ }else if(selectedMenu == MENUSPEEDSETTING){
+ return NUM_MENUVelSettings_ITEMS;
+ }else if(selectedMenu == MENUTESTSCREENSHOT){
+ return NUM_MENUTestBLEScreens_ITEMS;
+ }else if(selectedMenu == MENUAUTOMODESTEPPERANGLE){
+ return NUM_MENUStepperAngle_ITEMS;
+ }else if(selectedMenu == MENUSPEED){
+ return NUM_MENUSTEPVEL_ITEMS;
+ }else if(selectedMenu == MENUPICTUREDELAY){
+ return NUM_MENUPICDEL_ITEMS;
+ }else if(selectedMenu == MENUPICDELAYSETTING){
+ return NUM_MENUPICTUREDELAY_ITEMS;
+ }
+ return 0;
+}
diff --git a/src/OLEDIntegration.h b/src/OLEDIntegration.h
new file mode 100644
index 0000000..90b4477
--- /dev/null
+++ b/src/OLEDIntegration.h
@@ -0,0 +1,187 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: OLEDIntegration.h
+ Purpose: OLEDIntegration.h File of TurningTurnTable Project containing Display Setup/Update functions
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef OLEDINTEGRATION_H
+#define OLEDINTEGRATION_H
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+
+#include
+#include "CustomDebugging.h"
+#include "TurningTurnTablePARAMETERS.h"
+#include "TurningTurntable.h"
+#include "pins.h"
+
+// Including Wire.h because of I2C-Oled Display!
+// If other Display is used, include SPI Libary!
+#ifdef U8X8_HAVE_HW_SPI
+ #include
+#endif
+#ifdef U8X8_HAVE_HW_I2C
+ #include
+#endif
+
+
+/*-----------------------------------------------------------------------------
+ * Function Header Definition
+ * ----------------------------------------------------------------------------
+*/
+void OLEDSetup(void);
+void MenuSelector(int _value, bool* _spacingTriggerd, long* _StepperWay, bool* _StartAutoMode, bool* _hitBLEScreenshot, long* _way, bool* _StepperRunning, int* _InfiniteMode);
+void OLEDMainMenu(int _selected, float* _parMaxSpeed, float* _parAccel);
+
+void setMenuSelected(int _value);
+int getMenuSelected(void);
+int getMaxMenuCount(void);
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Constants
+ * ----------------------------------------------------------------------------
+*/
+
+// Placeholder Constant for dynamic Parameters
+static const char* placeHolder = "___VALUE___";
+
+// Main Menu String Configuration
+//#define MENUMAIN 0
+static const uint8_t NUM_MENUMAIN_ITEMS = 4;
+static const char* menuMAIN_Header = ">>Main Menu<<";
+static const char* menuMAIN_items[NUM_MENUMAIN_ITEMS] = {
+ "Auto Mode",
+ "Hand Mode",
+ "Settings",
+ "- - - - - - - - - -",
+};
+
+// Auto-Mode Settings Menu
+//#define MENUAUTOMODE 10
+static const uint8_t NUM_MENUAutoMode_ITEMS = 4;
+static const char* menuAutoMode_Header = ">>Auto Mode<<";
+static const char* menuAutoMode_items[NUM_MENUAutoMode_ITEMS] = {
+ "START",
+ "STOPP",
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+// Hand-Mode Settings Menu
+//#define MENUHANDMODE 11
+static const uint8_t NUM_MENUHandMode_ITEMS = 10;
+static const char* menuHandMode_Header = ">>Hand Mode<<";
+static const char* menuHandMode_items[NUM_MENUHandMode_ITEMS] = {
+ "+ INF",
+ "+ 1/4 Turn",
+ "+ 1/16 Turn",
+ "+ 1/64 Turn",
+ "- 1/64 Turn",
+ "- 1/16 Turn",
+ "- 1/4 Turn",
+ "- INF",
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+// Settings Menu String Configuration
+//#define MENUSETTINGS 12
+static const uint8_t NUM_MENUSETTINGS_ITEMS = 5;
+static const char* menuSETTINGS_Header = ">>Settings<<";
+static const char* menuSETTINGS_items[NUM_MENUSETTINGS_ITEMS] = {
+ "Auto Mode",
+ "Stepper Acceleration",
+ "Stepper Max. Speed",
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+// Stepper Acceleration String Configuration
+//#define MENUACCELERATION 100
+static const uint8_t NUM_MENUSTEPACC_ITEMS = 3;
+static const char* menuAcceleration_Header = ">>Stepper Acc.<<";
+extern const char* menuSTEPaCC_items[NUM_MENUSTEPACC_ITEMS];
+
+// Others String Configuration
+//#define MENUSPEED 101
+static const uint8_t NUM_MENUSTEPVEL_ITEMS = 3;
+static const char* menuSpeed_Header = ">>Stepper Vel.<<";
+extern const char* menuSTEPvEL_items[NUM_MENUSTEPVEL_ITEMS];
+
+// Automatic Mode Menu String Configuration
+//#define MENUAUTOMODESETTINGS 102
+static const uint8_t NUM_MENUAutoModeSettings_ITEMS = 5;
+static const char* menuAutoModeSettings_Header = ">>Auto Settings<<";
+static const char* menuAtuoModeSettings_items[NUM_MENUAutoModeSettings_ITEMS] = {
+ "Stepper Angle",
+ "Test Camera",
+ "Pic. Delay",
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+// Stepper Acceleration Setting String Configuration
+//#define MENUACCSETTING 1000
+static const uint8_t NUM_MENUAccSettings_ITEMS = 1;
+static const char* menuAccSettings_Header = ">>Set Acc. Stepper<<";
+
+
+// Stepper Speed Setting String Configuration
+//#define MENUSPEEDSETTING 1001
+static const uint8_t NUM_MENUVelSettings_ITEMS = 1;
+static const char* menuVelSettings_Header = ">>Set Vel. Stepper<<";
+
+
+// Test Screenshot Funciton
+//#define MENUTESTSCREENSHOT 1002
+static const uint8_t NUM_MENUTestBLEScreens_ITEMS = 3;
+static const char* menuTestBLEScreens_Header = ">>Test BLE Screens.<<";
+static const char* menuTestBLEScreens_items[NUM_MENUTestBLEScreens_ITEMS] = {
+ "Test Screens.",
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+// Stepper Angles Menu String Configuration
+//#define MENUAUTOMODESTEPPERANGLE 1003
+static const uint8_t NUM_MENUStepperAngle_ITEMS = 9;
+static const char* menuStepperAngle_Header = ">>Stepper Angle<<";
+static const char* menuStepperAngle_items[NUM_MENUStepperAngle_ITEMS] = {
+ " 1: 360°",
+ " 2; 180°",
+ " 4: 90°",
+ " 8: 45°",
+ "16: 22,5°",
+ "32: 11,25°",
+ "64: 5,625",
+ "<< BACK",
+ "- - - - - - - - - -"
+};
+
+// Others String Configuration
+//#define MENUPICTUREDELAY 1004
+static const uint8_t NUM_MENUPICDEL_ITEMS = 3;
+static const char* menuPicDelay_Header = ">>Pic. Delay<<";
+extern const char* menuPicDelay_items[NUM_MENUPICDEL_ITEMS];
+
+// Stepper Speed Setting String Configuration
+//#define MENUPICDELAYSETTING 1005
+static const uint8_t NUM_MENUPICTUREDELAY_ITEMS = 1;
+static const char* menuPictureDelay_Header = ">>Set Pic. Delay<<";
+
+#endif // OLEDIntegration.h
diff --git a/src/PinControl.cpp b/src/PinControl.cpp
new file mode 100644
index 0000000..02d61f7
--- /dev/null
+++ b/src/PinControl.cpp
@@ -0,0 +1,123 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: PinControl.cpp
+ Purpose: See PinControl.h
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: See PinControl.h
+******************************************v1.0.0****************************************************/
+
+#include "PinControl.h"
+
+/*-----------------------------------------------------------------------------
+ * digitalFASTRead(): Function to read a GPIO Pin State as fast alternative to digitalRead()
+ * ----------------------------------------------------------------------------
+*/
+int digitalFASTRead(uint8_t pin) {
+ if (pin < 0 || pin >= 40) {
+ // Pinnumber outside of valid area!
+ return false;
+ }
+
+ uint32_t bit = digitalPinToBitMask(pin);
+ uint32_t port = digitalPinToPort(pin);
+
+ if (port == NOT_A_PIN) {
+ // Invalid Pinnumber
+ return false;
+ }
+
+ // Pointer on GPIO-Register
+ volatile uint32_t *reg = portInputRegister(port);
+
+ // Read Pin State
+ bool state = ((*reg) & bit) != 0;
+
+ return state;
+}
+
+
+/*-----------------------------------------------------------------------------
+ * digitalFASTWrite(): Function to write a GPIO Pin State as fast alternative to digitalwrite()
+ * ----------------------------------------------------------------------------
+*/
+void digitalFASTWrite(uint8_t pin, bool state){
+ if (pin < 0 || pin >= 40) {
+ // Pinnumber outside of valid area!
+ return;
+ }
+
+ if(pin<32)
+ {
+ // Handle Pin 0-32
+ if(state == HIGH){
+ GPIO.out_w1ts = (1 << pin);
+ }else{
+ GPIO.out_w1tc = (1 << pin);
+ }
+ }else if(pin<40)
+ {
+ // Handle pins 32-39 if necessary
+ if(state == HIGH){
+ GPIO.out1_w1ts.val |= (1 << (pin - 32));
+ }else{
+ GPIO.out1_w1tc.val |= (1 << (pin - 32));
+ }
+
+ }else{
+ // WRONG Pin
+ return;
+ }
+}
+
+/*-----------------------------------------------------------------------------
+ * LED::LED(byte pin): Constructor Function of LED Class Instance
+ * ----------------------------------------------------------------------------
+*/
+LED::LED(byte pin){
+ _pin = pin;
+}
+
+/*-----------------------------------------------------------------------------
+ * LED::~LED(): Destructor Function of LED Class Instance
+ * ----------------------------------------------------------------------------
+*/
+LED::~LED(void){
+
+}
+
+/*-----------------------------------------------------------------------------
+ * LED::setup(): Function to Setup LED Class Instance
+ * ----------------------------------------------------------------------------
+*/
+void LED::setup(void){
+ pinMode(_pin, OUTPUT);
+}
+
+/*-----------------------------------------------------------------------------
+ * LED::writeOutput(bool _state): Function to Wirte LED State
+ * ----------------------------------------------------------------------------
+*/
+void LED::writeOutput(bool _state) {
+ digitalFASTWrite(_pin, _state);
+}
+
+/*-----------------------------------------------------------------------------
+ * LED::invertLEDState(): Function to Invert LED State
+ * ----------------------------------------------------------------------------
+*/
+void LED::invertLEDState(void) {
+ digitalFASTWrite(_pin, !digitalFASTRead(_pin));
+}
+
+/*-----------------------------------------------------------------------------
+ * LED::read(): Function to read LED State
+ * ----------------------------------------------------------------------------
+*/
+bool LED::read(void) {
+ return digitalFASTRead(_pin);
+}
+
+
+
diff --git a/src/PinControl.h b/src/PinControl.h
new file mode 100644
index 0000000..e14949e
--- /dev/null
+++ b/src/PinControl.h
@@ -0,0 +1,58 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: PinControl.h
+ Purpose: PinControl.h File of TurningTurnTable Project containing alternative function for controlling pins.
+ Functions like a digitalFASTread()/digitalFASTwrite() Function, compared to the digitalRead()/digitalWrite(), is implemented
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef PINCONTROL_H
+#define PINCONTROL_H
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+
+#include
+
+/*-----------------------------------------------------------------------------
+ * Function Header Definition
+ * ----------------------------------------------------------------------------
+*/
+
+int digitalFASTRead(uint8_t pin);
+void digitalFASTWrite(uint8_t pin, bool state);
+
+/*-----------------------------------------------------------------------------
+ * Class Definition
+ * ----------------------------------------------------------------------------
+*/
+
+/* Class Definition of LED */
+class LED {
+ public:
+ LED(byte pin);
+ ~LED(void);
+
+ void setup(void);
+ void writeOutput(bool _state);
+ void invertLEDState(void);
+ bool read(void);
+
+ private:
+ byte _pin;
+};
+
+#endif // PinControl.h
\ No newline at end of file
diff --git a/src/StepperControl.cpp b/src/StepperControl.cpp
new file mode 100644
index 0000000..d078445
--- /dev/null
+++ b/src/StepperControl.cpp
@@ -0,0 +1,184 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: StepperControl.cpp
+ Purpose: See StepperControl.h
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: See StepperControl.h
+******************************************v1.0.0****************************************************/
+
+#include "StepperControl.h"
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::StepperControl() Constructor Function (4Pins only)
+ * ----------------------------------------------------------------------------
+*/
+StepperControl::StepperControl(int Pin1, int Pin2, int Pin3, int Pin4){
+ _initStepper(Pin1, Pin2, Pin3, Pin4);
+};
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::StepperControl() Constructor Function (4Pins + Speed&Acceleration Parameters)
+ * ----------------------------------------------------------------------------
+*/
+StepperControl::StepperControl(int Pin1, int Pin2, int Pin3, int Pin4, float maxSpeed, float Acceleration){
+ _initStepper(Pin1, Pin2, Pin3, Pin4);
+ setMaxSpeed(maxSpeed);
+ setAcceleration(Acceleration);
+ DEBUG_SERIAL.print("[Stepper] Initialized! \tSpeed: ");
+ DEBUG_SERIAL.print(maxSpeed);
+ DEBUG_SERIAL.print("\tAcceleration: ");
+ DEBUG_SERIAL.println(Acceleration);
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::~StepperControl() Destructor Function
+ * ----------------------------------------------------------------------------
+*/
+StepperControl::~StepperControl(){
+ _Stepper->~AccelStepper();
+ delete _Stepper;
+};
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::runToPosition() Run to Position
+ * ----------------------------------------------------------------------------
+*/
+bool StepperControl::runToPosition(long absolut, bool processActive){
+
+ // Checking, if loaded Position is unequal private Class Position
+ // If so, enable Stepper Movement to new Position
+
+ if(_positionNEW != absolut){
+ _Stepper->enableOutputs();
+ _Stepper->setCurrentPosition(0);
+ _Stepper->moveTo(absolut);
+ _positionNEW = absolut;
+ }
+
+ // State Machine:
+ // First, Acceleration Phase
+ // Second, Constant Movement Phase
+ // Third, STOP Stepper Movement & Disable Outputs
+ if((_positionNEW > stepperPosition() && _positionNEW >= 0) || (_positionNEW < stepperPosition() && _positionNEW < 0)){
+
+ if((_Stepper->speed() >= _maxSpeed && _positionNEW >= 0) || (abs(_Stepper->speed()) >= _maxSpeed && _positionNEW <0)){
+ _state = RSPD;
+ }
+
+ switch (_state){
+ case RSPD:
+ _Stepper->runSpeed();
+ break;
+ case RJSTR:
+ _Stepper->run();
+ break;
+ default:
+ break;
+ }
+
+ return false;
+ }else{
+ _state = RJSTR;
+ _positionNEW = 0;
+
+ if(!processActive){
+ // Disable Stepper Outputs if NOT Process is active to avoid
+ // Uncontrolled movement during Automatic Process and loss of Steps!
+ _Stepper->disableOutputs();
+ }
+ return true;
+ }
+};
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::motorStop() Stop Stepper Movement and disable Output
+ * ----------------------------------------------------------------------------
+*/
+void StepperControl::motorStop(void){
+ _Stepper->stop();
+ _Stepper->disableOutputs();
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::isStepperRunning() Checking if Stepper is Running
+ * ----------------------------------------------------------------------------
+*/
+bool StepperControl::isStepperRunning(void){
+ return _Stepper->isRunning();
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::stepperPosition() Get current Stepper Position
+ * ----------------------------------------------------------------------------
+*/
+long StepperControl::stepperPosition(void){
+ return _Stepper->currentPosition();
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::setMaxSpeed() Set Max Stepper Speed
+ * ----------------------------------------------------------------------------
+*/
+void StepperControl::setMaxSpeed(float speed){
+ _Stepper->setMaxSpeed(speed);
+ _maxSpeed = speed;
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::getMaxSpeed() Get current Max Speed
+ * ----------------------------------------------------------------------------
+*/
+float StepperControl::getMaxSpeed(void){
+ return _maxSpeed;
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::setAcceleration() set Stepper Acceleration
+ * ----------------------------------------------------------------------------
+*/
+void StepperControl::setAcceleration(float acceleration){
+ _Stepper->setAcceleration(acceleration);
+ _Acceleration = acceleration;
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::getAcceleration() Get current Acceleration
+ * ----------------------------------------------------------------------------
+*/
+float StepperControl::getAcceleration(void){
+ return _Acceleration;
+}
+
+/*-----------------------------------------------------------------------------
+ * Class: StepperControl::_initStepper() Stepper Motor Initialisation Function
+ * ----------------------------------------------------------------------------
+*/
+void StepperControl::_initStepper(int Pin1, int Pin2, int Pin3, int Pin4){
+ // Create NEW AccelStepper Class Object
+ #if StepperOperation == 0
+ _Stepper = new AccelStepper(AccelStepper::FULL4WIRE, Pin1, Pin2, Pin3, Pin4, false);
+ #elif StepperOperation == 1
+ _Stepper = new AccelStepper(AccelStepper::HALF4WIRE, Pin1, Pin2, Pin3, Pin4, false);
+ #elif StepperOperation == 2
+ _Stepper = new AccelStepper(AccelStepper::DRIVER, Pin2, Pin1);
+
+ // Setup Driver Enable Pin
+ _Stepper->setEnablePin(Pin3);
+ _Stepper->setPinsInverted(false, false, true);
+
+ // Setup Remaining Pin as Output and Set it permanent to LOW
+ pinMode(Pin4, OUTPUT);
+ digitalWrite(Pin4, LOW);
+
+ #endif
+
+ // Stopp Stepper after Restart or after Initialisation
+ _Stepper->stop();
+
+ //Init Stepper Position to "0" after Initialization
+ _Stepper->setCurrentPosition(0);
+
+ DEBUG_SERIAL.println("[Stepper] Init Done!");
+}
diff --git a/src/StepperControl.h b/src/StepperControl.h
new file mode 100644
index 0000000..95d0008
--- /dev/null
+++ b/src/StepperControl.h
@@ -0,0 +1,71 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: StepperControl.h
+ Purpose: StepperControl.h File of TurningTurnTable Project containing whole Stepper Interfacing functions
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef STEPPERCONTROL_H
+#define STEPPERCONTROL_H
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+#include
+#include "CustomDebugging.h"
+#include "TurningTurnTablePARAMETERS.h"
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Constants
+ * ----------------------------------------------------------------------------
+*/
+// Definition of Stepper State Machine
+#define RSPD 01 // RUN Stepper with Constant Speed
+#define RJSTR 02 // RUN Stepper with Acceleration/Deacceleration Phase
+#define STOPPED 03 // Stopped
+
+/*-----------------------------------------------------------------------------
+ * Setup custom StepperControl() -- Class
+ * ----------------------------------------------------------------------------
+*/
+class StepperControl{
+ public:
+ StepperControl(int Pin1, int Pin2, int Pin3, int Pin4);
+ StepperControl(int Pin1, int Pin2, int Pin3, int Pin4, float maxSpeed, float Acceleration);
+ ~StepperControl();
+ bool isStepperRunning(void);
+ long stepperPosition(void);
+
+ // Movement Function
+ bool runToPosition(long absolut, bool processActive);
+ void motorStop(void);
+
+ // Setting Motor Parameters to µC
+ void setMaxSpeed(float speed);
+ float getMaxSpeed(void);
+ void setAcceleration(float acceleration);
+ float getAcceleration(void);
+
+ private:
+ void _initStepper(int Pin1, int Pin2, int Pin3, int Pin4);
+ AccelStepper* _Stepper;
+ float _maxSpeed = 0.0;
+ float _Acceleration = 0.0;
+ int _state = RJSTR;
+ unsigned long __msec = millis();
+ long _positionNEW = 0;
+};
+
+#endif //StepperControl.h
\ No newline at end of file
diff --git a/src/TurningTurnTablePARAMETERS.h b/src/TurningTurnTablePARAMETERS.h
new file mode 100644
index 0000000..c194ac4
--- /dev/null
+++ b/src/TurningTurnTablePARAMETERS.h
@@ -0,0 +1,99 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: TurningTurnTablePARAMETERS.h
+ Purpose: TurningTurnTablePARAMETERS.h File of TurningTurnTable Project containing project specific parameters
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef TURNINGTURNTABLEPARAMETERS_H
+#define TURNINGTURNTABLEPARAMETERS_H
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Constants
+ * ----------------------------------------------------------------------------
+*/
+
+// OLED-Specific Project Parameters
+#define MAX_SHOWN_MENU_Entrys 3 // Max Shown Menu Items in OLED Screen
+
+// Menu Definition
+#define MENUMAIN 0 // Main Menu
+ #define MENUAUTOMODE 10 // Submenu to Setup Automatic Mode
+ #define MENUHANDMODE 11 // Submenu to Setup Hand Mode
+ #define MENUSETTINGS 12 // Submenu to Setup Parameters
+ #define MENUACCELERATION 100 // Submenu to Adjust the Stepper Acceleration
+ #define MENUACCSETTING 1000 // Submenu to Adjust the Stepper Rotation "Real"-Acceleration-Value
+ #define MENUSPEED 101 // Menu to Adjust the Stepper Speed
+ #define MENUSPEEDSETTING 1001 // Submenu to Adjust the Stepper Rotation "Real"-Speed-Value
+ #define MENUAUTOMODESETTINGS 102 // Menu to set-up Automatic Mode Parameters
+ #define MENUTESTSCREENSHOT 1002 // Submenu to Test Bluetooth Screenshot function
+ #define MENUAUTOMODESTEPPERANGLE 1003 // Submenu to set Stepper Rotation Angle between Screenshot
+ #define MENUPICTUREDELAY 1004 // Submenu to set the Delay Time between Screenshot
+ #define MENUPICDELAYSETTING 1005 // Submenu to Adjust the Picutre Delay
+
+// Stepper Specific Project Parameters
+#define defaultMAXSPEEDSTEPPER 700.0 // Default Motor Max Speed Parameter
+#define MAXSTEPPERSPEED 2000.0 // Default Motor Max Speed HIGH-Value
+#define MINSTEPPERSPEED 50.0 // Default Motor Min Speed LOW-Value
+#define defaultACCELERATIONSTEPPER 300.0 // Default Motor Acceleration Parameter
+#define MAXSTEPPERACCELERATION 3000.0 // Default Motor Max Acceleration HIGH-Value
+#define MINSTEPPERACCELERATION 10.0 // Default Motor Min Acceleration LOW-Value
+#define defaultPICTUREDELAY 5000 // Default Delay after a Picture is Triggered by BLE
+#define MAXDPICTUREDELAY 10000 // Default Delay MAX Time
+#define MINPICTUREDELAY 1000 // Default delay MIN Time
+
+// Defining Stepper Operation Mode on your specific connection/operation Purpose
+#define StepperOperation 2 // 0 == FULL4WIRE; 1 == HALF4WIRE; 2 == DRIVER Stage with 16 MicroSteps
+
+// Turning Parameters
+#if StepperOperation == 2
+ // Multiplying here, because of 16 Times of Steps within one turn in 1/16 Micro-Mode
+ #define MECHGEARRATIO 16*6.1666667
+#elif StepperOperation == 1
+ // Multiplying here, because of 2 Times of Steps within one turn in Half Mode
+ #define MECHGEARRATIO 2*6.1666667 // Defining Ratio of Mechanical Gear
+#elif StepperOperation == 0
+ #define MECHGEARRATIO 6.1666667 // Defining Ratio of Mechanical Gear
+#endif
+
+#ifdef _28BYJ48
+ #define TURNFULL (MECHGEARRATIO * (long)2048) // Steps for a FULL Revolution -->> 1 Image
+ #define TURNHALF (MECHGEARRATIO * (long)1024) // Steps for a HALF Revolution -->> 2 Images
+ #define TURNQUART (MECHGEARRATIO * (long)512) // Steps for a QUARTER Revolution -->> 4 Images
+ #define TURNEIGHT (MECHGEARRATIO * (long)256) // Steps for a EIGHTS Revolution -->> 8 Images
+ #define TURNSIXTE (MECHGEARRATIO * (long)128) // Steps for a Sixteenth Revolution -->> 16 Images
+ #define TURNTHIRT (MECHGEARRATIO * (long)64) // Steps for a Thirty-Twos Revolution -->> 32 Images
+ #define TURNSIXTY (MECHGEARRATIO * (long)32) // Steps for a Sixty-fourth Revolution -->> 64 Images
+#endif
+
+#ifdef _17HS08
+ #define TURNFULL (MECHGEARRATIO * (long)200) // Steps for a FULL Revolution -->> 1 Image
+ #define TURNHALF (MECHGEARRATIO * (long)100) // Steps for a HALF Revolution -->> 2 Images
+ #define TURNQUART (MECHGEARRATIO * (long)50) // Steps for a QUARTER Revolution -->> 4 Images
+ #define TURNEIGHT (MECHGEARRATIO * (long)25) // Steps for a EIGHTS Revolution -->> 8 Images
+ #define TURNSIXTE (MECHGEARRATIO * (long)12.5) // Steps for a Sixteenth Revolution -->> 16 Images
+ #define TURNTHIRT (MECHGEARRATIO * (long)6.25) // Steps for a Thirty-Twos Revolution -->> 32 Images
+ #define TURNSIXTY (MECHGEARRATIO * (long)3.125) // Steps for a Sixty-fourth Revolution -->> 64 Images
+#endif
+
+// Process Steps for Automatic Mode
+#define STEPDONE 0 // Process Step: Standby
+#define STEPPICTURE 10 // Process Step: Taking a Picture of Object
+#define STEPPICBREAK 20 // Process Step: Break after Sendig Picture CMD to device via BLE
+#define STEPPERMOVE 30 // Process Step: Moving Stepper
+#define STEPPBREAK 40 // Process Step: Break after Stepper-Rotation
+#define STEPCHECK 50 // Process Step: Check if further Rotation is necessary
+#define STEPPSTOPJOB 99 // Process Step: STOP Automatic-Procedure
+
+#endif // TurningTurnTablePARAMETERS.h
diff --git a/src/TurningTurntable.cpp b/src/TurningTurntable.cpp
new file mode 100644
index 0000000..38fce69
--- /dev/null
+++ b/src/TurningTurntable.cpp
@@ -0,0 +1,132 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: TurningTurntable.cpp
+ Purpose: See TurningTurntable.h
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: See TurningTurntable.h
+******************************************v1.0.0****************************************************/
+
+#include "TurningTurntable.h"
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Variables
+ * ----------------------------------------------------------------------------
+*/
+
+// Procject Specific System Parameters Instance
+paramValues systemParameters;
+
+// preferences instance
+Preferences preferences;
+
+// Preferences App Name
+const char *AppName = "mAp";
+
+// key constance or Access key:values within Preferences
+const char* STEPCOUNT_KEY = "StepCount";
+const char* MAXVEL_KEY = "MaxVel";
+const char* MAXACC_KEY = "MaxAcc";
+const char* PICDELAY_KEY = "PicDel";
+
+/*-----------------------------------------------------------------------------
+ * readParameters() from Preferences function
+ * ----------------------------------------------------------------------------
+*/
+paramValues readParameters(void){
+
+ paramValues _data;
+
+ preferencesBegin();
+
+ // Read Stored Project Specific Settings in Preferneces to _data struct
+ _data.steppCount = preferences.getLong(STEPCOUNT_KEY);
+ _data.maxStepperSpeed = preferences.getFloat(MAXVEL_KEY);
+ _data.maxStepperAccel = preferences.getFloat(MAXACC_KEY);
+ _data.pictureDelay = preferences.getULong(PICDELAY_KEY);
+
+ preferences.end();
+
+ // Checking by default brightness Level "0" if so, factory settings has to be defined.
+ if(_data.steppCount == 0){
+ DEBUG_SERIAL.println("[Prefs] not Found! Load Factory Settings!");
+ _data = writeParameters(_data);
+ }
+
+ printParameters(_data);
+ return _data;
+}
+
+/*-----------------------------------------------------------------------------
+ * writeParameters() to Preferences function
+ * ----------------------------------------------------------------------------
+*/
+paramValues writeParameters(paramValues _data){
+ // Setting Default Variables to _data Struct
+ _data.steppCount = TURNSIXTE;
+ _data.maxStepperSpeed = defaultMAXSPEEDSTEPPER;
+ _data.maxStepperAccel = defaultACCELERATIONSTEPPER;
+ _data.pictureDelay = defaultPICTUREDELAY;
+
+ // Wrting Default Values Back to preferences
+ preferencesBegin();
+
+ preferences.putLong(STEPCOUNT_KEY, _data.steppCount);
+ preferences.putFloat(MAXVEL_KEY, _data.maxStepperSpeed);
+ preferences.putFloat(MAXACC_KEY, _data.maxStepperAccel);
+ preferences.putULong(PICDELAY_KEY, _data.pictureDelay);
+
+ preferences.end();
+
+ DEBUG_SERIAL.println("[Prefs] Factory Reset - Done!");
+
+ return _data;
+};
+
+/*-----------------------------------------------------------------------------
+ * printParameters() Parameters print to Console function
+ * ----------------------------------------------------------------------------
+*/
+void printParameters(paramValues _data){
+ DEBUG_SERIAL.print("-------------------------------------------------");
+ DEBUG_SERIAL.print("\nSettings:\tStepps Count during Auto: ");
+ DEBUG_SERIAL.print(_data.steppCount);
+ DEBUG_SERIAL.print("\tStepper max. Speed: ");
+ DEBUG_SERIAL.print(_data.maxStepperSpeed);
+ DEBUG_SERIAL.print("\tStepper max. Acceleration: ");
+ DEBUG_SERIAL.print(_data.maxStepperAccel);
+ DEBUG_SERIAL.print("\tPicture Delay Time: ");
+ DEBUG_SERIAL.print(_data.pictureDelay);
+ DEBUG_SERIAL.println("\n-------------------------------------------------");
+}
+
+/*-----------------------------------------------------------------------------
+ * preferencesBegin() Function with Error Handling
+ * ----------------------------------------------------------------------------
+*/
+void preferencesBegin(void){
+ // Max Attempts for Opening Preferences
+ uint8_t maxAttempts = 10;
+
+ for(uint8_t attempt = 1; attempt <= maxAttempts; attempt++) {
+ if(preferences.begin(AppName, false)) {
+ // Successfull Initialization of Preferences
+ break; // Break-up-Loop
+ }else{
+ for(unsigned long start = millis(); millis() - start < 200;) {
+ yield(); //short yield() back to ESP Firmware
+ }
+ DEBUG_SERIAL.println("[Prefs] Begin!");
+ }
+
+ // If Preferences begin is not possible -->> RESTART!
+ if (attempt == maxAttempts) {
+ DEBUG_SERIAL.println("[Prefs] Setup Error Restart!");
+ #ifndef NATIVE_ENVIRONMENT
+ ESP.restart();
+ #endif
+ }
+ }
+}
+
diff --git a/src/TurningTurntable.h b/src/TurningTurntable.h
new file mode 100644
index 0000000..3271de0
--- /dev/null
+++ b/src/TurningTurntable.h
@@ -0,0 +1,77 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: TurningTurntable.h
+ Purpose: TurningTurntable.h File of TurningTurnTable Project containing project specific stuff, like Read/Write Preferences
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+#ifndef TURNINGTURNTABLE_H
+#define TURNINGTURNTABLE_H
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+#include
+
+#include "CustomDebugging.h"
+#include "TurningTurnTablePARAMETERS.h"
+
+
+/*-----------------------------------------------------------------------------
+ * Setup Custom Structs (Datatyps)
+ * ----------------------------------------------------------------------------
+*/
+// Custom Struct for Remanent Project Specific Parameters
+struct paramValues{
+ long steppCount = 0;
+ float maxStepperSpeed = 0.0;
+ float maxStepperAccel = 0.0;
+ unsigned long pictureDelay = 0;
+};
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Variables
+ * ----------------------------------------------------------------------------
+*/
+
+// Project specific System Parameters
+extern paramValues systemParameters;
+
+// Preferences Object for Remanent adjustable Settings Variables
+extern Preferences preferences;
+
+// Preferences APP Name
+extern const char *AppName;
+
+// Definition of Project Specific Constant Key Char* for Preferences Access
+extern const char* STEPCOUNT_KEY;
+extern const char* MAXVEL_KEY;
+extern const char* MAXACC_KEY;
+extern const char* PICDELAY_KEY;
+
+
+/*-----------------------------------------------------------------------------
+ * Setup Custom Function Headers
+ * ----------------------------------------------------------------------------
+*/
+void printParameters(paramValues _data);
+
+void preferencesBegin(void);
+
+paramValues readParameters(void);
+paramValues writeParameters(paramValues _data);
+
+
+#endif //TurningTurntable.h
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..aee1773
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,521 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: main.cpp
+ Purpose: main.cpp File of TurningTurnTable Project containing setup/loop Function
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Including of Libary Direcotries
+ * ----------------------------------------------------------------------------
+*/
+#include
+#include
+
+#include "TurningTurnTablePARAMETERS.h"
+#include "TurningTurntable.h"
+#include "pins.h"
+#include "StepperControl.h"
+#include "BLEIntegration.h"
+#include "OLEDIntegration.h"
+#include "PinControl.h"
+
+/*-----------------------------------------------------------------------------
+ * Function Headers
+ * ----------------------------------------------------------------------------
+*/
+void toggleScreenshot(void);
+void runStepper(bool _autoModeActive);
+uint8_t updateSteps(long _stepps);
+void updateOLEDTask(void* _value);
+void automaticMode(void);
+void EncoderAcceleration(unsigned long _ms, long* _newPos, int Dir);
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Variables
+ * ----------------------------------------------------------------------------
+*/
+
+TaskHandle_t oledTaskHandler; // OLED Update Task Handler
+TaskHandle_t serverTaskHandler; // Bluetooth Update Task Handler
+
+long newPosition = 0; // Direct Return Value of Encoder
+long moduloValue = 0; // Manipulated Value based on selected Menu
+bool encoderButtonPressed = false;
+bool StepperRunning = false;
+bool HitPicture = false;
+
+int infiniteMode = 0; // Infinite Mode Variable
+
+int Dir_old = 0; // Rotary Encoder Direction
+
+bool StartAutoMode = false;
+
+uint8_t stepAutoMode = STEPDONE; // Step Variable for switch/case in Automatic Mode
+uint8_t CountStepsAuto = 0; // Counting amounts of Step in Automatic Mode
+
+long way = (long)0;
+
+const long roundingWindow = 1; // Rounding Window constant value
+
+unsigned long AsyncBLEBreak = 0;
+
+const unsigned long autoModeDelay = 5000;
+unsigned long AsyncAutoModeBreak = 0;
+
+const unsigned long debounceDelay = 70; // Debounce-Time for Push Buttons [ms]
+unsigned long lastDebounceTime = 0; // Timestamp last valid Push Button state
+
+constexpr float m = 30; // the maximum acceleration is 10 times.
+
+constexpr float longCutoff = 50; // at 200ms or slower, there should be no acceleration. (factor 1)
+
+constexpr float shortCutoff = 5; // at 5 ms, we want to have maximum acceleration (factor m)
+
+// To derive the calc. constants, compute as follows:
+// On an x(ms) - y(factor) plane resolve a linear formular factor(ms) = a * ms + b;
+// where f(4)=10 and f(200)=1
+
+constexpr float a = (m - 1) / (shortCutoff - longCutoff);
+constexpr float b = 1 - longCutoff * a;
+
+#ifdef _28BYJ48
+ StepperControl myStepper(IN1, IN2, IN3, IN4); // Stepper Motor Setup
+#elif _17HS08
+ StepperControl myStepper(IN1, IN3, IN2, IN4); // Stepper Motor Setup
+#else
+ #error "No Stepper model selected!"
+#endif
+
+RotaryEncoder encoder(encoderPinB, encoderPinA, RotaryEncoder::LatchMode::FOUR3); // Encoder Setup
+
+LED BoardLED(ONBoardLED); // Onboard LED
+
+/*-----------------------------------------------------------------------------
+ * Global Setup() Function Call - Running ONCE after Startup
+ * ----------------------------------------------------------------------------
+*/
+void setup() {
+ DEBUG_SERIAL.begin(115200);
+ DEBUG_SERIAL.println("\n");
+ DEBUG_SERIAL.println("--- BOOT ---");
+ DEBUG_SERIAL.println("Turning-TurnTable by Jojo1220");
+ DEBUG_SERIAL_INFORMATION.println(ARDUINO);
+ DEBUG_SERIAL_INFORMATION.println(__FILE__);
+ DEBUG_SERIAL_INFORMATION.print("---------------------------------------");
+ DEBUG_SERIAL_INFORMATION.print("\nESP Chip ID: ");
+ uint32_t id = 0;
+ for(int i=0; i<17; i=i+8) {
+ id |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
+ }
+ DEBUG_SERIAL_INFORMATION.printf("%08X", id);
+ DEBUG_SERIAL_INFORMATION.print("\t Chip Revision: ");
+ DEBUG_SERIAL_INFORMATION.print(ESP.getChipRevision());
+ DEBUG_SERIAL_INFORMATION.print("\t SDK Version: ");
+ DEBUG_SERIAL_INFORMATION.print(ESP.getSdkVersion());
+ DEBUG_SERIAL_INFORMATION.println("\n---------------------------------------");
+
+ // Setup Hardware Pinmode
+ BoardLED.setup();
+ pinMode(encoderPinSW, INPUT_PULLUP);
+
+ //Read Out Preferences Data from NVS
+ systemParameters = readParameters();
+
+ // Writing NVS Called Parameters Back to Class Instance
+ myStepper.setAcceleration(systemParameters.maxStepperAccel);
+ myStepper.setMaxSpeed(systemParameters.maxStepperSpeed);
+
+ // Setup OLED Display with Startup-Screen
+ OLEDSetup();
+
+ //keyboard_report.reportId = 0x02;
+ //consumer_Report.reportId = 0x01;
+ xTaskCreatePinnedToCore(updateOLEDTask, "OLEDUpdate", 30000, &moduloValue, 5, &oledTaskHandler, 0);
+ xTaskCreatePinnedToCore(taskServer, "BLEServer", 20000, NULL, 6, &serverTaskHandler, 1);
+
+ DEBUG_SERIAL.println("--- setup() - DONE ---");
+} //setup()
+
+/*-----------------------------------------------------------------------------
+ * Global Loop() Function Call
+ * ----------------------------------------------------------------------------
+*/
+void loop()
+{
+ // Encoder "Working" - Function Call with FASTRead Operation
+ encoder.tick(digitalFASTRead(encoderPinB), digitalFASTRead(encoderPinA));
+
+ // Encoder Position/Direction Read-Back
+ long newPos = encoder.getPosition();
+ int newDir = (int)encoder.getDirection();
+
+ // Check Automatic Mode of Turning Turntable is Triggered/Active or not
+ automaticMode();
+
+ // Calling Steper-Run-Function often to avoid stocking Stepper
+ runStepper(StartAutoMode);
+
+ // Check, if Screenshot is Polled by Automatic Mode or by Menu
+ if (HitPicture && connected && (millis() > AsyncBLEBreak + systemParameters.pictureDelay))
+ {
+
+ HitPicture = false;
+ AsyncBLEBreak = millis();
+
+ toggleScreenshot();
+
+ }
+
+ // Update Display due to Encoder's new Position
+ if (newPosition != newPos)
+ {
+ newPosition = newPos;
+
+ // Get delay Time between Rotation for Acceleration Mode of Encoder
+ unsigned long ms = encoder.getMillisBetweenRotations();
+
+ // Limiting Encoder Position ONLY in MAX Menu Items and if no Parameter has to be set
+ // Except during Parameter SETUP Mode
+ if ((newPosition > 0) || (getMenuSelected() == MENUACCSETTING) || (getMenuSelected() == MENUSPEEDSETTING) || (getMenuSelected() == MENUPICDELAYSETTING)){
+ if((getMenuSelected() != MENUACCSETTING) && (getMenuSelected() != MENUSPEEDSETTING) && (getMenuSelected() != MENUPICDELAYSETTING)){
+ moduloValue = newPosition % getMaxMenuCount();
+ }else{
+
+ // Get Encoder Direction and Set POS/NEG Value to Encoder + Calculation value
+ if((Dir_old != newDir) && (newDir != 0)){
+ if(newDir < 0){
+ encoder.setPosition(-1);
+ newPosition = -1;
+ //DEBUG_Serial.println("Change NEG Direction!");
+ }else if(newDir > 0){
+ encoder.setPosition(1);
+ newPosition = 1;
+ //DEBUG_Serial.println("Change POS Direction!");
+ }
+ Dir_old = newDir;
+ }
+ // Set Position only to +/- 1 to avoid incremental +/- calculation
+ if(newPosition > 1){
+ encoder.setPosition(1);
+ newPosition = 1;
+ }else if(newPosition < -1){
+ encoder.setPosition(-1);
+ newPosition = -1;
+ }
+
+ // Encoder Value Manipulation based on +/-1 and direct
+ // Value Overload to function.
+ long tempNewPosition = newPosition;
+ EncoderAcceleration(ms, &tempNewPosition, newDir);
+
+ moduloValue = tempNewPosition;
+
+ }
+ }
+ else{
+ moduloValue = 0;
+ newPosition = 0;
+ encoder.setPosition(0);
+ }
+ //DEBUG_Serial.println(moduloValue);
+
+ vTaskResume(oledTaskHandler);
+ }
+
+ // Get Button State of Encoder by FASTRead Function
+ bool CurrentButtonState = !digitalFASTRead(encoderPinSW);
+
+ // Debouncing and Check Button State of Encoder Button if Changed
+ if ((CurrentButtonState != encoderButtonPressed) && ((millis() - lastDebounceTime) > debounceDelay))
+ {
+ // Update Debounce Time and Button State
+ lastDebounceTime = millis();
+ encoderButtonPressed = CurrentButtonState;
+ //DEBUG_Serial.println("Encoder Button pressed!");
+
+ if(encoderButtonPressed){
+ bool spacingTriggerd = false;
+
+ // Calling Menu Update Function and Interact with Pointer-Variables and Main Loop Functions
+ MenuSelector(moduloValue, &spacingTriggerd, &systemParameters.steppCount, &StartAutoMode, &HitPicture, &way, &StepperRunning, &infiniteMode);
+
+ if (!spacingTriggerd)
+ {
+ // If not Menu Spacing have been triggerd, update OLED Screen and Execute Menu Item
+ //DEBUG_Serial.println("Another Task Resum ;)");
+ newPosition = 0;
+ moduloValue = 0;
+ encoder.setPosition(0);
+ vTaskResume(oledTaskHandler);
+ };
+ }
+ }
+
+} // loop()
+
+/*-----------------------------------------------------------------------------
+ * toggleScreenshot Function: Triggers a connected device for making a Screenshot
+ * ----------------------------------------------------------------------------
+*/
+void toggleScreenshot(void){
+ static bool volDirUp = true;
+
+ inputKeyboard_t a{};
+ a.Key = random(0x02,0x27);
+ // a.reportId = 0x02;
+ input->setValue((uint8_t*)&a,sizeof(a));
+ input->notify();
+
+ input->setValue((uint8_t*)(&keyboard_report), sizeof(keyboard_report));
+ input->notify();
+
+ inputConsumer_t b{};
+ // b.reportId = 0x01;
+
+ DEBUG_SERIAL.println("[BLE] CHEEEEESSSSSEEEEEE");
+ b.ConsumerControl = volDirUp ? 0xE9 : 0xEA;
+ volDirUp = volDirUp ? false : true;
+ inputVolume->setValue((uint8_t*)&b,sizeof(b));
+ inputVolume->notify();
+
+ inputVolume->setValue((uint8_t*)&consumer_Report,sizeof(consumer_Report));
+ inputVolume->notify();
+} // toggleScreenshot()
+
+/*-----------------------------------------------------------------------------
+ * Update Steptyp to turn specific angle for Screenshot
+ * ----------------------------------------------------------------------------
+*/
+uint8_t updateSteps(long _stepps)
+{
+ if (((TURNFULL - roundingWindow) <= _stepps) && (_stepps <= (TURNFULL + roundingWindow))){
+ return (uint8_t)1;
+ }else if (((TURNHALF - roundingWindow) <= _stepps) && (_stepps <= (TURNHALF + roundingWindow))){
+ return (uint8_t)2;
+ }else if (((TURNQUART - roundingWindow) <= _stepps) && (_stepps <= (TURNQUART + roundingWindow))){
+ return (uint8_t)4;
+ }else if (((TURNEIGHT - roundingWindow) <= _stepps) && (_stepps <= (TURNEIGHT + roundingWindow))){
+ return (uint8_t)8;
+ }else if (((TURNSIXTE - roundingWindow) <= _stepps) && (_stepps <= (TURNSIXTE + roundingWindow))){
+ return (uint8_t)16;
+ }else if (((TURNTHIRT - roundingWindow) <= _stepps) && (_stepps <= (TURNTHIRT + roundingWindow))){
+ return (uint8_t)32;
+ }else if (((TURNSIXTY - roundingWindow) <= _stepps) && (_stepps <= (TURNSIXTY + roundingWindow))){
+ return (uint8_t)64;
+ }else{
+ return 0;
+ };
+} // updateSteps()
+
+/*-----------------------------------------------------------------------------
+ * runStepper(): Run Stepper to Position -->> Called in LOOP function
+ * ----------------------------------------------------------------------------
+*/
+void runStepper(bool _autoModeActive){
+
+ // Check if Stepper Parameter maxStepperAcceleration has change during runtime
+ if(myStepper.getAcceleration() != systemParameters.maxStepperAccel){
+ myStepper.setAcceleration(systemParameters.maxStepperAccel);
+ }
+
+ // Check if Stepper Parameter maxStepperSpeed has change during runtime
+ if(myStepper.getMaxSpeed() != systemParameters.maxStepperSpeed){
+ myStepper.setMaxSpeed(systemParameters.maxStepperSpeed);
+ }
+
+ // Infinite Turning in positive or negative direction
+ // with constant parameters to "speed-up" things
+ if(infiniteMode == 0){
+ // Do Nothing/STOP Infinite Mode
+ //DEBUG_SERIAL.println("0");
+ }else if((infiniteMode == 1) && StepperRunning){
+ // Run Stepper Positive to Infinite
+ myStepper.setMaxSpeed(defaultMAXSPEEDSTEPPER);
+ myStepper.setAcceleration(defaultACCELERATIONSTEPPER);
+ way = 2147483647;
+ StepperRunning = false;
+ //DEBUG_SERIAL.println("1");
+ }else if((infiniteMode == 2) && StepperRunning){
+ // Run Stepper Negative to Infinite
+ myStepper.setMaxSpeed(defaultMAXSPEEDSTEPPER);
+ myStepper.setAcceleration(defaultACCELERATIONSTEPPER);
+ way = -2147483647;
+ StepperRunning = false;
+ //DEBUG_SERIAL.println("2");
+ }else if(infiniteMode == 3){
+ // Reset Values
+ way = 0;
+ StepperRunning = false;
+ infiniteMode = 0;
+ }
+
+ if (!StepperRunning){
+ StepperRunning = myStepper.runToPosition(way, _autoModeActive);
+ }
+
+} // runStepper()
+
+/*-----------------------------------------------------------------------------
+ * updateOLEDTask(): Taks Function to Update OLED if a change was done
+ * ----------------------------------------------------------------------------
+*/
+void updateOLEDTask(void* _value){
+ while(1){
+ long* moduloValuePtr = (long*)_value; // Casten Sie den Parameter _value zum Typ int*
+ long _moduloValue = *moduloValuePtr; // Holen Sie den Wert von moduloValue aus dem übergebenen Pointer
+
+ OLEDMainMenu(_moduloValue, &systemParameters.maxStepperSpeed, &systemParameters.maxStepperAccel);
+ vTaskSuspend(NULL);
+ }
+} // updateOLEDTask()
+
+/*-----------------------------------------------------------------------------
+ * automaticMode(): Automatic Mode for Turntable + Picture Mode
+ * ----------------------------------------------------------------------------
+*/
+void automaticMode(void)
+{
+ uint8_t _maxStepps = updateSteps(systemParameters.steppCount);
+ // If Started:
+ switch (stepAutoMode)
+ {
+ case STEPDONE:
+ if (StartAutoMode)
+ {
+ // Starting StateFlow Machine Here
+ stepAutoMode = STEPPICTURE;
+ CountStepsAuto = 0;
+ DEBUG_SERIAL.println("[AUTO] -Step 10- Auto Mode Started");
+ }
+ break;
+
+ case STEPPICTURE:
+ // Start with a Picture
+ HitPicture = true;
+ AsyncAutoModeBreak = millis();
+ stepAutoMode = STEPPICBREAK;
+ BoardLED.writeOutput(HIGH);
+ DEBUG_SERIAL.println("[AUTO] -Step 20- Take Picture");
+ if (!StartAutoMode)
+ {
+ stepAutoMode = STEPPSTOPJOB;
+ }
+ break;
+
+ case STEPPICBREAK:
+ // Waiting Until Picture Delay is done
+ if ((millis() > AsyncAutoModeBreak + autoModeDelay))
+ {
+ stepAutoMode = STEPPERMOVE;
+ BoardLED.writeOutput(LOW);
+ DEBUG_SERIAL.println("[AUTO] -Step 30- Picture Break");
+ }
+ if (!StartAutoMode)
+ {
+ stepAutoMode = STEPPSTOPJOB;
+ }
+ break;
+
+ case STEPPERMOVE:
+ // Moving Stepper Forward to Position
+ way = systemParameters.steppCount;
+ StepperRunning = false;
+ AsyncAutoModeBreak = millis();
+ stepAutoMode = STEPPBREAK;
+ DEBUG_SERIAL.println("[AUTO] -Step 40- Move Stepper");
+ if (!StartAutoMode)
+ {
+ stepAutoMode = STEPPSTOPJOB;
+ }
+ break;
+
+ case STEPPBREAK:
+ // Stepper Break after Movement
+ if ((millis() > AsyncAutoModeBreak + autoModeDelay))
+ {
+ if (!myStepper.isStepperRunning() || myStepper.stepperPosition() >= way)
+ {
+ CountStepsAuto++;
+ stepAutoMode = STEPCHECK;
+ DEBUG_SERIAL.println("[AUTO] -Step 50- Stepper in Position");
+ }
+ }
+ if (!StartAutoMode)
+ {
+ stepAutoMode = STEPPSTOPJOB;
+ }
+ break;
+
+ case STEPCHECK:
+ // checking if Rotation is done, or repeat is necessary
+ if (CountStepsAuto >= _maxStepps)
+ {
+ DEBUG_SERIAL.print("[AUTO] Max Counts: ");
+ DEBUG_SERIAL.print(_maxStepps);
+ DEBUG_SERIAL.print("\t Current Counts: ");
+ DEBUG_SERIAL.println(CountStepsAuto);
+ DEBUG_SERIAL.println("[AUTO] -Step 60- Checking Rotation");
+
+ CountStepsAuto = 0;
+ StartAutoMode = false;
+ stepAutoMode = STEPDONE;
+
+ //Deactivate Stepper here
+ myStepper.motorStop();
+ }
+ else
+ {
+ stepAutoMode = STEPPICTURE;
+ DEBUG_SERIAL.println("[AUTO] -Step 60- Checking Rotation");
+ }
+ if (!StartAutoMode)
+ {
+ stepAutoMode = STEPPSTOPJOB;
+ }
+ break;
+
+ case STEPPSTOPJOB:
+ // Stopp Mode Condition
+ CountStepsAuto = 0;
+ StartAutoMode = false;
+ stepAutoMode = STEPDONE;
+ BoardLED.writeOutput(LOW); // Reset Board LED
+ //Deactivate Stepper here
+ myStepper.motorStop();
+ DEBUG_SERIAL.println("[AUTO] -Step 99- Stopp AUTO Mode");
+ break;
+
+ default:
+ stepAutoMode = STEPPSTOPJOB; // Do Nothing here
+ break;
+ }
+} // automaticMode()
+
+/*-----------------------------------------------------------------------------
+ * EncoderAcceleration(): Acceleration Calculation to speed up movement of change parameters
+ * ----------------------------------------------------------------------------
+*/
+void EncoderAcceleration(unsigned long _ms, long* _newPos, int Dir){
+ if (_ms < longCutoff) {
+ // do some acceleration using factors a and b
+
+ // limit to maximum acceleration
+ if (_ms < shortCutoff) {
+ _ms = shortCutoff;
+ }
+
+ *_newPos = *_newPos + round((Dir*(a * _ms + b)));
+ }
+} // EncoderAcceleration()
\ No newline at end of file
diff --git a/src/pins.h b/src/pins.h
new file mode 100644
index 0000000..7885144
--- /dev/null
+++ b/src/pins.h
@@ -0,0 +1,88 @@
+/***************************TurningTurnTable Project by Jojo1220************************************
+ Filename: pins.h
+ Purpose: pins.h File of TurningTurnTable Project containing Hardware Pin's Configuration
+ Autor: Jojo1220
+ Created: 05.06.2024
+ Modified: 05.06.2024
+ Lizenz: CC BY-NC-ND 4.0
+ Notification: Requieres the following Libarys:
+ Dependency Graph
+ |-- AccelStepper @ 1.64.0
+ |-- U8g2 @ 2.35.19
+ |-- RotaryEncoder @ 1.5.3
+ |-- ESP32 BLE Arduino @ 2.0.0
+ |-- SPI @ 2.0.0
+ |-- Wire @ 2.0.0
+ |-- Preferences @ 2.0.0
+******************************************v1.0.0****************************************************/
+#ifndef PINS_H
+#define PINS_H
+
+/*-----------------------------------------------------------------------------
+ * Setup Global Constants
+ * ----------------------------------------------------------------------------
+*/
+
+#ifdef ESP32dev_Board
+/*-----------------------------------------------------------------------------
+ * Functionl Pin Definition for ESP32 Developement Board
+ * ----------------------------------------------------------------------------
+*/
+ // System Specific Pin Definition
+ #define ONBoardLED 2
+
+ // Pin Definition for OLED
+ #define SDA 21
+ #define SCL 22
+
+ // Pin Definition for Stepper Motor Driver ULN2003
+ // Watch out! IN2 and IN3 has to be inverted in Software Logic due to used Libary!
+ // Control is done by: (IN1; IN3; IN2; IN4) for 28BYJ48 Stepper Motor
+ // (IN1; IN2; IN3; IN4) for 17HS08 NEMA Stepper Motor -->> Setup is accordingly changed like that!
+ // (IN1==DIRECTION; IN2==STEP; IN3==ENABLE; IN4==NOT USED) for DRIVER Stage Setup -->> Setup is accordingly changed like that!
+ #define IN1 26
+ #define IN2 33
+ #define IN3 25
+ #define IN4 32
+
+ // Pin Definition for Encoder
+ #define encoderPinA 34 // CLK or Clock Pin
+ #define encoderPinB 14 // DT or Data Pin
+
+ #define encoderPinSW 27 // SW or Push Button Pin
+
+#endif //ESP32dev_Board
+
+
+#ifdef ESP32dev_ARDUINO
+/*-----------------------------------------------------------------------------
+ * Pin Definition for ESP32-"Arduino"
+ * ----------------------------------------------------------------------------
+*/
+ // System Specific Pin Definition
+ #define ONBoardLED 18
+
+ // Pin Definition for OLED
+ #define SDA 14
+ #define SCL 27
+
+ // Pin Definition for Stepper Motor Driver ULN2003
+ // Watch out! IN2 and IN3 has to be inverted in Software Logic due to used Libary!
+ // Control is done by: (IN1; IN3; IN2; IN4) for 28BYJ48 Stepper Motor
+ // (IN1; IN2; IN3; IN4) for 17HS08 NEMA Stepper Motor -->> Setup is accordingly changed like that!
+ // (IN1==DIRECTION; IN2==STEP; IN3==ENABLE; IN4==NOT USED) for DRIVER Stage Setup -->> Setup is accordingly changed like that!
+ #define IN1 26
+ #define IN2 17
+ #define IN3 25
+ #define IN4 16
+
+ // Pin Definition for Encoder
+ #define encoderPinA 5 // CLK or Clock Pin
+ #define encoderPinB 19 // DT or Data Pin
+
+ #define encoderPinSW 23 // SW or Push Button Pin
+
+#endif // ESP32dev_ARDUINO
+
+#endif //pins.h
+