File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 44// But only checks at regular periods of `update_ticks`
55class PollChange {
66public:
7- PollChange (int update_ticks)
7+ PollChange (unsigned update_ticks)
88 : update_ticks{update_ticks} {
99 }
1010
1111 void reset () {
1212 change_detected = true ;
1313 }
1414
15- void poll (int now, bool state) {
15+ void poll (unsigned now, bool state) {
1616 if (now - last_update_time >= update_ticks) {
1717 last_update_time = now;
1818
@@ -25,7 +25,7 @@ public:
2525
2626 // Defer calling state_func() until poll time has expired.
2727 // Useful if checking the state is a heavy operation.
28- void poll (int now, auto state_func) {
28+ void poll (unsigned now, auto state_func) {
2929 if (now - last_update_time >= update_ticks) {
3030 last_update_time = now;
3131
@@ -48,6 +48,6 @@ public:
4848private:
4949 bool current_state = false ;
5050 bool change_detected = false ;
51- int last_update_time = 0 ;
52- int update_ticks;
51+ unsigned last_update_time = 0 ;
52+ unsigned update_ticks;
5353};
You can’t perform that action at this time.
0 commit comments