fix linux ota file error.

This commit is contained in:
amass 2024-12-16 19:01:28 +08:00
parent 7c2a29740b
commit d3ccaba32f
3 changed files with 23 additions and 15 deletions

View File

@ -517,7 +517,11 @@ void DeviceConnection::requestReset() {
void DeviceConnection::transferBinContent() {
constexpr int SliceSize = 1024;
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];
int sendSize = SliceSize;

View File

@ -191,7 +191,7 @@ ApplicationWindow {
return
} else {
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认", () => {
App.resetDevice();
App.resetDevice()
})
}
}
@ -228,11 +228,14 @@ ApplicationWindow {
dialog = Qt.createQmlObject("import QtQuick.Dialogs; FileDialog {}", window, "myDynamicSnippet")
}
if (dialog) {
dialog.nameFilters = nameFilters;
dialog.nameFilters = nameFilters
dialog.visible = true
dialog.accepted.connect(function () {
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)
dialog.destroy()
})

View File

@ -41,6 +41,7 @@ Popup {
Layout.fillWidth: true
readOnly: true
placeholderText: "请选择升级bin文件"
selectByMouse: true
}
Button {
enabled: otaFinished