Skip to content

Commit

Permalink
deploy: 5bca4b1
Browse files Browse the repository at this point in the history
  • Loading branch information
cziter15 committed Jun 13, 2024
1 parent dcf5890 commit 4009014
Show file tree
Hide file tree
Showing 35 changed files with 154 additions and 84 deletions.
18 changes: 11 additions & 7 deletions doxygen_crawl.html
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@
<a href="index.html#autotoc_md16"/>
<a href="index.html#autotoc_md17"/>
<a href="index.html#autotoc_md18"/>
<a href="index.html#autotoc_md3"/>
<a href="index.html#autotoc_md4"/>
<a href="index.html#autotoc_md5"/>
<a href="index.html#autotoc_md6"/>
<a href="index.html#autotoc_md19"/>
<a href="index.html#autotoc_md20"/>
<a href="index.html#autotoc_md21"/>
<a href="index.html#autotoc_md22"/>
<a href="index.html#autotoc_md7"/>
<a href="index.html#autotoc_md8"/>
<a href="index.html#autotoc_md9"/>
Expand Down Expand Up @@ -479,10 +479,14 @@
<a href="ks_wifi_connector_8h_source.html"/>
<a href="md_examples_2readme.html"/>
<a href="md_examples_2readme.html#autotoc_md1"/>
<a href="md_examples_2readme.html#autotoc_md2"/>
<a href="md_examples_2readme.html#autotoc_md3"/>
<a href="md_examples_2readme.html#autotoc_md4"/>
<a href="md_examples_2readme.html#autotoc_md5"/>
<a href="md_tutorials_2readme.html"/>
<a href="md_tutorials_2readme.html#autotoc_md20"/>
<a href="md_tutorials_2readme.html#autotoc_md21"/>
<a href="md_tutorials_2readme.html#autotoc_md22"/>
<a href="md_tutorials_2readme.html#autotoc_md24"/>
<a href="md_tutorials_2readme.html#autotoc_md25"/>
<a href="md_tutorials_2readme.html#autotoc_md26"/>
<a href="ota_webpage_8h_source.html"/>
<a href="structksf_1_1comps_1_1ks_config_parameter.html"/>
</body>
Expand Down
32 changes: 16 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,23 @@
<p><a href="https://cziter15.github.io/ksIotFrameworkLib"><img src="https://img.shields.io/badge/Doxygen-2C4AA8?logo=doxygen&amp;style=for-the-badge" alt="Read the documentation" class="inline"/></a> <a href="https://github.com/cziter15/ksIotFrameworkLib/blob/master/LICENSE"><img src="https://img.shields.io/github/license/cziter15/ksIotFrameworkLib?style=for-the-badge" alt="License" class="inline"/></a></p>
<p><a href="https://platformio.org"><img src="https://img.shields.io/badge/works%20best%20with-PlatformIO-orange?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTEyOCAwQzkzLjgxIDAgNjEuNjY2IDEzLjMxNCAzNy40OSAzNy40OSAxMy4zMTQgNjEuNjY2IDAgOTMuODEgMCAxMjhjMCAzNC4xOSAxMy4zMTQgNjYuMzM0IDM3LjQ5IDkwLjUxQzYxLjY2NiAyNDIuNjg2IDkzLjgxIDI1NiAxMjggMjU2YzM0LjE5IDAgNjYuMzM0LTEzLjMxNCA5MC41MS0zNy40OUMyNDIuNjg2IDE5NC4zMzQgMjU2IDE2Mi4xOSAyNTYgMTI4YzAtMzQuMTktMTMuMzE0LTY2LjMzNC0zNy40OS05MC41MUMxOTQuMzM0IDEzLjMxNCAxNjIuMTkgMCAxMjggMCIgZmlsbD0iI0ZGN0YwMCIvPjxwYXRoIGQ9Ik0yNDkuMzg2IDEyOGMwIDY3LjA0LTU0LjM0NyAxMjEuMzg2LTEyMS4zODYgMTIxLjM4NkM2MC45NiAyNDkuMzg2IDYuNjEzIDE5NS4wNCA2LjYxMyAxMjggNi42MTMgNjAuOTYgNjAuOTYgNi42MTQgMTI4IDYuNjE0YzY3LjA0IDAgMTIxLjM4NiA1NC4zNDYgMTIxLjM4NiAxMjEuMzg2IiBmaWxsPSIjRkZGIi8+PHBhdGggZD0iTTE2MC44N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TAuMjY3IDEwLjMxN0w5NS44IDc0LjM3OGMtMTkuNjA5IDYuNTEtNDAuODg1IDIwLjc0Mi00MC44ODUgNTEuODguNDM2IDQ1LjAxIDU5LjU3MiA4NS4yNjcgNzMuMTg2IDg1LjI2N1Y2OC44OTJzLTEyLjI1Mi0uMDYyLTI2LjcyOSAzLjgxN3ptMTAuMzk1IDkyLjA5Yy04LjEzOCAxMC4yLTUyLjczNS0yNS44OC00NS4xNTQtNTEuNjQ1IDMuMDAyLTEyLjE0NSAxMy4xOS0xNy42MTIgMjEuNTExLTE2LjI4IDMwLjM1IDYuMTc1IDM1LjI2IDQ5LjM2OSAyMy42NDMgNjcuOTI2em0tMTguODItMzkuNDZhOS4zOTkgOS4zOTkgMCAwIDAtOS4zOTkgOS4zOTggOS4zOTkgOS4zOTkgMCAwIDAgOS40IDkuNCA5LjM5OSA5LjM5OSAwIDAgMCA5LjM5OC05LjQgOS4zOTkgOS4zOTkgMCAwIDAtOS4zOTktOS4zOTl6bS0yLjgxIDguNjcxYTIuMzc0IDIuMzc0IDAgMSAxIDAtNC43NDggMi4zNzQgMi4zNzQgMCAwIDEgMCA0Ljc0OHoiIGZpbGw9IiNGRjdGMDAiLz48L3N2Zz4=" alt="Build for PlatformIO" class="inline"/></a> <a href="https://hitsofcode.com/github/cziter15/ksIotFrameworkLib/view"><img src="https://hitsofcode.com/github/cziter15/ksIotFrameworkLib" alt="Hits-of-Code" class="inline"/></a> <a href="https://github.com/cziter15/ksIotFrameworkLib/commits/master"><img src="https://img.shields.io/github/commit-activity/m/cziter15/ksIotFrameworkLib" alt="Commit activity" class="inline"/></a></p>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/a17e4fe9-144c-4422-be40-90e0f402b054" alt="image" class="inline"/></p>
<h1><a class="anchor" id="autotoc_md3"></a>
<h1><a class="anchor" id="autotoc_md7"></a>
🌱 Motivation</h1>
<ul>
<li>The goal of this project is to create a simple template or starting point to develop IoT applications using Espressif microcontrollers.</li>
<li>I was frequently copying and modifying source code for different devices and this is an attempt to streamline this process.</li>
</ul>
<h1><a class="anchor" id="autotoc_md4"></a>
<h1><a class="anchor" id="autotoc_md8"></a>
📚 Doxygen</h1>
<ul>
<li>Detailed documentation can be found on <a href="https://cziter15.github.io/ksIotFrameworkLib">here</a>.</li>
</ul>
<h1><a class="anchor" id="autotoc_md5"></a>
<h1><a class="anchor" id="autotoc_md9"></a>
🔎 Examples</h1>
<ul>
<li>Soome people prefer to learn by example. In this, open the [examples directory](examples).</li>
</ul>
<h1><a class="anchor" id="autotoc_md6"></a>
<h1><a class="anchor" id="autotoc_md10"></a>
ℹ️ Architecture</h1>
<div class="fragment"><div class="line">flowchart TD</div>
<div class="line"> AppState{AppState}</div>
Expand Down Expand Up @@ -146,23 +146,23 @@ <h1><a class="anchor" id="autotoc_md6"></a>
<li>Each component has init, postInit, and loop methods.</li>
<li>Components can be marked for removal, and they will be safely released in the next tick.</li>
</ul>
<h1><a class="anchor" id="autotoc_md7"></a>
<h1><a class="anchor" id="autotoc_md11"></a>
📏 Utilities</h1>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/1b144cdf-e345-4865-8ae7-92f0eaf31992" alt="image" class="inline"/></p>
<h1><a class="anchor" id="autotoc_md8"></a>
<h1><a class="anchor" id="autotoc_md12"></a>
🔨 Components</h1>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/c27aba37-4e54-49f5-9ad5-97439e7baf33" alt="image" class="inline"/></p>
<h2><a class="anchor" id="autotoc_md9"></a>
<h2><a class="anchor" id="autotoc_md13"></a>
🔅 Rules:</h2>
<ul>
<li>Components should be added in the app's <b>init</b> method, so they will be available for <b>postInit</b> methods. (you can add them later, in loop() but that's another case)</li>
<li>The <b>init</b> method is the best place to add dependent components, setup initial pin values etc.</li>
<li>The <b>postInit</b> method is the best place to obtain a weak pointer to another component by calling <b>findComponent</b>. This will handle cases when other components were added via init method.</li>
</ul>
<h1><a class="anchor" id="autotoc_md10"></a>
<h1><a class="anchor" id="autotoc_md14"></a>
🌱 Building the application</h1>
<p>To build an application, simply create a new class inherited from ksApplication and add your initial components inside the init method. See projects like <b>emon_fw</b> for reference.</p>
<h2><a class="anchor" id="autotoc_md11"></a>
<h2><a class="anchor" id="autotoc_md15"></a>
🔎 How does it work under the hood?</h2>
<ul>
<li>The application is created, followed by the invocation of its init() method. If false is returned from the init method, the subsequent execution of the loop will be skipped, resulting in no iteration over the components. The App Rotator will then try to run next apllication.</li>
Expand Down Expand Up @@ -195,42 +195,42 @@ <h2><a class="anchor" id="autotoc_md11"></a>
<div class="line"> <span class="comment">/* Application finished initialization, return true as it succedeed. */</span></div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md12"></a>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md16"></a>
🔁 Application rotator</h1>
<p>The library implements one very useful utility named ksAppRotator. This object can wrap application instantiation logic into something like carousel or rotator.</p>
<p>Typically the device hosts two applications. First application is running core device logic while the second one is dedicated to help the user with the device configuration.</p>
<p>Each application has it's own loop method taking care of all underlying logic. In case of fail (which can happen anytime, even when creating the application object), the rotator will spawn next application and start processing it's logic until fail or break.</p>
<p>This is very flexible, because you can even raise fail (false) from application's init method and then go directly into the configuration mode (for example there's no WiFi credentials provided by the user).</p>
<h1><a class="anchor" id="autotoc_md13"></a>
<h1><a class="anchor" id="autotoc_md17"></a>
🔣 Compiler flags</h1>
<ul>
<li>Bare Arduino projects need to have <code>gnu++2a</code> enabled via <code>compiler.cpp.extra_flags=</code> option in the <code>board.txt</code> file.</li>
</ul>
<h1><a class="anchor" id="autotoc_md14"></a>
<h1><a class="anchor" id="autotoc_md18"></a>
#️⃣ Custom RTTI</h1>
<ul>
<li>Use the KSF_RTTI_DECLARATIONS macro to provide proper runtime type information generation for proper casting of components.</li>
<li>See <a class="el" href="ks_config_provider_8h_source.html">ksConfigProvider.h</a> for an example. Your application components should use this macro, otherwise the component finding mechanism won't work.</li>
</ul>
<h1><a class="anchor" id="autotoc_md15"></a>
<h1><a class="anchor" id="autotoc_md19"></a>
🔥 Saving power</h1>
<ul>
<li>By default, this framework supports enables power saving for the modem.</li>
<li>Automatic modem sleep requires the DTIM to be set on the access point.</li>
<li>The best value for was 3. It allows the ESP32 to go down from around 100mA to 20mA.</li>
</ul>
<h1><a class="anchor" id="autotoc_md16"></a>
<h1><a class="anchor" id="autotoc_md20"></a>
📑 Dependencies</h1>
<ul>
<li><b>It is highly recommended to use PlatformIO as it will automatically download dependencies!</b></li>
</ul>
<h2><a class="anchor" id="autotoc_md17"></a>
<h2><a class="anchor" id="autotoc_md21"></a>
🔡 Frameworks</h2>
<ul>
<li>Arduino for ESP32 [ <a href="https://github.com/espressif/arduino-esp32">https://github.com/espressif/arduino-esp32</a> ]</li>
<li>Arduino for ESP8266 [ <a href="https://github.com/esp8266/Arduino">https://github.com/esp8266/Arduino</a> ]</li>
</ul>
<h2><a class="anchor" id="autotoc_md18"></a>
<h2><a class="anchor" id="autotoc_md22"></a>
🔡 Libraries</h2>
<ul>
<li>PubSubClient [ <a href="https://github.com/knolleary/pubsubclient">https://github.com/knolleary/pubsubclient</a> ]</li>
Expand Down
68 changes: 67 additions & 1 deletion md_examples_2readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,74 @@
<div class="headertitle"><div class="title">Examples</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="autotoc_md0"></a>This is a directory that contains aplplication examples.</p>
<div class="textblock"><p><a class="anchor" id="autotoc_md0"></a>In this directory, you will find examples that guide you through building various firmware applications.</p>
<p><b>Before you start, read this page to ensure you are familiar with PlatformIO and have the correct IDE setup.</b></p>
<h1><a class="anchor" id="autotoc_md1"></a>
IDE Preparation</h1>
<p><b>When using PlatformIO, no additional setup is required, and you don't need to install the Arduino IDE separately. This library can be used with the Arduino IDE, though it may be suboptimal.</b></p>
<ul>
<li><a href="https://code.visualstudio.com/">Download and install official Microsoft Visual Studio Code</a>. PlatformIO IDE is built on top of it.</li>
<li>Open the extension manager.</li>
<li>Search for the official <code>platformio ide</code> extension.</li>
<li>Install PlatformIO IDE extension.</li>
</ul>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/18dfb3a2-866c-4308-a197-5a90bbb13b90" alt="image" class="inline"/></p>
<h1><a class="anchor" id="autotoc_md2"></a>
Opening existing projects</h1>
<ul>
<li>If properly configured, the project should contain a <code>platformio.ini</code> file in its main directory.</li>
<li>To open a project, use the <code>Open Folder</code> option from the File menu.</li>
<li>Dependencies will be automatically installed, which may take some time.</li>
</ul>
<h1><a class="anchor" id="autotoc_md3"></a>
Creating your first application</h1>
<ol type="1">
<li>Open PlatformIO UI.</li>
<li>Click on <code>New project</code>, and select your ESP version. Then click <code>Finish</code>.</li>
</ol>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/494565fa-4753-446c-a18e-c903626637a3" alt="image" class="inline"/></p>
<ol type="1">
<li>Open the <code>platformio.ini</code> file:</li>
</ol>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/1d882165-c64f-40a6-addb-36141837c5dc" alt="image" class="inline"/></p>
<ol type="1">
<li>Add the following code and save the file: <div class="fragment"><div class="line"># Define library dependencies.</div>
<div class="line">lib_deps = </div>
<div class="line"> ksIotFrameworkLib=https://github.com/cziter15/ksIotFrameworkLib</div>
</div><!-- fragment --></li>
<li>Platformio will download required dependencies. Please be patient as it may take some time.</li>
<li>Now open <code>main.cpp</code> file and replace the code with the following listing and save the file. <div class="fragment"><div class="line"><span class="preprocessor">#include &lt;ksIotFrameworkLib.h&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">class </span>MyApplication : <span class="keyword">public</span> <a class="code hl_class" href="classksf_1_1ks_application.html">ksf::ksApplication</a></div>
<div class="line">{</div>
<div class="line"> <span class="keyword">public</span>:</div>
<div class="line"> <span class="keywordtype">bool</span> <a class="code hl_function" href="classksf_1_1ks_application.html#ae0df7f797abc4f477f17448aa89613ce">init</a>()<span class="keyword"> override </span></div>
<div class="line"><span class="keyword"> </span>{</div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"> }</div>
<div class="line"> <span class="keywordtype">bool</span> <a class="code hl_function" href="classksf_1_1ks_application.html#a5f4246bf46d16e6469b3967d399c7cd3">loop</a>()<span class="keyword"> override </span></div>
<div class="line"><span class="keyword"> </span>{</div>
<div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"> }</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line">KSF_IMPLEMENT_APP_ROTATOR</div>
<div class="line">(</div>
<div class="line"> MyApplication</div>
<div class="line">)</div>
<div class="ttc" id="aclassksf_1_1ks_application_html"><div class="ttname"><a href="classksf_1_1ks_application.html">ksf::ksApplication</a></div><div class="ttdoc">A class that is a base for user-defined application.</div><div class="ttdef"><b>Definition</b> ksApplication.h:43</div></div>
<div class="ttc" id="aclassksf_1_1ks_application_html_a5f4246bf46d16e6469b3967d399c7cd3"><div class="ttname"><a href="classksf_1_1ks_application.html#a5f4246bf46d16e6469b3967d399c7cd3">ksf::ksApplication::loop</a></div><div class="ttdeci">virtual bool loop()</div><div class="ttdoc">Executes application logic loop.</div><div class="ttdef"><b>Definition</b> ksApplication.cpp:15</div></div>
<div class="ttc" id="aclassksf_1_1ks_application_html_ae0df7f797abc4f477f17448aa89613ce"><div class="ttname"><a href="classksf_1_1ks_application.html#ae0df7f797abc4f477f17448aa89613ce">ksf::ksApplication::init</a></div><div class="ttdeci">virtual bool init()=0</div><div class="ttdoc">Initializes application.</div></div>
</div><!-- fragment --></li>
<li>Now you are able to build the application stub.</li>
</ol>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/afac0511-cf68-4007-ba89-b2902cabca6c" alt="image" class="inline"/></p>
<ol type="1">
<li>Now all that's left to do is implement the components and logic of your device.</li>
</ol>
<h1><a class="anchor" id="autotoc_md4"></a>
Examples</h1>
<h1><a class="anchor" id="autotoc_md5"></a>
[basic-config](basic-config)</h1>
<p>This application demonstrates how create most typical application stack. One ksApplication is responsible for device logic and the another is the application that is used to configure the device. </p>
</div></div><!-- contents -->
Expand Down
8 changes: 4 additions & 4 deletions md_tutorials_2readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
<div class="headertitle"><div class="title">Tutorials</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="autotoc_md19"></a>In this directory, you will find step-by-step tutorials that guide you through building various firmware applications.</p>
<div class="textblock"><p><a class="anchor" id="autotoc_md23"></a>In this directory, you will find step-by-step tutorials that guide you through building various firmware applications.</p>
<p><b>Before you start, read this page to ensure you are familiar with PlatformIO and have the correct IDE setup.</b></p>
<h1><a class="anchor" id="autotoc_md20"></a>
<h1><a class="anchor" id="autotoc_md24"></a>
IDE Preparation</h1>
<p><b>When using PlatformIO, no additional setup is required, and you don't need to install the Arduino IDE separately. This library can be used with the Arduino IDE, though it may be suboptimal.</b></p>
<ul>
Expand All @@ -99,14 +99,14 @@ <h1><a class="anchor" id="autotoc_md20"></a>
<li>Install PlatformIO IDE extension.</li>
</ul>
<p><img src="https://github.com/cziter15/ksIotFrameworkLib/assets/5003708/18dfb3a2-866c-4308-a197-5a90bbb13b90" alt="image" class="inline"/></p>
<h1><a class="anchor" id="autotoc_md21"></a>
<h1><a class="anchor" id="autotoc_md25"></a>
Opening existing projects</h1>
<ul>
<li>If properly configured, the project should contain a <code>platformio.ini</code> file in its main directory.</li>
<li>To open a project, use the <code>Open Folder</code> option from the File menu.</li>
<li>Dependencies will be automatically installed, which may take some time.</li>
</ul>
<h1><a class="anchor" id="autotoc_md22"></a>
<h1><a class="anchor" id="autotoc_md26"></a>
Creating your first application</h1>
<ol type="1">
<li>Open PlatformIO UI.</li>
Expand Down
Loading

0 comments on commit 4009014

Please sign in to comment.