{"id":6397,"date":"2025-01-26T17:57:29","date_gmt":"2025-01-26T16:57:29","guid":{"rendered":"https:\/\/arduino.net.pl\/?p=6397"},"modified":"2025-01-26T22:28:16","modified_gmt":"2025-01-26T21:28:16","slug":"ota-dla-mikroprocesorow-tutorial","status":"publish","type":"post","link":"https:\/\/arduino.net.pl\/index.php\/ota-dla-mikroprocesorow-tutorial\/","title":{"rendered":"OTA dla mikroprocesor\u00f3w, tutorial"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Kolejno\u015b\u0107 dzia\u0142a\u0144<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tworzymy folder dla mikroprocesora, nazywamy go na przyk\u0142ad: <strong>Projekt1_OTA<\/strong>\n<ul class=\"wp-block-list\">\n<li>do foldera wklejamy pliki <strong>boot.py<\/strong>, <strong>ota.py<\/strong>,<strong> version.json<\/strong> z obs\u0142ug\u0105 OTA oraz dowolny <strong>main.py<\/strong>. Ew. dodatkowe pliki jak <strong>credentials.py<\/strong><\/li>\n\n\n\n<li>do pliku <strong>version.json<\/strong> wpisujemy <strong><strong>{&#8222;version&#8221;: 0}<\/strong><\/strong> <\/li>\n\n\n\n<li>transmitujemy pliki do procesora <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Uruchamiamy serwer flask obs\u0142uguj\u0105cy OTA\n<ul class=\"wp-block-list\">\n<li>w folderze w kt\u00f3rym jest serwer (na przyk\u0142ad z nazw\u0105 <strong>OTA_flask<\/strong>) tworzymy nowy folder <strong>ota_files<\/strong> a w nim kolejne foldery z nazwami urz\u0105dze\u0144, na przyk\u0142ad <strong>device_1<\/strong>, <strong>device_2<\/strong><\/li>\n\n\n\n<li>w ka\u017cdym z tych folder\u00f3w znajduj\u0105 si\u0119 dwa pliki:\n<ul class=\"wp-block-list\">\n<li> <strong>version.json<\/strong> oraz <strong>main.py<\/strong> z kodem, kt\u00f3ry ma by\u0107 wys\u0142any do mikroprocesora aby podmieni\u0107 poprzedni plik <strong>main.py<\/strong> w kt\u00f3rym jest kod obs\u0142uguj\u0105cy mikroprocesor<\/li>\n\n\n\n<li>je\u015bli chcemy, by po restarcie mikroprocesora program znajduj\u0105cy si\u0119 w pliku <strong>boot.py<\/strong> uruchomi\u0142 proces podmiany pliku <strong>main.py<\/strong>, w pliku <strong>version.json<\/strong> nale\u017cy podwy\u017cszy\u0107 numer wersji. Za pierwszym razem wpisujemy <strong>{&#8222;version&#8221;: 1}<\/strong><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>To w zasadzie wszystko. Pliki z kodami obs\u0142uguj\u0105cymi proces <strong>OTA<\/strong> dla j\u0119zyka mikropython podaj\u0119 w <strong>repozytorium github<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Link do repozytorium<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/yarogniew\/ota_micropython_template.git\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/github.com\/yarogniew\/ota_micropython_template.git<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kolejno\u015b\u0107 dzia\u0142a\u0144 Link do repozytorium https:\/\/github.com\/yarogniew\/ota_micropython_template.git<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,141],"tags":[102,30],"class_list":["post-6397","post","type-post","status-publish","format-standard","hentry","category-esp8266","category-micropython","tag-ota","tag-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/6397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/comments?post=6397"}],"version-history":[{"count":4,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/6397\/revisions"}],"predecessor-version":[{"id":6403,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/6397\/revisions\/6403"}],"wp:attachment":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/media?parent=6397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/categories?post=6397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/tags?post=6397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}