提高红外线线程优先级
This commit is contained in:
parent
6c6cfda8f9
commit
20da728352
@ -29,7 +29,7 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
rt_sprintf(tmp, "%02X", key);
|
||||
rt_atomic_store(&snake_pressed, snake_max + 1);
|
||||
// 上
|
||||
if (repeat == 0 &&rt_strcmp(tmp, "30") == 0 || rt_strcmp(tmp, "53") == 0)
|
||||
if (rt_strcmp(tmp, "30") == 0 || rt_strcmp(tmp, "53") == 0)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 2)
|
||||
rt_atomic_store(&now_direction, 0);
|
||||
@ -42,7 +42,7 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
}
|
||||
|
||||
// 左
|
||||
if (repeat == 0 &&rt_strcmp(tmp, "E8") == 0 || rt_strcmp(tmp, "99") == 0)
|
||||
if (rt_strcmp(tmp, "E8") == 0 || rt_strcmp(tmp, "99") == 0)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 3)
|
||||
rt_atomic_store(&now_direction, 1);
|
||||
@ -53,7 +53,7 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
}
|
||||
|
||||
// 下
|
||||
if (repeat == 0 &&rt_strcmp(tmp, "B0") == 0 || rt_strcmp(tmp, "4B") == 0)
|
||||
if (rt_strcmp(tmp, "B0") == 0 || rt_strcmp(tmp, "4B") == 0)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 0)
|
||||
rt_atomic_store(&now_direction, 2);
|
||||
@ -63,7 +63,7 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
}
|
||||
|
||||
// 右
|
||||
if (repeat == 0 &&rt_strcmp(tmp, "68") == 0 || rt_strcmp(tmp, "83") == 0)
|
||||
if (rt_strcmp(tmp, "68") == 0 || rt_strcmp(tmp, "83") == 0)
|
||||
{
|
||||
if (rt_atomic_load(&now_direction) != 1)
|
||||
rt_atomic_store(&now_direction, 3);
|
||||
@ -71,6 +71,15 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
|
||||
const char *str = "right\n";
|
||||
rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
}
|
||||
// // 加速
|
||||
// if (rt_strcmp(tmp, "68") == 0 || rt_strcmp(tmp, "83") == 0)
|
||||
// {
|
||||
// if (rt_atomic_load(&now_direction) != 1)
|
||||
// rt_atomic_store(&now_direction, 3);
|
||||
// // rt_strncpy(str,"right\n",10);
|
||||
// const char *str = "right\n";
|
||||
// rt_device_write(serial, 0, str, rt_strlen(str));
|
||||
// }
|
||||
|
||||
// 菜单(切换页面)
|
||||
if (repeat == 0 && (rt_strcmp(tmp, "88") == 0 || rt_strcmp(tmp, "11") == 0))
|
||||
|
@ -560,7 +560,7 @@ MSH_CMD_EXPORT_ALIAS(cdc_init, cdc, "write on virtual device");
|
||||
// }
|
||||
void inf_init(void)
|
||||
{
|
||||
Infrared_Thread = rt_thread_create("Infrared_Thread", myir_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
|
||||
Infrared_Thread = rt_thread_create("Infrared_Thread", myir_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY-THREAD_PRIORITY+3, THREAD_TIMESLICE*4);
|
||||
|
||||
if (Infrared_Thread != RT_NULL)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user