Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
fbc797ef
Commit
fbc797ef
authored
Sep 23, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 优化 边界查找拐点方式算法改进,温修范围%设置
2. 修复 AD盒设置,ip设置界面每次都重新connect,导致先读,再写入,画面看到好像没有改一样。
parent
fb7cdf6d
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
214 additions
and
430 deletions
+214
-430
StringResource.en-US.xaml
....Base/FLY.Thick.Base.UI/Culture/StringResource.en-US.xaml
+1
-0
StringResource.zh-CN.xaml
....Base/FLY.Thick.Base.UI/Culture/StringResource.zh-CN.xaml
+1
-0
Page_BorderSearch.xaml
...t.FLY.Thick.Base/FLY.Thick.Base.UI/Page_BorderSearch.xaml
+23
-10
Page_FlyAD.xaml.cs
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Page_FlyAD.xaml.cs
+0
-2
BorderSearchServiceClient.cs
...k.Base/FLY.Thick.Base/Client/BorderSearchServiceClient.cs
+63
-214
IBorderSearchService.cs
...hick.Base/FLY.Thick.Base/IService/IBorderSearchService.cs
+8
-0
BORDERSEARCH_OBJ_INTERFACE.cs
...LY.Thick.Base/OBJ_INTERFACE/BORDERSEARCH_OBJ_INTERFACE.cs
+5
-126
BorderSearch_OBJProxy.cs
...e/FLY.Thick.Base/Server.OBJProxy/BorderSearch_OBJProxy.cs
+29
-21
FlyAD_OBJProxy.cs
...ick.Base/FLY.Thick.Base/Server.OBJProxy/FlyAD_OBJProxy.cs
+2
-1
BorderSearch.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/BorderSearch.cs
+80
-54
GM_Fix.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_Fix.cs
+2
-2
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Culture/StringResource.en-US.xaml
View file @
fbc797ef
...
...
@@ -10,6 +10,7 @@
<sys:String x:Key="strSetTemperature">SetTemp</sys:String>
<sys:String x:Key="strTemperatureAD">TempAD</sys:String>
<sys:String x:Key="strTemperatureRange">TempRange</sys:String>
<sys:String x:Key="strTempRangePercent">TempRange%</sys:String>
<sys:String x:Key="strFilter">Filter</sys:String>
<sys:String x:Key="strSensorWidth">SensorWidth</sys:String>
<sys:String x:Key="strBorderLessen">B.Lessen</sys:String>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Culture/StringResource.zh-CN.xaml
View file @
fbc797ef
...
...
@@ -13,6 +13,7 @@
<sys:String x:Key="strInflectionPoint">拐点查找</sys:String>
<sys:String x:Key="strSetTemperature">设置温修</sys:String>
<sys:String x:Key="strTemperatureAD">温修AD</sys:String>
<sys:String x:Key="strTempRangePercent">温修范围%</sys:String>
<sys:String x:Key="strTemperatureRange">温修范围</sys:String>
<sys:String x:Key="strFilter">滤波器</sys:String>
<sys:String x:Key="strSensorWidth">探头直径</sys:String>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Page_BorderSearch.xaml
View file @
fbc797ef
...
...
@@ -86,18 +86,31 @@
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSetTemperature}" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding TempADBySet}" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding TempADBySet, Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=CollapsedWhenTrue}">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strTemperatureAD}" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="{Binding TempAD}" />
<Grid>
<StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding TempADBySet, Converter={StaticResource visbilityconv},ConverterParameter=CollapsedWhenTrue}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="{DynamicResource strTemperatureAD}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding TempAD}" />
</StackPanel>
<StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding TempADBySet, Converter={StaticResource ResourceKey=
visbilityconv},ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource ResourceKey=
TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTemperatureAD}" />
<TextBox Style="{StaticResource ResourceKey=
TextBoxStyle_FieldContent}" Text="{Binding TempAD}" />
<StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding TempADBySet, Converter={StaticResource
visbilityconv},ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource
TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTemperatureAD}" />
<TextBox Style="{StaticResource
TextBoxStyle_FieldContent}" Text="{Binding TempAD}" />
</StackPanel>
</Grid>
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTemperatureRange}" />
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding TempRange}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTempRangePercent}" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding IsTempRangeByPercent}" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Margin="5" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTemperatureRange}" />
<Grid>
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding TempRange}" Visibility="{Binding IsTempRangeByPercent, Converter={StaticResource visbilityconv},ConverterParameter=CollapsedWhenTrue}"/>
<StackPanel Orientation="Horizontal" Visibility="{Binding IsTempRangeByPercent, Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding TempRangePercent,Converter={StaticResource percentconv}}"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="%"/>
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
<WrapPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5">
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Page_FlyAD.xaml.cs
View file @
fbc797ef
...
...
@@ -24,8 +24,6 @@ namespace ThickTcpUiInWindow
public
partial
class
Page_FlyAD
:
Page
{
FlyADServiceClient
mFlyADService
;
IPEndPoint
ServerIPEP
;
TDGageServiceClient
mTDGageService
;
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/BorderSearchServiceClient.cs
View file @
fbc797ef
...
...
@@ -23,233 +23,72 @@ namespace FLY.Thick.Base.Client
}
#
region
IBorderSearchService
成员
private
bool
enable
;
public
bool
Enable
{
get
{
return
enable
;
}
set
{
if
(
enable
!=
value
)
{
enable
=
value
;
NotifyPropertyChanged
(
"Enable"
);
}
}
}
bool
isbreakdetect
=
true
;
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// 边界拐点检测,找到的边界更加精确
/// </summary>
public
bool
IsBreakDetect
{
get
{
return
isbreakdetect
;
}
set
{
if
(
isbreakdetect
!=
value
)
{
isbreakdetect
=
value
;
NotifyPropertyChanged
(
"IsBreakDetect"
);
}
}
}
private
Range
valid
=
new
Range
();
public
Range
Valid
{
get
{
return
valid
;
}
}
private
Range
border_backw
=
new
Range
();
public
Range
Border_Backw
{
get
{
return
border_backw
;
}
}
private
Range
border_forw
=
new
Range
();
public
Range
Border_Forw
{
get
{
return
border_forw
;
}
}
private
int
width
;
public
bool
IsBreakDetect
{
get
;
set
;
}
=
true
;
public
Range
Valid
{
get
;
}
=
new
Range
();
public
Range
Border_Backw
{
get
;
}
=
new
Range
();
public
Range
Border_Forw
{
get
;
}
=
new
Range
();
/// <summary>
/// 当前膜宽,测量出来的,单位是 脉冲
/// </summary>
public
int
Width
{
get
{
return
width
;
}
protected
set
{
if
(
width
!=
value
)
{
width
=
value
;
NotifyPropertyChanged
(
"Width"
);
}
}
}
private
int
mid
;
public
int
Width
{
get
;
protected
set
;
}
/// <summary>
/// 膜中间位置 单位 脉冲
/// </summary>
public
int
Mid
{
get
{
return
mid
;
}
protected
set
{
if
(
mid
!=
value
)
{
mid
=
value
;
NotifyPropertyChanged
(
"Mid"
);
}
}
}
public
int
Mid
{
get
;
protected
set
;
}
bool
tempADBySet
=
false
;
/// <summary>
/// 手动设置温修AD值
/// </summary>
public
bool
TempADBySet
{
get
{
return
tempADBySet
;
}
set
{
if
(
tempADBySet
!=
value
)
{
tempADBySet
=
value
;
NotifyPropertyChanged
(
"TempADBySet"
);
}
public
bool
TempADBySet
{
get
;
set
;
}
}
}
public
int
TempAD
{
get
;
set
;
}
private
int
tempad
;
public
int
TempAD
{
get
{
return
tempad
;
}
set
{
if
(
tempad
!=
value
)
{
tempad
=
value
;
NotifyPropertyChanged
(
"TempAD"
);
}
}
}
private
int
temprange
;
public
int
TempRange
{
get
{
return
temprange
;
}
set
{
if
(
temprange
!=
value
)
{
temprange
=
value
;
NotifyPropertyChanged
(
"TempRange"
);
}
}
}
private
int
n
;
public
int
N
{
get
{
return
n
;
}
set
{
if
(
n
!=
value
)
{
n
=
value
;
NotifyPropertyChanged
(
"N"
);
}
}
}
public
int
TempRange
{
get
;
set
;
}
/// <summary>
/// 温修范围是温修的百分比
/// </summary>
public
bool
IsTempRangeByPercent
{
get
;
set
;
}
=
true
;
/// <summary>
/// 温修范围百分比
/// </summary>
public
double
TempRangePercent
{
get
;
set
;
}
=
0.02
;
public
int
N
{
get
;
set
;
}
private
int
sensorwidth
;
/// <summary>
/// 探头直径,单位脉冲, 膜宽 = 边界范围 - 探头直径
/// </summary>
public
int
SensorWidth
{
get
{
return
sensorwidth
;
}
set
{
if
(
sensorwidth
!=
value
)
{
sensorwidth
=
value
;
NotifyPropertyChanged
(
"SensorWidth"
);
}
}
}
private
int
n2
;
public
int
N2
{
get
{
return
n2
;
}
set
{
if
(
n2
!=
value
)
{
n2
=
value
;
NotifyPropertyChanged
(
"N2"
);
}
}
}
private
int
n3
;
public
int
N3
{
get
{
return
n3
;
}
set
{
if
(
n3
!=
value
)
{
n3
=
value
;
NotifyPropertyChanged
(
"N3"
);
}
}
}
public
int
SensorWidth
{
get
;
set
;
}
public
int
N2
{
get
;
set
;
}
public
int
N3
{
get
;
set
;
}
private
int
[]
datas
=
null
;
/// <summary>
/// 用于调试, 进入到边界查找的数据
/// </summary>
public
int
[]
Datas
{
get
{
return
datas
;
}
protected
set
{
datas
=
value
;
NotifyPropertyChanged
(
"Datas"
);
}
}
[
PropertyChanged
.
DoNotCheckEquality
]
public
int
[]
Datas
{
get
;
protected
set
;
}
=
null
;
#
endregion
#
region
INotifyPropertyChanged
成员
...
...
@@ -278,12 +117,15 @@ namespace FLY.Thick.Base.Client
p
.
valid
=
Valid
;
p
.
sensorwidth
=
SensorWidth
;
p
.
isBreakDetect
=
IsBreakDetect
;
p
.
isTempRangeByPercent
=
IsTempRangeByPercent
;
p
.
tempRangePercent
=
TempRangePercent
;
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
//获取所有数据,设置推送
CurrObjSys
.
SetValueEx
(
mConn
,
mServerID
,
ID
,
BORDERSEARCH_OBJ_INTERFACE
.
SET_PARAMS
,
p
.
ToBytes
(
));
Misc
.
Converter
.
StringToBytes
(
json
));
}
public
override
void
Dispose
()
{
...
...
@@ -315,9 +157,9 @@ namespace FLY.Thick.Base.Client
{
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_PARAMS
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
(
);
if
(!
p
.
TryParse
(
infodata
))
return
;
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
>(
json
)
;
Enable
=
p
.
enable
;
Valid
.
Begin
=
p
.
valid
.
Begin
;
...
...
@@ -330,12 +172,17 @@ namespace FLY.Thick.Base.Client
N2
=
p
.
n2
;
N3
=
p
.
n3
;
IsBreakDetect
=
p
.
isBreakDetect
;
IsTempRangeByPercent
=
p
.
isTempRangeByPercent
;
TempRangePercent
=
p
.
tempRangePercent
;
}
break
;
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_RESULT
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Result
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Result
();
if
(!
p
.
TryParse
(
infodata
))
return
;
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Result
>(
json
);
Border_Forw
.
Begin
=
p
.
borderForw
.
Begin
;
Border_Forw
.
End
=
p
.
borderForw
.
End
;
Border_Backw
.
Begin
=
p
.
borderBackw
.
Begin
;
...
...
@@ -345,9 +192,11 @@ namespace FLY.Thick.Base.Client
}
break
;
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_DATAS
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Data
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Data
();
if
(!
p
.
TryParse
(
infodata
))
return
;
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Data
>(
json
);
Datas
=
p
.
data
;
}
break
;
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/IService/IBorderSearchService.cs
View file @
fbc797ef
...
...
@@ -54,7 +54,15 @@ namespace FLY.Thick.Base.IService
/// AD超过了范围, 就认为开始找到边界
/// </summary>
int
TempRange
{
get
;
set
;}
/// <summary>
/// 温修范围是温修的百分比
/// </summary>
bool
IsTempRangeByPercent
{
get
;
set
;
}
/// <summary>
/// 温修范围百分比
/// </summary>
double
TempRangePercent
{
get
;
set
;
}
/// <summary>
/// 有滤波器,只有非空的连续N个pos以上,才开始算边界开始
/// </summary>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/OBJ_INTERFACE/BORDERSEARCH_OBJ_INTERFACE.cs
View file @
fbc797ef
...
...
@@ -11,7 +11,7 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
public
class
BORDERSEARCH_OBJ_INTERFACE
{
#
region
Pack
public
class
Pack_Params
:
IPack
public
class
Pack_Params
{
public
bool
enable
;
public
Range
valid
;
...
...
@@ -23,142 +23,21 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
public
int
n2
;
public
int
n3
;
public
bool
isBreakDetect
;
#
region
IPack
成员
public
byte
[]
ToBytes
()
{
List
<
byte
>
buf
=
new
List
<
byte
>();
buf
.
AddRange
(
BitConverter
.
GetBytes
(
enable
));
buf
.
AddRange
(
valid
.
ToBytes
());
buf
.
AddRange
(
BitConverter
.
GetBytes
(
tempADBySet
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
tempad
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
temprange
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
n
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
sensorwidth
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
n2
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
n3
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
isBreakDetect
));
return
buf
.
ToArray
();
}
public
bool
TryParse
(
byte
[]
value
)
{
if
(
value
.
Length
<
(
1
+
8
+
1
+
4
*
6
+
1
))
return
false
;
int
idx
=
0
;
enable
=
BitConverter
.
ToBoolean
(
value
,
idx
);
idx
+=
1
;
valid
=
new
Range
();
valid
.
TryParse
(
value
,
idx
);
idx
+=
8
;
tempADBySet
=
BitConverter
.
ToBoolean
(
value
,
idx
);
idx
+=
1
;
tempad
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
temprange
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
n
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
sensorwidth
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
n2
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
n3
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
isBreakDetect
=
BitConverter
.
ToBoolean
(
value
,
idx
);
idx
+=
1
;
return
true
;
}
#
endregion
public
bool
isTempRangeByPercent
;
public
double
tempRangePercent
;
}
public
class
Pack_Result
:
IPack
public
class
Pack_Result
{
public
Range
borderForw
;
public
Range
borderBackw
;
public
int
width
;
public
int
mid
;
#
region
IPack
成员
public
byte
[]
ToBytes
()
{
List
<
byte
>
buf
=
new
List
<
byte
>();
buf
.
AddRange
(
borderForw
.
ToBytes
());
buf
.
AddRange
(
borderBackw
.
ToBytes
());
buf
.
AddRange
(
BitConverter
.
GetBytes
(
width
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
mid
));
return
buf
.
ToArray
();
}
public
bool
TryParse
(
byte
[]
value
)
{
if
(
value
.
Length
<
8
+
8
+
4
+
4
)
return
false
;
int
idx
=
0
;
borderForw
=
new
Range
();
borderForw
.
TryParse
(
value
,
0
);
idx
+=
8
;
borderBackw
=
new
Range
();
borderBackw
.
TryParse
(
value
,
idx
);
idx
+=
8
;
width
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
mid
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
return
true
;
}
#
endregion
}
public
class
Pack_Data
:
IPack
public
class
Pack_Data
{
public
int
[]
data
;
public
byte
[]
ToBytes
()
{
List
<
byte
>
buf
=
new
List
<
byte
>();
if
(
data
==
null
)
{
buf
.
AddRange
(
BitConverter
.
GetBytes
(
0
));
}
else
{
buf
.
AddRange
(
BitConverter
.
GetBytes
(
data
.
Length
));
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
buf
.
AddRange
(
BitConverter
.
GetBytes
(
data
[
i
]));
}
}
return
buf
.
ToArray
();
}
public
bool
TryParse
(
byte
[]
value
)
{
int
cnt
=
4
;
int
index
=
0
;
if
(
value
.
Length
<
(
index
+
cnt
))
return
false
;
int
idx
=
index
;
int
len
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
cnt
+=
len
*
4
;
if
(
value
.
Length
<
(
index
+
cnt
))
return
false
;
if
(
len
<=
0
)
data
=
null
;
else
{
data
=
new
int
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
data
[
i
]
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
}
}
return
true
;
}
}
#
endregion
#
region
GetValue
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server.OBJProxy/BorderSearch_OBJProxy.cs
View file @
fbc797ef
...
...
@@ -32,6 +32,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
(
e
.
PropertyName
==
"TempADBySet"
)
||
(
e
.
PropertyName
==
"TempAD"
)
||
(
e
.
PropertyName
==
"TempRange"
)
||
(
e
.
PropertyName
==
"TempRangePercent"
)
||
(
e
.
PropertyName
==
"IsTempRangeByPercent"
)
||
(
e
.
PropertyName
==
"SensorWidth"
)
||
(
e
.
PropertyName
==
"N"
)
||
(
e
.
PropertyName
==
"N2"
)
||
...
...
@@ -98,9 +100,12 @@ namespace FLY.Thick.Base.Server.OBJProxy
sensorwidth
=
mBorderSearch
.
SensorWidth
,
n2
=
mBorderSearch
.
N2
,
n3
=
mBorderSearch
.
N3
,
isBreakDetect
=
mBorderSearch
.
IsBreakDetect
isBreakDetect
=
mBorderSearch
.
IsBreakDetect
,
isTempRangeByPercent
=
mBorderSearch
.
IsTempRangeByPercent
,
tempRangePercent
=
mBorderSearch
.
TempRangePercent
};
infodata
=
p
.
ToBytes
();
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
infodata
=
Misc
.
Converter
.
StringToBytes
(
json
);
}
break
;
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_RESULT
:
{
...
...
@@ -111,7 +116,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
width
=
mBorderSearch
.
Width
,
mid
=
mBorderSearch
.
Mid
};
infodata
=
p
.
ToBytes
();
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
infodata
=
Misc
.
Converter
.
StringToBytes
(
json
);
}
break
;
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_DATAS
:
{
...
...
@@ -119,7 +125,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
{
data
=
mBorderSearch
.
Datas
};
infodata
=
p
.
ToBytes
();
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
infodata
=
Misc
.
Converter
.
StringToBytes
(
json
);
}
break
;
default
:
...
...
@@ -133,9 +140,9 @@ namespace FLY.Thick.Base.Server.OBJProxy
{
case
BORDERSEARCH_OBJ_INTERFACE
.
SET_PARAMS
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
(
);
if
(
p
.
TryParse
(
infodata
))
{
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
>(
json
);
mBorderSearch
.
Enable
=
p
.
enable
;
mBorderSearch
.
Valid
.
Begin
=
p
.
valid
.
Begin
;
mBorderSearch
.
Valid
.
End
=
p
.
valid
.
End
;
...
...
@@ -149,9 +156,10 @@ namespace FLY.Thick.Base.Server.OBJProxy
mBorderSearch
.
N3
=
p
.
n3
;
mBorderSearch
.
IsBreakDetect
=
p
.
isBreakDetect
;
mBorderSearch
.
IsTempRangeByPercent
=
p
.
isTempRangeByPercent
;
mBorderSearch
.
TempRangePercent
=
p
.
tempRangePercent
;
mBorderSearch
.
Apply
();
}
}
break
;
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server.OBJProxy/FlyAD_OBJProxy.cs
View file @
fbc797ef
...
...
@@ -99,6 +99,7 @@ namespace FLY.Thick.Base.Server.OBJProxy
mFlyAD
.
HasCRC
=
p
.
hasCRC
;
mFlyAD
.
GridSmooth
=
p
.
gridsmooth
;
var
ep
=
Misc
.
StringConverter
.
ToIPEndPoint
(
p
.
ep
);
if
(!
mFlyAD
.
LocalEP
.
Equals
(
ep
))
mFlyAD
.
Connect
(
ep
);
mFlyAD
.
PosOffset
=
p
.
posoffset
;
mFlyAD
.
JogVelocity
=
p
.
jogvelocity
;
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/BorderSearch.cs
View file @
fbc797ef
...
...
@@ -85,7 +85,17 @@ namespace FLY.Thick.Base.Server
/// <summary>
/// AD超过了范围, 就认为开始找到边界
/// </summary>
public
int
TempRange
{
get
;
set
;
}
public
int
TempRange
{
get
;
set
;
}
=
1000
;
/// <summary>
/// 温修范围是温修的百分比
/// </summary>
public
bool
IsTempRangeByPercent
{
get
;
set
;
}
=
true
;
/// <summary>
/// 温修范围百分比
/// </summary>
public
double
TempRangePercent
{
get
;
set
;
}
=
0.02
;
/// <summary>
...
...
@@ -160,7 +170,8 @@ namespace FLY.Thick.Base.Server
Border
.
Reset
();
Mid
=
Valid
.
Mid
;
TempRange
=
500
;
TempRangePercent
=
500.0
/
50000
;
IsTempRangeByPercent
=
true
;
}
void
Border_Backw_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
...
...
@@ -184,14 +195,21 @@ namespace FLY.Thick.Base.Server
if
(!
TempADBySet
)
TempAD
=
CurrTempAD
;
}
//if (GetSavePropertyNames().Contains(e.PropertyName))
//{
// FObjBase.PollModule.Current.Poll_JustOnce(
// new FObjBase.PollModule.PollHandler(delegate()
// {
// Save();
// }), this, MARKNO_SAVE);
//}
else
if
(
e
.
PropertyName
==
"TempAD"
)
{
if
(
IsTempRangeByPercent
)
{
TempRange
=
(
int
)(
TempAD
*
TempRangePercent
);
}
}
else
if
((
e
.
PropertyName
==
"TempRangePercent"
)
||
(
e
.
PropertyName
==
"IsTempRangeByPercent"
))
{
if
(
IsTempRangeByPercent
)
{
TempRange
=
(
int
)(
TempAD
*
TempRangePercent
);
}
}
}
public
void
Init
()
...
...
@@ -446,8 +464,7 @@ namespace FLY.Thick.Base.Server
int
[]
filterdats
=
new
int
[
dat
.
Length
];
//数据滤波
for
(
int
i
=
0
;
i
<=
borderbegin_grid
;
i
++)
for
(
int
i
=
0
;
i
<
dat
.
Length
;
i
++)
{
int
b
=
i
-
num
;
int
e
=
i
+
num
;
...
...
@@ -463,59 +480,62 @@ namespace FLY.Thick.Base.Server
}
filterdats
[
i
]
=
Misc
.
MyMath
.
Avg
(
dat
,
b
,
e
);
}
int
bg
=
borderbegin_grid
;
int
eg
=
borderend_grid
;
for
(
int
i
=
borderend_grid
;
i
<
dat
.
Length
;
i
++)
{
int
b
=
i
-
num
;
int
e
=
i
+
num
;
if
(
b
<
0
)
int
[]
breakdats
=
new
int
[
dat
.
Length
];
num
=
1
;
for
(
int
i
=
0
;
i
<
dat
.
Length
;
i
++)
{
b
=
0
;
e
=
b
+
num
*
2
;
}
else
if
(
e
>=
(
dat
.
Length
-
1
))
if
((
i
-
num
)
<
0
)
breakdats
[
i
]
=
Misc
.
MyBase
.
NULL_VALUE
;
else
if
((
i
+
num
)
>=
dat
.
Length
)
breakdats
[
i
]
=
Misc
.
MyBase
.
NULL_VALUE
;
else
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filterdats
[
i
-
num
]))
breakdats
[
i
]
=
Misc
.
MyBase
.
NULL_VALUE
;
else
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filterdats
[
i
+
num
]))
breakdats
[
i
]
=
Misc
.
MyBase
.
NULL_VALUE
;
else
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filterdats
[
i
]))
breakdats
[
i
]
=
Misc
.
MyBase
.
NULL_VALUE
;
else
{
e
=
dat
.
Length
-
1
;
b
=
e
-
num
*
2
;
breakdats
[
i
]
=
Math
.
Abs
((
filterdats
[
i
]
-
filterdats
[
i
-
num
])
*
(
filterdats
[
i
+
num
]
-
filterdats
[
i
]));
}
filterdats
[
i
]
=
Misc
.
MyMath
.
Avg
(
dat
,
b
,
e
);
}
int
bg
=
borderbegin_grid
;
int
eg
=
borderend_grid
;
int
last_breakdat
=
int
.
MaxValue
;
bool
isdown
=
false
;
//从第1次找到的边界开始,往外找,找折点的最小值
for
(
int
i
=
borderbegin_grid
;
i
>=
(
borderbegin_grid
-
sensor_grid
);
i
--)
{
bg
=
i
;
if
((
i
-
num
)
<
0
)
break
;
if
((
i
+
num
)
>=
dat
.
Length
)
break
;
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filter
dats
[
i
-
num
]))
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
break
dats
[
i
-
num
]))
break
;
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filter
dats
[
i
+
num
]))
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
break
dats
[
i
+
num
]))
break
;
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filter
dats
[
i
]))
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
break
dats
[
i
]))
break
;
int
breakdat
=
(
filterdats
[
i
]
-
filterdats
[
i
-
num
])
*
(
filterdats
[
i
+
num
]
-
filterdats
[
i
]);
if
(
last_breakdat
==
int
.
MaxValue
)
last_breakdat
=
breakdat
;
else
if
(
breakdat
<
last_breakdat
)
last_breakdat
=
breakdat
;
else
if
(
breakdats
[
i
]
<
breakdats
[
i
+
num
])
{
//在减少
bg
=
i
;
isdown
=
true
;
}
if
(
isdown
)
{
//找到边界了
if
(
breakdats
[
i
]
<
breakdats
[
i
-
num
])
{
//之前那个就是最小值
break
;
}
}
last_breakdat
=
int
.
MaxValue
;
}
isdown
=
false
;
for
(
int
i
=
borderend_grid
;
i
<=
(
borderend_grid
+
sensor_grid
);
i
++)
{
eg
=
i
;
if
((
i
-
num
)
<
0
)
break
;
if
((
i
+
num
)
>=
dat
.
Length
)
...
...
@@ -527,17 +547,21 @@ namespace FLY.Thick.Base.Server
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
filterdats
[
i
]))
break
;
int
breakdat
=
(
filterdats
[
i
]
-
filterdats
[
i
-
num
])
*
(
filterdats
[
i
+
num
]
-
filterdats
[
i
]);
if
(
last_breakdat
==
int
.
MaxValue
)
last_breakdat
=
breakdat
;
else
if
(
breakdat
<
last_breakdat
)
last_breakdat
=
breakdat
;
else
if
(
breakdats
[
i
]
<
breakdats
[
i
-
num
])
{
//找到边界了
//在减少
eg
=
i
;
isdown
=
true
;
}
if
(
isdown
)
{
if
(
breakdats
[
i
]
<
breakdats
[
i
+
num
])
{
//之前那个就是最小值
break
;
}
}
}
borderbegin_grid
=
bg
;
borderend_grid
=
eg
;
return
true
;
...
...
@@ -764,6 +788,8 @@ namespace FLY.Thick.Base.Server
"TempADBySet"
,
"TempAD"
,
"TempRange"
,
"TempRangePercent"
,
"IsTempRangeByPercent"
,
"N"
,
"SensorWidth"
,
"N2"
,
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_Fix.cs
View file @
fbc797ef
...
...
@@ -51,8 +51,8 @@ namespace FLY.Thick.Base.Server
void
flyad_TimeGridEvent
(
object
sender
,
FlyADBase
.
TimeGridEventArgs
e
)
{
if
(
IsIgnoreDataWhenIdle
&&
!
IsRunning
)
return
;
//
if (IsIgnoreDataWhenIdle && !IsRunning)
//
return;
DateTime
dt
=
e
.
Time
;
TimeSpan
ts
=
e
.
Ts
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment