From 47ae60e538548281b346a3767b7942462fa7094d Mon Sep 17 00:00:00 2001 From: Avery Black Date: Mon, 21 Oct 2024 08:48:37 -0700 Subject: [PATCH] Fix not incrementing F12 data --- VoodooRMI/Functions/F12.cpp | 24 +++++++++++------------- VoodooRMI/Functions/F12.hpp | 2 -- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/VoodooRMI/Functions/F12.cpp b/VoodooRMI/Functions/F12.cpp index 9043b26..c54f335 100644 --- a/VoodooRMI/Functions/F12.cpp +++ b/VoodooRMI/Functions/F12.cpp @@ -249,6 +249,7 @@ int F12::rmi_f12_read_sensor_tuning() void F12::attention(AbsoluteTime time, UInt8 *data[], size_t *size) { + RMI2DSensorReport report {}; size_t offset = data1_offset; if (*data) { @@ -281,29 +282,26 @@ void F12::attention(AbsoluteTime time, UInt8 *data[], size_t *size) #endif // debug int fingers = min (nbr_fingers, 5); - UInt8 *fingerData = &data_pkt[offset]; - for (int i = 0; i < fingers; i++) { - rmi_2d_sensor_abs_object *obj = &report.objs[i]; + rmi_2d_sensor_abs_object &obj = report.objs[i]; + UInt8 *fingerData = &data_pkt[offset + (fingers * F12_DATA1_BYTES_PER_OBJ)]; switch (fingerData[0]) { case RMI_F12_OBJECT_FINGER: - obj->type = RMI_2D_OBJECT_FINGER; + obj.type = RMI_2D_OBJECT_FINGER; break; case RMI_F12_OBJECT_STYLUS: - obj->type = RMI_2D_OBJECT_STYLUS; + obj.type = RMI_2D_OBJECT_STYLUS; break; default: - obj->type = RMI_2D_OBJECT_NONE; + obj.type = RMI_2D_OBJECT_NONE; } - obj->x = (fingerData[2] << 8) | fingerData[1]; - obj->y = (fingerData[4] << 8) | fingerData[3]; - obj->z = fingerData[5]; - obj->wx = fingerData[6]; - obj->wy = fingerData[7]; - - data += F12_DATA1_BYTES_PER_OBJ; + obj.x = (fingerData[2] << 8) | fingerData[1]; + obj.y = (fingerData[4] << 8) | fingerData[3]; + obj.z = fingerData[5]; + obj.wx = fingerData[6]; + obj.wy = fingerData[7]; } report.timestamp = time; diff --git a/VoodooRMI/Functions/F12.hpp b/VoodooRMI/Functions/F12.hpp index 91ba8a0..03bd5e3 100644 --- a/VoodooRMI/Functions/F12.hpp +++ b/VoodooRMI/Functions/F12.hpp @@ -62,8 +62,6 @@ class F12 : public RMITrackpadFunction { private: IOService *voodooInputInstance {nullptr}; - RMI2DSensorReport report {}; - static rmi_register_desc_item *rmi_get_register_desc_item(rmi_register_descriptor *rdesc, UInt16 reg); static size_t rmi_register_desc_calc_size(rmi_register_descriptor *rdesc); static int rmi_register_desc_calc_reg_offset(rmi_register_descriptor *rdesc, UInt16 reg);