Comments (7)
- 直接切换成状态5会丢失一个
LONG_PRESS_START
事件。 - 切换成状态 0 或状态 1 则不会,不过需要再过
LONG_TICKS
才能检测到长按事件。这是可以理解的,因为在连击之后突然长按按键,也是需要LONG_TICKS
个时间之后才能触发长按事件。
from multibutton.
else if(handle->ticks > SHORT_TICKS){
handle->state = 0;
}
添加成这个
from multibutton.
下面是我的建议,供参考
case 3:
if(handle->button_level != handle->active_level)
{
handle->event = (uint8_t)PRESS_UP;
EVENT_CB(PRESS_UP);
if(handle->ticks < SHORT_TICKS)
{
handle->ticks = 0;
handle->state = 2;
}
else
{
handle->state = 0;
}
}
else if (handle->ticks > LONG_TICKS)
{
handle->state = 5;
}
break;
from multibutton.
@idfulin 你好 这里还有一个和你差不多的代码,他建议是回到0,你觉得回到哪个比较好呢?
0x1abin/MultiButton#15 (comment)
from multibutton.
@Jackistang 明白了 handle->ticks > LONG_TICKS 还是 handle->ticks > SHORT_TICKS比较好?
from multibutton.
@Jackistang #5 我提了一个pr, 要不你来提也行。
from multibutton.
如果切换成状态0或者1的话,建议是 SHORT_TICKS
,因为状态 3 经过 SHORT_TICKS
后仍检测到按键按下,这时已有的两个扇出就失效了,可以直接转换状态了。
你可以改改你的 pr,
from multibutton.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multibutton.