refactor(device): 优化设备角色判断和串口配置逻辑

- 移除 Weigher2 的初始化代码从 InitActivity 到 BaseApp
- 将设备角色判断与串口配置逻辑合并到应用启动流程中
- 主设备配置为 /dev/ttyS7,子设备配置为 /dev/ttyS4
- 简化设备角色分配的条件判断逻辑
This commit is contained in:
2026-04-13 09:40:28 +08:00
parent 6a1a1f3c5c
commit bb32ed84fe
2 changed files with 7 additions and 11 deletions
@@ -58,14 +58,6 @@ class InitActivity : BaseActivity() {
initViewModel()
// 主设备上/dev/ttyS7,子设备是/dev/ttyS4
Weigher2.setDevicePort(
if (GlobalData.deviceId == "8fc2ab34-2137-3112-acca-f884ea8736d4") {
"/dev/ttyS7"
} else {
"/dev/ttyS4"
}
)
WeightUtil.init()
WeightUtil.getWeight()
WeightUtil.startContinuousRead()