Skip to content

Commit 3639b9f

Browse files
committed
added check of updated values after mapping in order to avoid dead zone updating
1 parent fb51fc9 commit 3639b9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Modulino.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ class ModulinoJoystick : public Module {
166166
bool update() {
167167
uint8_t buf[3];
168168
auto res = read((uint8_t*)buf, 3);
169-
auto ret = res && (buf[0] != last_status[0] || buf[1] != last_status[1] || buf[2] != last_status[2]);
170169
auto x = buf[0];
171170
auto y = buf[1];
172171
map_value(x, y);
172+
auto ret = res && (x != last_status[0] || buf[1] != y || buf[2] != last_status[2]);
173+
if (!ret) {
174+
return false;
175+
}
173176
last_status[0] = x;
174177
last_status[1] = y;
175178
last_status[2] = buf[2];

0 commit comments

Comments
 (0)