Skip to content

Commit

Permalink
Fix not incrementing F12 data
Browse files Browse the repository at this point in the history
  • Loading branch information
1Revenger1 committed Oct 21, 2024
1 parent 712d403 commit 47ae60e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
24 changes: 11 additions & 13 deletions VoodooRMI/Functions/F12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions VoodooRMI/Functions/F12.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 47ae60e

Please sign in to comment.