-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FFP Force Feedback Effect Improvements #48
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Separated type conversion functions as existing one contained div/2 for Time units Update FFP structures. wavelength -> frequency Update FFP MIDI data structures to include useful known parameters. Change references to waveLength => frequency and units 1/Hz => Hz to avoid confusion. frequency to MIDI uint14 and new USB period => MIDI frequency conversion.
Functions that check if a) MIDI parameter has changed and if so update the SysEx data and b) check if already sent to device and Send Modify if so. This is needed because future improvements may send more updates to the stick. Also makes code more concise. Also #define all MIDI modify offset codes Wheel code only minimum update to not break compatibility. Will have altered behaviour in some cases where previously address and send-modify code were not targeting the same parameter. Corrected definition of USB_DURATION_INFINITE Fix compiler errors
While removing gain compensated magnitudes from periodic and constant force (otherwise double accounting)
Never modify param1 as this triggers an FFP bug so that envelopes are not applied Instead set reciprocal direction if magnitude is negative
Resolve definition in excess of force limit (i.e. magnitude + offset > stick force max) by respecting offset and squeezing available range for envelope. Will now allow attack and fade levels to exceed sustain level
Support for ramp up and down and envelopes all changing on the fly Uses same code as periodics, respecting start and end where attack or fade are out of range Fix for bug added in periodic mod where amplitudes were halved
…pring centre. Implement all device control in response to USB: Pause/Continue, Enable/Disable Actuators, Stop All, Reset Set PID state flags accordingly - some changes here Device Gain command in response to USB only. Not changed automatically on Reset. Remove SetAutoCentre - this should be handled by Reset then Stop All. Changed in initialisation as well i.e. Auto spring centre persists after FFB init. Update wheel code for compatibility only using known commands - not tested
They were reversed in new implementation
Missed one...
Missed some comments
Calculate a coefficient value for each axis that is scaled by effect gain Send modify if coefficient or gain changes FFP does not natively support effect gain for conditional effects - so this is needed to enable it.
Send SampleRate if it is set to a non default value If USB samplePeriod is set to "default" then the default 100Hz FFP value is used, except it is increased for high waveform frequencies to prevent aliasing.
This is based on the FFP limitations for numbers of supported effects. Also memory for stack is getting tight with all the parameters stored for later calculation. Needed to free some up. Wheel may support more effects...
FFP has space for 10 waveforms and 2 of each type of conditional. The adapter counts these when a new effect is requested in order to respond correctly to host (success/full) and ensure effect IDs do not get out of sync
Due to ID offset, this allows 18 effects which is the maximum number the FFP supports of the effect types that are implemented.
Different effect types now use different data structures within the same block so there are fewer redundant bytes
Used a spoof Report ID to allow this to be triggered. Could the spoof ID 91 be triggered by anything else??
Changed spoofed ID to 15 and added entry in OutReportSize Was causing pointer overflow.
… enabled Preprocessor switch
Not expecting you to review unless you want to tloimu, just adding you for awareness. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See discussion #45
One change I want to highlight is this:
I chose to do this because the number of parameters that would potentially be updated by e.g. a Set Effect report has increased now that more parameters are supported. This would lead to an increase in the number of send..modify message pairs that would need to be forwarded even if nothing had changed. In practice it means that sometimes 10 or more USB messages are received, with no MIDI messages resulting. Either the USB message is a duplicate or the change is too small or not in a supported parameter. The risk is that if a MIDI message fails then the effect parameter may never be updated, so it could be less robust. It doesn't seem ideal to clog up the bandwidth with a lot of redundant messages, but not sure what a middle ground might be - send everything twice?? I didn't experience any problems I attributed to this in testing.
Draft Release Changelist:
Summary
The objective of this firmware update is to improve the force feedback capability for the Force Feedback Pro (FFP) to include the features that are supported only by all three of:
a) USB Device Class Definition for Physical Interface Devices (PID),
b) the FFP firmware, and
c) the "next generation" GameInput API.
It includes a collection of new features, bug fixes and workarounds of FFP limitations that cumulatively should improve compatibility with most games and make it more likely the effects will play as originally intended.
More details on the development here: #45
Tested so far with: Force Editor (fedit.exe), FSX, FS-Force for FSX, XPForce for FSX, SimFFB, Need for Speed III, Monster Truck Madness 2
Changes/New Features
Not supported
FFP Firmware Limitations and Bugs
Known/Possible Issues