fix:修复设置电机功率出现错误的问题

This commit is contained in:
liyi 2025-02-18 09:59:25 +08:00
parent c9ba5aa769
commit 9cf186dab5
3 changed files with 52 additions and 35 deletions

View File

@ -500,7 +500,10 @@ class _LockSetPageState extends State<LockSetPage>
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.motorPowerPage); Get.toNamed(Routers.motorPowerPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})), })),
// 广使 // 广使
/* 2024-01-12 广 by DaisyWu /* 2024-01-12 广 by DaisyWu

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
@ -28,6 +29,7 @@ class MotorPowerLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue =
state.motorTorsion.value; state.motorTorsion.value;
eventBus eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); .fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
showToast('操作成功'.tr); showToast('操作成功'.tr);
@ -36,6 +38,7 @@ class MotorPowerLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -43,6 +46,10 @@ class MotorPowerLogic extends BaseGetXController {
_replySetSupportFunctionsWithParameters(reply); _replySetSupportFunctionsWithParameters(reply);
} }
if (reply is SetSupportFunctionsWithParametersReply) {
_replySetSupportFunctionsWithParameters(reply);
}
// () // ()
// if(reply is ReadSupportFunctionsNoParametersReply) { // if(reply is ReadSupportFunctionsNoParametersReply) {
// _readSupportFunctionsWithParametersReply(reply); // _readSupportFunctionsWithParametersReply(reply);

View File

@ -45,29 +45,36 @@ class _MotorPowerPageState extends State<MotorPowerPage> {
SizedBox( SizedBox(
height: 40.h, height: 40.h,
), ),
_buildTipsView( Obx(
() => _buildTipsView(
'${'小功率:'.tr}\n', '耗电少'.tr, state.motorTorsion.value == 1, () { '${'小功率:'.tr}\n', '耗电少'.tr, state.motorTorsion.value == 1, () {
state.motorTorsion.value = 1; state.motorTorsion.value = 1;
logic.sendOpenDoorDirection(); logic.sendOpenDoorDirection();
}), }),
),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
_buildTipsView( Obx(
() => _buildTipsView(
'${'中功率'.tr}\n', '常规使用'.tr, state.motorTorsion.value == 2, () { '${'中功率'.tr}\n', '常规使用'.tr, state.motorTorsion.value == 2, () {
state.motorTorsion.value = 2; state.motorTorsion.value = 2;
logic.sendOpenDoorDirection(); logic.sendOpenDoorDirection();
}), }),
),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
_buildTipsView( Obx(
() => _buildTipsView(
'${'大功率'.tr}\n', '大功率提示'.tr, state.motorTorsion.value == 3, () { '${'大功率'.tr}\n', '大功率提示'.tr, state.motorTorsion.value == 3, () {
state.motorTorsion.value = 3; state.motorTorsion.value = 3;
logic.sendOpenDoorDirection(); logic.sendOpenDoorDirection();
}), }),
)
], ],
)); ),
);
} }
Widget _buildTipsView( Widget _buildTipsView(