File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1765,6 +1765,7 @@ void loop() {
1765
1765
- Исправлена ошибка компиляции при использовании библиотеки в нескольких .cpp файлах
1766
1766
- v3.5.3
1767
1767
- Добавлено количество кликов в опрос press/release/click/pressing
1768
+ - v3.5.5 - коллбэк на базе std::function для ESP
1768
1769
1769
1770
<a id="feedback"></a>
1770
1771
## Баги и обратная связь
Original file line number Diff line number Diff line change 1
1
name =EncButton
2
- version =3.5.4
2
+ version =3.5.5
3
3
author =AlexGyver <
[email protected] >
4
4
maintainer =AlexGyver <
[email protected] >
5
5
sentence =Light and powerful library for button and encoder operation for Arduino
Original file line number Diff line number Diff line change 39
39
#define EB_STEP_T (EB_STEP_TIME)
40
40
#endif
41
41
42
- #define EB_FOR_SCALE 6
43
-
44
42
// =================== PACK FLAGS ===================
45
43
#define EB_CLKS_R (1 << 0 )
46
44
#define EB_PRS_R (1 << 1 )
64
62
65
63
// базовый класс кнопки
66
64
class VirtButton {
65
+ #ifdef __AVR__
66
+ typedef void (*ActionHandler)();
67
+ #else
68
+ typedef std::function<void ()> ActionHandler;
69
+ #endif
70
+
67
71
public:
68
72
// ====================== SET ======================
69
73
// установить таймаут удержания, умолч. 600 (макс. 4000 мс)
@@ -120,9 +124,9 @@ class VirtButton {
120
124
}
121
125
122
126
// подключить функцию-обработчик событий (вида void f())
123
- void attach (void (* handler)() ) {
127
+ void attach (ActionHandler handler) {
124
128
#ifndef EB_NO_CALLBACK
125
- cb = * handler;
129
+ cb = handler;
126
130
#endif
127
131
}
128
132
@@ -484,7 +488,7 @@ class VirtButton {
484
488
#endif
485
489
486
490
#ifndef EB_NO_CALLBACK
487
- void (*cb)() = nullptr ;
491
+ ActionHandler cb = nullptr ;
488
492
#endif
489
493
490
494
#ifndef EB_DEB_TIME
You can’t perform that action at this time.
0 commit comments