完成远程控制页面中急停的长按选中类别的操作-待测试
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:maibu_satabot_v2/features/remote_control/data/models/running_status_model.dart';
|
||||
import 'package:maibu_satabot_v2/features/remote_control/presentation/bloc/remote_control_state.dart';
|
||||
@@ -134,13 +135,19 @@ class RemoteControlCubit extends Cubit<RemoteControlState> {
|
||||
|
||||
// 4. 更新功能开关 (比如割刀速度、灯光、点火等)
|
||||
void updateFunction({int? mower, int? lift, int? ignition, bool? emergency}) {
|
||||
debugPrint('🔧 [updateFunction] 调用 - mower: $mower, lift: $lift, ignition: $ignition, emergency: $emergency');
|
||||
final updatedEntity = state.controlEntity.copyWith(
|
||||
mower: mower,
|
||||
lift: lift,
|
||||
ignition: ignition,
|
||||
emergency: emergency,
|
||||
);
|
||||
emit(state.copyWith(controlEntity: updatedEntity));
|
||||
//emit(state.copyWith(controlEntity: updatedEntity));
|
||||
emit(state.copyWith(
|
||||
controlEntity: updatedEntity,
|
||||
isEmergency: emergency ?? state.isEmergency,
|
||||
));
|
||||
debugPrint('✅ [updateFunction] 状态已更新并 emit');
|
||||
}
|
||||
|
||||
void updateOriginY(int y) {
|
||||
@@ -186,7 +193,10 @@ class RemoteControlCubit extends Cubit<RemoteControlState> {
|
||||
|
||||
void updateChassisLift(int i) {}
|
||||
|
||||
void updateEmergency(bool bool) {}
|
||||
void updateEmergency(bool bool) {
|
||||
debugPrint('🚨 [急停] ${bool ? "触发急停!" : "解除急停"}');
|
||||
updateFunction(emergency: bool);
|
||||
}
|
||||
|
||||
void respondPermission(bool bool, String deviceId) {
|
||||
emit(state.copyWith(showPermissionRequestDialog: false));
|
||||
@@ -243,16 +253,19 @@ class RemoteControlCubit extends Cubit<RemoteControlState> {
|
||||
}
|
||||
/// 发送底盘指令
|
||||
void sendChassisCommand(int i) {
|
||||
debugPrint(' [底盘指令] ${i}');
|
||||
updateFunction(lift: i);
|
||||
}
|
||||
/// 发送割刀指令
|
||||
void sendMowerCommand(int i) {
|
||||
debugPrint(' [割刀指令] ${i}');
|
||||
updateFunction(mower: i);
|
||||
}
|
||||
/// 发送点火指令
|
||||
void sendFireCommand(int i) {
|
||||
//void updateFunction({int? mower, int? lift, int? ignition, bool? emergency})
|
||||
// updateFunction(mower:0, lift: 0, ignition: i, emergency: false);
|
||||
debugPrint(' [点火指令] ${i}');
|
||||
updateFunction(ignition: i);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user