From 3ea3fdefd0642c4239d200fbd910db9ae076e192 Mon Sep 17 00:00:00 2001 From: babayaga Date: Tue, 24 Jun 2025 13:47:01 +0200 Subject: [PATCH] latest :) --- .../hdpe/assets/washed-2-stage-6/DSC02906.JPG | 4 +- .../material/hdpe/sheets/.inc/DSC04861.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04866.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04869.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04880.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04881.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04887.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04904.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04905.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04926.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04932.JPG | 3 + .../material/hdpe/sheets/.inc/DSC04966.JPG | 3 + projects/pid-controller/.gitignore | 32 - projects/pid-controller/LICENSE | 674 ------ projects/pid-controller/README.md | 84 - .../Arduino-PID-Library-1.2.0.zip | 3 - .../arduino-libraries/Bounce2-master.zip | 3 - .../DHT-sensor-library-1.3.8.zip | 3 - .../pid-controller/arduino-libraries/DIO2.zip | 3 - .../ThermocoupleToSerial.ino | 53 - .../ThermocoupleToSerial.pde | 53 - .../arduino-libraries/MAX31855/MAX31855.cpp | 230 -- .../arduino-libraries/MAX31855/MAX31855.h | 36 - .../arduino-libraries/MAX31855/keywords.txt | 29 - .../MAX6675_library-1.0.1.zip | 3 - .../arduino-libraries/NewPing_v1.9.1.zip | 3 - .../arduino-libraries/Streaming-5.0.0.zip | 3 - .../arduino-libraries/TimerOne-1.1.0.zip | 3 - .../arduino-libraries/Vector-1.1.2.zip | 3 - .../arduino-Tools40-master.zip | 3 - ...INO-Instruction-Manual-V1.5-2018-12-14.pdf | 3 - .../CONTROLLINO-MINI-Pinout-1.jpg | 3 - .../MINI_DATASHEET-19-04-20161.pdf | 3 - .../package_ControllinoHardware_index.json | 232 -- .../fastgpio-arduino-2.1.0.zip | 3 - .../documents/cases/Cassandra.JPG | 3 - .../documents/cases/Cassandra.md | 0 .../documents/cases/Sheetpress cell 4.2.PDF | 3 - .../documents/cases/Sheetpress cell 4.2.md | 3 - .../documents/cases/Sheetpress cell 4.2.png | 3 - .../documents/cases/Sheetpress cell 4.2.svg | 1309 ---------- projects/pid-controller/firmware/.gitignore | 5 - projects/pid-controller/firmware/Addon.cpp | 51 - projects/pid-controller/firmware/Addon.h | 72 - .../firmware/MultiPIDController.h | 26 - projects/pid-controller/firmware/Partition.h | 28 - projects/pid-controller/firmware/TimerOne.cpp | 54 - projects/pid-controller/firmware/TimerOne.h | 485 ---- projects/pid-controller/firmware/Version.h | 9 - .../firmware/addons/CurrentSensor.h | 59 - .../firmware/addons/DirectionSwitch.h | 56 - .../firmware/addons/MotorTemperature.h | 40 - .../firmware/addons/OperationModeSwitch.h | 148 -- .../pid-controller/firmware/addons/Reset.h | 30 - .../pid-controller/firmware/addons/Status.h | 110 - .../firmware/addons/TemperatureSensor.h | 42 - projects/pid-controller/firmware/app.cpp | 192 -- projects/pid-controller/firmware/app.h | 97 - .../pid-controller/firmware/app_addons.cpp | 150 -- projects/pid-controller/firmware/app_ctrl.cpp | 0 projects/pid-controller/firmware/app_pid.cpp | 2 - .../AutoTune_Example/AutoTune_Example.pde | 161 -- .../firmware/auto-tune/PID_AutoTune_v0.cpp | 196 -- .../firmware/auto-tune/PID_AutoTune_v0.h | 55 - projects/pid-controller/firmware/bridge.cpp | 121 - projects/pid-controller/firmware/bridge.h | 81 - projects/pid-controller/firmware/common/Pin.h | 512 ---- .../pid-controller/firmware/common/PinGroup.h | 469 ---- .../pid-controller/firmware/common/macros.h | 98 - .../pid-controller/firmware/common/ppmath.h | 14 - .../pid-controller/firmware/common/timer.h | 136 -- .../firmware/components/3PosAnalog.h | 80 - .../pid-controller/firmware/components/3pos.h | 81 - .../firmware/components/TemperatureSensor.h | 42 - projects/pid-controller/firmware/config.h | 91 - .../firmware/config/known_16bit_timers.h | 153 -- projects/pid-controller/firmware/config_adv.h | 21 - .../firmware/config_validator.h | 7 - projects/pid-controller/firmware/constants.h | 19 - projects/pid-controller/firmware/enums.h | 89 - projects/pid-controller/firmware/features.h | 14 - projects/pid-controller/firmware/firmware.ino | 12 - projects/pid-controller/firmware/package.json | 28 - .../firmware/ppmath_statistics.cpp | 93 - .../firmware/ppmath_statistics.h | 116 - projects/pid-controller/firmware/types.h | 11 - .../pid-controller/firmware/user_config.h | 4 - projects/pid-controller/firmware/util/crc16.h | 88 - projects/pid-controller/firmware/util/word.h | 64 - projects/pid-controller/firmware/version.js | 34 - projects/pid-controller/firmware/yarn.lock | 788 ------ projects/pid-controller/network.md | 26 - .../osPID-Firmware/AnalogButton.cpp | 86 - .../osPID-Firmware/AnalogButton_local.h | 47 - .../osPID-Firmware/EEPROMAnything.h | 20 - .../osPID-Firmware/MAX31855.cpp | 230 -- .../osPID-Firmware/MAX31855_local.h | 35 - .../osPID-Firmware/PID_AutoTune_v0.cpp | 235 -- .../osPID-Firmware/PID_AutoTune_v0_local.h | 53 - .../reference-impl/osPID-Firmware/PID_v1.cpp | 192 -- .../osPID-Firmware/PID_v1_local.h | 81 - .../reference-impl/osPID-Firmware/README.txt | 33 - .../reference-impl/osPID-Firmware/io.h | 530 ---- .../reference-impl/osPID-Firmware/max6675.cpp | 73 - .../osPID-Firmware/max6675_local.h | 21 - .../osPID-Firmware/osPID_Firmware.ino | 1327 ---------- .../pid-controller/research/TriangleTest.md | 69 - .../research/assets/setup-triangle-test.jpg | 3 - ...CONTROLLINO MINI pure – CONTROLLINO.html | 2148 ----------------- ...INO-Instruction-Manual-V1.5-2018-12-14.pdf | 3 - .../controllino/CONTROLLINO-MEGA-Pinout-1.jpg | 3 - .../FMUSE0FIC37CA7W/FMUSE0FIC37CA7W.ino | 142 -- .../vendor/controllino/mega.jpg | 3 - ...vicenet_communications_users_manual_en.pdf | 3 - .../cad/Mould-Frame-650-15-1300.STEP | 3 + .../650-15mm/cad/Mould-Frame-650-15.STEP | 3 + 116 files changed, 41 insertions(+), 13485 deletions(-) create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04861.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04866.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04869.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04880.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04881.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04887.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04904.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04905.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04926.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04932.JPG create mode 100644 products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04966.JPG delete mode 100644 projects/pid-controller/.gitignore delete mode 100644 projects/pid-controller/LICENSE delete mode 100644 projects/pid-controller/README.md delete mode 100644 projects/pid-controller/arduino-libraries/Arduino-PID-Library-1.2.0.zip delete mode 100644 projects/pid-controller/arduino-libraries/Bounce2-master.zip delete mode 100644 projects/pid-controller/arduino-libraries/DHT-sensor-library-1.3.8.zip delete mode 100644 projects/pid-controller/arduino-libraries/DIO2.zip delete mode 100644 projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.ino delete mode 100644 projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.pde delete mode 100644 projects/pid-controller/arduino-libraries/MAX31855/MAX31855.cpp delete mode 100644 projects/pid-controller/arduino-libraries/MAX31855/MAX31855.h delete mode 100644 projects/pid-controller/arduino-libraries/MAX31855/keywords.txt delete mode 100644 projects/pid-controller/arduino-libraries/MAX6675_library-1.0.1.zip delete mode 100644 projects/pid-controller/arduino-libraries/NewPing_v1.9.1.zip delete mode 100644 projects/pid-controller/arduino-libraries/Streaming-5.0.0.zip delete mode 100644 projects/pid-controller/arduino-libraries/TimerOne-1.1.0.zip delete mode 100644 projects/pid-controller/arduino-libraries/Vector-1.1.2.zip delete mode 100644 projects/pid-controller/arduino-libraries/arduino-Tools40-master.zip delete mode 100644 projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf delete mode 100644 projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-MINI-Pinout-1.jpg delete mode 100644 projects/pid-controller/arduino-libraries/boards/controllino-mini/MINI_DATASHEET-19-04-20161.pdf delete mode 100644 projects/pid-controller/arduino-libraries/boards/package_ControllinoHardware_index.json delete mode 100644 projects/pid-controller/arduino-libraries/fastgpio-arduino-2.1.0.zip delete mode 100644 projects/pid-controller/documents/cases/Cassandra.JPG delete mode 100644 projects/pid-controller/documents/cases/Cassandra.md delete mode 100644 projects/pid-controller/documents/cases/Sheetpress cell 4.2.PDF delete mode 100644 projects/pid-controller/documents/cases/Sheetpress cell 4.2.md delete mode 100644 projects/pid-controller/documents/cases/Sheetpress cell 4.2.png delete mode 100644 projects/pid-controller/documents/cases/Sheetpress cell 4.2.svg delete mode 100644 projects/pid-controller/firmware/.gitignore delete mode 100644 projects/pid-controller/firmware/Addon.cpp delete mode 100644 projects/pid-controller/firmware/Addon.h delete mode 100644 projects/pid-controller/firmware/MultiPIDController.h delete mode 100644 projects/pid-controller/firmware/Partition.h delete mode 100644 projects/pid-controller/firmware/TimerOne.cpp delete mode 100644 projects/pid-controller/firmware/TimerOne.h delete mode 100644 projects/pid-controller/firmware/Version.h delete mode 100644 projects/pid-controller/firmware/addons/CurrentSensor.h delete mode 100644 projects/pid-controller/firmware/addons/DirectionSwitch.h delete mode 100644 projects/pid-controller/firmware/addons/MotorTemperature.h delete mode 100644 projects/pid-controller/firmware/addons/OperationModeSwitch.h delete mode 100644 projects/pid-controller/firmware/addons/Reset.h delete mode 100644 projects/pid-controller/firmware/addons/Status.h delete mode 100644 projects/pid-controller/firmware/addons/TemperatureSensor.h delete mode 100644 projects/pid-controller/firmware/app.cpp delete mode 100644 projects/pid-controller/firmware/app.h delete mode 100644 projects/pid-controller/firmware/app_addons.cpp delete mode 100644 projects/pid-controller/firmware/app_ctrl.cpp delete mode 100644 projects/pid-controller/firmware/app_pid.cpp delete mode 100644 projects/pid-controller/firmware/auto-tune/Examples/AutoTune_Example/AutoTune_Example.pde delete mode 100644 projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.cpp delete mode 100644 projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.h delete mode 100644 projects/pid-controller/firmware/bridge.cpp delete mode 100644 projects/pid-controller/firmware/bridge.h delete mode 100644 projects/pid-controller/firmware/common/Pin.h delete mode 100644 projects/pid-controller/firmware/common/PinGroup.h delete mode 100644 projects/pid-controller/firmware/common/macros.h delete mode 100644 projects/pid-controller/firmware/common/ppmath.h delete mode 100644 projects/pid-controller/firmware/common/timer.h delete mode 100644 projects/pid-controller/firmware/components/3PosAnalog.h delete mode 100644 projects/pid-controller/firmware/components/3pos.h delete mode 100644 projects/pid-controller/firmware/components/TemperatureSensor.h delete mode 100644 projects/pid-controller/firmware/config.h delete mode 100644 projects/pid-controller/firmware/config/known_16bit_timers.h delete mode 100644 projects/pid-controller/firmware/config_adv.h delete mode 100644 projects/pid-controller/firmware/config_validator.h delete mode 100644 projects/pid-controller/firmware/constants.h delete mode 100644 projects/pid-controller/firmware/enums.h delete mode 100644 projects/pid-controller/firmware/features.h delete mode 100644 projects/pid-controller/firmware/firmware.ino delete mode 100644 projects/pid-controller/firmware/package.json delete mode 100644 projects/pid-controller/firmware/ppmath_statistics.cpp delete mode 100644 projects/pid-controller/firmware/ppmath_statistics.h delete mode 100644 projects/pid-controller/firmware/types.h delete mode 100644 projects/pid-controller/firmware/user_config.h delete mode 100644 projects/pid-controller/firmware/util/crc16.h delete mode 100644 projects/pid-controller/firmware/util/word.h delete mode 100644 projects/pid-controller/firmware/version.js delete mode 100644 projects/pid-controller/firmware/yarn.lock delete mode 100644 projects/pid-controller/network.md delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton.cpp delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton_local.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/EEPROMAnything.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/MAX31855.cpp delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/MAX31855_local.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0.cpp delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0_local.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/PID_v1.cpp delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/PID_v1_local.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/README.txt delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/io.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/max6675.cpp delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/max6675_local.h delete mode 100644 projects/pid-controller/reference-impl/osPID-Firmware/osPID_Firmware.ino delete mode 100644 projects/pid-controller/research/TriangleTest.md delete mode 100644 projects/pid-controller/research/assets/setup-triangle-test.jpg delete mode 100644 projects/pid-controller/vendor/controllino/CONTROLLINO MINI pure – CONTROLLINO.html delete mode 100644 projects/pid-controller/vendor/controllino/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf delete mode 100644 projects/pid-controller/vendor/controllino/CONTROLLINO-MEGA-Pinout-1.jpg delete mode 100644 projects/pid-controller/vendor/controllino/FMUSE0FIC37CA7W/FMUSE0FIC37CA7W.ino delete mode 100644 projects/pid-controller/vendor/controllino/mega.jpg delete mode 100644 projects/pid-controller/vendor/omron/h124_e5ar_e5er_devicenet_communications_users_manual_en.pdf create mode 100644 sheetpress/components/900_Moulds/1300x650-15mm/cad/Mould-Frame-650-15-1300.STEP create mode 100644 sheetpress/components/900_Moulds/650-15mm/cad/Mould-Frame-650-15.STEP diff --git a/products/poly-mech/resources/material/hdpe/assets/washed-2-stage-6/DSC02906.JPG b/products/poly-mech/resources/material/hdpe/assets/washed-2-stage-6/DSC02906.JPG index 2288eebd4..de40a43ab 100644 --- a/products/poly-mech/resources/material/hdpe/assets/washed-2-stage-6/DSC02906.JPG +++ b/products/poly-mech/resources/material/hdpe/assets/washed-2-stage-6/DSC02906.JPG @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b12a8a5dcb41d2926aa5df68cd74402251beac0bc4b3b131d28d82867df7c43e -size 2210181 +oid sha256:d289c783d3ddc016270818036e834180d0188450669af1e48b62bdf38dbac629 +size 262497 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04861.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04861.JPG new file mode 100644 index 000000000..2d82243a5 --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04861.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f95d519f3a7e71844f0866db8d324271ccb474561aceb9fb30adfab61fc3f6c5 +size 402284 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04866.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04866.JPG new file mode 100644 index 000000000..8605fccfb --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04866.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbe435d2a6efa14bc9775e81cef5423c23721160f7680dc3efd28ab534afef56 +size 687038 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04869.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04869.JPG new file mode 100644 index 000000000..71d9f47fe --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04869.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48e153fa584eac65ad17490bebec5c0ac593cb2b2109ae44763572a43d8cd115 +size 355005 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04880.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04880.JPG new file mode 100644 index 000000000..aeb848e37 --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04880.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0b80153d0a65ba00640e16f4261defe727cffdd9822455c10e8aaf9a4c290ed +size 478178 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04881.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04881.JPG new file mode 100644 index 000000000..6bb0f945d --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04881.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8cbb844177dd0049a69b0d897e85ade27ce814cb3fc3410ecc475ffa87c2fab +size 491343 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04887.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04887.JPG new file mode 100644 index 000000000..66baaa4ed --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04887.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ac53ba9241b0f0ec977432750e2e7f8d23fc561ddab6362c13f7e4f875b28d7 +size 292651 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04904.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04904.JPG new file mode 100644 index 000000000..f2859406b --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04904.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d0c7ceb4dea125412a3d090f0ffa92e21bfa2e3d7feed0120a18443457dafa7 +size 252523 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04905.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04905.JPG new file mode 100644 index 000000000..1c18aab46 --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04905.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:619cf1e93b03de9babf1c9dcffa38aa080d3d97e92a7a87ac6880aac1c99dbfe +size 399530 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04926.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04926.JPG new file mode 100644 index 000000000..f827e2d84 --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04926.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49977ecd07ef7c8255faf06c239be238963dc194a08f6531588a654a589cefa6 +size 222349 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04932.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04932.JPG new file mode 100644 index 000000000..da1ca7720 --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04932.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5452172a46646456017bb8da0e328f92d63cf904c3b869e2c7088cb0e12d1f4 +size 436700 diff --git a/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04966.JPG b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04966.JPG new file mode 100644 index 000000000..1fd867f7e --- /dev/null +++ b/products/poly-mech/resources/material/hdpe/sheets/.inc/DSC04966.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bc6136ee3a57cb138c1d36cb44e19d598d082072c8f43073c36feb4b3d8b8b1 +size 376163 diff --git a/projects/pid-controller/.gitignore b/projects/pid-controller/.gitignore deleted file mode 100644 index 259148fa1..000000000 --- a/projects/pid-controller/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app diff --git a/projects/pid-controller/LICENSE b/projects/pid-controller/LICENSE deleted file mode 100644 index f288702d2..000000000 --- a/projects/pid-controller/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/projects/pid-controller/README.md b/projects/pid-controller/README.md deleted file mode 100644 index b914ebd55..000000000 --- a/projects/pid-controller/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Multichannel PID controller - -Purpose of this PID controller is to lower overall amperage by cycling periodically through SSRs. - -This is based on [osPID](http://ospid.com/blog/download/) - -### Hardware - -- [Controllino - Mega (Arduino compatible)](https://www.controllino.biz/product/controllino-mega/). [See PIN layout](./vendor/controllino/CONTROLLINO-MEGA-Pinout-1.jpg) - -![](./vendor/controllino/mega.jpg) - -- Optional: OLED & keypad control -- 8 channels -- Optional: Modbus -- TC sensor module, MAX6675 | MAX31855 - -## Features - -### PID - -- Autotune per PID -- Support for multiple TCs (see Marlin firmware) - -### Configuration - -- Set max Amp -- Set max/min heat time per cell/partition - -## Milestones / Todos - -- [x] Check/Simulate performance bottle necks for Mega -- [x] Temperature logger, serial & MaxC based -- [ ] Integrate PID/Auto-tune - - [ ] EEprom storage ? -- [x] Debug interface via RS485 -- [x] Data - reader via RS232 (Matlab) -- [ ] Configuration (remote / local) -> Control-Freak - HMI -- [-] Model testing/verification - -## Edge cases / Errors - -- [ ] PID-Partition Timeout : PID didn't reach target with limits -- [ ] PID/Partition Overshooting : PID or operator malfunction -- [ ] PID Auto-tuning timeout : autotuning too long -- [ ] PID/Partition interference : partition overlap noise ? - -## Modes - -- [ ] Groups (partition groups) -- [ ] Serial (single linked partition group) -- [ ] Remote (HMI & control) -- [x] Master controller, only. Eg: control other PIDs via Modbus - -## PP/PH - -### New parameters - -- [ ] Ramp-time -- [ ] Amp Budget -- [ ] Sub SP hold time - -### New behaviours - -- [ ] Currently there are multiple issues surfacing regarding the sheetpress. A profile should allow to have multiple target temperature points (eg: 1 hour to hold softening point, 30 mins for holding melting point rage, 10 mins for slightly over melting point : pressing phase) with a holding & ramp time each. -- [ ] The user should be able to adjust these profiles per flake size. For that we should also study the effects of various flake sizes regarding stresses created in the sheets. - -### Modbus Implementation - -- [-] Should implement broadcast queries : Status (Run/Alarm,...) , SP(s) & PV - -### References - -- [PID research](https://gitlab.com/plastichub/osr/research#pid-control) - -### Hydra tests/experiments - -- [x] calc. heat transfer, x & square (with screw | without screw | loaded) -- [x] Inkbird vs Rex -- [x] PID param transfer from E5 to Inkbird, Rexc : NO -- [x] test TC mount variants -- [x] different man. PID params (soak, hysteresis, ..) - - diff --git a/projects/pid-controller/arduino-libraries/Arduino-PID-Library-1.2.0.zip b/projects/pid-controller/arduino-libraries/Arduino-PID-Library-1.2.0.zip deleted file mode 100644 index e19d6db8c..000000000 --- a/projects/pid-controller/arduino-libraries/Arduino-PID-Library-1.2.0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7dcbf835b493efaf173590cf06ee1100d7416372b967a520541434fb5d39ae6b -size 10372 diff --git a/projects/pid-controller/arduino-libraries/Bounce2-master.zip b/projects/pid-controller/arduino-libraries/Bounce2-master.zip deleted file mode 100644 index 7132fd558..000000000 --- a/projects/pid-controller/arduino-libraries/Bounce2-master.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a1a18dd6a25045eb75d5d4122a55704861b0219b0ef286ffb089b9488c493036 -size 253603 diff --git a/projects/pid-controller/arduino-libraries/DHT-sensor-library-1.3.8.zip b/projects/pid-controller/arduino-libraries/DHT-sensor-library-1.3.8.zip deleted file mode 100644 index 853c6e122..000000000 --- a/projects/pid-controller/arduino-libraries/DHT-sensor-library-1.3.8.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d919d9430f4610a310e6f0f380056569672969bb70d51374287e9f7ca25a7146 -size 19010 diff --git a/projects/pid-controller/arduino-libraries/DIO2.zip b/projects/pid-controller/arduino-libraries/DIO2.zip deleted file mode 100644 index 90d1834b5..000000000 --- a/projects/pid-controller/arduino-libraries/DIO2.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7680764349e4f0e79331e4bb42328e0e066d99291b0855d022fcaba18c95768f -size 25304 diff --git a/projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.ino b/projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.ino deleted file mode 100644 index aec4aae7f..000000000 --- a/projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.ino +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* -* Thermocouple to serial for MAX31855 example -* Version: 1.00 -* Date: 26-12-2011 -* Company: Rocket Scream Electronics -* Website: www.rocketscream.com -* -* This is an example of using the MAX31855 library for Arduino to read -* temperature from a thermocouple and send the reading to serial interfacec. -* Please check our wiki (www.rocketscream.com/wiki) for more information on -* using this piece of library. -* -* This example code is licensed under Creative Commons Attribution-ShareAlike -* 3.0 Unported License. -* -* Revision Description -* ======== =========== -* 1.00 Initial public release. -* -*******************************************************************************/ -// ***** INCLUDES ***** -#include - -// ***** PIN DEFINITIONS ***** -const unsigned char thermocoupleSO = 12; -const unsigned char thermocoupleCS = 10; -const unsigned char thermocoupleCLK = 13; - -MAX31855 MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK); - -void setup() -{ - Serial.begin(57600); -} - -void loop() -{ - double temperature; - - // Retrieve thermocouple temperature in Degree Celsius - temperature = MAX31855.readThermocouple(CELSIUS); - Serial.print("Thermocouple temperature: "); - Serial.print(temperature); - Serial.println(" Degree Celsius"); - - // Retrieve cold junction temperature in Degree Celsius - temperature = MAX31855.readJunction(CELSIUS); - Serial.print("Junction temperature: "); - Serial.print(temperature); - Serial.println(" Degree Celsius"); - - delay(1000); -} diff --git a/projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.pde b/projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.pde deleted file mode 100644 index aec4aae7f..000000000 --- a/projects/pid-controller/arduino-libraries/MAX31855/Examples/ThermocoupleToSerial/ThermocoupleToSerial.pde +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* -* Thermocouple to serial for MAX31855 example -* Version: 1.00 -* Date: 26-12-2011 -* Company: Rocket Scream Electronics -* Website: www.rocketscream.com -* -* This is an example of using the MAX31855 library for Arduino to read -* temperature from a thermocouple and send the reading to serial interfacec. -* Please check our wiki (www.rocketscream.com/wiki) for more information on -* using this piece of library. -* -* This example code is licensed under Creative Commons Attribution-ShareAlike -* 3.0 Unported License. -* -* Revision Description -* ======== =========== -* 1.00 Initial public release. -* -*******************************************************************************/ -// ***** INCLUDES ***** -#include - -// ***** PIN DEFINITIONS ***** -const unsigned char thermocoupleSO = 12; -const unsigned char thermocoupleCS = 10; -const unsigned char thermocoupleCLK = 13; - -MAX31855 MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK); - -void setup() -{ - Serial.begin(57600); -} - -void loop() -{ - double temperature; - - // Retrieve thermocouple temperature in Degree Celsius - temperature = MAX31855.readThermocouple(CELSIUS); - Serial.print("Thermocouple temperature: "); - Serial.print(temperature); - Serial.println(" Degree Celsius"); - - // Retrieve cold junction temperature in Degree Celsius - temperature = MAX31855.readJunction(CELSIUS); - Serial.print("Junction temperature: "); - Serial.print(temperature); - Serial.println(" Degree Celsius"); - - delay(1000); -} diff --git a/projects/pid-controller/arduino-libraries/MAX31855/MAX31855.cpp b/projects/pid-controller/arduino-libraries/MAX31855/MAX31855.cpp deleted file mode 100644 index e86f5602b..000000000 --- a/projects/pid-controller/arduino-libraries/MAX31855/MAX31855.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* -* MAX31855 Library -* Version: 1.10 -* Date: 24-07-2012 -* Company: Rocket Scream Electronics -* Website: www.rocketscream.com -* -* This is a MAX31855 library for Arduino. Please check our wiki -* (www.rocketscream.com/wiki) for more information on using this piece of -* library. -* -* This library is licensed under Creative Commons Attribution-ShareAlike 3.0 -* Unported License. -* -* Revision Description -* ======== =========== -* 1.10 Added negative temperature support for both junction & thermocouple. -* 1.00 Initial public release. -* -*******************************************************************************/ -#include "MAX31855.h" - -MAX31855::MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK) -{ - so = SO; - cs = CS; - sck = SCK; - - // MAX31855 data output pin - pinMode(so, INPUT); - // MAX31855 chip select input pin - pinMode(cs, OUTPUT); - // MAX31855 clock input pin - pinMode(sck, OUTPUT); - - // Default output pins state - digitalWrite(cs, HIGH); - digitalWrite(sck, LOW); -} - -/******************************************************************************* -* Name: readThermocouple -* Description: Read the thermocouple temperature either in Degree Celsius or -* Fahrenheit. Internally, the conversion takes place in the -* background within 100 ms. Values are updated only when the CS -* line is high. -* -* Argument Description -* ========= =========== -* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT -* -* Return Description -* ========= =========== -* temperature Temperature of the thermocouple either in Degree Celsius or -* Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or -* FAULT_SHORT_VCC will be returned. These fault values are outside -* of the temperature range the MAX31855 is capable of. -*******************************************************************************/ -double MAX31855::readThermocouple(unit_t unit) -{ - unsigned long data; - double temperature; - - // Initialize temperature - temperature = 0; - - // Shift in 32-bit of data from MAX31855 - data = readData(); - - // If fault is detected - if (data & 0x00010000) - { - // Check for fault type (3 LSB) - switch (data & 0x00000007) - { - // Open circuit - case 0x01: - temperature = FAULT_OPEN; - break; - - // Thermocouple short to GND - case 0x02: - temperature = FAULT_SHORT_GND; - break; - - // Thermocouple short to VCC - case 0x04: - temperature = FAULT_SHORT_VCC; - break; - } - } - // No fault detected - else - { - // Retrieve thermocouple temperature data and strip redundant data - data = data >> 18; - // Bit-14 is the sign - temperature = (data & 0x00001FFF); - - // Check for negative temperature - if (data & 0x00002000) - { - // 2's complement operation - // Invert - data = ~data; - // Ensure operation involves lower 13-bit only - temperature = data & 0x00001FFF; - // Add 1 to obtain the positive number - temperature += 1; - // Make temperature negative - temperature *= -1; - } - - // Convert to Degree Celsius - temperature *= 0.25; - - // If temperature unit in Fahrenheit is desired - if (unit == FAHRENHEIT) - { - // Convert Degree Celsius to Fahrenheit - temperature = (temperature * 9.0/5.0)+ 32; - } - } - return (temperature); -} - -/******************************************************************************* -* Name: readJunction -* Description: Read the thermocouple temperature either in Degree Celsius or -* Fahrenheit. Internally, the conversion takes place in the -* background within 100 ms. Values are updated only when the CS -* line is high. -* -* Argument Description -* ========= =========== -* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT -* -* Return Description -* ========= =========== -* temperature Temperature of the cold junction either in Degree Celsius or -* Fahrenheit. -* -*******************************************************************************/ -double MAX31855::readJunction(unit_t unit) -{ - double temperature; - unsigned long data; - - // Shift in 32-bit of data from MAX31855 - data = readData(); - - // Strip fault data bits & reserved bit - data = data >> 4; - // Bit-12 is the sign - temperature = (data & 0x000007FF); - - // Check for negative temperature - if (data & 0x00000800) - { - // 2's complement operation - // Invert - data = ~data; - // Ensure operation involves lower 11-bit only - temperature = data & 0x000007FF; - // Add 1 to obtain the positive number - temperature += 1; - // Make temperature negative - temperature *= -1; - } - - // Convert to Degree Celsius - temperature *= 0.0625; - - // If temperature unit in Fahrenheit is desired - if (unit == FAHRENHEIT) - { - // Convert Degree Celsius to Fahrenheit - temperature = (temperature * 9.0/5.0)+ 32; - } - - // Return the temperature - return (temperature); -} - -/******************************************************************************* -* Name: readData -* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse -* width is 100 ns. No delay is required in this case. -* -* Argument Description -* ========= =========== -* 1. NIL -* -* Return Description -* ========= =========== -* data 32-bit of data acquired from the MAX31855 chip. -* -*******************************************************************************/ -unsigned long MAX31855::readData() -{ - int bitCount; - unsigned long data; - - // Clear data - data = 0; - - // Select the MAX31855 chip - digitalWrite(cs, LOW); - - // Shift in 32-bit of data - for (bitCount = 31; bitCount >= 0; bitCount--) - { - digitalWrite(sck, HIGH); - - // If data bit is high - if (digitalRead(so)) - { - // Need to type cast data type to unsigned long, else compiler will - // truncate to 16-bit - data |= ((unsigned long)1 << bitCount); - } - - digitalWrite(sck, LOW); - } - - // Deselect MAX31855 chip - digitalWrite(cs, HIGH); - - return(data); -} \ No newline at end of file diff --git a/projects/pid-controller/arduino-libraries/MAX31855/MAX31855.h b/projects/pid-controller/arduino-libraries/MAX31855/MAX31855.h deleted file mode 100644 index 0ad0fd5f2..000000000 --- a/projects/pid-controller/arduino-libraries/MAX31855/MAX31855.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef MAX31855_H -#define MAX31855_H - -#if ARDUINO >= 100 - #include "Arduino.h" -#else - #include "WProgram.h" -#endif - -#define FAULT_OPEN 10000 -#define FAULT_SHORT_GND 10001 -#define FAULT_SHORT_VCC 10002 - -enum unit_t -{ - CELSIUS, - FAHRENHEIT -}; - -class MAX31855 -{ - public: - MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK); - - double readThermocouple(unit_t unit); - double readJunction(unit_t unit); - - private: - unsigned char so; - unsigned char cs; - unsigned char sck; - - unsigned long readData(); - -}; -#endif \ No newline at end of file diff --git a/projects/pid-controller/arduino-libraries/MAX31855/keywords.txt b/projects/pid-controller/arduino-libraries/MAX31855/keywords.txt deleted file mode 100644 index 73d38e43e..000000000 --- a/projects/pid-controller/arduino-libraries/MAX31855/keywords.txt +++ /dev/null @@ -1,29 +0,0 @@ -####################################### -# Syntax Coloring Map MAX31855 -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -MAX31855 KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### - -readThermocouple KEYWORD2 -readJunction KEYWORD2 - -####################################### -# Instances (KEYWORD2) -####################################### - -####################################### -# Constants (LITERAL1) -####################################### -CELSIUS LITERAL1 -FAHRENHEIT LITERAL1 -FAULT_OPEN LITERAL1 -FAULT_SHORT_GND LITERAL1 -FAULT_SHORT_VCC LITERAL1 \ No newline at end of file diff --git a/projects/pid-controller/arduino-libraries/MAX6675_library-1.0.1.zip b/projects/pid-controller/arduino-libraries/MAX6675_library-1.0.1.zip deleted file mode 100644 index 26d07dbd4..000000000 --- a/projects/pid-controller/arduino-libraries/MAX6675_library-1.0.1.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:13b1390251d10164aaaaee6ef6fe3d43595d193c51cbe45cad5171b72078b536 -size 4353 diff --git a/projects/pid-controller/arduino-libraries/NewPing_v1.9.1.zip b/projects/pid-controller/arduino-libraries/NewPing_v1.9.1.zip deleted file mode 100644 index db05011dd..000000000 --- a/projects/pid-controller/arduino-libraries/NewPing_v1.9.1.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:75f7e0754429873c11f3a74496f425b3ffda8791b2d77a47130a751930e6f6d7 -size 19242 diff --git a/projects/pid-controller/arduino-libraries/Streaming-5.0.0.zip b/projects/pid-controller/arduino-libraries/Streaming-5.0.0.zip deleted file mode 100644 index 02f636aac..000000000 --- a/projects/pid-controller/arduino-libraries/Streaming-5.0.0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:27b25f6261f193dc3076674f1322b9b77a2aedefca3ddae52408bf336d9016f7 -size 4637 diff --git a/projects/pid-controller/arduino-libraries/TimerOne-1.1.0.zip b/projects/pid-controller/arduino-libraries/TimerOne-1.1.0.zip deleted file mode 100644 index 04cecda53..000000000 --- a/projects/pid-controller/arduino-libraries/TimerOne-1.1.0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:db98a2ed31428219fade87eeac5e4e638e6e4bc029add7ace2874734c87a2632 -size 8767 diff --git a/projects/pid-controller/arduino-libraries/Vector-1.1.2.zip b/projects/pid-controller/arduino-libraries/Vector-1.1.2.zip deleted file mode 100644 index 9a28ddec4..000000000 --- a/projects/pid-controller/arduino-libraries/Vector-1.1.2.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dd328faa9ed7272594df25b4685675a4d573c8049f379d3189ca91e40a9e6234 -size 5966 diff --git a/projects/pid-controller/arduino-libraries/arduino-Tools40-master.zip b/projects/pid-controller/arduino-libraries/arduino-Tools40-master.zip deleted file mode 100644 index 367b09356..000000000 --- a/projects/pid-controller/arduino-libraries/arduino-Tools40-master.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7456a56686806601eaaa53a5d24e2ac26aca3bf5630cd57d3202223b84cddcbc -size 61759 diff --git a/projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf b/projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf deleted file mode 100644 index 68fa3aa8b..000000000 --- a/projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:967cba98c096e1efd6e5ff8f101efc7781d00a172482fa6c50f3a7e2191b8713 -size 1648022 diff --git a/projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-MINI-Pinout-1.jpg b/projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-MINI-Pinout-1.jpg deleted file mode 100644 index 36de2fa60..000000000 --- a/projects/pid-controller/arduino-libraries/boards/controllino-mini/CONTROLLINO-MINI-Pinout-1.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7efd19359bfbdfa8c3dda9c8388a37f728e449443458dd7dd257d1b680fcc76c -size 2465358 diff --git a/projects/pid-controller/arduino-libraries/boards/controllino-mini/MINI_DATASHEET-19-04-20161.pdf b/projects/pid-controller/arduino-libraries/boards/controllino-mini/MINI_DATASHEET-19-04-20161.pdf deleted file mode 100644 index 3d8d1eed5..000000000 --- a/projects/pid-controller/arduino-libraries/boards/controllino-mini/MINI_DATASHEET-19-04-20161.pdf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:87efb67116cceb38efea6178321ec9379723c607ff29859905eb0886b84de8cf -size 171827 diff --git a/projects/pid-controller/arduino-libraries/boards/package_ControllinoHardware_index.json b/projects/pid-controller/arduino-libraries/boards/package_ControllinoHardware_index.json deleted file mode 100644 index f7642081d..000000000 --- a/projects/pid-controller/arduino-libraries/boards/package_ControllinoHardware_index.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "packages": [ - { - "name": "CONTROLLINO_Boards", - "maintainer": "CONTROLLINO", - "websiteURL": "https://controllino.biz/", - "email": "info@controllino.biz", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "platforms": [ - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "1.0.0", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/85e5ff22bb53cb3ffdbefd00f6ae30533db8cf86/Boards/ControllinoHW.zip?raw=true", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:0ca4811376820e2cfad4a6f840f9a05935efdbc7ed79d021c91b008c87cfd234", - "size": "216717", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.8.1-arduino5" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.0.1-arduino5" - } - ] - }, - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "1.1.0", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/c2f7ac0e27daae484a9d9f99a2ef4d8209002598/Boards/ControllinoHW.zip?raw=true", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:2ed3f3eaadb27da7e1a75063536c9dba3609e26d20c7ceee638cbfde93e10ec1", - "size": "223237", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MAXI Automation" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.8.1-arduino5" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.0.1-arduino5" - } - ] - }, - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "2.0.0", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/bbf44c9d965e5ff767f14cc8b5aa8f98e1cee681/Boards/ControllinoHW.zip?raw=true", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:d7f79ce738b0608bec3a340252aa79aaa6414b430b0945d5c770601bcb7b47af", - "size": "257287", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MAXI Automation" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.9.2-atmel3.5.3-arduino2" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.3.0-arduino8" - } - ] - }, - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "2.0.1", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/da2516ea2d6f2a5bb7976d3d06ef779da5685312/Boards/ControllinoHW.zip?raw=true", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:4FDAA6E210F68CFB77C5247F7ADE7C55D0065A2B23D6CD27747A932D0E1D8F43", - "size": "240312", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MAXI Automation" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.9.2-atmel3.5.3-arduino2" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.3.0-arduino8" - } - ] - }, - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "3.0.0", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/cca67c1cefa77897be062c05827176a3e8be07c2/Boards/ControllinoHW.zip?raw=true", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:653e16df2533b9fc3f360080876a5285a5aad2b7a8753fdf73eba6a7a1ad4dde", - "size": "63054", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MAXI Automation" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.9.2-atmel3.5.3-arduino2" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.3.0-arduino8" - } - ] - }, - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "3.0.2", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/blob/1b422df4f4d57215d21f15a2c14c8f82d85a69c1/Boards/ControllinoHW.zip?raw=true", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:54122590abc97decb22f9ee698834c999130482eb4801a662fc7e5e4b2b1948f", - "size": "65808", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MAXI Automation" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.9.2-atmel3.5.3-arduino2" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.3.0-arduino8" - } - ] - }, - { - "name": "CONTROLLINO Boards", - "architecture": "avr", - "version": "3.1.0", - "category": "Contributed", - "url": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/raw/master/Boards/ControllinoHW.zip", - "archiveFileName": "ControllinoHW.zip", - "checksum": "SHA-256:3520d650305373537c295874d88805ff49230c00b8db85606ec8a63969259f31", - "size": "65715", - "help": { - "online": "https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library/issues" - }, - "boards": [ - { "name": "MINI" }, - { "name": "MAXI" }, - { "name": "MAXI Automation" }, - { "name": "MEGA" } - ], - "toolsDependencies": [ - { - "packager": "arduino", - "name": "avr-gcc", - "version": "4.9.2-atmel3.5.3-arduino2" - }, - { - "packager": "arduino", - "name": "avrdude", - "version": "6.3.0-arduino8" - } - ] - } - ], - "tools":[] - } - ] -} diff --git a/projects/pid-controller/arduino-libraries/fastgpio-arduino-2.1.0.zip b/projects/pid-controller/arduino-libraries/fastgpio-arduino-2.1.0.zip deleted file mode 100644 index ce2989723..000000000 --- a/projects/pid-controller/arduino-libraries/fastgpio-arduino-2.1.0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:986e4373669ed1885cadd2f9ae51c33f58cf3818a84393bb99409efc652d102f -size 12931 diff --git a/projects/pid-controller/documents/cases/Cassandra.JPG b/projects/pid-controller/documents/cases/Cassandra.JPG deleted file mode 100644 index 8b9bd796a..000000000 --- a/projects/pid-controller/documents/cases/Cassandra.JPG +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:23d4867a8769c40a5ee06ebb74958c4fb39837c65e9d17eb04a34e3ada0a2e26 -size 159294 diff --git a/projects/pid-controller/documents/cases/Cassandra.md b/projects/pid-controller/documents/cases/Cassandra.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.PDF b/projects/pid-controller/documents/cases/Sheetpress cell 4.2.PDF deleted file mode 100644 index 344668d60..000000000 --- a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.PDF +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a14eba1a7253015a42c73b74008569adc4cb4c11e08d9c694d516c6cdb581f23 -size 28771 diff --git a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.md b/projects/pid-controller/documents/cases/Sheetpress cell 4.2.md deleted file mode 100644 index f6f9dfe40..000000000 --- a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.md +++ /dev/null @@ -1,3 +0,0 @@ -## Sheetpress Partitions - - diff --git a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.png b/projects/pid-controller/documents/cases/Sheetpress cell 4.2.png deleted file mode 100644 index 58cb38787..000000000 --- a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:85ba8c521330ecac8f78fa128faa66742547376c2eb5926260ce65dc0adc7c7f -size 110924 diff --git a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.svg b/projects/pid-controller/documents/cases/Sheetpress cell 4.2.svg deleted file mode 100644 index 19cf852fc..000000000 --- a/projects/pid-controller/documents/cases/Sheetpress cell 4.2.svg +++ /dev/null @@ -1,1309 +0,0 @@ - -image/svg+xml636.40 636.40 842.53 848.52 diff --git a/projects/pid-controller/firmware/.gitignore b/projects/pid-controller/firmware/.gitignore deleted file mode 100644 index 5b8b4171c..000000000 --- a/projects/pid-controller/firmware/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -Debug -src -__vm -.vs -node_modules diff --git a/projects/pid-controller/firmware/Addon.cpp b/projects/pid-controller/firmware/Addon.cpp deleted file mode 100644 index bee793c43..000000000 --- a/projects/pid-controller/firmware/Addon.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "Addon.h" -#include -#include -#include - -bool Addon::hasFlag(uchar flag) -{ - return TEST(flags, flag); -} -void Addon::setFlag(uchar flag) -{ - flags = SBI(flags, flag); -} -void Addon::clearFlag(uchar flag) -{ - CBI(flags, flag); -} -void Addon::debug(Stream *stream) -{ - -} -void Addon::info(Stream *stream) -{ - -} -void Addon::enable() -{ - this->clearFlag(DISABLED); -} -void Addon::disable() -{ - this->setFlag(DISABLED); -} -bool Addon::enabled() -{ - return this->hasFlag(DISABLED); -} - -Addon *byId(Addons addons, uchar id) -{ - uchar s = addons.size(); - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (addon->id == id) - { - return addon; - } - } - return NULL; -} \ No newline at end of file diff --git a/projects/pid-controller/firmware/Addon.h b/projects/pid-controller/firmware/Addon.h deleted file mode 100644 index 5497368cc..000000000 --- a/projects/pid-controller/firmware/Addon.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef ADDON_H -#define ADDON_H - -#include -#include - -#include "enums.h" -#include "common/macros.h" - -#define ADDON_NORMAL 1 << LOOP | 1 << INFO | 1 << SETUP -#ifdef HAS_STATES - #define ADDON_STATED ADDON_NORMAL | 1 << STATE -#else - #define ADDON_STATED ADDON_NORMAL -#endif - -class Stream; - -class Addon -{ - -public: - const String name; - const short id; - millis_t now; - millis_t last; - millis_t dt; - Addon(String _name, short _id) : name(_name), - id(_id), - now(0), - last(0), - dt(0) - { - flags = ADDON_NORMAL; - } - - Addon(String _name, short _id, short _flags) : name(_name), - id(_id), - flags(_flags) - { - } - - virtual void debug(Stream *stream); - virtual void info(Stream *stream); - virtual short setup(){}; - virtual short loop(){}; - virtual short ok(){}; - virtual bool pause(){}; - virtual bool resume(){}; - virtual bool destroy(){}; - virtual String state() { return ""; }; - - int flags; - void setFlag(uchar flag); - bool hasFlag(uchar flag); - void clearFlag(uchar flag); - void enable(); - void disable(); - bool enabled(); - - #ifdef HAS_ADDON_EEP_STORE - void save(void* store); - void restore(void* store); - #endif - -}; - -typedef Vector Addons; -Addon *byId(Addons addons, uchar id); -typedef short (Addon::*AddonFnPtr)(short); - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/MultiPIDController.h b/projects/pid-controller/firmware/MultiPIDController.h deleted file mode 100644 index 6e04074fe..000000000 --- a/projects/pid-controller/firmware/MultiPIDController.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MULTI_PID_CONTROLLER_H -#define MULTI_PID_CONTROLLER_H - -#include -#include -#include "../Addon.h" -#include "../config.h" - -#include "./common/macros.h" -#include "./common/ppmath.h" - -class Partition; - -class MultiPIDController : public Addon -{ -public: - MultiPIDController() : Addon(MPID_CTRL_STR, MPIDCTRL, ADDON_STATED) - { - this->setFlag(DEBUG); - } - -private: - Partition *partions[MAX_PARTITIONS]; -}; - -#endif diff --git a/projects/pid-controller/firmware/Partition.h b/projects/pid-controller/firmware/Partition.h deleted file mode 100644 index 411bd7bea..000000000 --- a/projects/pid-controller/firmware/Partition.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef PARTITION_H -#define PARTITION_H - -#include -#include "./config.h" -#include "./macros.h" -#include "./time.h" - -/*** - * The heating cell - */ -class Partition -{ -public: - ushort state; // type: PARTITION_STATE -private: - ushort pin; // GPIO - ushort id; - const char name[124]; // for logging - - // computation memory - millis_t last_active; - millis_t last_duration; - - Partition* next; // for prio/linking -}; - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/TimerOne.cpp b/projects/pid-controller/firmware/TimerOne.cpp deleted file mode 100644 index 7e838d0ae..000000000 --- a/projects/pid-controller/firmware/TimerOne.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 - * Original code by Jesse Tane for http://labs.ideo.com August 2008 - * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support - * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop - * Modified Oct 2009 by Dan Clemens to work with timer1 of the ATMega1280 or Arduino Mega - * Modified April 2012 by Paul Stoffregen - * Modified again, June 2014 by Paul Stoffregen - * Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality - * - * This is free software. You can redistribute it and/or modify it under - * the terms of Creative Commons Attribution 3.0 United States License. - * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ - * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. - * - */ - -#include "TimerOne.h" - -TimerOne Timer1; // preinstatiate - -unsigned short TimerOne::pwmPeriod = 0; -unsigned char TimerOne::clockSelectBits = 0; -void (*TimerOne::isrCallback)() = TimerOne::isrDefaultUnused; - -// interrupt service routine that wraps a user defined function supplied by attachInterrupt -#if defined (__AVR_ATtiny85__) -ISR(TIMER1_COMPA_vect) -{ - Timer1.isrCallback(); -} -#elif defined(__AVR__) -ISR(TIMER1_OVF_vect) -{ - Timer1.isrCallback(); -} - -#elif defined(__arm__) && defined(CORE_TEENSY) -void ftm1_isr(void) -{ - uint32_t sc = FTM1_SC; - #ifdef KINETISL - if (sc & 0x80) FTM1_SC = sc; - #else - if (sc & 0x80) FTM1_SC = sc & 0x7F; - #endif - Timer1.isrCallback(); -} - -#endif - -void TimerOne::isrDefaultUnused() -{ -} diff --git a/projects/pid-controller/firmware/TimerOne.h b/projects/pid-controller/firmware/TimerOne.h deleted file mode 100644 index 940412dd2..000000000 --- a/projects/pid-controller/firmware/TimerOne.h +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 - * Original code by Jesse Tane for http://labs.ideo.com August 2008 - * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support - * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop - * Modified April 2012 by Paul Stoffregen - portable to other AVR chips, use inline functions - * Modified again, June 2014 by Paul Stoffregen - support Teensy 3.x & even more AVR chips - * Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality - * - * - * This is free software. You can redistribute it and/or modify it under - * the terms of Creative Commons Attribution 3.0 United States License. - * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ - * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. - * - */ - -#ifndef TimerOne_h_ -#define TimerOne_h_ - -#if defined(ARDUINO) && ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - -#include "config/known_16bit_timers.h" -#if defined (__AVR_ATtiny85__) -#define TIMER1_RESOLUTION 256UL // Timer1 is 8 bit -#elif defined(__AVR__) -#define TIMER1_RESOLUTION 65536UL // Timer1 is 16 bit -#else -#define TIMER1_RESOLUTION 65536UL // assume 16 bits for non-AVR chips -#endif - -// Placing nearly all the code in this .h file allows the functions to be -// inlined by the compiler. In the very common case with constant values -// the compiler will perform all calculations and simply write constants -// to the hardware registers (for example, setPeriod). - - -class TimerOne -{ - -#if defined (__AVR_ATtiny85__) - public: - //**************************** - // Configuration - //**************************** - void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { - TCCR1 = _BV(CTC1); //clear timer1 when it matches the value in OCR1C - TIMSK |= _BV(OCIE1A); //enable interrupt when OCR1A matches the timer value - setPeriod(microseconds); - } - void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { - const unsigned long cycles = microseconds * ratio; - if (cycles < TIMER1_RESOLUTION) { - clockSelectBits = _BV(CS10); - pwmPeriod = cycles; - } else - if (cycles < TIMER1_RESOLUTION * 2UL) { - clockSelectBits = _BV(CS11); - pwmPeriod = cycles / 2; - } else - if (cycles < TIMER1_RESOLUTION * 4UL) { - clockSelectBits = _BV(CS11) | _BV(CS10); - pwmPeriod = cycles / 4; - } else - if (cycles < TIMER1_RESOLUTION * 8UL) { - clockSelectBits = _BV(CS12); - pwmPeriod = cycles / 8; - } else - if (cycles < TIMER1_RESOLUTION * 16UL) { - clockSelectBits = _BV(CS12) | _BV(CS10); - pwmPeriod = cycles / 16; - } else - if (cycles < TIMER1_RESOLUTION * 32UL) { - clockSelectBits = _BV(CS12) | _BV(CS11); - pwmPeriod = cycles / 32; - } else - if (cycles < TIMER1_RESOLUTION * 64UL) { - clockSelectBits = _BV(CS12) | _BV(CS11) | _BV(CS10); - pwmPeriod = cycles / 64UL; - } else - if (cycles < TIMER1_RESOLUTION * 128UL) { - clockSelectBits = _BV(CS13); - pwmPeriod = cycles / 128; - } else - if (cycles < TIMER1_RESOLUTION * 256UL) { - clockSelectBits = _BV(CS13) | _BV(CS10); - pwmPeriod = cycles / 256; - } else - if (cycles < TIMER1_RESOLUTION * 512UL) { - clockSelectBits = _BV(CS13) | _BV(CS11); - pwmPeriod = cycles / 512; - } else - if (cycles < TIMER1_RESOLUTION * 1024UL) { - clockSelectBits = _BV(CS13) | _BV(CS11) | _BV(CS10); - pwmPeriod = cycles / 1024; - } else - if (cycles < TIMER1_RESOLUTION * 2048UL) { - clockSelectBits = _BV(CS13) | _BV(CS12); - pwmPeriod = cycles / 2048; - } else - if (cycles < TIMER1_RESOLUTION * 4096UL) { - clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS10); - pwmPeriod = cycles / 4096; - } else - if (cycles < TIMER1_RESOLUTION * 8192UL) { - clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11); - pwmPeriod = cycles / 8192; - } else - if (cycles < TIMER1_RESOLUTION * 16384UL) { - clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10); - pwmPeriod = cycles / 16384; - } else { - clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10); - pwmPeriod = TIMER1_RESOLUTION - 1; - } - OCR1A = pwmPeriod; - OCR1C = pwmPeriod; - TCCR1 = _BV(CTC1) | clockSelectBits; - } - - //**************************** - // Run Control - //**************************** - void start() __attribute__((always_inline)) { - TCCR1 = 0; - TCNT1 = 0; - resume(); - } - void stop() __attribute__((always_inline)) { - TCCR1 = _BV(CTC1); - } - void restart() __attribute__((always_inline)) { - start(); - } - void resume() __attribute__((always_inline)) { - TCCR1 = _BV(CTC1) | clockSelectBits; - } - - //**************************** - // PWM outputs - //**************************** - //Not implemented yet for ATTiny85 - //TO DO - - //**************************** - // Interrupt Function - //**************************** - void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { - isrCallback = isr; - TIMSK |= _BV(OCIE1A); - } - void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { - if(microseconds > 0) setPeriod(microseconds); - attachInterrupt(isr); - } - void detachInterrupt() __attribute__((always_inline)) { - //TIMSK = 0; // Timer 0 and Timer 1 both use TIMSK register so setting it to 0 will override settings for Timer1 as well - TIMSK &= ~_BV(OCIE1A); - } - static void (*isrCallback)(); - static void isrDefaultUnused(); - - private: - static unsigned short pwmPeriod; - static unsigned char clockSelectBits; - static const byte ratio = (F_CPU)/ ( 1000000 ); - -#elif defined(__AVR__) - public: - //**************************** - // Configuration - //**************************** - void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { - TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer - TCCR1A = 0; // clear control register A - setPeriod(microseconds); - } - void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { - const unsigned long cycles = (F_CPU / 2000000) * microseconds; - if (cycles < TIMER1_RESOLUTION) { - clockSelectBits = _BV(CS10); - pwmPeriod = cycles; - } else - if (cycles < TIMER1_RESOLUTION * 8) { - clockSelectBits = _BV(CS11); - pwmPeriod = cycles / 8; - } else - if (cycles < TIMER1_RESOLUTION * 64) { - clockSelectBits = _BV(CS11) | _BV(CS10); - pwmPeriod = cycles / 64; - } else - if (cycles < TIMER1_RESOLUTION * 256) { - clockSelectBits = _BV(CS12); - pwmPeriod = cycles / 256; - } else - if (cycles < TIMER1_RESOLUTION * 1024) { - clockSelectBits = _BV(CS12) | _BV(CS10); - pwmPeriod = cycles / 1024; - } else { - clockSelectBits = _BV(CS12) | _BV(CS10); - pwmPeriod = TIMER1_RESOLUTION - 1; - } - ICR1 = pwmPeriod; - TCCR1B = _BV(WGM13) | clockSelectBits; - } - - //**************************** - // Run Control - //**************************** - void start() __attribute__((always_inline)) { - TCCR1B = 0; - TCNT1 = 0; // TODO: does this cause an undesired interrupt? - resume(); - } - void stop() __attribute__((always_inline)) { - TCCR1B = _BV(WGM13); - } - void restart() __attribute__((always_inline)) { - start(); - } - void resume() __attribute__((always_inline)) { - TCCR1B = _BV(WGM13) | clockSelectBits; - } - - //**************************** - // PWM outputs - //**************************** - void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) { - unsigned long dutyCycle = pwmPeriod; - dutyCycle *= duty; - dutyCycle >>= 10; - if (pin == TIMER1_A_PIN) OCR1A = dutyCycle; - #ifdef TIMER1_B_PIN - else if (pin == TIMER1_B_PIN) OCR1B = dutyCycle; - #endif - #ifdef TIMER1_C_PIN - else if (pin == TIMER1_C_PIN) OCR1C = dutyCycle; - #endif - } - void pwm(char pin, unsigned int duty) __attribute__((always_inline)) { - if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); } - #ifdef TIMER1_B_PIN - else if (pin == TIMER1_B_PIN) { pinMode(TIMER1_B_PIN, OUTPUT); TCCR1A |= _BV(COM1B1); } - #endif - #ifdef TIMER1_C_PIN - else if (pin == TIMER1_C_PIN) { pinMode(TIMER1_C_PIN, OUTPUT); TCCR1A |= _BV(COM1C1); } - #endif - setPwmDuty(pin, duty); - TCCR1B = _BV(WGM13) | clockSelectBits; - } - void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) { - if (microseconds > 0) setPeriod(microseconds); - pwm(pin, duty); - } - void disablePwm(char pin) __attribute__((always_inline)) { - if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1); - #ifdef TIMER1_B_PIN - else if (pin == TIMER1_B_PIN) TCCR1A &= ~_BV(COM1B1); - #endif - #ifdef TIMER1_C_PIN - else if (pin == TIMER1_C_PIN) TCCR1A &= ~_BV(COM1C1); - #endif - } - - //**************************** - // Interrupt Function - //**************************** - void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { - isrCallback = isr; - TIMSK1 = _BV(TOIE1); - } - void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { - if(microseconds > 0) setPeriod(microseconds); - attachInterrupt(isr); - } - void detachInterrupt() __attribute__((always_inline)) { - TIMSK1 = 0; - } - static void (*isrCallback)(); - static void isrDefaultUnused(); - - private: - // properties - static unsigned short pwmPeriod; - static unsigned char clockSelectBits; - - - - - - -#elif defined(__arm__) && defined(CORE_TEENSY) - -#if defined(KINETISK) -#define F_TIMER F_BUS -#elif defined(KINETISL) -#define F_TIMER (F_PLL/2) -#endif - - public: - //**************************** - // Configuration - //**************************** - void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { - setPeriod(microseconds); - } - void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { - const unsigned long cycles = (F_TIMER / 2000000) * microseconds; - // A much faster if-else - // This is like a binary serch tree and no more than 3 conditions are evaluated. - // I haven't checked if this becomes significantly longer ASM than the simple ladder. - // It looks very similar to the ladder tho: same # of if's and else's - - /* - // This code does not work properly in all cases :( - // https://github.com/PaulStoffregen/TimerOne/issues/17 - if (cycles < TIMER1_RESOLUTION * 16) { - if (cycles < TIMER1_RESOLUTION * 4) { - if (cycles < TIMER1_RESOLUTION) { - clockSelectBits = 0; - pwmPeriod = cycles; - }else{ - clockSelectBits = 1; - pwmPeriod = cycles >> 1; - } - }else{ - if (cycles < TIMER1_RESOLUTION * 8) { - clockSelectBits = 3; - pwmPeriod = cycles >> 3; - }else{ - clockSelectBits = 4; - pwmPeriod = cycles >> 4; - } - } - }else{ - if (cycles > TIMER1_RESOLUTION * 64) { - if (cycles > TIMER1_RESOLUTION * 128) { - clockSelectBits = 7; - pwmPeriod = TIMER1_RESOLUTION - 1; - }else{ - clockSelectBits = 7; - pwmPeriod = cycles >> 7; - } - } - else{ - if (cycles > TIMER1_RESOLUTION * 32) { - clockSelectBits = 6; - pwmPeriod = cycles >> 6; - }else{ - clockSelectBits = 5; - pwmPeriod = cycles >> 5; - } - } - } - */ - if (cycles < TIMER1_RESOLUTION) { - clockSelectBits = 0; - pwmPeriod = cycles; - } else - if (cycles < TIMER1_RESOLUTION * 2) { - clockSelectBits = 1; - pwmPeriod = cycles >> 1; - } else - if (cycles < TIMER1_RESOLUTION * 4) { - clockSelectBits = 2; - pwmPeriod = cycles >> 2; - } else - if (cycles < TIMER1_RESOLUTION * 8) { - clockSelectBits = 3; - pwmPeriod = cycles >> 3; - } else - if (cycles < TIMER1_RESOLUTION * 16) { - clockSelectBits = 4; - pwmPeriod = cycles >> 4; - } else - if (cycles < TIMER1_RESOLUTION * 32) { - clockSelectBits = 5; - pwmPeriod = cycles >> 5; - } else - if (cycles < TIMER1_RESOLUTION * 64) { - clockSelectBits = 6; - pwmPeriod = cycles >> 6; - } else - if (cycles < TIMER1_RESOLUTION * 128) { - clockSelectBits = 7; - pwmPeriod = cycles >> 7; - } else { - clockSelectBits = 7; - pwmPeriod = TIMER1_RESOLUTION - 1; - } - - uint32_t sc = FTM1_SC; - FTM1_SC = 0; - FTM1_MOD = pwmPeriod; - FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_CPWMS | clockSelectBits | (sc & FTM_SC_TOIE); - } - - //**************************** - // Run Control - //**************************** - void start() __attribute__((always_inline)) { - stop(); - FTM1_CNT = 0; - resume(); - } - void stop() __attribute__((always_inline)) { - FTM1_SC = FTM1_SC & (FTM_SC_TOIE | FTM_SC_CPWMS | FTM_SC_PS(7)); - } - void restart() __attribute__((always_inline)) { - start(); - } - void resume() __attribute__((always_inline)) { - FTM1_SC = (FTM1_SC & (FTM_SC_TOIE | FTM_SC_PS(7))) | FTM_SC_CPWMS | FTM_SC_CLKS(1); - } - - //**************************** - // PWM outputs - //**************************** - void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) { - unsigned long dutyCycle = pwmPeriod; - dutyCycle *= duty; - dutyCycle >>= 10; - if (pin == TIMER1_A_PIN) { - FTM1_C0V = dutyCycle; - } else if (pin == TIMER1_B_PIN) { - FTM1_C1V = dutyCycle; - } - } - void pwm(char pin, unsigned int duty) __attribute__((always_inline)) { - setPwmDuty(pin, duty); - if (pin == TIMER1_A_PIN) { - *portConfigRegister(TIMER1_A_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE; - } else if (pin == TIMER1_B_PIN) { - *portConfigRegister(TIMER1_B_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE; - } - } - void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) { - if (microseconds > 0) setPeriod(microseconds); - pwm(pin, duty); - } - void disablePwm(char pin) __attribute__((always_inline)) { - if (pin == TIMER1_A_PIN) { - *portConfigRegister(TIMER1_A_PIN) = 0; - } else if (pin == TIMER1_B_PIN) { - *portConfigRegister(TIMER1_B_PIN) = 0; - } - } - - //**************************** - // Interrupt Function - //**************************** - void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { - isrCallback = isr; - FTM1_SC |= FTM_SC_TOIE; - NVIC_ENABLE_IRQ(IRQ_FTM1); - } - void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { - if(microseconds > 0) setPeriod(microseconds); - attachInterrupt(isr); - } - void detachInterrupt() __attribute__((always_inline)) { - FTM1_SC &= ~FTM_SC_TOIE; - NVIC_DISABLE_IRQ(IRQ_FTM1); - } - static void (*isrCallback)(); - static void isrDefaultUnused(); - - private: - // properties - static unsigned short pwmPeriod; - static unsigned char clockSelectBits; - -#undef F_TIMER - -#endif -}; - -extern TimerOne Timer1; - -#endif - diff --git a/projects/pid-controller/firmware/Version.h b/projects/pid-controller/firmware/Version.h deleted file mode 100644 index faf26dc9c..000000000 --- a/projects/pid-controller/firmware/Version.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef VERSION_H - - #define VERSION_H - - #define VERSION "0.7|2f05843f89b2b8f6d75276ba363f7c2e17383e0b" - - #define CID "47" - - #endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/addons/CurrentSensor.h b/projects/pid-controller/firmware/addons/CurrentSensor.h deleted file mode 100644 index a6ebf9894..000000000 --- a/projects/pid-controller/firmware/addons/CurrentSensor.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CURRENT_SENSOR_H -#define CURRENT_SENSOR_H - -#include -#include -#include "../Addon.h" -#include "../config.h" - -#include "../common/macros.h" -#include "../common/ppmath.h" - -class CurrentSensor : public Addon -{ -public: - CurrentSensor(short _pin) : pin(_pin), - load(0), - Addon(CURRENT_SENSOR_STR, CURRENT_SENSOR) - { - // this->setFlag(DEBUG); - } - - short setup() - { - pinMode(pin, INPUT); - loop(); - } - - short loop() - { - if (now - last > MOTOR_LOAD_READ_INTERVAL) - { - load = digitalRead(pin); - last = now; - } - return load; - } - - short ok() - { - return !load; - } - - void debug(Stream *stream) - { - *stream << this->name << ":" << ok(); - } - - void info(Stream *stream) - { - *stream << this->name << "\n\t : " SPACE("Pin:" << pin); - } - - millis_t lastOverload; - -protected: - short pin; - short load; -}; -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/addons/DirectionSwitch.h b/projects/pid-controller/firmware/addons/DirectionSwitch.h deleted file mode 100644 index 71bffb72d..000000000 --- a/projects/pid-controller/firmware/addons/DirectionSwitch.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef DIRECTION_SWITCH_H -#define DIRECTION_SWITCH_H - -#include "../config.h" -#include "../components/3PosAnalog.h" -#include "../Addon.h" -#include -#include "../common/macros.h" - -class DirectionSwitch : public Addon -{ -public: - Pos3Analog dir_switch; - DirectionSwitch() : dir_switch(DIR_SWITCH_UP_PIN, DIR_SWITCH_DOWN_PIN), - Addon(DIRECTION_SWITCH_STR, DIRECTION_SWITCH) - { - - } - - void debug(Stream *stream) - { - *stream << this->name << ":" << SPACE(dir_switch.switch_pos) << SPACE(dir_switch.last_switch); - } - void info(Stream *stream) - { - *stream << this->name << "\n\t : " SPACE("Up Pin:" << DIR_SWITCH_UP_PIN) << SPACE("\t | Down Pin :" << DIR_SWITCH_DOWN_PIN); - } - short setup() - { - dir_switch.setup(); - return loop(); - } - short loop() - { - if (now - dt > ANALOG_READ_INTERVAL) - { - _value = dir_switch.loop(); - dt = now; - } - return _value; - } - short value() - { - return _value; - } - - short last() - { - return dir_switch.last_switch; - } - -private: - short _value; -}; - -#endif diff --git a/projects/pid-controller/firmware/addons/MotorTemperature.h b/projects/pid-controller/firmware/addons/MotorTemperature.h deleted file mode 100644 index 63d152cde..000000000 --- a/projects/pid-controller/firmware/addons/MotorTemperature.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef MOTOR_TEMPERATURE_H -#define MOTOR_TEMPERATURE_H - -#include -#include "Addon.h" -#include "config.h" -#include -#include "../common/macros.h" -#include "TemperatureSensor.h" - -class MotorTemperature : public Addon -{ -private: - TemperatureSensor sensor; - -public: - MotorTemperature() : sensor(MOTOR_TEMPERTURE_SCK_PIN, MOTOR_TEMPERTURE_CS_PIN, MOTOR_TEMPERTURE_SO_PIN, MOTOR_TEMPERTURE_MAX, MOTOR_TEMPERTURE_INTERVAL), - Addon(MOTOR_TEMPERATURE_STR, MOTOR_TEMPERATURE) {} - - virtual short ok() - { - return sensor.ok(); - } - void debug(Stream *stream) - { - // *stream << this->name << ":" << this->ok(); - } - void info(Stream *stream) - { - /* - *stream << this->name << "\n\t : " << - SPACE("Pin SCK:" << MOTOR_TEMPERTURE_SCK_PIN ) << - SPACE("Pin CS :" << MOTOR_TEMPERTURE_CS_PIN ) << - SPACE("Pin SO:" << MOTOR_TEMPERTURE_SO_PIN ) << - SPACE("Max" << MOTOR_TEMPERTURE_MAX ) << - SPACE("Interval" << MOTOR_TEMPERTURE_INTERVAL ); - */ - } -}; -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/addons/OperationModeSwitch.h b/projects/pid-controller/firmware/addons/OperationModeSwitch.h deleted file mode 100644 index 4822eab45..000000000 --- a/projects/pid-controller/firmware/addons/OperationModeSwitch.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef OPERATION_MODE_SWITCH_H -#define OPERATION_MODE_SWITCH_H - -#ifdef HAS_STATES -#include -#endif - -#ifndef OP_MODE_ANALOG -#include -#endif - -#include "../config.h" -#include "../Addon.h" -#include -#include "../common/macros.h" -#include "../common/ppmath.h" - -class OperationModeSwitch : public Addon -{ - -public: - short pin1; -#ifdef OP_MODE_ANALOG - ushort level1; - ushort level2; - ushort level3; - OperationModeSwitch(short _pin1, ushort _level1, ushort _level2, ushort _level3) : pin1(_pin1), - level1(_level1), - level2(_level2), - level3(_level3), - Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH) - { - //setFlag(DEBUG); - } -#ifdef HAS_STATES - String state() - { - const int capacity = JSON_OBJECT_SIZE(2); - StaticJsonDocument doc; - doc['0'] = id; - doc['1'] = value(); - return doc.as(); - } -#endif - void debug(Stream *stream) - { - //*stream << this->name << SPACE(value()); - } - void info(Stream *stream) - { - //*stream << this->name << "\n\t "; - } - - short value() - { - ushort value = analogRead(pin1); - if (RANGE(value, level1 - 10, level1 + 10)) - { - return OP_DEBUG; - } - if (RANGE(value, level2 - 10, level2 + 10)) - { - return OP_NORMAL; - } - if (RANGE(value, level3 - 10, level3 + 10)) - { - return OP_SERVICE; - } - return OP_NONE; - } - short setup() - { - } - - short loop() - { - // Serial.println(analogRead(pin1)); - } - -#else - Bounce debouncer1; - Bounce debouncer2; - Bounce debouncer3; - short pin1; - short pin2; - short pin3; - - OperationModeSwitch(short _pin1, short _pin2, short _pin3) : pin1(_pin1), // 1-2 - pin2(_pin2), // 5-6 - pin3(_pin3), // 9-10 - Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH) - { - } - - void debug(Stream *stream) - { - *stream << this->name << ": PIN1 " << SPACE(!debouncer1.read()) << ": PIN2 " << SPACE(!debouncer2.read()) << ": PIN3 " << SPACE(!debouncer3.read()); - } - void info(Stream *stream) - { - *stream << this->name << "\n\t : "; - } - - short value() - { - if (!debouncer1.read()) - { - return OP_DEBUG; - } - - if (!debouncer2.read()) - { - return OP_NORMAL; - } - - if (!debouncer3.read()) - { - return OP_SERVICE; - } - - return OP_NONE; - } - short setup() - { - this->debouncer1 = Bounce(); - this->debouncer1.attach(this->pin1, INPUT_PULLUP); - this->debouncer1.interval(25); - - this->debouncer2 = Bounce(); - this->debouncer2.attach(this->pin2, INPUT_PULLUP); - this->debouncer2.interval(25); - - this->debouncer3 = Bounce(); - this->debouncer3.attach(this->pin3, INPUT_PULLUP); - this->debouncer3.interval(25); - } - - short loop() - { - this->debouncer1.update(); - this->debouncer2.update(); - this->debouncer3.update(); - } - -#endif -}; - -#endif diff --git a/projects/pid-controller/firmware/addons/Reset.h b/projects/pid-controller/firmware/addons/Reset.h deleted file mode 100644 index 9b1cab20f..000000000 --- a/projects/pid-controller/firmware/addons/Reset.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef RESET_H -#define RESET_H - -// This module uses currently a normally closed momentary button. - -static millis_t sw_reset_TS = 0; - -static void reset_setup() -{ - pinMode(RESET_PIN, INPUT_PULLUP); - sw_reset_TS = millis(); -} - -static void reset_loop() -{ - if (millis() - sw_reset_TS > RESET_INTERVAL) { - #if RESET_NC == true - // globals.isReset = digitalRead(RESET_PIN); - #else - // globals.isReset = !digitalRead(RESET_PIN); - #endif - - sw_reset_TS = millis(); - // if(globals.isReset && DEBUG){ - // Serial.println("reset"); - // } - } -} - -#endif diff --git a/projects/pid-controller/firmware/addons/Status.h b/projects/pid-controller/firmware/addons/Status.h deleted file mode 100644 index 1fd66289c..000000000 --- a/projects/pid-controller/firmware/addons/Status.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef STATUS_H -#define STATUS_H - -#include "../addon.h" -#include "../types.h" -#include "../common/macros.h" - -#include - -class Status : public Addon -{ -public: - Status(short _errorPin, short _okPin) : errorPin(_errorPin), - okPin(_okPin), - status_blink_TS(0), - doBlink(false), - last_blink(true), - blink_start_ts(0), - max_blink_time(HOUR_MS), - Addon(STATUS_STR, STATUS) - { - } - - short setup() - { - pinMode(okPin, OUTPUT); - pinMode(errorPin, OUTPUT); - } - - short loop() - { - if (now - status_blink_TS > 1000) - { - status_blink_TS = millis(); - last_blink = !last_blink; - if (doBlink) - { - digitalWrite(errorPin, last_blink); - } - - if (now - blink_start_ts > max_blink_time) - { - doBlink = false; - } - } - } - void status_blink(bool blink) - { - if (!doBlink && blink) - { - blink_start_ts = millis(); - } - doBlink = blink; - } - - void setStatusAllOn() - { - if (doBlink) - { - return; - } - digitalWrite(errorPin, HIGH); - digitalWrite(okPin, HIGH); - } - - void setStatusAllOff() - { - if (doBlink) - { - return; - } - digitalWrite(errorPin, LOW); - digitalWrite(okPin, LOW); - } - - void setStatus(bool error) - { - if (doBlink) - { - return; - } - if (error) - { - digitalWrite(errorPin, HIGH); - digitalWrite(okPin, LOW); - } - else - { - digitalWrite(okPin, HIGH); - digitalWrite(errorPin, LOW); - } - } - - void info(Stream *stream) - { - *stream << this->name << "\n\t : " SPACE("Error Pin:" << errorPin) << SPACE("\t | Ok Pin :" << okPin); - } - -private: - millis_t status_blink_TS; - bool doBlink; - bool last_blink; - millis_t blink_start_ts; - millis_t max_blink_time; - - short okPin; - short errorPin; -}; - -#endif diff --git a/projects/pid-controller/firmware/addons/TemperatureSensor.h b/projects/pid-controller/firmware/addons/TemperatureSensor.h deleted file mode 100644 index e17f9953c..000000000 --- a/projects/pid-controller/firmware/addons/TemperatureSensor.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef TEMPERATURE_SENSOR_H -#define TEMPERATURE_SENSOR_H - -#include -#include "../config.h" -#include "../macros.h" -#include "../time.h" - -class TemperatureSensor -{ - -public: - TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)), - temperature(), - temperature_TS(millis()), - maxTemp(_max), - interval(_interval) {} - - bool ok() - { - return temperature < maxTemp; - } - - void loop() - { - - if (millis() - temperature_TS > interval) - { - temperature_TS = millis(); - temperature = ktc.readCelsius(); - } - } - -private: - MAX6675 ktc; - short temperature; - short maxTemp; - short interval; - millis_t temperature_TS; -}; - -#endif diff --git a/projects/pid-controller/firmware/app.cpp b/projects/pid-controller/firmware/app.cpp deleted file mode 100644 index 458e84f49..000000000 --- a/projects/pid-controller/firmware/app.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#include -#include -#include -#include "app.h" -#include "features.h" -#include -#include "Version.h" - -// #define DEBUG_MEM - -static Addon *addonsArray[10]; - -#ifdef HAS_STATES -short App::appState(short nop) -{ - uchar s = addons.size(); - uchar si = 0; - String out = ""; - uchar l = numByFlag(STATE); - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (!!(addon->hasFlag(STATE))) - { - si++; - out += addon->state(); - if (si < l) - { - out += ","; - } - } - } - const char *response = Bridge::CreateResponse(STATE_RESPONSE_CODE, 0, out.c_str()); - Serial.write(response); -} -#endif - -short App::ok() -{ - return E_OK; -} - -App::App() : Addon("APP", APP, 1 << STATE), -#ifdef HAS_STATUS - status(new Status(STATUS_ERROR_PIN, STATUS_OK_PIN)), -#endif - cSensor(new CurrentSensor(CURRENT_SENSOR_PIN)) -{ -} - -short App::getAppState(short val) -{ - return _state; -} -void (*resetFunction)(void) = 0; // Self reset (to be used with watchdog) - -void printMem() -{ - Serial.print("mem: "); - Serial.print(freeMemory()); - Serial.println('--'); -} -short App::setup() -{ - Serial.begin(DEBUG_BAUD_RATE); - Serial.print("Booting Firmware ...................... \n\n"); - Serial.print(FIRMWARE_VERSION); - Serial.print(" | "); - Serial.print(VERSION); - Serial.print(" | "); - Serial.print(CID); - Serial.println(" - \n"); - addons.setStorage(addonsArray); - setup_addons(); - -#ifdef MEARSURE_PERFORMANCE - printPerfTS = 0; - addonLoopTime = 0; - bridgeLoopTime = 0; -#endif - debugTS = 0; - loopTS = 0; - _state = 0; -#ifdef DEBUG_MEM - timer.every( - 5000, [](App *app) -> void { - printMem(); - }, - this); -#endif -} - -void App::onError(int error) -{ - if (_state != ERROR) - { -#ifdef HAS_STATUS - status->status_blink(true); -#endif - - _state = ERROR; - } -} - -short App::loop() -{ - timer.tick(); - now = millis(); - loop_addons(); - loop_com(); - loop_pid(); - delay(LOOP_DELAY); -} - -void App::loop_com() -{ - if (millis() - comTS > 300) - { -#if defined(HAS_BRIDGE) && defined(HAS_SERIAL) - PPSerial::Message *msg = serialBridge->read(); - if (msg) - { - switch (msg->verb) - { - - case Bridge::EC_METHOD: - { - char *strings[3]; - char *ptr = NULL; - byte index = 0; - - ptr = strtok(msg->payload, ":"); - - while (ptr != NULL && index < 4) - { - strings[index] = ptr; - index++; - ptr = strtok(NULL, ":"); - } - - int id = atoi(strings[0]); - char *_method = strings[1]; - - SKeyVal *method = VSL::instance()->hasMethod(id, _method); - if (method) - { - int arg = atoi(strings[2]); - Addon *addon = (Addon *)method->instance; - AddonFnPtr ptr = method->mPtr; - short ret = (addon->*ptr)(arg); - - if (TEST(msg->flags, Bridge::STATE)) - { - #ifdef HAS_STATES - this->appState(0); - #endif - } - else if (TEST(msg->flags, Bridge::RECEIPT)) - { - #ifdef BRIDGE_HAS_RESPONSE - const char *response = Bridge::CreateResponse(msg->id, 0, ret); - Serial.write(response); - #endif - } - if (TEST(msg->flags, Bridge::DEBUG)) - { - // Serial.println("Called command"); - } - } - else - { - VSL::instance()->debug(); - if (TEST(msg->flags, Bridge::DEBUG)) - { - /* - Serial.print("Incoming message, cant find class & method "); - Serial.print(_class); - Serial.print(":"); - Serial.print(_method); - Serial.print("\n"); - */ - } - } - break; - } - } - msg->payload = NULL; - } -#endif - comTS = millis(); - } -} diff --git a/projects/pid-controller/firmware/app.h b/projects/pid-controller/firmware/app.h deleted file mode 100644 index 82a072e1c..000000000 --- a/projects/pid-controller/firmware/app.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef APP_H -#define APP_H - -#include "config.h" -#include -#include "types.h" -#include "Addon.h" -#include "common/timer.h" - -class DirectionSwitch; -class CurrentSensor; -class Status; -class PPSerial; -class ModbusBridge; - -class App : public Addon -{ - -public: - App(); - - DirectionSwitch *dirSwitch; - CurrentSensor *cSensor; - Status *status; - - PPSerial *serialBridge; - ModbusBridge *modbusBridge; - - Addon *byId(short id); - - short setup(); - short loop(); - short debug(); - short info(); - short ok(); - - void loop_service(); - void loop_com(); - void loop_simulate(); - void loop_pid(); - void loop_addons(); - void setup_addons(); - void onDidSetupAddons(); - - ushort numByFlag(ushort flag); - short shred(short value = 0); - ushort loopShred(); - void loopShredCancel(); - - void onError(int error); - - Vector addons; - - // bridge - short setFlag(ushort addonId, ushort flag); - -#ifdef HAS_STATES - short appState(short nop = 0); - String state(); -#endif - - millis_t loopTS; - millis_t wait; - millis_t comTS; - millis_t waitTS; - Timer<10, millis> timer; // 10 concurrent tasks, using micros as resolution - - enum APP_STATE - { - RESET = 0, - REMOTE = 2, - LOCAL = 3, - TEST = 3, - ERROR = 5 - }; - - short _state; - short _error; - short getLastError(short val = 0){ - return _error; - } - short setLastError(short val = 0); - short setAppState(short newState); - short getAppState(short val); - -private: - -#ifdef MEARSURE_PERFORMANCE - millis_t addonLoopTime; - millis_t bridgeLoopTime; - millis_t printPerfTS; -#endif - - millis_t debugTS; -}; - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/app_addons.cpp b/projects/pid-controller/firmware/app_addons.cpp deleted file mode 100644 index b43e54f9e..000000000 --- a/projects/pid-controller/firmware/app_addons.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include -#include "app.h" -#include "config.h" -#include "types.h" -#include "common/macros.h" -#include "Addon.h" -#include "features.h" - - -void App::onDidSetupAddons(){ - - #ifdef HAS_STATUS - status->setStatusAllOn(); - delay(SECS * 2); - status->setStatusAllOff(); - status->setStatus(false); - #endif -} - -short App::setFlag(ushort addonId, ushort flag) -{ - Addon *addon = byId(addonId); - if (addon) - { - addon->setFlag(flag); - return E_OK; - } - return ERROR_WARNING; -} - -ushort App::numByFlag(ushort flag) -{ - uchar s = addons.size(); - uchar l = 0; - String out = ""; - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (!!(addon->hasFlag(flag))) - { - l++; - } - } - return l; -} - -short App::debug() -{ -#ifndef MEARSURE_PERFORMANCE - if (millis() - debugTS > DEBUG_INTERVAL) - { - uchar s = addons.size(); - uchar nb = 0; - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (addon->hasFlag(DEBUG)) - { - (addon->debug)(&Serial); - Serial.println("\n"); - nb++; - } - } - if (nb) - { - Serial.println("\n"); - } - debugTS = millis(); - } -#endif -} - -short App::info() -{ - Serial.print("Addon configuration : \n\n"); - uchar s = addons.size(); - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (addon->hasFlag(INFO)) - { - addon->info(&Serial); - Serial << "\n"; - } - } -} - -Addon *App::byId(short id) -{ - uchar s = addons.size(); - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (addon->id == id) - { - return addon; - } - } - return NULL; -} - -void App::setup_addons() -{ -#ifdef HAS_STATUS - addons.push_back((Addon *)status); -#endif - addons.push_back((Addon *)cSensor); - addons.push_back((Addon *)this); - - uchar s = addons.size(); - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (addon->hasFlag(SETUP)) - { - addon->setup(); - } - } - onDidSetupAddons(); -} -void App::loop_addons() -{ - -#ifdef MEARSURE_PERFORMANCE - millis_t now = millis(); -#endif - - uchar s = addons.size(); - for (uchar i = 0; i < s; i++) - { - Addon *addon = addons[i]; - if (addon->hasFlag(LOOP)) - { - addon->now = now; - addon->loop(); - } - } - -#ifdef MEARSURE_PERFORMANCE - addonLoopTime = millis() - now; - if (millis() - printPerfTS > 3000) - { - printPerfTS = now; - Serial << SPACE("Addon loop time") << addonLoopTime << "\n"; - } -#endif - debug(); -} diff --git a/projects/pid-controller/firmware/app_ctrl.cpp b/projects/pid-controller/firmware/app_ctrl.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/projects/pid-controller/firmware/app_pid.cpp b/projects/pid-controller/firmware/app_pid.cpp deleted file mode 100644 index b35f79562..000000000 --- a/projects/pid-controller/firmware/app_pid.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "app.h" - diff --git a/projects/pid-controller/firmware/auto-tune/Examples/AutoTune_Example/AutoTune_Example.pde b/projects/pid-controller/firmware/auto-tune/Examples/AutoTune_Example/AutoTune_Example.pde deleted file mode 100644 index 64131f3cb..000000000 --- a/projects/pid-controller/firmware/auto-tune/Examples/AutoTune_Example/AutoTune_Example.pde +++ /dev/null @@ -1,161 +0,0 @@ -#include -#include - -byte ATuneModeRemember=2; -double input=80, output=50, setpoint=180; -double kp=2,ki=0.5,kd=2; - -double kpmodel=1.5, taup=100, theta[50]; -double outputStart=5; -double aTuneStep=50, aTuneNoise=1, aTuneStartValue=100; -unsigned int aTuneLookBack=20; - -boolean tuning = false; -unsigned long modelTime, serialTime; - -PID myPID(&input, &output, &setpoint,kp,ki,kd, DIRECT); -PID_ATune aTune(&input, &output); - -//set to false to connect to the real world -boolean useSimulation = true; - -void setup() -{ - if(useSimulation) - { - for(byte i=0;i<50;i++) - { - theta[i]=outputStart; - } - modelTime = 0; - } - //Setup the pid - myPID.SetMode(AUTOMATIC); - - if(tuning) - { - tuning=false; - changeAutoTune(); - tuning=true; - } - - serialTime = 0; - Serial.begin(9600); - -} - -void loop() -{ - - unsigned long now = millis(); - - if(!useSimulation) - { //pull the input in from the real world - input = analogRead(0); - } - - if(tuning) - { - byte val = (aTune.Runtime()); - if (val!=0) - { - tuning = false; - } - if(!tuning) - { //we're done, set the tuning parameters - kp = aTune.GetKp(); - ki = aTune.GetKi(); - kd = aTune.GetKd(); - myPID.SetTunings(kp,ki,kd); - AutoTuneHelper(false); - } - } - else myPID.Compute(); - - if(useSimulation) - { - theta[30]=output; - if(now>=modelTime) - { - modelTime +=100; - DoModel(); - } - } - else - { - analogWrite(0,output); - } - - //send-receive with processing if it's time - if(millis()>serialTime) - { - SerialReceive(); - SerialSend(); - serialTime+=500; - } -} - -void changeAutoTune() -{ - if(!tuning) - { - //Set the output to the desired starting frequency. - output=aTuneStartValue; - aTune.SetNoiseBand(aTuneNoise); - aTune.SetOutputStep(aTuneStep); - aTune.SetLookbackSec((int)aTuneLookBack); - AutoTuneHelper(true); - tuning = true; - } - else - { //cancel autotune - aTune.Cancel(); - tuning = false; - AutoTuneHelper(false); - } -} - -void AutoTuneHelper(boolean start) -{ - if(start) - ATuneModeRemember = myPID.GetMode(); - else - myPID.SetMode(ATuneModeRemember); -} - - -void SerialSend() -{ - Serial.print("setpoint: ");Serial.print(setpoint); Serial.print(" "); - Serial.print("input: ");Serial.print(input); Serial.print(" "); - Serial.print("output: ");Serial.print(output); Serial.print(" "); - if(tuning){ - Serial.println("tuning mode"); - } else { - Serial.print("kp: ");Serial.print(myPID.GetKp());Serial.print(" "); - Serial.print("ki: ");Serial.print(myPID.GetKi());Serial.print(" "); - Serial.print("kd: ");Serial.print(myPID.GetKd());Serial.println(); - } -} - -void SerialReceive() -{ - if(Serial.available()) - { - char b = Serial.read(); - Serial.flush(); - if((b=='1' && !tuning) || (b!='1' && tuning))changeAutoTune(); - } -} - -void DoModel() -{ - //cycle the dead time - for(byte i=0;i<49;i++) - { - theta[i] = theta[i+1]; - } - //compute the input - input = (kpmodel / taup) *(theta[0]-outputStart) + input*(1-1/taup) + ((float)random(-10,10))/100; - -} diff --git a/projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.cpp b/projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.cpp deleted file mode 100644 index 4d0e11eea..000000000 --- a/projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#if ARDUINO >= 100 - #include "Arduino.h" -#else - #include "WProgram.h" -#endif - -#include - - -PID_ATune::PID_ATune(double* Input, double* Output) -{ - input = Input; - output = Output; - controlType =0 ; //default to PI - noiseBand = 0.5; - running = false; - oStep = 30; - SetLookbackSec(10); - lastTime = millis(); - -} - - - -void PID_ATune::Cancel() -{ - running = false; -} - -int PID_ATune::Runtime() -{ - justevaled=false; - if(peakCount>9 && running) - { - running = false; - FinishUp(); - return 1; - } - unsigned long now = millis(); - - if((now-lastTime)absMax)absMax=refVal; - if(refValsetpoint+noiseBand) *output = outputStart-oStep; - else if (refVal=0;i--) - { - double val = lastInputs[i]; - if(isMax) isMax = refVal>val; - if(isMin) isMin = refVal2) - { //we've transitioned. check if we can autotune based on the last peaks - double avgSeparation = (abs(peaks[peakCount-1]-peaks[peakCount-2])+abs(peaks[peakCount-2]-peaks[peakCount-3]))/2; - if( avgSeparation < 0.05*(absMax-absMin)) - { - FinishUp(); - running = false; - return 1; - - } - } - justchanged=false; - return 0; -} -void PID_ATune::FinishUp() -{ - *output = outputStart; - //we can generate tuning parameters! - Ku = 4*(2*oStep)/((absMax-absMin)*3.14159); - Pu = (double)(peak1-peak2) / 1000; -} - -double PID_ATune::GetKp() -{ - return controlType==1 ? 0.6 * Ku : 0.4 * Ku; -} - -double PID_ATune::GetKi() -{ - return controlType==1? 1.2*Ku / Pu : 0.48 * Ku / Pu; // Ki = Kc/Ti -} - -double PID_ATune::GetKd() -{ - return controlType==1? 0.075 * Ku * Pu : 0; //Kd = Kc * Td -} - -void PID_ATune::SetOutputStep(double Step) -{ - oStep = Step; -} - -double PID_ATune::GetOutputStep() -{ - return oStep; -} - -void PID_ATune::SetControlType(int Type) //0=PI, 1=PID -{ - controlType = Type; -} -int PID_ATune::GetControlType() -{ - return controlType; -} - -void PID_ATune::SetNoiseBand(double Band) -{ - noiseBand = Band; -} - -double PID_ATune::GetNoiseBand() -{ - return noiseBand; -} - -void PID_ATune::SetLookbackSec(int value) -{ - if (value<1) value = 1; - - if(value<25) - { - nLookBack = value * 4; - sampleTime = 250; - } - else - { - nLookBack = 100; - sampleTime = value*10; - } -} - -int PID_ATune::GetLookbackSec() -{ - return nLookBack * sampleTime / 1000; -} diff --git a/projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.h b/projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.h deleted file mode 100644 index f029c062c..000000000 --- a/projects/pid-controller/firmware/auto-tune/PID_AutoTune_v0.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef PID_AutoTune_v0 -#define PID_AutoTune_v0 -#define LIBRARY_VERSION 0.0.1 - -class PID_ATune -{ - - - public: - //commonly used functions ************************************************************************** - PID_ATune(double*, double*); // * Constructor. links the Autotune to a given PID - int Runtime(); // * Similar to the PID Compue function, returns non 0 when done - void Cancel(); // * Stops the AutoTune - - void SetOutputStep(double); // * how far above and below the starting value will the output step? - double GetOutputStep(); // - - void SetControlType(int); // * Determies if the tuning parameters returned will be PI (D=0) - int GetControlType(); // or PID. (0=PI, 1=PID) - - void SetLookbackSec(int); // * how far back are we looking to identify peaks - int GetLookbackSec(); // - - void SetNoiseBand(double); // * the autotune will ignore signal chatter smaller than this value - double GetNoiseBand(); // this should be acurately set - - double GetKp(); // * once autotune is complete, these functions contain the - double GetKi(); // computed tuning parameters. - double GetKd(); // - - private: - void FinishUp(); - bool isMax, isMin; - double *input, *output; - double setpoint; - double noiseBand; - int controlType; - bool running; - unsigned long peak1, peak2, lastTime; - int sampleTime; - int nLookBack; - int peakType; - double lastInputs[101]; - double peaks[10]; - int peakCount; - bool justchanged; - bool justevaled; - double absMax, absMin; - double oStep; - double outputStart; - double Ku, Pu; - -}; -#endif - diff --git a/projects/pid-controller/firmware/bridge.cpp b/projects/pid-controller/firmware/bridge.cpp deleted file mode 100644 index b892d6ffc..000000000 --- a/projects/pid-controller/firmware/bridge.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include "bridge.h" -#include -#include -#include "constants.h" - -typedef struct -{ - short key; - char *value; -} TAddons; - -const TAddons addonsDict[]{}; - -static VSL *_instance; -class SKeyVal; -SKeyVal *clazzMaps[20]; -Vector clazzes; - -class SKeyValS -{ -public: - void *instance; - ushort id; - SKeyValS() {} - SKeyValS(void *_instance, ushort _id) : instance(_instance), - id(_id) {} -}; - -char *getAddonName(short key) -{ - for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i) - { - if (addonsDict[i].key == key) - { - return addonsDict[i].value; - } - } - return NULL; -} -short getAddonKey(String name) -{ - for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i) - { - if (name.equals(String(addonsDict[i].value))) - { - return addonsDict[i].value; - } - } - return -1; -} - -void VSL::init() -{ - _instance = new VSL(); - clazzes.setStorage(clazzMaps); -} - -VSL *VSL::instance() -{ - if (!_instance) - { - VSL::init(); - } - return _instance; -} - -SKeyVal *VSL::hasMethod(ushort id, String methodName) -{ - uchar s = clazzes.size(); - for (uchar i = 0; i < s; i++) - { - - SKeyVal *val = clazzes.at(i); - if (val->key == id && val->methodName.equals(methodName)) - { - return val; - } - } - return NULL; -} -void VSL::debug() -{ -#ifdef BRIDGE_DEBUG - uchar s = clazzes.size(); - for (uchar i = 0; i < s; i++) - { - SKeyVal *val = clazzes.at(i); - Serial.print(val->className); - Serial.print(":"); - Serial.print(val->methodName); - Serial.print("\n"); - } -#endif -} - -SKeyVal *VSL::registerMemberFunction(ushort id, Addon *clazz, char *method, AddonFnPtr ptr, char *ret) -{ - SKeyVal *meth = hasMethod(id, method); - if (meth) - { -#ifdef BRIDGE_DEBUG - Serial << "Register class member: " - << SPACE(name << "::" << method) - << "already registered! \n"; -#endif - } - else - { -#ifdef BRIDGE_DEBUG - if (!getAddonKey(name)) - { - Serial.println("invalid addon key"); - } -#endif - meth = new SKeyVal(id, clazz, method, ptr); - //Serial << "Register member method:" - // << SPACE(meth->className << "::" << meth->methodName) - // << "\n"; - clazzes.push_back(meth); - } -} diff --git a/projects/pid-controller/firmware/bridge.h b/projects/pid-controller/firmware/bridge.h deleted file mode 100644 index 1dc2c83ce..000000000 --- a/projects/pid-controller/firmware/bridge.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef BRDIGE_H -#define BRIDGE_H - -#include "Addon.h" -#include -class App; -class SKeyVal; -class SKeyValS; - -class SKeyVal -{ -public: - short key; - void *instance; - String methodName; - AddonFnPtr mPtr; - SKeyVal() {} - SKeyVal(ushort _key, void *_instance, String _methodName, AddonFnPtr _mPtr) : key(_key), - instance(_instance), - methodName(_methodName), - mPtr(_mPtr) {} -}; -class VSL -{ -public: - SKeyVal *registerMemberFunction( - ushort id, - Addon *clazz, - char *method, - AddonFnPtr ptr, - char *ret); - - static void init(); - static VSL *instance(); - SKeyVal *VSL::hasMethod(ushort id, String method); - void debug(); -}; - -#define REGISTER_CLASS_MEMBER_FN(id, inst, methodName, method, ret) \ - { \ - VSL::instance()->registerMemberFunction(id, inst, methodName, method, "2"); \ - } -#endif - -namespace Bridge -{ - -static const char *START_STR = "<<"; -static const char *END_STR = ">>"; -static const char RESPONSE_DEL = ';'; -static const char *CreateResponse(short id, short error, short ret) -{ - static char response[1024] = {'\0'}; - snprintf(response, sizeof(response), "%s%d%c%d%c%d%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR); - return response; -} -static const char *CreateResponse(short id, short error, const char *ret) -{ - static char response[1024] = {'\0'}; - snprintf(response, sizeof(response), "%s%d%c%d%c%s%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR); - return response; -} - -enum ECALLS -{ - EC_COMMAND = 1, - EC_METHOD = 2, - EC_FUNC = 3, - EC_USER = 10 -}; - -enum MessageFlags -{ - NEW = 1, - PROCESSING = 2, - PROCESSED = 3, - DEBUG = 4, - RECEIPT = 5, - STATE = 6 -}; -} // namespace Bridge diff --git a/projects/pid-controller/firmware/common/Pin.h b/projects/pid-controller/firmware/common/Pin.h deleted file mode 100644 index 1d2688ca5..000000000 --- a/projects/pid-controller/firmware/common/Pin.h +++ /dev/null @@ -1,512 +0,0 @@ -#ifndef PIN_H -#define PIN_H - -// this class doesn't outperform fastgpio but is works with AtmelMega - -#include - -#define DDR_HIGH (*_DDR |= _offset) ///< Set the DDR register to HIGH for the pin -#define DDR_TOGGLE (*_DDR ^= _offset) ///< Set the DDR register to the inverse for the pin -#define DDR_LOW (*_DDR &= _ioffset) ///< Set the DDR register to LOW for the pin - -#define PORT_HIGH (*_PORT |= _offset) ///< Set the PORT register to HIGH for the pin -#define PORT_TOGGLE (*_PORT ^= _offset) ///< Set the PORT register to the inverse for the pin -#define PORT_LOW (*_PORT &= _ioffset) ///< Set the PORT register to LOW for the pin - -#define DDR_ON (*_DDR & _offset) ///< Get the DDR register for the pin (HIGH, LOW) with other pins forced to 0 -#define DDR_OFF (*_DDR | _ioffset) ///< Get the DDR register for the pin (HIGH, LOW) with other pins forced to 1 - -#define PORT_ON (*_PORT & _offset) ///< Get the PORT register for the pin (HIGH, LOW) with other pins forced to 0 -#define PORT_OFF (*_PORT | _ioffset) ///< Get the PORT register for the pin (HIGH, LOW) with other pins forced to 1 - -#define PIN_ON (*_PIN & _offset) ///< Get the PIN register for the pin (HIGH, LOW) with other pins forced to 0 -#define PIN_OFF (*_PIN | _ioffset) ///< Get the PIN register for the pin (HIGH, LOW) with other pins forced to 1 - -class Pin -{ -public: - Pin(uint8_t number) - { - _number = number; - _offset = digitalPinToBitMask(_number); - _ioffset = ~_offset; - _timer = digitalPinToTimer(_number); - _PIN = portInputRegister(digitalPinToPort(_number)); - _PORT = portOutputRegister(digitalPinToPort(_number)); - _DDR = portModeRegister(digitalPinToPort(_number)); - } - - /** - Custom board constructor - - getAnalogValue() and setDutyCycle(int value) not supported - - @param number pin number written on board - @param offset bit mask used to access pin in registers - @param timer timer for pin - @param PIN input register for pin - @param PORT data register for pin - @param DDR data direction register for pin - */ - Pin(uint8_t number, uint8_t offset, uint8_t timer, volatile uint8_t *PIN, volatile uint8_t *PORT, volatile uint8_t *DDR) - { - _number = number; - _offset = offset; - _ioffset = ~_offset; - _timer = timer; - _PIN = PIN; - _PORT = PORT; - _DDR = DDR; - } - - // ################################# Operators ################################# - - /** - Get the value of the pin from the PIN register - - @return true if the value of the pin is HIGH, false otherwise - */ - operator bool() const - { - return bool(PIN_ON); - } - - /** - Set the pin state - - @param state the state of the pin (HIGH, LOW) - */ - Pin &operator=(uint8_t state) - { - uint8_t oldSREG = SREG; - cli(); - if (state == LOW) - { - PORT_LOW; - } - else - { - PORT_HIGH; - } - SREG = oldSREG; - - return *this; - } - - // ################################# Getters ################################# - - /** - Get the pin number - - @return pin number - */ - uint8_t getNumber() - { - return _number; - } - - /** - Get the pin offset - - @return pin offset - */ - uint8_t getOffset() - { - return _offset; - } - - /** - Get the inverse pin offset - - @return inverse pin offset - */ - uint8_t getInverseOffset() - { - return _ioffset; - } - - /** - Get the pin timer - - @return pin timer - */ - uint8_t getTimer() - { - return _timer; - } - - /** - Get a pointer to the PIN register - - @return pointer to the PIN register - */ - volatile uint8_t *getPIN() - { - return _PIN; - } - - /** - Get a pointer to the PORT register - - @return pointer to the PORT register - */ - volatile uint8_t *getPORT() - { - return _PORT; - } - - /** - Get a pointer to the DDR register - - @return pointer to the DDR register - */ - volatile uint8_t *getDDR() - { - return _DDR; - } - - /** - Get the mode of the pin from the DDR register - - @return mode of the pin (OUTPUT, INPUT) - */ - uint8_t getMode() - { - if (DDR_ON) - { - return OUTPUT; - } - else - { - return INPUT; - } - } - - /** - Get the state of the pin from the PORT register - - @return state of the pin (HIGH, LOW) - */ - uint8_t getState() - { - if (PORT_ON) - { - return HIGH; - } - else - { - return LOW; - } - } - - /** - Get the value of the pin from the PIN register - - @return value of the pin (HIGH, LOW) - */ - uint8_t getValue() - { - if (PIN_ON) - { - return HIGH; - } - else - { - return LOW; - } - } - - /** - Get the analog value of the pin - - @return analog value of the pin (0-1023) - */ - uint16_t getAnalogValue() - { - return analogRead(_number); - } - - /** - Set the pin mode and pin state - - @param mode the mode of the pin (OUTPUT, INPUT) - @param state the state of the pin (HIGH, LOW) - */ - void set(uint8_t mode, uint8_t state) - { - uint8_t oldSREG = SREG; - cli(); - if (mode == INPUT) - { - DDR_LOW; - } - else - { - DDR_HIGH; - } - if (state == LOW) - { - PORT_LOW; - } - else - { - PORT_HIGH; - } - SREG = oldSREG; - } - - /** - Set the pin mode - - @param mode the mode of the pin (OUTPUT, INPUT) - */ - void setMode(uint8_t mode) - { - uint8_t oldSREG = SREG; - cli(); - if (mode == INPUT) - { - DDR_LOW; - } - else - { - DDR_HIGH; - } - SREG = oldSREG; - } - - /** - Set the pin state - - @param state the state of the pin (HIGH, LOW) - */ - void setState(uint8_t state) - { - uint8_t oldSREG = SREG; - cli(); - if (state == LOW) - { - PORT_LOW; - } - else - { - PORT_HIGH; - } - SREG = oldSREG; - } - - // #################### Input #################### - - void setInput() - { - uint8_t oldSREG = SREG; - cli(); - DDR_LOW; - SREG = oldSREG; - } - - /** - Set the pin pullup resistor to on - */ - void setPullupOn() - { - uint8_t oldSREG = SREG; - cli(); - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin pullup resistor to off - */ - void setPullupOff() - { - uint8_t oldSREG = SREG; - cli(); - PORT_LOW; - SREG = oldSREG; - } - - /** - Set the pin mode to input and the pin pullup resistor to on - */ - void setInputPullupOn() - { - uint8_t oldSREG = SREG; - cli(); - DDR_LOW; - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin mode to input and the pin pullup resistor to off - */ - void setInputPullupOff() - { - uint8_t oldSREG = SREG; - cli(); - DDR_LOW; - PORT_LOW; - SREG = oldSREG; - } - - // #################### Output #################### - - /** - Set the pin mode to output - */ - void setOutput() - { - uint8_t oldSREG = SREG; - cli(); - DDR_HIGH; - SREG = oldSREG; - } - - /** - Set the pin output to HIGH - */ - void setHigh() - { - uint8_t oldSREG = SREG; - cli(); - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin output to LOW - */ - void setLow() - { - uint8_t oldSREG = SREG; - cli(); - PORT_LOW; - SREG = oldSREG; - } - - /** - Set the pin mode to output and the pin output to HIGH - */ - void setOutputHigh() - { - uint8_t oldSREG = SREG; - cli(); - DDR_HIGH; - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin mode to output and the pin output to LOW - */ - void setOutputLow() - { - uint8_t oldSREG = SREG; - cli(); - DDR_HIGH; - PORT_LOW; - SREG = oldSREG; - } - - /** - Set the PWM duty cycle - - @param value the duty cycle (0-255) - */ - void setDutyCycle(int value) - { - analogWrite(_number, value); - } - - // ################################# Utilities ################################# - - /** - Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT) - */ - void toggleMode() - { - uint8_t oldSREG = SREG; - cli(); - DDR_TOGGLE; - SREG = oldSREG; - } - - /** - Toggle the pin state (HIGH -> LOW, LOW -> HIGH) - */ - void toggleState() - { - uint8_t oldSREG = SREG; - cli(); - PORT_TOGGLE; - SREG = oldSREG; - } - - // #################### RC Timer #################### - - /** - Set the pin mode to input and decrement a counter until the pin goes HIGH or the counter reaches 0 then set the pin mode to output and return the counter value - - @param count the initial value for the counter to start at (0-65535) - - @return the value remaining on the counter when the pin state went to HIGH or 0 if the counter reached 0 - */ - volatile unsigned int rcTimer(volatile unsigned int count) - { - uint8_t status; - asm volatile( - // Save interupt status and disable interupts - "in %[status], __SREG__ \n\t" // Store current interupt status in variable 's' - "cli \n\t" // Disable interupts - - // Set Pin to input mode to start charging capacitor - "ld __tmp_reg__, %a[_DDR] \n\t" // Load the DDR register into r0 (__tmp_reg__) - "and __tmp_reg__, %[_ioffset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__) - "st %a[_DDR], __tmp_reg__ \n\t" // Store r0 (__tmp_reg__) in the DDR register - - // Count time before Pin becomes high - "loop%=: \n\t" // Label for looping - //"ld __tmp_reg__,%a[_PIN] \n\t" // Load the PIN register into r0 (__tmp_reg__) - "and __tmp_reg__, %[_offset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__) - "brne end%= \n\t" // End the loop if r0 (__tmp_reg__) is not equal to zero by branching to label 'end' - "dec %[count] \n\t" // Decrement the value of 'count' by one - "brne loop%= \n\t" // If the value of 'count' is not equal to zero continue the loop by branching to label 'loop' - - // Done counting - "end%=: \n\t" // Label for ending loop - // Set Pin to output mode to start discharging capacitor - "ld __tmp_reg__, %a[_DDR] \n\t" // Load the DDR register into r0 (__tmp_reg__) - "or __tmp_reg__, %[_offset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__) - "st %a[_DDR], __tmp_reg__ \n\t" // Store r0 (__tmp_reg__) in the PORT register - - // Restore interupt status - "out __SREG__, %[status] \n\t" // Load interupt status from variable 's' - - // Outputs - : - [ count ] "+r"(count), // The value the counter was at when the pin went high - [ status ] "=&r"(status) // The interupt status - - // Inputs - : - [ _DDR ] "e"(_DDR), // The address of the DDR register for the pin - [ _PIN ] "e"(_PIN), // The address of the PIN register for the pin - [ _offset ] "r"(_offset), // The bit mask used to access pin in registers - [ _ioffset ] "r"(_ioffset) // The inverse bit mask used to access pin in registers - ); - - return count; - } - -private: - uint8_t _number; - uint8_t _offset; - uint8_t _ioffset; - uint8_t _timer; - volatile uint8_t *_PIN; - volatile uint8_t *_PORT; - volatile uint8_t *_DDR; -}; -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/common/PinGroup.h b/projects/pid-controller/firmware/common/PinGroup.h deleted file mode 100644 index dbbab12fb..000000000 --- a/projects/pid-controller/firmware/common/PinGroup.h +++ /dev/null @@ -1,469 +0,0 @@ -#ifndef PIN_GROUP_H -#define PIN_GROUP_H - -#include "Pin.h" - -/** - Class for simultaneous operations on Arduino I/O pins - */ -class PinGroup -{ -public: - template - PinGroup(Pin (&pins)[N]) - { - _offset = pins[0].getOffset(); - _PIN = pins[0].getPIN(); - _PORT = pins[0].getPORT(); - _DDR = pins[0].getDDR(); - _numbers[0] = pins[0].getNumber(); - _valid = true; - - for (int i = 1; i < N; i++) - { - if (_DDR != pins[i].getDDR()) - { - _valid = false; - } - _offset |= pins[i].getOffset(); - _numbers[i] = pins[i].getNumber(); - } - _ioffset = ~_offset; - } - - // ################################# Operators ################################# - /** - Compare the value of the pin - - @param value the state of the pin (HIGH, LOW) - - @return true if the value of all of the pins are equal to the value passed in, false otherwise - */ - bool operator==(uint8_t value) - { - uint8_t status = *_PIN; - if ((status & _offset) == _offset) - { - return (value == HIGH); - } - else if ((status | _ioffset) == _ioffset) - { - return (value == LOW); - } - else - { - return false; - } - } - - /** - Compare the value of the pin - - @param value the state of the pin (HIGH, LOW) - - @return true if the value of all of the pins are not equal to the value passed in, false otherwise - */ - bool operator!=(uint8_t value) - { - uint8_t status = *_PIN; - if ((status & _offset) == _offset) - { - return (value == LOW); - } - else if ((status | _ioffset) == _ioffset) - { - return (value == HIGH); - } - else - { - return false; - } - } - - /** - Set the pin state - - @param state the state of the pin (HIGH, LOW) - */ - PinGroup &operator=(uint8_t state) - { - oldSREG = SREG; - cli(); - if (state == LOW) - { - PORT_LOW; - } - else - { - PORT_HIGH; - } - SREG = oldSREG; - - return *this; - } - - // ################################# Getters ################################# - - /** - Get the pin numbers - - @return array of pin numbers - */ - uint8_t *getNumbers() - { - return _numbers; - } - - /** - Get the pin offset - - @return pin offset - */ - uint8_t getOffset() - { - return _offset; - } - - /** - Get the inverse pin offset - - @return inverse pin offset - */ - uint8_t getInverseOffset() - { - return _ioffset; - } - - /** - Get a pointer to the PIN register - - @return pointer to the PIN register - */ - volatile uint8_t *getPIN() - { - return _PIN; - } - - /** - Get a pointer to the PORT register - - @return pointer to the PORT register - */ - volatile uint8_t *getPORT() - { - return _PORT; - } - - /** - Get a pointer to the DDR register - - @return pointer to the DDR register - */ - volatile uint8_t *getDDR() - { - return _DDR; - } - - /** - Get the mode of the pin from the DDR register - - @return mode of the pin (OUTPUT, INPUT, -1) - */ - uint8_t getMode() - { - uint8_t status = *_DDR; - if ((status & _offset) == _offset) - { - return OUTPUT; - } - else if ((status | _ioffset) == _ioffset) - { - return INPUT; - } - else - { - return -1; - } - } - - /** - Get the state of the pin from the PORT register - - @return state of the pin (HIGH, LOW, -1) - */ - uint8_t getState() - { - uint8_t status = *_PORT; - if ((status & _offset) == _offset) - { - return HIGH; - } - else if ((status | _ioffset) == _ioffset) - { - return LOW; - } - else - { - return -1; - } - } - - /** - Get the value of the pin from the PIN register - - @return value of the pin (HIGH, LOW, -1) - */ - uint8_t getValue() - { - uint8_t status = *_PIN; - if ((status & _offset) == _offset) - { - return HIGH; - } - else if ((status | _ioffset) == _ioffset) - { - return LOW; - } - else - { - return -1; - } - } - - /** - Check the group to ensure all pins use the same registers - - @return true if the pins in the group all use the same registers, false otherwise - */ - bool isValid() - { - return _valid; - } - - // ################################# Setters ################################# - - // #################### Generic #################### - - /** - Set the pin mode and pin state - - @param mode the mode of the pin (OUTPUT, INPUT) - @param state the state of the pin (HIGH, LOW) - */ - void set(uint8_t mode, uint8_t state) - { - oldSREG = SREG; - cli(); - if (mode == INPUT) - { - DDR_LOW; - } - else - { - DDR_HIGH; - } - if (state == LOW) - { - PORT_LOW; - } - else - { - PORT_HIGH; - } - SREG = oldSREG; - } - - /** - Set the pin mode - - @param mode the mode of the pin (OUTPUT, INPUT) - */ - void setMode(uint8_t mode) - { - oldSREG = SREG; - cli(); - if (mode == INPUT) - { - DDR_LOW; - } - else - { - DDR_HIGH; - } - SREG = oldSREG; - } - - /** - Set the pin state - - @param state the state of the pin (HIGH, LOW) - */ - void setState(uint8_t state) - { - oldSREG = SREG; - cli(); - if (state == LOW) - { - PORT_LOW; - } - else - { - PORT_HIGH; - } - SREG = oldSREG; - } - - // #################### Input #################### - - /** - Set the pin mode to input - */ - void setInput() - { - oldSREG = SREG; - cli(); - DDR_LOW; - SREG = oldSREG; - } - - /** - Set the pin pullup resistor to on - */ - void setPullupOn() - { - oldSREG = SREG; - cli(); - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin pullup resistor to off - */ - void setPullupOff() - { - oldSREG = SREG; - cli(); - PORT_LOW; - SREG = oldSREG; - } - - /** - Set the pin mode to input and the pin pullup resistor to on - */ - void setInputPullupOn() - { - oldSREG = SREG; - cli(); - DDR_LOW; - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin mode to input and the pin pullup resistor to off - */ - void setInputPullupOff() - { - oldSREG = SREG; - cli(); - DDR_LOW; - PORT_LOW; - SREG = oldSREG; - } - - // #################### Output #################### - - /** - Set the pin mode to output - */ - void setOutput() - { - oldSREG = SREG; - cli(); - DDR_HIGH; - SREG = oldSREG; - } - - /** - Set the pin output to HIGH - */ - void setHigh() - { - oldSREG = SREG; - cli(); - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin output to LOW - */ - void setLow() - { - oldSREG = SREG; - cli(); - PORT_LOW; - SREG = oldSREG; - } - - /** - Set the pin mode to output and the pin output to HIGH - */ - void setOutputHigh() - { - oldSREG = SREG; - cli(); - DDR_HIGH; - PORT_HIGH; - SREG = oldSREG; - } - - /** - Set the pin mode to output and the pin output to LOW - */ - void setOutputLow() - { - oldSREG = SREG; - cli(); - DDR_HIGH; - PORT_LOW; - SREG = oldSREG; - } - - // ################################# Utilities ################################# - - // #################### Toggle #################### - - /** - Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT) - */ - void toggleMode() - { - oldSREG = SREG; - cli(); - DDR_TOGGLE; - SREG = oldSREG; - } - - /** - Toggle the pin state (HIGH -> LOW, LOW -> HIGH) - */ - void toggleState() - { - oldSREG = SREG; - cli(); - PORT_TOGGLE; - SREG = oldSREG; - } - -private: - uint8_t _numbers[8]; - uint8_t _offset; - uint8_t _ioffset; - bool _valid; - uint8_t oldSREG; - volatile uint8_t *_PIN; - volatile uint8_t *_PORT; - volatile uint8_t *_DDR; -}; diff --git a/projects/pid-controller/firmware/common/macros.h b/projects/pid-controller/firmware/common/macros.h deleted file mode 100644 index a25308726..000000000 --- a/projects/pid-controller/firmware/common/macros.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef MACROS_H -#define MACROS_H - -#include "../types.h" - -// Macros for adding -#define INC_0 1 -#define INC_1 2 -#define INC_2 3 -#define INC_3 4 -#define INC_4 5 -#define INC_5 6 -#define INC_6 7 -#define INC_7 8 -#define INC_8 9 -#define INCREMENT_(n) INC_ ##n -#define INCREMENT(n) INCREMENT_(n) - -// Macros for subtracting -#define DEC_1 0 -#define DEC_2 1 -#define DEC_3 2 -#define DEC_4 3 -#define DEC_5 4 -#define DEC_6 5 -#define DEC_7 6 -#define DEC_8 7 -#define DEC_9 8 -#define DECREMENT_(n) DEC_ ##n -#define DECREMENT(n) DECREMENT_(n) - -// compiler - & C quirks -#define FORCE_INLINE __attribute__((always_inline)) inline -#define _UNUSED __attribute__((unused)) - -// fallback noop -#define NOOP do{} while(0) - -//Option testing -#define _CAT(a, ...) a ## __VA_ARGS__ -#define SWITCH_ENABLED_ 1 -#define ENABLED(b) _CAT(SWITCH_ENABLED_, b) - -// time -#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) -#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) - -#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f) -#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f) -#define HOUR_MS ((millis_t)1000 * (millis_t)(60 * 60)) -#define MIN_MS ((millis_t)1000 * (millis_t)(60)) -#define SECS ((millis_t)1000) - -// bit masks -#undef _BV -#define _BV(b) (1 << (b)) -#define TEST(n,b) !!((n)&_BV(b)) -#define SBI(n,b) (n |= _BV(b)) -#define CBI(n,b) (n &= ~_BV(b)) -#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0) - -#define _BV32(b) (1UL << (b)) -#define TEST32(n,b) !!((n)&_BV32(b)) -#define SBI32(n,b) (n |= _BV32(b)) -#define CBI32(n,b) (n &= ~_BV32(b)) -#define SIGN(a) ((a>0)-(a<0)) - -// math basics - -#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H)) -#define NUMERIC(a) WITHIN(a, '0', '9') -#define DECIMAL(a) (NUMERIC(a) || a == '.') -#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+') -#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') -#define COUNT(a) (sizeof(a)/sizeof(*a)) -#define ZERO(a) memset(a,0,sizeof(a)) -#define COPY(a,b) memcpy(a,b,MIN(sizeof(a),sizeof(b))) - - -// #define M_PI 3.14159265358979323846f -#define RADIANS(d) ((d)*M_PI/180.0f) -#define DEGREES(r) ((r)*180.0f/M_PI) -#define CEILING(x,y) (((x) + (y) - 1) / (y)) - -// Macros for initializing arrays -#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 } -#define ARRAY_5(v1, v2, v3, v4, v5, ...) { v1, v2, v3, v4, v5 } -#define ARRAY_4(v1, v2, v3, v4, ...) { v1, v2, v3, v4 } -#define ARRAY_3(v1, v2, v3, ...) { v1, v2, v3 } -#define ARRAY_2(v1, v2, ...) { v1, v2 } -#define ARRAY_1(v1, ...) { v1 } - -#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__) -#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__) - -#define SPACE(A) " " << A << " " - -#endif diff --git a/projects/pid-controller/firmware/common/ppmath.h b/projects/pid-controller/firmware/common/ppmath.h deleted file mode 100644 index 93ac9d821..000000000 --- a/projects/pid-controller/firmware/common/ppmath.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef PPMATH_H -#define PPMATH_H - -template -T clamp(const T &value, const T &low, const T &high) -{ - return value < low ? low : (value > high ? high : value); -} - -#define RANGE(i, min, max) ((i > min) && (i < max)) ? true : false - -#define NCLAMP(x, min, max) (x - min) / (max - min) - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/common/timer.h b/projects/pid-controller/firmware/common/timer.h deleted file mode 100644 index 603d7583f..000000000 --- a/projects/pid-controller/firmware/common/timer.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef TIMER_H -#define TIMER_H - -#if defined(ARDUINO) && ARDUINO >= 100 -#include -#else -#include -#endif - -#include "macros.h" - -#ifndef TIMER_MAX_TASKS -#define TIMER_MAX_TASKS 0x10 -#endif - -template < - size_t max_tasks = TIMER_MAX_TASKS, /* max allocated tasks */ - unsigned long (*time_func)() = millis /* time function for timer */ - > -class Timer -{ -public: - typedef bool (*handler_t)(void *opaque); /* task handler func signature */ - /* Calls handler with opaque as argument in delay units of time */ - bool - in(unsigned long delay, handler_t h, void *opaque = NULL) - { - return add_task(time_func(), delay, h, opaque); - } - - /* Calls handler with opaque as argument at time */ - bool - at(unsigned long time, handler_t h, void *opaque = NULL) - { - const unsigned long now = time_func(); - return add_task(now, time - now, h, opaque); - } - - /* Calls handler with opaque as argument every interval units of time */ - bool - every(unsigned long interval, handler_t h, void *opaque = NULL) - { - return add_task(time_func(), interval, h, opaque, interval); - } - - - /* Ticks the timer forward - call this function in loop() */ - void - tick() - { - tick(time_func()); - } - - /* Ticks the timer forward - call this function in loop() */ - inline void - tick(unsigned long t) - { - for (size_t i = 0; i < max_tasks; ++i) - { - struct task *const task = &tasks[i]; - const unsigned long duration = t - task->start; - - if (task->handler && duration >= task->expires) - { - task->repeat = task->handler(task->opaque) && task->repeat; - - if (task->repeat) - task->start = t; - else - remove(task); - }else{ - } - } - } - -private: - struct task - { - handler_t handler; /* task handler callback func */ - void *opaque; /* argument given to the callback handler */ - unsigned long start, - expires, /* when the task expires */ - repeat; /* repeat task */ - } tasks[max_tasks]; - - inline void - remove(struct task *task) - { - task->handler = NULL; - task->opaque = NULL; - task->start = 0; - task->expires = 0; - task->repeat = 0; - } - - inline struct task * - next_task_slot() - { - for (size_t i = 0; i < max_tasks; ++i) - { - struct task *const slot = &tasks[i]; - if (slot->handler == NULL) - return slot; - } - - return NULL; - } - - inline struct task * - add_task(unsigned long start, unsigned long expires, - handler_t h, void *opaque, bool repeat = 0) - { - struct task *const slot = next_task_slot(); - - if (!slot){ - return NULL; - } - - slot->handler = h; - slot->opaque = opaque; - slot->start = start; - slot->expires = expires; - slot->repeat = repeat; - - return slot; - } -}; - -/* create a timer with the default settings */ -inline Timer<> -timer_create_default() -{ - return Timer<>(); -} - -#endif diff --git a/projects/pid-controller/firmware/components/3PosAnalog.h b/projects/pid-controller/firmware/components/3PosAnalog.h deleted file mode 100644 index f43d816da..000000000 --- a/projects/pid-controller/firmware/components/3PosAnalog.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef POS3_ANALOG_H -#define POS3_ANALOG_H - -#include -#include "../enums.h" -#include "../common/ppmath.h" - -class Pos3Analog -{ -public: - Pos3Analog(short _upPin, short _downPin) : upPin(_upPin), downPin(_downPin) - { - } - - short setup() - { - pinMode(upPin, INPUT_PULLUP); - pinMode(downPin, INPUT_PULLUP); - last_switch = loop(); - return 0; - } - - short loop() - { - uchar newDirection = this->read(); - - if (newDirection != this->switch_pos) - { - this->last_switch = this->switch_pos; - } - this->switch_pos = newDirection; - return this->switch_pos; - } - - short last_switch = -1; // Track last switch position - short switch_pos = -1; // Current switch position - short upPin; - short downPin; - - -private: - uchar read() - { - - bool up = RANGE(analogRead(upPin), 240, 260); - bool down = RANGE(analogRead(downPin), 240, 260); - - uchar newDirection = 0; - - if (up) - { - newDirection = POS3_DIRECTION::UP; - } - if (down) - { - newDirection = POS3_DIRECTION::DOWN; - } - if (!up && !down) - { - newDirection = POS3_DIRECTION::MIDDLE; - } - if (up && down) - { - newDirection = POS3_DIRECTION::INVALID; - } - return newDirection; - } - - bool changed() - { - return last_switch != switch_pos; - } - - bool clear() - { - return last_switch = switch_pos; - } -}; - -#endif diff --git a/projects/pid-controller/firmware/components/3pos.h b/projects/pid-controller/firmware/components/3pos.h deleted file mode 100644 index defa892df..000000000 --- a/projects/pid-controller/firmware/components/3pos.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef POS3_H -#define POS3_H - -#include -#include "../enums.h" - -class Pos3 -{ -public: - Pos3(int _upPin, int _downPin) : upPin(_upPin), downPin(_downPin) - { - } - - int setup() - { - - this->debouncerUp = Bounce(); - this->debouncerUp.attach(this->upPin, INPUT_PULLUP); - this->debouncerUp.interval(25); - - this->debouncerDown = Bounce(); - this->debouncerDown.attach(this->downPin, INPUT_PULLUP); - this->debouncerDown.interval(25); - return 0; - } - int loop() - { - int newDirection = this->read(); - - if (newDirection != this->switch_pos) - { - this->last_switch = this->switch_pos; - } - this->switch_pos = newDirection; - - return this->switch_pos; - } - - int last_switch = -1; // Track last switch position - int switch_pos = -1; // Current switch position - -protected: - int upPin; - int downPin; - - Bounce debouncerUp; - Bounce debouncerDown; - -private: - int read() - { - - this->debouncerUp.update(); - this->debouncerDown.update(); - - bool up = this->debouncerUp.read() == 0 ? true : false; - bool down = this->debouncerDown.read() == 0 ? true : false; - - int newDirection = 0; - - if (up) - { - newDirection = POS3_DIRECTION::UP; - } - if (down) - { - newDirection = POS3_DIRECTION::DOWN; - } - if (!up && !down) - { - newDirection = POS3_DIRECTION::MIDDLE; - } - if (up && down) - { - newDirection = POS3_DIRECTION::INVALID; - } - return newDirection; - } -}; - -#endif diff --git a/projects/pid-controller/firmware/components/TemperatureSensor.h b/projects/pid-controller/firmware/components/TemperatureSensor.h deleted file mode 100644 index e17f9953c..000000000 --- a/projects/pid-controller/firmware/components/TemperatureSensor.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef TEMPERATURE_SENSOR_H -#define TEMPERATURE_SENSOR_H - -#include -#include "../config.h" -#include "../macros.h" -#include "../time.h" - -class TemperatureSensor -{ - -public: - TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)), - temperature(), - temperature_TS(millis()), - maxTemp(_max), - interval(_interval) {} - - bool ok() - { - return temperature < maxTemp; - } - - void loop() - { - - if (millis() - temperature_TS > interval) - { - temperature_TS = millis(); - temperature = ktc.readCelsius(); - } - } - -private: - MAX6675 ktc; - short temperature; - short maxTemp; - short interval; - millis_t temperature_TS; -}; - -#endif diff --git a/projects/pid-controller/firmware/config.h b/projects/pid-controller/firmware/config.h deleted file mode 100644 index b12f29602..000000000 --- a/projects/pid-controller/firmware/config.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#include "enums.h" -#include "common/macros.h" -#include - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Core settings -// - -#define LOOP_DELAY 500 // Our frame time, exluding delays in some places -#define BOOT_DELAY 1000 // Wait at least this amount in ms after boot before doing anything - -// Please consider to set this to false for production - especially with the full feature set since this is requiring extra -// time for the serial communication and will affect the overall framerate/performance -// #define DEBUG true - -#define DEBUG_INTERVAL 1000 -#define DEBUG_BAUD_RATE 19200 // Serial port speed - -#define RELAY_ON 0 // The relay bank's on value (eg: normally closed) -#define RELAY_OFF 255 // The relay bank's off value (eg: normally closed) - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Machine settings -// - -// #define USE_MEGA // On Arduino Uno we have only limited ports which are not enough to enable all features. -#define USE_CONTROLLINO -// #define HAS_AUTOREVERSE - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// General switches - -// Reset button - uncomment to activate. This will unlock the fatal state in case of jamming or other problems. -//#define HAS_RESET -#define RESET_PIN 3 -#define RESET_DELAY 1000 // Time to wait when reset has been hit or hold. This is good to give the system some time -#define RESET_FATAL true // Makes the reset button act as emergency button. User has to go into stop positon first to unlock it again otherwise it keeps spinning after the RESET_DELAY -#define RESET_INTERVAL 300 // Interval to read the NC reset button -#define RESET_NC true // Toggles the reset button type between NC and NO - -// Operation Mode Switch - - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Heating Cell/Partition - - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Feedback - -// Status LEDS (ok, error) - uncomment to activate -#define HAS_STATUS -#define STATUS_OK_PIN CONTROLLINO_D2 -#define STATUS_ERROR_PIN CONTROLLINO_D3 - - -#define FIRMWARE_VERSION 0.7 - -//////////////////////////////////////////////////////////////// -// -// HMI Bridge -// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// externals -// - -// pull in internal constants -#include "constants.h" - -// pull in internal configs -#include "config_adv.h" - -// The user_config.h is initially added to the github repository but changes will be ignored via .gitignore. Please keep this file safe and possibly -// on a per tenant base stored. You can override parameters in this file by using #undef SOME_PARAMETER and then re-define again if needed, otherwise disable -// default features by using #undef FEATURE_OR_PARAMETER. -// This presents the possibilty to play with the code whilst staying in the loop with latest updates. -#include "user_config.h" - -// At last we check all configs and spit compiler errors -#include "config_validator.h" - -#endif diff --git a/projects/pid-controller/firmware/config/known_16bit_timers.h b/projects/pid-controller/firmware/config/known_16bit_timers.h deleted file mode 100644 index bdae33021..000000000 --- a/projects/pid-controller/firmware/config/known_16bit_timers.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef known_16bit_timers_header_ -#define known_16bit_timers_header_ - -// Wiring-S -// -#if defined(__AVR_ATmega644P__) && defined(WIRING) - #define TIMER1_A_PIN 5 - #define TIMER1_B_PIN 4 - #define TIMER1_ICP_PIN 6 - -// Teensy 2.0 -// -#elif defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) - #define TIMER1_A_PIN 14 - #define TIMER1_B_PIN 15 - #define TIMER1_C_PIN 4 - #define TIMER1_ICP_PIN 22 - #define TIMER1_CLK_PIN 11 - #define TIMER3_A_PIN 9 - #define TIMER3_ICP_PIN 10 - -// Teensy++ 2.0 -#elif defined(__AVR_AT90USB1286__) && defined(CORE_TEENSY) - #define TIMER1_A_PIN 25 - #define TIMER1_B_PIN 26 - #define TIMER1_C_PIN 27 - #define TIMER1_ICP_PIN 4 - #define TIMER1_CLK_PIN 6 - #define TIMER3_A_PIN 16 - #define TIMER3_B_PIN 15 - #define TIMER3_C_PIN 14 - #define TIMER3_ICP_PIN 17 - #define TIMER3_CLK_PIN 13 - -// Teensy 3.0 -// -#elif defined(__MK20DX128__) - #define TIMER1_A_PIN 3 - #define TIMER1_B_PIN 4 - #define TIMER1_ICP_PIN 4 - -// Teensy 3.1 / Teensy 3.2 -// -#elif defined(__MK20DX256__) - #define TIMER1_A_PIN 3 - #define TIMER1_B_PIN 4 - #define TIMER1_ICP_PIN 4 - #define TIMER3_A_PIN 32 - #define TIMER3_B_PIN 25 - #define TIMER3_ICP_PIN 32 - -// Teensy 3.5 / Teensy 3.6 -// -#elif defined(__MK64FX512__) || defined(__MK66FX1M0__) - #define TIMER1_A_PIN 3 - #define TIMER1_B_PIN 4 - #define TIMER1_ICP_PIN 4 - #define TIMER3_A_PIN 29 - #define TIMER3_B_PIN 30 - #define TIMER3_ICP_PIN 29 - -// Teensy-LC -// -#elif defined(__MKL26Z64__) - #define TIMER1_A_PIN 16 - #define TIMER1_B_PIN 17 - #define TIMER1_ICP_PIN 17 - #define TIMER3_A_PIN 3 - #define TIMER3_B_PIN 4 - #define TIMER3_ICP_PIN 4 - -// Arduino Mega -// -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) - #define TIMER1_A_PIN 11 - #define TIMER1_B_PIN 12 - #define TIMER1_C_PIN 13 - #define TIMER3_A_PIN 5 - #define TIMER3_B_PIN 2 - #define TIMER3_C_PIN 3 - #define TIMER4_A_PIN 6 - #define TIMER4_B_PIN 7 - #define TIMER4_C_PIN 8 - #define TIMER4_ICP_PIN 49 - #define TIMER5_A_PIN 46 - #define TIMER5_B_PIN 45 - #define TIMER5_C_PIN 44 - #define TIMER3_ICP_PIN 48 - #define TIMER3_CLK_PIN 47 - -// Arduino Leonardo, Yun, etc -// -#elif defined(__AVR_ATmega32U4__) - #define TIMER1_A_PIN 9 - #define TIMER1_B_PIN 10 - #define TIMER1_C_PIN 11 - #define TIMER1_ICP_PIN 4 - #define TIMER1_CLK_PIN 12 - #define TIMER3_A_PIN 5 - #define TIMER3_ICP_PIN 13 - -// Uno, Duemilanove, LilyPad, etc -// -#elif defined (__AVR_ATmega168__) || defined (__AVR_ATmega328P__) - #define TIMER1_A_PIN 9 - #define TIMER1_B_PIN 10 - #define TIMER1_ICP_PIN 8 - #define TIMER1_CLK_PIN 5 - -// Sanguino -// -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) - #define TIMER1_A_PIN 13 - #define TIMER1_B_PIN 12 - #define TIMER1_ICP_PIN 14 - #define TIMER1_CLK_PIN 1 - -// Wildfire - Wicked Devices -// -#elif defined(__AVR_ATmega1284P__) && defined(WILDFIRE_VERSION) && WILDFIRE_VERSION >= 3 - #define TIMER1_A_PIN 5 // PD5 - #define TIMER1_B_PIN 8 // PD4 - #define TIMER1_ICP_PIN 6 // PD6 - #define TIMER1_CLK_PIN 23 // PB1 - #define TIMER3_A_PIN 12 // PB6 - #define TIMER3_B_PIN 13 // PB7 - #define TIMER3_ICP_PIN 9 // PB5 - #define TIMER3_CLK_PIN 0 // PD0 -#elif defined(__AVR_ATmega1284P__) && defined(WILDFIRE_VERSION) && WILDFIRE_VERSION < 3 - #define TIMER1_A_PIN 5 // PD5 - #define TIMER1_B_PIN 4 // PD4 - #define TIMER1_ICP_PIN 6 // PD6 - #define TIMER1_CLK_PIN 15 // PB1 - #define TIMER3_A_PIN 12 // PB6 - #define TIMER3_B_PIN 13 // PB7 - #define TIMER3_ICP_PIN 11 // PB5 - #define TIMER3_CLK_PIN 0 // PD0 - -// Mighty-1284 - Maniacbug -// -#elif defined(__AVR_ATmega1284P__) - #define TIMER1_A_PIN 12 // PD5 - #define TIMER1_B_PIN 13 // PD4 - #define TIMER1_ICP_PIN 14 // PD6 - #define TIMER1_CLK_PIN 1 // PB1 - #define TIMER3_A_PIN 6 // PB6 - #define TIMER3_B_PIN 7 // PB7 - #define TIMER3_ICP_PIN 5 // PB5 - #define TIMER3_CLK_PIN 8 // PD0 - -#endif - -#endif diff --git a/projects/pid-controller/firmware/config_adv.h b/projects/pid-controller/firmware/config_adv.h deleted file mode 100644 index 5a43fc5a2..000000000 --- a/projects/pid-controller/firmware/config_adv.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CONFIG_ADV_H -#define CONFIG_ADV_H - - -// Error codes -// -#define E_MSG_OK "Ok" - -// common operating failures -#define E_OK 0 //all good -#define E_STUCK 100 //Shredder stuck - -// power failures - -// sensor failures - -//////////////////////////// -// -// sub system failures - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/config_validator.h b/projects/pid-controller/firmware/config_validator.h deleted file mode 100644 index 0595fa50b..000000000 --- a/projects/pid-controller/firmware/config_validator.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CONFIG_VALIDATOR -#define CONFIG_VALIDATOR - -#include "common/macros.h" - - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/constants.h b/projects/pid-controller/firmware/constants.h deleted file mode 100644 index 1d4b184eb..000000000 --- a/projects/pid-controller/firmware/constants.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CONSTANTS_H -#define CONSTANTS_H - -#include "enums.h" - -///////////////////////////////////////////////////////////////////////// -// -// Addons -// - -#define CURRENT_SENSOR_STR "CurrentSensor" -#define ENCLOSURE_SENSOR_STR "EnclosureSensor" -#define POWER_STR "Power" -#define OPERATION_MODE_SWITCH_STR "OperationModeSwitch" -#define APP_STR "App" -#define STATUS_STR "Status LED" -#define MPID_CTRL_STR "Multi - PID Controller" - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/enums.h b/projects/pid-controller/firmware/enums.h deleted file mode 100644 index 0e7da0a64..000000000 --- a/projects/pid-controller/firmware/enums.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef ENUMS_H -#define ENUMS_H - -enum PIN_TYPE -{ - ANALOG, - DIGITAL -}; - -enum BOARD -{ - UNO, - MEGA -}; - -enum PARTITION_STATE -{ - OFF = 0, - HEATING = 1 - AUTO_TUNING = 2, - AUTO = 3, - DISABLED = 4, - ERROR = 10 -}; - -enum CONTROL_MODE -{ - OP_PANEL = 1, // OLED & Keypad - EXTERN = 2 // RS485 -}; - -enum RUN_MODE -{ - PID = 0, // Normal PID mode - MANUAL = 1, // Debugging / Operator - TEST = 2, // Run remote tests - ERROR = 3 - LOCKED = 4 -}; - -enum ADDON_FLAGS -{ - DEBUG = 1, - INFO = 2, - LOOP = 3, - DISABLED = 4, - SETUP = 5, - MAIN = 6, - STATE = 7 -}; - -enum ADDONS -{ - ENCLOSURE_SENSOR = 6, - DIP_SWITCH = 10, - POWER = 11, - OPERATION_MODE_SWITCH = 20, - SERIAL_BRIDGE = 23, - APP = 25, - MODBUS_BRIDGE = 26, - CURRENT_SENSOR = 32, - STATUS = 33, - MPIDCTRL = 34, - LAST = 64 -}; - -enum POWER_CIRCUIT -{ - POWER_1 = 0, - POWER_2 = 1, - POWER_3 = 1 -}; - -enum OPERATION_MODE -{ - OP_NONE = 0, - OP_NORMAL = 1, - OP_DEBUG = 2, - OP_SERVICE = 3, - OP_TEST -}; -enum ERROR -{ - ERROR_OK = 0, - ERROR_WARNING = 1, - ERROR_FATAL = 2 -}; - -#endif diff --git a/projects/pid-controller/firmware/features.h b/projects/pid-controller/firmware/features.h deleted file mode 100644 index 3601992f9..000000000 --- a/projects/pid-controller/firmware/features.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef FEATURES_H -#define FEATURES_H - -#ifdef HAS_RESET - #include "reset.h" -#endif - -#include "addons/CurrentSensor.h" - -#ifdef HAS_STATUS - #include "addons/Status.h" -#endif - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/firmware.ino b/projects/pid-controller/firmware/firmware.ino deleted file mode 100644 index 10dde87bc..000000000 --- a/projects/pid-controller/firmware/firmware.ino +++ /dev/null @@ -1,12 +0,0 @@ -#include "app.h" - -App app = App(); - -void setup(){ - app.setup(); - app.info(); - Serial.println("------------------ Ready -------------------------------------- "); -} -void loop(){ - app.loop(); -} \ No newline at end of file diff --git a/projects/pid-controller/firmware/package.json b/projects/pid-controller/firmware/package.json deleted file mode 100644 index 0f8253fc6..000000000 --- a/projects/pid-controller/firmware/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@plastichub/pid-firmware", - "version": "0.1", - "description": "", - "main": "index.js", - "cid": 0, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://gitlab.com/plastichub/osr/firmware.git" - }, - "keywords": [ - "precious", - "plastic" - ], - "author": "PlasticHUB", - "license": "GPL-3.0-or-later", - "bugs": { - "url": "https://gitlab.com/plastichub/osr/firmware/issues" - }, - "homepage": "https://gitlab.com/plastichub/osr/firmware#readme", - "dependencies": { - "@xblox/fs": "^0.13.19", - "simple-git": "^1.131.0" - } -} diff --git a/projects/pid-controller/firmware/ppmath_statistics.cpp b/projects/pid-controller/firmware/ppmath_statistics.cpp deleted file mode 100644 index 6ba5f40c4..000000000 --- a/projects/pid-controller/firmware/ppmath_statistics.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "ppmath_statistics.h" - -Statistic::Statistic() -{ - clear(); -} - -// resets all counters -void Statistic::clear() -{ - _cnt = 0; - _sum = 0; - _min = 0; - _max = 0; -#ifdef STAT_USE_STDEV - _ssqdif = 0.0; // not _ssq but sum of square differences - // which is SUM(from i = 1 to N) of - // (f(i)-_ave_N)**2 -#endif -} - -// adds a new value to the data-set -void Statistic::add(const float value) -{ - if (_cnt == 0) - { - _min = value; - _max = value; - } - else - { - if (value < _min) - _min = value; - else if (value > _max) - _max = value; - } - _sum += value; - _cnt++; - -#ifdef STAT_USE_STDEV - if (_cnt > 1) - { - float _store = (_sum / _cnt - value); - _ssqdif = _ssqdif + _cnt * _store * _store / (_cnt - 1); - // ~10% faster but limits the amount of samples to 65K as _cnt*_cnt overflows - // float _store = _sum - _cnt * value; - // _ssqdif = _ssqdif + _store * _store / (_cnt*_cnt - _cnt); - } -#endif -} - -// returns the average of the data-set added sofar -float Statistic::average() const -{ - if (_cnt == 0) - return NAN; // original code returned 0 - return _sum / _cnt; -} - -// Population standard deviation = s = sqrt [ S ( Xi - � )2 / N ] -// http://www.suite101.com/content/how-is-standard-deviation-used-a99084 -#ifdef STAT_USE_STDEV - -float Statistic::variance() const -{ - if (_cnt == 0) - return NAN; // otherwise DIV0 error - return _ssqdif / _cnt; -} - -float Statistic::mean() const -{ - if (_cnt == 0) - return NAN; // otherwise DIV0 error - return this->sum() / _cnt; -} - -float Statistic::pop_stdev() const -{ - if (_cnt == 0) - return NAN; // otherwise DIV0 error - return sqrt(_ssqdif / _cnt); -} - -float Statistic::unbiased_stdev() const -{ - if (_cnt < 2) - return NAN; // otherwise DIV0 error - return sqrt(_ssqdif / (_cnt - 1)); -} - -#endif -// END OF FILE \ No newline at end of file diff --git a/projects/pid-controller/firmware/ppmath_statistics.h b/projects/pid-controller/firmware/ppmath_statistics.h deleted file mode 100644 index 01d8887b9..000000000 --- a/projects/pid-controller/firmware/ppmath_statistics.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef PPMATH_STATISTICS_H -#define PPMATH_STATISTICS_H - -#include -#include - -#define STAT_USE_STDEV - -#ifdef __cplusplus - -// C++11 solution that is standards compliant. Return type is deduced automatically -template -static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) -{ - return lhs < rhs ? lhs : rhs; -} -template -static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) -{ - return lhs > rhs ? lhs : rhs; -} -template -static inline constexpr const T ABS(const T v) -{ - return v >= 0 ? v : -v; -} -#else -// Using GCC extensions, but Travis GCC version does not like it and gives -// "error: statement-expressions are not allowed outside functions nor in template-argument lists" -#define MIN(a, b) \ - ({__typeof__(a) _a = (a); \ - __typeof__(b) _b = (b); \ - _a < _b ? _a : _b; }) - -#define MAX(a, b) \ - ({__typeof__(a) _a = (a); \ - __typeof__(b) _b = (b); \ - _a > _b ? _a : _b; }) - -#define ABS(a) \ - ({__typeof__(a) _a = (a); \ - _a >= 0 ? _a : -_a; }) - -#endif - -class Statistic -{ -public: - Statistic(); // "switches on/off" stdev run time - void clear(); // "switches on/off" stdev run time - void add(const float); - - // returns the number of values added - uint32_t count() const { return _cnt; }; // zero if empty - float sum() const { return _sum; }; // zero if empty - float minimum() const { return _min; }; // zero if empty - float maximum() const { return _max; }; // zero if empty - float average() const; // NAN if empty - float mean() const; // zero if empty - -#ifdef STAT_USE_STDEV - float variance() const; // NAN if empty - float pop_stdev() const; // population stdev // NAN if empty - float unbiased_stdev() const; // NAN if empty -#endif - -protected: - uint32_t _cnt; - float _sum; - float _min; - float _max; -#ifdef STAT_USE_STDEV - float _ssqdif; // sum of squares difference -#endif -}; - -/** - * Returns the kth q-quantile. - * @link http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population - * ie: median is 1st 2-quantile - * ie: upper quartile is 3rd 4-quantile - * @return {Number} q-quantile of values. - */ -/* -const quantile = (arr: number[], i: number, n: number) => { - if (i === 0) return Math.min.apply(null, arr); - if (i === n) return Math.max.apply(null, arr); - - let sorted = arr.slice(0); - sorted.sort((a, b) => a - b); - let index = sorted.length * i / n; - - if (index % 1 === 0) { - return 0.5 * sorted[index - 1] + 0.5 * sorted[index]; - } - - return sorted[~~index]; -}; - -export const median = (arr: number[]) => quantile(arr, 1, 2); - -export const sum = (arr: number[]) => arr.reduce((a, b) => a + b, 0); - -export const mean = (arr: number[]) => sum(arr) / arr.length; - - -// sqare errors along mean -const sdiff = (arr: number[], mean: number) => arr.map((v) => - Math.pow(v - mean, 2) -); - -export const standardDeviation = (arr: number[]) => - Math.sqrt(mean(sdiff(arr, mean(arr)))); -*/ - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/types.h b/projects/pid-controller/firmware/types.h deleted file mode 100644 index c33a7a3a5..000000000 --- a/projects/pid-controller/firmware/types.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -#include - -typedef unsigned long millis_t; -typedef unsigned short ushort; -typedef unsigned char uchar; - - -#endif \ No newline at end of file diff --git a/projects/pid-controller/firmware/user_config.h b/projects/pid-controller/firmware/user_config.h deleted file mode 100644 index a0c1ec4c8..000000000 --- a/projects/pid-controller/firmware/user_config.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef USER_CONFIG_H -#define USER_CONFIG_H - -#endif diff --git a/projects/pid-controller/firmware/util/crc16.h b/projects/pid-controller/firmware/util/crc16.h deleted file mode 100644 index 3ed528e99..000000000 --- a/projects/pid-controller/firmware/util/crc16.h +++ /dev/null @@ -1,88 +0,0 @@ -/** -@file -CRC Computations - -@defgroup util_crc16 "util/crc16.h": CRC Computations -@code#include "util/crc16.h"@endcode - -This header file provides functions for calculating -cyclic redundancy checks (CRC) using common polynomials. -Modified by Doc Walker to be processor-independent (removed inline -assembler to allow it to compile on SAM3X8E processors). - -@par References: -Jack Crenshaw's "Implementing CRCs" article in the January 1992 issue of @e -Embedded @e Systems @e Programming. This may be difficult to find, but it -explains CRC's in very clear and concise terms. Well worth the effort to -obtain a copy. - -*/ -/* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz - Copyright (c) 2005, 2007 Joerg Wunsch - Copyright (c) 2013 Dave Hylands - Copyright (c) 2013 Frederic Nadeau - Copyright (c) 2015 Doc Walker - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. */ - - -#ifndef _UTIL_CRC16_H_ -#define _UTIL_CRC16_H_ - - -/** @ingroup util_crc16 - Processor-independent CRC-16 calculation. - - Polynomial: x^16 + x^15 + x^2 + 1 (0xA001)
- Initial value: 0xFFFF - - This CRC is normally used in disk-drive controllers. - - @param uint16_t crc (0x0000..0xFFFF) - @param uint8_t a (0x00..0xFF) - @return calculated CRC (0x0000..0xFFFF) -*/ -uint16_t crc16_update(uint16_t crc, uint8_t a); -/*{ - int i; - - crc ^= a; - for (i = 0; i < 8; ++i) - { - if (crc & 1) - crc = (crc >> 1) ^ 0xA001; - else - crc = (crc >> 1); - } - - return crc; -} -*/ - -#endif /* _UTIL_CRC16_H_ */ diff --git a/projects/pid-controller/firmware/util/word.h b/projects/pid-controller/firmware/util/word.h deleted file mode 100644 index c72ad9446..000000000 --- a/projects/pid-controller/firmware/util/word.h +++ /dev/null @@ -1,64 +0,0 @@ -/** -@file -Utility Functions for Manipulating Words - -@defgroup util_word "util/word.h": Utility Functions for Manipulating Words -@code#include "util/word.h"@endcode - -This header file provides utility functions for manipulating words. - -*/ -/* - - word.h - Utility Functions for Manipulating Words - - This file is part of ModbusMaster. - - ModbusMaster is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ModbusMaster is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with ModbusMaster. If not, see . - - Written by Doc Walker (Rx) - Copyright © 2009-2015 Doc Walker <4-20ma at wvfans dot net> - -*/ - - -#ifndef _UTIL_WORD_H_ -#define _UTIL_WORD_H_ - - -/** @ingroup util_word - Return low word of a 32-bit integer. - - @param uint32_t ww (0x00000000..0xFFFFFFFF) - @return low word of input (0x0000..0xFFFF) -*/ -static inline uint16_t lowWord(uint32_t ww) -{ - return (uint16_t) ((ww) & 0xFFFF); -} - - -/** @ingroup util_word - Return high word of a 32-bit integer. - - @param uint32_t ww (0x00000000..0xFFFFFFFF) - @return high word of input (0x0000..0xFFFF) -*/ -static inline uint16_t highWord(uint32_t ww) -{ - return (uint16_t) ((ww) >> 16); -} - - -#endif /* _UTIL_WORD_H_ */ diff --git a/projects/pid-controller/firmware/version.js b/projects/pid-controller/firmware/version.js deleted file mode 100644 index 2c703ce81..000000000 --- a/projects/pid-controller/firmware/version.js +++ /dev/null @@ -1,34 +0,0 @@ -const read = require('@xblox/fs/read'); -const write = require('@xblox/fs/write'); -const path = require('path'); -const cwd = path.resolve('../../'); -const pkgVersion = read.sync('package.json', 'json').version; -const cid = read.sync('package.json', 'json').cid; - -async function status(workingDir) { - const git = require('simple-git/promise'); - - let statusSummary = null; - try { - statusSummary = await git(workingDir).log(); - } - catch (e) { - // handle the error - } - - return statusSummary; -} - - -status(cwd).then((status) => { - const version = - `#ifndef VERSION_H \n - #define VERSION_H \n - #define VERSION "${pkgVersion}|${status.latest.hash}"\n - #define CID "${cid}"\n - #endif`; - - write.sync('./Version.h', version); - console.log(version); -} -); \ No newline at end of file diff --git a/projects/pid-controller/firmware/yarn.lock b/projects/pid-controller/firmware/yarn.lock deleted file mode 100644 index bfb766582..000000000 --- a/projects/pid-controller/firmware/yarn.lock +++ /dev/null @@ -1,788 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@sindresorhus/df@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-1.0.1.tgz#c69b66f52f6fcdd287c807df210305dbaf78500d" - integrity sha1-xptm9S9vzdKHyAffIQMF2694UA0= - -"@sindresorhus/df@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/df/-/df-2.1.0.tgz#d208cf27e06f0bb476d14d7deccd7d726e9aa389" - integrity sha1-0gjPJ+BvC7R20U197M19cm6ao4k= - dependencies: - execa "^0.2.2" - -"@types/minimatch@^3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" - integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== - -"@xblox/core@0.0.18": - version "0.0.18" - resolved "https://registry.yarnpkg.com/@xblox/core/-/core-0.0.18.tgz#6513807ba2982c6b274b3e3972bec312dfb2c8da" - integrity sha1-ZROAe6KYLGsnSz45cr7DEt+yyNo= - dependencies: - base-64 "^0.1.0" - jsonpath "^0.2.11" - qs "^6.4.0" - reflect-metadata "^0.1.10" - -"@xblox/fs@^0.13.19": - version "0.13.19" - resolved "https://registry.yarnpkg.com/@xblox/fs/-/fs-0.13.19.tgz#7231ac9bc186a15a48d04a9c4d86c7ff651f8740" - integrity sha512-211yh3Zkm0AIMjNfhOhGzw+vTWH+O4zMivktjW0M+l5mJkyM2f92Pw/GBvxFAOWR2Fryn2NfCIF1GiQIRYdTEQ== - dependencies: - "@types/minimatch" "^3.0.3" - "@xblox/core" "0.0.18" - denodeify "^1.2.1" - errno "^0.1.4" - mime "^2.0.3" - minimatch "^3.0.4" - mkdirp "^0.5.1" - progress-stream "^1.2.0" - q "^1.4.1" - rimraf "^2.6.2" - throttle "^1.0.3" - trash "^4.0.1" - write-file-atomic "^1.3.1" - -JSONSelect@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/JSONSelect/-/JSONSelect-0.4.0.tgz#a08edcc67eb3fcbe99ed630855344a0cf282bb8d" - integrity sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40= - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -base-64@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" - integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs= - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -cjson@~0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/cjson/-/cjson-0.2.1.tgz#73cd8aad65d9e1505f9af1744d3b79c1527682a5" - integrity sha1-c82KrWXZ4VBfmvF0TTt5wVJ2gqU= - -colors@0.5.x: - version "0.5.1" - resolved "https://registry.yarnpkg.com/colors/-/colors-0.5.1.tgz#7d0023eaeb154e8ee9fce75dcb923d0ed1667774" - integrity sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q= - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= - -cross-spawn-async@^2.1.1: - version "2.2.5" - resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc" - integrity sha1-hF/wwINKPe2dFg2sptOQkGuyiMw= - dependencies: - lru-cache "^4.0.0" - which "^1.2.8" - -cross-spawn@^6.0.0: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -debug@2: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -debug@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" - -denodeify@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/denodeify/-/denodeify-1.2.1.tgz#3a36287f5034e699e7577901052c2e6c94251631" - integrity sha1-OjYof1A05pnnV3kBBSwubJQlFjE= - -dir-glob@^2.0.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" - integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== - dependencies: - path-type "^3.0.0" - -ebnf-parser@~0.1.9: - version "0.1.10" - resolved "https://registry.yarnpkg.com/ebnf-parser/-/ebnf-parser-0.1.10.tgz#cd1f6ba477c5638c40c97ed9b572db5bab5d8331" - integrity sha1-zR9rpHfFY4xAyX7ZtXLbW6tdgzE= - -errno@^0.1.4: - version "0.1.7" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" - integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== - dependencies: - prr "~1.0.1" - -escape-string-applescript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-applescript/-/escape-string-applescript-2.0.0.tgz#760bca838668e408fe5ee52ce42caf7cb46c5273" - integrity sha1-dgvKg4Zo5Aj+XuUs5CyvfLRsUnM= - -escodegen@0.0.21: - version "0.0.21" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-0.0.21.tgz#53d652cfa1030388279458a5266c5ffc709c63c3" - integrity sha1-U9ZSz6EDA4gnlFilJmxf/HCcY8M= - dependencies: - esprima "~1.0.2" - estraverse "~0.0.4" - optionalDependencies: - source-map ">= 0.1.2" - -escodegen@~0.0.24: - version "0.0.28" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-0.0.28.tgz#0e4ff1715f328775d6cab51ac44a406cd7abffd3" - integrity sha1-Dk/xcV8yh3XWyrUaxEpAbNer/9M= - dependencies: - esprima "~1.0.2" - estraverse "~1.3.0" - optionalDependencies: - source-map ">= 0.1.2" - -esprima@1.0.x, esprima@~1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad" - integrity sha1-n1V+CPw7TSbs6d00+Pv0drYlha0= - -esprima@1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.2.tgz#76a0fd66fcfe154fd292667dc264019750b1657b" - integrity sha1-dqD9Zvz+FU/SkmZ9wmQBl1CxZXs= - -estraverse@~0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-0.0.4.tgz#01a0932dfee574684a598af5a67c3bf9b6428db2" - integrity sha1-AaCTLf7ldGhKWYr1pnw7+bZCjbI= - -estraverse@~1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.3.2.tgz#37c2b893ef13d723f276d878d60d8535152a6c42" - integrity sha1-N8K4k+8T1yPydth41g2FNRUqbEI= - -execa@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" - integrity sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw== - dependencies: - cross-spawn "^6.0.0" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -execa@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.2.2.tgz#e2ead472c2c31aad6f73f1ac956eef45e12320cb" - integrity sha1-4urUcsLDGq1vc/GslW7vReEjIMs= - dependencies: - cross-spawn-async "^2.1.1" - npm-run-path "^1.0.0" - object-assign "^4.0.1" - path-key "^1.0.0" - strip-eof "^1.0.0" - -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" - integrity sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A= - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= - -glob@^7.1.2, glob@^7.1.3: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globby@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-7.1.1.tgz#fb2ccff9401f8600945dfada97440cca972b8680" - integrity sha1-+yzP+UAfhgCUXfral0QMypcrhoA= - dependencies: - array-union "^1.0.1" - dir-glob "^2.0.0" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== - -ignore@^3.3.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@~2.0.1: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= - -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -jison-lex@0.2.x: - version "0.2.1" - resolved "https://registry.yarnpkg.com/jison-lex/-/jison-lex-0.2.1.tgz#ac4b815e8cce5132eb12b5dfcfe8d707b8844dfe" - integrity sha1-rEuBXozOUTLrErXfz+jXB7iETf4= - dependencies: - lex-parser "0.1.x" - nomnom "1.5.2" - -jison@0.4.13: - version "0.4.13" - resolved "https://registry.yarnpkg.com/jison/-/jison-0.4.13.tgz#9041707d62241367f58834532b9f19c2c36fac78" - integrity sha1-kEFwfWIkE2f1iDRTK58ZwsNvrHg= - dependencies: - JSONSelect "0.4.0" - cjson "~0.2.1" - ebnf-parser "~0.1.9" - escodegen "0.0.21" - esprima "1.0.x" - jison-lex "0.2.x" - lex-parser "~0.1.3" - nomnom "1.5.2" - -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= - optionalDependencies: - graceful-fs "^4.1.6" - -jsonpath@^0.2.11: - version "0.2.12" - resolved "https://registry.yarnpkg.com/jsonpath/-/jsonpath-0.2.12.tgz#5bf9d911fb4616c1e3370beceb9f0db24ae34cd2" - integrity sha1-W/nZEftGFsHjNwvs658NskrjTNI= - dependencies: - esprima "1.2.2" - jison "0.4.13" - static-eval "0.2.3" - underscore "1.7.0" - -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" - integrity sha1-QIhDO0azsbolnXh4XY6W9zugJDk= - optionalDependencies: - graceful-fs "^4.1.9" - -lex-parser@0.1.x, lex-parser@~0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/lex-parser/-/lex-parser-0.1.4.tgz#64c4f025f17fd53bfb45763faeb16f015a747550" - integrity sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA= - -lru-cache@^4.0.0: - version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" - integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - -mime@^2.0.3: - version "2.4.5" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.5.tgz#d8de2ecb92982dedbb6541c9b6841d7f218ea009" - integrity sha512-3hQhEUF027BuxZjQA3s7rIv/7VCQPa27hN9u9g87sEkWaKwQPuXOkVKtOeiyUrnWqTDiOs8Ed2rwg733mB0R5w== - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -mkdirp@^0.5.1: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== - dependencies: - minimist "^1.2.5" - -mount-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mount-point/-/mount-point-3.0.0.tgz#665cb9edebe80d110e658db56c31d0aef51a8f97" - integrity sha1-Zly57evoDREOZY21bDHQrvUaj5c= - dependencies: - "@sindresorhus/df" "^1.0.1" - pify "^2.3.0" - pinkie-promise "^2.0.1" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -ms@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - -nomnom@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.5.2.tgz#f4345448a853cfbd5c0d26320f2477ab0526fe2f" - integrity sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8= - dependencies: - colors "0.5.x" - underscore "1.1.x" - -npm-run-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-1.0.0.tgz#f5c32bf595fe81ae927daec52e82f8b000ac3c8f" - integrity sha1-9cMr9ZX+ga6Sfa7FLoL4sACsPI8= - dependencies: - path-key "^1.0.0" - -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= - dependencies: - path-key "^2.0.0" - -object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -object-keys@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" - integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= - -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= - -p-map@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" - integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== - -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-key@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-1.0.0.tgz#5d53d578019646c0d68800db4e146e6bdc2ac7af" - integrity sha1-XVPVeAGWRsDWiADbThRua9wqx68= - -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= - -path-type@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" - integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== - dependencies: - pify "^3.0.0" - -pify@^2.2.0, pify@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= - -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= - -pinkie-promise@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= - -progress-stream@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/progress-stream/-/progress-stream-1.2.0.tgz#2cd3cfea33ba3a89c9c121ec3347abe9ab125f77" - integrity sha1-LNPP6jO6OonJwSHsM0er6asSX3c= - dependencies: - speedometer "~0.1.2" - through2 "~0.2.3" - -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= - -q@^1.4.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= - -qs@^6.4.0: - version "6.9.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.3.tgz#bfadcd296c2d549f1dffa560619132c977f5008e" - integrity sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw== - -"readable-stream@>= 0.3.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@~1.1.9: - version "1.1.14" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" - integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - -reflect-metadata@^0.1.10: - version "0.1.13" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" - integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== - -rimraf@^2.2.8, rimraf@^2.6.2: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - -run-applescript@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-3.2.0.tgz#73fb34ce85d3de8076d511ea767c30d4fdfc918b" - integrity sha512-Ep0RsvAjnRcBX1p5vogbaBdAGu/8j/ewpvGqnQYunnLd9SM0vWcPJewPKNnWFggf0hF0pwIgwV5XK7qQ7UZ8Qg== - dependencies: - execa "^0.10.0" - -safe-buffer@~5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== - -semver@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= - -signal-exit@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== - -simple-git@^1.131.0: - version "1.132.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.132.0.tgz#53ac4c5ec9e74e37c2fd461e23309f22fcdf09b1" - integrity sha512-xauHm1YqCTom1sC9eOjfq3/9RKiUA9iPnxBbrY2DdL8l4ADMu0jjM5l5lphQP5YWNqAL2aXC/OeuQ76vHtW5fg== - dependencies: - debug "^4.0.1" - -slash@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" - integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= - -slide@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" - integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= - -"source-map@>= 0.1.2": - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - -speedometer@~0.1.2: - version "0.1.4" - resolved "https://registry.yarnpkg.com/speedometer/-/speedometer-0.1.4.tgz#9876dbd2a169d3115402d48e6ea6329c8816a50d" - integrity sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0= - -static-eval@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/static-eval/-/static-eval-0.2.3.tgz#023f17ac9fee426ea788c12ea39206dc175f8b2a" - integrity sha1-Aj8XrJ/uQm6niMEuo5IG3Bdfiyo= - dependencies: - escodegen "~0.0.24" - -"stream-parser@>= 0.0.2": - version "0.3.1" - resolved "https://registry.yarnpkg.com/stream-parser/-/stream-parser-0.3.1.tgz#1618548694420021a1182ff0af1911c129761773" - integrity sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M= - dependencies: - debug "2" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= - -throttle@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/throttle/-/throttle-1.0.3.tgz#8a32e4a15f1763d997948317c5ebe3ad8a41e4b7" - integrity sha1-ijLkoV8XY9mXlIMXxevjrYpB5Lc= - dependencies: - readable-stream ">= 0.3.0" - stream-parser ">= 0.0.2" - -through2@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/through2/-/through2-0.2.3.tgz#eb3284da4ea311b6cc8ace3653748a52abf25a3f" - integrity sha1-6zKE2k6jEbbMis42U3SKUqvyWj8= - dependencies: - readable-stream "~1.1.9" - xtend "~2.1.1" - -trash@^4.0.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/trash/-/trash-4.3.0.tgz#6ebeecdea4d666b06e389b47d135ea88e1de5075" - integrity sha512-f36TKwIaBiXm63xSrn8OTNghg5CYHBsFVJvcObMo76LRpgariuRi2CqXQHw1VzfeximD0igdGaonOG6N760BtQ== - dependencies: - escape-string-applescript "^2.0.0" - fs-extra "^0.30.0" - globby "^7.1.1" - p-map "^1.2.0" - p-try "^1.0.0" - pify "^3.0.0" - run-applescript "^3.0.0" - uuid "^3.1.0" - xdg-trashdir "^2.1.1" - -underscore@1.1.x: - version "1.1.7" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.1.7.tgz#40bab84bad19d230096e8d6ef628bff055d83db0" - integrity sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA= - -underscore@1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209" - integrity sha1-a7rwh3UA02vjTsqlhODbn+8DUgk= - -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" - integrity sha1-nHC/2Babwdy/SGBODwS4tJzenp8= - dependencies: - os-homedir "^1.0.0" - -util-deprecate@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -uuid@^3.1.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - -which@^1.2.8, which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -write-file-atomic@^1.3.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" - integrity sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8= - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - slide "^1.1.5" - -xdg-basedir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-2.0.0.tgz#edbc903cc385fc04523d966a335504b5504d1bd2" - integrity sha1-7byQPMOF/ARSPZZqM1UEtVBNG9I= - dependencies: - os-homedir "^1.0.0" - -xdg-trashdir@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/xdg-trashdir/-/xdg-trashdir-2.1.1.tgz#59a60aaf8e6f9240c1daed9a0944b2f514c27d8e" - integrity sha512-KcVhPaOu2ZurYNHSRTf1+ZHORkTZGCQ+u0JHN17QixRISJq4pXOnjt/lQcehvtHL5QAKhSzKgyjrcNnPdkPBHA== - dependencies: - "@sindresorhus/df" "^2.1.0" - mount-point "^3.0.0" - pify "^2.2.0" - user-home "^2.0.0" - xdg-basedir "^2.0.0" - -xtend@~2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" - integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= - dependencies: - object-keys "~0.4.0" - -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= diff --git a/projects/pid-controller/network.md b/projects/pid-controller/network.md deleted file mode 100644 index 639f48976..000000000 --- a/projects/pid-controller/network.md +++ /dev/null @@ -1,26 +0,0 @@ -## Remarks on the network - - -*Plasticbay - Scotland (yeah)* - -Well I have mentioned a few times that there was a problem with the strategy of overshooting melting temperature by 50 or 60 deg C. It generates fumes and degrades the plastics seriously. I am very concerned by this advice and I am basically told to just get on with it. Here a little explanation of what is going on: -You may know that plastic is a good thermal insulant, meaning its thermal conductivity is low. That means that if you heat up a mass from the outside, it will take a long time to be at the same temperature in the inside. The gradient between the core and the outside of what you want to melt is depending of the thermal conductivity. For the sake of simplicity, lets say the "instantaneous" thermal gradient needed to melt your example is 60 deg C. -So to get the inside to melt, either (1) you heat up to the melting temperature or just above and wait that the heat transfers inside let say it takes 12h or (2) you rise the outside temperature 60 degrees above the melting temperature so "relatively" quickly the inside reaches the melting temperature. - -(2) is what the Team is advising and I am firmly against it because while you do that, the outside of the mass (here sheet) is at 220-240 degs, the mass that is overheated generates a lot of fumes and looses its chemical properties and basically its capacity to bond. That's why many complain that the sheets have a random output. All the charts should be changed with a proper time-to-temperature-to-mass output. I find the current advice dangerous. - ---- - -*RENN* - -Hi there, - -I am starting my sheetpress workplace and I just run our machine yesterday and the result was bad :( -It didn't melt properly, some parts didnt melted at all. (It didnt burn) -I want to know why it failed. - -I followed the guide from preciousplastic official site. (see the pic) -I melted HDPE in 220 degree for 1 hour (for 22MM thickness) -I know the melting point of HDPE is 120 degree but I just followed the guide. - -Do you guys think the temperature was wrong? diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton.cpp b/projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton.cpp deleted file mode 100644 index ea18cc14b..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "AnalogButton_local.h" -//#include "WProgram.h" -#include "Arduino.h" - -AnalogButton::AnalogButton(uint8_t analogPin, int buttonValueReturn, - int buttonValueUp, int buttonValueDown, int buttonValueOk) -{ - // Store analog pin used to multiplex push button - buttonPin = analogPin; - - // Add upper bound of tolerance for variation againts resistor values, temperature - // and other possible drift - buttonValueThresholdReturn = TOLERANCE*buttonValueReturn; - buttonValueThresholdUp = TOLERANCE*buttonValueUp; - buttonValueThresholdDown = TOLERANCE*buttonValueDown; - buttonValueThresholdOk = TOLERANCE*buttonValueOk; -} - -button_t AnalogButton::read(void) -{ - int buttonValue; - - buttonValue = analogRead(buttonPin); - - if (buttonValue >= BUTTON_NONE_THRESHOLD) return BUTTON_NONE; - if (buttonValue <= buttonValueThresholdReturn) return BUTTON_RETURN; - if (buttonValue <= buttonValueThresholdUp) return BUTTON_UP; - if (buttonValue <= buttonValueThresholdDown) return BUTTON_DOWN; - if (buttonValue <= buttonValueThresholdOk) return BUTTON_OK; - - return BUTTON_NONE; -} - -button_t AnalogButton::get(void) -{ - static button_t buttonMask; - static buttonState_t buttonState; - static unsigned long debounceTimer; - button_t buttonValue; - button_t buttonStatus; - - // Initialize button status - buttonStatus = BUTTON_NONE; - - switch (buttonState) - { - case BUTTON_STATE_SCAN: - // Retrieve current button value - buttonValue = read(); - // If button press is detected - if (buttonValue != BUTTON_NONE) - { - // Store current button press value - buttonMask = buttonValue; - // Retrieve current time - debounceTimer = millis(); - debounceTimer += DEBOUNCE_PERIOD; - // Proceed to button debounce state - buttonState = BUTTON_STATE_DEBOUNCE; - } - break; - - case BUTTON_STATE_DEBOUNCE: - if (read() == buttonMask) - { - // If debounce period is completed - if (millis() >= debounceTimer) - { - buttonStatus = buttonMask; - // Proceed to wait for the button to be released - buttonState = BUTTON_STATE_RELEASE; - } - } - break; - - case BUTTON_STATE_RELEASE: - if (read() == BUTTON_NONE) - { - buttonMask = BUTTON_NONE; - buttonState = BUTTON_STATE_SCAN; - } - break; - } - - return (buttonStatus); -} diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton_local.h b/projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton_local.h deleted file mode 100644 index bfa1e3524..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/AnalogButton_local.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef AnalogButton_h -#define AnalogButton_h - -#include - -enum button_t -{ - BUTTON_NONE, - BUTTON_RETURN, - BUTTON_UP, - BUTTON_DOWN, - BUTTON_OK -}; - -enum buttonState_t -{ - BUTTON_STATE_SCAN, - BUTTON_STATE_DEBOUNCE, - BUTTON_STATE_RELEASE -}; - -#define BUTTON_NONE_THRESHOLD 1000 -#define TOLERANCE 1.1 -#define DEBOUNCE_PERIOD 100 - -class AnalogButton -{ - public: - AnalogButton(uint8_t analogPin, int buttonValueReturn, - int buttonValueUp, int buttonValueDown, - int buttonValueOk); - - button_t get(void); - - private: - button_t read(void); - - // Analog pin used as button multiplexer - uint8_t buttonPin; - // Upper boound ADC value for each button - int buttonValueThresholdReturn; - int buttonValueThresholdUp; - int buttonValueThresholdDown; - int buttonValueThresholdOk; -}; - -#endif diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/EEPROMAnything.h b/projects/pid-controller/reference-impl/osPID-Firmware/EEPROMAnything.h deleted file mode 100644 index c548cbf61..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/EEPROMAnything.h +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include // for type definitions - -template int EEPROM_writeAnything(int ee, const T& value) -{ - const byte* p = (const byte*)(const void*)&value; - unsigned int i; - for (i = 0; i < sizeof(value); i++) - EEPROM.write(ee++, *p++); - return i; -} - -template int EEPROM_readAnything(int ee, T& value) -{ - byte* p = (byte*)(void*)&value; - unsigned int i; - for (i = 0; i < sizeof(value); i++) - *p++ = EEPROM.read(ee++); - return i; -} diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/MAX31855.cpp b/projects/pid-controller/reference-impl/osPID-Firmware/MAX31855.cpp deleted file mode 100644 index ea3a1f5e9..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/MAX31855.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* -* MAX31855 Library -* Version: 1.10 -* Date: 24-07-2012 -* Company: Rocket Scream Electronics -* Website: www.rocketscream.com -* -* This is a MAX31855 library for Arduino. Please check our wiki -* (www.rocketscream.com/wiki) for more information on using this piece of -* library. -* -* This library is licensed under Creative Commons Attribution-ShareAlike 3.0 -* Unported License. -* -* Revision Description -* ======== =========== -* 1.10 Added negative temperature support for both junction & thermocouple. -* 1.00 Initial public release. -* -*******************************************************************************/ -#include "MAX31855_local.h" - -MAX31855::MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK) -{ - so = SO; - cs = CS; - sck = SCK; - - // MAX31855 data output pin - pinMode(so, INPUT); - // MAX31855 chip select input pin - pinMode(cs, OUTPUT); - // MAX31855 clock input pin - pinMode(sck, OUTPUT); - - // Default output pins state - digitalWrite(cs, HIGH); - digitalWrite(sck, LOW); -} - -/******************************************************************************* -* Name: readThermocouple -* Description: Read the thermocouple temperature either in Degree Celsius or -* Fahrenheit. Internally, the conversion takes place in the -* background within 100 ms. Values are updated only when the CS -* line is high. -* -* Argument Description -* ========= =========== -* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT -* -* Return Description -* ========= =========== -* temperature Temperature of the thermocouple either in Degree Celsius or -* Fahrenheit. If fault is detected, FAULT_OPEN, FAULT_SHORT_GND or -* FAULT_SHORT_VCC will be returned. These fault values are outside -* of the temperature range the MAX31855 is capable of. -*******************************************************************************/ -double MAX31855::readThermocouple(unit_t unit) -{ - unsigned long data; - double temperature; - - // Initialize temperature - temperature = 0; - - // Shift in 32-bit of data from MAX31855 - data = readData(); - - // If fault is detected - if (data & 0x00010000) - { - // Check for fault type (3 LSB) - switch (data & 0x00000007) - { - // Open circuit - case 0x01: - temperature = FAULT_OPEN; - break; - - // Thermocouple short to GND - case 0x02: - temperature = FAULT_SHORT_GND; - break; - - // Thermocouple short to VCC - case 0x04: - temperature = FAULT_SHORT_VCC; - break; - } - } - // No fault detected - else - { - // Retrieve thermocouple temperature data and strip redundant data - data = data >> 18; - // Bit-14 is the sign - temperature = (data & 0x00001FFF); - - // Check for negative temperature - if (data & 0x00002000) - { - // 2's complement operation - // Invert - data = ~data; - // Ensure operation involves lower 13-bit only - temperature = data & 0x00001FFF; - // Add 1 to obtain the positive number - temperature += 1; - // Make temperature negative - temperature *= -1; - } - - // Convert to Degree Celsius - temperature *= 0.25; - - // If temperature unit in Fahrenheit is desired - if (unit == FAHRENHEIT) - { - // Convert Degree Celsius to Fahrenheit - temperature = (temperature * 9.0 / 5.0) + 32; - } - } - return (temperature); -} - -/******************************************************************************* -* Name: readJunction -* Description: Read the thermocouple temperature either in Degree Celsius or -* Fahrenheit. Internally, the conversion takes place in the -* background within 100 ms. Values are updated only when the CS -* line is high. -* -* Argument Description -* ========= =========== -* 1. unit Unit of temperature required: CELSIUS or FAHRENHEIT -* -* Return Description -* ========= =========== -* temperature Temperature of the cold junction either in Degree Celsius or -* Fahrenheit. -* -*******************************************************************************/ -double MAX31855::readJunction(unit_t unit) -{ - double temperature; - unsigned long data; - - // Shift in 32-bit of data from MAX31855 - data = readData(); - - // Strip fault data bits & reserved bit - data = data >> 4; - // Bit-12 is the sign - temperature = (data & 0x000007FF); - - // Check for negative temperature - if (data & 0x00000800) - { - // 2's complement operation - // Invert - data = ~data; - // Ensure operation involves lower 11-bit only - temperature = data & 0x000007FF; - // Add 1 to obtain the positive number - temperature += 1; - // Make temperature negative - temperature *= -1; - } - - // Convert to Degree Celsius - temperature *= 0.0625; - - // If temperature unit in Fahrenheit is desired - if (unit == FAHRENHEIT) - { - // Convert Degree Celsius to Fahrenheit - temperature = (temperature * 9.0 / 5.0) + 32; - } - - // Return the temperature - return (temperature); -} - -/******************************************************************************* -* Name: readData -* Description: Shift in 32-bit of data from MAX31855 chip. Minimum clock pulse -* width is 100 ns. No delay is required in this case. -* -* Argument Description -* ========= =========== -* 1. NIL -* -* Return Description -* ========= =========== -* data 32-bit of data acquired from the MAX31855 chip. -* -*******************************************************************************/ -unsigned long MAX31855::readData() -{ - int bitCount; - unsigned long data; - - // Clear data - data = 0; - - // Select the MAX31855 chip - digitalWrite(cs, LOW); - - // Shift in 32-bit of data - for (bitCount = 31; bitCount >= 0; bitCount--) - { - digitalWrite(sck, HIGH); - - // If data bit is high - if (digitalRead(so)) - { - // Need to type cast data type to unsigned long, else compiler will - // truncate to 16-bit - data |= ((unsigned long)1 << bitCount); - } - - digitalWrite(sck, LOW); - } - - // Deselect MAX31855 chip - digitalWrite(cs, HIGH); - - return (data); -} \ No newline at end of file diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/MAX31855_local.h b/projects/pid-controller/reference-impl/osPID-Firmware/MAX31855_local.h deleted file mode 100644 index 79c1b1285..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/MAX31855_local.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef MAX31855_H -#define MAX31855_H - -#if ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - -#define FAULT_OPEN 10000 -#define FAULT_SHORT_GND 10001 -#define FAULT_SHORT_VCC 10002 - -enum unit_t -{ - CELSIUS, - FAHRENHEIT -}; - -class MAX31855 -{ -public: - MAX31855(unsigned char SO, unsigned char CS, unsigned char SCK); - - double readThermocouple(unit_t unit); - double readJunction(unit_t unit); - -private: - unsigned char so; - unsigned char cs; - unsigned char sck; - - unsigned long readData(); -}; -#endif \ No newline at end of file diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0.cpp b/projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0.cpp deleted file mode 100644 index 51894b494..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/********************************************************************************************** - * Arduino PID AutoTune Library - Version 0.0.0 - * by Brett Beauregard brettbeauregard.com - * - * This Library is ported from the AutotunerPID Toolkit by William Spinelli - * (http://www.mathworks.com/matlabcentral/fileexchange/4652) - * Copyright (c) 2004 - * - * This Library is licensed under the BSD License: - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - **********************************************************************************************/ - -#if ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - -#include "PID_AutoTune_v0_local.h" //renamed to avoid conflict if Autotune library is installed on IDE - -PID_ATune::PID_ATune(double *Input, double *Output) -{ - input = Input; - output = Output; - controlType = 0; //default to PI - noiseBand = 0.5; - running = false; - oStep = 30; - SetLookbackSec(10); - lastTime = millis(); -} - -void PID_ATune::Cancel() -{ - running = false; -} - -int PID_ATune::Runtime() -{ - justevaled = false; - if (peakCount > 9 && running) - { - running = false; - FinishUp(); - return 1; - } - unsigned long now = millis(); - - if ((now - lastTime) < (unsigned long)sampleTime) - return false; - lastTime = now; - double refVal = *input; - justevaled = true; - if (!running) - { //initialize working variables the first time around - peakType = 0; - peakCount = 0; - justchanged = false; - absMax = refVal; - absMin = refVal; - setpoint = refVal; - running = true; - initCount = 0; - outputStart = *output; - *output = outputStart + oStep; - } - else - { - if (refVal > absMax) - absMax = refVal; - if (refVal < absMin) - absMin = refVal; - } - - //oscillate the output base on the input's relation to the setpoint - - if (refVal > setpoint + noiseBand) - *output = outputStart - oStep; - else if (refVal < setpoint - noiseBand) - *output = outputStart + oStep; - - //bool isMax=true, isMin=true; - isMax = true; - isMin = true; - //id peaks - for (int i = nLookBack - 1; i >= 0; i--) - { - double val = lastInputs[i]; - if (isMax) - isMax = refVal > val; - if (isMin) - isMin = refVal < val; - lastInputs[i + 1] = lastInputs[i]; - } - lastInputs[0] = refVal; - if (nLookBack < 9) - { //we don't want to trust the maxes or mins until the inputs array has been filled - initCount++; - return 0; - } - - if (isMax) - { - if (peakType == 0) - peakType = 1; - if (peakType == -1) - { - peakType = 1; - justchanged = true; - peak2 = peak1; - } - peak1 = now; - peaks[peakCount] = refVal; - } - else if (isMin) - { - if (peakType == 0) - peakType = -1; - if (peakType == 1) - { - peakType = -1; - peakCount++; - justchanged = true; - } - - if (peakCount < 10) - peaks[peakCount] = refVal; - } - - if (justchanged && peakCount > 2) - { //we've transitioned. check if we can autotune based on the last peaks - double avgSeparation = (abs(peaks[peakCount - 1] - peaks[peakCount - 2]) + abs(peaks[peakCount - 2] - peaks[peakCount - 3])) / 2; - if (avgSeparation < 0.05 * (absMax - absMin)) - { - FinishUp(); - running = false; - return 1; - } - } - justchanged = false; - return 0; -} -void PID_ATune::FinishUp() -{ - *output = outputStart; - //we can generate tuning parameters! - Ku = 4 * oStep / ((absMax - absMin) * 3.14159); - Pu = (double)(peak1 - peak2) / 1000; -} - -double PID_ATune::GetKp() -{ - return controlType == 1 ? 0.6 * Ku : 0.4 * Ku; -} - -double PID_ATune::GetKi() -{ - return controlType == 1 ? 1.2 * Ku / Pu : 0.48 * Ku / Pu; // Ki = Kc/Ti -} - -double PID_ATune::GetKd() -{ - return controlType == 1 ? 0.075 * Ku * Pu : 0; //Kd = Kc * Td -} - -void PID_ATune::SetOutputStep(double Step) -{ - oStep = Step; -} - -double PID_ATune::GetOutputStep() -{ - return oStep; -} - -void PID_ATune::SetControlType(int Type) //0=PI, 1=PID -{ - controlType = Type; -} -int PID_ATune::GetControlType() -{ - return controlType; -} - -void PID_ATune::SetNoiseBand(double Band) -{ - noiseBand = Band; -} - -double PID_ATune::GetNoiseBand() -{ - return noiseBand; -} - -void PID_ATune::SetLookbackSec(int value) -{ - if (value < 1) - value = 1; - - if (value < 25) - { - nLookBack = value * 4; - sampleTime = 250; - } - else - { - nLookBack = 100; - sampleTime = value * 10; - } -} - -int PID_ATune::GetLookbackSec() -{ - return nLookBack * sampleTime / 1000; -} diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0_local.h b/projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0_local.h deleted file mode 100644 index 90fc1d1ca..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/PID_AutoTune_v0_local.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef PID_AutoTune_v0 -#define PID_AutoTune_v0 -#define LIBRARY_VERSION 0.0.0 - -class PID_ATune -{ - -public: - //commonly used functions ************************************************************************** - PID_ATune(double *, double *); // * Constructor. links the Autotune to a given PID - int Runtime(); // * Similar to the PID Compue function, returns non 0 when done - void Cancel(); // * Stops the AutoTune - - void SetOutputStep(double); // * how far above and below the starting value will the output step? - double GetOutputStep(); // - - void SetControlType(int); // * Determies if the tuning parameters returned will be PI (D=0) - int GetControlType(); // or PID. (0=PI, 1=PID) - - void SetLookbackSec(int); // * how far back are we looking to identify peaks - int GetLookbackSec(); // - - void SetNoiseBand(double); // * the autotune will ignore signal chatter smaller than this value - double GetNoiseBand(); // this should be acurately set - - double GetKp(); // * once autotune is complete, these functions contain the - double GetKi(); // computed tuning parameters. - double GetKd(); // - -private: - void FinishUp(); - bool isMax, isMin; - double *input, *output; - double setpoint; - double noiseBand; - int controlType; - bool running; - unsigned long peak1, peak2, lastTime; - int sampleTime; - int nLookBack; - int peakType; - double lastInputs[100]; - double peaks[10]; - int peakCount; - bool justchanged; - bool justevaled; - int initCount; - double absMax, absMin; - double oStep; - double outputStart; - double Ku, Pu; -}; -#endif diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/PID_v1.cpp b/projects/pid-controller/reference-impl/osPID-Firmware/PID_v1.cpp deleted file mode 100644 index 1d391cd58..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/PID_v1.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/********************************************************************************************** - * Arduino PID Library - Version 1.0.1 - * by Brett Beauregard brettbeauregard.com - * - * This Library is licensed under a GPLv3 License - **********************************************************************************************/ - -#if ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - -#include "PID_v1_local.h" //renamed to avoid conflict if PID library is installed on IDE - -/*Constructor (...)********************************************************* -* The parameters specified here are those for for which we can't set up -* reliable defaults, so we need to have the user set them. -***************************************************************************/ -PID::PID(double* Input, double* Output, double* Setpoint, - double Kp, double Ki, double Kd, int ControllerDirection) -{ -PID::SetOutputLimits(0, 255); //default output limit corresponds to -//the arduino pwm limits - - SampleTime = 100; //default Controller Sample Time is 0.1 seconds - - PID::SetControllerDirection(ControllerDirection); - PID::SetTunings(Kp, Ki, Kd); - - lastTime = millis()-SampleTime; - inAuto = false; - myOutput = Output; - myInput = Input; - mySetpoint = Setpoint; - -} - - -/* Compute() ********************************************************************** -* This, as they say, is where the magic happens. this function should be called -* every time "void loop()" executes. the function will decide for itself whether a new -* pid Output needs to be computed -**********************************************************************************/ -void PID::Compute() -{ - if(!inAuto) return; - unsigned long now = millis(); - unsigned long timeChange = (now - lastTime); - if(timeChange>=(unsigned long)SampleTime) - { - /*Compute all the working error variables*/ - double input = *myInput; - double error = *mySetpoint - input; - ITerm+= (ki * error); - if(ITerm > outMax) ITerm= outMax; - else if(ITerm < outMin) ITerm= outMin; - double dInput = (input - lastInput); - - /*Compute PID Output*/ - double output = kp * error + ITerm- kd * dInput; - - if(output > outMax) output = outMax; - else if(output < outMin) output = outMin; - *myOutput = output; - - /*Remember some variables for next time*/ - lastInput = input; - lastTime = now; - } -} - - -/* SetTunings(...)************************************************************* -* This function allows the controller's dynamic performance to be adjusted. -* it's called automatically from the constructor, but tunings can also -* be adjusted on the fly during normal operation -******************************************************************************/ -void PID::SetTunings(double Kp, double Ki, double Kd) -{ - if (Kp<0 || Ki<0 || Kd<0) return; - - dispKp = Kp; dispKi = Ki; dispKd = Kd; - - double SampleTimeInSec = ((double)SampleTime)/1000; - kp = Kp; - ki = Ki * SampleTimeInSec; - kd = Kd / SampleTimeInSec; - - if(controllerDirection ==REVERSE) - { - kp = (0 - kp); - ki = (0 - ki); - kd = (0 - kd); - } -} - -/* SetSampleTime(...) ********************************************************* -* sets the period, in Milliseconds, at which the calculation is performed -******************************************************************************/ -void PID::SetSampleTime(int NewSampleTime) -{ - if (NewSampleTime > 0) - { - double ratio = (double)NewSampleTime - / (double)SampleTime; - ki *= ratio; - kd /= ratio; - SampleTime = (unsigned long)NewSampleTime; - } -} - -/* SetOutputLimits(...)**************************************************** -* This function will be used far more often than SetInputLimits. while -* the input to the controller will generally be in the 0-1023 range (which is -* the default already,) the output will be a little different. maybe they'll -* be doing a time window and will need 0-8000 or something. or maybe they'll -* want to clamp it from 0-125. who knows. at any rate, that can all be done -* here. -**************************************************************************/ -void PID::SetOutputLimits(double Min, double Max) -{ - if(Min >= Max) return; - outMin = Min; - outMax = Max; - - if(inAuto) - { - if(*myOutput > outMax) *myOutput = outMax; - else if(*myOutput < outMin) *myOutput = outMin; - - if(ITerm > outMax) ITerm= outMax; - else if(ITerm < outMin) ITerm= outMin; - } -} - -/* SetMode(...)**************************************************************** -* Allows the controller Mode to be set to manual (0) or Automatic (non-zero) -* when the transition from manual to auto occurs, the controller is -* automatically initialized -******************************************************************************/ -void PID::SetMode(int Mode) -{ - bool newAuto = (Mode == AUTOMATIC); - if(newAuto == !inAuto) - { /*we just went from manual to auto*/ - PID::Initialize(); - } - inAuto = newAuto; -} - -/* Initialize()**************************************************************** -* does all the things that need to happen to ensure a bumpless transfer -* from manual to automatic mode. -******************************************************************************/ -void PID::Initialize() -{ - ITerm = *myOutput; - lastInput = *myInput; - if(ITerm > outMax) ITerm = outMax; - else if(ITerm < outMin) ITerm = outMin; -} - -/* SetControllerDirection(...)************************************************* -* The PID will either be connected to a DIRECT acting process (+Output leads -* to +Input) or a REVERSE acting process(+Output leads to -Input.) we need to -* know which one, because otherwise we may increase the output when we should -* be decreasing. This is called from the constructor. -******************************************************************************/ -void PID::SetControllerDirection(int Direction) -{ - if(inAuto && Direction !=controllerDirection) - { - kp = (0 - kp); - ki = (0 - ki); - kd = (0 - kd); - } - controllerDirection = Direction; -} - -/* Status Funcions************************************************************* -* Just because you set the Kp=-1 doesn't mean it actually happened. these -* functions query the internal state of the PID. they're here for display -* purposes. this are the functions the PID Front-end uses for example -******************************************************************************/ -double PID::GetKp(){ return dispKp; } -double PID::GetKi(){ return dispKi;} -double PID::GetKd(){ return dispKd;} -int PID::GetMode(){ return inAuto ? AUTOMATIC : MANUAL;} -int PID::GetDirection(){ return controllerDirection;} - - diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/PID_v1_local.h b/projects/pid-controller/reference-impl/osPID-Firmware/PID_v1_local.h deleted file mode 100644 index ce64b6cf1..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/PID_v1_local.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef PID_v1_h -#define PID_v1_h -#define LIBRARY_VERSION 1.0.0 - -class PID -{ - - - public: - - //Constants used in some of the functions below - #define AUTOMATIC 1 - #define MANUAL 0 - #define DIRECT 0 - #define REVERSE 1 - - //commonly used functions ************************************************************************** - PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and - double, double, double, int); // Setpoint. Initial tuning parameters are also set here - - void SetMode(int Mode); // * sets PID to either Manual (0) or Auto (non-0) - - void Compute(); // * performs the PID calculation. it should be - // called every time loop() cycles. ON/OFF and - // calculation frequency can be set using SetMode - // SetSampleTime respectively - - void SetOutputLimits(double, double); //clamps the output to a specific range. 0-255 by default, but - //it's likely the user will want to change this depending on - //the application - - - - //available but not commonly used functions ******************************************************** - void SetTunings(double, double, // * While most users will set the tunings once in the - double); // constructor, this function gives the user the option - // of changing tunings during runtime for Adaptive control - void SetControllerDirection(int); // * Sets the Direction, or "Action" of the controller. DIRECT - // means the output will increase when error is positive. REVERSE - // means the opposite. it's very unlikely that this will be needed - // once it is set in the constructor. - void SetSampleTime(int); // * sets the frequency, in Milliseconds, with which - // the PID calculation is performed. default is 100 - - - - //Display functions **************************************************************** - double GetKp(); // These functions query the pid for interal values. - double GetKi(); // they were created mainly for the pid front-end, - double GetKd(); // where it's important to know what is actually - int GetMode(); // inside the PID. - int GetDirection(); // - - private: - void Initialize(); - - double dispKp; // * we'll hold on to the tuning parameters in user-entered - double dispKi; // format for display purposes - double dispKd; // - - double kp; // * (P)roportional Tuning Parameter - double ki; // * (I)ntegral Tuning Parameter - double kd; // * (D)erivative Tuning Parameter - - int controllerDirection; - - double *myInput; // * Pointers to the Input, Output, and Setpoint variables - double *myOutput; // This creates a hard link between the variables and the - double *mySetpoint; // PID, freeing the user from having to constantly tell us - // what these values are. with pointers we'll just know. - - unsigned long lastTime; - double ITerm, lastInput; - - int SampleTime; - double outMin, outMax; - bool inAuto; -}; -#endif - - diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/README.txt b/projects/pid-controller/reference-impl/osPID-Firmware/README.txt deleted file mode 100644 index a5661a1c5..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/README.txt +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************** - * osPID Firmware, Version 1.7 - * by Brett Beauregard & Rocket Scream - * License: GPLv3 & BSD License (For autotune) - * 27 April 2016 - ********************************************************/ - - NOTE: THIS FIRMWARE IS CONFIGURED FOR DIGITAL OUTPUT CARD - V1.5 & TEMPERATURE INPUT CARD V1.2. IF YOU ARE USING - A DIFFERENT I/O CONFIGURATION BE SURE TO UN-COMMENT THE - APPROPRIATE #DEFINE STATEMENTS IN IO.H. - -Updates for version 1.7 --output is disabled if input is in error state for both thermistor and thermocouple - -Updates for version 1.6 --added support for v1.5 of the Temperature Input card (MAX31855 Thermocouple chip) - -Updates for version 1.5 --restructured code to allow for different IO cards --added reflow profile support --eliminated LCD flicker --error message when thermocouple is disconnected --extreme code size / RAM improvement (mainly menu and EEPRom) --consolodated the code into fewer files - * osPID_Firmware.ino - Just about everything - * io.h - IO card code. pre-compiler flags control which card code is used - * EEPROMAnything.h - halley's amazing EEPROMWriteAnything code. - * AnalogButton .cpp _local.h - ospid button-reading/debounce code - * PID_AutoTune_v0 .cpp _local.h - local copy of the autotune library (to avoid - conflicts with possibly pre-installed copies) - * PID_v1 .ccp _local.h - local copy of the PID library - * max6675 .cpp _local.h - local copy of the max6675 library, used by the input card. diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/io.h b/projects/pid-controller/reference-impl/osPID-Firmware/io.h deleted file mode 100644 index 481d1e265..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/io.h +++ /dev/null @@ -1,530 +0,0 @@ -/******************************************************************************* -* The osPID Kit comes with swappable IO cards which are supported by different -* device drivers & libraries. For the osPID firmware to correctly communicate with -* your configuration, you must uncomment the appropriate "define" statements below. -* Please take note that only 1 input card and 1 output card can be used at a time. -* List of available IO cards: -* -* Input Cards -* =========== -* 1. TEMP_INPUT_V110: -* Temperature Basic V1.10 with 1 thermistor & 1 type-K thermocouple (MAX6675) -* interface. -* 2. TEMP_INPUT_V120: -* Temperature Basic V1.20 with 1 thermistor & 1 type-K thermocouple -* (MAX31855KASA) interface. -* 3. PROTOTYPE_INPUT: -* Generic prototype card with input specified by user. Please add necessary -* input processing in the section below. -* -* Output Cards -* ============ -* 1. DIGITAL_OUTPUT_V120: -* Output card with 1 SSR & 2 relay output. -* 2. DIGITAL_OUTPUT_V150: -* Output card with 1 SSR & 2 relay output. Similar to V1.20 except LED mount -* orientation. -* 3. PROTOTYPE_OUTPUT: -* Generic prototype card with output specified by user. Please add necessary -* output processing in the section below. -* -* This file is licensed under Creative Commons Attribution-ShareAlike 3.0 -* Unported License. -* -*******************************************************************************/ - -// ***** INPUT CARD ***** -//#define TEMP_INPUT_V110 -#define TEMP_INPUT_V120 -//#define PROTOTYPE_INPUT - -// ***** OUTPUT CARD ***** -//#define DIGITAL_OUTPUT_V120 -#define DIGITAL_OUTPUT_V150 -//#define PROTOTYPE_OUTPUT - -union { // This Data structure lets - byte asBytes[32]; // us take the byte array - float asFloat[8]; // sent from processing and -} // easily convert it to a -serialXfer; // float array -byte b1,b2; - -#ifdef TEMP_INPUT_V110 -#include "max6675_local.h" -const byte thermistorPin = A6; -const byte thermocoupleCS = 10; -const byte thermocoupleSO = 12; -const byte thermocoupleCLK = 13; -byte inputType = 0; -double THERMISTORNOMINAL = 10; -double BCOEFFICIENT = 1; -double TEMPERATURENOMINAL = 293.15; -double REFERENCE_RESISTANCE = 10; -MAX6675 thermocouple(thermocoupleCLK, thermocoupleCS, thermocoupleSO); - -// EEPROM backup -void EEPROMBackupInputParams(int offset) -{ - EEPROM.write(offset, inputType); - EEPROM_writeAnything(offset+2,THERMISTORNOMINAL); - EEPROM_writeAnything(offset+6,BCOEFFICIENT); - EEPROM_writeAnything(offset+10,TEMPERATURENOMINAL); - EEPROM_writeAnything(offset+14,REFERENCE_RESISTANCE); -} - -// EEPROM restore -void EEPROMRestoreInputParams(int offset) -{ - inputType = EEPROM.read(offset); - EEPROM_readAnything(offset+2,THERMISTORNOMINAL); - EEPROM_readAnything(offset+6,BCOEFFICIENT); - EEPROM_readAnything(offset+10,TEMPERATURENOMINAL); - EEPROM_readAnything(offset+14,REFERENCE_RESISTANCE); -} - -void InitializeInputCard() -{ -} - -void InputSerialReceiveStart() -{ -} - -void InputSerialReceiveDuring(byte val, byte index) -{ - if(index==1) b1 = val; - else if(index<18) serialXfer.asBytes[index-2] = val; -} - -void InputSerialReceiveAfter(int eepromOffset) -{ - inputType = b1; - THERMISTORNOMINAL = serialXfer.asFloat[0]; - BCOEFFICIENT = serialXfer.asFloat[1]; - TEMPERATURENOMINAL = serialXfer.asFloat[2]; - REFERENCE_RESISTANCE = serialXfer.asFloat[3]; - EEPROMBackupInputParams(eepromOffset); -} - -void InputSerialSend() -{ - Serial.print((int)inputType); - Serial.print(" "); - Serial.print(THERMISTORNOMINAL); - Serial.print(" "); - Serial.print(BCOEFFICIENT); - Serial.print(" "); - Serial.print(TEMPERATURENOMINAL); - Serial.print(" "); - Serial.println(REFERENCE_RESISTANCE); -} - -void InputSerialID() -{ - Serial.print(" IID1"); -} - -double readThermistorTemp(int voltage) -{ - float R = REFERENCE_RESISTANCE / (1024.0/(float)voltage - 1); - float steinhart; - steinhart = R / THERMISTORNOMINAL; // (R/Ro) - steinhart = log(steinhart); // ln(R/Ro) - steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro) - steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To) - steinhart = 1.0 / steinhart; // Invert - steinhart -= 273.15; // convert to C - - return steinhart; -} - -double ReadInputFromCard() -{ - if(inputType == 0) return thermocouple.readCelsius(); - else if(inputType == 1) - { - int adcReading = analogRead(thermistorPin); - if ((adcReading == 0) || (adcReading == 1023)) - { - return NAN; - } - else - { - return readThermistorTemp(adcReading); - } - } -} -#endif /*TEMP_INPUT_V110*/ - -#ifdef TEMP_INPUT_V120 -#include "MAX31855_local.h" -const byte thermistorPin = A6; -const byte thermocoupleCS = 10; -const byte thermocoupleSO = 12; -const byte thermocoupleCLK = 13; -byte inputType = 0; -double THERMISTORNOMINAL = 10; -double BCOEFFICIENT = 1; -double TEMPERATURENOMINAL = 293.15; -double REFERENCE_RESISTANCE = 10; -MAX31855 thermocouple(thermocoupleSO, thermocoupleCS, thermocoupleCLK); - -// EEPROM backup -void EEPROMBackupInputParams(int offset) -{ - EEPROM.write(offset, inputType); - EEPROM_writeAnything(offset+2,THERMISTORNOMINAL); - EEPROM_writeAnything(offset+6,BCOEFFICIENT); - EEPROM_writeAnything(offset+10,TEMPERATURENOMINAL); - EEPROM_writeAnything(offset+14,REFERENCE_RESISTANCE); -} - -// EEPROM restore -void EEPROMRestoreInputParams(int offset) -{ - inputType = EEPROM.read(offset); - EEPROM_readAnything(offset+2,THERMISTORNOMINAL); - EEPROM_readAnything(offset+6,BCOEFFICIENT); - EEPROM_readAnything(offset+10,TEMPERATURENOMINAL); - EEPROM_readAnything(offset+14,REFERENCE_RESISTANCE); -} - -void InitializeInputCard() -{ -} - -void InputSerialReceiveStart() -{ -} - -void InputSerialReceiveDuring(byte val, byte index) -{ - if(index==1) b1 = val; - else if(index<18) serialXfer.asBytes[index-2] = val; -} - -void InputSerialReceiveAfter(int eepromOffset) -{ - inputType = b1; - THERMISTORNOMINAL = serialXfer.asFloat[0]; - BCOEFFICIENT = serialXfer.asFloat[1]; - TEMPERATURENOMINAL = serialXfer.asFloat[2]; - REFERENCE_RESISTANCE = serialXfer.asFloat[3]; - EEPROMBackupInputParams(eepromOffset); -} - -void InputSerialSend() -{ - Serial.print((int)inputType); - Serial.print(" "); - Serial.print(THERMISTORNOMINAL); - Serial.print(" "); - Serial.print(BCOEFFICIENT); - Serial.print(" "); - Serial.print(TEMPERATURENOMINAL); - Serial.print(" "); - Serial.println(REFERENCE_RESISTANCE); -} - -void InputSerialID() -{ - Serial.print(" IID2"); -} - -double readThermistorTemp(int voltage) -{ - float R = REFERENCE_RESISTANCE / (1024.0/(float)voltage - 1); - float steinhart; - steinhart = R / THERMISTORNOMINAL; // (R/Ro) - steinhart = log(steinhart); // ln(R/Ro) - steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro) - steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To) - steinhart = 1.0 / steinhart; // Invert - steinhart -= 273.15; // convert to C - - return steinhart; -} - -double ReadInputFromCard() -{ - if(inputType == 0) - { - double val = thermocouple.readThermocouple(CELSIUS); - if (val==FAULT_OPEN|| val==FAULT_SHORT_GND|| val==FAULT_SHORT_VCC)val = NAN; - return val; - } - else if(inputType == 1) - { - int adcReading = analogRead(thermistorPin); - // If either thermistor or reference resistor is not connected - if ((adcReading == 0) || (adcReading == 1023)) - { - return NAN; - } - else - { - return readThermistorTemp(adcReading); - } - } -} -#endif /*TEMP_INPUT_V120*/ - -#ifdef PROTOTYPE_INPUT - /*Include any libraries and/or global variables here*/ - -float flt1_i=0, flt2_i=0, flt3_i=0, flt4_i=0; -byte bt1_i=0, bt2_i=0, bt3_i=0, bt4_i=0; - -void EEPROMBackupInputParams(int offset) -{ - EEPROM_writeAnything(offset, bt1_i); - EEPROM_writeAnything(offset+1, bt2_i); - EEPROM_writeAnything(offset+2, bt3_i); - EEPROM_writeAnything(offset+3, bt4_i); - EEPROM_writeAnything(offset+4,flt1_i); - EEPROM_writeAnything(offset+8,flt2_i); - EEPROM_writeAnything(offset+12,flt3_i); - EEPROM_writeAnything(offset+16,flt4_i); -} - -void EEPROMRestoreInputParams(int offset) -{ - EEPROM_readAnything(offset, bt1_i); - EEPROM_readAnything(offset+1, bt2_i); - EEPROM_readAnything(offset+2, bt3_i); - EEPROM_readAnything(offset+3, bt4_i); - EEPROM_readAnything(offset+4,flt1_i); - EEPROM_readAnything(offset+8,flt2_i); - EEPROM_readAnything(offset+12,flt3_i); - EEPROM_readAnything(offset+16,flt4_i); -} - -void InitializeInputCard() -{ -} - -void InputSerialReceiveStart() -{ -} - -void InputSerialReceiveDuring(byte val, byte index) -{ - if(index==1) bt1_i = val; - else if(index==2) bt2_i = val; - else if(index==3) bt3_i = val; - else if(index==4) bt4_i = val; - else if(index<22) serialXfer.asBytes[index-5] = val; -} - -void InputSerialReceiveAfter(int eepromOffset) -{ - flt1_i = serialXfer.asFloat[0]; - flt2_i = serialXfer.asFloat[1]; - flt3_i = serialXfer.asFloat[2]; - flt4_i = serialXfer.asFloat[3]; - - EEPROMBackupInputParams(eepromOffset); -} - -void InputSerialSend() -{ - Serial.print(int(bt1_i)); - Serial.print(" "); - Serial.print(int(bt2_i)); - Serial.print(" "); - Serial.print(int(bt3_i)); - Serial.print(" "); - Serial.print(int(bt4_i)); - Serial.print(" "); - Serial.print(flt1_i); - Serial.print(" "); - Serial.print(flt2_i); - Serial.print(" "); - Serial.print(flt3_i); - Serial.print(" "); - Serial.println(flt4_i); -} - -void InputSerialID() -{ - Serial.print(" IID0"); -} - -double ReadInputFromCard() -{ - /*your code here*/ - return 0; -} -#endif /*PROTOTYPE_INPUT*/ - -#if defined(DIGITAL_OUTPUT_V120) || defined(DIGITAL_OUTPUT_V150) -byte outputType = 1; -const byte RelayPin = 5; -const byte SSRPin = 6; -//unsigned long windowStartTime; -double outWindowSec = 5.0; -unsigned long WindowSize = 5000; - -void setOutputWindow(double val) -{ - unsigned long temp = (unsigned long)(val*1000); - if(temp<500)temp = 500; - outWindowSec = (double)temp/1000; - if(temp!=WindowSize) - { - WindowSize = temp; - } -} - -void EEPROMBackupOutputParams(int offset) -{ - EEPROM.write(offset, outputType); - EEPROM_writeAnything(offset+1, WindowSize); -} -void EEPROMRestoreOutputParams(int offset) -{ - outputType = EEPROM.read(offset); - EEPROM_readAnything(offset+1, WindowSize); -} - -void InitializeOutputCard() -{ - pinMode(RelayPin, OUTPUT); - pinMode(SSRPin, OUTPUT); -} - -void OutputSerialReceiveStart() -{ -} - -void OutputSerialReceiveDuring(byte val, byte index) -{ - if(index==1) b1 = val; - else if(index<6) serialXfer.asBytes[index-2] = val; -} - -void OutputSerialReceiveAfter(int eepromOffset) -{ - if(outputType != b1) - { - if (b1==0)digitalWrite(SSRPin, LOW); - else if(b1==1) digitalWrite( RelayPin,LOW); //turn off the other pin - outputType=b1; - } - outWindowSec = serialXfer.asFloat[0]; - setOutputWindow(outWindowSec); - EEPROMBackupOutputParams(eepromOffset); -} - -void OutputSerialID() -{ - Serial.print(" OID1"); -} - -void WriteToOutputCard(double value) -{ - unsigned long wind = millis() % WindowSize; // (millis() - windowStartTime); - /*if(wind>WindowSize) - { - wind -= WindowSize; - windowStartTime += WindowSize; - }*/ - unsigned long oVal = (unsigned long)(value*(double)WindowSize/ 100.0); - if(outputType == 0) digitalWrite(RelayPin ,(oVal>wind) ? HIGH : LOW); - else if(outputType == 1) digitalWrite(SSRPin ,(oVal>wind) ? HIGH : LOW); -} - -// Serial send & receive -void OutputSerialSend() -{ - Serial.print((int)outputType); - Serial.print(" "); - Serial.println(outWindowSec); -} -#endif /*DIGITAL_OUTPUT_V120 & DIGITAL_OUTPUT_V150*/ - -#ifdef PROTOTYPE_OUTPUT -float flt1_o=0, flt2_o=0, flt3_o=0, flt4_o=0; -byte bt1_o=0, bt2_o=0, bt3_o=0, bt4_o=0; - -void EEPROMBackupOutputParams(int offset) -{ - EEPROM_writeAnything(offset, bt1_o); - EEPROM_writeAnything(offset+1, bt2_o); - EEPROM_writeAnything(offset+2, bt3_o); - EEPROM_writeAnything(offset+3, bt4_o); - EEPROM_writeAnything(offset+4,flt1_o); - EEPROM_writeAnything(offset+8,flt2_o); - EEPROM_writeAnything(offset+12,flt3_o); - EEPROM_writeAnything(offset+16,flt4_o); -} - -void EEPROMRestoreOutputParams(int offset) -{ - EEPROM_readAnything(offset, bt1_o); - EEPROM_readAnything(offset+1, bt2_o); - EEPROM_readAnything(offset+2, bt3_o); - EEPROM_readAnything(offset+3, bt4_o); - EEPROM_readAnything(offset+4,flt1_o); - EEPROM_readAnything(offset+8,flt2_o); - EEPROM_readAnything(offset+12,flt3_o); - EEPROM_readAnything(offset+16,flt4_o); -} - -void InitializeOutputCard() -{ -} - -void OutputSerialReceiveStart() -{ -} - -void OutputSerialReceiveDuring(byte val, byte index) -{ - if(index==1) bt1_o = val; - else if(index==2) bt2_o = val; - else if(index==3) bt3_o = val; - else if(index==4) bt4_o = val; - else if(index<22) serialXfer.asBytes[index-5] = val; -} - -void OutputSerialReceiveAfter(int eepromOffset) -{ - flt1_o = serialXfer.asFloat[0]; - flt2_o = serialXfer.asFloat[1]; - flt3_o = serialXfer.asFloat[2]; - flt4_o = serialXfer.asFloat[3]; - - EEPROMBackupOutputParams(eepromOffset); -} - -void OutputSerialID() -{ - Serial.print(" OID0"); -} - -void WriteToOutputCard(double value) -{ -} - -// Serial send & receive -void OutputSerialSend() -{ - Serial.print(int(bt1_o)); - Serial.print(" "); - Serial.print(int(bt2_o)); - Serial.print(" "); - Serial.print(int(bt3_o)); - Serial.print(" "); - Serial.print(int(bt4_o)); - Serial.print(" "); - Serial.print(flt1_o); - Serial.print(" "); - Serial.print(flt2_o); - Serial.print(" "); - Serial.print(flt3_o); - Serial.print(" "); - Serial.println(flt4_o); -} -#endif /*PROTOTYPE_OUTPUT*/ diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/max6675.cpp b/projects/pid-controller/reference-impl/osPID-Firmware/max6675.cpp deleted file mode 100644 index 248a8eb4f..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/max6675.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// this library is public domain. enjoy! -// www.ladyada.net/learn/sensors/thermocouple - -#include -#include -#include -#include "max6675_local.h" - -MAX6675::MAX6675(int8_t SCLK, int8_t CS, int8_t MISO) -{ - sclk = SCLK; - cs = CS; - miso = MISO; - - //define pin modes - pinMode(cs, OUTPUT); - pinMode(sclk, OUTPUT); - pinMode(miso, INPUT); - - digitalWrite(cs, HIGH); -} -double MAX6675::readCelsius(void) -{ - - uint16_t v; - - digitalWrite(cs, LOW); - _delay_ms(1); - - v = spiread(); - v <<= 8; - v |= spiread(); - - digitalWrite(cs, HIGH); - - if (v & 0x4) - { - // uh oh, no thermocouple attached! - return NAN; - //return -100; - } - - v >>= 3; - - return v * 0.25; -} - -double MAX6675::readFarenheit(void) -{ - return readCelsius() * 9.0 / 5.0 + 32; -} - -byte MAX6675::spiread(void) -{ - int i; - byte d = 0; - - for (i = 7; i >= 0; i--) - { - digitalWrite(sclk, LOW); - _delay_ms(1); - if (digitalRead(miso)) - { - //set the bit to 0 no matter what - d |= (1 << i); - } - - digitalWrite(sclk, HIGH); - _delay_ms(1); - } - - return d; -} diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/max6675_local.h b/projects/pid-controller/reference-impl/osPID-Firmware/max6675_local.h deleted file mode 100644 index da1a45c0c..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/max6675_local.h +++ /dev/null @@ -1,21 +0,0 @@ -// this library is public domain. enjoy! -// www.ladyada.net/learn/sensors/thermocouple - -#if ARDUINO >= 100 -#include "Arduino.h" -#else -#include "WProgram.h" -#endif - -class MAX6675 -{ -public: - MAX6675(int8_t SCLK, int8_t CS, int8_t MISO); - - double readCelsius(void); - double readFarenheit(void); - -private: - int8_t sclk, miso, cs; - uint8_t spiread(void); -}; diff --git a/projects/pid-controller/reference-impl/osPID-Firmware/osPID_Firmware.ino b/projects/pid-controller/reference-impl/osPID-Firmware/osPID_Firmware.ino deleted file mode 100644 index b90d6bb19..000000000 --- a/projects/pid-controller/reference-impl/osPID-Firmware/osPID_Firmware.ino +++ /dev/null @@ -1,1327 +0,0 @@ -//#define USE_SIMULATION - -#include -#include -#include "AnalogButton_local.h" -#include "PID_v1_local.h" -#include "EEPROMAnything.h" -#include "PID_AutoTune_v0_local.h" -#include "io.h" - -// ***** PIN ASSIGNMENTS ***** - -const byte buzzerPin = 3; -const byte systemLEDPin = A2; - -const byte EEPROM_ID = 2; //used to automatically trigger and eeprom reset after firmware update (if necessary) - -const byte TYPE_NAV=0; -const byte TYPE_VAL=1; -const byte TYPE_OPT=2; - -byte mMain[] = { - 0,1,2,3}; -byte mDash[] = { - 4,5,6,7}; -byte mConfig[] = { - 8,9,10,11}; -byte *mMenu[] = { - mMain, mDash, mConfig}; - -byte curMenu=0, mIndex=0, mDrawIndex=0; -LiquidCrystal lcd(A1, A0, 4, 7, 8, 9); -AnalogButton button(A3, 0, 253, 454, 657); - -unsigned long now, lcdTime, buttonTime,ioTime, serialTime; -boolean sendInfo=true, sendDash=true, sendTune=true, sendInputConfig=true, sendOutputConfig=true; - -bool editing=false; -bool inputOk = true; -bool tuning = false; - -double setpoint=250,input=250,output=50, pidInput=250; - -double kp = 2, ki = 0.5, kd = 2; -byte ctrlDirection = 0; -byte modeIndex = 0; -byte highlightedIndex=0; - -PID myPID(&pidInput, &output, &setpoint,kp,ki,kd, DIRECT); - -double aTuneStep = 20, aTuneNoise = 1; -unsigned int aTuneLookBack = 10; -byte ATuneModeRemember = 0; -PID_ATune aTune(&pidInput, &output); - - -byte curProfStep=0; -byte curType=0; -float curVal=0; -float helperVal=0; -unsigned long helperTime=0; -boolean helperflag=false; -unsigned long curTime=0; - - -/*Profile declarations*/ -const unsigned long profReceiveTimeout = 10000; -unsigned long profReceiveStart=0; -boolean receivingProfile=false; -const int nProfSteps = 15; -char profname[] = { - 'N','o',' ','P','r','o','f'}; -byte proftypes[nProfSteps]; -unsigned long proftimes[nProfSteps]; -float profvals[nProfSteps]; -boolean runningProfile = false; - - -//for devlopment and demo purposes, it's useful to have a -//simulation that can run on the osPID. the problem is -//that is uses memory. rather than have it hogging resources -//when not in use, it's activated using a compile flag. -// this way, it doesn't get compiled during normal circumstances - -#ifdef USE_SIMULATION -double kpmodel = 5, taup = 50, theta[30]; -const double outputStart = 50; -const double inputStart=250; - -void DoModel() -{ - // Cycle the dead time - for(byte i=0;i<30;i++) - { - theta[i] = theta[i+1]; - } - // Compute the input - input = (kpmodel / taup) *(theta[0]-outputStart) + (input-inputStart)*(1-1/taup)+inputStart + ((float)random(-10,10))/100; -} -#else - -#endif /*USE_SIMULATION*/ - - - -void setup() -{ - Serial.begin(9600); - lcdTime=10; - buttonTime=1; - ioTime=5; - serialTime=6; - //windowStartTime=2; - lcd.begin(8, 2); - - lcd.setCursor(0,0); - lcd.print(F(" osPID ")); - lcd.setCursor(0,1); - lcd.print(F(" v1.70 ")); - delay(1000); - - initializeEEPROM(); - - - -#ifdef USE_SIMULATION - input = inputStart; - for(int i=0;i<30;i++)theta[i] = outputStart; -#else - InitializeInputCard(); - InitializeOutputCard(); -#endif - myPID.SetSampleTime(1000); - myPID.SetOutputLimits(0, 100); - myPID.SetTunings(kp, ki, kd); - myPID.SetControllerDirection(ctrlDirection); - myPID.SetMode(modeIndex); -} - -byte editDepth=0; -void loop() -{ - now = millis(); - - if(now >= buttonTime) - { - switch(button.get()) - { - case BUTTON_NONE: - break; - - case BUTTON_RETURN: - back(); - break; - - case BUTTON_UP: - updown(true); - break; - - case BUTTON_DOWN: - updown(false); - break; - - case BUTTON_OK: - ok(); - break; - } - buttonTime += 50; - } - - bool doIO = now >= ioTime; - //read in the input - if(doIO) - { - ioTime+=250; -#ifdef USE_SIMULATION - DoModel(); - pidInput = input; -#else - input = ReadInputFromCard(); - inputOk = !isnan(input); - if(inputOk)pidInput = input; - -#endif /*USE_SIMULATION*/ - } - - - if(tuning) - { - byte val = (aTune.Runtime()); - - if(val != 0) - { - tuning = false; - } - - if(!tuning) - { - // We're done, set the tuning parameters - kp = aTune.GetKp(); - ki = aTune.GetKi(); - kd = aTune.GetKd(); - myPID.SetTunings(kp, ki, kd); - AutoTuneHelper(false); - EEPROMBackupTunings(); - } - } - else - { - if(runningProfile) ProfileRunTime(); - //allow the pid to compute if necessary - if(inputOk) myPID.Compute(); - } - - - - - - if(doIO) - { - //send the output -#ifdef USE_SIMULATION - theta[29] = output; -#else - if(!inputOk) output = 0; // Ensure output is zero when input is invalid - // Send to output card - WriteToOutputCard(output); -#endif /*USE_SIMULATION*/ - - - - } - - if(now>lcdTime) - { - drawLCD(); - lcdTime+=250; - } - if(millis() > serialTime) - { - //if(receivingProfile && (now-profReceiveStart)>profReceiveTimeout) receivingProfile = false; - SerialReceive(); - SerialSend(); - serialTime += 500; - } -} - - -void drawLCD() -{ - boolean highlightFirst= (mDrawIndex==mIndex); - drawItem(0,highlightFirst, mMenu[curMenu][mDrawIndex]); - drawItem(1,!highlightFirst, mMenu[curMenu][mDrawIndex+1]); - if(editing) lcd.setCursor(editDepth, highlightFirst?0:1); -} - -void drawItem(byte row, boolean highlight, byte index) -{ - char buffer[7]; - lcd.setCursor(0,row); - double val=0; - int dec=0; - int num=0; - char icon=' '; - boolean isNeg = false; - boolean didneg = false; - byte decSpot = 0; - boolean edit = editing && highlightedIndex==index; - boolean canEdit=!tuning; - switch(getMenuType(index)) - { - case TYPE_NAV: - lcd.print(highlight? '>':' '); - switch(index) - { - case 0: - lcd.print(F("DashBrd")); - break; - case 1: - lcd.print(F("Config ")); - break; - case 2: - lcd.print(tuning ? F("Cancel ") : F("ATune ")); - break; - case 3: - if(runningProfile)lcd.print(F("Cancel ")); - else lcd.print(profname); - break; - default: - return; - } - - break; - case TYPE_VAL: - - switch(index) - { - case 4: - val = setpoint; - dec=1; - icon='S'; - break; - case 5: - val = input; - dec=1; - icon='I'; - canEdit=false; - break; - case 6: - val = output; - dec=1; - icon='O'; - canEdit = (modeIndex==0); - break; - case 8: - val = kp; - dec=2; - icon='P'; - break; - case 9: - val = ki; - dec=2; - icon='I'; - break ; - case 10: - val = kd; - dec=2; - icon='D'; - break ; - - default: - return; - } - lcd.print(edit? '[' : (highlight ? (canEdit ? '>':'|') : - ' ')); - - if(isnan(val)) - { //display an error - lcd.print(icon); - lcd.print( now % 2000<1000 ? F(" Error"):F(" ")); - return; - } - - for(int i=0;i=1;i--) - { - if(i==decSpot)buffer[i] = '.'; - else { - if(num==0) - { - if(i>=decSpot-1) buffer[i]='0'; - else if (isNeg && !didneg) - { - buffer[i]='-'; - didneg=true; - } - else buffer[i]=' '; - } - else { - buffer[i] = num%10+48; - num/=10; - } - } - } - lcd.print(buffer); - break; - case TYPE_OPT: - - lcd.print(edit ? '[': (highlight? '>':' ')); - switch(index) - { - case 7: - lcd.print(modeIndex==0 ? F("M Man "):F("M Auto ")); - break; - case 11://12: - - lcd.print(ctrlDirection==0 ? F("A Direc"):F("A Rever")); - break; - } - - break; - default: - return; - } - - //indication of altered state - if(highlight && (tuning || runningProfile)) - { - //should we blip? - if(tuning) - { - if(now % 1500 <500) - { - lcd.setCursor(0,row); - lcd.print('T'); - } - } - else //running profile - { - if(now % 2000 < 500) - { - lcd.setCursor(0,row); - lcd.print('P'); - } - else if(now%2000 < 1000) - { - lcd.setCursor(0,row); - char c; - if(curProfStep<10) c = curProfStep + 48; //0-9 - else c = curProfStep + 65; //A,B... - lcd.print(c); - } - } - } -} - -byte getValDec(byte index) -{ - switch(index) - { - case 4: - case 5: - case 6: - //case 11: - return 1; - case 8: - case 9: - case 10: - default: - return 2; - } -} -byte getMenuType(byte index) -{ - switch(index) - { - case 0: - case 1: - case 2: - case 3: - return TYPE_NAV; - case 4: - case 5: - case 6: - case 8: - case 9: - case 10: - //case 11: - return TYPE_VAL; - case 7: - case 11: //12: - return TYPE_OPT; - default: - return 255; - } -} - -boolean changeflag=false; - -void back() -{ - if(editing) - { //decrease the depth and stop editing if required - - editDepth--; - if(getMenuType(highlightedIndex)==TYPE_VAL) - { - if(editDepth==7-getValDec(highlightedIndex))editDepth--; //skip the decimal - } - if(editDepth<3) - { - editDepth=0; - editing= false; - lcd.noCursor(); - } - } - else - { //if not editing return to previous menu. currently this is always main - - - //depending on which menu we're coming back from, we may need to write to the eeprom - if(changeflag) - { - if(curMenu==1) - { - EEPROMBackupDash(); - } - else if(curMenu==2) //tunings may have changed - { - EEPROMBackupTunings(); - myPID.SetTunings(kp,ki,kd); - myPID.SetControllerDirection(ctrlDirection); - } - changeflag=false; - } - if(curMenu!=0) - { - highlightedIndex = curMenu-1; //make sure the arrow is on the menu they were in - mIndex=curMenu-1; - curMenu=0; - mDrawIndex=0; - - } - } -} - - - -double getValMin(byte index) -{ - switch(index) - { - case 4: - case 5: - case 6: -// case 11: - return -999.9; - case 8: - case 9: - case 10: - default: - return 0; - } -} - - -double getValMax(byte index) -{ - switch(index) - { - case 4: - case 5: - case 6: - //case 11: - return 999.9; - case 8: - case 9: - case 10: - default: - return 99.99; - } - -} - -void updown(bool up) -{ - - if(editing) - { - changeflag = true; - byte decdepth; - double adder; - switch(getMenuType(highlightedIndex)) - { - case TYPE_VAL: - decdepth = 7 - getValDec(highlightedIndex); - adder=1; - if(editDepthdecdepth)for(int i=decdepth;imaximum)(*val)=maximum; - else if((*val)0) - { - mIndex--; - mDrawIndex=mIndex; - } - } - else - { - byte limit = 3;// (curMenu==2 ? 4 : 3); - if(mIndexhelperTime) - { - setpoint = curVal; - gotonext=true; - } - else - { - setpoint = (curVal-helperVal)*(1-(float)(helperTime-now)/(float)(curTime))+helperVal; - } - } - else if (curType==2) //wait - { - float err = input-setpoint; - if(helperflag) //we're just looking for a cross - { - - if(err==0 || (err>0 && helperVal<0) || (err<0 && helperVal>0)) gotonext=true; - else helperVal = err; - } - else //value needs to be within the band for the perscribed time - { - if (abs(err)>curVal) helperTime=now; //reset the clock - else if( (now-helperTime)>=curTime) gotonext=true; //we held for long enough - } - - } - else if(curType==3) //step - { - - if((now-helperTime)>curTime)gotonext=true; - } - else if(curType==127) //buzz - { - if(now=nProfSteps) - { - curType=0; - helperTime =0; - } - else - { - curType = proftypes[curProfStep]; - curVal = profvals[curProfStep]; - curTime = proftimes[curProfStep]; - - } - if(curType==1) //ramp - { - helperTime = curTime + now; //at what time the ramp will end - helperVal = setpoint; - } - else if(curType==2) //wait - { - helperflag = (curVal==0); - if(helperflag) helperVal= input-setpoint; - else helperTime=now; - } - else if(curType==3) //step - { - setpoint = curVal; - helperTime = now; - } - else if(curType==127) //buzzer - { - helperTime = now + curTime; - } - else - { - curType=0; - } - - - - if(curType==0) //end - { //we're done - runningProfile=false; - curProfStep=0; - Serial.println("P_DN"); - digitalWrite(buzzerPin,LOW); - } - else - { - Serial.print("P_STP "); - Serial.print(int(curProfStep)); - Serial.print(" "); - Serial.print(int(curType)); - Serial.print(" "); - Serial.print((curVal)); - Serial.print(" "); - Serial.println((curTime)); - } - -} - - - - - -const int eepromTuningOffset = 1; //13 bytes -const int eepromDashOffset = 14; //9 bytes -const int eepromATuneOffset = 23; //12 bytes -const int eepromProfileOffset = 35; //136 bytes -const int eepromInputOffset = 172; //? bytes (depends on the card) -const int eepromOutputOffset = 300; //? bytes (depends on the card) - - -void initializeEEPROM() -{ - //read in eeprom values - byte firstTime = EEPROM.read(0); - if(firstTime!=EEPROM_ID) - {//the only time this won't be 1 is the first time the program is run after a reset or firmware update - //clear the EEPROM and initialize with default values - for(int i=1;i<1024;i++) EEPROM.write(i,0); - EEPROMBackupTunings(); - EEPROMBackupDash(); - EEPROMBackupATune(); - EEPROMBackupInputParams(eepromInputOffset); - EEPROMBackupOutputParams(eepromOutputOffset); - EEPROMBackupProfile(); - EEPROM.write(0,EEPROM_ID); //so that first time will never be true again (future firmware updates notwithstanding) - } - else - { - EEPROMRestoreTunings(); - EEPROMRestoreDash(); - EEPROMRestoreATune(); - EEPROMRestoreInputParams(eepromInputOffset); - EEPROMRestoreOutputParams(eepromOutputOffset); - EEPROMRestoreProfile(); - } -} - - - -void EEPROMreset() -{ - EEPROM.write(0,0); -} - - -void EEPROMBackupTunings() -{ - EEPROM.write(eepromTuningOffset,ctrlDirection); - EEPROM_writeAnything(eepromTuningOffset+1,kp); - EEPROM_writeAnything(eepromTuningOffset+5,ki); - EEPROM_writeAnything(eepromTuningOffset+9,kd); -} - -void EEPROMRestoreTunings() -{ - ctrlDirection = EEPROM.read(eepromTuningOffset); - EEPROM_readAnything(eepromTuningOffset+1,kp); - EEPROM_readAnything(eepromTuningOffset+5,ki); - EEPROM_readAnything(eepromTuningOffset+9,kd); -} - -void EEPROMBackupDash() -{ - EEPROM.write(eepromDashOffset, (byte)myPID.GetMode()); - EEPROM_writeAnything(eepromDashOffset+1,setpoint); - EEPROM_writeAnything(eepromDashOffset+5,output); -} - -void EEPROMRestoreDash() -{ - modeIndex = EEPROM.read(eepromDashOffset); - EEPROM_readAnything(eepromDashOffset+1,setpoint); - EEPROM_readAnything(eepromDashOffset+5,output); -} - -void EEPROMBackupATune() -{ - EEPROM_writeAnything(eepromATuneOffset,aTuneStep); - EEPROM_writeAnything(eepromATuneOffset+4,aTuneNoise); - EEPROM_writeAnything(eepromATuneOffset+8,aTuneLookBack); -} - -void EEPROMRestoreATune() -{ - EEPROM_readAnything(eepromATuneOffset,aTuneStep); - EEPROM_readAnything(eepromATuneOffset+4,aTuneNoise); - EEPROM_readAnything(eepromATuneOffset+8,aTuneLookBack); -} - -void EEPROMBackupProfile() -{ - EEPROM_writeAnything(eepromProfileOffset, profname); - EEPROM_writeAnything(eepromProfileOffset + 8, proftypes); - EEPROM_writeAnything(eepromProfileOffset + 24, profvals); - EEPROM_writeAnything(eepromProfileOffset + 85, proftimes); //there might be a slight issue here (/1000?) -} - -void EEPROMRestoreProfile() -{ - EEPROM_readAnything(eepromProfileOffset, profname); - EEPROM_readAnything(eepromProfileOffset + 8, proftypes); - EEPROM_readAnything(eepromProfileOffset + 24, profvals); - EEPROM_readAnything(eepromProfileOffset + 85, proftimes); //there might be a slight issue here (/1000?) -} - -/******************************************** - * Serial Communication functions / helpers - ********************************************/ - -boolean ackDash = false, ackTune = false; -union { // This Data structure lets - byte asBytes[32]; // us take the byte array - float asFloat[8]; // sent from processing and -} // easily convert it to a -foo; // float array - -// getting float values from processing into the arduino -// was no small task. the way this program does it is -// as follows: -// * a float takes up 4 bytes. in processing, convert -// the array of floats we want to send, into an array -// of bytes. -// * send the bytes to the arduino -// * use a data structure known as a union to convert -// the array of bytes back into an array of floats -void SerialReceive() -{ - - // read the bytes sent from Processing - byte index=0; - byte identifier=0; - byte b1=255,b2=255; - boolean boolhelp=false; - - while(Serial.available()) - { - byte val = Serial.read(); - if(index==0){ - identifier = val; - Serial.println(int(val)); - } - else - { - switch(identifier) - { - case 0: //information request - if(index==1) b1=val; //which info type - else if(index==2)boolhelp = (val==1); //on or off - break; - case 1: //dasboard - case 2: //tunings - case 3: //autotune - if(index==1) b1 = val; - else if(index<14)foo.asBytes[index-2] = val; - break; - case 4: //EEPROM reset - if(index==1) b1 = val; - break; - case 5: //input configuration - if (index==1)InputSerialReceiveStart(); - InputSerialReceiveDuring(val, index); - break; - case 6: //output configuration - if (index==1)OutputSerialReceiveStart(); - OutputSerialReceiveDuring(val, index); - break; - case 7: //receiving profile - if(index==1) b1=val; - else if(b1>=nProfSteps) profname[index-2] = char(val); - else if(index==2) proftypes[b1] = val; - else foo.asBytes[index-3] = val; - - break; - case 8: //profile command - if(index==1) b2=val; - break; - default: - break; - } - } - index++; - } - - //we've received the information, time to act - switch(identifier) - { - case 0: //information request - switch(b1) - { - case 0: - sendInfo = true; - sendInputConfig=true; - sendOutputConfig=true; - break; - case 1: - sendDash = boolhelp; - break; - case 2: - sendTune = boolhelp; - break; - case 3: - sendInputConfig = boolhelp; - break; - case 4: - sendOutputConfig = boolhelp; - break; - default: - break; - } - break; - case 1: //dashboard - if(index==14 && b1<2) - { - setpoint=double(foo.asFloat[0]); - //Input=double(foo.asFloat[1]); // * the user has the ability to send the - // value of "Input" in most cases (as - // in this one) this is not needed. - if(b1==0) // * only change the output if we are in - { // manual mode. otherwise we'll get an - output=double(foo.asFloat[2]); // output blip, then the controller will - } // overwrite. - - if(b1==0) myPID.SetMode(MANUAL);// * set the controller mode - else myPID.SetMode(AUTOMATIC); // - EEPROMBackupDash(); - ackDash=true; - } - break; - case 2: //Tune - if(index==14 && (b1<=1)) - { - // * read in and set the controller tunings - kp = double(foo.asFloat[0]); // - ki = double(foo.asFloat[1]); // - kd = double(foo.asFloat[2]); // - ctrlDirection = b1; - myPID.SetTunings(kp, ki, kd); // - if(b1==0) myPID.SetControllerDirection(DIRECT);// * set the controller Direction - else myPID.SetControllerDirection(REVERSE); // - EEPROMBackupTunings(); - ackTune = true; - } - break; - case 3: //ATune - if(index==14 && (b1<=1)) - { - - aTuneStep = foo.asFloat[0]; - aTuneNoise = foo.asFloat[1]; - aTuneLookBack = (unsigned int)foo.asFloat[2]; - if((!tuning && b1==1)||(tuning && b1==0)) - { //toggle autotune state - changeAutoTune(); - } - EEPROMBackupATune(); - ackTune = true; - } - break; - case 4: //EEPROM reset - if(index==2 && b1<2) EEPROM.write(0,0); //eeprom will re-write on next restart - break; - case 5: //input configuration - InputSerialReceiveAfter(eepromInputOffset); - sendInputConfig=true; - break; - case 6: //ouput configuration - OutputSerialReceiveAfter(eepromOutputOffset); - sendOutputConfig=true; - break; - case 7: //receiving profile - - if((index==11 || (b1>=nProfSteps && index==9) )) - { - if(!receivingProfile && b1!=0) - { //there was a timeout issue. reset this transfer - receivingProfile=false; - Serial.println("ProfError"); - EEPROMRestoreProfile(); - } - else if(receivingProfile || b1==0) - { - if(runningProfile) - { //stop the current profile execution - StopProfile(); - } - - if(b1==0) - { - receivingProfile = true; - profReceiveStart = millis(); - } - - if(b1>=nProfSteps) - { //getting the name is the last step - receivingProfile=false; //last profile step - Serial.print("ProfDone "); - Serial.println(profname); - EEPROMBackupProfile(); - Serial.println("Archived"); - } - else - { - profvals[b1] = foo.asFloat[0]; - proftimes[b1] = (unsigned long)(foo.asFloat[1] * 1000); - Serial.print("ProfAck "); - Serial.print(b1); - Serial.print(" "); - Serial.print(proftypes[b1]); - Serial.print(" "); - Serial.print(profvals[b1]); - Serial.print(" "); - Serial.println(proftimes[b1]); - } - } - } - break; - case 8: - if(index==2 && b2<2) - { - if(b2==1) StartProfile(); - else StopProfile(); - - } - break; - default: - break; - } -} - - -// unlike our tiny microprocessor, the processing ap -// has no problem converting strings into floats, so -// we can just send strings. much easier than getting -// floats from processing to here no? -void SerialSend() -{ - if(sendInfo) - {//just send out the stock identifier - Serial.print("\nosPID v1.70"); - InputSerialID(); - OutputSerialID(); - Serial.println(""); - sendInfo = false; //only need to send this info once per request - } - if(sendDash) - { - Serial.print("DASH "); - Serial.print(setpoint); - Serial.print(" "); - if(isnan(input)) Serial.print("Error"); - else Serial.print(input); - Serial.print(" "); - Serial.print(output); - Serial.print(" "); - Serial.print(myPID.GetMode()); - Serial.print(" "); - Serial.println(ackDash?1:0); - if(ackDash)ackDash=false; - } - if(sendTune) - { - Serial.print("TUNE "); - Serial.print(myPID.GetKp()); - Serial.print(" "); - Serial.print(myPID.GetKi()); - Serial.print(" "); - Serial.print(myPID.GetKd()); - Serial.print(" "); - Serial.print(myPID.GetDirection()); - Serial.print(" "); - Serial.print(tuning?1:0); - Serial.print(" "); - Serial.print(aTuneStep); - Serial.print(" "); - Serial.print(aTuneNoise); - Serial.print(" "); - Serial.print(aTuneLookBack); - Serial.print(" "); - Serial.println(ackTune?1:0); - if(ackTune)ackTune=false; - } - if(sendInputConfig) - { - Serial.print("IPT "); - InputSerialSend(); - sendInputConfig=false; - } - if(sendOutputConfig) - { - Serial.print("OPT "); - OutputSerialSend(); - sendOutputConfig=false; - } - if(runningProfile) - { - Serial.print("PROF "); - Serial.print(int(curProfStep)); - Serial.print(" "); - Serial.print(int(curType)); - Serial.print(" "); -switch(curType) -{ - case 1: //ramp - Serial.println((helperTime-now)); //time remaining - - break; - case 2: //wait - Serial.print(abs(input-setpoint)); - Serial.print(" "); - Serial.println(curVal==0? -1 : float(now-helperTime)); - break; - case 3: //step - Serial.println(curTime-(now-helperTime)); - break; - default: - break; - -} - - } - -} - - - - - - - - - diff --git a/projects/pid-controller/research/TriangleTest.md b/projects/pid-controller/research/TriangleTest.md deleted file mode 100644 index 6ffb78f34..000000000 --- a/projects/pid-controller/research/TriangleTest.md +++ /dev/null @@ -1,69 +0,0 @@ -# Basic tests - -We test the behaviour, times and temperature of 3 cartridge heaters on a sheetpress. - -[In short, Video - Youtube](https://www.youtube.com/watch?v=2opgJ1I2T_Y&feature=youtu.be) - -![](./assets/setup-triangle-test.jpg) - -## Setup - -- [3 Cartridge heaters](https://nl.aliexpress.com/item/32867272365.html?spm=a2g0o.productlist.0.0.564f5a002eSsCx&algo_pvid=452428f3-a649-40ee-916b-66b5fecae41a&algo_expid=452428f3-a649-40ee-916b-66b5fecae41a-3&btsid=df7c8627-0269-4d8c-90bc-8c5d3f12df73&ws_ab_test=searchweb0_0,searchweb201602_5,searchweb201603_55) at 220V -- Room temperature : 33 degc -- Stronger air circulation in the workshop -- PID : Inkbird - 100VH -- Cartridge heater : 12mm OD / 8cm L -- Extra probe to PID probe difference around 15 degc (at 220degc) -- Addtional probe to measure frame and wool temperatures -- Press Plate : [EN AW 5083 [AlMg4,5Mn0,7]](https://gleich.de/us/products/g-al-c250/), 10mm -- Insulation wol: [RockWool - ProRox WM960](https://rti.rockwool.com/en-in/products/industrial/prorox-wm-960/?selectedCat=industrial%20-%20india) - ---- - -### Results - -- PID Probe to extra probe difference : 10-25% -- Autotuning duration for 50 degC : 18 mins -- Temperature loss from heated to unheated cell (33cm) : ~30 - 50% - -### Speeds - -**Times to raise temperature, 220degc** - -- at 130C, it took 17 secs to increase by one degc | Outer temperture (wool) : room temp -- at 140C, it took 28 secs to increase by one degc | Outer temperture : room temp -- at 155C, it took 38 secs to increase by one degc | Outer temperture : room temp | Frame-temperature : 50degc -- at 160C, it took 41 secs to increase by one degc | Outer temperture : room temp | Frame-temperature : 52degc -- at 170C, it took 52 secs to increase by one degc | Outer temperture : room temp | Frame-temperature : 53degc -- at 180C, it took 58 secs to increase by one degc | Outer temperture : room temp | Frame-temperature : 53degc -- at 190C, it took 1:54 mins to increase by one degc | Outer temperture : room temp | Frame-temperature : 53degc -- at 200C, it took 1:55 mins to increase by one degc | Outer temperture : 34 degc | Frame-temperature : 68degc -- at 210C, it took 3:02 mins to increase by one degc | Outer temperture : 35 degc | Frame-temperature : 82degc -- at 220C, it took 12:05 mins to increase by one degc | Outer temperture : 36 degc | Frame-temperature : 84degc - -- after 220C, it takes **12:05 - 18 mins** to increase by one degc | Outer temperture : 36 degc | Frame-temperature : 84degc - -**Total : Time to heat from 33 degC to 210degc: 2:15 h::mm** - -**Total : Time to heat from 33 degC to 220degc: 3:28 h::mm** - ---- - -**Times to increase temperature (turn off heating)** - -- at 214degc (at the PID probe), it took 0:17 secs to cool down by 1 degc ! -- at 205degc (at the extra probe - on the heater block), it took 0:21 secs to cool down by 1 degc ! - ---- - -## Conclusions - -- research: we need better probes and some better logging -- build: PID probe should penetrate the heat plate -- build: Heat plate should be thicker -- build: Cartridge heater blocks should be bigger -- times: After, 200 degc (at 33 degc room temp), the system has a really hard time to increase temperature at all, especially strong wind/air circulation at the perimeter affects this times significantly -- performance: it's unlikely to go beyond 220/230 degc, especially in colder environments -- see [more](../network) remarks from the network -- serial partition heating: with a window of 18 secs to cool down one degc (heater off), we might have still a chance with better heat containment as recommended in the build remarks - diff --git a/projects/pid-controller/research/assets/setup-triangle-test.jpg b/projects/pid-controller/research/assets/setup-triangle-test.jpg deleted file mode 100644 index 613307656..000000000 --- a/projects/pid-controller/research/assets/setup-triangle-test.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c38e27c0f03cbd0c73dd37b8ed2b2216739752a622127d49284f937ec4373a9c -size 11712 diff --git a/projects/pid-controller/vendor/controllino/CONTROLLINO MINI pure – CONTROLLINO.html b/projects/pid-controller/vendor/controllino/CONTROLLINO MINI pure – CONTROLLINO.html deleted file mode 100644 index 4ad6037e0..000000000 --- a/projects/pid-controller/vendor/controllino/CONTROLLINO MINI pure – CONTROLLINO.html +++ /dev/null @@ -1,2148 +0,0 @@ - - - - - CONTROLLINO MINI pure – CONTROLLINO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

CONTROLLINO MINI pure

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-

The MINI is the smallest child in our CONTROLLINO family. But no worries – it’s still a big boy when it comes to the number of inputs and outputs (8 each). The incredible size to I/O ratio makes the MINI one of the most compact and versatile PLCs on the market.

-

On stock

-
-
-
-
-
-

119.00 excl VAT

-
-
-
-
-
-SKU 100.000.10 -Category: -Tag: -
-
-
-
-
-
-

952 in stock

-
-
- - -
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - -
-

Downloads

- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/projects/pid-controller/vendor/controllino/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf b/projects/pid-controller/vendor/controllino/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf deleted file mode 100644 index 68fa3aa8b..000000000 --- a/projects/pid-controller/vendor/controllino/CONTROLLINO-Instruction-Manual-V1.5-2018-12-14.pdf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:967cba98c096e1efd6e5ff8f101efc7781d00a172482fa6c50f3a7e2191b8713 -size 1648022 diff --git a/projects/pid-controller/vendor/controllino/CONTROLLINO-MEGA-Pinout-1.jpg b/projects/pid-controller/vendor/controllino/CONTROLLINO-MEGA-Pinout-1.jpg deleted file mode 100644 index 703f7ed81..000000000 --- a/projects/pid-controller/vendor/controllino/CONTROLLINO-MEGA-Pinout-1.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b0b9243fb8d06773ecd76daa919f559128d58765a6948f912d448692470c98a0 -size 4826575 diff --git a/projects/pid-controller/vendor/controllino/FMUSE0FIC37CA7W/FMUSE0FIC37CA7W.ino b/projects/pid-controller/vendor/controllino/FMUSE0FIC37CA7W/FMUSE0FIC37CA7W.ino deleted file mode 100644 index a5f217ac5..000000000 --- a/projects/pid-controller/vendor/controllino/FMUSE0FIC37CA7W/FMUSE0FIC37CA7W.ino +++ /dev/null @@ -1,142 +0,0 @@ -/*This document should end up as a short introduction to one particular method of sidestepping Accelstepper's somewhat low step-rate limit using default stepper.run() protocol. It is not the only and certainly not the best method. But it works.*/ -//Extra note about the purpose: This lets you use the nice accelstepper acceleration algorithm for the initial acceleration and then a much cruder linear ramp thereafter. -#include - -/* Accelstepper SetMotorIdentifier(TYPE, STEP, DIRECTION) We are using type 1 because it's a classic stepper Driver. -Different types might ask for things other than step&direction [see Accelsteppr documentation]*/ - -const int stepPin=23; -const int directionPin=14; -AccelStepper stepper(1,stepPin,directionPin); - -long actuatorDistance = 158400; //This varies depending on your purpose. I wanted to go 158,400 steps. That equated to 99 rotations of my 1.8 deg stepper motor with 1/8th microstepping. -int actuatorSpeed=3900; //This corresponded to 487.5 steps/second, or 2.47 revs/second, which for me corresponding to about 40 seconds for my actuator. - -unsigned long actuatorTimeout =19000; //This might not be used in the tutorial, but it's good to have a timeout threshold if you think your actuator might stall out and you want some backup timeout. - -int actuatorAcceleration=8500; //This acceleration value was chosen by experimentation, and only corresponds to the initial actuatorSpeed trigger point - after that your linear acceleration takes over. - -const byte programOverhead=26; //measured in mS. During the fast-stepping function you may want to check a few sensors (in my case, for an end-stop). The thing is you want your initial linear step-delay to be pretty close to whatever step rate the accelstepper actuatorSpeed was. For this to work, you need to know roughly how much time your control loop takes excluding the step delay. If your sketch is similar to mine in what it's checking, you can start with my numbers. - -const byte minPulseWidth=3; //different drivers require different mininum step pulses to register a line change...The basic reprap drivers are 1-2mS, this is sort of an unnecessary variable I used for extra fluff, you can probably do without it. - -//FINAL STEP RATE VALUE -byte stepDelayTarget=90-minPulseWidth-programOverhead; //Uhoh! This should never add up to <0. Check manually. -//This number, here shown as 90, relates to your target final step max speed. 90 is in uS, so I went up to 1000,000/90 = 11,111.1.. steps/second. That's an improvement over the default max of 3900 steps/seconds and as rate limited in my application by the physical system. I don't know how high you can expect an arduino to go. - - -const int systemEndstop=24; - -const int enablePin=53; //This is another extra variable I kept in the example code. You can ignore it, but it refers to a pin that is controlling the enable pin of my DRV8825 driver. Because it's 53 you can see I wrote this probably for an arduino mega. - -//Global variables as part of the program functions. -unsigned long timeStart; -//We want to be able to reset Timestart in different parts of the program. It's a global variable redeclared by a number of functions. Be aware. Another 'extra variable' I kept in the example code. - -void setup(){ //Void setup runs once during initial boot of microprocessor, but not after. - - stepper.setPinsInverted(false,false,true); // setPinsInverted(bool Dir,bool Step,bool Enable) Bool enable is == true because my enable pin is OFF when HIGH and ON when LOW. This is opposite of the default, so we enable the invert function. I believe the default is set for an A4988 driver, and this use case is for the Pololu DRV8825 breakout. - - - //these should be familiar if you've used the accelstepper program before. - stepper.setMaxSpeed(actuatorSpeed); - stepper.setAcceleration(actuatorAcceleration); - stepper.setEnablePin(enablePin); - stepper.setMinPulseWidth(3); //Remember the minPulseWidth variable from before? This is the accelstepper version. - -// declare pinmodes - pinMode(systemEndstop,INPUT); - digitalWrite(systemEndstop,HIGH); //This sets internal 20k pull-up resistor. It is usually necessary for a hall sensor to have a pull-up resistor, and in this case I was using a hall-sensor endstop. -} - -void fastSteppingFunction(){ - - //Ok! StepDelay needs to be set so that it creates a stepping speed approximately equal to the stepping speed that accelstepper leaves off at. Much different, and you will have caused an instantaneous acceleration that the stepper motor will fail to keep up with. - - byte stepDelay=((1000000/actuatorSpeed)-minPulseWidth-programOverhead); - //In my original code, I actually hard coded the stepDelay start at 250 instead of (100000/actuatorSpeed). The math for my values would put 1,000,000/actuatorSpeed at 256 steps/second, and for some reason I chose 250. But this math step allows for you to change your actuatorSpeed without needing to change the value here. - - byte counter = 0; //counter is used as a way to make a very quick conditional statement that overflows every 256 digits. There are other ways to implement the linear ramp. This is the way I chose. I thought it would be fast although it's no longer clear to me why I chose exactly this method. - - while(digitalRead(systemEndstop)==HIGH){ //remember this is our ending condition. In my code we are not relying on our steps to be counted until our endstop. You can do this too, by setting your condition to be be when a bigger counter reaches a certain number. Then you need to implement a counter that increments during each step. - - digitalWrite(stepPin,HIGH); - delayMicroseconds(minPulseWidth); - digitalWrite(stepPin,LOW); - delayMicroseconds(stepDelay); - - if (actuatorTimeout<(millis()-timeStart)){ - //Did you notice we said "timeStart=millis()" at the start of actuation? This is because I recommend your system has a timeout in case your motor stalls out and you never reach your endstop. - - //make an error function and call it here. - //make a function to get back up to speed, assuming you want to do that after you resolve the error. Optional not included. - //recursively return to the fastSteppingFunction(); - } - - //Next increment the counter, this will run each time you repeat the loop. At the point I'm writing this instructable, I suggest using a different method to make a linear ramp. This method is not very adjustable to changing the ramp, more in next comments. - - counter=counter+2; //always manipulate this counter so that you understand when your counter will reach the condition in the if statement below. In my case, it will reach the condition every 256/2 steps, i.e, every 128 steps, or, about every fifth of a revolution. If I chose a number like "3" instead of "2" I would have a problem because the counter would not reach 0 until a third overflow of the byte number, so I would be decreasing the slope of my linear ramp six times. Meanwhile I can also decrease the slope by half by changing the number to 1, or I can double the slope by saying 4. This lack of flexibility in changing the linear ramp slope is why I suggest considering other methods to make a linear ramp. Try to implement your method with minimum math. Ideally do not include multiplication in the loop, and especially not division. Division is not native on the arduino, and requires more software overhead. - - if (stepDelay>stepDelayTarget && counter==0){ - //So this condition is looking to see if you're reached your max speed target, and if you haven't yet and the counter has reached its trigger point [0], then it decreases the delay. - stepDelay--; //Stepdelay-- is a fast way of saying "stepdelay=stepdelay-1", i.e, your decreasing the step delay. By decreasing the step delay, you are increasing the frequency of steps/ the speed of your motor. - } - } -} - -void moveActuatorForward(){ - - //Hey! You're about to start moving a motor. In a lot of cases that means you should make some safety check. The following commented if statement is a filler for that. - /*if ([insert errorCondition]){ - //stepper.disableOutputs(); - //error(); - }*/ - - stepper.enableOutputs(); //This is redundant, in fact. It's already been called. - stepper.move(actuatorDistance); //You need to tell accelstepper how far you're going! - - timeStart = millis(); //I used a global variable in other parts of the code, maybe you want to use a local variable. - - //Hey we're finally starting!! - while(1){ //Title: "Basic Moving While Loop" - - if (digitalRead(systemEndstop)==LOW){ - //we finished before acceleration got past the library limit! This never happened for my application, but maybe does for yours. - break; //break removes you from the while loop called "Basic Moving While loop" - } - - stepper.run(); //this makes your initial acceleration completely abstract. - - if(stepper.speed()