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

@ -156,9 +156,9 @@ ApplicationWindow {
}
if (App.collector.path.length <= 0) {
showFolderDialog(folder => {
App.collector.path = folder
App.collector.start(App.devices.get(deviceList.currentIndex).ip)
})
App.collector.path = folder
App.collector.start(App.devices.get(deviceList.currentIndex).ip)
})
} else {
App.collector.start(App.devices.get(
deviceList.currentIndex).ip)
@ -190,8 +190,8 @@ ApplicationWindow {
showMessageDialog(2, "恢复出厂设置", "请先选择设备")
return
} else {
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认",()=>{
App.resetDevice();
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认", () => {
App.resetDevice()
})
}
}
@ -203,19 +203,19 @@ ApplicationWindow {
id: messageBar
root: window.contentItem
}
function showSuccess(text,duration){
return messageBar.showSuccess(text,duration)
function showSuccess(text, duration) {
return messageBar.showSuccess(text, duration)
}
function showMessageDialog(type, title, message, callback) {
let component = Qt.createComponent("MessageDialog.qml")
if (component.status === Component.Ready) {
let dialog = component.createObject(window, {
"type": type,
"titleText": title,
"text": message,
"callback": callback
})
"type": type,
"titleText": title,
"text": message,
"callback": callback
})
dialog.open()
}
}
@ -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