re-enabled mouse and Stelladaptor input for Driving Controller (fixes #951)

This commit is contained in:
Thomas Jentzsch 2023-01-18 17:01:21 +01:00
parent dd5b16f997
commit 9d46bb614f

View File

@ -114,6 +114,7 @@ void Driving::updateControllerAxes()
{
// Digital events (from keyboard or joystick hats & buttons)
const int d_axis = myEvent.get(myXAxisValue);
uInt32 oldCounterHires = myCounterHires;
if(myEvent.get(myCCWEvent) != 0 && myLastCCWEvent == 0)
myCounterHires = ((myGrayIndex + 4) * 256.0F) / SENSITIVITY - 1; // set to end of previous counter interval
@ -136,16 +137,17 @@ void Driving::updateControllerAxes()
range as digital inputs.
*/
myCounterHires += (a_axis/512) + (a_axis >= 0);
cerr << "! ";
}
// Only consider the lower-most bits (corresponding to pins 1 & 2)
myGrayIndex = static_cast<Int32>((myCounterHires / 256.0F) * SENSITIVITY) & 0b11;
if(oldCounterHires != myCounterHires)
// Only consider the lower-most bits (corresponding to pins 1 & 2)
myGrayIndex = static_cast<Int32>((myCounterHires / 256.0F) * SENSITIVITY) & 0b11;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Driving::updateMouseAxes()
{
Int32 oldCounter = myCounter;
static constexpr int MJ_Threshold = 2;
// Mouse motion and button events
@ -178,6 +180,8 @@ void Driving::updateMouseAxes()
++myCounter;
}
}
if(myCounter != oldCounter)
myGrayIndex = (myCounter >> 2) & 0b11;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -206,6 +210,7 @@ void Driving::updateStelladaptorAxes()
// simulated gray codes generated by PC keyboard or PC joystick
// Must be rounded into the middle of the myCounter interval!
myCounter = (myGrayIndex + 0.5F) * 4.0F / SENSITIVITY;
myCounterHires = myCounter * 256.0F / 4.0F;
}
}