Skip to content

Commit

Permalink
⚗️ Wondering if 8600pro img writer is compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed Jul 9, 2024
1 parent 2a3b30f commit 3890c43
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
18 changes: 18 additions & 0 deletions Utils/Serial/MySerialPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ public void OpenSerial()
_sp.Open();
}
}


// 8600pro的串口
public void OpenSerialPro()
{
_sp.PortName = TargetPort;
_sp.BaudRate = 9600;
_sp.DataBits = 8;
_sp.StopBits = StopBits.One;
_sp.Parity = Parity.None;
_sp.ReadBufferSize = 10240;
_sp.WriteBufferSize = 10240;
_sp.DtrEnable = true;
_sp.RtsEnable = true;
_sp.ReadTimeout = 4000;
_sp.WriteTimeout = 4000;
_sp.Open();
}

public void CloseSerial()
{
Expand Down
17 changes: 8 additions & 9 deletions Utils/Serial/WriBootImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ public WriBootImage(SHX_DEVICE device, SKBitmap img)
{
_device = device;
image = img;
comStep = State.HandShakeStep1;
NComStep = NImgStep.Step_HandShake;
if (device != SHX_DEVICE.SHX8600PRO)
{
TimerInit();
_sp.OpenSerial();
}
else
{
TimerInitPro();
_sp.OpenSerialPro();
}
comStep = State.HandShakeStep1;
_sp.OpenSerial();
}


Expand Down Expand Up @@ -137,6 +139,7 @@ private void OverTimer_Start()
public bool WriteImg()
{
comStep = State.HandShakeStep1;
NComStep = NImgStep.Step_HandShake_Jump1;
// Bitmap bitmap2 = new Bitmap(image.Width, image.Height, PixelFormat.Format24bppRgb);
// for (int i = 0; i < image.Width; i++)
// {
Expand Down Expand Up @@ -330,10 +333,6 @@ public bool Communication()
return false;
}




// 迷惑的8600_NEW
public bool NHandShake()
{
byte[] array = new byte[1];
Expand All @@ -359,9 +358,9 @@ public bool NHandShake()
_sp.WriteByte(bufForData, 0, 1);
NComStep = NImgStep.Step_HandShake;
overTimer.Stop();
_sp.CloseSerial();
_sp.BaudRate = 115200;
_sp.Open();
// _sp.CloseSerial();
// _sp.BaudRate = 115200;
// _sp.Open();
Thread.Sleep(100);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Views/Common/DeviceSelectWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DeviceSelectWindow()
{
// if (DebugWindow.HasInstance()) DebugWindow.GetInstance().Close();
InitializeComponent();
if (HidTools.IsShxGt12HidExist()) DeviceChooseComboBox.SelectedIndex = 2;
if (HidTools.IsShxGt12HidExist()) DeviceChooseComboBox.SelectedIndex = 3;
}

private async void Device_OnClick(object? sender, RoutedEventArgs e)
Expand Down

0 comments on commit 3890c43

Please sign in to comment.