├── .clang-format ├── .gitignore ├── .travis.yml ├── .vscode ├── extensions.json ├── settings.json └── tasks.json ├── LICENSE ├── PresenceModule.code-workspace ├── README.md ├── dependencies.txt ├── doc-depricated ├── Applikationbeschreibung-Praesenz.md ├── charts │ ├── RaumVerlassen-BewegungTotzeit.png │ ├── RaumVerlassen-BewegungTotzeitReset.png │ ├── RaumVerlassen-JedeBewegungTotzeit.png │ ├── RaumVerlassen-Totzeit.png │ ├── RaumVerlassen-TotzeitReset.png │ └── RaumVerlassen.xlsx ├── pics │ ├── AllgemeineParameter.png │ ├── AusgangPhase.png │ ├── EingangDefault.png │ ├── EingangLink.png │ ├── EingangLock.png │ ├── Helligkeit.png │ ├── HelligkeitKanal.png │ ├── HelligkeitPhase.png │ ├── InterneEingaenge.png │ ├── Kanaldefinition.png │ ├── LED.png │ ├── LeaveRoom.png │ ├── ManualOverride.png │ ├── ManuellPhase.png │ ├── Output.png │ ├── PM-Kanal.png │ ├── Phasenbeispiel.png │ ├── PraesenzHardware.png │ ├── PraesenzPhase.png │ ├── PraesenzRohdaten.png │ ├── PresenceKanal.png │ ├── Sperre.png │ ├── Szenario.png │ ├── Szenensteuerung.png │ ├── TagNachtObjekt.png │ ├── TagesphaseFunktion.png │ ├── TagesphasePage.png │ └── Tagesphasen.png └── technical │ ├── Kurzzeit-Timing.pptx │ ├── PM-Firmware-Konzept.md │ ├── PM-Logik.md │ └── Testplatine │ └── Schematic.pdf ├── include ├── README ├── hardware.h ├── knxprod copy.h ├── knxprod.h └── versions.h ├── lib ├── OFM-ConfigTransfer ├── OFM-FileTransferModule ├── OFM-LogicModule ├── OFM-Network ├── OFM-PresenceModule ├── OFM-SmartMF ├── OFM-UsbExchange ├── OFM-VirtualButton ├── OGM-Common ├── OGM-SensorDevices ├── README └── knx ├── library.json ├── platformio.bak.ini ├── platformio.custom.ini ├── platformio.ini ├── restore ├── Restore-Dependencies-Branch.ps1 └── Restore-Dependencies.ps1 ├── scripts ├── Build-IP.ps1 ├── Build-Release-Package.ps1 ├── Build-Release.ps1 ├── OpenKNX-Build-Settings.ps1 ├── OpenKNX-Build.ps1 ├── Readme-Hardware.html └── Readme-Hardware.md ├── src ├── PMmodul-Big.xml ├── PMmodul-IP.xml ├── PMmodul-Release.xml ├── PMmodul-VirtualButton.link.xml ├── PMmodul.conf.xml ├── PMmodul.xml └── main.cpp └── test └── README /.clang-format: -------------------------------------------------------------------------------- 1 | #Generated from Visual Studio settings 2 | --- 3 | BasedOnStyle: llvm 4 | BreakBeforeBraces: Custom 5 | BraceWrapping: 6 | AfterClass: true 7 | AfterControlStatement: true 8 | AfterCaseLabel: true 9 | AfterEnum: true 10 | AfterFunction: true 11 | AfterNamespace: true 12 | AfterStruct: true 13 | AfterUnion: true 14 | AfterExternBlock: true 15 | BeforeCatch: true 16 | BeforeElse: true 17 | BeforeWhile: true 18 | BeforeLambdaBody: false 19 | SplitEmptyFunction: true 20 | SplitEmptyRecord: true 21 | SplitEmptyNamespace: true 22 | IndentBraces: false 23 | ColumnLimit: 0 24 | IndentWidth: 4 25 | IndentPPDirectives: BeforeHash 26 | NamespaceIndentation: All 27 | TabWidth: 4 28 | DerivePointerAlignment: true 29 | IndentCaseLabels: true 30 | AllowShortCaseLabelsOnASingleLine: true 31 | AllowShortEnumsOnASingleLine: true 32 | AllowShortFunctionsOnASingleLine: All 33 | AllowShortIfStatementsOnASingleLine: OnlyFirstIf 34 | AllowShortLambdasOnASingleLine: All 35 | ConstructorInitializerIndentWidth: 4 36 | ContinuationIndentWidth: 4 37 | UseTab: Never 38 | ... -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | **/*.knxprod 7 | **/*.debug.xml 8 | release/* 9 | release-package/* 10 | doc/TP_Radar_Sensor/* 11 | **/*.baggages/* 12 | platformio.ini.full.txt 13 | release-collection/* 14 | 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < https://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < https://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < https://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choose one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # - platformio update 39 | # 40 | # script: 41 | # - platformio run 42 | 43 | 44 | # 45 | # Template #2: The project is intended to be used as a library with examples. 46 | # 47 | 48 | # language: python 49 | # python: 50 | # - "2.7" 51 | # 52 | # sudo: false 53 | # cache: 54 | # directories: 55 | # - "~/.platformio" 56 | # 57 | # env: 58 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 59 | # - PLATFORMIO_CI_SRC=examples/file.ino 60 | # - PLATFORMIO_CI_SRC=path/to/test/directory 61 | # 62 | # install: 63 | # - pip install -U platformio 64 | # - platformio update 65 | # 66 | # script: 67 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 68 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureOnOpen": false 3 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Pre-Build-Step", 8 | "type": "shell", 9 | "command": "lib/OGM-Common/scripts/Build/OpenKNX-Pre-Build.ps1", 10 | "args": [], 11 | "group": "build", 12 | "problemMatcher": [] 13 | }, 14 | { 15 | "label": "Develop SAMD", 16 | "type": "shell", 17 | "command": "scripts/OpenKNX-Build.ps1", 18 | "args": [ 19 | "develop_SAMD" 20 | ], 21 | "group": "build", 22 | "problemMatcher": [] 23 | }, 24 | { 25 | "label": "Develop RP2040", 26 | "type": "shell", 27 | "command": "scripts/OpenKNX-Build.ps1", 28 | "args": [ 29 | "develop_RP2040" 30 | ], 31 | "group": "build", 32 | "problemMatcher": [] 33 | }, 34 | { 35 | "label": "Upload JLINK SAMD", 36 | "type": "shell", 37 | "command": "scripts/OpenKNX-Build.ps1", 38 | "args": [ 39 | "upload_JLINK_SAMD", 40 | "upload" 41 | ], 42 | "group": "build", 43 | "problemMatcher": [] 44 | }, 45 | // { 46 | // "label": "Upload Release JLINK SAMD", 47 | // "type": "shell", 48 | // "command": "scripts/OpenKNX-Build.ps1", 49 | // "args": [ 50 | // "upload_Release_JLINK_SAMD", 51 | // "upload" 52 | // ], 53 | // "group": "build", 54 | // "problemMatcher": [] 55 | // }, 56 | { 57 | "label": "Upload JLINK RP2040", 58 | "type": "shell", 59 | "command": "scripts/OpenKNX-Build.ps1", 60 | "args": [ 61 | "upload_JLINK_RP2040", 62 | "upload" 63 | ], 64 | "group": "build", 65 | "problemMatcher": [] 66 | }, 67 | // { 68 | // "label": "Upload Release JLINK RP2040", 69 | // "type": "shell", 70 | // "command": "scripts/OpenKNX-Build.ps1", 71 | // "args": [ 72 | // "upload_Release_JLINK_RP2040", 73 | // "upload" 74 | // ], 75 | // "group": "build", 76 | // "problemMatcher": [] 77 | // }, 78 | { 79 | "label": "Upload USB SAMD", 80 | "type": "shell", 81 | "command": "scripts/OpenKNX-Build.ps1", 82 | "args": [ 83 | "upload_USB_SAMD", 84 | "upload" 85 | ], 86 | "group": "build", 87 | "problemMatcher": [] 88 | }, 89 | { 90 | "label": "Upload USB RP2040", 91 | "type": "shell", 92 | "command": "scripts/OpenKNX-Build.ps1", 93 | "args": [ 94 | "upload_USB_RP2040", 95 | "upload" 96 | ], 97 | "group": "build", 98 | "problemMatcher": [] 99 | }, 100 | { 101 | "label": "Create Dependencies", 102 | "type": "shell", 103 | "command": "lib/OGM-Common/scripts/setup/reusable/Build-Dependencies.ps1", 104 | "args": [], 105 | "problemMatcher": [], 106 | "group": "build" 107 | }, 108 | { 109 | "label": "OpenKNXproducer", 110 | "type": "shell", 111 | "command": "~/bin/OpenKNXproducer.exe", 112 | "args": [ 113 | "create", 114 | "--Debug", 115 | "--HeaderFileName", 116 | "include/knxprod.h", 117 | "src/PMmodul.xml" 118 | ], 119 | "problemMatcher": [], 120 | "group": "test" 121 | }, 122 | { 123 | "label": "Build-Release", 124 | "type": "shell", 125 | "command": "scripts/Build-Release.ps1", 126 | "args": [ 127 | "Release" 128 | ], 129 | "problemMatcher": [], 130 | "group": "test" 131 | }, 132 | { 133 | "label": "Build-Big", 134 | "type": "shell", 135 | "command": "scripts/Build-Release.ps1", 136 | "args": [ 137 | "Big" 138 | ], 139 | "problemMatcher": [], 140 | "group": "test" 141 | }, 142 | { 143 | "label": "Build-IP", 144 | "type": "shell", 145 | "command": "scripts/Build-IP.ps1", 146 | "args": [ 147 | "IP" 148 | ], 149 | "problemMatcher": [], 150 | "group": "test" 151 | }, 152 | { 153 | "label": "Build-Release-Package", 154 | "type": "shell", 155 | "command": "scripts/Build-Release-Package.ps1", 156 | "args": [], 157 | "problemMatcher": [], 158 | "group": "test" 159 | }, 160 | { 161 | "label": "Build-Beta", 162 | "type": "shell", 163 | "command": "scripts/Build-Release.ps1", 164 | "args": [], 165 | "problemMatcher": [], 166 | "group": "test" 167 | }, 168 | { 169 | "label": "Resolve platformio.ini", 170 | "type": "shell", 171 | "command": "~/.platformio/penv/Scripts/pio", 172 | "args": [ 173 | "project", 174 | "config", 175 | ">platformio.ini.full.txt" 176 | ], 177 | "problemMatcher": [], 178 | "group": "test" 179 | } 180 | ] 181 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /PresenceModule.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | { 7 | "path": "../OFM-PresenceModule" 8 | }, 9 | { 10 | "path": "../OFM-LogicModule" 11 | }, 12 | { 13 | "path": "../OFM-VirtualButton" 14 | }, 15 | { 16 | "path": "../OGM-SensorDevices" 17 | }, 18 | { 19 | "path": "../OGM-Common" 20 | }, 21 | { 22 | "path": "../OFM-FileTransferModule" 23 | }, 24 | { 25 | "path": "../OFM-SmartMF" 26 | }, 27 | { 28 | "path": "../knx" 29 | }, 30 | { 31 | "path": "../OFM-ConfigTransfer" 32 | }, 33 | { 34 | "path": "../OFM-Network" 35 | }, 36 | { 37 | "path": "../OFM-UsbExchange" 38 | } 39 | ], 40 | "settings": { 41 | "files.associations": { 42 | "*.json": "jsonc", 43 | "*.yaml": "home-assistant", 44 | "array": "cpp", 45 | "string": "cpp", 46 | "string_view": "cpp", 47 | "ranges": "cpp", 48 | "istream": "cpp", 49 | "ostream": "cpp", 50 | "deque": "cpp", 51 | "unordered_map": "cpp", 52 | "vector": "cpp", 53 | "initializer_list": "cpp" 54 | }, 55 | "cSpell.language": "en,de-DE", 56 | "powershell.cwd": "c:\\Users\\waldemar.porscha@sap.com\\PlatformIO\\OpenKNX\\OAM-PresenceModule", 57 | "workbench.colorCustomizations": { 58 | "activityBar.background": "#a68000", 59 | "activityBar.foreground": "#ffffff", 60 | "activityBar.activeBackground": "#f6df12", 61 | "statusBar.foreground": "#ffffff", 62 | "statusBar.background": "#a68000", 63 | "titleBar.activeBackground": "#a68000", 64 | "titleBar.activeForeground": "#ffffff" 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenKNX - PresenceModule 2 | === 3 | 4 | Implementation of a knx presence module with up to 50 presence channels based on the [knx stack](https://github.com/thelsing/knx) from thelsing and the [OpenKNX](https://github.com/OpenKNX) infrastructure. 5 | 6 | Application description (including a feature overview) can be found [here](https://github.com/OpenKNX/OAM-PresenceModule/blob/main/doc/Applikationbeschreibung-Praesenz.md). 7 | 8 | It contains also the [logic module](https://github.com/OpenKNX/OAM-LogicModule). 9 | 10 | It supports the SAMD and RP2040 version of the stack. 11 | 12 | It is a PlatformIO project and needs a working ETS 5.7 installed on the same PC. 13 | -------------------------------------------------------------------------------- /dependencies.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/dependencies.txt -------------------------------------------------------------------------------- /doc-depricated/charts/RaumVerlassen-BewegungTotzeit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/charts/RaumVerlassen-BewegungTotzeit.png -------------------------------------------------------------------------------- /doc-depricated/charts/RaumVerlassen-BewegungTotzeitReset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/charts/RaumVerlassen-BewegungTotzeitReset.png -------------------------------------------------------------------------------- /doc-depricated/charts/RaumVerlassen-JedeBewegungTotzeit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/charts/RaumVerlassen-JedeBewegungTotzeit.png -------------------------------------------------------------------------------- /doc-depricated/charts/RaumVerlassen-Totzeit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/charts/RaumVerlassen-Totzeit.png -------------------------------------------------------------------------------- /doc-depricated/charts/RaumVerlassen-TotzeitReset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/charts/RaumVerlassen-TotzeitReset.png -------------------------------------------------------------------------------- /doc-depricated/charts/RaumVerlassen.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/charts/RaumVerlassen.xlsx -------------------------------------------------------------------------------- /doc-depricated/pics/AllgemeineParameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/AllgemeineParameter.png -------------------------------------------------------------------------------- /doc-depricated/pics/AusgangPhase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/AusgangPhase.png -------------------------------------------------------------------------------- /doc-depricated/pics/EingangDefault.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/EingangDefault.png -------------------------------------------------------------------------------- /doc-depricated/pics/EingangLink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/EingangLink.png -------------------------------------------------------------------------------- /doc-depricated/pics/EingangLock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/EingangLock.png -------------------------------------------------------------------------------- /doc-depricated/pics/Helligkeit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Helligkeit.png -------------------------------------------------------------------------------- /doc-depricated/pics/HelligkeitKanal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/HelligkeitKanal.png -------------------------------------------------------------------------------- /doc-depricated/pics/HelligkeitPhase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/HelligkeitPhase.png -------------------------------------------------------------------------------- /doc-depricated/pics/InterneEingaenge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/InterneEingaenge.png -------------------------------------------------------------------------------- /doc-depricated/pics/Kanaldefinition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Kanaldefinition.png -------------------------------------------------------------------------------- /doc-depricated/pics/LED.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/LED.png -------------------------------------------------------------------------------- /doc-depricated/pics/LeaveRoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/LeaveRoom.png -------------------------------------------------------------------------------- /doc-depricated/pics/ManualOverride.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/ManualOverride.png -------------------------------------------------------------------------------- /doc-depricated/pics/ManuellPhase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/ManuellPhase.png -------------------------------------------------------------------------------- /doc-depricated/pics/Output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Output.png -------------------------------------------------------------------------------- /doc-depricated/pics/PM-Kanal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/PM-Kanal.png -------------------------------------------------------------------------------- /doc-depricated/pics/Phasenbeispiel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Phasenbeispiel.png -------------------------------------------------------------------------------- /doc-depricated/pics/PraesenzHardware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/PraesenzHardware.png -------------------------------------------------------------------------------- /doc-depricated/pics/PraesenzPhase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/PraesenzPhase.png -------------------------------------------------------------------------------- /doc-depricated/pics/PraesenzRohdaten.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/PraesenzRohdaten.png -------------------------------------------------------------------------------- /doc-depricated/pics/PresenceKanal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/PresenceKanal.png -------------------------------------------------------------------------------- /doc-depricated/pics/Sperre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Sperre.png -------------------------------------------------------------------------------- /doc-depricated/pics/Szenario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Szenario.png -------------------------------------------------------------------------------- /doc-depricated/pics/Szenensteuerung.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Szenensteuerung.png -------------------------------------------------------------------------------- /doc-depricated/pics/TagNachtObjekt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/TagNachtObjekt.png -------------------------------------------------------------------------------- /doc-depricated/pics/TagesphaseFunktion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/TagesphaseFunktion.png -------------------------------------------------------------------------------- /doc-depricated/pics/TagesphasePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/TagesphasePage.png -------------------------------------------------------------------------------- /doc-depricated/pics/Tagesphasen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/pics/Tagesphasen.png -------------------------------------------------------------------------------- /doc-depricated/technical/Kurzzeit-Timing.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/technical/Kurzzeit-Timing.pptx -------------------------------------------------------------------------------- /doc-depricated/technical/PM-Firmware-Konzept.md: -------------------------------------------------------------------------------- 1 | # PM Firmware Grobkonzept 2 | 3 | Dieses Dokument basiert auf den ersten Ideen, die entstanden sind, um eine PM-Applikation mit dem Logikmodul zu realisieren. 4 | 5 | Da aber jetzt eine eigene Firmware geschrieben wird, die auch mehr Möglichkeiten bietet, wird dieses Dokument zum Brainstorming genutzt. 6 | 7 | Initial werden alle Diskussionspunkte aus dem Dokument [PM-Logik.md](PM-Logik.md) übernommen, allerdings ohne Realisierungsüberlegungen mit dem Logikmodul. 8 | 9 | ## Hauptfunktion 10 | 11 | Es soll eine PM-Applikation entstehen, die Präsenz und Helligkeit von außen bekommt (von einem PM mit einer ungenügenden Applikation, wie z.B. dem TP von Steinel) und dann eine passende PM-Parametrierung erlaubt. Es werden 10-20 PM-Kanäle angestrebt. 12 | 13 | Damit diese Applikation auch mit einer PM-fähigen Hardware vom Masifi (mit PIR-, Helligkeitssensor und Signal-LEDs) genutzt werden kann, können die PM-Kanäle alternativ auch Helligkeit und Präsenz von lokalen Sensoren empfangen. 14 | 15 | Um eventuelle Signalverläufe der externen PM zu korrigieren oder die Ausgänge der PM-Kanäle an weitere Szenarien anzupassen, wird auch das Logikmodul mit so vielen Kanälen wie es möglich und sinnvoll ist eingebunden. 16 | 17 | ## Lokale Präsenzhardware 18 | 19 | Falls es lokale Präsenzhardware gibt (PIR, Helligkeitssensor, LEDs), wird diese so eingebunden, dass die vorhandenen Präsenzkanäle Präsenz oder Helligkeit statt vom Bus auch von der lokalen Hardware erhalten können. Eventuelle LEDs können zur Signalisierung von Präsenz oder weiteren Informationen verwendet werden. 20 | 21 | ## Helligkeit (pro Kanal) 22 | 23 | Helligkeit kann extern zyklisch gesendet werden und/oder bei Bedarf sogar über einen ReadRequest gelesen werden. 24 | 25 | Helligkeitsanpassung (Anhebung oder Absenkung des Lux-Wertes) passiert bereits beim Sender, nicht pro PM-Kanal. 26 | 27 | Helligkeitsschwellwerte zum Einschalten und ein Hysteresewert (um wie viel darf es heller werden) zum Ausschalten werden natürlich pro Kanal definiert. Alternativ kann der Schwellwert zum Einschalten über den Bus gesetzt werden. **Der zum Ausschalten auch?** 28 | 29 | ### Adaptive Helligkeitsschwelle 30 | 31 | Als Ausbaustufe kann man eine Adaptive Helligkeitsschwelle implementieren, um mit geringer Hysterese für Helligkeitsabschaltung arbeiten zu können. 32 | 33 | Dabei wird die Helligkeit nach dem Einschalten gemessen und 34 | von da an mit dem gemessenen Hysteresewert verglichen. Wird dieser überschritten, wird wieder ausgeschaltet. 35 | 36 | Um zu vermeiden, dass das Einschalten weiterer Lichtquellen im Raum den Hysteresewert überschreitet, wird es pro Kanal einen Trigger-Eingang geben, der mit dem Status einer jeden Lichtquelle verbunden wird (hörende GA). Jede 1 auf diesem Eingang führt zur Reevaluation der Lichtschwelle (gleiches Verfahren wie beim ersten Einschalten vom Licht). 37 | 38 | **B:** Könnte hier eventuell die Statusauswertung des Lichtstatus über ein OR Gatter bereits das Triggersignal liefern? 39 | 40 | **W:** Das OR haben wir "wegdiskutiert" und werden erstmal veruchen, es über Logik zu lösen. Erst wenn das zu kompliziert ist, wird es in den PM eingebaut. 41 | 42 | **B:** Nach einem Wechsel einer Lichtquelle muss die Abschaltung über Helligkeitsschwelle unterdrückt werden, bis eine stabile neue Schwelle vorliegt. 43 | 44 | **W:** Sehe ich auch so, aber es gibt noch einiges zu klären, deswegen die folgenden Unterkapitel... 45 | 46 | ### Adaptive Helligkeitsschwelle zum abschalten 47 | 48 | Grundidee ist super: Beim Einschalten einer Lichtquelle wird der PM Getriggert und rechnet eine neue Lichtschwelle aus. 49 | 50 | Bei mehreren Lichtkreisen muss man ein paar Sachen durchdenken. 51 | 52 | Gegeben sei ein Raum mit 3 Lichtkreisen und einem kleinen Fenster. Auch bei vollem Tageslicht wird es nicht heller als mit allen Lichtquellen. Wir haben die Größen: 53 | 54 | **L1** Helligkeit bei nur einer Lichtquelle 55 | **L2** Helligkeit bei zwei Lichtquellen 56 | **L3** Helligkeit bei drei Lichtquellen 57 | **R** Helligkeit im Raum (ist entweder L*n* oder T) 58 | **T** Helligkeit bei Tageslicht 59 | 60 | Ferner gibt es noch die Schwellwerte: 61 | 62 | **L1s** Schwelle bei nur einer Lichtquelle 63 | **L2s** Schwelle bei zwei Lichtquellen 64 | **L3s** Schwelle bei drei Lichtquellen 65 | **Ts** Schwelle bei Tageslicht 66 | **S** berechnete Ausschaltschwelle 67 | 68 | Wir wissen: 69 | 70 | **L1** < **L2** < **Max(T)** < **L3** 71 | 72 | Wir nehmen an: 73 | 74 | **L1** < **L1s** < **L2** < **L2s** < **L3** < **L3s** 75 | 76 | #### Fall 1: Abschalten erhöht Lichtschwelle 77 | 78 | Es sind 2 Lichtquellen an, Sonne scheint, im Raum ist es heller als **L2**, aber die Ausschaltschwelle ist noch nicht erreicht: 79 | 80 | **L2** < **R** = **T** < **S** = **L2s** 81 | 82 | Wenn jetzt eine Lichtquelle abgeschaltet wird, wird es nicht dunkler, aber **L2s** wird neu berechnet und wird größer: 83 | 84 | **S** = **Ts** > **L2s** 85 | 86 | Hypothese: Wenn beim Abschalten die neue Schwelle größer ist, wird die alte beibehalten. 87 | 88 | Weitere Fälle folgen... 89 | 90 | #### Szenenwechsel/Dimmen 91 | 92 | Was ist, wenn gleichzeitig mehrere Lichtkreise durchgedimmt werden (potentiell ohne Schalttrigger)? 93 | 94 | ## Präsenzinformation (pro Kanal) 95 | 96 | Die Präsenzkanäle werden ein externes Präsenzsignal erhalten. In erster Näherung kann man das wie ein klassisches Slave-Signal bei anderen Meldern betrachten. Hier sollen auch Alternativen betrachtet werden. 97 | 98 | Es gibt 2 Konzepte, um ein externes Präsenzsignal auszuwerten. Beide Konzepte haben ihre Vor- und Nachteile. 99 | 100 | ### Präsenz als Triggersignal 101 | 102 | Präsenz als Trigger ist der klassische Ansatz. Die Präsenzquelle sendet zyklisch eine Präsenzinformation als EIN-Telegramm. Dieses Signal sollte min. doppelt so oft eintreffen wie die Nachlaufzeit des PM-Kanals ist. 103 | 104 | Man wertet nur EIN-Telegramme aus und jedes EIN-Telegramm triggert erneut die Nachlaufzeit. 105 | 106 | Die Vorteile dieses Ansatzes: 107 | 108 | * relativ einfach zu realisieren 109 | * man kann an einen Slave-Eingang beliebig viele Slaves anschließen 110 | * Bei Telegrammverlusten/Ausfall des Slave wird sicher abgeschaltet (nach dem Ablauf der Nachlaufzeit) 111 | 112 | Demgegenüber steht als Nachteil: 113 | 114 | * Der Quell-PM muss ein zyklisches Senden unterstützen 115 | * Man hat "überflüssige" Telegramme auf dem Bus, die einfach nur den Status Quo (immer noch Präsenz) bestätigen 116 | * Änderungen der Nachlaufzeit beim PM-Kanal müssen immer auch bei allen Slaves (1/2 Zykluszeit) nachgezogen werden 117 | * Je kürzer die Nachlaufzeit, desto mehr Buslast erfährt man duch "überflüssige" Telegramme. 118 | 119 | ### Präsenz als Schaltsignal 120 | 121 | Man kann das Präsenzsignal auch schaltend betrachten: Ein EIN-Telegramm signalisiert Präsenz, die mit einem AUS-Telegramm beendet wird. Die Nachlaufzeit wird erst beim AUS-Telegramm gestartet und würde durch ein neues EIN-Telegramm abgebrochen werden. Ein erneutes AUS-Telegramm während der Nachlaufzeit würde die Nachlaufzeit nachtriggern. 122 | 123 | Vorteile: 124 | 125 | * Rein schaltende Quellen (z.B. Schalter, Stromüberwacher) könnten als Slave dienen. 126 | * Man vermeidet bzw. reduziert überflüssige Telegramme (kein zyklisches Senden notwendig) 127 | * Es sind sehr kurze Nachlaufzeiten möglich 128 | * Änderungen der Nachlaufzeiten beim Master haben keinen Einfluss auf die Slaves 129 | 130 | Nachteile: 131 | 132 | * Telgrammverlust (hier spezeill AUS-Telegramme) könnte ein Ausschalten verhindern. 133 | * Obiges könnte man durch ein Lesetelegramm vor dem Ausschalten verhindern, doch dann gibt es wieder "Überflüssige" Telegramme (aber weniger, weil nur "on demand"). 134 | 135 | ### Warum überhaupt Gedanken um schaltende Slaves? 136 | 137 | Weil es sich anbietet, beim TP die beiden Präsenz-Rohdaten-Ausgänge "Präsenz" und "Bewegung" zu nehmen, die sind aber von ihrem Verhalten her schaltend. 138 | Und einige Slaves, die man zum Triggern von Präsenz nutzen will, senden nicht zyklisch (Strommesskanäle). 139 | Ferner wäre die Option "Schalter als Slave" eine einfache Möglichkeit der PM-Überbrückung, ohne sich Sperren und Zwangsführung zu kümmern. 140 | Und ein triggernder Slave kann genau so über schaltende Logik implementiert werden, indem intern nach der triggernden 1 sofort eine 0 erzeugt wird. 141 | 142 | Aktuelle Tendenz: Implementierung von schaltenden Slaves, 2 Slave-Eingänge. So können einfach die Rohdaten-Ausgänge Präsenz und Bewegung vom TP genutzt werden. Weitere Eingänge können durch das Logikmodul relaisiert werden. 143 | 144 | In der Applikation wird man pro Eingang einstellen können, ob er schaltend oder triggernd ist. Ein triggernder Eingang wird einfach nach dem Empfang eines EIN-Telegramms intern sofort ein AUS erzeugen und eingehende AUS-Telegramme ignorieren. 145 | 146 | ## Sperre (pro Kanal) 147 | 148 | Das Setzen einer Sperre sollte den Präsenzeingang auf AUS setzen, die Nachlaufzeit sofort beenden und einen definierten Zustand (EIN oder AUS, in der Applikation wählbar) am Ausgang realisieren. 149 | **Diskussion Alternative:** Sperre hält den Schaltausgang konstant. Nach dem Aufheben der Sperre werden die Nachlauftimer neu gesetzt. 150 | Erst nach dem zurücknehmen der Sperre sollte der Kanal wieder seine Funktion aufnehmen. 151 | 152 | ## Slaveeingang 153 | 154 | Weitere Slaves werden durch das Logikmodul realisiert. 155 | 156 | Ein schaltender Slave wird durch ein OR, das jedes Telegramm durchlässt (also alle EIN- und AUS-Wiederholungen). 157 | 158 | Ein triggernder Slave bekommt einen Logikkanal mit einem Treppenlicht von 0.1 Sekunden, so dass immer eine EIN-AUS-Kombination ereugt wird. 159 | 160 | ## Statuseingang vom Aktor 161 | 162 | Ein Statuseingang vom Aktor dient der PM-Logik dazu, über externe Schaltvorgänge des Aktors informiert zu werden. Dies adressiert vor allem unbeabsichtigte, vor allem durch automatismen verursachte Schaltvorgänge. Nehmen wir mal an, ein "Alles aus" macht das Licht aus, auch wenn man noch am Lesen ist. Dann möchte die Person durch z.B. einfaches "Winken" wieder das Licht anmachen können. Das ist anders bei manueller Bedienung (siehe nächster Abschnitt). Umgekehrt sollte beim unbeabsichtigten Einschalten des Aktors ohne Präsenz das Licht irgendwann wieder ausgehen, sinnvollerweise nach Ablauf der Nachlaufzeit. 163 | 164 | Erste Idee: Wenn der Aktorstatus ungleich dem Schaltausgang des PM ist, dann wird der Präsenzeingang auf AUS gesezt, die Nachlaufzeit sofort beendet und der Modus auf Auto gesetzt. **Diskussion Alternative** Wenn der PM Ausgang AUS ist, aber der Statuseingang EIN, wird noch Präsenz und Nachlaufzeit abgewartet, bis der Ausgang AUS geschaltet wird. Vorteil: Eine Szene bzw. EIN Signal kann direkt vom Taster zum Aktor gesandt werden (Ausfallsicherheit), ohne das der PM das Licht sofort deaktiviert. 165 | 166 | Ist der Aktorstatus AUS, wird auch der PM-Kanal auf AUS gesetzt, ohne die Nachlaufzeit zu triggern. **Evtl. Totzeit einplanen?** Es wird auch kein AUS-Telegramm gesendet, da der Aktor schon AUS ist. 167 | Ist der Aktorstatus EIN, wird der PM-Kanal auf EIN gesetzt und die Nachlaufzeit getriggert, also das ganz normale EINschaltverhalten, allerdings wird kein EIN-Telegramm gesendet, da der Aktror schon EIN ist. 168 | 169 | ## Manuelle Bedienung 170 | 171 | Aus theoretischer Betrachtung lassen sich 4 Varianten einer manuellen Bedienung von PM-Zuständen (hier mal exemplarisch die Bedienung von Licht) ableiten: 172 | 173 | * Der Benutzer möchte das Licht einschalten und es soll auf keinen Fall ausgehen. Der PM (also die Automatik) sind deaktiviert. Beim Ausschalten wird entschieden, ob dann wieder per PM (also Automatisch) geschaltet wird. Das nennen wir **Manuell AN** 174 | 175 | * Der Benutzer möchte das Licht ausschalten und es soll auf keinen Fall angehen. Der PM (also die Automatik) sind deaktiviert. Beim Einschalten wird entschieden, ob dann wieder per PM (also Automatisch) geschaltet wird. Das nennen wir **Manuell AUS** 176 | 177 | * Der Benutzer möchte das Licht einschalten, es soll aber durchaus durch den PM ausgeschaltet werden können (klassischer Fall: Es ist einem zu dunkel, der PM hat aber seine Helligkeitsschwelle zum Einschalten noch nicht erreicht). Das nennen wir **Automatik EIN** 178 | 179 | * Der Benutzer möchte das Licht ausschalten, es soll aber durchaus durch den PM eingeschaltet werden können (klassischer Fall: Der PM hat das Licht eingeschaltet, man macht es aber aus, um einen schönen Abend bei Kerzenlicht zu verbringen). Hier ist es wichtig, dass das Licht so lange aus bleibt, wie Präsenz im Raum existiert. Das nennen wir **Automatik AUS** 180 | 181 | Wenn man sich die obigen 4 Fälle anschaut, sind das genau die Fälle der Zwangsführung: 182 | 183 | * 00 - **keine Priorität, aus** entspricht Standardverhalten+ausschalten oder bei uns **Automatik AUS** (da beim PM das Standardverhalten ja "Automatik EIN" sein sollte) 184 | 185 | * 01 - **keine Priorität, ein** entspricht Standardverhalten+einschalten oder bei uns **Automatik EIN** 186 | 187 | * 10 - **Priorität, aus** entspricht Sonderverhalten+ausschalten oder bei uns **Manuell AUS** (da Priorität beim PM ja das übersteuern der Automatik ist) 188 | 189 | * 11 - **Priorität, ein** entspricht Sonderverhalten+einschalten oder bei uns **Manuell EIN** 190 | 191 | **hier braucht es nochmal Brainstorming, wie man das mit der Sperre in Einklang bringt, s.u.** 192 | Ob man alle 4 Varianten über ein Zwangsführungsobjekt zugänglich macht oder über 2 einzelne Bitobjekte, ist sekundär. Interessant ist die Realisierung. Bei 2 einzelnen Bitobjekten würde die bereits besprochene Sperre das Prioritätsobjekt abbilden, es käme nur noch ein EIN/AUS-Objekt hinzu. 193 | 194 | Um es überschaubar zu gestalten, wird hier der Ansatz gewählt, dass es eine Sperre und ein manuelles EIN/AUS-Objekt (M) gibt. Ein Zwangsführungs-Eingang setzt nur die beiden Einzelobjekte intern. Das bedeutet, dass die beiden Einzelobjekte und die Zwangsführung gleichberechtigt sind. Das kann verwirrend sein. Klassischerweise hat die Zwangsführung Vorrang vor Sperre oder es kann nur eines von beiden in der Applikation ausgewählt werden. 195 | 196 | ## Kurzzeitpräsenz 197 | 198 | Der Melder sollte auch Kurzzeitpräsenz erkennen können. Der Gang zum Kühlschrank sollte das Licht anmachen, aber nach kurzer Zeit auch wieder ausmachen. Hierzu muss man angeben, welche Zeitspanne noch als kurze Präsenz gilt. Ferner muss man auch angeben, welche Nachlaufzeit bei Kurzzeitpräsenz gelten soll. 199 | 200 | ## Nachlaufzeit per KO ändern 201 | 202 | Man wird die Nachlaufzeit (der Langzeitpräsenz) auch per KO ändern können. Dies wirkt sich auf bereits laufende Nachlaufzeiten direkt aus. Wenn also eine Nachlaufzeit von 5 Minuten bereits 3 Minuten läuft und die Nachlaufzeit wird auf 2 Minuten geändert, wird die laufende Nachlaufzeit sofort beendet. Ebenso würde eine Änderung auf 10 Minuten dazu führen, dass die Nachlaufzeit noch weitere 7 Minuten andauert. 203 | 204 | ## Totzeit 205 | 206 | Totzeit dient dazu, ein erneutes Einschalten während der Abschaltphase zu verhindern, weil eine sich abkühlende Lichtquelle von manchen PM als Bewegung erkannt wird. 207 | 208 | Da die Totzeit eigentlich hardwarebezogen ist, muss man bei Problemen die Totzeit am Quell-PM einstellen. 209 | 210 | Muss der virtuelle PM von der Totzeit wissen? Arbeitshypthese: Nein. Wird sich aber bei der Erstellung der Firmware noch zeigen und muss dann potentiell hinzugefügt werden. 211 | **B:** Totzeit sollte auch im PM Modul vorgesehen wqerden, um bei manuellen Ausschaltvorgängen noch den Raum verlassen zu können, ohne erneut auszulösen 212 | **W:** Für diesen Usecase würde ich lieber noch ein paar Gedanken Richtung "Nachlaufzeit AUS kürzer als Nachlaufzeit EIN" spendieren. Ist meiner Meinung nach sparter, aber schwerer zu realisieren. 213 | 214 | ## Tagesphase (Tag-Nacht-Objekt) 215 | 216 | Anstatt mit einem Tag-Nacht-Objekt zu arbeiten gibt es ein Szenenobjekt, dass bis zu 5 Tagesphasen zulässt (Morgen-Mittag-Dämmerung-Abend-Nacht-Objekt). Falls es nur 2 Phasen sind, wird ein klassisches DPT1-KO angeboten. 217 | **Vorschlag** Implementation im ersten Step mit 1bit (Tag/Nacht) später Erweiterung auf bis zu 3bit. 218 | **W:** Wie besprochen machen wir gleich 4 Tagesphasen. Der Mehraufwand ist überschaubar und maist ist es aufwändiger, später von einem 2-Stufigen (bool) auf ein mehrstufiges Konzept zu wechseln (andersrum ist immer einfacher). 219 | 220 | ## Reset 221 | 222 | Für Präsenzmessung gibt es Situationen, in denen man feststellen will, ob gerade jetzt eine Präsenz im Raum gegeben ist (z.B. das Haus wird verlassen, ist noch jemand drin?). Mit PM und Nachlaufzeiten ist das schwer zu realisieren, denn man weiß erst nach der Nachlaufzeit (bei mehreren PM nach dem Maximum aller Nachlaufzeiten), ob Präsenz vorhanden ist oder nicht. 223 | 224 | Eine Alternative ist, einen PM zurückzusetzen und ihm ein Zeitfenster zu geben, in dem er eine Präsenz ermitteln kann (Wenn ab jetzt innerhalb der nächsten 15 Sekunden keine Präsenz festgestellt wird, dann ist wohl keiner da). Dazu muss man den PM samt seiner Nachlaufzeit zurücksetzen können. Dafür ist die Reset-Logik. Diese nutzt bei einer abstrakten PM-Applikation nichts, wenn man nicht auch den Quell-PM entsprechend zurücksetzen kann. Ob und wie das geht, hängt von dessen Hardware ab. Einige PM machen einen internen Reset durch setzen und zurücksetzen der Sperre kurz hintereinander. Das könnte man auch hier erwägen und das KO sparen. 225 | 226 | **Diskussion** weitere Alternative: Präsenzausgang des Lichtkanals, ohne oder mit sehr kurzen Nachlaufzeiten (ggf. Beobachtungsfenster, über mehrere Präsenzeingänge) 227 | **W:** Das bekommt man nicht hin, wenn der PM extern ist und man die PIR Rohdaten nicht bekommt. 228 | 229 | Der Reset würde auch immer in den Automatikmodus zurückkehren und könnte somit auch als externes Rücksetzen vom Manuellmodus genutzt werden (unabhängig von der Rückfallzeit). **Gibt es noch weitere Usecases für einen Reset?** 230 | 231 | ## KO (statisch) 232 | 233 | Die folgenden KO werden einmalig (global für die gesamte PM-Applikaiton, also für alle Kanäle) angeboten. Derzeit exponieren sie eine eventuell vorhandene PM-Hardware. 234 | 235 | KO | Name | DPT | Bedeutung 236 | :---:|:---|---:|:-- 237 | 20 | Helligkeit | 9.004 | Ausgang: Hellikeit bei lokaler Hardware 238 | 21 | Präsenz | 1.001 | Ausgang: Präsenz bei lokaler Hardware (schaltend?) 239 | 22 | LED rot | 1.001 | Eingang/Status: Rote LED über Bus schalten 240 | 23 | LED gelb | 1.001 | Eingang/Status: Gelbe LED über Bus schalten 241 | 242 | ## KO (pro Kanal) 243 | 244 | Derzeit würde ich die Kanalabhängigen KO bei 30 starten lassen. 245 | Bei 15 KO pro Kanal und 20 Kanälen würde man auf 300 KO kommen, also bis 329. 246 | 247 | Falls das Logikmodul bei 80 Kanälen bleibt, würden weitere 240 KO hinzukommen, 330-569. Das müsste man testen, wird potentiell knapp (bei angenommenen 500 KO Geasmtkapazität). 248 | 249 | Sonst hätte man 500 - 330 = 170 KO für Logik, was 57 Kanäle ermöglicht -> sollte auch reichen (ergibt 501 KO). 250 | 251 | In der folgenden Tabelle ist die KO-Nummer nur ein Offset zu einem Anfangs-KO *n*, das für den Kanal berechnet wird. 252 | 253 | KO | Name | DPT | Bedeutung 254 | :---:|:---|---:|:-- 255 | 0 | Helligkeit | 9.004 | Eingang: Helligkeit extern 256 | 1 | Präsenz A | 1.001 | Eingang: Präsenzinfo Quelle 1 257 | 2 | Präsenz B | 1.001 | Eingang: Präsenzinfo Quelle 2 258 | 3 | Automatik übersteuern | 1.001 | Eingang: Aktuellen Schaltwert im Automatikmodus setzen 259 | 4 | Manuell übersteuern | 1.001 | Eingang: Aktuellen Schaltwert im Manuellmodus setzen 260 | 5 | Aktorstatus | 1.001 | Eingang: Status des geschalteten Aktors 261 | 6 | Lichtschwellenberechnung | 1.001 | Eingang: EIN triggert Berechnung adaptiver Lichtschwelle 262 | 7 | Sperre | 1.001 | Eingang/Status: Sperre 263 | 7 | Zwangsführung | 2.001 | Eingang/Status: Zwangsführung 264 | 8 | Reset Nachlauf | 1.001 | Präsenz neu ermitteln 265 | 9 | Tagesphase | 5.010 / 17.001 | Eingang: Tagesphase (Zahl oder Szene?) 266 | 9 | Tag/Nacht | 1.001 | Eingang: Tag-/Nacht-Objekt (Alternative zu Tagesphase) 267 | 10 | Helligkeitsschwelle | 9.004 | Eingang: Helligkeitsschwelle 268 | 11 | Nachlaufzeit | 7.005 | Eingang: Nachlaufzeit 269 | 12 | Szenensteuerung | 17.001 | Eingang/Status: PM über Szene steuern 270 | 13 | Schaltausgang | 1.001 | Ausgang: Schaltend 271 | 13 | Dimmausgang | 5.001 | Ausgang: Dimmen 272 | 13 | Szenenausgang | 17.001 | Ausgang: Szene 273 | 14 | Schaltausgang 2 | 1.001 | Ausgang: 2. Schaltausgang 274 | 14 | Dimmausgang 2 | 5.001 | Ausgang: 2. Dimmen 275 | 14 | Szenenausgang 2 | 17.001 | Ausgang: 2. Szene 276 | 15 | Status Automatikbetrieb | 1.001 | Ausgabe des PM Status (manuell / Automatik) 277 | 16 | Manuell Relativ Dimmen | 3.007 | Eingang: Es wurde manuell am Taster gedimmt 278 | 17 | Manuell Absolut Dimmen | 5.001 | Eingang: Es wurde manuell über Absolutwert gedimmt 279 | 18 | Manuell Szene Dimmen | 17.001 | Eingang: Es wurde manuell über Szene gedimmt 280 | 19 | Frei für Erweriterung | | Belegt nur einen passendes KO 281 | 282 | ## Offene Punkte 283 | 284 | ### Steuerung des Quell-PM 285 | 286 | Werden wir eventuell KO (Ausgänge) brauchen, die den Quell-PM steuern, um bestimmte Funktionen zu ermöglichen (z.B. Reset der Quelle, um definiertes Verhalten zu bekommen)? **Erste Vermutung** Nein 287 | 288 | ### Abgrenzung Manuell und Sperre 289 | 290 | Manuell und Sperre sind sehr ähnlich. Die Abgrenzung der beiden muss noch diskutiert werden. 291 | 292 | Sperre hat höhere Prio, deswegen braucht man auch Sperre/Zwangsführung. 293 | 294 | ### Manuelle Bedienung über weitere Stellgrößen 295 | 296 | Bisher wurde die manuelle Bedienung nur unter dem Aspekt "Schalten" betrachtet. Allerdings werden gerade Lichtquellen auch noch mittels dimmen und Szenen gesteuert. Und dies kann natürlich auch zu einer Änderung des Schaltzustands führen (z.B. runterdimmen, bis die Lampe AUS ist, oder Szene, die auf 50% einschaltet). Wie soll ein PM auf solche Aktionen reagieren und wie soll er solche Aktionen überhaupt mitbekommen? 297 | 298 | Arbeitshypothese: Die korrekte Reaktion erfolgt über den Aktorstatuseingang. 299 | 300 | Wenn eine Lichtquelle über die Szene 50% eingeschaltet wird, dann sendet der Aktor auch seinen EIN-Status an den PM. Dieser verläßt einen möglichen Manuell-Modus, triggert die Nachlaufzeit, sendet aber kein EIN-Signal vom PM an den Aktor (siehe Aktorstatus). Ein EIN-Telegramm muss in einem solchen Falle unterdrückt werden, weil es Dimmer gibt, die bei einem EIN auf den Schalteingang wieder auf 100% gehen. 301 | 302 | Wenn eine Lichtquelle über relatives Dimmen auf 0% gedimmt wird, dann sendet der Aktor auch seinen AUS-Status an den PM. Dieser verläßt einen möglichen Manuell-Modus, triggert NICHT die Nachlaufzeit, sendet auch kein AUS-Signal vom PM an den Aktor (siehe Aktorstatus). 303 | 304 | Das Problem ist aber, dass man im letzteren Fall eine Nachlaufzeit wünschen würde. Andernfalls würde - bei einem manuellen runterdimmen auf 0% in dem Raum selbst - das Licht sofort wieder angehen, weil man ja noch im Raum ist (Das ist die "ich bin auf dem Klo, das Licht ist aus und ich winke kurz"-Situation). 305 | 306 | Kurz gesagt: Die Veränderung des Schaltstatus über einen manuellen Eingriff (Schalten, relatives Dimmen, absolutes Dimmen oder Szene) ist eher wie Taste kurz zu betrachten, aber ohne dass der PM erneut schaltet. 307 | 308 | Eine unvorhergesehene Schaltung sollte wie unter Aktorstatus beschrieben betrachtet werden. 309 | 310 | Einwand: Was ist mit mehreren Dimmkanälen? Multiple Lichtkreise sind ja schon an anderen Stellen adressiert, muss man hier auch durchdenken. 311 | 312 | ### Nachlaufzeit bei AUS kürzer als Nachlaufzeit bei EIN 313 | 314 | ### Sperren Bewegung - Usecase? 315 | 316 | Kein Usecase gefunden, lassen wir erstmal weg. 317 | 318 | ### Dunkelschalten - Usecase? 319 | 320 | Arbeitshypothese: Kann man auch über Helligkeitsschwelle auf max Lux setzen lösen. Geht über Logikmodul auch als DPT1-Signal. 321 | 322 | ### Halbautomat ist noch nicht adressiert 323 | 324 | ### Rückfall 325 | 326 | Zumindest bei Sperre und Zwangsführung, aber auch bei Manuell AUS/EIN sollte es einen Rückfall über Zeit und über Reset geben. Gleiche Zeit für beide oder einzeln? 327 | 328 | ### Doppelbetätigung von Tastern 329 | 330 | Es kann passieren, dass die Tastereingänge für Automatik EIN/AUS und Manuell EIN/AUS auch mehrmals das gleiche Telegramm empfangen: 331 | 332 | * man sendet ein EIN auf Taster kurz -> führt zu Automatik EIN 333 | * jetzt sendet man erneut ein EIN auf Taster kurz -> passiert jetzt was? Wird daraus jetzt Manuell EIN (Intention: Es ist schon an, man will also den Automatikmodus wechseln ohne Aus- und Einschalten zu müssen)? 334 | * An sich könnte man das ja auch direkt durch Manuell EIN-Signal erreichen. Obiger Ansatz würde aber Tasten sparen. 335 | 336 | Eigentlich hängt das nicht von Doppelbetätigung ab, sondern von einem erneuten EIN/AUS-Signal auf einen Zustand, in dem sich die Statemachine bereits befindet. 337 | -------------------------------------------------------------------------------- /doc-depricated/technical/PM-Logik.md: -------------------------------------------------------------------------------- 1 | # PM Logik mit Logikmodul 2 | 3 | ## Kommunikationsobjekte 4 | 5 | KO | Name | DPT | Bedeutung 6 | :---:|:---|---:|:-- 7 | 10 | Ausgang Schalten | 1.001 | Schaltausgang Lichtkanal 8 | 10 | Ausgang Dimmen absolut | 5.001 | Ausgang absoluter Dimmwert 9 | 10 | Ausgang Szene | 17.001 | Ausgang Szenennummer 10 | 11 | Ausgang Zusatzschalten | 1.001 | Zusatzausgang z.B. für Nachtlicht 11 | 12 | Eingang externer Taster kurz | 1.001 | Übersteuerung Automatikmodus 12 | 13 | Eingang externer Taster lang | 1.001 | Umschaltung manuell / Automatikmodus 13 | 14 | Eingang externe Bewegung| 1.001 | Externes Präsenzsignal (zyklisch) 14 | 15 | Eingang externe Helligkeit| 9.004 | Externes Helligkeitssignal (in lux) 15 | 16 | Eingang externe Helligkeitsschwelle| 9.004 | Vorgabe der Helligkeitsschwelle (in lux) 16 | 17 | Ausgang adaptive Helligkeitsschwelle| 9.004 | Ausgabe der adaptiven Helligkeitsschwelle (in lux) 17 | 18 | Eingang Dunkel schalten | 1.001 | Deaktivierung Helligkeitsschwelle 18 | 18 | Eingang externe Nachlaufzeit| 7.005 | Vorgabe externe Nachlaufzeit (10-65000s) 19 | 20 | Eingang Sperre Bewegungserkennung| 1.001 | Bewegungserkennung sperren 20 | 21 | Eingang Zwangsführung | 2.001 | 2bit Zwangsführung 21 | 22 | Eingang Sperrobjekt | 1.001 | PM Sperren 22 | 23 | Status Automatikbetrieb | 1.001 | Ausgabe des PM Status (manuell / Automatik) 23 | 24 | Eingang Szene | 17.001 | Szenensteuerung des PM 24 | 25 | Eingang Tag/Nacht | 1.001 | Tag/Nacht Umschaltung 25 | 26 | Ausgang Aktorkanal | 1.001 | Ausgang des ODER Gatters für den Aktorstatus 26 | 27 | Eingang 1 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 27 | 28 | Eingang 2 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 28 | 29 | Eingang 3 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 29 | 30 | Eingang 4 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 30 | 31 | Eingang 5 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 31 | 32 | Eingang 6 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 32 | 33 | Eingang 7 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 33 | 34 | Eingang 8 Lichtstatus| 1.001 | Eingang ODER Gatter für Ermittlung Lichtstatus 34 | 35 | 36 | 37 | ## Hauptfunktion 38 | 39 | Helligkeit kann von TP zyklisch gesendet werden und dann über einen Eingangskonverter in ein passendes "ist dunkel"-Signal konvertiert werden. Mit Hysterese vermeidet man ein Schwingen, mit Differenzhysterese könnte man sogar eine Helligkeitsschwelle über den Bus setzen. 40 | 41 | Helligkeit DPT9 über Hysterese (oder Differenzhysterese) -> Dunkel D 42 | 43 | Merker: Adaptive Helligkeitsschwelle, um mit geringer Hysterese für Helligkeitsabschaltung arbeiten zu können. 44 | Aktualisierung der adaptiven Schwelle wird durch Änderung am Statuseingang oder gesonderten Triggereingang ausgelöst 45 | 46 | Um häufiger Bewegungstrigger zu bekommen, nehmen wir Präsenz und Bewegung vom TP, nicht den Lichtkanal. So kann man (vielleicht) Kurzzeitpräsenz auch ermöglichen. 47 | 48 | Präsenz und Bewegung vom TP über ein OR, wobei jedes Signal triggert -> Präsenztrigger PT 49 | 50 | Als Grundfunktion würde man einfach ein Treppenlicht nachtriggern, dass nicht ausschaltbar ist. 51 | 52 | D AND PT (nur PT triggert) -> Ausgang hat ein Treppenlicht, nachtriggerbar, nicht ausschaltbar -> Lichtausgang L 53 | 54 | ---- 55 | 56 | ## Sperre 57 | 58 | Sperre (S) ist ein negiertes Tor am Ausgang, damit man klar sagen kann, was für ein Singal beim anlegen der Sperre und beim aufheben der Sperre gesendet wird. 59 | 60 | Allerdings muss man bei der Sperre auch das Treppenlicht ausschalten, damit man beim Ausschalten der Sperre ein definiertes Verhalten hat. 61 | 62 | 63 | 64 | Änderung zu oben: 65 | 66 | Aus D und PT wird jetzt erstmal nur ein Lichttrigger gemacht, dass nur 1 sendet (und so ein Treppenlicht nur nachtriggern kann). 67 | 68 | D AND PT (nut PT triggert) -> Filter auf "nur 1 weiterleiten" -> Lichttrigger LT 69 | 70 | Der Lichttrigger kann von einem Tor komplett unterbunden werden und so im Sperrfall direkt mit einer 0 das Treppenlicht ausschalten. Da der Lichttrigger nur 1 sendet, kann dieser das Treppenlicht niemals ausschalten. 71 | 72 | LT geht auf ein Tor, dass von S (negiert) geöffnet wird. Das Tor sendet immer eine 0 im geschlossenen Zustand, wird bei jedem Telegramm getriggert. Der Ausgang ist dann das Treppenlicht, ausschaltbar, nachtriggerbar -> Treppenlicht TL 73 | 74 | Ab hier hätte man bereits ein sperrbares Treppenlichtsignal, dass aber im Falle einer Sperre nur eine 0 senden kann. Wenn das nicht reicht, schaltet man noch ein Tor hinterher, dass im Sperrfall ein gewünschtes Signal sendet. Hier kann man dann auch passend wiederholungen filtern, zyklisch senden, Ein- und Ausschaltverzögern, was immer man will. 75 | 76 | TL geht auf ein weiteres Tor, dass von S (negiert) geöffnet wird. Für geschlossenen Zustand kann das Tor parametrisiert werden, bei offen wird TL gesendet. Ausgang filtert alle 0 und 1 Wiederholungen -> Lichtausgang L 77 | 78 | ## Salveeingang 79 | 80 | Eigentlich braucht man keinen weiteren Slaveeingang. Für 1-Trigger kann der selbe Eingang wie für Präsenz vom TP verwendet werden (mehrere GA an diesem KO). 81 | 82 | Falls wir vom TP nicht nur 1, sondern auch 0-Telegramme auswerten, würde ein Slaveeingang notwendig werden. 83 | 84 | ## Statuseingang vom Aktor 85 | 86 | Ein Statuseingang vom Aktor dient der PM-Logik dazu, über externe Schaltvorgänge des Aktors informiert zu werden. Dies adressiert vor allem unbeabsichtigte, vor allem durch automatismen verursachte Schaltvorgänge. Nehmen wir mal an, ein "Alles aus" macht mir das Licht aus, auch wenn ich noch am Lesen bin. Dann möchte ich durch z.B. einfaches "Winken" wieder das Licht anmachen können. Das ist anders bei manueller Bedienung (siehe nächster Abschnitt). 87 | 88 | Erste Idee: das 1-Signal triggert normal wie jeder Slave, das 0-Signal schaltet das Treppenlicht aus. 89 | 90 | So würden neue Bewegungen direkt erkannt werden und neue Aktionen auslösen. 91 | 92 | ## Manuelle Bedienung 93 | 94 | Aus theoretischer Betrachtung lassen sich 4 Varianten einer manuellen Bedienung von PM-Zuständen (hier mal exemplarisch die Bedienung von Licht) ableiten: 95 | 96 | * Der Benutzer möchte das Licht einschalten und es soll auf keinen Fall ausgehen. Der PM (also die Automatik) sind deaktiviert. Beim Ausschalten wird entschieden, ob dann wieder per PM (also Automatisch) geschaltet wird. Das nennen wir **Automatik AUS, Licht AN** 97 | 98 | * Der Benutzer möchte das Licht ausschalten und es soll auf keinen Fall angehen. Der PM (also die Automatik) sind deaktiviert. Beim Einschalten wird entschieden, ob dann wieder per PM (also Automatisch) geschaltet wird. Das nennen wir **Automatik AUS, Licht AUS** 99 | 100 | * Der Benutzer möchte das Licht einschalten, es soll aber durchaus durch den PM ausgeschaltet werden können (klassischer Fall: Es ist einem zu dunkel, der PM hat aber seine Helligkeitsschwelle zum Einschalten noch nicht erreicht). Das nennen wir **Automatik EIN, Licht EIN** 101 | 102 | * Der Benutzer möchte das Licht ausschalten, es soll aber durchaus durch den PM eingeschaltet werden können (klassischer Fall: Der PM hat das Licht eingeschaltet, man macht es aber aus, um einen schönen Abend bei Kerzenlicht zu verbringen). Hier ist es wichtig, dass das Licht so lange aus bleibt, wie Präsenz im Raum existiert. Das nennen wir **Automatik EIN, Licht AUS** 103 | 104 | Wenn man sich die obigen 4 Fälle anschaut, sind das genau die Fälle der Zwangsführung: 105 | 106 | * 00 - **keine Priorität, aus** entspricht Standardverhalten+ausschalten oder bei uns **Automatik EIN, Licht AUS** (da beim PM das Standardverhalten ja "Automatik EIN" sein sollte) 107 | 108 | * 01 - **keine Priorität, ein** entspricht Standardverhalten+einschalten oder bei uns **Automatik EIN, Licht EIN** 109 | 110 | * 10 - **Priorität, aus** entspricht Sonderverhalten+ausschalten oder bei uns **Automatik AUS, Licht AUS** (da Priorität beim PM ja das übersteuern der Automatik ist) 111 | 112 | * 11 - **Priorität, ein** entspricht Sonderverhalten+einschalten oder bei uns **Automatik AUS, Licht EIN** 113 | 114 | Ob man alle 4 Varianten über ein Zwangsführungsobjekt zugänglich macht oder über 2 einzelne Bitobjekte, ist sekundär. Interessant ist die Realisierung. Bei 2 einzelnen Bitobjekten würde die bereits besprochene Sperre das Prioritätsobjekt abbilden, es käme nur noch ein EIN/AUS-Objekt hinzu. 115 | 116 | Um es überschaubar zu gestalten, wird hier der Ansatz gewählt, dass es eine Sperre und ein manuelles EIN/AUS-Objekt (M) gibt. Ein Zwangsführungs-Eingang setzt nur die beiden Einzelobjekte intern. Das bedeutet, dass die beiden Einzelobjekte und die Zwangsführung gleichberechtigt sind. Das kann verwirrend sein. Klassischerweise hat die Zwangsführung Vorrang vor Sperre oder es kann nur eines von beiden in der Applikation ausgewählt werden. 117 | 118 | ### Automatik EIN, Ausgang EIN/AUS 119 | 120 | Man will hier ein bestimmtes Ausgangssignal haben (EIN oder AUS), solange Präsenz ist. Danach soll der Melder wieder in seinen "normalen" Automatikmodus fallen. 121 | 122 | Ein Impuls auf dem Einagang M muss die Helligkeitsschwelle deaktivieren, das Treppenlicht triggern und den gewünschten Wert am Ausgang senden. 123 | 124 | Um den Impuls festzustellen: 125 | 126 | Eingang M normal und negiert auf ein OR, dass jedes Eingangssignal durchlässt -> Manueller Trigger MT. 127 | 128 | Wir brauchen noch etwas, was den Manuellmodus speichert. Der Modus wird von MT gestartet. Zurückgesetzt wird er, wenn die Nachlaufzeit auf 0 geht. 129 | 130 | MT geht auf ein OR mit einem Eingang. Der Ausgang sendet nur bei Änderung -> Status Manueller Modul MM. 131 | 132 | MM geht auf ein OR, das direkt hiter der Helligkeits-Hysterese sitzt. So kann man den PM helligkeitsunabhängig machen. Statt: 133 | 134 | D AND PT (nut PT triggert) -> Filter auf "nur 1 weiterleiten" -> Lichttrigger LT 135 | 136 | machen wir jetzt 137 | 138 | D OR MM (nur senden bei Änderung) -> Dunkel neu DN 139 | 140 | um dann 141 | 142 | DN AND PT (nut PT triggert) -> Filter auf "nur 1 weiterleiten" -> Lichttrigger LT 143 | 144 | MM setzt technisch eine Sperre wie bei Automatik AUS, der Ausgang ist dann durch den Wert von M vorbelegt. 145 | 146 | Jetzt fehlt nur noch, dass ein 0 vom Treppenlicht auch MM zurücksetzt. 147 | 148 | TL geht auf ein OR mit nur einem Eingang, dass nur 0 durchlässt -> Treppenlicht Aus TL0. 149 | 150 | TL0 geht auf den einzigen Eignang vom MM, der dann MM zurücksetzt. 151 | 152 | ### Automatik AUS, Ausgang EIN/AUS 153 | 154 | Wir nutzen die Sperre von oben, nur wird das 2. Tor (das vom Lichtausgang L) so parametriert, dass es immer eine 0 im Sperrfall liefert. Der Ausgang dieser Logik ist jetzt auch nicht mehr der Lichtausgang, sondern der Sperrausgang SA. 155 | 156 | TL geht auf ein weiteres Tor, dass von S (negiert) geöffnet wird. Für geschlossenen Zustand liefert das Tor immer 0, bei offen wird TL gesendet. Ausgang filtert alle 0 und 1 Wiederholungen -> Sperrausgang SA 157 | 158 | Der Sperrausgang SA wird jetzt auf ein OR mir dem 159 | 160 | ## Kurzzeitpräsenz 161 | 162 | ## Nachlaufzeit per KO ändern 163 | 164 | ## Totzeit 165 | -------------------------------------------------------------------------------- /doc-depricated/technical/Testplatine/Schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/OAM-PresenceModule/2af7764ea7c129187d57154841f9ea634a7f882f/doc-depricated/technical/Testplatine/Schematic.pdf -------------------------------------------------------------------------------- /include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /include/hardware.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef BOARD_ENDUSER 4 | 5 | #include 6 | 7 | // // Board specific definietions 8 | // // #define BOARD_MASIFI 9 | // // ################################################ 10 | // // ### Board Configuration 11 | // // ################################################ 12 | // #ifdef BOARD_DEVEL 13 | // #define PROG_LED_PIN 26 14 | // #define PROG_LED_PIN_ACTIVE_ON LOW 15 | // #define PROG_BUTTON_PIN 10 16 | // #define PROG_BUTTON_PIN_INTERRUPT_ON RISING 17 | // #define SAVE_INTERRUPT_PIN 17 18 | // #define BUZZER_PIN 18 19 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0xFF // Address of 24LC256 eeprom chip 20 | // #endif 21 | // #ifdef BOARD_ENOCEAN 22 | // #ifndef PROG_LED_PIN 23 | // #define PROG_LED_PIN 10 24 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 25 | // #endif 26 | // #ifndef PROG_BUTTON_PIN 27 | // #define PROG_BUTTON_PIN 8 28 | // #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 29 | // #endif 30 | // #define SAVE_INTERRUPT_PIN A9 31 | // // #define INFO_LED_PIN 38 32 | // // #define INFO_LED_PIN_ACTIVE_ON HIGH 33 | // // #define COUNT_LOG_CHANNEL 80 34 | // // Buzzer 35 | // // #define BUZZER_PIN 9 36 | // // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 37 | // #define NO_I2C 38 | // #endif 39 | #ifdef BOARD_MASIFI_V1 40 | #define PROG_LED_PIN 13 41 | #define PROG_LED_PIN_ACTIVE_ON HIGH 42 | #define PROG_BUTTON_PIN 11 43 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 44 | #define SAVE_INTERRUPT_PIN 8 45 | #define INFO_LED_PIN 38 46 | #define INFO_LED_PIN_ACTIVE_ON HIGH 47 | #define COUNT_1WIRE_BUSMASTER 1 48 | #define COUNT_1WIRE_CHANNEL 30 49 | // #define COUNT_PM_CHANNEL 6 50 | // #define COUNT_LOG_CHANNEL 80 51 | // Buzzer 52 | #define BUZZER_PIN 9 53 | #define I2C_1WIRE_DEVICE_ADDRESSS 0x1A // Address of DS2482 1-Wire-Busmaster chip 54 | #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 55 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 56 | #endif 57 | 58 | #ifdef BOARD_MASIFI_V2 59 | #define PROG_LED_PIN 13 60 | #define PROG_LED_PIN_ACTIVE_ON HIGH 61 | #define PROG_BUTTON_PIN 11 62 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 63 | #define SAVE_INTERRUPT_PIN 8 64 | #define INFO_LED_PIN 38 65 | #define INFO_LED_PIN_ACTIVE_ON HIGH 66 | #define COUNT_1WIRE_BUSMASTER 1 67 | #define COUNT_1WIRE_CHANNEL 30 68 | // #define COUNT_PM_CHANNEL 6 69 | // #define COUNT_LOG_CHANNEL 99 70 | // Buzzer 71 | #define BUZZER_PIN 9 72 | #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 73 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 74 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 75 | #endif 76 | 77 | #ifdef BOARD_MASIFI_V3 78 | #define PROG_LED_PIN 13 79 | #define PROG_LED_PIN_ACTIVE_ON HIGH 80 | #define PROG_BUTTON_PIN 11 81 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 82 | #define SAVE_INTERRUPT_PIN A2 // 8 83 | #define INFO_LED_PIN 38 84 | #define INFO_LED_PIN_ACTIVE_ON HIGH 85 | #define COUNT_1WIRE_BUSMASTER 1 86 | #define COUNT_1WIRE_CHANNEL 30 87 | // #define COUNT_PM_CHANNEL 6 88 | // #define COUNT_LOG_CHANNEL 80 89 | // Buzzer 90 | #define BUZZER_PIN 9 91 | #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 92 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 93 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 94 | #endif 95 | 96 | #ifdef BOARD_MASIFI_V31 97 | #define PROG_LED_PIN 13 98 | #define PROG_LED_PIN_ACTIVE_ON HIGH 99 | #define PROG_BUTTON_PIN 12 100 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 101 | #define SAVE_INTERRUPT_PIN A2 // 8 102 | #define INFO_LED_PIN 38 103 | #define INFO_LED_PIN_ACTIVE_ON HIGH 104 | #define COUNT_1WIRE_BUSMASTER 1 105 | #define COUNT_1WIRE_CHANNEL 30 106 | // #define COUNT_PM_CHANNEL 6 107 | // #define COUNT_LOG_CHANNEL 80 108 | // Buzzer 109 | #define BUZZER_PIN 9 110 | #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 111 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 112 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 113 | #endif 114 | 115 | // Sensormodul auf RP2040 Basis produktiv 116 | #ifdef BOARD_MASIFI_V40 117 | #define PROG_LED_PIN 1 118 | #define PROG_LED_PIN_ACTIVE_ON HIGH 119 | #define PROG_BUTTON_PIN 0 120 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 121 | #define SAVE_INTERRUPT_PIN 29 122 | // #define INFO_LED_PIN 38 123 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 124 | // #define COUNT_1WIRE_BUSMASTER 1 125 | // #define COUNT_1WIRE_CHANNEL 30 126 | // #define COUNT_PM_CHANNEL 6 127 | // #define COUNT_LOG_CHANNEL 99 128 | #define KNX_UART_RX_PIN 17 129 | #define KNX_UART_TX_PIN 16 130 | #define KNX_I2C_SDA_PIN 20 131 | #define KNX_I2C_SCL_PIN 21 132 | // Buzzer 133 | #define BUZZER_PIN 27 134 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 135 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 136 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 137 | #endif 138 | 139 | // Sensormodul-Breakout-Board 140 | #ifdef BOARD_MASIFI_SENSOR_BREAKOUT 141 | #define PROG_LED_PIN 1 142 | #define PROG_LED_PIN_ACTIVE_ON HIGH 143 | #define PROG_BUTTON_PIN 0 144 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 145 | // #define SAVE_INTERRUPT_PIN 22 146 | // #define INFO_LED_PIN 38 147 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 148 | #define KNX_UART_RX_PIN 17 149 | #define KNX_UART_TX_PIN 16 150 | #define KNX_I2C_SDA_PIN 20 151 | #define KNX_I2C_SCL_PIN 21 152 | #define I2C_SDA_PIN 14 153 | #define I2C_SCL_PIN 15 154 | // #define COUNT_1WIRE_BUSMASTER 1 155 | // #define COUNT_1WIRE_CHANNEL 30 156 | #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 157 | // #define I2C_BUS_1WIRE Wire1 158 | // #define ONEWIRE_5V_ENABLE 5 159 | // #define ONEWIRE_5V_SHORT 4 160 | // Buzzer 161 | #define BUZZER_PIN 9 162 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 163 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RGBW-LED-Driver 164 | #define HW_ANALOG_ID 26 165 | #define HW_REVISION_ID1 10 166 | #define HW_REVISION_ID2 11 167 | #define HW_REVISION_ID3 12 168 | #define HF_UART_TX_PIN 8 169 | #define HF_UART_RX_PIN 9 170 | #define HF_S1_PIN 27 171 | #define HF_S2_PIN 13 172 | #define HF_POWER_PIN 28 // usually "Rotary switch push button" 173 | #define PRESENCE_LED_PIN 10 174 | #define PRESENCE_LED_PIN_ACTIVE_ON HIGH 175 | #define MOVE_LED_PIN 11 176 | #define MOVE_LED_PIN_ACTIVE_ON HIGH 177 | #endif 178 | 179 | #ifdef BOARD_MASIFI_AUSSEN_V13 180 | #define PROG_LED_PIN 13 181 | #define PROG_LED_PIN_ACTIVE_ON HIGH 182 | #define PROG_BUTTON_PIN 12 183 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 184 | #define SAVE_INTERRUPT_PIN A2 // 8 185 | #define INFO_LED_PIN 38 186 | #define INFO_LED_PIN_ACTIVE_ON HIGH 187 | #define COUNT_1WIRE_BUSMASTER 1 188 | #define COUNT_1WIRE_CHANNEL 30 189 | // #define COUNT_LOG_CHANNEL 80 190 | // Buzzer 191 | #define BUZZER_PIN 9 192 | #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 193 | #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 194 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 195 | #endif 196 | 197 | // Sensormodul auf RP2040 Basis (erster Prototyp) 198 | #ifdef BOARD_MASIFI_PICO 199 | #define PROG_LED_PIN 12 200 | #define PROG_LED_PIN_ACTIVE_ON HIGH 201 | #define PROG_BUTTON_PIN 28 202 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 203 | #define SAVE_INTERRUPT_PIN D29 // 8 204 | // #define INFO_LED_PIN 38 205 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 206 | #define COUNT_1WIRE_BUSMASTER 1 207 | #define COUNT_1WIRE_CHANNEL 30 208 | // #define COUNT_PM_CHANNEL 6 209 | // #define COUNT_LOG_CHANNEL 99 210 | #define KNX_UART_RX_PIN 17 211 | #define KNX_UART_TX_PIN 16 212 | #define KNX_I2C_SDA_PIN 20 213 | #define KNX_I2C_SCL_PIN 21 214 | // Buzzer 215 | #define BUZZER_PIN 27 216 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 217 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 218 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 219 | #endif 220 | 221 | #ifdef BOARD_SIRSYDOM_PIPICO_BCU_CONNECTOR 222 | #define PROG_LED_PIN 21 223 | #define PROG_LED_PIN_ACTIVE_ON HIGH 224 | #define PROG_BUTTON_PIN 22 225 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 226 | #define SAVE_INTERRUPT_PIN 20 // 8 227 | // #define INFO_LED_PIN 38 228 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 229 | // #define COUNT_1WIRE_BUSMASTER 1 230 | // #define COUNT_1WIRE_CHANNEL 30 231 | // #define COUNT_PM_CHANNEL 6 232 | // #define COUNT_LOG_CHANNEL 99 233 | #define KNX_UART_RX_PIN 1 234 | #define KNX_UART_TX_PIN 0 235 | // #define KNX_I2C_SDA_PIN 20 236 | // #define KNX_I2C_SCL_PIN 21 237 | // Buzzer 238 | #define BUZZER_PIN 27 239 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 240 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 241 | // #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 242 | #endif 243 | 244 | #ifdef BOARD_SMARTMF_1TE_RP2040 245 | #define PROG_LED_PIN 1 246 | #define PROG_LED_PIN_ACTIVE_ON HIGH 247 | #define PROG_BUTTON_PIN 0 248 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 249 | #define SAVE_INTERRUPT_PIN 29 250 | #define KNX_UART_RX_PIN 17 251 | #define KNX_UART_TX_PIN 16 252 | #endif 253 | 254 | #ifdef BOARD_OPENKNX_REG1_BASE 255 | #define PROG_LED_PIN 2 256 | #define PROG_LED_PIN_ACTIVE_ON HIGH 257 | #define PROG_BUTTON_PIN 7 258 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 259 | #define SAVE_INTERRUPT_PIN 6 260 | #define INFO_LED_PIN 3 261 | #define INFO_LED_PIN_ACTIVE_ON HIGH 262 | #define KNX_UART_RX_PIN 1 263 | #define KNX_UART_TX_PIN 0 264 | #endif 265 | 266 | // HF-Firmware-Test auf RP2040-Sensormodul Basis (reiner Test) 267 | #ifdef BOARD_MASIFI_PICO_SEN_PM_TEST 268 | #define PROG_LED_PIN 12 269 | #define PROG_LED_PIN_ACTIVE_ON HIGH 270 | #define PROG_BUTTON_PIN 28 271 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 272 | #define SAVE_INTERRUPT_PIN D29 // 8 273 | // #define INFO_LED_PIN 38 274 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 275 | // #define COUNT_1WIRE_BUSMASTER 1 276 | // #define COUNT_1WIRE_CHANNEL 30 277 | // #define COUNT_PM_CHANNEL 6 278 | // #define COUNT_LOG_CHANNEL 99 279 | #define KNX_UART_RX_PIN 17 280 | #define KNX_UART_TX_PIN 16 281 | #define KNX_I2C_SDA_PIN 20 282 | #define KNX_I2C_SCL_PIN 21 283 | // Buzzer 284 | #define BUZZER_PIN 27 285 | #define PRESENCE_LED_PIN 9 286 | #define PRESENCE_LED_PIN_ACTIVE_ON HIGH 287 | #define MOVE_LED_PIN 8 288 | #define MOVE_LED_PIN_ACTIVE_ON HIGH 289 | #define I2C_SDA_PIN 2 290 | #define I2C_SCL_PIN 3 291 | #define HF_UART_TX_PIN 4 292 | #define HF_UART_RX_PIN 5 293 | #define HF_S1_PIN 6 294 | #define HF_S2_PIN 7 295 | #define HF_POWER_PIN 14 296 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 297 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 298 | #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 299 | #endif 300 | 301 | #ifdef BOARD_MASIFI_HFPM_DEVEL 302 | #define PROG_LED_PIN 16 303 | #define PROG_LED_PIN_ACTIVE_ON HIGH 304 | #define PROG_BUTTON_PIN 17 305 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 306 | #define INFO_LED_PIN 10 307 | #define INFO_LED_PIN_ACTIVE_ON HIGH 308 | #define PRESENCE_LED_PIN 9 309 | #define PRESENCE_LED_PIN_ACTIVE_ON HIGH 310 | #define MOVE_LED_PIN 8 311 | #define MOVE_LED_PIN_ACTIVE_ON HIGH 312 | #define KNX_UART_TX_PIN 12 313 | #define KNX_UART_RX_PIN 13 314 | #define I2C_WIRE Wire1 315 | #define I2C_SDA_PIN 2 316 | #define I2C_SCL_PIN 3 317 | #define HF_SERIAL Serial2 318 | #define HF_SERIAL_SPEED 9600 319 | #define HF_UART_TX_PIN 4 320 | #define HF_UART_RX_PIN 5 321 | #define HF_S1_PIN 6 322 | #define HF_S2_PIN 7 323 | #define HF_POWER_PIN 14 324 | #define SAVE_INTERRUPT_PIN 15 325 | // #define SENSOR_I2C_OPT300x Wire1 326 | // #define SENSOR_I2C_VEML7700 Wire1 327 | // #define PIR_PIN 14 328 | // #define COUNT_PM_CHANNEL 15 329 | // #define COUNT_LOG_CHANNEL 80 330 | // Buzzer 331 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 332 | #endif 333 | 334 | #ifdef BOARD_MASIFI_HFPM_DEVEL2 335 | #define PROG_LED_PIN 18 336 | #define PROG_LED_PIN_ACTIVE_ON HIGH 337 | #define PROG_BUTTON_PIN 17 338 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 339 | // #define INFO_LED_PIN 9 340 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 341 | #define PRESENCE_LED_PIN 0 342 | #define PRESENCE_LED_PIN_ACTIVE_ON HIGH 343 | #define MOVE_LED_PIN 1 344 | #define MOVE_LED_PIN_ACTIVE_ON HIGH 345 | #define KNX_UART_TX_PIN 12 346 | #define KNX_UART_RX_PIN 13 347 | #define I2C_WIRE Wire1 348 | #define I2C_SDA_PIN 26 // I2C1 349 | #define I2C_SCL_PIN 27 // I2C1 350 | #define HF_SERIAL Serial2 351 | #define HF_SERIAL_SPEED 9600 352 | #define HF_UART_TX_PIN 4 353 | #define HF_UART_RX_PIN 5 354 | #define HF_S1_PIN 2 355 | #define HF_S2_PIN 3 356 | #define HF_POWER_PIN 10 357 | #define SAVE_INTERRUPT_PIN 11 358 | #define SmartMF_HardwareVariant_PIN 29 359 | #define SmartMF_HardwareRevision_ID1 22 360 | #define SmartMF_HardwareRevision_ID2 23 361 | #define SmartMF_HardwareRevision_ID3 24 362 | // #define SENSOR_I2C_OPT300x Wire1 363 | // #define SENSOR_I2C_VEML7700 Wire1 364 | #endif 365 | 366 | #ifdef BOARD_MASIFI_HFPM_V20 367 | #define PROG_LED_PIN 18 368 | #define PROG_LED_PIN_ACTIVE_ON HIGH 369 | #define PROG_BUTTON_PIN 17 370 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 371 | // #define INFO_LED_PIN 9 372 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 373 | #define PRESENCE_LED_PIN 0 374 | #define PRESENCE_LED_PIN_ACTIVE_ON HIGH 375 | #define MOVE_LED_PIN 1 376 | #define MOVE_LED_PIN_ACTIVE_ON HIGH 377 | #define KNX_UART_TX_PIN 12 378 | #define KNX_UART_RX_PIN 13 379 | #define I2C_WIRE Wire1 380 | #define I2C_SDA_PIN 26 // I2C1 381 | #define I2C_SCL_PIN 27 // I2C1 382 | #define HF_SERIAL Serial2 383 | #define HF_SERIAL_SPEED 9600 384 | #define HF_UART_TX_PIN 4 385 | #define HF_UART_RX_PIN 5 386 | #define HF_S1_PIN 2 387 | #define HF_S2_PIN 3 388 | #define HF_POWER_PIN 28 389 | #define SAVE_INTERRUPT_PIN 11 390 | #define SmartMF_HardwareVariant_PIN 29 391 | #define SmartMF_HardwareRevision_ID1 22 392 | #define SmartMF_HardwareRevision_ID2 23 393 | #define SmartMF_HardwareRevision_ID3 24 394 | // #define SENSOR_I2C_OPT300x Wire1 395 | // #define SENSOR_I2C_VEML7700 Wire1 396 | #endif 397 | 398 | #ifdef BOARD_ABTOOLS_FINGERPRINT_V13 399 | #define INFO_LED_PIN 11 400 | #define INFO_LED_PIN_ACTIVE_ON HIGH 401 | #define PROG_LED_PIN 10 402 | #define PROG_LED_PIN_ACTIVE_ON HIGH 403 | #define PROG_BUTTON_PIN 9 404 | #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 405 | 406 | #define KNX_UART_TX_PIN 12 407 | #define KNX_UART_RX_PIN 13 408 | #define SAVE_INTERRUPT_PIN 0 409 | #endif 410 | // #ifdef BOARD_MASIFI_PM 411 | // #define PROG_LED_PIN 13 412 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 413 | // #define PROG_BUTTON_PIN 11 414 | // #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 415 | // #define SAVE_INTERRUPT_PIN 0 416 | // #define INFO_LED_PIN 26 417 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 418 | // #define PRESENCE_LED_PIN 8 419 | // #define PRESENCE_LED_PIN_ACTIVE_ON HIGH 420 | // #define PIR_PIN 14 421 | // // #define COUNT_PM_CHANNEL 15 422 | // // #define COUNT_LOG_CHANNEL 80 423 | // // Buzzer 424 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 425 | // #endif 426 | // #ifdef BOARD_PM_V3 427 | // #define PROG_LED_PIN 13 428 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 429 | // #define PROG_BUTTON_PIN 11 430 | // #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 431 | // #define SAVE_INTERRUPT_PIN A2 // 8 432 | // #define INFO_LED_PIN 38 433 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 434 | // #define COUNT_1WIRE_BUSMASTER 1 435 | // #define COUNT_1WIRE_CHANNEL 30 436 | // // #define COUNT_PM_CHANNEL 20 437 | // // #define COUNT_LOG_CHANNEL 80 438 | // // Buzzer 439 | // #define BUZZER_PIN 9 440 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 441 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 442 | // #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 443 | // #endif 444 | // #ifdef BOARD_PM_V31 445 | // #define PROG_LED_PIN 13 446 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 447 | // #define PROG_BUTTON_PIN 12 448 | // #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 449 | // #define SAVE_INTERRUPT_PIN A2 // 8 450 | // #define INFO_LED_PIN 38 451 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 452 | // #define COUNT_1WIRE_BUSMASTER 1 453 | // #define COUNT_1WIRE_CHANNEL 30 454 | // // #define COUNT_PM_CHANNEL 20 455 | // // #define COUNT_LOG_CHANNEL 80 456 | // // Buzzer 457 | // #define BUZZER_PIN 9 458 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of DS2484 1-Wire-Busmaster chip 459 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 460 | // #define I2C_RGBLED_DEVICE_ADDRESS 0x60 // Address of PCA9632 RBGW-LED-Driver 461 | // #endif 462 | // #ifdef BOARD_MASIFI_ONEWIRE 463 | // #define PROG_LED_PIN 26 464 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 465 | // #define PROG_BUTTON_PIN A1 466 | // #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 467 | // #define INFO_LED_PIN 25 468 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 469 | // #define COUNT_1WIRE_BUSMASTER 3 470 | // #define COUNT_1WIRE_CHANNEL 90 471 | // // #define COUNT_LOG_CHANNEL 80 472 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of first DS2482 1-Wire-Busmaster chip, used are 0x19, 0x1A, 0x1B 473 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 474 | // #endif 475 | // #ifdef BOARD_MASIFI_ONEWIRE_ITSYBITSY_M0 476 | // #define PROG_LED_PIN 9 477 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 478 | // #define PROG_BUTTON_PIN A1 479 | // #define PROG_BUTTON_PIN_INTERRUPT_ON FALLING 480 | // #define INFO_LED_PIN 13 481 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 482 | // #define COUNT_1WIRE_BUSMASTER 3 483 | // #define COUNT_1WIRE_CHANNEL 90 484 | // // #define COUNT_LOG_CHANNEL 80 485 | // #define I2C_1WIRE_DEVICE_ADDRESSS 0x18 // Address of first DS2482 1-Wire-Busmaster chip, used are 0x19, 0x1A, 0x1B 486 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 487 | // #endif 488 | // // ModbusGateway from Masifi, SAMD hardware 489 | // #ifdef BOARD_MASIFI_MODBUS_SAMD 490 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 491 | // #define PROG_BUTTON_PIN A1 492 | // #define INFO_LED_PIN 13 493 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 494 | // #define I2C_EEPROM_DEVICE_ADDRESSS 0x50 // Address of 24LC256 eeprom chip 495 | // #endif 496 | // // ModbusGateway from Masifi, RP2040 hardware 497 | // #ifdef BOARD_MASIFI_MODBUS_RP2040 498 | // #define PROG_LED_PIN_ACTIVE_ON HIGH 499 | // #define PROG_BUTTON_PIN A1 500 | // #define INFO_LED_PIN 13 501 | // #define INFO_LED_PIN_ACTIVE_ON HIGH 502 | // #define KNX_UART_TX_PIN 12 503 | // #define KNX_UART_RX_PIN 13 504 | // #endif 505 | #endif 506 | -------------------------------------------------------------------------------- /include/versions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define MAIN_Version "5b2683e" 4 | #define KNX_Version "2.1.2+764900e" 5 | #define MODULE_LogicModule_Version "3.5.2+7bc407d" 6 | #define MODULE_LogicModule_ETS 53 7 | #define MODULE_Common_Version "1.2.0+5d0a279" 8 | #define MODULE_Common_ETS 18 9 | #define MODULE_PresenceModule_Version "3.6.2+ede7be9" 10 | #define MODULE_PresenceModule_ETS 54 11 | #define MODULE_SensorDevices_Version "4.0.0+a2c27b2" 12 | #define MODULE_SensorDevices_ETS 64 13 | #define MODULE_SmartMF_Version "a64279e" 14 | #define MODULE_FileTransferModule_Version "0.0.4+f13e94b" 15 | #define MODULE_FileTransferModule_ETS 0 16 | #define MODULE_UsbExchange_Version "0.0.1+1ce7a13" 17 | #define MODULE_UsbExchange_ETS 0 18 | #define MODULE_VirtualButton_Version "0.5.0+35b02ba" 19 | #define MODULE_VirtualButton_ETS 5 20 | -------------------------------------------------------------------------------- /lib/OFM-ConfigTransfer: -------------------------------------------------------------------------------- 1 | ../../OFM-ConfigTransfer -------------------------------------------------------------------------------- /lib/OFM-FileTransferModule: -------------------------------------------------------------------------------- 1 | ../../OFM-FileTransferModule -------------------------------------------------------------------------------- /lib/OFM-LogicModule: -------------------------------------------------------------------------------- 1 | ../../OFM-LogicModule -------------------------------------------------------------------------------- /lib/OFM-Network: -------------------------------------------------------------------------------- 1 | ../../OFM-Network -------------------------------------------------------------------------------- /lib/OFM-PresenceModule: -------------------------------------------------------------------------------- 1 | ../../OFM-PresenceModule -------------------------------------------------------------------------------- /lib/OFM-SmartMF: -------------------------------------------------------------------------------- 1 | ../../OFM-SmartMF -------------------------------------------------------------------------------- /lib/OFM-UsbExchange: -------------------------------------------------------------------------------- 1 | ../../OFM-UsbExchange -------------------------------------------------------------------------------- /lib/OFM-VirtualButton: -------------------------------------------------------------------------------- 1 | ../../OFM-VirtualButton -------------------------------------------------------------------------------- /lib/OGM-Common: -------------------------------------------------------------------------------- 1 | ../../OGM-Common -------------------------------------------------------------------------------- /lib/OGM-SensorDevices: -------------------------------------------------------------------------------- 1 | ../../OGM-SensorDevices -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /lib/knx: -------------------------------------------------------------------------------- 1 | ../../knx -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OAM-PresenceModule", 3 | "version": "3.6.2", 4 | "description": "Virtual Presence application for the knx stack, can be parametrized with ETS", 5 | "homepage": "https://openknx.de", 6 | "authors": { 7 | "name": "OpenKNX", 8 | "email": "info@openknx.de", 9 | "url": "https://openknx.de", 10 | "maintainer": true 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/OpenKNX/OAM-PresenceModule" 15 | } 16 | } -------------------------------------------------------------------------------- /platformio.bak.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | ; default_envs = build 13 | libdeps_dir = /tmp/libdeps 14 | 15 | [env] 16 | framework = arduino 17 | build_flags = 18 | ; -include "src/PMmodulHardware.h" 19 | # put preprocessor output into object file directory 20 | ; -save-temps=obj 21 | ; -fverbose-asm 22 | -D PMMODULE 23 | ; optimize knx stack 24 | -D SMALL_GROUPOBJECT 25 | -D USE_BINSEARCH 26 | ; -D KNX_AUTO_ADAPT 27 | ; -D KNX_WAIT_FOR_ADDR 28 | -D MASK_VERSION=0x07B0 29 | ; use flash directly 30 | -D KNX_FLASH_SIZE=0x8000 ; be careful, has to be large enough for ETS data and data stored by IFlashUserData 31 | ;-D DEBUG_TIMING 32 | ;-D LOGIC_TRACE 33 | -Wno-unknown-pragmas 34 | -Wno-switch 35 | ; debug timing in knx stack 36 | monitor_speed = 115200 37 | lib_ldf_mode = deep+ 38 | ; lib_extra_dirs = 39 | ; ${PROJECT_DIR}\.. 40 | debug_tool = jlink 41 | debug_extra_cmds = 42 | set output-radix 16 43 | upload_protocol = jlink 44 | 45 | [RP2040] 46 | platform = https://github.com/maxgerhardt/platform-raspberrypi.git 47 | board = pico 48 | board_build.core = earlephilhower 49 | platform_packages = framework-arduinopico @ https://github.com/earlephilhower/arduino-pico/releases/download/2.7.3/rp2040-2.7.3.zip 50 | ; board_build.filesystem_size = 0.1m 51 | ; platform_packages = 52 | ; ; framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#2.3.2 53 | ; framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git 54 | 55 | build_flags = 56 | ${env.build_flags} 57 | -D SERIAL_DEBUG=Serial 58 | ;flash start at 1.5MiB 59 | -D KNX_FLASH_OFFSET=0x180000 60 | ; -D USE_RP2040_EEPROM_EMULATION 61 | ; -D USE_RP2040_LARGE_EEPROM_EMULATION 62 | -D PIO_FRAMEWORK_ARDUINO_ENABLE_RTTI 63 | -D LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS 64 | -O0 65 | 66 | build_unflags = -Os 67 | 68 | lib_deps = 69 | adafruit/Adafruit VEML7700 Library @ 2.1.0 70 | ; adafruit/Adafruit SleepyDog Library @ ^1.4.0 71 | ; ; Wire 72 | ; ; SPI 73 | ; build_type = debug 74 | debug_build_flags = -O0 -ggdb3 75 | ; debug_build_flags = -ggdb3 76 | 77 | [SAMD] 78 | platform = atmelsam 79 | board = zeroUSB 80 | build_flags = 81 | ${env.build_flags} 82 | -D SERIAL_DEBUG=SerialUSB 83 | ; -D KNX_FLASH_SIZE=0x8000 84 | ; use EEPROM emulation 85 | ; -D USE_SAMD_EEPROM_EMULATION 86 | ; -D CRYSTALLESS 87 | ; -D WATCHDOG 88 | lib_deps = 89 | adafruit/Adafruit SleepyDog Library @ 1.4.0 90 | adafruit/Adafruit VEML7700 Library @ 2.1.0 91 | ; Wire 92 | ; SPI 93 | 94 | [RP2040_develop] 95 | build_flags = 96 | -D DEBUG_DELAY=10000 97 | ; -D BOARD_MASIFI_PICO 98 | ; -D BOARD_MASIFI_V40 99 | ;-D BOARD_MASIFI_HFPM_DEVEL 100 | ; -D BOARD_SMARTMF_1TE_RP2040 101 | ; -D BOARD_SIRSYDOM_PIPICO_BCU_CONNECTOR 102 | -D BOARD_MASIFI_SENSOR_BREAKOUT 103 | -D SERIAL_HF=Serial2 104 | 105 | [SAMD_develop] 106 | build_flags = 107 | -D DEBUG_DELAY=10000 108 | -D BOARD_MASIFI_V2 109 | 110 | 111 | 112 | [env:build_RP2040] 113 | extends = RP2040 114 | build_flags = 115 | ${RP2040.build_flags} 116 | ${RP2040_develop.build_flags} 117 | 118 | [env:build_SAMD] 119 | extends = SAMD 120 | build_flags = 121 | ${SAMD.build_flags} 122 | ${SAMD_develop.build_flags} 123 | 124 | 125 | 126 | [env:upload_USB_RP2040] 127 | extends = RP2040 128 | build_flags = 129 | ${RP2040.build_flags} 130 | ${RP2040_develop.build_flags} 131 | upload_protocol = picotool 132 | 133 | [env:upload_USB_SAMD] 134 | extends = SAMD 135 | build_flags = 136 | ${SAMD.build_flags} 137 | ${SAMD_develop.build_flags} 138 | upload_protocol = sam-ba 139 | 140 | [env:upload_JLINK_RP2040] 141 | extends = RP2040 142 | build_flags = 143 | ${RP2040.build_flags} 144 | ${RP2040_develop.build_flags} 145 | upload_protocol = jlink 146 | 147 | [env:upload_Release_JLINK_RP2040] 148 | extends = RP2040 149 | build_flags = 150 | ${RP2040.build_flags} 151 | -D DEBUG_DELAY=100 152 | -D BOARD_MASIFI_HFPM_DEVEL2 153 | -D SERIAL_HF=Serial2 154 | upload_protocol = jlink 155 | 156 | [env:upload_JLINK_SAMD] 157 | extends = SAMD 158 | build_flags = 159 | ${SAMD.build_flags} 160 | ${SAMD_develop.build_flags} 161 | upload_protocol = jlink 162 | 163 | [env:upload_Release_JLINK_SAMD] 164 | extends = SAMD 165 | build_flags = 166 | ${SAMD.build_flags} 167 | -D DEBUG_DELAY=100 168 | -D BOARD_MASIFI_V3 169 | upload_protocol = jlink 170 | 171 | 172 | #### Release Environments 173 | [env:release_Sensormodul_v31_SAMD] 174 | extends = SAMD 175 | build_flags = 176 | ${SAMD.build_flags} 177 | -D DEBUG_DELAY=100 178 | -D BOARD_MASIFI_V31 179 | 180 | [env:release_Sensormodul_v30_SAMD] 181 | extends = SAMD 182 | build_flags = 183 | ${SAMD.build_flags} 184 | -D DEBUG_DELAY=100 185 | -D BOARD_MASIFI_V3 186 | 187 | [env:release_Sensormodul_v40_RP2040] 188 | extends = RP2040 189 | build_flags = 190 | ${RP2040.build_flags} 191 | -D DEBUG_DELAY=100 192 | -D BOARD_MASIFI_V40 193 | 194 | [env:release_PiPico_BCU_Connector] 195 | extends = RP2040 196 | build_flags = 197 | ${RP2040.build_flags} 198 | -D DEBUG_DELAY=100 199 | -D BOARD_SIRSYDOM_PIPICO_BCU_CONNECTOR 200 | 201 | [env:release_1TE_RP2040_SmartMF] 202 | extends = RP2040 203 | build_flags = 204 | ${RP2040.build_flags} 205 | -D DEBUG_DELAY=100 206 | -D BOARD_SMARTMF_1TE_RP2040 207 | 208 | [env:release_OpenKNX_REG1_Base] 209 | extends = RP2040 210 | build_flags = 211 | ${RP2040.build_flags} 212 | -D DEBUG_DELAY=100 213 | -D BOARD_OPENKNX_REG1_BASE 214 | 215 | [env:release_RP2040_devel] 216 | extends = RP2040 217 | build_flags = 218 | ${RP2040.build_flags} 219 | -D DEBUG_DELAY=100 220 | -D BOARD_MASIFI_HFPM_DEVEL 221 | -D SERIAL_HF=Serial2 222 | 223 | [env:release_RealPresence] 224 | extends = RP2040 225 | build_flags = 226 | ${RP2040.build_flags} 227 | -D DEBUG_DELAY=100 228 | -D BOARD_MASIFI_HFPM_DEVEL2 229 | -D SERIAL_HF=Serial2 230 | 231 | [env:release_RealPresence_v20] 232 | extends = RP2040 233 | build_flags = 234 | ${RP2040.build_flags} 235 | -D DEBUG_DELAY=100 236 | -D BOARD_MASIFI_HFPM_V20 237 | -D SERIAL_HF=Serial2 238 | 239 | ### This is an example for enduser compiled environment 240 | [env:enduser] 241 | extends = SAMD 242 | ;extends = RP2040 243 | upload_protocol = sam-ba 244 | ;upload_protocol = picotool 245 | build_flags = 246 | ${SAMD.build_flags} 247 | -D DEBUG_DELAY=100 248 | -D BOARD_ENDUSER 249 | ; -D BOARD_MASIFI_HFPM_DEVEL 250 | -------------------------------------------------------------------------------- /platformio.custom.ini: -------------------------------------------------------------------------------- 1 | [SAMD_FLASH] 2 | build_flags = 3 | -D KNX_FLASH_SIZE=0x3800 4 | -D KNX_FLASH_OFFSET=0x3BC00 5 | -D OPENKNX_FLASH_SIZE=0x600 6 | -D OPENKNX_FLASH_OFFSET=0x3FA00 7 | 8 | [RP2040_FLASH] 9 | build_flags = 10 | -D KNX_FLASH_SIZE=0xC000 11 | -D KNX_FLASH_OFFSET=0xF0000 12 | -D OPENKNX_FLASH_SIZE=0x4000 13 | -D OPENKNX_FLASH_OFFSET=0xFC000 14 | 15 | [custom] 16 | build_flags = 17 | -D PMMODULE 18 | -D LOGICMODULE 19 | -D OPENKNX_LOOPTIME_WARNING=100 20 | ; -D KNX_AUTO_ADAPT 21 | ; -D KNX_WAIT_FOR_ADDR # ensures rx of an address (GA or PA) with higher ACK probability, but takes 7ms in knx.loop()! 22 | ; -D OPENKNX_LOOPTIME_WARNING=13 # should be set with KNX_WAIT_FOR_ADDR to OPENKNX_LOOPTIME_WARNING + 7 23 | 24 | ; debug parameters 25 | [custom_develop] 26 | extends = custom 27 | build_flags = 28 | ${custom.build_flags} 29 | -D OPENKNX_HEARTBEAT 30 | ; -D OPENKNX_HEARTBEAT_PRIO 31 | ; -D OPENKNX_RTT 32 | ; -D BUFFER_SIZE_UP=10240 33 | ; -D DEBUG_LOOP_TIME=10 ; will print a info when a loop took more than x ms. 34 | ; -D LOGIC_TRACE 35 | ; ; to see trace logs, they must match one of the 5 filters (TRACE_LOG1 .. TRACE_LOG2) 36 | ; "-D OPENKNX_TRACE1=Common.*" 37 | ; "-D OPENKNX_TRACE2=Flash.*" 38 | debug_build_flags = 39 | -D OPENKNX_DEBUGGER 40 | -ggdb3 41 | 42 | ; this config block is for specifing options that are valid for all RP2040-based builds 43 | [RP2040_custom] 44 | extends = RP2040, custom 45 | ; platform = https://github.com/maxgerhardt/platform-raspberrypi.git#0b2e90a 46 | ; platform_packages = framework-arduinopico @ https://github.com/earlephilhower/arduino-pico/releases/download/2.7.3/rp2040-2.7.3.zip 47 | ; board = pipico 48 | build_flags = 49 | -D SERIAL_DEBUG=Serial 50 | -D USE_KNX_DMA_UART=0 51 | -D USE_KNX_DMA_IRQ=0 52 | ; -D HF_SERIAL=Serial2 53 | -Wunused-variable 54 | 55 | ; this config block is for specifing options that are valid for all RP2040-based develop/debug builds 56 | [RP2040_custom_develop] 57 | extends = RP2040_develop, RP2040_custom, custom_develop, RP2040_EXCHANGE_2MB 58 | build_flags = 59 | ${RP2040_develop.build_flags} 60 | ${RP2040_custom.build_flags} 61 | ${custom_develop.build_flags} 62 | ${RP2040_EXCHANGE_2MB.build_flags} 63 | ${KNX_TP.build_flags} 64 | debug_build_flags = 65 | ${custom_develop.debug_build_flags} 66 | -O0 67 | 68 | ; this config block is for specifing options that are valid for all RP2040-based release builds 69 | [RP2040_custom_releases] 70 | extends = RP2040_releases, RP2040_custom, custom, UPLOAD_JLINK 71 | build_flags = 72 | ${RP2040_releases.build_flags} 73 | ${RP2040_custom.build_flags} 74 | ${custom.build_flags} 75 | ; "-D OPENKNX_TRACE1=C.*" 76 | ; -D OPENKNX_DEBUG 77 | -O0 78 | 79 | [RP2040_custom_releases_TP] 80 | extends = RP2040_custom_releases 81 | build_flags = 82 | ${RP2040_custom_releases.build_flags} 83 | ${KNX_TP.build_flags} 84 | 85 | [RP2040_custom_releases_TP_2MB] 86 | extends = RP2040_custom_releases_TP, RP2040_EXCHANGE_2MB 87 | build_flags = 88 | ${RP2040_EXCHANGE_2MB.build_flags} 89 | ${RP2040_custom_releases_TP.build_flags} 90 | 91 | [RP2040_custom_releases_TP_16MB] 92 | extends = RP2040_custom_releases_TP, RP2040_EXCHANGE_16MB 93 | build_flags = 94 | ${RP2040_EXCHANGE_16MB.build_flags} 95 | ${RP2040_custom_releases_TP.build_flags} 96 | 97 | [RP2040_custom_releases_IP] 98 | extends = RP2040_custom_releases 99 | build_flags = 100 | ${RP2040_custom_releases.build_flags} 101 | ${KNX_IP.build_flags} 102 | 103 | 104 | ; this config block is for specifing options that are valid for all SAMD-based builds 105 | [SAMD_custom] 106 | extends = SAMD, custom 107 | build_flags = 108 | -D SERIAL_DEBUG=SerialUSB 109 | -D KNX_DEBUG_SERIAL=SerialUSB 110 | -D KNX_SERIAL=Serial1 111 | 112 | ; this config block is for specifing options that are valid for all SAMD-based develop/debug builds 113 | [SAMD_custom_develop] 114 | extends = SAMD_custom, SAMD_develop, custom_develop 115 | build_flags = 116 | ${SAMD_develop.build_flags} 117 | ${SAMD_custom.build_flags} 118 | ${custom_develop.build_flags} 119 | ${KNX_TP.build_flags} 120 | debug_build_flags = 121 | ${custom_develop.debug_build_flags} 122 | -Os 123 | 124 | 125 | ; this config block is for specifing options that are valid for all SAMD-based release builds 126 | [SAMD_custom_releases] 127 | extends = SAMD_releases, SAMD_custom, custom 128 | build_flags = 129 | ${SAMD_releases.build_flags} 130 | ${SAMD_custom.build_flags} 131 | ${custom.build_flags} 132 | ${KNX_TP.build_flags} 133 | -Os 134 | 135 | [env:develop_SAMD] 136 | extends = SAMD_custom_develop 137 | build_flags = 138 | ${SAMD_custom_develop.build_flags} 139 | -D BOARD_MASIFI_V3 140 | ; -D BOARD_MASIFI_V31 141 | 142 | [env:develop_RP2040] 143 | extends = RP2040_custom_develop, RP2040_EXCHANGE_2MB 144 | build_flags = 145 | ${RP2040_custom_develop.build_flags} 146 | ; -D BOARD_SMARTMF_1TE_RP2040 147 | ; -D BOARD_MASIFI_PICO 148 | -D HF_SERIAL=Serial2 149 | -D BOARD_MASIFI_HFPM_DEVEL2 150 | ; -D BOARD_MASIFI_V40 151 | 152 | [env:develop_REG1_BASE_IP] 153 | extends = RP2040_UPLOAD_USB, RP2040_custom_develop, RP2040_EXCHANGE_16MB 154 | build_flags = 155 | ${RP2040_EXCHANGE_16MB.build_flags} 156 | ${RP2040_custom_develop.build_flags} 157 | ${KNX_IP.build_flags} 158 | -D OKNXHW_REG1_BASE_IP 159 | ; -D KNX_IP_GENERIC 160 | -D KNX_IP_W5500 161 | -D KNX_LOG_IP 162 | 163 | [env:upload_USB_SAMD] 164 | extends = UPLOAD_USB_SAMD, env:develop_SAMD 165 | 166 | [env:upload_JLINK_SAMD] 167 | extends = UPLOAD_JLINK, env:develop_SAMD 168 | 169 | [env:upload_USB_RP2040] 170 | extends = UPLOAD_USB_RP2040, env:develop_RP2040 171 | 172 | [env:upload_JLINK_RP2040] 173 | extends = UPLOAD_JLINK, env:develop_RP2040 174 | 175 | 176 | ; Releases 177 | [env:release_Sensormodul_Breakout_RP2040] 178 | extends = RP2040_custom_releases_TP_2MB 179 | build_flags = 180 | ${RP2040_custom_releases_TP_2MB.build_flags} 181 | -D BOARD_MASIFI_SENSOR_BREAKOUT 182 | 183 | [env:release_Sensormodul_v31_SAMD] 184 | extends = SAMD_custom_releases 185 | build_flags = 186 | ${SAMD_custom_releases.build_flags} 187 | -D BOARD_MASIFI_V31 188 | 189 | [env:release_Sensormodul_v30_SAMD] 190 | extends = SAMD_custom_releases 191 | build_flags = 192 | ${SAMD_custom_releases.build_flags} 193 | -D BOARD_MASIFI_V3 194 | 195 | [env:release_Sensormodul_v40_RP2040] 196 | extends = RP2040_custom_releases_TP_16MB 197 | build_flags = 198 | ${RP2040_custom_releases_TP_16MB.build_flags} 199 | -D BOARD_MASIFI_V40 200 | 201 | [env:release_PiPico_BCU_Connector] 202 | extends = RP2040_custom_releases_TP_2MB 203 | build_flags = 204 | ${RP2040_custom_releases_TP_2MB.build_flags} 205 | -D DEVICE_PIPICO_BCU_CONNECTOR 206 | 207 | [env:release_1TE_RP2040_SmartMF] 208 | extends = RP2040_custom_releases_TP_16MB 209 | build_flags = 210 | ${RP2040_custom_releases_TP_16MB.build_flags} 211 | -D BOARD_SMARTMF_1TE_RP2040 212 | 213 | [env:release_OpenKNX_REG1_BASE_V0] 214 | extends = RP2040_custom_releases_TP_16MB 215 | build_flags = 216 | ${RP2040_custom_releases_TP_16MB.build_flags} 217 | -D DEVICE_REG1_BASE_V0 218 | 219 | [env:release_OpenKNX_REG1_BASE_V1] 220 | extends = RP2040_custom_releases_TP_16MB 221 | build_flags = 222 | ${RP2040_custom_releases_TP_16MB.build_flags} 223 | -D DEVICE_REG1_BASE_V1 224 | 225 | [env:release_RP2040_devel] 226 | extends = RP2040_custom_releases_TP_2MB 227 | build_flags = 228 | ${RP2040_custom_releases_TP_2MB.build_flags} 229 | -D HF_SERIAL=Serial2 230 | -D BOARD_MASIFI_HFPM_DEVEL 231 | 232 | [env:release_RealPresence] 233 | extends = RP2040_custom_releases_TP_16MB 234 | build_flags = 235 | ${RP2040_custom_releases_TP_16MB.build_flags} 236 | -D HF_SERIAL=Serial2 237 | -D BOARD_MASIFI_HFPM_DEVEL2 238 | 239 | [env:release_RealPresence_v20] 240 | extends = RP2040_custom_releases_TP_16MB 241 | build_flags = 242 | ${RP2040_custom_releases_TP_16MB.build_flags} 243 | -D HF_SERIAL=Serial2 244 | -D BOARD_MASIFI_HFPM_V20 245 | 246 | [env:release_Fingerprint_v13_RP2040] 247 | extends = RP2040_custom_develop, RP2040_16MB 248 | build_flags = 249 | ${RP2040_custom_releases.build_flags} 250 | -D BOARD_ABTOOLS_FINGERPRINT_V13 251 | 252 | [env:release_REG1_BASE_IP] 253 | extends = RP2040_UPLOAD_USB, RP2040_custom_releases_IP, RP2040_EXCHANGE_16MB 254 | build_flags = 255 | ${RP2040_EXCHANGE_16MB.build_flags} 256 | ${RP2040_custom_releases_IP.build_flags} 257 | -D DEVICE_REG1_BASE_IP 258 | ; -D KNX_IP_WIFI 259 | -D KNX_IP_LAN 260 | -D CONFIG_ETH_ENABLED 261 | 262 | 263 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | ; default_envs = build 13 | libdeps_dir = /tmp/libdeps 14 | extra_configs = 15 | lib/OGM-Common/platformio.base.ini 16 | lib/OGM-Common/platformio.rp2040.ini 17 | lib/OGM-Common/platformio.samd.ini 18 | lib/OFM-UsbExchange/platformio.exchange.ini 19 | platformio.custom.ini 20 | -------------------------------------------------------------------------------- /restore/Restore-Dependencies-Branch.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Open ■ 3 | ┬────┴ Restore-Dependencies 4 | ■ KNX 2024 OpenKNX - Erkan Çolak 5 | 6 | FILEPATH: restore/Restore-Dependencies-Branch.ps1 7 | #> 8 | 9 | param( 10 | # Set the Git checkout mode 11 | [ValidateSet("Branch", "Hash")] 12 | [string]$GitCheckoutMode = "Branch", # Default is Branch 13 | 14 | # Force the script to recreate symbolic links 15 | [switch]$ForceRecreateSymLinks = $true, # Default is $true 16 | 17 | # "dependencies.txt" file 18 | [string]$DependenciesFile = "dependencies.txt", # Default is "dependencies.txt" 19 | 20 | # Check for privileges (Windows only) 21 | [switch]$CheckForDeveloperMode = $false, # Default is $false 22 | [switch]$CheckForSymbolicLinkPermissions = $true, # Default is $true 23 | [switch]$CheckForAdminOnly = $false, # Default is $false 24 | 25 | # Set the Write-Host message behavior 26 | [switch]$Verbose = $false, # Default is $false 27 | [switch]$DebugMsg = $false # Default is $false 28 | ) 29 | 30 | # Construct the command to invoke Restore-Dependencies.ps1 31 | $command = ".\Restore-Dependencies.ps1" + 32 | " -GitCheckoutMode $GitCheckoutMode" + 33 | " -ForceRecreateSymLinks:`$$ForceRecreateSymLinks" + 34 | " -DependenciesFile $DependenciesFile" + 35 | " -CheckForDeveloperMode:`$$CheckForDeveloperMode" + 36 | " -CheckForSymbolicLinkPermissions:`$$CheckForSymbolicLinkPermissions" + 37 | " -CheckForAdminOnly:`$$CheckForAdminOnly" + 38 | " -Verbose:`$$Verbose" + 39 | " -DebugMsg:`$$DebugMsg" 40 | 41 | # Execute the command 42 | Invoke-Expression $command 43 | -------------------------------------------------------------------------------- /restore/Restore-Dependencies.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Open ■ 3 | ┬────┴ Restore-Dependencies 4 | ■ KNX 2024 OpenKNX - Erkan Çolak 5 | 6 | FILEPATH: restore/Restore-Dependencies.ps1 7 | 8 | This script is designed to automate the process of managing dependencies in a software project, making it easier to 9 | set up the project environment for development or deployment. It is structured in a way that allows for easy 10 | modification and extension, and it can be used in a variety of different environments due to its platform-independent design. 11 | 12 | Here's a high-level description of what it does: 13 | 1. The script starts by checking the operating system it's running on. It sets up several variables 14 | (IsWindows, IsLinux, IsMacOs) based on the operating system type. This information is used later in 15 | the script to handle OS-specific operations. The script is designed to run platform-independently. 16 | 17 | 2. It assumes that the script is started in the project's 'restore' directory. It suggests going one 18 | directory back to get to the project directory. 19 | 20 | 3. The script checks if a specific dependencies file (dependencies.txt) exists. If the file exists, 21 | it reads the content of the file into a variable. This file contains information about the dependencies 22 | that need to be cloned from git. 23 | 24 | 4. For each dependency listed in the dependencies.txt file, the script performs a git clone operation 25 | to download the dependency into a directory outside of the current project. It also checks out the 26 | correct branch for each dependency as specified in the dependencies.txt file. 27 | 28 | 5. The script checks if a 'lib' directory exists. If the directory does not exist, it creates the directory 29 | and outputs a message to the user. It then gets the project files from the 'lib' directory. 30 | 31 | 6. The script creates symbolic links for the cloned dependencies in the 'lib' subfolder. This allows the 32 | project to reference the dependencies as if they were part of the project's own source code. 33 | 34 | 7. The script checks if each project file exists. If a project file does not exist, it outputs a message to the user. 35 | 36 | 8. Many core functions of the script are modularized and can be used outside of this script, providing flexibility and reusability. 37 | #> 38 | 39 | # Optional Input Parameters 40 | param( 41 | # Set the Git checkout mode 42 | [ValidateSet("Branch", "Hash")] 43 | [string]$GitCheckoutMode= "Hash", # Branch or Hash. Default is Hash 44 | 45 | # Force the script to recreate symbolic links 46 | [switch]$ForceRecreateSymLinks= $true, # Default is $true 47 | 48 | # "dependencies.txt" file 49 | [string]$DependenciesFile= "dependencies.txt", # Default is "dependencies.txt" 50 | 51 | # Check for privileges (Windows only) 52 | [switch]$CheckForDeveloperMode= $false, # Default is $false 53 | [switch]$CheckForSymbolicLinkPermissions= $true, # Default is $true 54 | [switch]$CheckForAdminOnly= $false, # Default is $false 55 | 56 | # Set the Write-Host message behavior 57 | [switch]$Verbose= $false, # Default is $false 58 | [switch]$DebugMsg= $false # Default is $false 59 | ) 60 | 61 | # Global Variables 62 | # If the user has no permissions to create symbolic links with 'New-Item', the script will try to use mklink to create symbolic links. 63 | 64 | #Those variables are used to check if the script is running on Windows. Only on Windows we can use mklink to create symbolic links. 65 | # If $Auto_Use_mklink_To_Create_SymLinks is $true, the script will automatically use mklink to create symbolic links. 66 | $Auto_Use_mklink_To_Create_SymLinks = $false # Default is $false 67 | # Ignore the permissions to create symbolic links with 'New-Item' and use mklink to create symbolic links. 68 | $Force_Use_mklink_To_Create_SymLinks = $true # Default is $true. If $Auto_Use_mklink_To_Create_SymLinks is $true, this variable is ignored. 69 | 70 | 71 | 72 | function Test-Administrator { 73 | return (([Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole('Administrators')).If($true, $false) 74 | } 75 | 76 | function Test-DeveloperMode { 77 | try { 78 | # Check if the registry key exists 79 | $isDeveloperMode = (Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowDevelopmentWithoutDevLicense" -ErrorAction Stop) -eq 1 80 | return $isDeveloperMode 81 | } catch { 82 | Write-Host -ForegroundColor Red "Error: $_" 83 | return $false 84 | } 85 | } 86 | 87 | function Test-SymbolicLinkPermission { 88 | # Clear the error variable 89 | $Error.Clear() 90 | $bRet = $true 91 | # Create a test symbolic link and target 92 | $testLinkPath = Join-Path ([System.IO.Path]::GetTempPath()) "test_symlink" 93 | $testTargetPath = Join-Path ([System.IO.Path]::GetTempPath()) "test_target" 94 | # Create the test target file 95 | $null = New-Item -ItemType File -Path $testTargetPath -Force 96 | $null = New-Item -ItemType SymbolicLink -Path $testLinkPath -Target $testTargetPath -Force -ErrorAction SilentlyContinue 97 | # Check last error message to see if the symbolic link was created successfully 98 | if ($Error) { 99 | # There was an error, so check the error message. If the error message is "UnauthorizedAccess", the user does not have permissions to create symbolic links 100 | $bRet = $false 101 | # Any other error message is unexpected and should be investigated. The script will return $false also in this case. 102 | # If the symbolic link was not created successfully, check the error message 103 | foreach ($err in $Error) { 104 | # Check the FullyQualifiedErrorId property if it contains the "UnauthorizedAccess" error 105 | if ($DebugMsg) { 106 | Write-Host -ForegroundColor DarkRed "- Error Message: $($err.Exception.Message)" 107 | Write-Host -ForegroundColor DarkRed "- Category : $($err.CategoryInfo.Category)" 108 | Write-Host -ForegroundColor DarkRed "- TargetName: $($err.CategoryInfo.TargetName)" 109 | Write-Host -ForegroundColor DarkRed "- ScriptName: $($err.InvocationInfo.ScriptName)" 110 | Write-Host -ForegroundColor DarkRed "- ErrorId: $($err.FullyQualifiedErrorId)" 111 | } else { 112 | if ($Verbose) { 113 | Write-Host -ForegroundColor DarkRed "- Error Message: $($err.Exception.Message)" 114 | Write-Host -ForegroundColor DarkRed "- ErrorId: $($err.FullyQualifiedErrorId)" 115 | } 116 | } 117 | if ($err.FullyQualifiedErrorId -eq "UnauthorizedAccess" -or 118 | $err.FullyQualifiedErrorId -eq "NewItemSymbolicLinkElevationRequired,Microsoft.PowerShell.Commands.NewItemCommand") { 119 | if ($Verbose) { Write-Host -ForegroundColor Red "- Symbolic link creation requires elevated privileges." ([Char]0x2717) } 120 | Write-Host -ForegroundColor Red "- User $($env:USERNAME) has not permissions to create symbolic links with 'New-Item'." ([Char]0x2717) 121 | break 122 | } 123 | } 124 | } else { 125 | # There was no error, so the symbolic link was created successfully 126 | if ($Verbose) { Write-Host -ForegroundColor Green "- TestSymbolic link created successfully." } 127 | Write-Host -ForegroundColor Green "- User $($env:USERNAME) has permissions to create symbolic links with New-Item." ([Char]0x221A) 128 | } 129 | # Clean up the test symbolic link and target 130 | Remove-Item -Path $testLinkPath -ErrorAction SilentlyContinue 131 | Remove-Item -Path $testTargetPath -ErrorAction SilentlyContinue 132 | return $bRet 133 | } 134 | 135 | function OpenKNX_ShowLogo($AddCustomText = $null) { 136 | Write-Host "" 137 | Write-Host "Open " -NoNewline 138 | #Write-Host "■" -ForegroundColor Green 139 | Write-Host "$( [char]::ConvertFromUtf32(0x25A0) )" -ForegroundColor Green 140 | $unicodeString = "$( [char]::ConvertFromUtf32(0x252C) )$( [char]::ConvertFromUtf32(0x2500) )$( [char]::ConvertFromUtf32(0x2500) )$( [char]::ConvertFromUtf32(0x2500) )$( [char]::ConvertFromUtf32(0x2500) )$( [char]::ConvertFromUtf32(0x2534) ) " 141 | 142 | if ($AddCustomText) { 143 | #Write-Host "┬────┴ $AddCustomText" -ForegroundColor Green 144 | Write-Host "$($unicodeString) $($AddCustomText)" -ForegroundColor Green 145 | } 146 | else { 147 | #Write-Host "┬────┴" -ForegroundColor Green 148 | Write-Host "$($unicodeString)" -ForegroundColor Green 149 | } 150 | 151 | #Write-Host "■" -NoNewline -ForegroundColor Green 152 | Write-Host "$( [char]::ConvertFromUtf32(0x25A0) )" -NoNewline -ForegroundColor Green 153 | Write-Host " KNX" 154 | Write-Host "" 155 | } 156 | 157 | function CheckForPrivileges { 158 | if ($IsWinEnv ) { 159 | if($CheckForAdminOnly) { 160 | if($Verbose) { Write-Host -ForegroundColor Yellow "- Checking if we are in Administrator privileges" } 161 | if( -not (Test-Administrator) ) { 162 | Write-Host -ForegroundColor Red "ERROR: Restore-Dependencies requires Administrator privileges to run!" 163 | Write-Host -ForegroundColor Red "- Please run the script again with Administrator privileges." 164 | exit 1 165 | } else { Write-Host -ForegroundColor Green "- The script is running with Administrator privileges." ([Char]0x221A) } 166 | } 167 | if($CheckForDeveloperMode) { 168 | if($Verbose) { Write-Host -ForegroundColor Yellow "- Checking if we are in Developer Mode" } 169 | if( -not (Test-DeveloperMode) ) { 170 | Write-Host -ForegroundColor Red "ERROR: Restore-Dependencies requires Developer Mode to run!" 171 | Write-Host -ForegroundColor Red "- Please run the script again with Developer Mode." 172 | Write-Host -ForegroundColor Red "- If you are using Windows `>10, you can enable Developer Mode by going to Settings `> Update `& Security `> For developers and selecting Developer mode." 173 | exit 1 174 | } else { Write-Host -ForegroundColor Green "- The script is running with Developer Mode." ([Char]0x221A) } 175 | } 176 | if(-not $Force_Use_mklink_To_Create_SymLinks -and $CheckForSymbolicLinkPermissions) { 177 | if($Verbose) { Write-Host -ForegroundColor Yellow "- Checking if we have permissions to create symbolic links" } 178 | if( -not (Test-SymbolicLinkPermission) ) { 179 | if($Auto_Use_mklink_To_Create_SymLinks) { 180 | $script:Force_Use_mklink_To_Create_SymLinks = $true 181 | Write-Host -ForegroundColor Yellow "- We have no permissions to create symbolic links with 'New-Item'. We will try to use mklink to create symbolic links." 182 | } else { 183 | Write-Host -ForegroundColor Red "ERROR: Restore-Dependencies requires permissions to create symbolic links to run!" 184 | Write-Host -ForegroundColor Red "- Please run the script again with Administrator privileges." 185 | exit 1 186 | } 187 | } else { Write-Host -ForegroundColor Green "- The script has permissions to create symbolic links." ([Char]0x221A) } 188 | } else { Write-Host -ForegroundColor Green "- We will use mklink to create symbolic links." ([Char]0x221A) } 189 | } 190 | } 191 | 192 | function CheckOS { 193 | # check on which os we are running 194 | # After check, the Os-Informations are availibe in the PS-Env. 195 | if ($PSVersionTable.PSVersion.Major -lt 6.0) { 196 | switch ($([System.Environment]::OSVersion.Platform)) { 197 | 'Win32NT' { 198 | New-Variable -Option Constant -Name IsWindows -Value $True -ErrorAction SilentlyContinue 199 | New-Variable -Option Constant -Name IsLinux -Value $false -ErrorAction SilentlyContinue 200 | New-Variable -Option Constant -Name IsMacOs -Value $false -ErrorAction SilentlyContinue 201 | } 202 | } 203 | } 204 | $script:IsLinuxEnv = (Get-Variable -Name "IsLinux" -ErrorAction Ignore) -and $IsLinux 205 | $script:IsMacOSEnv = (Get-Variable -Name "IsMacOS" -ErrorAction Ignore) -and $IsMacOS 206 | $script:IsWinEnv = !$IsLinuxEnv -and !$IsMacOSEnv 207 | 208 | $CurrentOS = switch($true) { 209 | $IsLinuxEnv { "Linux" } 210 | $IsMacOSEnv { "MacOS" } 211 | $IsWinEnv { "Windows" } 212 | default { "Unknown" } 213 | } 214 | $PSVersion = "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" 215 | if($true) { Write-Host -ForegroundColor Green "- We are on $CurrentOS Build Environment with PowerShell $PSVersion" ([Char]0x221A) } 216 | } 217 | function ProcessDependencies($DependenciesFile) { 218 | # Check if the file exists 219 | if (-not (Test-Path $DependenciesFile)) { 220 | Write-Host -ForegroundColor Red "The file $DependenciesFile does not exist." 221 | return $null 222 | } 223 | 224 | # Get the content of the file 225 | $dependencies = Get-Content $DependenciesFile 226 | 227 | # Process each line and filter out invalid ones 228 | $lineNumber = 0 229 | $dependedProjects = foreach ($line in $dependencies) { 230 | $lineNumber++ 231 | if ($line -notmatch '^-------' -and -not $line.StartsWith('#')) { 232 | $parts = $line -split ' ', 4 233 | if ($parts.Count -lt 4) { 234 | if($Verbose) { Write-Host -ForegroundColor DarkYellow "Dependencies: Error on line ${lineNumber}: Line does not have the expected format and will be skipped: $line" } 235 | } else { 236 | $hash, $branch, $folders, $urlParts = $parts 237 | $folders = $folders -split '/' 238 | $urlParts = $urlParts -split '#' 239 | $url = $urlParts[0] 240 | $branch = if($urlParts.Count -gt 1) { $urlParts[1] } else { $branch } 241 | # Extract the project name from the URL 242 | $urlParts = $url -split '/' 243 | $projectNameWithExtension = $urlParts[-1] 244 | # Assuming the project name is the same as the repository name, and considering the possibility of a .git extension to fix a 'dot' in the project name. 245 | # Get the index of the last dot in the string (.git) 246 | $lastDotPosition = $projectNameWithExtension.LastIndexOf('.') 247 | # Check if a dot was found 248 | if ($lastDotPosition -ge 0) { 249 | # Extract the substring without the last dot 250 | $projectName = $projectNameWithExtension.Substring(0, $lastDotPosition) 251 | } else { 252 | # No dot found, use the entire string as the project name! 253 | $projectName = $projectNameWithExtension 254 | } 255 | # Create a custom object for the project 256 | [PSCustomObject]@{ 257 | "Hash" = $hash 258 | "Branch" = $branch 259 | "Folder" = $folders 260 | "FolderCount" = $folders.Count 261 | "URL" = $url 262 | "ProjectName" = $projectName 263 | } 264 | } 265 | } 266 | } 267 | return $dependedProjects 268 | } 269 | function Get-ProjectFiles($subprojects) { 270 | # Initialize an empty array for the project files 271 | $projectFiles = @() 272 | 273 | # Loop through each subproject 274 | foreach ($subproject in $subprojects) { 275 | # Find and Get the project file 276 | $projectFile = $subproject | Select-Object BaseName 277 | if($Verbose) { Write-Host "- Get-ProjectFiles - Found existing project file: $($projectFile.BaseName)" -ForegroundColor Yellow } 278 | 279 | # Check if the file name is not "README" and is not empty 280 | if ($projectFile.BaseName -ne "README" -and ![string]::IsNullOrWhiteSpace($projectFile.BaseName)) { 281 | # Add the project file to the list 282 | $projectFiles += $projectFile 283 | } 284 | } 285 | 286 | # Return the list of project files 287 | return $projectFiles 288 | } 289 | function CloneRepository($projectFilesGitInfo, $dependedProjects, $CloneDir, $CloneModeHash= $false) { 290 | # Loop through each depended project 291 | if($CloneModeHash -and $Verbose) { Write-Host "- CloneRepository - Using hash" -ForegroundColor Green } 292 | foreach ($dependedProject in $dependedProjects) { 293 | # Initialize a flag to track if the project is found 294 | $hashMatch = $false 295 | $branchMatch = $false 296 | 297 | if($Verbose) { Write-Host "- CloneRepository - Check: '$($dependedProject.ProjectName)'" -ForegroundColor Green } 298 | # Loop through each project file's git information 299 | foreach ($projectFile in $projectFilesGitInfo) { 300 | # Check if projectFile contains valid data 301 | if (($null -ne $projectFile.BaseName -and $projectFile.BaseName -ne "") -and 302 | ($null -ne $dependedProject.ProjectName -and $dependedProject.ProjectName -ne "") -and 303 | ( $projectFile.BaseName -match $dependedProject.ProjectName) ) 304 | { 305 | if($Verbose) { Write-Host "- CloneRepository - Found: '$($dependedProject.ProjectName)' - '$($projectFile.Path)'" -ForegroundColor Green } 306 | #Compare the branches and hashes 307 | # Check if the branches match 308 | if (($null -ne $projectFile.TargetBranch -and $projectFile.TargetBranch -ne "") -and 309 | $projectFile.TargetBranch -eq $dependedProject.Branch) 310 | { 311 | # If the branches match, set the flag to true 312 | $branchMatch = $true 313 | if($Verbose) { Write-Host "- CloneRepository - Branch: '$($dependedProject.ProjectName)' - Both matches to ($($projectFile.TargetBranch))" -ForegroundColor Green } 314 | } 315 | # Check if the hashes match 316 | if (($null -ne $projectFile.TargetShortHash -and $null -ne $dependedProject.Hash) -and 317 | $projectFile.TargetShortHash -match $dependedProject.Hash) 318 | { 319 | # If the project is found, set the flag to true and break the loop 320 | $hashMatch = $true 321 | if($Verbose) { Write-Host "- CloneRepository - Hash: '$($dependedProject.ProjectName)' - Both matches to ($($projectFile.TargetShortHash))" -ForegroundColor Green } 322 | } 323 | if($branchMatch -and $hashMatch) { 324 | if($Verbose) { Write-Host "- CloneRepository - Found: "$dependedProject.ProjectName" - "$projectFile.Path -ForegroundColor Green } 325 | if($Verbose) { Write-Host "- CloneRepository - Branches and Hashes matching: '$($dependedProject.ProjectName)'" -ForegroundColor Green } 326 | break 327 | } 328 | break 329 | } 330 | } 331 | 332 | # If the project is not found, clone the repository 333 | if (-not $branchMatch -and -not $hashMatch) { 334 | # Create the Git clone URL with the URL and the Hash from the dependency 335 | $GitClone = ($dependedProject.URL).ToString() 336 | if($Verbose) { Write-Host "- CloneRepository - '$($dependedProject.ProjectName)' not Found. Target does not exist." -ForegroundColor DarkYellow } 337 | # Try to clone the repository 338 | try { 339 | if($IsWinEnv){ 340 | $CloneTarget = Join-Path $CloneDir $dependedProject.ProjectName 341 | } else { 342 | $CloneTarget = Join-Path -Path $CloneDir -ChildPath $dependedProject.ProjectName 343 | } 344 | if($Verbose) { Write-Host "- CloneRepository - CloneTarget: " $CloneTarget -ForegroundColor Green } 345 | if($Verbose) { Write-Host "- CloneRepository - Cloning '$($dependedProject.ProjectName)': '$GitClone' to '$CloneTarget'" -ForegroundColor Yellow } 346 | 347 | $DoClone= $true 348 | # Check if the folder already exists 349 | if (Test-Path $CloneTarget -PathType Container) { 350 | # Check if it's a Git repository (contains .git directory) 351 | if (Test-Path (Join-Path $CloneTarget ".git") -PathType Container) { 352 | if($Verbose) { Write-Host "- CloneRepository - Cloning: The target directory is already a Git repository." -ForegroundColor Yellow } 353 | $DoClone= $false 354 | } else { 355 | # The folder exists, but it's not a Git repository, so rename it 356 | if($true) { Write-Host "- CloneRepository - The directory already exists, but it's not a Git repository. Renaming..." -ForegroundColor Yellow } 357 | Rename-Item -Path $CloneTarget -NewName "${CloneTarget}_backup" -Force 358 | } 359 | } 360 | if($DoClone) { 361 | #Invoke-RestMethod -Uri $GitClone -Method Head -ErrorAction Stop; 362 | if($Verbose) { $GitCmd= "git clone '$($GitClone)' '$($CloneTarget.ToString())'" 363 | } else { $GitCmd= "git clone -q '$($GitClone)' '$($CloneTarget.ToString())'" } 364 | $exitCode = Invoke-Expression $($GitCmd+';$?') 365 | if (!$exitCode) { 366 | Write-Host "- CloneRepository - Failed Cloning "$dependedProject.ProjectName": '$GitClone' to '$CloneTarget' "([Char]0x2717) -ForegroundColor Red 367 | # exit 1 expected, but error-handling should be consistent 368 | # TODO: extend restore script error-handling and check for possible side-effects 369 | } 370 | #git clone -q '$GitClone' '$CloneTarget.ToString()' 371 | } 372 | 373 | if($true) { Write-Host "- CloneRepository - Cloned "$dependedProject.ProjectName": '$GitClone' to '$CloneTarget' "([Char]0x221A) -ForegroundColor Green } 374 | } 375 | # If the repository does not exist, catch the error 376 | catch { 377 | if($Verbose) { Write-Host "CloneRepository - Cloning Error: "$dependedProject.ProjectName"- Repository does not exist: "$GitClone -ForegroundColor DarkYellow } 378 | } 379 | } 380 | # If the project is found, check out to the specific branch 381 | if(-not $hashMatch -or -not $branchMatch) 382 | { 383 | if($Verbose) { Write-Host "- CloneRepository - Found: "$dependedProject.ProjectName" - "$dependedProject.URL -ForegroundColor Green } 384 | 385 | # If the repository already exists, switch to the corresponding branch 386 | $checkoutTarget = if ($CloneModeHash) { "Hash" } else { "Branch" } 387 | if($Verbose) { Write-Host "- CloneRepository -"$dependedProject.ProjectName"- Repository already exists. Checking out to the $($checkoutTarget)." -ForegroundColor Yellow } 388 | 389 | try { 390 | # Check the installed Git version 391 | if($IsWinEnv){ 392 | $CloneTarget = Join-Path $CloneDir $dependedProject.ProjectName 393 | $GitDir = Join-Path $CloneTarget ".git" 394 | } else { 395 | $CloneTarget = Join-Path -Path $CloneDir -ChildPath $dependedProject.ProjectName 396 | $GitDir = Join-Path -Path $CloneTarget -ChildPath ".git" 397 | } 398 | 399 | if($Verbose) { Write-Host "- CloneRepository - $($checkoutTarget) - GitDir: "$GitDir -ForegroundColor Yellow } 400 | $GitCmd = "git --git-dir=""$($GitDir)"" --work-tree=""$($CloneTarget.ToString())""" 401 | if($Verbose) { Write-Host "- CloneRepository - $($checkoutTarget) - GitCmd: "$GitCmd -ForegroundColor Yellow } 402 | 403 | if($CloneModeHash) { 404 | $CheckOutTarget = $($dependedProject.Hash) # Optional: If the CloneModeHash is true, use the Hash 405 | } else { 406 | $CheckOutTarget = $($dependedProject.Branch) # If the CloneModeHash is false (default), use the Branch 407 | } 408 | 409 | if ((& git --version) -ge 'git version 2.23' -and $CloneModeHash -eq $false ) { 410 | $CheckOutMethod = "switch" # If the Git version is 2.23 or higher, use the 'switch' command 411 | } else { 412 | $CheckOutMethod = "checkout" # If the Git version is 2.23 or higher, use the 'switch' command 413 | } 414 | 415 | # Let's do the git checkout 416 | if($Verbose) { 417 | Invoke-Expression "$GitCmd fetch --all" 418 | Invoke-Expression "$GitCmd $CheckOutMethod $($CheckOutTarget)" 419 | } else { 420 | Invoke-Expression "$GitCmd fetch --all -q" | Out-Null 421 | Invoke-Expression "$GitCmd $CheckOutMethod $($CheckOutTarget) -q" | Out-Null 422 | } 423 | 424 | if($true) { 425 | $checkoutTarget = if ($CloneModeHash) { "Hash '$($dependedProject.Hash)'" } else { "Branch '$($dependedProject.Branch)'" } 426 | Write-Host "- CloneRepository - '$($dependedProject.ProjectName)' $($checkoutTarget) Checked out."([Char]0x221A) -ForegroundColor Green 427 | } 428 | } 429 | # If cannot check out to the branch, catch the error 430 | catch { 431 | if($Verbose) { 432 | $checkoutTarget = if ($CloneModeHash) { "Hash '$($dependedProject.Hash)'" } else { "Branch '$($dependedProject.Branch)'" } 433 | Write-Host "- CloneRepository - $($dependedProject.ProjectName) - Checkout Error! Cannot checkout $($checkoutTarget)."([Char]0x2717) -ForegroundColor Red } 434 | } 435 | } 436 | 437 | # Repository exists and the correct branch or hash is already checked out 438 | # if freshly cloned or checkout, no action needed but when switched or correct branch was set, we need to pull last changes 439 | # if CloneMode Branch, check if the branch is up-to-date 440 | if (-not $CloneModeHash) 441 | { 442 | if($Verbose) { Write-Host "- CloneRepository - Pull: "$dependedProject.ProjectName" - "$dependedProject.URL -ForegroundColor Green } 443 | try{ 444 | if($IsWinEnv){ 445 | $CloneTarget = Join-Path $CloneDir $dependedProject.ProjectName 446 | $GitDir = Join-Path $CloneTarget ".git" 447 | } else { 448 | $CloneTarget = Join-Path -Path $CloneDir -ChildPath $dependedProject.ProjectName 449 | $GitDir = Join-Path -Path $CloneTarget -ChildPath ".git" 450 | } 451 | 452 | $GitCmd = "git --git-dir=""$($GitDir)"" --work-tree=""$($CloneTarget.ToString())""" 453 | 454 | if($Verbose) { 455 | Invoke-Expression "$GitCmd pull --ff-only" 456 | } else { 457 | Invoke-Expression "$GitCmd pull --ff-only -q" | Out-Null 458 | } 459 | } 460 | catch { 461 | if($Verbose) { 462 | Write-Host "- CloneRepository - $($dependedProject.ProjectName) - Pull Error!"([Char]0x2717) -ForegroundColor Red } 463 | } 464 | } 465 | } 466 | } 467 | function Get-GitInfo($path) { 468 | if ($IsWinEnv) { 469 | $TargetDir= (Join-Path $path ".git").ToString() 470 | } else { 471 | $TargetDir= (Join-Path -Path $path -ChildPath ".git").ToString() 472 | } 473 | if($Verbose) { Write-Host "GitInfo - TargetDir: "$TargetDir -ForegroundColor Yellow } 474 | if (Test-Path $TargetDir) { 475 | $ShortCommitHash = "git --git-dir ""$($TargetDir)"" log -1 --pretty=format:'%h'" 476 | $LongCommitHash = "git --git-dir ""$($TargetDir)"" log -1 --pretty=format:'%H'" 477 | $RemoteOriginURL = "git --git-dir ""$($TargetDir)"" config --get remote.origin.url" 478 | 479 | if($Verbose) { $ShortCommitHash= Invoke-Expression $ShortCommitHash } else { $ShortCommitHash= Invoke-Expression $ShortCommitHash | Out-Null } 480 | if($Verbose) { $LongCommitHash= Invoke-Expression $LongCommitHash } else { $LongCommitHash= Invoke-Expression $LongCommitHash | Out-Null } 481 | if($Verbose) { $RemoteOriginURL = Invoke-Expression $RemoteOriginURL } else { $RemoteOriginURL = Invoke-Expression $RemoteOriginURL | Out-Null } 482 | 483 | if($Verbose) { Write-Host "GitInfo - Found git repo in directory: $path" -ForegroundColor Green } 484 | 485 | return @{ 486 | ShortHash = $ShortCommitHash 487 | LongHash = $LongCommitHash 488 | RemoteURL = $RemoteOriginURL 489 | } 490 | } 491 | else { 492 | if($Verbose) { Write-Host "GitInfo - Not a git repo. Ignoring directory: $path" -ForegroundColor DarkYellow } 493 | return $null 494 | } 495 | } 496 | function CreateGitDependencyInfo($projectDir, $dependedProjects) { 497 | # Check if project files or project directory is null or empty 498 | if ( -not $projectDir -or -not $dependedProjects) { 499 | if($Verbose) { Write-Host "CreateGitDependencyInfo - Project files or project directory is null or empty." -ForegroundColor DarkYellow } 500 | return @() 501 | } 502 | # Iterate over each project file 503 | $projectDependedList = $dependedProjects | ForEach-Object { 504 | if( $IsWinEnv ){ 505 | $fullPath = Join-Path $projectDir $_.Folder[0] 506 | $fullPath = Join-Path $fullPath $_.Folder[1] 507 | $TargetPath = (Resolve-Path (Join-Path $projectDir '..') ).Path 508 | $TargetPath = (Join-Path $TargetPath $_.ProjectName).ToString() 509 | } 510 | else { 511 | $fullPath = Join-Path -Path $projectDir -ChildPath $_.Folder[0] -AdditionalChildPath $_.Folder[1] 512 | $TargetPath = (Join-Path -Path ((Resolve-Path (Join-Path $projectDir '..')).Path) -ChildPath $_.ProjectName).ToString() 513 | } 514 | 515 | # Get Git information for the current and target paths 516 | $TargetBranch = "" 517 | if (Test-Path (Join-Path $TargetPath ".git")) { 518 | if ($Verbose) { Write-Host "CreateGitDependencyInfo - GitInfo for target project: $($_.ProjectName)" -ForegroundColor Yellow } 519 | $gitInfo = Get-GitInfo $fullPath 520 | $targetGitInfo = Get-GitInfo $TargetPath 521 | if ($Verbose) { Write-Host "CreateGitDependencyInfo - getting the current branch of project: $($_.ProjectName)" -ForegroundColor Yellow } 522 | try { 523 | $gitDir = Join-Path -Path $TargetPath -ChildPath ".git" 524 | $TargetBranch = & git --git-dir $gitDir branch --show-current 525 | } catch { 526 | Write-Host "Failed to get the current branch of project: $($_.ProjectName)" -ForegroundColor Red 527 | } 528 | } else { 529 | if ($Verbose) { Write-Host "CreateGitDependencyInfo - Target project: $($_.ProjectName) is not a git repo." -ForegroundColor DarkYellow } 530 | } 531 | 532 | # Create a new PSObject with the git information and return it 533 | New-Object PSObject -Property @{ 534 | BaseName = $_.ProjectName 535 | Path = $fullPath 536 | Branch = $_.Branch 537 | ShortHash = $_.Hash 538 | LongHash = $gitInfo.LongHash 539 | RemoteURL = $_.URL 540 | TargetPath = $TargetPath 541 | TargetBranch = $TargetBranch 542 | TargetShortHash = $targetGitInfo.ShortHash 543 | TargetLongHash = $targetGitInfo.LongHash 544 | TargetRemoteURL = $targetGitInfo.RemoteURL 545 | } 546 | } 547 | return $projectDependedList 548 | } 549 | function CreateSymbolicLink ($projectDir, $projectFiles) { 550 | 551 | # Check if projectDir and projectFiles are not empty 552 | if (-not $projectDir -or -not $projectFiles) { 553 | if($Verbose) { Write-Host "- CreateSymbolicLink - Project directory or project files are empty." -ForegroundColor DarkYellow } 554 | return 555 | } 556 | foreach ($projectFile in $projectFiles) { 557 | $CreateSymLink = $true 558 | 559 | # Test if if a symbolic link exists 560 | if($Verbose) { Write-Host "- CreateSymbolicLink - Symbolic link test: $($projectFile.Path)" -ForegroundColor Yellow } 561 | if ($null -ne $projectFile.Path -and $projectFile.Path -ne '' -and (Test-Path $projectFile.Path)) { 562 | if ((Get-Item $projectFile.Path).Attributes.ToString().Contains("ReparsePoint")) { 563 | # Seems that there is a valid link. Now lets get the linked Target of it 564 | $targetPath = (Get-Item $projectFile.Path) 565 | if($DebugMsg) { write-output $targetPath } 566 | 567 | # Get the target of the symbolic link 568 | if($IsMacOS -or $IsLinux) { $symlink = $targetPath.target 569 | } else { $symlink = $targetPath.target[0] } 570 | 571 | if($Verbose) { Write-Host "- CreateSymbolicLink - Found Symbolic Link: $($symlink)"-ForegroundColor DarkYellow } 572 | 573 | # Now, lets create target link path 574 | $linkTarget = Join-Path $(Join-Path ".." "..") $projectFile.BaseName.ToString() 575 | 576 | # Check if we are on Windows and if we should use mklink to create the symbolic link 577 | if($IsWinEnv -and -not $Force_Use_mklink_To_Create_SymLinks) { 578 | $LinkTarget = Join-Path $(Split-Path -Path $projectDir -Parent) $ProjectFile.BaseName 579 | } 580 | 581 | # If the link target is the same as the project file name, set the CreateSymLink flag to false 582 | if ($symlink.ToString() -eq $linkTarget.ToString()) { 583 | if(!$ForceRecreateSymLinks) { Write-Host "- CreateSymbolicLink - '$($ProjectFile.BaseName)'- A existing and valid symbolic link detected. Skip linking."([Char]0x221A) -ForegroundColor Green } 584 | $CreateSymLink = $false 585 | } 586 | } 587 | } else { if (-not ($null -ne $projectFile.Path -and $projectFile.Path -ne '')) { $CreateSymLink = $false } } 588 | 589 | if($CreateSymLink -or $ForceRecreateSymLinks ) { 590 | # Create a symlink 591 | if($Verbose) { 592 | $Message= "- CreateSymbolicLink - '$($ProjectFile.BaseName)' - No valid symbolic link detected. Creating new symbolic link." 593 | if( $ForceRecreateSymLinks ) { 594 | $Message= "- CreateSymbolicLink - '$($ProjectFile.BaseName)' - Forcing to create new symbolic links." 595 | } 596 | Write-Host $Message -ForegroundColor Yellow 597 | } 598 | 599 | # Remove a existing symbolic link first 600 | if( ($ForceRecreateSymLinks -or ($null -ne $projectFile.Path -and $projectFile.Path -ne '')) -and 601 | (Test-Path $projectFile.Path) ) { 602 | 603 | if($Verbose -and $ForceRecreateSymLinks ) { 604 | $Message= "- CreateSymbolicLink - '$($ProjectFile.BaseName)' - Forcing to remove existing symbolic link: '$($projectFile.Path)'" 605 | Write-Host $Message -ForegroundColor Yellow 606 | } 607 | 608 | Remove-Item -Path $projectFile.Path -Force -Recurse 609 | if (!$?) { exit 1 } 610 | } 611 | if($DebugMsg) { write-output $ProjectFile } 612 | 613 | # Create the symbolic link to link the project file to the target 614 | $linkTarget = $ProjectFile.BaseName 615 | $linkValue = Join-Path $(Join-Path ".." "..") $linkTarget 616 | 617 | #The create smbolic link command 618 | $CreateSymLinkCommand = "New-Item -ItemType SymbolicLink -Path '$($projectFile.Path)' -Target '$($linkValue)'" 619 | 620 | # Check if we are on Windows and if we should use mklink command to create the symbolic link 621 | if($IsWinEnv) { 622 | if ( $Force_Use_mklink_To_Create_SymLinks) { 623 | $CreateSymLinkCommand = "cmd /C mklink /D ""$($projectFile.Path)"" ""$($linkValue)""" 624 | } else { 625 | $TargetLinkDir = Split-Path -Path $projectDir -Parent 626 | $linkValue = Join-Path $TargetLinkDir $ProjectFile.BaseName 627 | $CreateSymLinkCommand = "New-Item -ItemType SymbolicLink -Path '$($projectFile.Path)' -Target '$($linkValue)'" 628 | } 629 | } 630 | if($Verbose) { Write-Host "- CreateSymbolicLink - '$($ProjectFile.BaseName)' - CreateSymLinkCommand: $($CreateSymLinkCommand)" -ForegroundColor Yellow } 631 | 632 | # Try to create the symbolic link 633 | try { 634 | if($Verbose) { 635 | Invoke-Expression $CreateSymLinkCommand 636 | } else { 637 | Invoke-Expression $CreateSymLinkCommand | Out-Null 638 | } 639 | Write-Host "- CreateSymbolicLink - Symbolic link created at $($projectFile.Path) with target $linkValue"([Char]0x221A) -ForegroundColor Green 640 | } catch { 641 | Write-Host "Error creating symbolic link: $_" -ForegroundColor Red 642 | exit 1 643 | } 644 | } 645 | } 646 | } 647 | 648 | # Beispielaufruf der Funktion 649 | Clear-Host 650 | OpenKNX_ShowLogo -AddCustomText "Restore Dependencies" 651 | Write-Host "Starting to Restore depended projects..." -ForegroundColor Green 652 | 653 | CheckOS # check on which os we are running 654 | CheckForPrivileges # check for privileges, which are needed to run the script 655 | if($Verbose) { Write-Host -ForegroundColor Yellow "- We assume, we start this script in the project's 'restore' directory." } 656 | #Start-Sleep 30 657 | Set-Location .. # Go one directory back, to get the project dir. 658 | # Now we are in the project directory 659 | 660 | # Call the ProcessDependencies function and store the result in the $dependedProjects variable 661 | Write-Host -ForegroundColor Yellow "- Reading the dependencies.txt file and processing each line." 662 | $dependedProjects = ProcessDependencies $DependenciesFile 663 | if( $dependedProjects.Count -eq 0) { 664 | Write-Host -ForegroundColor Red "- No dependencies found in dependencies.txt file. Please check the file." 665 | exit 1 # exit with error 666 | } 667 | if($DebugMsg) { $dependedProjects | ForEach-Object { Write-Output $_ } } # Output each depended project 668 | 669 | # Call the Get-ProjectFiles function with the content of the 'lib' directory and store the result in the $projectFiles variable 670 | # Check if the 'lib' directory exists 671 | Write-Host -ForegroundColor Yellow "- Checking if the 'lib' directory exists." 672 | if (Test-Path 'lib') { 673 | # Call the Get-ProjectFiles function with the content of the 'lib' directory and store the result in the $projectFiles variable 674 | $projectFiles = Get-ProjectFiles (Get-ChildItem 'lib') 675 | } else { 676 | Write-Host -ForegroundColor DarkYellow "- The 'lib' directory was not found and will be created in 3 seconds..." 677 | Start-Sleep -Seconds 3 678 | New-Item -ItemType Directory -Path 'lib' | Out-Null 679 | $projectFiles = Get-ProjectFiles (Get-ChildItem 'lib') 680 | } 681 | 682 | #Write-Host "Project files:" 683 | if($DebugMsg) { $projectFiles | ForEach-Object { Write-Output $_ } } # Output each project file 684 | # Get the current location and store it in the $projectDir variable 685 | $projectDir = Get-Location 686 | 687 | # Call the CreateGitDependencyInfo function with the current location and the project files and store the result in the $projectFilesGitInfo variable 688 | Write-Host -ForegroundColor Yellow "- Creating git dependency information for each project file." 689 | $projectFilesGitInfo = CreateGitDependencyInfo $projectDir $dependedProjects 690 | if($DebugMsg) { $projectFilesGitInfo | ForEach-Object { Write-Output $_ } } 691 | # Output each project file's git information 692 | 693 | # Call the CloneRepository function with the project files' git information and the depended projects 694 | Write-Host -ForegroundColor Yellow "- Checking, cloning and rebranching the git repositories for each dependency." 695 | $CloneDir = (Resolve-Path (Join-Path $projectDir '..')).Path 696 | if($Verbose) { Write-Host $CloneDir } 697 | CloneRepository $projectFilesGitInfo $dependedProjects $CloneDir ($GitCheckoutMode -eq "Hash") 698 | 699 | 700 | if($Verbose) { Write-Host -ForegroundColor Yellow "- Checking and creating symbolic links for each project file." } 701 | CreateSymbolicLink $projectDir $projectFilesGitInfo 702 | OpenKNX_ShowLogo -AddCustomText "Restore Dependencies: Done $([Char]0x221A)" -------------------------------------------------------------------------------- /scripts/Build-IP.ps1: -------------------------------------------------------------------------------- 1 | # This script is just a template and has to be copied and modified per project 2 | # This script should be called from .vscode/tasks.json with 3 | # 4 | # scripts/Build-Release.ps1 - for Beta builds 5 | # scripts/Build-Release.ps1 Release - for Release builds 6 | # 7 | # { 8 | # "label": "Build-Release", 9 | # "type": "shell", 10 | # "command": "scripts/Build-Release.ps1 Release", 11 | # "args": [], 12 | # "problemMatcher": [], 13 | # "group": "test" 14 | # }, 15 | # { 16 | # "label": "Build-Beta", 17 | # "type": "shell", 18 | # "command": "scripts/Build-Release.ps1 ", 19 | # "args": [], 20 | # "problemMatcher": [], 21 | # "group": "test" 22 | # } 23 | 24 | 25 | 26 | # set product names, allows mapping of (devel) name in Project to a more consistent name in release 27 | # $settings = scripts/OpenKNX-Build-Settings.ps1 28 | 29 | # execute generic pre-build steps 30 | lib/OGM-Common/scripts/setup/reusable/Build-Release-Preprocess.ps1 $args[0] 31 | if (!$?) { exit 1 } 32 | 33 | # build firmware based on generated headerfile 34 | 35 | # build firmware for REG1_BASE_IP 36 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_REG1_BASE_IP firmware-REG1-BASE-IP uf2 37 | if (!$?) { exit 1 } 38 | 39 | # # TEMPORARY: We use our own generic updload files for this version 40 | # Copy-Item scripts/data/* release/data -Force 41 | 42 | # execute generic post-build steps 43 | lib/OGM-Common/scripts/setup/reusable/Build-Release-Postprocess.ps1 $args[0] 44 | if (!$?) { exit 1 } 45 | 46 | if (Test-Path -Path release-collection -PathType Container) { 47 | Copy-Item release/* release-collection/ 48 | } 49 | -------------------------------------------------------------------------------- /scripts/Build-Release-Package.ps1: -------------------------------------------------------------------------------- 1 | # This script should be called from .vscode/tasks.json with 2 | # { 3 | # "label": "Build-Release-Package", 4 | # "type": "shell", 5 | # "command": "scripts/Build-Release-Package.ps1", 6 | # "args": [ 7 | # ], 8 | # "problemMatcher": [], 9 | # "group": "test" 10 | # }, 11 | 12 | # check and cleanup working dir 13 | if (Test-Path -Path release-package) { 14 | # clean working dir 15 | Remove-Item -Recurse release-package\* 16 | } else { 17 | New-Item -Path release-package -ItemType Directory | Out-Null 18 | } 19 | 20 | # list here all release variants you want to release as a package 21 | scripts/Build-Release.ps1 Big 22 | if (!$?) { exit 1 } 23 | Copy-Item release/* release-package 24 | 25 | # scripts/Build-Release.ps1 Release 26 | # if (!$?) { exit 1 } 27 | # Copy-Item release/* release-package 28 | 29 | scripts/Build-IP.ps1 IP 30 | if (!$?) { exit 1 } 31 | Copy-Item release/* release-package 32 | 33 | Write-Host "Release package sucessfully created!" -------------------------------------------------------------------------------- /scripts/Build-Release.ps1: -------------------------------------------------------------------------------- 1 | # This script is just a template and has to be copied and modified per project 2 | # This script should be called from .vscode/tasks.json with 3 | # 4 | # scripts/Build-Release.ps1 - for Beta builds 5 | # scripts/Build-Release.ps1 Release - for Release builds 6 | # 7 | # { 8 | # "label": "Build-Release", 9 | # "type": "shell", 10 | # "command": "scripts/Build-Release.ps1 Release", 11 | # "args": [], 12 | # "problemMatcher": [], 13 | # "group": "test" 14 | # }, 15 | # { 16 | # "label": "Build-Beta", 17 | # "type": "shell", 18 | # "command": "scripts/Build-Release.ps1 ", 19 | # "args": [], 20 | # "problemMatcher": [], 21 | # "group": "test" 22 | # } 23 | 24 | $releaseIndication = $args[0] 25 | 26 | # set product names, allows mapping of (devel) name in Project to a more consistent name in release 27 | # $settings = scripts/OpenKNX-Build-Settings.ps1 28 | 29 | # execute generic pre-build steps 30 | lib/OGM-Common/scripts/setup/reusable/Build-Release-Preprocess.ps1 $args[0] 31 | if (!$?) { exit 1 } 32 | 33 | if (Test-Path -Path scripts/data -PathType Container) { 34 | Copy-Item scripts/data/* release/data/ 35 | if (!$?) { exit 1 } 36 | } 37 | 38 | # build firmware based on generated headerfile for RP2040 39 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_RP2040_devel firmware-DeveloperBoard uf2 DeveloperBoard-JustForTesters 40 | if (!$?) { exit 1 } 41 | 42 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_PiPico_BCU_Connector firmware-PiPico-BCU-Connector uf2 43 | if (!$?) { exit 1 } 44 | 45 | # build firmware for 1TE-RP2040-SmartMF 46 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_1TE_RP2040_SmartMF firmware-1TE-RP2040-SmartMF uf2 47 | if (!$?) { exit 1 } 48 | 49 | # build firmware for OpenKNX-REG1-Base-V0 50 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_OpenKNX_REG1_BASE_V0 firmware-OpenKNX-REG1-BASE-V0 uf2 51 | if (!$?) { exit 1 } 52 | 53 | # build firmware for OpenKNX-REG1-Base-V1 54 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_OpenKNX_REG1_BASE_V1 firmware-OpenKNX-REG1-BASE-V1 uf2 55 | if (!$?) { exit 1 } 56 | 57 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_RealPresence firmware-RealPresence uf2 58 | if (!$?) { exit 1 } 59 | 60 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_RealPresence_v20 firmware-RealPresence_v2.0 uf2 61 | if (!$?) { exit 1 } 62 | 63 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_Sensormodul_v40_RP2040 firmware-Sensormodul-v4x-RP2040 uf2 64 | if (!$?) { exit 1 } 65 | 66 | if ($releaseIndication -eq "Release") { 67 | # build firmware based on generated headerfile for SAMD 68 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_Sensormodul_v31_SAMD firmware-Sensormodul-v31-SAMD bin 69 | if (!$?) { exit 1 } 70 | 71 | lib/OGM-Common/scripts/setup/reusable/Build-Step.ps1 release_Sensormodul_v30_SAMD firmware-Sensormodul-v30-SAMD bin 72 | if (!$?) { exit 1 } 73 | } 74 | # execute generic post-build steps 75 | lib/OGM-Common/scripts/setup/reusable/Build-Release-Postprocess.ps1 $args[0] 76 | if (!$?) { exit 1 } 77 | 78 | if (Test-Path -Path release-collection -PathType Container) { 79 | Copy-Item release/* release-collection/ 80 | } 81 | -------------------------------------------------------------------------------- /scripts/OpenKNX-Build-Settings.ps1: -------------------------------------------------------------------------------- 1 | 2 | # set product names, allows mapping of (devel) name in Project to a more consistent name in release 3 | $settings = lib/OGM-Common/scripts/build/OpenKNX-Build-Settings.ps1 $args[0] "PMmodul" "PresenceModule" 4 | 5 | # $settings.sourceName="PMmodul" 6 | # $settings.targetName="PresenceModule" 7 | # $settings.knxprod="src/{0}.h" -f $settings.sourceName 8 | # $settings.hardware="src/{0}Hardware.h" -f $settings.sourceName 9 | 10 | Return $settings -------------------------------------------------------------------------------- /scripts/OpenKNX-Build.ps1: -------------------------------------------------------------------------------- 1 | lib/OGM-Common/scripts/build/OpenKNX-Build.ps1 $args[0] $args[1] -------------------------------------------------------------------------------- /scripts/Readme-Hardware.html: -------------------------------------------------------------------------------- 1 |

