fix linux ota file error.
This commit is contained in:
parent
7c2a29740b
commit
d3ccaba32f
@ -517,7 +517,11 @@ void DeviceConnection::requestReset() {
|
|||||||
void DeviceConnection::transferBinContent() {
|
void DeviceConnection::transferBinContent() {
|
||||||
constexpr int SliceSize = 1024;
|
constexpr int SliceSize = 1024;
|
||||||
constexpr int WaitMd5CheckTime = 3000; // ms
|
constexpr int WaitMd5CheckTime = 3000; // ms
|
||||||
if (m_sendedSize >= m_uploadBuffer.size()) return;
|
if (m_sendedSize >= m_uploadBuffer.size()) {
|
||||||
|
LOG(warning) << "file size is wrong, sended size: " << m_sendedSize
|
||||||
|
<< "ota file size: " << m_uploadBuffer.size();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char buffer[1 + sizeof(int32_t) + 1024];
|
char buffer[1 + sizeof(int32_t) + 1024];
|
||||||
int sendSize = SliceSize;
|
int sendSize = SliceSize;
|
||||||
|
15
qml/Main.qml
15
qml/Main.qml
@ -190,8 +190,8 @@ ApplicationWindow {
|
|||||||
showMessageDialog(2, "恢复出厂设置", "请先选择设备")
|
showMessageDialog(2, "恢复出厂设置", "请先选择设备")
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认",()=>{
|
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认", () => {
|
||||||
App.resetDevice();
|
App.resetDevice()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,8 +203,8 @@ ApplicationWindow {
|
|||||||
id: messageBar
|
id: messageBar
|
||||||
root: window.contentItem
|
root: window.contentItem
|
||||||
}
|
}
|
||||||
function showSuccess(text,duration){
|
function showSuccess(text, duration) {
|
||||||
return messageBar.showSuccess(text,duration)
|
return messageBar.showSuccess(text, duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMessageDialog(type, title, message, callback) {
|
function showMessageDialog(type, title, message, callback) {
|
||||||
@ -228,11 +228,14 @@ ApplicationWindow {
|
|||||||
dialog = Qt.createQmlObject("import QtQuick.Dialogs; FileDialog {}", window, "myDynamicSnippet")
|
dialog = Qt.createQmlObject("import QtQuick.Dialogs; FileDialog {}", window, "myDynamicSnippet")
|
||||||
}
|
}
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
dialog.nameFilters = nameFilters;
|
dialog.nameFilters = nameFilters
|
||||||
dialog.visible = true
|
dialog.visible = true
|
||||||
dialog.accepted.connect(function () {
|
dialog.accepted.connect(function () {
|
||||||
let fileUrl = isQt5 ? dialog.fileUrl.toString() : dialog.selectedFile.toString()
|
let fileUrl = isQt5 ? dialog.fileUrl.toString() : dialog.selectedFile.toString()
|
||||||
let localFilePath = fileUrl.startsWith("file:///") ? fileUrl.substring(8) : fileUrl
|
let localFilePath = fileUrl
|
||||||
|
if (fileUrl.startsWith("file:///")) {
|
||||||
|
localFilePath = fileUrl.substring(Qt.platform.os === "windows" ? 8 : 7)
|
||||||
|
}
|
||||||
onSelected(localFilePath)
|
onSelected(localFilePath)
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
})
|
})
|
||||||
|
@ -41,6 +41,7 @@ Popup {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
readOnly: true
|
readOnly: true
|
||||||
placeholderText: "请选择升级bin文件"
|
placeholderText: "请选择升级bin文件"
|
||||||
|
selectByMouse: true
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
enabled: otaFinished
|
enabled: otaFinished
|
||||||
|
Loading…
Reference in New Issue
Block a user