Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DODO�
arduino-esp32
提交
cfe7e011
A
arduino-esp32
项目概览
DODO�
/
arduino-esp32
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
arduino-esp32
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cfe7e011
编写于
11月 28, 2018
作者:
J
Jeroen88
提交者:
Me No Dev
11月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove F() macro's (#2121)
上级
fcd734a1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
23 deletion
+23
-23
libraries/HTTPUpdate/src/HTTPUpdate.cpp
libraries/HTTPUpdate/src/HTTPUpdate.cpp
+23
-23
未找到文件。
libraries/HTTPUpdate/src/HTTPUpdate.cpp
浏览文件 @
cfe7e011
...
...
@@ -93,31 +93,31 @@ String HTTPUpdate::getLastErrorString(void)
StreamString
error
;
Update
.
printError
(
error
);
error
.
trim
();
// remove line ending
return
String
(
F
(
"Update error: "
)
)
+
error
;
return
String
(
"Update error: "
)
+
error
;
}
// error from http client
if
(
_lastError
>
-
100
)
{
return
String
(
F
(
"HTTP error: "
)
)
+
HTTPClient
::
errorToString
(
_lastError
);
return
String
(
"HTTP error: "
)
+
HTTPClient
::
errorToString
(
_lastError
);
}
switch
(
_lastError
)
{
case
HTTP_UE_TOO_LESS_SPACE
:
return
F
(
"Not Enough space"
)
;
return
"Not Enough space"
;
case
HTTP_UE_SERVER_NOT_REPORT_SIZE
:
return
F
(
"Server Did Not Report Size"
)
;
return
"Server Did Not Report Size"
;
case
HTTP_UE_SERVER_FILE_NOT_FOUND
:
return
F
(
"File Not Found (404)"
)
;
return
"File Not Found (404)"
;
case
HTTP_UE_SERVER_FORBIDDEN
:
return
F
(
"Forbidden (403)"
)
;
return
"Forbidden (403)"
;
case
HTTP_UE_SERVER_WRONG_HTTP_CODE
:
return
F
(
"Wrong HTTP Code"
)
;
return
"Wrong HTTP Code"
;
case
HTTP_UE_SERVER_FAULTY_MD5
:
return
F
(
"Wrong MD5"
)
;
return
"Wrong MD5"
;
case
HTTP_UE_BIN_VERIFY_HEADER_FAILED
:
return
F
(
"Verify Bin Header Failed"
)
;
return
"Verify Bin Header Failed"
;
case
HTTP_UE_BIN_FOR_WRONG_FLASH
:
return
F
(
"New Binary Does Not Fit Flash Size"
)
;
return
"New Binary Does Not Fit Flash Size"
;
}
return
String
();
...
...
@@ -164,29 +164,29 @@ HTTPUpdateResult HTTPUpdate::handleUpdate(HTTPClient& http, const String& curren
// use HTTP/1.0 for update since the update handler not support any transfer Encoding
http
.
useHTTP10
(
true
);
http
.
setTimeout
(
_httpClientTimeout
);
http
.
setUserAgent
(
F
(
"ESP32-http-Update"
)
);
http
.
addHeader
(
F
(
"Cache-Control"
),
F
(
"no-cache"
)
);
http
.
addHeader
(
F
(
"x-ESP32-STA-MAC"
)
,
WiFi
.
macAddress
());
http
.
addHeader
(
F
(
"x-ESP32-AP-MAC"
)
,
WiFi
.
softAPmacAddress
());
http
.
addHeader
(
F
(
"x-ESP32-free-space"
)
,
String
(
ESP
.
getFreeSketchSpace
()));
http
.
addHeader
(
F
(
"x-ESP32-sketch-size"
)
,
String
(
ESP
.
getSketchSize
()));
// To do http.addHeader(
F("x-ESP32-sketch-md5")
, String(ESP.getSketchMD5()));
http
.
setUserAgent
(
"ESP32-http-Update"
);
http
.
addHeader
(
"Cache-Control"
,
"no-cache"
);
http
.
addHeader
(
"x-ESP32-STA-MAC"
,
WiFi
.
macAddress
());
http
.
addHeader
(
"x-ESP32-AP-MAC"
,
WiFi
.
softAPmacAddress
());
http
.
addHeader
(
"x-ESP32-free-space"
,
String
(
ESP
.
getFreeSketchSpace
()));
http
.
addHeader
(
"x-ESP32-sketch-size"
,
String
(
ESP
.
getSketchSize
()));
// To do http.addHeader(
"x-ESP32-sketch-md5"
, String(ESP.getSketchMD5()));
// Sketch MD5 is not supported by the core, but SHA256 is, so add a SHA256 instead
String
sketchSHA256
=
getSketchSHA256
();
if
(
sketchSHA256
.
length
()
!=
0
)
{
http
.
addHeader
(
F
(
"x-ESP32-sketch-sha256"
)
,
sketchSHA256
);
http
.
addHeader
(
"x-ESP32-sketch-sha256"
,
sketchSHA256
);
}
http
.
addHeader
(
F
(
"x-ESP32-chip-size"
)
,
String
(
ESP
.
getFlashChipSize
()));
http
.
addHeader
(
F
(
"x-ESP32-sdk-version"
)
,
ESP
.
getSdkVersion
());
http
.
addHeader
(
"x-ESP32-chip-size"
,
String
(
ESP
.
getFlashChipSize
()));
http
.
addHeader
(
"x-ESP32-sdk-version"
,
ESP
.
getSdkVersion
());
if
(
spiffs
)
{
http
.
addHeader
(
F
(
"x-ESP32-mode"
),
F
(
"spiffs"
)
);
http
.
addHeader
(
"x-ESP32-mode"
,
"spiffs"
);
}
else
{
http
.
addHeader
(
F
(
"x-ESP32-mode"
),
F
(
"sketch"
)
);
http
.
addHeader
(
"x-ESP32-mode"
,
"sketch"
);
}
if
(
currentVersion
&&
currentVersion
[
0
]
!=
0x00
)
{
http
.
addHeader
(
F
(
"x-ESP32-version"
)
,
currentVersion
);
http
.
addHeader
(
"x-ESP32-version"
,
currentVersion
);
}
const
char
*
headerkeys
[]
=
{
"x-MD5"
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录