111
This commit is contained in:
1 parent
ecf4c32ca6
commit
e150f96f3a
3 files changed
+33
-25
No files matched your search
@@ -107,6 +107,8 @@ class SteelyardController extends GetxController {
|
||||
widget.value = 0;
|
||||
callbackWidget.value = 0;
|
||||
price.value = 0;
|
||||
_noUpdateTimer?.cancel();
|
||||
_noUpdateTimer = null;
|
||||
}
|
||||
|
||||
// 打开称串口
|
||||
@@ -141,7 +143,9 @@ class SteelyardController extends GetxController {
|
||||
appC.srialSteelyardManage.listen((event) {
|
||||
final w = appC.srialSteelyardManage.parseWidget(event);
|
||||
if (ObjectUtil.isEmpty(w)) return;
|
||||
callbackWidget.value = w!;
|
||||
// 保留两位小数并向上取整
|
||||
final roundedWeight = (w! * 100).ceil() / 100;
|
||||
callbackWidget.value = roundedWeight;
|
||||
});
|
||||
interval(
|
||||
callbackWidget,
|
||||
@@ -166,7 +170,6 @@ class SteelyardController extends GetxController {
|
||||
time: const Duration(milliseconds: 100),
|
||||
);
|
||||
} catch (e) {
|
||||
_closeStatus();
|
||||
_closeStatus();
|
||||
logger.e("|$_tag|打开并监听称串口失败error|$e|");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user