Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
raspberry_Holographic
Project
Project
Details
Activity
Releases
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
张泽仁
raspberry_Holographic
Commits
2395af70
Commit
2395af70
authored
Oct 31, 2023
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new release
parent
1a9771f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
12 deletions
+110
-12
interface.c
raspberrypi_spi/LocalDimming/interface.c
+110
-12
No files found.
raspberrypi_spi/LocalDimming/interface.c
View file @
2395af70
...
...
@@ -90,10 +90,10 @@ void protocalAck(int fileusb)
}
// get angle and change into 16bits, return;
shor
t
getAngle
(
char
*
rece
)
in
t
getAngle
(
char
*
rece
)
{
shor
t
angle
;
shor
t
result
=
0
;
in
t
angle
;
in
t
result
=
0
;
int
i
=
0
;
char
*
p
=
rece
;
while
(
*
(
p
+
i
)
!=
'a'
||
*
(
p
+
i
+
1
)
!=
'n'
)
...
...
@@ -108,7 +108,7 @@ short getAngle(char *rece)
i
++
;
continue
;
}
shor
t
num
=
*
(
p
+
i
)
-
'0'
;
in
t
num
=
*
(
p
+
i
)
-
'0'
;
result
=
result
*
10
+
num
;
i
++
;
}
...
...
@@ -274,6 +274,102 @@ void waitforReady_test(int fileuart) //test_version
}
int
last
=
0
;
int
reality
=
0
;
int
dealAngle
(
int
angle
)
{
int
result
=
0
;
int
ret
=
0
;
if
(
last
<=
1800
){
int
max
=
last
+
1800
;
if
(
angle
>=
last
&&
angle
<=
max
){
//turn leftji
result
=
angle
-
last
;
//prshortf("sent message = %d\n", reality + result);
}
else
{
//turn right
if
(
last
>
angle
){
result
=
angle
-
last
;
//prshortf("sent message = %d\n", reality + result);
}
else
{
result
=
last
+
(
3600
-
angle
);
result
=
-
result
;
//prshortf("sent message = %d\n", reality + result);
}
}
}
else
{
int
over
=
last
-
1800
;
if
(
angle
>=
over
&&
angle
<=
last
){
//turn right
result
=
angle
-
last
;
//prshortf("sent message = %d\n", reality + result);
}
else
{
//turn left
if
(
angle
<
over
){
result
=
angle
+
3600
-
last
;
//prshortf("sent message = %d\n", reality + result);
}
else
{
result
=
angle
-
last
;
//prshortf("sent message = %d\n", reality + result);
}
}
}
ret
=
reality
+
result
;
return
ret
;
}
void
sentUart
(
char
*
buf
,
int
fileuart
,
int
fileusb
)
{
if
(
count
==
9
)
//9
{
strcat
(
totalbuf
,
buf
);
int
angle
;
angle
=
getAngle
(
totalbuf
);
printf
(
"usb realize angle is = %d
\n
"
,
angle
);
int
sentangle
=
dealAngle
(
3600
-
angle
);
last
=
angle
;
//40 38 0B 06 00 0A 01 XX XX XX XX CRCL CRCH
char
message
[
13
]
=
{
0x40
,
0x38
,
0x0B
,
0x06
,
0x00
,
0x0A
,
0x01
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
sendMessageHead
(
1
,
message
);
message
[
7
]
=
(
sentangle
>>
24
)
&
0xff
;
message
[
8
]
=
(
sentangle
>>
16
)
&
0xff
;
message
[
9
]
=
(
sentangle
>>
8
)
&
0xff
;
message
[
10
]
=
sentangle
&
0xff
;
uint16_t
crc
=
CrcValueCalc
(
message
,
11
);
message
[
11
]
=
crc
&
0xff
;
message
[
12
]
=
(
crc
>>
8
)
&
0xff
;
if
(
g_callback
!=
NULL
)
{
char
buf
[
256
]
=
{
0
};
snprintf
(
buf
,
256
,
"cvlc --play-and-exit --aout alsa --alsa-audio-device hw:%d,0 /usr/local/bin/Videos/aaaa.mp3 &"
,
get_audio_device_id
());
//system("mpg321 /usr/local/bin/Videos/aaaa.mp3 &");
//system("cvlc --play-and-exit --aout alsa --alsa-audio-device hw:2,0 /usr/local/bin/Videos/aaaa.mp3 &");
system
(
buf
);
g_callback
(
g_callback_ctx
,
2
);
}
usleep
(
100
);
write
(
fileuart
,
message
,
13
);
printf
(
" %d
\n
"
,
__LINE__
);
count
=
1
;
memset
(
totalbuf
,
0
,
1024
);
serialFlush
(
fileusb
);
}
else
{
count
++
;
strcat
(
totalbuf
,
buf
);
}
}
/*
void sentUart(char *buf, int fileuart, int fileusb) //changed
{
if (count == 9)
...
...
@@ -301,7 +397,8 @@ void sentUart(char *buf, int fileuart, int fileusb) //changed
memset(totalbuf, 0, 1024);
protocalAck(fileusb);
if
(
g_callback
!=
NULL
){
if (g_callback != NULL)
{
char buf[256] = {0};
snprintf(buf, 256, "cvlc --play-and-exit --aout alsa --alsa-audio-device hw:%d,0 /usr/local/bin/Videos/aaaa.mp3 &", get_audio_device_id());
//system("mpg321 /usr/local/bin/Videos/aaaa.mp3 &");
...
...
@@ -320,6 +417,7 @@ void sentUart(char *buf, int fileuart, int fileusb) //changed
}
}
*/
void
circleReading
()
//changed
{
...
...
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