-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为什么重复执行的定时器不在MultiTimerYield执行重新启动,在回调函数容易漏掉 #10
Comments
我倒觉得这样才能最大限度的灵活控制。
…_________________________________________________________________________
QQ: 529864495
手机: 15036977063
备用QQ: 251107197
备用手机: 15038566482
说明:提供单片机软硬件开发技术指导,代做软硬件设计,调试勘误等业务,低价有偿服务。
_________________________________________________________________________
------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2022年1月13日(星期四) 中午11:44
收件人: ***@***.***>;
抄送: ***@***.***>;
主题: [0x1abin/MultiTimer] 为什么重复执行的定时器不在MultiTimerYield执行重新启动,在回调函数容易漏掉 (Issue #10)
为什么重复执行的定时器不在MultiTimerYield执行重新启动,在回调函数容易漏掉
增加排序功能很好,但是去掉了重复执行功能啊,单片机又很多都是要重复执行的定时器
增加可重复执行功能
struct MultiTimerHandle {
MultiTimer* next;
uint64_t deadline;
MultiTimerCallback_t callback;
void* userData;
uint64_t interval; //记录间隔
uint8_t repeat; //重复执行标记
};
//根据repeat标志重新启动定时器
if (entry->repeat) {
MultiTimerStart(entry, entry->interval, entry->callback, entry->userData, entry->repeat)
}
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
我一般这样用 #include "NewType.h" #define tType uint16 extern void TimerStart(pTimer t, tType time); #endif #include "Timer.h" //启动已经停止的定时器,如果定时器已经启动或时间到则忽略. //使用 while(1){ |
这个必须在回调里重启的设计对回调用匿名函数很不友好。。。 |
可以尝试在启动定时器函数添加个重复次数的参数, 确实在回调里去重新运行启动函数很不友好,反复创建,而且也不好向多次运行的回调函数里通过传参方式去传递数据 |
为什么重复执行的定时器不在MultiTimerYield执行重新启动,在回调函数容易漏掉
增加排序功能很好,但是去掉了重复执行功能啊,单片机又很多都是要重复执行的定时器
增加可重复执行功能
struct MultiTimerHandle {
MultiTimer* next;
uint64_t deadline;
MultiTimerCallback_t callback;
void* userData;
uint64_t interval; //记录间隔
uint8_t repeat; //重复执行标记
};
//根据repeat标志重新启动定时器
if (entry->repeat) {
MultiTimerStart(entry, entry->interval, entry->callback, entry->userData, entry->repeat)
}
The text was updated successfully, but these errors were encountered: