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
285777f6
Commit
285777f6
authored
Mar 04, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 支持AD盒v1 版本 GET_STATE 与 v2 不一样,但之前不支持,全部都是v2的导致出错了
parent
909dd72a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
14 deletions
+66
-14
FLYAD7_OBJ_INTERFACE.cs
Project.FLY.FlyADBase/FlyADBase/FLYAD7_OBJ_INTERFACE.cs
+50
-8
FlyAD7.cs
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
+16
-6
No files found.
Project.FLY.FlyADBase/FlyADBase/FLYAD7_OBJ_INTERFACE.cs
View file @
285777f6
...
...
@@ -163,29 +163,26 @@ namespace FLYAD7_OBJ_INTERFACE
}
public
class
Pack_DriveState
:
IPack
{
//当前运行指令(1B)+当前运行状态(1B)+运行模式(1B)
+ systick(4B) + 命令序列码(4B)
//当前运行指令(1B)+当前运行状态(1B)+运行模式(1B)
public
DRIVE_MAN_ORDER
order
;
public
DRIVE_MAN_STATUS
status
;
public
byte
mode
;
public
int
systick
;
public
Int32
marker
;
#
region
IPack
成员
public
byte
[]
ToBytes
()
public
virtual
byte
[]
ToBytes
()
{
List
<
byte
>
buf
=
new
List
<
byte
>();
buf
.
Add
((
byte
)
order
);
buf
.
Add
((
byte
)
status
);
buf
.
Add
((
byte
)
mode
);
buf
.
AddRange
(
BitConverter
.
GetBytes
(
systick
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
marker
));
return
buf
.
ToArray
();
}
public
bool
TryParse
(
byte
[]
value
)
public
virtual
bool
TryParse
(
byte
[]
value
)
{
if
(
value
.
Count
()
<
(
1
+
1
+
1
+
4
+
4
))
if
(
value
.
Count
()
<
(
1
+
1
+
1
))
return
false
;
int
idx
=
0
;
order
=
(
DRIVE_MAN_ORDER
)
value
[
idx
];
...
...
@@ -194,6 +191,36 @@ namespace FLYAD7_OBJ_INTERFACE
idx
++;
mode
=
value
[
idx
];
idx
++;
return
true
;
}
#
endregion
}
public
class
Pack_DriveState_2
:
Pack_DriveState
{
//当前运行指令(1B)+当前运行状态(1B)+运行模式(1B)+ systick(4B) + 命令序列码(4B)
public
int
systick
;
public
Int32
marker
;
#
region
IPack
成员
public
override
byte
[]
ToBytes
()
{
List
<
byte
>
buf
=
new
List
<
byte
>();
buf
.
AddRange
(
base
.
ToBytes
());
buf
.
AddRange
(
BitConverter
.
GetBytes
(
systick
));
buf
.
AddRange
(
BitConverter
.
GetBytes
(
marker
));
return
buf
.
ToArray
();
}
public
override
bool
TryParse
(
byte
[]
value
)
{
if
(!
base
.
TryParse
(
value
))
return
false
;
int
idx
=
3
;
if
(
value
.
Count
()
<
(
1
+
1
+
1
+
4
+
4
))
return
false
;
systick
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
marker
=
BitConverter
.
ToInt32
(
value
,
idx
);
...
...
@@ -201,6 +228,21 @@ namespace FLYAD7_OBJ_INTERFACE
return
true
;
}
public
virtual
bool
TryParse_version
(
byte
[]
value
,
out
int
version
)
{
version
=
1
;
if
(!
base
.
TryParse
(
value
))
return
false
;
int
idx
=
3
;
if
(
value
.
Count
()
<
(
1
+
1
+
1
+
4
+
4
))
return
true
;
version
=
2
;
systick
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
marker
=
BitConverter
.
ToInt32
(
value
,
idx
);
idx
+=
4
;
return
true
;
}
#
endregion
}
public
class
Pack_SyncStatus
:
IPack
...
...
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
View file @
285777f6
...
...
@@ -545,14 +545,24 @@ namespace FlyADBase
break
;
case
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
GET_STATE
:
{
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
Pack_DriveState
p
=
new
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
Pack_DriveState
();
if
(!
p
.
TryParse
(
infodata
))
int
version
;
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
Pack_DriveState_2
pack
=
new
FLYAD7_OBJ_INTERFACE
.
DRIVE_MAN_INTERFACE
.
Pack_DriveState_2
();
if
(!
pack
.
TryParse_version
(
infodata
,
out
version
))
break
;
DriveOrder
=
p
.
order
;
DriveStatus
=
p
.
status
;
Marker
=
p
.
marker
;
if
(
version
==
1
)
{
DriveOrder
=
pack
.
order
;
DriveStatus
=
pack
.
status
;
}
else
if
(
version
==
2
)
{
DriveOrder
=
pack
.
order
;
DriveStatus
=
pack
.
status
;
Marker
=
pack
.
marker
;
advGetState
();
}
isReadyGetState
=
true
;
updateIsReady
();
...
...
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