嗨对话框:
使用官方SDK pxp_reporter演示时,在pxp_reporter_task中自定义了三个定时服务,任意开启2个定时服务时工作正常,但是3个定时服务同时打开时系统不工作,是协议栈对定时服务数量有限制吗?但是感觉不太可能,因为才3个定时服务,加上演示自定义的总共7个定时服务,问题挺奇怪,请问是否有出现过类似情况?谢谢!(下面附加的是3个自定义服务的所有代码部分)
# ifdef HAL_TIME_SERVICE
#define HAL_TIME_NOTIF (1 << 5)
# endif
# ifdef USB_CHARGER_LED_INDICATOR_SERVICE
#define LED_PWM_DEMO_TMO_NOTIF (1 << 6)
# endif
# ifdef SIXAXIS_SENSOR_READ_SERVICE
#define LSM6DSL_DATAREAD_TMO_NOTIF (1 << 7)
# endif
# ifdef USB_CHARGER_LED_INDICATOR_SERVICE
PRIVILEGED_DATA static OS_TIMER led_pwm_demo_tim;
# endif
# ifdef SIXAXIS_SENSOR_READ_SERVICE
PRIVILEGED_DATA static OS_TIMER sixaxis_tim;
# endif
/*用于时间监控的定时器*/
# ifdef HAL_TIME_SERVICE
PRIVILEGED_DATA static OS_TIMER time_tim;
# endif
# ifdef SIXAXIS_SENSOR_READ_SERVICE
static void sixaxis_tim_cb(OS_TIMER timer)
{
OS_TASK task = (OS_TASK) OS_TIMER_GET_TIMER_ID(timer);
OS_TASK_NOTIFY(任务、LSM6DSL_DATAREAD_TMO_NOTIF OS_NOTIFY_SET_BITS);
}
# endif
# ifdef USB_CHARGER_LED_INDICATOR_SERVICE
static void led_pwm_tim_cb(OS_TIMER timer)
{
OS_TASK task = (OS_TASK)OS_TIMER_GET_TIMER_ID(timer);
OS_TASK_NOTIFY(任务、LED_PWM_DEMO_TMO_NOTIF OS_NOTIFY_SET_BITS);
}
# endif
# ifdef HAL_TIME_SERVICE
static void time_tim_cb(OS_TIMER timer)日志含义
{
OS_TASK task = (OS_TASK)OS_TIMER_GET_TIMER_ID(timer);
OS_TASK_NOTIFY(任务、HAL_TIME_NOTIF OS_NOTIFY_SET_BITS);
}
# endif
空白pxp_reporter_task (void * params)
{
//。。。。。。省略其他代码
# ifdef SIXAXIS_SENSOR_READ_SERVICE
static void sixaxis_tim_cb(OS_TIMER timer)
{
OS_TASK task = (OS_TASK) OS_TIMER_GET_TIMER_ID(timer);
OS_TASK_NOTIFY(任务、LSM6DSL_DATAREAD_TMO_NOTIF OS_NOTIFY_SET_BITS);
}
# endif
# ifdef USB_CHARGER_LED_INDICATOR_SERVICE
static void led_pwm_tim_cb(OS_TIMER timer)
{
OS_TASK task = (OS_TASK)OS_TIMER_GET_TIMER_ID(timer);
OS_TASK_NOTIFY(任务、LED_PWM_DEMO_TMO_NOTIF OS_NOTIFY_SET_BITS);
}
# endif
# ifdef HAL_TIME_SERVICE
static void time_tim_cb(OS_TIMER timer)日志含义
{
OS_TASK task = (OS_TASK)OS_TIMER_GET_TIMER_ID(timer);
OS_TASK_NOTIFY(任务、HAL_TIME_NOTIF OS_NOTIFY_SET_BITS);
}
# endif
(,) {
OS_BASE_TYPE ret __attribute__((未使用));
uint32_t notif;
# ifdef SIXAXIS_SENSOR_READ_SERVICE
if (notif & LSM6DSL_DATAREAD_TMO_NOTIF)
{
//。。。。。。省略
}
如果(notif & LED_PWM_DEMO_TMO_NOTIF)
{
//。。。。。。省略
}
如果(notif & HAL_TIME_NOTIF)
{
//。。。。。。省略
}
}
//。。。。。。省略其他代码
}
可以尝试增大一栈的容量和堆大小下,定时器任务应该不存在这么少的数量限制