1. 前言
前面的博文中,我們編寫的韌體都是通過ArduinoIDE往串列埠線上的ESP8266模組去燒寫韌體。這樣就會有幾個弊端:
- 需要經常插拔轉接線,很容易造成8266串列埠丟失;
- 如果是將ESP8266做成產品並交付到客戶手上之後應該如何更新產品中的ESP8266韌體呢?難道要使用者拿到技術中心來更新?如果是這樣,這個產品必定屬於失敗產品。
在這裡,就引入我們本篇章需要了解的實用知識 —— OTA功能。
OTA —— Over the air update of the firmware,也就是無線韌體更新,這個可以說是非常炫酷且實用的功能。
那麼O他的本質是什麼?它又是如何工作的呢?
一般情況下,當我們使用串列埠線更新8266的韌體是通過SerialBootLoader來更新,這個屬於開發板內建好的預設方式。
而OTA因為用到的是WIFI網路,所以我們假設也有一個名為“WIFIOTABootLoader”的東西來處理韌體的無線寫入更新,但是這個WIFIOTABootLoader需要我們先通過串列埠線預先寫入到ESP8266。換句話說就是,我們得在專案程式碼中嵌入用於O他的 WIFIOTABootLoader。
那麼問題來了,WIFIOTABootLoader到底是什麼原理呢?
萬變不離其宗,博主第一個想到的就是 WebServer、UDP、mDNS的混合使用,通過mDNS可以解決域名訪問問題,WebServer提供web頁面供開發者上傳韌體檔案,然後WebServer處理具體的請求,再把檔案寫入flash中(萬幸的是,博主去看底層程式碼,確實有這樣設計的思路)。
所以,要想深入理解OTA,請先回顧基礎知識:
- ESP8266開發之旅 網路篇⑩ UDP服務
- ESP8266開發之旅 網路篇⑪ WebServer——ESP8266WebServer庫的使用
- ESP8266開發之旅 網路篇⑫ 域名服務——ESP8266mDNS庫
2. OTA方式
在Arduino Core For ESP8266中,使用OTA功能可以有三種方式:
- ArduinoOTA —— OTA之Arduino IDE更新,也就是無線更新需要利用到Arduino IDE,只是不需要通過串列埠線燒寫而已,這種方式適合開發者;
- WebUpdateOTA —— OTA之web更新,通過8266上配置的webserver來選擇韌體更新,這種方式適合開發者以及有簡單配置經驗的消費者;
- ServerUpdateOTA —— OTA之伺服器更新,通過公網伺服器,把韌體放在雲端伺服器上,下載更新,這種方式適合零基礎的消費者,無感知更新;
其實不管哪一種方式,其最終目的:
為了把新韌體燒寫到Flash中,然後替代掉舊韌體,以達到更新韌體的效果。
那麼,我們來看看最終新舊韌體是怎麼用替換,請看下圖:
- 沒有更新韌體前,當前韌體(current sketch,綠色部分)和 檔案系統(spiffs,藍色部分)位於flash儲存空間的不同區域,中間空白的是空閒空間;
- 韌體更新時,新韌體(new sketch,黃色所示)將寫入空閒空間,此時flash同時存在這三個物件;
- 重啟模組後,新韌體會覆蓋掉舊韌體,然後從當前韌體的開始地址處開始執行,以達到韌體更新的目的。
接下來,我們看看這三種方式是怎麼用實現了以上三個步驟。
3. ArduinoOTA —— OTA之Arduino IDE更新
為了更好地使用ArduinoOTA,先來了解一下ArduinoOTA需要用到的庫,然後再具體分析裡面的實現原理。請在程式碼裡面引入以下庫:
#include <ArduinoOTA.h>
檢視 ArduinoOTA 底層原始碼,可以發現引入 UdpContext、ESP8266mDNS、WiFiClient(同時關聯WiFiServer),也就是說用到了UDP服務、TCP服務以及mDNS域名對映,這個是一個關鍵點。
在這裡,博主也總結了ArduinoOTA庫的百度腦圖:
總體上,方法可以細分為3大類:
- 安全策略配置
- 管理OTA
- 韌體更新相關
3.1 安全策略配置
一般來說,使用預設的安全策略配置就好,但是如果有特殊要求,也可以自行配置。
3.1.1 setHostname —— 設定主機名
函式說明:
/**
* 設定主機名,主要用於mDNS的域名對映
* @param hostName 主機名
*/
void setHostname(const char *hostname);
注意點:
- 預設主機名是esp8266-xxxxx
3.1.2 getHostname —— 獲取主機名
函式說明:
/**
* 獲取主機名
* @return String 主機名
*/
String getHostname();
3.1.3 setPassword —— 設定訪問密碼
函式說明:
/**
* 設定訪問密碼
* @param password 上傳密碼,預設為NULL
*/
void setPassword(const char *password);
原始碼說明:
void ArduinoOTAClass::setPassword(const char * password) {
if (!_initialized && !_password.length() && password) {
//MD5編碼 建議用這個方法更好
MD5Builder passmd5;
passmd5.begin();
passmd5.add(password);
passmd5.calculate();
_password = passmd5.toString();
}
}
3.1.4 setPasswordHash —— 設定訪問密碼雜湊值
函式說明:
/**
* 設定訪問密碼雜湊值
* @param password 上傳密碼Hash值 MD5(password)
*/
void setPasswordHash(const char *password);
原始碼說明:
void ArduinoOTAClass::setPasswordHash(const char * password) {
if (!_initialized && !_password.length() && password) {
//md5編碼的password
_password = password;
}
}
3.1.5 setPort —— 設定Udp服務埠
函式說明:
/**
* 設定Udp服務埠
* @param port Udp服務埠
*/
void setPort(uint16_t port);
注意點:
- 以上程式碼請在begin方法之前呼叫;
3.2 管理OTA
3.2.1 begin —— 啟動ArduinoOTA服務
函式說明:
/**
* 啟動ArduinoOTA服務
*/
void begin();
原始碼說明:
void ArduinoOTAClass::begin() {
if (_initialized)
return;
//配置主機名,預設 esp8266-xxxx
if (!_hostname.length()) {
char tmp[15];
sprintf(tmp, "esp8266-%06x", ESP.getChipId());
_hostname = tmp;
}
//udp服務埠號,預設8266
if (!_port) {
_port = 8266;
}
if(_udp_ota){
_udp_ota->unref();
_udp_ota = 0;
}
//啟動UDP服務
_udp_ota = new UdpContext;
_udp_ota->ref();
if(!_udp_ota->listen(*IP_ADDR_ANY, _port))
return;
//繫結了回撥函式
_udp_ota->onRx(std::bind(&ArduinoOTAClass::_onRx, this));
//啟動mDNS服務
MDNS.begin(_hostname.c_str());
if (_password.length()) {
MDNS.enableArduino(_port, true);
} else {
//mDNS註冊OTA服務
MDNS.enableArduino(_port);
}
_initialized = true;
_state = OTA_IDLE;
#ifdef OTA_DEBUG
OTA_DEBUG.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port);
#endif
}
/**
* 解析收到的OTA請求
*/
void ArduinoOTAClass::_onRx(){
if(!_udp_ota->next()) return;
ip_addr_t ota_ip;
if (_state == OTA_IDLE) {
//檢視當前OTA命令 可以燒寫韌體或者燒寫SPIFFS
int cmd = parseInt();
if (cmd != U_FLASH && cmd != U_SPIFFS)
return;
_ota_ip = _udp_ota->getRemoteAddress();
_cmd = cmd;
_ota_port = parseInt();
_ota_udp_port = _udp_ota->getRemotePort();
_size = parseInt();
_udp_ota->read();
_md5 = readStringUntil('\n');
_md5.trim();
if(_md5.length() != 32)
return;
ota_ip.addr = (uint32_t)_ota_ip;
//驗證密碼,需要IDE輸入密碼
if (_password.length()){
MD5Builder nonce_md5;
nonce_md5.begin();
nonce_md5.add(String(micros()));
nonce_md5.calculate();
_nonce = nonce_md5.toString();
char auth_req[38];
sprintf(auth_req, "AUTH %s", _nonce.c_str());
_udp_ota->append((const char *)auth_req, strlen(auth_req));
_udp_ota->send(&ota_ip, _ota_udp_port);
//切換到驗證狀態
_state = OTA_WAITAUTH;
return;
} else {
//切換到更新韌體狀態
_state = OTA_RUNUPDATE;
}
} else if (_state == OTA_WAITAUTH) {
int cmd = parseInt();
if (cmd != U_AUTH) {
_state = OTA_IDLE;
return;
}
_udp_ota->read();
String cnonce = readStringUntil(' ');
String response = readStringUntil('\n');
if (cnonce.length() != 32 || response.length() != 32) {
_state = OTA_IDLE;
return;
}
String challenge = _password + ":" + String(_nonce) + ":" + cnonce;
MD5Builder _challengemd5;
_challengemd5.begin();
_challengemd5.add(challenge);
_challengemd5.calculate();
String result = _challengemd5.toString();
ota_ip.addr = (uint32_t)_ota_ip;
if(result.equalsConstantTime(response)) {
//驗證通過 切換到更新韌體狀態 等待韌體接收
_state = OTA_RUNUPDATE;
} else {
_udp_ota->append("Authentication Failed", 21);
_udp_ota->send(&ota_ip, _ota_udp_port);
if (_error_callback) _error_callback(OTA_AUTH_ERROR);
_state = OTA_IDLE;
}
}
while(_udp_ota->next()) _udp_ota->flush();
}
可以看出,begin方法主要是根據配置內容,啟動mDNS服務,預設域名是esp8266-xxxx,啟動UDP服務,預設埠是8266,這個是後面ArduinoIDE無線傳輸韌體的根本。
3.2.2 handle —— 處理韌體更新
函式說明:
/**
* 處理韌體更新,這個方法需要在loop方法中不斷檢測呼叫
*/
void handle();
原始碼說明:
void ArduinoOTAClass::handle() {
if (_state == OTA_RUNUPDATE) {
//處理韌體傳輸更新
_runUpdate();
_state = OTA_IDLE;
}
}
/**
* 處理韌體傳輸更新
*/
void ArduinoOTAClass::_runUpdate() {
ip_addr_t ota_ip;
ota_ip.addr = (uint32_t)_ota_ip;
//檢視Update是否啟動成功,Update類主要用於跟flash打交道,用於更新韌體或者SPIFFS,下面博主會說明一下
if (!Update.begin(_size, _cmd)) {
#ifdef OTA_DEBUG
OTA_DEBUG.println("Update Begin Error");
#endif
if (_error_callback) {
_error_callback(OTA_BEGIN_ERROR);
}
StreamString ss;
Update.printError(ss);
_udp_ota->append("ERR: ", 5);
_udp_ota->append(ss.c_str(), ss.length());
_udp_ota->send(&ota_ip, _ota_udp_port);
delay(100);
_udp_ota->listen(*IP_ADDR_ANY, _port);
_state = OTA_IDLE;
return;
}
_udp_ota->append("OK", 2);
_udp_ota->send(&ota_ip, _ota_udp_port);
delay(100);
Update.setMD5(_md5.c_str());
//停止UDP服務
WiFiUDP::stopAll();
WiFiClient::stopAll();
//執行OTA開始回撥
if (_start_callback) {
_start_callback();
}
if (_progress_callback) {
_progress_callback(0, _size);
}
//連線到IDE建立的服務地址
WiFiClient client;
if (!client.connect(_ota_ip, _ota_port)) {
#ifdef OTA_DEBUG
OTA_DEBUG.printf("Connect Failed\n");
#endif
_udp_ota->listen(*IP_ADDR_ANY, _port);
if (_error_callback) {
_error_callback(OTA_CONNECT_ERROR);
}
_state = OTA_IDLE;
}
uint32_t written, total = 0;
while (!Update.isFinished() && client.connected()) {
int waited = 1000;
//接收韌體內容
while (!client.available() && waited--)
delay(1);
if (!waited){
#ifdef OTA_DEBUG
OTA_DEBUG.printf("Receive Failed\n");
#endif
_udp_ota->listen(*IP_ADDR_ANY, _port);
if (_error_callback) {
_error_callback(OTA_RECEIVE_ERROR);
}
_state = OTA_IDLE;
}
//把韌體內容寫入flash
written = Update.write(client);
if (written > 0) {
client.print(written, DEC);
total += written;
//回撥呼叫進度
if(_progress_callback) {
_progress_callback(total, _size);
}
}
}
//更新結束
if (Update.end()) {
//回撥接收成功
client.print("OK");
client.stop();
delay(10);
#ifdef OTA_DEBUG
OTA_DEBUG.printf("Update Success\n");
#endif
//OTA結束回撥
if (_end_callback) {
_end_callback();
}
//自動重啟
if(_rebootOnSuccess){
#ifdef OTA_DEBUG
OTA_DEBUG.printf("Rebooting...\n");
#endif
//let serial/network finish tasks that might be given in _end_callback
delay(100);
//重啟命令
ESP.restart();
}
} else {
_udp_ota->listen(*IP_ADDR_ANY, _port);
if (_error_callback) {
_error_callback(OTA_END_ERROR);
}
Update.printError(client);
#ifdef OTA_DEBUG
Update.printError(OTA_DEBUG);
#endif
_state = OTA_IDLE;
}
}
接下來,看看Update類,這是一個寫Flash儲存空間的重要類,重點看幾個方法:
Update.begin原始碼說明
bool UpdaterClass::begin(size_t size, int command) {
....... //省略前面細節
if (command == U_FLASH) {
//以下程式碼就是確認燒寫位置,燒寫位置在我們文章開頭說到的空閒空間,處於當前程式區和SPIFFS之間
//size of current sketch rounded to a sector
uint32_t currentSketchSize = (ESP.getSketchSize() + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
//address of the end of the space available for sketch and update
//_SPIFFS_start SPIFFS開始地址
uint32_t updateEndAddress = (uint32_t)&_SPIFFS_start - 0x40200000;
//size of the update rounded to a sector
uint32_t roundedSize = (size + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
//address where we will start writing the update
updateStartAddress = (updateEndAddress > roundedSize)? (updateEndAddress - roundedSize) : 0;
.....//省略細節
}
else if (command == U_SPIFFS) {
//如果是燒寫SPIFFS
updateStartAddress = (uint32_t)&_SPIFFS_start - 0x40200000;
}
else {
//不支援其他命令
// unknown command
#ifdef DEBUG_UPDATER
DEBUG_UPDATER.println(F("[begin] Unknown update command."));
#endif
return false;
}
//initialize 記錄更新位置
_startAddress = updateStartAddress;
_currentAddress = _startAddress;
.......省略細節
}
Update.end原始碼說明
bool UpdaterClass::end(bool evenIfRemaining){
..... //省略前面細節
if (_command == U_FLASH) {
//設定重啟後copy新韌體覆蓋舊韌體
eboot_command ebcmd;
ebcmd.action = ACTION_COPY_RAW;
ebcmd.args[0] = _startAddress;
ebcmd.args[1] = 0x00000;
ebcmd.args[2] = _size;
eboot_command_write(&ebcmd);
#ifdef DEBUG_UPDATER
DEBUG_UPDATER.printf("Staged: address:0x%08X, size:0x%08X\n", _startAddress, _size);
}
else if (_command == U_SPIFFS) {
DEBUG_UPDATER.printf("SPIFFS: address:0x%08X, size:0x%08X\n", _startAddress, _size);
#endif
}
_reset();
return true;
}
3.2.3 setRebootOnSuccess —— 設定韌體更新完畢是否自動重啟
函式說明:
/**
* 設定韌體更新完畢是否自動重啟
* @param reboot 是否自動重啟,預設true
*/
void setRebootOnSuccess(bool reboot);
注意點:
- 這個函式可以設定成true,讓8266可以自動重啟;
3.3 韌體更新相關
3.3.1 onStart —— OTA開始連線回撥
函式說明:
/**
* 回撥函式定義
*/
typedef std::function<void(void)> THandlerFunction;
/**
* OTA開始連線回撥 fn
* @param fn 回撥函式
*/
void onStart(THandlerFunction fn);
3.3.2 onEnd —— OTA結束回撥
函式說明:
/**
* 回撥函式定義
*/
typedef std::function<void(void)> THandlerFunction;
/**
* OTA結束回撥 fn
* @param fn 回撥函式
*/
void onEnd(THandlerFunction fn);
3.3.3 onError —— OTA出錯回撥
函式說明:
/**
* 回撥函式定義
* @param ota_error_t 錯誤原因
*/
typedef std::function<void(ota_error_t)> THandlerFunction_Error;
/**
* OTA出錯回撥 fn
* @param fn 回撥函式
*/
void onError(THandlerFunction_Error fn);
錯誤原因定義如下:
typedef enum {
OTA_AUTH_ERROR,//驗證失敗
OTA_BEGIN_ERROR,//update 開啟失敗
OTA_CONNECT_ERROR,//網路連線失敗
OTA_RECEIVE_ERROR,//接收韌體失敗
OTA_END_ERROR//結束失敗
} ota_error_t;
3.3.4 onProgress —— OTA接收韌體進度
函式說明:
/**
* 回撥函式定義
* @param 韌體當前資料大小
* @param 韌體總大小
*/
typedef std::function<void(unsigned int, unsigned int)> THandlerFunction_Progress;
/**
* OTA接收韌體進度 回撥fn
* @param fn 回撥函式
*/
void onProgress(THandlerFunction_Progress fn);
3.4 例項
實驗說明:
OTA之Arduino IDE更新,需要利用到ArduinoOTA庫。也就意味著我們需要首先往8266燒寫支援ArduinoO他的程式碼,然後ArduinoIDE會通過UDP通訊連線到8266建立的UDP服務,通過UDP服務校驗相應資訊,校驗通過後8266連線ArduinoIDE建立的Http服務,傳輸新韌體。
注意:
- ArduinoOTA需要Python環境支援,需要讀者先安裝。
實驗準備:
- NodeMcu開發板
- Python 2.7(不安裝不支援的Python 3.5,Windows使用者應選擇“將python.exe新增到路徑”(見下文 - 預設情況下未選擇此選項))python 2.7 提取碼:g9ds
實驗步驟:
演示更新功能,需要區分新舊程式碼。先往NodeMcu燒寫V1.0版本程式碼:
/**
* 功能描述:OTA之Arduino IDE更新 V1.0版本程式碼
*
*/
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
#define CodeVersion "CodeVersion V1.0"
const char* ssid = "xxxx";//填上wifi賬號
const char* password = "xxxxx";//填上wifi密碼
void setup() {
DebugBegin(115200);
DebugPrintln("Booting Sketch....");
DebugPrintln(CodeVersion);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
DebugPrintln("Connection Failed! Rebooting...");
delay(5000);
//重啟ESP8266模組
ESP.restart();
}
// Port defaults to 8266
// ArduinoOTA.setPort(8266);
// Hostname defaults to esp8266-[ChipID]
// ArduinoOTA.setHostname("myesp8266");
// No authentication by default
// ArduinoOTA.setPassword("admin");
// Password can be set with it's md5 value as well
// MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
// ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");
ArduinoOTA.onStart([]() {
String type;
//判斷一下OTA內容
if (ArduinoOTA.getCommand() == U_FLASH) {
type = "sketch";
} else { // U_SPIFFS
type = "filesystem";
}
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
DebugPrintln("Start updating " + type);
});
ArduinoOTA.onEnd([]() {
DebugPrintln("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
DebugPrintF("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
DebugPrintF("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) {
DebugPrintln("Auth Failed");
} else if (error == OTA_BEGIN_ERROR) {
DebugPrintln("Begin Failed");
} else if (error == OTA_CONNECT_ERROR) {
DebugPrintln("Connect Failed");
} else if (error == OTA_RECEIVE_ERROR) {
DebugPrintln("Receive Failed");
} else if (error == OTA_END_ERROR) {
DebugPrintln("End Failed");
}
});
ArduinoOTA.begin();
DebugPrintln("Ready");
DebugPrint("IP address: ");
DebugPrintln(WiFi.localIP());
}
void loop() {
ArduinoOTA.handle();
}
燒寫成功後,開啟串列埠監視器會看到下圖內容:
注意:燒寫成功後,關閉ArduinoIDE然後重新開啟(目的是為了和ESP8266建立無線通訊)。
然後在工具選單的埠項中你會發現多了一個 "esp8266-xxxxx" 的選單項,選中它。
接下來,請往NodeMcu燒寫V1.1版本程式碼(跟上面程式碼一樣,就是改變了版本號):
/**
* 功能描述:OTA之Arduino IDE更新 V1.1版本程式碼
*
*/
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
#define CodeVersion "CodeVersion V1.1"
const char* ssid = "xxxx";//填上wifi賬號
const char* password = "xxxx";//填上wifi密碼
void setup() {
DebugBegin(115200);
DebugPrintln("Booting Sketch....");
DebugPrintln(CodeVersion);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
DebugPrintln("Connection Failed! Rebooting...");
delay(5000);
//重啟ESP8266模組
ESP.restart();
}
// Port defaults to 8266
// ArduinoOTA.setPort(8266);
// Hostname defaults to esp8266-[ChipID]
// ArduinoOTA.setHostname("myesp8266");
// No authentication by default
// ArduinoOTA.setPassword("admin");
// Password can be set with it's md5 value as well
// MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
// ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");
ArduinoOTA.onStart([]() {
String type;
//判斷一下OTA內容
if (ArduinoOTA.getCommand() == U_FLASH) {
type = "sketch";
} else { // U_SPIFFS
type = "filesystem";
}
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
DebugPrintln("Start updating " + type);
});
ArduinoOTA.onEnd([]() {
DebugPrintln("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
DebugPrintF("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
DebugPrintF("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) {
DebugPrintln("Auth Failed");
} else if (error == OTA_BEGIN_ERROR) {
DebugPrintln("Begin Failed");
} else if (error == OTA_CONNECT_ERROR) {
DebugPrintln("Connect Failed");
} else if (error == OTA_RECEIVE_ERROR) {
DebugPrintln("Receive Failed");
} else if (error == OTA_END_ERROR) {
DebugPrintln("End Failed");
}
});
ArduinoOTA.begin();
DebugPrintln("Ready");
DebugPrint("IP address: ");
DebugPrintln(WiFi.localIP());
}
void loop() {
ArduinoOTA.handle();
}
編譯點選上傳,會出現以下頁面:
更新完畢,重啟8266
實驗總結:
OTA之Arduino IDE更新實現邏輯非常簡單,主要包括幾方面:
- 連線WIFI
- 配置 ArduinoOTA 物件的事件函式
- 啟動 ArduinoOTA 服務 ArduinoOTA.begin()
- 在 loop() 函式將處理權交由 ArduinoOTA.handle()
為了區分正常工作模式以及更新模式,我們可以設定個標誌位來區分(標誌位通過其他手段修改,比如按鈕、軟體控制)。
void loop() {
if (flag ==0 ) {
// 正常工作狀態的程式碼
} else {
ArduinoOTA.handle();
}
}
4. WebUpdateOTA —— OTA之web更新
OTA之web更新,通過8266上配置的webserver來選擇韌體更新,這種方式適合開發者以及有簡單配置經驗的消費者,其操作過程如下:
- 用ESP8266先建立一個Web伺服器然後提供一個web更新介面,需要使用到庫 ESP8266HTTPUpdateServer;
- 通過Arduino將原始檔編譯為*.bin的二進位制檔案;
- 通過mDNS功能在瀏覽器中訪問ESP8266的伺服器頁面,預設服務地址為:http://esp8266.local/update;
- 通過Web介面將本地編譯好的*.bin二進位制韌體檔案上傳到ESP8266中;
- 上傳完成編譯檔案後ESP8266將韌體寫入Flash中
OTA之web更新,請加上以下標頭檔案:
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
接下來,先上一個博主總結的百度腦圖:
方法只有兩個,非常簡單。
4.1 updateCredentials —— 驗證使用者資訊
函式說明:
/**
* 校驗使用者資訊
* @param username 使用者名稱稱
* @param password 使用者密碼
*/
void updateCredentials(const char * username, const char * password)
4.2 setup —— 配置WebOTA
函式說明:
/**
* 配置WebOTA
* @param ESP8266WebServer 需要繫結的webserver
*/
void setup(ESP8266WebServer *server){
setup(server, NULL, NULL);
}
/**
* 配置WebOTA
* @param ESP8266WebServer 需要繫結的webserver
* @param path 註冊uri
*/
void setup(ESP8266WebServer *server, const char * path){
setup(server, path, NULL, NULL);
}
/**
* 配置WebOTA
* @param ESP8266WebServer 需要繫結的webserver
* @param username 使用者名稱稱
* @param password 使用者密碼
*/
void setup(ESP8266WebServer *server, const char * username, const char * password){
setup(server, "/update", username, password);
}
/**
* 配置WebOTA
* @param ESP8266WebServer 需要繫結的webserver
* @param username 使用者名稱稱
* @param password 使用者密碼
* @param path 註冊uri (預設是"/update")
*/
void setup(ESP8266WebServer *server, const char * path, const char * username, const char * password);
來分析一下setup原始碼:
/**
* 配置WebOTA
* @param ESP8266WebServer 需要繫結的webserver
* @param username 使用者名稱稱
* @param password 使用者密碼
* @param path 註冊uri (預設是"/update")
*/
void ESP8266HTTPUpdateServer::setup(ESP8266WebServer *server, const char * path, const char * username, const char * password)
{
_server = server;
_username = (char *)username;
_password = (char *)password;
// 註冊webserver的響應回撥函式
_server->on(path, HTTP_GET, [&](){
//校驗使用者資訊 通過就傳送更新頁面
if(_username != NULL && _password != NULL && !_server->authenticate(_username, _password))
return _server->requestAuthentication();
_server->send_P(200, PSTR("text/html"), serverIndex);
});
// 註冊webserver的響應回撥函式 處理檔案上傳 檔案結束
_server->on(path, HTTP_POST, [&](){
//檔案上傳完畢回撥
if(!_authenticated)
return _server->requestAuthentication();
if (Update.hasError()) {
_server->send(200, F("text/html"), String(F("Update error: ")) + _updaterError);
} else {
_server->client().setNoDelay(true);
_server->send_P(200, PSTR("text/html"), successResponse);
delay(100);
//斷開http連線
_server->client().stop();
//重啟ESP8266
ESP.restart();
}
},[&](){
// 通過 Update 物件處理檔案上傳,關於update物件請看上面的講解。
HTTPUpload& upload = _server->upload();
//韌體上傳開始
if(upload.status == UPLOAD_FILE_START){
_updaterError = String();
if (_serial_output)
Serial.setDebugOutput(true);
_authenticated = (_username == NULL || _password == NULL || _server->authenticate(_username, _password));
if(!_authenticated){
if (_serial_output)
Serial.printf("Unauthenticated Update\n");
return;
}
WiFiUDP::stopAll();
if (_serial_output)
Serial.printf("Update: %s\n", upload.filename.c_str());
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
if(!Update.begin(maxSketchSpace)){//start with max available size
_setUpdaterError();
}
} else if(_authenticated && upload.status == UPLOAD_FILE_WRITE && !_updaterError.length()){
//韌體正在寫入
if (_serial_output) Serial.printf(".");
if(Update.write(upload.buf, upload.currentSize) != upload.currentSize){
_setUpdaterError();
}
} else if(_authenticated && upload.status == UPLOAD_FILE_END && !_updaterError.length()){
//韌體正在寫入結束
if(Update.end(true)){ //true to set the size to the current progress
if (_serial_output) Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
} else {
_setUpdaterError();
}
if (_serial_output) Serial.setDebugOutput(false);
} else if(_authenticated && upload.status == UPLOAD_FILE_ABORTED){
Update.end();
if (_serial_output) Serial.println("Update was aborted");
}
delay(0);
});
}
整體上來說,博主比較建議這種方法,簡單快捷,巧妙利用了webserver。
4.3 例項
4.3.1 系統自帶OTA之web更新
實驗說明:
演示ESP8266 OTA之web更新,通過建立的webserver來上傳新韌體以達到更新目的。
實驗準備:
- NodeMcu開發板
實驗原始碼:
先往ESP8266燒寫V1.0版本程式碼,如下:
/*
* 功能描述:OTA之web更新 V1.0版本程式碼
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
#define CodeVersion "CodeVersion V1.0"
const char* host = "esp8266-webupdate";
const char* ssid = "xxx";//填上wifi賬號
const char* password = "xxx";//填上wifi密碼
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
void setup(void) {
DebugBegin(115200);
DebugPrintln("Booting Sketch...");
DebugPrintln(CodeVersion);
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
WiFi.begin(ssid, password);
DebugPrintln("WiFi failed, retrying.");
}
//啟動mdns服務
MDNS.begin(host);
//配置webserver為更新server
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
DebugPrintF("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
}
void loop(void) {
httpServer.handleClient();
MDNS.update();
}
然後在串列埠偵錯程式就可以看到O他的更新頁面地址:
然後在瀏覽器裡面開啟該地址,會看到下面的介面:
接下來,開始更新程式碼。
在首選項設定裡面的“顯示詳細輸出”選項中選中"編譯"
然後修改程式碼為V1.1版本,如下:
/*
* 功能描述:OTA之web更新 V1.1版本程式碼
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
#define CodeVersion "CodeVersion V1.1"
const char* host = "esp8266-webupdate";
const char* ssid = "xxx";//填上wifi賬號
const char* password = "xxx";//填上wifi密碼
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
void setup(void) {
DebugBegin(115200);
DebugPrintln("Booting Sketch...");
DebugPrintln(CodeVersion);
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
WiFi.begin(ssid, password);
DebugPrintln("WiFi failed, retrying.");
}
//啟動mdns服務
MDNS.begin(host);
//配置webserver為更新server
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
DebugPrintF("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
}
void loop(void) {
httpServer.handleClient();
MDNS.update();
}
編譯該程式碼,然後找到新韌體的本地地址,
回到瀏覽器點選“Choose file”按鈕然後選擇該新韌體就可以上傳到ESP8266中去:
更新結束。
實驗結果:
可以看到下面的列印結果:
實驗總結:
這個更新介面做得有點醜,可以提供給開發人員用,儘量還是不要給消費者用。
4.3.2 自定義OTA之web更新
實驗說明:
在上面的系統自帶OTA之web更新例項中,由於是系統自帶的更新頁面,還是有點醜。對於開發人員來說,這個頁面我表示接受不了了。
自定義頁面有兩種方式:
- 直接修改 ESP8266HTTPUpdateServer 裡面web頁面,讀者可以把 ESP8266HTTPUpdateServer.cpp檔案裡面的serverIndex改成下面博主提供的serverIndex,這裡暫且不講;
- 基於 ESP8266HTTPUpdateServer 庫去自定義新庫,我們暫且命名為 ESP8266CustomHTTPUpdateServer,博主建議並講解這種方式;
ESP8266CustomHTTPUpdateServer庫的實現步驟:
- 請找到ESP8266核心庫目錄,然後在libraries目錄下拷貝 ESP8266HTTPUpdateServer 目錄,重新命名為 ESP8266CustomHTTPUpdateServer
- 修改 ESP8266CustomHTTPUpdateServer 裡面的類名,把 ESP8266HTTPUpdateServer 統一改成 ESP8266CustomHTTPUpdateServer;
- 把 ESP8266CustomHTTPUpdateServer.cpp檔案裡面的serverIndex改成以下內容:
static const char serverIndex[] PROGMEM =
"<!DOCTYPE html>\r\n\
<html lang=\"en\">\r\n\
<head>\r\n\
<meta charset=\"UTF-8\">\r\n\
<title>ESP8266 WebOTA</title>\r\n\
<style>\r\n\
body{text-align: center;height: 100%;}\r\n\
div,input{padding:5px;font-size:12px;}\r\n\
input{width:95%;margin-top: 5px;}\r\n\
button{padding:5px;border:0;border-radius:20px;background-color:#1fa3ec;color:#fff;line-height:30px;font-size:16px;width:100%;margin-top: 40px;}\r\n\
.m-user-icon{width: 100px;height: 100px;border-radius: 50px}\r\n\
.m-user-name{font-size: 18px;font-weight: bold;margin-top: 10px;}\r\n\
.fileupload{position: relative;width:150px;height:25px;border:1px solid #66B3FF;border-radius: 4px;box-shadow: 1px 1px 5px #66B3FF;line-height: 25px;overflow: hidden;color: #66B3FF;;left: 50%;transform: translateX(-50%);text-overflow:ellipsis;white-space:nowrap}\r\n\
.fileupload input{position: absolute;width:150px;height:25px;top: 0;left: 50%;transform: translateX(-50%);opacity: 0;filter: alpha(opacity=0);-ms-filter: 'alpha(opacity=0)';}\r\n\
</style>\r\n\
</head>\r\n\
<body>\r\n\
<div style=\"text-align:center;display:inline-block;min-width:260px;margin-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\"m-user-name\">ESP8266 WebOTA更新</div>\r\n\
</div>\r\n\
<form method='POST' action='' enctype='multipart/form-data'>\r\n\
<div class=\"fileupload\">\r\n\
<script>\r\n\
function getFilename(){\r\n\
let filename=document.getElementById(\"file\").value;\r\n\
if(filename===undefined||filename===\"\"){\r\n\
document.getElementById(\"filename\").innerHTML=\"點選此處上傳檔案\";\r\n\
} else{\r\n\
let fn=filename.substring(filename.lastIndexOf(\"\\\")+1);\r\n\
document.getElementById(\"filename\").innerHTML=fn; \r\n\
}\r\n\
}\r\n\
</script>\r\n\
<span id=\"filename\">點選選擇新韌體</span>\r\n\
<input type=\"file\" name=\"file\" id=\"file\" onchange=\"getFilename()\"/>\r\n\
</div>\r\n\
<button type='submit'>確定更新</button>\r\n\
</form>\r\n\
<div style=\";margin-top: 10px;\">Copyright © 2019 By<a href='https://blog.csdn.net/wubo_fly'>微控制器菜鳥</a></div>\r\n\
</div>\r\n\
</body>\r\n\
</html>";
當然好心的博主肯定不需要你們自己寫,下載下來放到你們的8266庫目錄吧 —— ESP8266CustomHTTPUpdateServer
注意:
- ESP8266CustomHTTPUpdateServer庫用法跟ESP8266HTTPUpdateServer庫是一樣的,博主只是基於ESP8266HTTPUpdateServer修改web頁面而已,其他一概不改動。
- 博主在ArduinoIDE 1.8.5版本和esp8266 2.4.2版本加入這個庫,編譯不過。後改用ArduinoIDE 1.8.9版本以及esp8266 2.5.0版本可以編譯通過,猜測是底層編譯器不一樣,請讀者注意一下。
實驗準備:
- 需要大家有一定的web基礎——html+css+js
- NodeMcu開發板
實驗步驟
- 先往ESP8266燒寫V1.0版本程式碼,如下:
/*
* 功能描述:自定義OTA之web更新 V1.0版本程式碼
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266CustomHTTPUpdateServer.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
#define CodeVersion "CodeVersion V1.0"
const char* host = "esp8266-webupdate";
const char* ssid = "xxxx";//填上wifi賬號
const char* password = "xxxx";//填上wifi密碼
ESP8266WebServer httpServer(80);
ESP8266CustomHTTPUpdateServer httpUpdater;
void setup(void) {
DebugBegin(115200);
DebugPrintln("Booting Sketch...");
DebugPrintln(CodeVersion);
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
WiFi.begin(ssid, password);
DebugPrintln("WiFi failed, retrying.");
}
//啟動mdns服務
MDNS.begin(host);
//配置webserver為更新server
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
DebugPrintF("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
}
void loop(void) {
httpServer.handleClient();
MDNS.update();
}
可以看到串列埠列印資訊
然後可以在電腦瀏覽器訪問 http://esp8266-webupdate.local/update
接著修改程式碼為V1.1版本,如下:
/*
* 功能描述:自定義OTA之web更新 V1.1版本程式碼
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266CustomHTTPUpdateServer.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
#define CodeVersion "CodeVersion V1.1"
const char* host = "esp8266-webupdate";
const char* ssid = "TP-LINK_5344";//填上wifi賬號
const char* password = "6206908you11011010";//填上wifi密碼
ESP8266WebServer httpServer(80);
ESP8266CustomHTTPUpdateServer httpUpdater;
void setup(void) {
DebugBegin(115200);
DebugPrintln("Booting Sketch...");
DebugPrintln(CodeVersion);
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
WiFi.begin(ssid, password);
DebugPrintln("WiFi failed, retrying.");
}
//啟動mdns服務
MDNS.begin(host);
//配置webserver為更新server
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
DebugPrintF("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
}
void loop(void) {
httpServer.handleClient();
MDNS.update();
}
編譯程式碼,注意最終生成bin檔案儲存位置
選擇該bin檔案,更新完畢,可以看到串列埠列印資訊:
5. ServerUpdateOTA —— OTA之伺服器更新
OTA之伺服器更新,通過公網伺服器,把韌體放在雲端伺服器上,下載更新,這種方式適合零基礎的消費者,無感知更新;
不過由於博主暫時沒有自主開發伺服器程式的能力,所以這裡暫時只討論需用用到的庫,原理本質上都是一樣的。
ServerUpdateOTA需要用到 ESP8266httpUpdate 庫,請在程式碼中引入以下標頭檔案:
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
接下來,先上一個博主總結的百度腦圖:
方法只有兩個,非常簡單。
5.1 update —— 更新韌體
函式說明:
/**
* 更新韌體(http)
* @param url 韌體下載地址
* @param currentVersion 韌體當前版本
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return update(const String& url, const String& currentVersion = "");
/**
* 更新韌體(https)
* @param url 韌體下載地址
* @param currentVersion 韌體當前版本
* @param httpsFingerprint https相關資訊
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return update(const String& url, const String& currentVersion,const String& httpsFingerprint);
/**
* 更新韌體(https)
* @param url 韌體下載地址
* @param currentVersion 韌體當前版本
* @param httpsFingerprint https相關資訊
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return update(const String& url, const String& currentVersion,const uint8_t httpsFingerprint[20]); // BearSSL
/**
* 更新韌體(http)
* @param host 主機
* @param port 埠
* @param uri uri 地址
* @param currentVersion 韌體當前版本
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri = "/",const String& currentVersion = "");
/**
* 更新韌體(https)
* @param host 主機
* @param port 埠
* @param uri uri 地址
* @param currentVersion 韌體當前版本
* @param httpsFingerprint https相關資訊
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,const String& currentVersion, const String& httpsFingerprint);
/**
* 更新韌體(https)
* @param host 主機
* @param port 埠
* @param uri uri 地址
* @param currentVersion 韌體當前版本
* @param httpsFingerprint https相關資訊
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return update(const String& host, uint16_t port, const String& url,const String& currentVersion, const uint8_t httpsFingerprint[20]); // BearSSL
t_httpUpdate_return定義如下:
enum HTTPUpdateResult {
HTTP_UPDATE_FAILED,//更新失敗
HTTP_UPDATE_NO_UPDATES,//未開始更新
HTTP_UPDATE_OK//更新完畢
};
5.2 rebootOnUpdate —— 是否自動重啟
函式說明:
/**
* 設定是否自動重啟
* @param reboot true表示自動重啟,預設false
*/
void rebootOnUpdate(bool reboot);
5.3 updateSpiffs —— 更新SPIFFS
函式說明:
/**
* 更新韌體(http)
* @param url 韌體下載地址
* @param currentVersion 韌體當前版本
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion = "");
/**
* 更新韌體(http)
* @param url 韌體下載地址
* @param currentVersion 韌體當前版本
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint);
/**
* 更新韌體(http)
* @param url 韌體下載地址
* @param currentVersion 韌體當前版本
* @return t_httpUpdate_return 更新狀態
*/
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion, const uint8_t httpsFingerprint[20]); // BearSSL
5.4 例項
博主沒有具體的伺服器(原理都是非常相似的,把伺服器上面的新韌體下載下來,然後更新),所以這裡只是給一個通用的程式碼:
/**
* 功能描述:OTA之伺服器更新
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
//除錯定義
#define DebugBegin(baud_rate) Serial.begin(baud_rate)
#define DebugPrintln(message) Serial.println(message)
#define DebugPrint(message) Serial.print(message)
#define DebugPrintF(...) Serial.printf( __VA_ARGS__ )
ESP8266WiFiMulti WiFiMulti;
void setup() {
DebugBegin(115200);
WiFi.mode(WIFI_STA);
//這裡填上wifi賬號 SSID 和 密碼 PASSWORD
WiFiMulti.addAP("SSID", "PASSWORD");
}
void loop() {
// wait for WiFi connection
if ((WiFiMulti.run() == WL_CONNECTED)) {
//填上伺服器地址
t_httpUpdate_return ret = ESPhttpUpdate.update("http://server/file.bin");
//t_httpUpdate_return ret = ESPhttpUpdate.update("https://server/file.bin", "", "fingerprint");
switch (ret) {
case HTTP_UPDATE_FAILED:
DebugPrintF("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
break;
case HTTP_UPDATE_NO_UPDATES:
DebugPrintln("HTTP_UPDATE_NO_UPDATES");
break;
case HTTP_UPDATE_OK:
DebugPrintln("HTTP_UPDATE_OK");
break;
}
}
}
等博主後面學習了伺服器開發,再補回來吧。
6. 總結
在Arduino Core For ESP8266中,使用OTA功能可以有三種方式:
- ArduinoOTA —— OTA之Arduino IDE更新,也就是無線更新需要利用到Arduino IDE,只是不需要通過串列埠線燒寫而已,這種方式適合開發者;
- WebUpdateOTA —— OTA之web更新,通過8266上配置的webserver來選擇韌體更新,這種方式適合開發者以及有簡單配置經驗的消費者;
- ServerUpdateOTA —— OTA之伺服器更新,通過公網伺服器,把韌體放在雲端伺服器上,下載更新,這種方式適合零基礎的消費者,無感知更新;
至於使用哪一種,看具體需求。
其實不管哪一種方式,其最終目的:
為了把新韌體燒寫到Flash中,然後替代掉舊韌體,以達到更新韌體的效果。
注意,OTA更新也可以更新SPIFFS。