{"id":635,"date":"2022-11-22T23:17:31","date_gmt":"2022-11-22T15:17:31","guid":{"rendered":"http:\/\/wordpress.loc\/?p=635"},"modified":"2022-11-22T23:17:54","modified_gmt":"2022-11-22T15:17:54","slug":"esp32_ch1-20","status":"publish","type":"post","link":"https:\/\/www.nmking.io\/index.php\/2022\/11\/22\/635\/","title":{"rendered":"ESP32 OTA\u7121\u7dda\u66f4\u65b0\u7cfb\u52172 OTAWebUpload"},"content":{"rendered":"\n<figure class=\"wp-block-pullquote\"><blockquote><p>ESP32 OTA\u7684\u7b2c\u4e8c\u7a2e\u6a21\u5f0f\u662fOTAWebUpload\uff0c\u4e00\u6a23\u662fArduinoIDE\u5167\u7684\u7bc4\u4f8b\uff0c\u65b9\u5f0f\u662f\u5c07ESP32\u8b8a\u6210\u4e00\u53f0Webserver\uff0c\u900f\u904eESP32\u7684\u7db2\u9801\u4e0a\u50b3ArduinoIDE\u7de8\u8b6f\u904e\u5f97bin(binary)\u6a94<\/p><\/blockquote><\/figure>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-ht-block-toc is-style-rounded htoc htoc--position-wide toc-list-style-plain\" data-htoc-state=\"expanded\"><span class=\"htoc__title\"><span class=\"ht_toc_title\">Table of Contents<\/span><span class=\"htoc__toggle\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"16\" height=\"16\"><g fill=\"#444\"><path d=\"M15 7H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z\"><\/path><path d=\"M15 1H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM15 13H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z\"><\/path><\/g><\/svg><\/span><\/span><div class=\"htoc__itemswrap\"><ul class=\"ht_toc_list\"><li class=\"\"><a href=\"#htoc-\">\u5be6\u4f5c\u8aaa\u660e<\/a><\/li><li class=\"\"><a href=\"#htoc-otawebupload\">\u7b2c\u4e00\u6b21\u71d2\u9304OTAWebUpload\u7a0b\u5f0f\u78bc<\/a><\/li><li class=\"\"><a href=\"#htoc-bin\">\u4e0a\u50b3bin\u6a94<\/a><\/li><\/ul><\/div><\/div>\n\n\n\n<p>\u6211\u7684ESP32\u5be6\u505a\u66f8\u7c4d\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.nmking.io\/index.php\/2022\/11\/10\/esp32_ch1-2\/\" target=\"_blank\">\u6211\u51fa\u66f8\u4e86 ESP32 \u7269\u806f\u7db2\u5c08\u984c<\/a><br>\u535a\u5ba2\u4f86\u7db2\u5740\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.books.com.tw\/products\/0010901195\" target=\"_blank\">https:\/\/www.books.com.tw\/products\/0010901195<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-\">\u5be6\u4f5c\u8aaa\u660e<\/h2>\n\n\n\n<p>ESP32 OTA\u7684\u7b2c\u4e8c\u7a2e\u6a21\u5f0f\u662fOTAWebUpload\uff0c\u4e00\u6a23\u662fArduinoIDE\u5167\u7684\u7bc4\u4f8b\uff0c\u65b9\u5f0f\u662f\u5c07ESP32\u8b8a\u6210\u4e00\u53f0Webserver\uff0c\u900f\u904eESP32\u7684\u7db2\u9801\u4e0a\u50b3ArduinoIDE\u7de8\u8b6f\u904e\u5f97bin(binary)\u6a94\uff0c\u9019\u65b9\u5f0f\u96d6\u7136\u8c8c\u4f3c\u8f03BasicOTA\u628a\u529f\u80fd\u76f4\u63a5\u505a\u5728ArduinoIDE\u4e0a\u9ebb\u7169\uff0c\u4f46\u662f\u8f03\u70ba\u7a69\u5b9a\uff0c\u6839\u64da\u4e4b\u524d\u7684\u7d93\u9a57\u5728ArduinoIDE\u4e0a\u7684WiFi\u865b\u64ecPort\u4e0d\u4e00\u5b9a\u80fd\u6b63\u5e38\u4f7f\u7528\uff0c\u800c\u8d70Http\u6a21\u5f0f\u7684Web\u70baTCP\/IP\u6a21\u5f0f\uff0c\u76f8\u5c0d\u975e\u5e38\u7a69\u5b9a\uff0c\u5169\u8005\u76f8\u6bd4\uff0c\u5982\u679c\u9700\u8981\u7a69\u5b9a\u6027\u9ad8\u7684\u9084\u662f\u63a1\u7528OTAWebUpload\u5427\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-otawebupload\">\u7b2c\u4e00\u6b21\u71d2\u9304OTAWebUpload\u7a0b\u5f0f\u78bc<\/h2>\n\n\n\n<p>OTAWebUpload\u4e00\u6a23\u662fArduinoIDE\u5167\u5efa\u7684\u7bc4\u4f8b\uff0c\u5728\u6a94\u6848\/\u7bc4\u4f8b\/ArduinOTA\/OTAWebUpload\u53ef\u4ee5\u627e\u5230<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633956719-1435545-g_n.png?resize=841%2C680&#038;ssl=1\" alt=\"\" width=\"841\" height=\"680\"\/><figcaption class=\"wp-element-caption\">OTAWebUpload\u7a0b\u5f0f\u5eab<\/figcaption><\/figure>\n\n\n\n<p>\u958b\u555f\u4e4b\u5f8c\uff0c\u9996\u5148\u8981\u4fee\u6539\u7684\u662f\u6700\u524d\u9762\u7b2c8-9\u884c\u7684WiFi SSID\u53ca\u5bc6\u78bc\uff0c\u81f3\u65bchost\u5247\u6539\u4e0d\u6539\u7121\u6240\u8b02(mDNS\u7528)\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633957232-2708464377-g_n.png?resize=839%2C334&#038;ssl=1\" alt=\"\" width=\"839\" height=\"334\"\/><figcaption class=\"wp-element-caption\">\u4fee\u6539WIFI\u7a0b\u5f0f<\/figcaption><\/figure>\n\n\n\n<p>\u7a0b\u5f0f\u4e0a\u50b3\u5b8c\u6210\u5f8c\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u53d6\u5f97\u7684IP<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633957349-1642802782-g_n.png?resize=840%2C371&#038;ssl=1\" alt=\"\" width=\"840\" height=\"371\"\/><figcaption class=\"wp-element-caption\">\u53d6\u5f97IP\u4f4d\u7f6e<\/figcaption><\/figure>\n\n\n\n<p>\u7528\u700f\u89bd\u5668\u958b\u555f\u4e0a\u9762\u9019\u500bIP\u5c31\u53ef\u4ee5\u770b\u5230ESP32\u6240\u6a21\u64ec\u7684\u7db2\u7ad9\u767b\u5165\u756b\u9762<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633957335-2583339188-g.png?resize=840%2C415&#038;ssl=1\" alt=\"\" width=\"840\" height=\"415\"\/><figcaption class=\"wp-element-caption\">ESP32\u66f4\u65b0\u7a0b\u5f0f\u767b\u5165\u756b\u9762<\/figcaption><\/figure>\n\n\n\n<p>\u7531\u65bc\u9019\u500b\u662f\u7528\u4f86\u66f4\u65b0\u7a0b\u5f0f\u78bc\u7684\uff0c\u6240\u4ee5\u7576\u7136\u8981\u6709\u5e33\u5bc6\u4e86\uff0c\u4e0d\u7136\u96a8\u4fbf\u6709\u4eba\u8dd1\u4f86\u767b\u5165\uff0c\u96a8\u4fbf\u4e0a\u50b3\u7a0b\u5f0f\u78bc\uff0c\u4f60\u7684ESP32\u5c31\u88ab\u7d81\u67b6\u4e86\uff0c\u54c8\u54c8\uff0c\u81f3\u65bc\u5e33\u5bc6\u662f\u591a\u5c11\uff1f\u5f88\u611a\u8822\u7684\uff0c\u5e33\u5bc6\u5df2\u7d93\u5beb\u5728html\u539f\u59cb\u6a94\uff0c\u90fd\u662fadmin\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633957679-794095103-g_n.png?resize=840%2C246&#038;ssl=1\" alt=\"\" width=\"840\" height=\"246\"\/><figcaption class=\"wp-element-caption\">html\u539f\u59cb\u6a94\u4e2d\u7684\u5e33\u865f\u5bc6\u78bc<\/figcaption><\/figure>\n\n\n\n<p>\u8981\u4fee\u6539\u9019\u500b\u5e33\u5bc6\u4e5f\u5f88\u7c21\u55ae\uff0cArduino\u539f\u59cb\u6a94\u4e2d\u7684\u7b2c17-97\u884c\u90fd\u662f\u7db2\u9801\u7684\u539f\u59cb\u6a94\uff0c\u5e33\u5bc6\u53ef\u4ee5\u5728\u7b2c47\u884c\u770b\u5230\uff0c\u4e0d\u904e\u6539\u9019\u500b\u5be6\u969b\u4e0a\u6c92\u4ec0\u9ebc\u610f\u601d\uff0c\u56e0\u70ba\u53ea\u8981\u6703\u6aa2\u8996\u539f\u59cb\u6a94\u7684\u90fd\u77e5\u9053\u600e\u9ebc\u627e\u5e33\u5bc6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633957836-1801542279-g_n.png?resize=841%2C331&#038;ssl=1\" alt=\"\" width=\"841\" height=\"331\"\/><figcaption class=\"wp-element-caption\">Arduino\u539f\u59cb\u6a94\u4fee\u6539\u5e33\u865f\u5bc6\u78bc<\/figcaption><\/figure>\n\n\n\n<p>\u5b8c\u6210\u5e33\u865f\u5bc6\u78bc\u767b\u5165ESP32\u7db2\u7ad9\u5f8c\uff0c\u5c31\u53ef\u4ee5\u6e96\u5099\u4e0a\u50b3\u7de8\u8b6f\u7684bin\u6a94\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633957985-4162049750-g.png?resize=839%2C358&#038;ssl=1\" alt=\"\" width=\"839\" height=\"358\"\/><figcaption class=\"wp-element-caption\">\u767b\u5165\u5f8c\u756b\u9762<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htoc-bin\">\u4e0a\u50b3bin\u6a94<\/h2>\n\n\n\n<p>\u63a5\u4e0b\u4f86\u6211\u5011\u8981\u6e96\u5099\u4e0b\u4e00\u500b\u8981\u4e0a\u50b3\u5230EPS32\u4e0a\u7684\u7a0b\u5f0fbin\u6a94\uff0cbin\u5c31\u662f\u5c07\u539f\u59cb\u78bc\u7de8\u8b6f\u5f8c\u7684binary\u4e8c\u9032\u4f4d\u6a94\uff0c\u7531\u65bc\u6211\u5011\u4f7f\u7528Arduino\u6642\u7de8\u8b6f\u4e0a\u50b3\u7684\u904e\u7a0b\u6211\u5011\u662f\u4e0d\u592a\u95dc\u5fc3\u7684\uff0c\u6240\u4ee5\u53ef\u80fd\u5927\u90e8\u5206\u7684\u4f7f\u7528\u8005\u90fd\u4e0d\u77e5\u9053\u539f\u59cb\u6a94\u6709\u7d93\u904e\u7de8\u8b6f\u6210bin\u3002<\/p>\n\n\n\n<p>\u7576\u6211\u5011\u5f9e\u539f\u4f86\u7684OTAWebUpload\u7bc4\u4f8b\u4fee\u6539\u6210\u4e0b\u4e00\u7248\u7684\u7a0b\u5f0f\u5f8c\uff0c\u4f8b\u5982\u7b46\u8005\u5728\u6b64\u52a0\u5165LED\u9583\u8000\u7684\u529f\u80fd\uff0c\u4fee\u6539\u7684\u7a0b\u5f0f\u90e8\u4efd\u5982\u4e0b\uff0c\u5982\u4e0a\u4e00\u7bc0\u6240\u8aaa\u660e\u907f\u514d\u904e\u9577\u7684delay\u5f71\u97ff\u7a0b\u5f0f\u4e0a\u50b3\uff0c\u5efa\u8b70\u6539\u7528\u6700\u5f8c\u66f4\u65b0\u7684\u65b9\u5f0f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633958887-769924397-g_n.png?resize=841%2C638&#038;ssl=1\" alt=\"\" width=\"841\" height=\"638\"\/><figcaption class=\"wp-element-caption\">\u4fee\u6539delay\u7a0b\u5f0f<\/figcaption><\/figure>\n\n\n\n<p>\u539f\u59cb\u78bc\u4fee\u6539\u5b8c\u7562\u5f8c\uff0c\u8981\u5982\u4f55\u53d6\u5f97bin\u6a94\u5462\uff1f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u529f\u80fd\u8868\u7684\u8349\u7a3f\u78bc\/\u532f\u51fa\u5df2\u7de8\u8b6f\u7684\u4e8c\u9032\u4f4d\u6a94<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633959151-532087795-g.png?resize=839%2C601&#038;ssl=1\" alt=\"\" width=\"839\" height=\"601\"\/><figcaption class=\"wp-element-caption\">\u532f\u51fa\u5df2\u7de8\u8b6f\u7684\u4e8c\u9032\u4f4d\u6a94<\/figcaption><\/figure>\n\n\n\n<p>\u6b64\u6642ArduinoIDE\u6703\u8981\u6c42\u5c07\u6a94\u6848\u5b58\u6a94\uff0c\u4e14\u6703\u5c07bin\u6a94\u6848\u532f\u51fa\u5230\u539f\u59cb\u6a94\u7684\u8cc7\u6599\u593e\u4e2d\u3002\u5982\u4e0b\u5716\u7684\u300cota.ino.esp32.bin\u300d<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633959779-3801388536-g.png?resize=840%2C439&#038;ssl=1\" alt=\"\" width=\"840\" height=\"439\"\/><figcaption class=\"wp-element-caption\">\u532f\u51fabin\u6a94<\/figcaption><\/figure>\n\n\n\n<p>\u63a5\u4e0b\u4f86\u6211\u5011\u628abin\u6a94\u900f\u904e\u4e0a\u9762ESP32\u7684\u7db2\u7ad9\u9032\u884c\u4e0a\u50b3<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633959912-2043326254-g.png?resize=839%2C361&#038;ssl=1\" alt=\"\" width=\"839\" height=\"361\"\/><figcaption class=\"wp-element-caption\">bin\u6a94\u4e0a\u50b3\u4e2d\u756b\u9762<\/figcaption><\/figure>\n\n\n\n<p>\u4e0a\u50b3\u5b8c\u7562\u5f8c\uff0cESP32\u6703\u81ea\u5df1\u91cd\u65b0\u958b\u6a5f\uff0c\u4e0d\u904e\u7db2\u9801\u6c92\u6709\u4efb\u4f55\u66f4\u65b0\u5b8c\u7562\u7684\u63d0\u793a\u8a0a\u606f\u3002\u4e0d\u904e\u5047\u8a2d\u6e2c\u8a66\u6642\u4f60\u6709\u63a5\u8457\u5e8f\u5217\u8996\u7a97\u7684\u8a71\uff0c\u662f\u53ef\u4ee5\u770b\u5230\u66f4\u65b0\u8a0a\u606f\u7684\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/pic.pimg.tw\/youyouyou\/1633960501-1736899770-g_n.png?resize=842%2C574&#038;ssl=1\" alt=\"\" width=\"842\" height=\"574\"\/><figcaption class=\"wp-element-caption\">\u5e8f\u5217\u8996\u7a97\u986f\u793a\u66f4\u65b0\u7a0b\u5f0f\u72c0\u614b<\/figcaption><\/figure>\n\n\n\n<p>\u4e00\u6a23\u7684\u8a18\u5f97\u6bcf\u4e00\u500b\u7248\u672c\u7684OTA\u7a0b\u5f0f\u90fd\u5fc5\u9808\u4fdd\u7559\u539f\u672cOTA\u7684\u7a0b\u5f0f\u78bc\uff0c\u624d\u80fd\u5728\u4e0b\u4e00\u6b21\u66f4\u65b0\u6642\u4fdd\u6709OTA\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ESP32 OTA\u7684\u7b2c\u4e8c\u7a2e\u6a21\u5f0f\u662fOTAWebUpload\uff0c\u4e00\u6a23\u662fArduinoIDE\u5167\u7684\u7bc4\u4f8b\uff0c\u65b9\u5f0f\u662f\u5c07ESP3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-635","post","type-post","status-publish","format-standard","hentry","category-esp32"],"blocksy_meta":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/comments?post=635"}],"version-history":[{"count":1,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/635\/revisions"}],"predecessor-version":[{"id":636,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/635\/revisions\/636"}],"wp:attachment":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/media?parent=635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/categories?post=635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/tags?post=635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}