Unterstützte Hardware

2 |

Die Software für dieses Release wurde auf folgender Hardware getestet und läuft damit "out-of-the-box":

3 |
    4 |
  • Smart-MF Sensormodul 4.x www.smart-mf.de, als virtueller 5 | Präsenzmelder, um die Applikationen von alten oder unzuverlässigen Präsenzmeldern zu verbessern
  • 6 |
  • PiPico-BCU-Connector OpenKNX-Wiki, als virtueller 8 | Präsenzmelder
  • 9 |
  • 1TE-RP2040-Smart-MF www.smart-mf.de, als virtueller 10 | Präsenzmelder auf allen Varianten lauffähig
  • 11 |
  • OpenKNX-UP1-System OpenKNX-Wiki, als virtueller Präsenzmelder 13 | auf allen Varianten lauffähig
  • 14 |
  • OpenKNX-REG1-System OpenKNX-Wiki, als virtueller Präsenzmelder 16 | auf allen Varianten lauffähig
  • 17 |
  • Smart-MF RealPresence www.smart-mf.de, als vollständiger 18 | Präsenzmelder, der auch Personen ohne Bewegung zuverlässig erkennt.
  • 19 |
20 |

Andere Hardware kann genutzt werden, jedoch muss das Projekt dann neu compiliert werden. Alle notwendigen Teile für 21 | ein Aufsetzen der Build-Umgebung inclusive aller notwendigen Projekte finden sich im OpenKNX-Projekt

