Skip to content

Commit

Permalink
🐛 bug fix: Pg bar freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed Jul 25, 2024
1 parent 7ea7866 commit c006774
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions Properties/SETTINGS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class SETTINGS
public const string RPC_URL = "http://127.0.0.1:8563/";

public const string WS_RPC_URL = "ws://127.0.0.1:8563/rpc";

public static bool DISABLE_DEBUG_CHAN_DATA_OUTPUT = true;

public static string DATA_DIR = RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
Expand Down
4 changes: 3 additions & 1 deletion Utils/BLE/Platforms/RPC/WSRPCBLE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Newtonsoft.Json;
Expand Down Expand Up @@ -30,7 +31,7 @@ public WSRPCBLE(bool useManual)
wsrpc.StartWSRPC();
}

// See BLEPlugin.py
// See BLEPlugin.go
public bool GetBleAvailabilityAsync()
{
if (!manual)
Expand Down Expand Up @@ -82,6 +83,7 @@ public bool GetBleAvailabilityAsync()
Arguments = SETTINGS.RPC_CLIENT_PROCESS_ARGS,
UseShellExecute = false,
CreateNoWindow = true,
StandardOutputEncoding = Encoding.UTF8,
RedirectStandardError = true,
RedirectStandardOutput = true
}
Expand Down
18 changes: 9 additions & 9 deletions Utils/Serial/WriBootImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public bool NHandShake()
_sp.BaudRate = 115200;
_sp.Open();
Thread.Sleep(100);
DebugWindow.GetInstance().updateDebugContent("Successfully handshake!");
// DebugWindow.GetInstance().updateDebugContent("Successfully handshake!");
return true;
}
}
Expand Down Expand Up @@ -414,7 +414,7 @@ public bool NCommunication()
{
case NImgStep.Step_HandShake:
{
DebugWindow.GetInstance().updateDebugContent("NImgStep.Step_HandShake");
// DebugWindow.GetInstance().updateDebugContent("NImgStep.Step_HandShake");
byte[] array = Encoding.ASCII.GetBytes(STR_HANDSHAKE);
packageLength = LoadPackage(NCommandType.CMD_HANDSHAKE, 0, array.Length, array);
_sp.WriteByte(bufForData, 0, packageLength);
Expand All @@ -425,7 +425,7 @@ public bool NCommunication()
}
case NImgStep.Step_Over:
{
DebugWindow.GetInstance().updateDebugContent("NImgStep.Step_Over");
// DebugWindow.GetInstance().updateDebugContent("NImgStep.Step_Over");
byte[] array = Encoding.ASCII.GetBytes("Over");
packageLength = LoadPackage(NCommandType.CMD_OVER, 0, array.Length, array);
_sp.WriteByte(bufForData, 0, packageLength);
Expand All @@ -438,7 +438,7 @@ public bool NCommunication()
case NImgStep.Step_SetImageAddress:
case NImgStep.Step_SetVoiceAddress:
{
DebugWindow.GetInstance().updateDebugContent("NImgStep.3set");
// DebugWindow.GetInstance().updateDebugContent("NImgStep.3set");
byte[] array = new byte[4];
array[3] = (byte)((uint)(address >> 24) & 0xFFu);
array[2] = (byte)((uint)(address >> 16) & 0xFFu);
Expand All @@ -452,7 +452,7 @@ public bool NCommunication()
}
case NImgStep.Step_Erase:
{
DebugWindow.GetInstance().updateDebugContent("NImgStep.erase");
// DebugWindow.GetInstance().updateDebugContent("NImgStep.erase");
int num2 = 17668;
byte[] array = new byte[6];
array[3] = (byte)((uint)(address >> 24) & 0xFFu);
Expand All @@ -469,7 +469,7 @@ public bool NCommunication()
}
case NImgStep.Step_Data:
{
DebugWindow.GetInstance().updateDebugContent("NImgStep.data");
// DebugWindow.GetInstance().updateDebugContent("NImgStep.data");
byte[] array = new byte[1024];
Array.Copy(bufferBmpData, num, array, 0, 1024);
if (num <= byteOfData)
Expand All @@ -487,11 +487,11 @@ public bool NCommunication()
break;
}
case NImgStep.Step_Receive_1:
DebugWindow.GetInstance().updateDebugContent($"NImgStep.recv1:{readFailedTimes}");
// DebugWindow.GetInstance().updateDebugContent($"NImgStep.recv1:{readFailedTimes}");
if (_sp.BytesToReadFromCache >= 1)
{
readFailedTimes = 0;
DebugWindow.GetInstance().updateDebugContent("Gonna read something out...");
// DebugWindow.GetInstance().updateDebugContent("Gonna read something out...");
_sp.ReadByte(bufForData, 0, 1);
if (bufForData[0] == 165)
{
Expand All @@ -514,7 +514,7 @@ public bool NCommunication()
}
break;
case NImgStep.Step_Receive_2:
DebugWindow.GetInstance().updateDebugContent("NImgStep.recv2");
// DebugWindow.GetInstance().updateDebugContent("NImgStep.recv2");
if (flagReceivePackageOver)
{
flagReceivePackageOver = false;
Expand Down

0 comments on commit c006774

Please sign in to comment.