update version, fix bug / validate flash fw

This commit is contained in:
2026-03-08 20:53:26 +07:00
parent 1c1fbb7f92
commit ec78c984ad
5 changed files with 31 additions and 13 deletions

View File

@@ -11,6 +11,10 @@ echo.
cd /d "%~dp0"
REM Doc version tu file
set /p APP_VERSION=<version.txt
echo Building version: v%APP_VERSION%
REM 1. Tao venv neu chua co
if not exist "venv" (
echo [1/4] Creating virtual environment...
@@ -27,9 +31,10 @@ pip install -r requirements.txt pyinstaller --quiet
REM 4. Build .exe
echo [3/4] Building executable...
pyinstaller ^
--name "Mira_Firmware_Loader_v1.1.0" ^
--name "Mira_Firmware_Loader_v%APP_VERSION%" ^
--icon "icon.ico" ^
--add-data "icon.ico;." ^
--add-data "version.txt;." ^
--onefile ^
--windowed ^
--noconfirm ^
@@ -47,11 +52,11 @@ echo.
echo [4/4] Build complete!
echo.
if exist "dist\Mira_Firmware_Loader_v1.1.0.exe" (
echo SUCCESS: dist\Mira_Firmware_Loader_v1.1.0.exe
if exist "dist\Mira_Firmware_Loader_v%APP_VERSION%.exe" (
echo SUCCESS: dist\Mira_Firmware_Loader_v%APP_VERSION%.exe
echo.
echo File size:
for %%A in ("dist\Mira_Firmware_Loader_v1.1.0.exe") do echo %%~zA bytes
for %%A in ("dist\Mira_Firmware_Loader_v%APP_VERSION%.exe") do echo %%~zA bytes
echo.
echo Ban co the copy file .exe nay sang may khac va chay truc tiep.
) else (

View File

@@ -74,7 +74,7 @@ def _ping_sweep(network, progress_cb=None):
if progress_cb:
progress_cb(done_count[0], total)
with ThreadPoolExecutor(max_workers=70) as executor:
with ThreadPoolExecutor(max_workers=100) as executor:
futures = [executor.submit(_ping_and_track, ip) for ip in hosts]
for f in as_completed(futures):
pass

20
main.py
View File

@@ -28,7 +28,7 @@ from core.ssh_flasher import flash_device_ssh
from core.workers import ScanThread, FlashThread
from utils.network import _resolve_hostname, get_default_network
from utils.system import resource_path, get_machine_info
from utils.system import resource_path, get_machine_info, get_version
@@ -72,7 +72,7 @@ class App(QWidget):
title.setAlignment(Qt.AlignmentFlag.AlignCenter)
layout.addWidget(title)
copyright_label = QLabel(f"© {datetime.datetime.now().year} Smatec — R&D Software Team. v1.1.0")
copyright_label = QLabel(f"© {datetime.datetime.now().year} Smatec — R&D Software Team. v{get_version()}")
copyright_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
copyright_label.setStyleSheet(
"color: #9399b2; font-size: 11px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto;"
@@ -337,12 +337,12 @@ class App(QWidget):
parallel_row.addStretch()
flash_layout.addLayout(parallel_row)
btn_flash = QPushButton("⚡ FLASH SELECTED DEVICES")
btn_flash.setObjectName("flash")
btn_flash.setMinimumHeight(45)
btn_flash.setStyleSheet("QPushButton#flash { font-size: 16px; font-weight: bold; letter-spacing: 1px; }")
btn_flash.clicked.connect(self.flash_all)
flash_layout.addWidget(btn_flash)
self.btn_flash = QPushButton("⚡ FLASH SELECTED DEVICES")
self.btn_flash.setObjectName("flash")
self.btn_flash.setMinimumHeight(45)
self.btn_flash.setStyleSheet("QPushButton#flash { font-size: 16px; font-weight: bold; letter-spacing: 1px; }")
self.btn_flash.clicked.connect(self.flash_all)
flash_layout.addWidget(self.btn_flash)
flash_group.setLayout(flash_layout)
layout.addWidget(flash_group)
@@ -657,6 +657,9 @@ class App(QWidget):
self.flash_thread.device_status.connect(self._on_flash_status)
self.flash_thread.device_done.connect(self._on_flash_done)
self.flash_thread.all_done.connect(self._on_flash_all_done)
# Disable flash button during flashing
self.btn_flash.setEnabled(False)
self.flash_thread.start()
def _on_flash_status(self, index, msg):
@@ -690,6 +693,7 @@ class App(QWidget):
def _on_flash_all_done(self):
"""All flashing complete."""
self.btn_flash.setEnabled(True)
QMessageBox.information(self, "Flash Complete", "All devices have been processed.")

View File

@@ -34,3 +34,11 @@ def get_machine_info():
"os": os_info,
"mac": mac_addr,
}
def get_version():
"""Read version from version.txt"""
try:
with open(resource_path('version.txt'), 'r', encoding='utf-8') as f:
return f.read().strip()
except Exception:
return "Unknown"

1
version.txt Normal file
View File

@@ -0,0 +1 @@
1.1.1