23 |

Interessierte sollten auch die Beiträge im OpenKNX-Forum studieren.

-------------------------------------------------------------------------------- /scripts/Readme-Hardware.md: -------------------------------------------------------------------------------- 1 | # Unterstützte Hardware 2 | 3 | Die Software für dieses Release wurde auf folgender Hardware getestet und läuft damit "out-of-the-box": 4 | 5 | * **Smart-MF Sensormodul 4.x** [www.smart-mf.de](https://www.smart-mf.de), als virtueller Präsenzmelder, um die Applikationen von alten oder unzuverlässigen Präsenzmeldern zu verbessern 6 | * **PiPico-BCU-Connector** [OpenKNX-Wiki](https://github.com/OpenKNX/OpenKNX/wiki/PiPico-BCU-Connector), als virtueller Präsenzmelder 7 | * **1TE-RP2040-Smart-MF** [www.smart-mf.de](https://www.smart-mf.de), als virtueller Präsenzmelder auf allen Varianten lauffähig 8 | * **OpenKNX-UP1-System** [OpenKNX-Wiki](https://github.com/OpenKNX/OpenKNX/wiki/OpenKNX-UP1), als virtueller Präsenzmelder auf allen Varianten lauffähig 9 | * **OpenKNX-REG1-System** [OpenKNX-Wiki](https://github.com/OpenKNX/OpenKNX/wiki/OpenKNX-REG1), als virtueller Präsenzmelder auf allen Varianten lauffähig 10 | * **Smart-MF RealPresence** [www.smart-mf.de](https://www.smart-mf.de), als vollständiger Präsenzmelder, der auch Personen ohne Bewegung zuverlässig erkennt. 11 | 12 | Andere Hardware kann genutzt werden, jedoch muss das Projekt dann neu compiliert werden. Alle notwendigen Teile für ein Aufsetzen der Build-Umgebung inclusive aller notwendigen Projekte finden sich im [OpenKNX-Projekt](https://github.com/OpenKNX) 13 | 14 | Interessierte sollten auch die Beiträge im [OpenKNX-Forum](https://knx-user-forum.de/forum/projektforen/openknx) studieren. 15 | -------------------------------------------------------------------------------- /src/PMmodul-Big.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 20 | 21 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 37 | 38 | 39 | 40 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/PMmodul-IP.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 22 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 52 | 53 | 54 | 55 | 61 | 62 | 63 | 64 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/PMmodul-Release.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 18 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 36 | 37 | 38 | 39 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/PMmodul-VirtualButton.link.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/PMmodul.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/PMmodul.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 21 | 22 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 47 | 48 | 49 | 50 | 56 | 57 | 58 | 59 | 65 | 66 | 67 | 68 | 69 | 80 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Logic.h" 2 | #include "Presence.h" 3 | #include "SensorDevices.h" 4 | #ifdef ARDUINO_ARCH_RP2040 5 | #include "FileTransferModule.h" 6 | #include "UsbExchangeModule.h" 7 | #include "VirtualButtonModule.h" 8 | #if defined(KNX_IP_LAN) || defined(KNX_IP_WIFI) 9 | #include "NetworkModule.h" 10 | #endif 11 | #endif 12 | #include "OpenKNX.h" 13 | 14 | #ifdef ARDUINO_ARCH_RP2040 15 | #pragma message "Pico Core Version: " ARDUINO_PICO_VERSION_STR 16 | #endif 17 | #include "hardware.h" 18 | 19 | #include "Sensor.h" 20 | 21 | void setup() 22 | { 23 | const uint8_t firmwareRevision = 2; 24 | 25 | #ifdef ARDUINO_ARCH_RP2040 26 | #ifdef I2C_WIRE 27 | I2C_WIRE.setSDA(I2C_SDA_PIN); 28 | I2C_WIRE.setSCL(I2C_SCL_PIN); 29 | openknxSensorDevicesModule.defaultWire(I2C_WIRE); 30 | #endif 31 | #endif 32 | openknx.init(firmwareRevision); 33 | openknx.addModule(1, openknxLogic); 34 | openknx.addModule(2, openknxPresenceModule); 35 | openknx.addModule(4, openknxSensorDevicesModule); 36 | #ifdef ARDUINO_ARCH_RP2040 37 | openknx.addModule(5, openknxVirtualButtonModule); 38 | openknx.addModule(3, openknxFileTransferModule); 39 | openknx.addModule(8, openknxUsbExchangeModule); 40 | #if defined(KNX_IP_LAN) || defined(KNX_IP_WIFI) 41 | openknx.addModule(7, openknxNetwork); 42 | #endif 43 | #endif 44 | openknx.setup(); 45 | } 46 | 47 | void loop() 48 | { 49 | openknx.loop(); 50 | } 51 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | --------------------------------------------------------------------------------