delay(
2
);
}
if
(
strstr
(recv_buf, p_ack) !=
NULL
)
{
return
1
;
}
}
while
(millis() - startMillis < timeout_ms);
return
0
;
}
static
void
recv_prase
(
char
*p_msg)
{
if
(p_msg ==
NULL
)
{
return
;
}
char
*p_start =
NULL
;
int
data =
0
;
int
rssi =
0
;
int
snr =
0
;
p_start =
strstr
(p_msg,
"RX"
);
if
(p_start && (
1
==
sscanf
(p_start,
"RX: \"%d\"\r\n"
, &data)))
{
Serial.println(data);
u8x8.setCursor(
2
,
4
);
u8x8.print(
"led :"
);
led = !!data;
u8x8.print(led);
if
(led)
{
digitalWrite(LED_BUILTIN, LOW);
}
else
{
digitalWrite(LED_BUILTIN, HIGH);
}
}
p_start =
strstr
(p_msg,
"RSSI"
);
if
(p_start && (
1
==
sscanf
(p_start,
"RSSI %d,"
, &rssi)))
{
u8x8.setCursor(
0
,
6
);
u8x8.print(
" "
);
u8x8.setCursor(
2
,
6
);
u8x8.print(
"rssi:"
);
u8x8.print(rssi);
}
p_start =
strstr
(p_msg,
"SNR"
);