diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index 102ef19..5dfd990 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -96,7 +96,6 @@ void processMouseKineticState(mouse_kinetic_state_t *kineticState) } float distance = kineticState->currentSpeed * elapsedTime / 1000; - kineticState->distance = distance; if (activeMouseStates[kineticState->leftState]) { kineticState->xSum -= distance; @@ -137,16 +136,18 @@ void processMouseActions() processMouseKineticState(&mouseScrollState); ActiveUsbMouseReport->wheelX = mouseScrollState.xOut; - *(float*)(DebugBuffer + 50) = mouseScrollState.currentSpeed; - *(uint16_t*)(DebugBuffer + 54) = mouseScrollState.xOut; - *(float*)(DebugBuffer + 56) = mouseScrollState.xSum; - *(float*)(DebugBuffer + 60) = mouseScrollState.distance; -// SetDebugBufferFloat(60, mouseScrollState.currentSpeed); ActiveUsbMouseReport->wheelY = mouseScrollState.yOut; -// SetDebugBufferFloat(62, mouseScrollState.ySum); mouseScrollState.xOut = 0; mouseScrollState.yOut = 0; +// The following line makes the firmware crash for some reason: +// SetDebugBufferFloat(60, mouseScrollState.currentSpeed); +// TODO: Figure out why. +// Oddly, the following line (which is the inlined version of the above) works: +// *(float*)(DebugBuffer + 60) = mouseScrollState.currentSpeed; +// The value parameter of SetDebugBufferFloat() seems to be the culprit because +// if it's not used within the function it doesn't crash anymore. + if (activeMouseStates[SerializedMouseAction_LeftClick]) { ActiveUsbMouseReport->buttons |= MouseButton_Left; } diff --git a/right/src/usb_report_updater.h b/right/src/usb_report_updater.h index 05ea3c4..bbf0a3d 100644 --- a/right/src/usb_report_updater.h +++ b/right/src/usb_report_updater.h @@ -51,7 +51,6 @@ mouse_speed_t prevMouseSpeed; float intMultiplier; float currentSpeed; - float distance; float targetSpeed; uint8_t initialSpeed; uint8_t acceleration;