优化wifi

This commit is contained in:
“虞渠成” 2026-06-23 15:54:48 +08:00
parent e22f0a13a0
commit d6eda72140
3 changed files with 20 additions and 0 deletions

View File

@ -344,8 +344,10 @@ namespace Kill.UI.Pages
if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth) if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth)
{ {
LoadingUI.Show();
bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync( bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync(
BLEConstants.CMD_ANGLE_CONTROL, angleControl.ToBytes()); BLEConstants.CMD_ANGLE_CONTROL, angleControl.ToBytes());
LoadingUI.Hide();
if (success) if (success)
{ {
Debug.Log($"[FovSettingPage] 角度设置成功: {selectedAngle}°"); Debug.Log($"[FovSettingPage] 角度设置成功: {selectedAngle}°");
@ -400,8 +402,10 @@ namespace Kill.UI.Pages
if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth) if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth)
{ {
LoadingUI.Show();
bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync( bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync(
BLEConstants.CMD_VISIBLE_LASER_CONTROL, vllControl.ToBytes()); BLEConstants.CMD_VISIBLE_LASER_CONTROL, vllControl.ToBytes());
LoadingUI.Hide();
if (success) if (success)
{ {
Debug.Log($"[FovSettingPage] 可见激光设置成功: {(newVllState ? "" : "")}"); Debug.Log($"[FovSettingPage] 可见激光设置成功: {(newVllState ? "" : "")}");
@ -412,6 +416,7 @@ namespace Kill.UI.Pages
else else
{ {
Debug.LogError("[FovSettingPage] 可见激光设置失败"); Debug.LogError("[FovSettingPage] 可见激光设置失败");
// 失败不更新UI保持原状态
} }
} }
else else
@ -492,6 +497,7 @@ namespace Kill.UI.Pages
{ {
Debug.LogError("[FovSettingPage] 角度恢复失败"); Debug.LogError("[FovSettingPage] 角度恢复失败");
} }
LoadingUI.Hide();
NotifyHomePageRefresh(); NotifyHomePageRefresh();
ClosePage(); ClosePage();
} }

View File

@ -1207,6 +1207,14 @@ namespace Kill.UI.Pages
InitDeviceUIFromConfig(); InitDeviceUIFromConfig();
} }
} }
else
{
Debug.LogError("[HomePageCtrl] WiFi锁定设置失败");
}
}
catch (System.Exception ex)
{
Debug.LogError($"[HomePageCtrl] WiFi锁定设置异常: {ex.Message}");
} }
finally finally
{ {

View File

@ -445,8 +445,10 @@ namespace Kill.UI.Pages
if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth) if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth)
{ {
LoadingUI.Show();
bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync( bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync(
BLEConstants.CMD_DISTANCE_CONTROL, distanceControl.ToBytes()); BLEConstants.CMD_DISTANCE_CONTROL, distanceControl.ToBytes());
LoadingUI.Hide();
if (success) if (success)
{ {
Debug.Log($"[LensSettingPage] 距离设置成功: {selectedLensValue}m"); Debug.Log($"[LensSettingPage] 距离设置成功: {selectedLensValue}m");
@ -500,8 +502,10 @@ namespace Kill.UI.Pages
if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth) if (DataManager.Instance.hasWifi && !DataManager.Instance.hasBluetooth)
{ {
LoadingUI.Show();
bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync( bool success = await HomePageCtrl.Instance.SendBleCommandByWifiAsync(
BLEConstants.CMD_VISIBLE_LASER_CONTROL, vllControl.ToBytes()); BLEConstants.CMD_VISIBLE_LASER_CONTROL, vllControl.ToBytes());
LoadingUI.Hide();
if (success) if (success)
{ {
Debug.Log($"[LensSettingPage] 可见激光设置成功: {(newVllState ? "" : "")}"); Debug.Log($"[LensSettingPage] 可见激光设置成功: {(newVllState ? "" : "")}");
@ -512,6 +516,7 @@ namespace Kill.UI.Pages
else else
{ {
Debug.LogError("[LensSettingPage] 可见激光设置失败"); Debug.LogError("[LensSettingPage] 可见激光设置失败");
// 失败不更新UI保持原状态
} }
} }
else else
@ -650,6 +655,7 @@ namespace Kill.UI.Pages
{ {
Debug.LogError("[LensSettingPage] 距离恢复失败"); Debug.LogError("[LensSettingPage] 距离恢复失败");
} }
LoadingUI.Hide();
NotifyHomePageRefresh(); NotifyHomePageRefresh();
ClosePage(); ClosePage();
} }