fix(scale): 解决称重设备清零功能问题

- 修复了ScaleServiceManager中的WeightUtil引用路径错误
- 添加了WebSocket服务器中设备ID验证失败的日志记录
- 修复了Weigher2中字符串比较的错误写法,使用equals方法替代==
- 更新了WeightUtil中清零操作的日志记录和异常处理机制
This commit is contained in:
2026-04-20 10:01:05 +08:00
parent d3b69c4e46
commit 99d670390a
4 changed files with 17 additions and 11 deletions
@@ -40,8 +40,8 @@ public class Weigher2 {
}
public static void init() {
String var0;
if ((var0 = Build.MODEL) == "pcb_941") {
String var0 = Build.MODEL;
if ("pcb_941".equals(var0)) {
Log.w(TAG, "pcb not support, " + var0);
Listener var1;
if ((var1 = mListener) != null) {
@@ -51,7 +51,7 @@ public class Weigher2 {
} else {
System.init();
initScale();
if (var0 == "pcb_908") {
if ("pcb_908".equals(var0)) {
// mDevicePort = "/dev/ttyS4";
mDevicePort = "/dev/ttyS7";
}
@@ -76,8 +76,8 @@ public class Weigher2 {
}
public static void config() {
String var0;
if ((var0 = Build.MODEL) == "pcb_941") {
String var0 = Build.MODEL;
if ("pcb_941".equals(var0)) {
Log.w(TAG, "pcb not support, " + var0);
Listener var2;
if ((var2 = mListener) != null) {
@@ -69,10 +69,12 @@ object WeightUtil {
fun tareTwo(address: Int) {
try {
//Weigher2.tareTwo(address)
Weigher2.zeroTwo(address)
Log.d(TAG, "执行清零操作: address=$address")
Weigher2.tareTwo(address)
// Weigher2.zeroTwo(address)
} catch (e: Exception) {
e.printStackTrace()
Log.e(TAG, "执行清零异常: address=$address, error=${e.message}", )
}
}