字符串微调
This commit is contained in:
parent
f51fb8dedf
commit
fb5772da17
@ -34,7 +34,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
if (rt_atomic_load(&now_direction) != 2)
|
||||
rt_atomic_store(&now_direction, 0);
|
||||
|
||||
*str = "forward\n";
|
||||
rt_strncpy(str,"forward\n",10);
|
||||
// *str = ;
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
|
||||
}
|
||||
@ -44,7 +45,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 3)
|
||||
rt_atomic_store(&now_direction, 1);
|
||||
*str = "left\n";
|
||||
// *str = "left\n";
|
||||
rt_strncpy(str,"left\n",10);
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
|
||||
@ -53,7 +55,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 0)
|
||||
rt_atomic_store(&now_direction, 2);
|
||||
*str= "back\n";
|
||||
// *str= "back\n";
|
||||
rt_strncpy(str,"back\n",10);
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
|
||||
@ -62,7 +65,8 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 1)
|
||||
rt_atomic_store(&now_direction, 3);
|
||||
*str = "right\n";
|
||||
rt_strncpy(str,"right\n",10);
|
||||
// *str = "right\n";
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
|
||||
@ -81,7 +85,7 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
if (repeat == 0 && (rt_strcmp(tmp, "73") == 0||rt_strcmp(tmp, "FF") == 0))
|
||||
{
|
||||
*str = "OK\n";
|
||||
/* 发送字符串 */
|
||||
rt_strncpy(str,"OK\n",10);
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
if (page_chosen == 4&& page_stop == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user