-
Notifications
You must be signed in to change notification settings - Fork 16
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
Enable Rumble FF Autofire #12
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,12 +118,21 @@ void FFB::FFBRelease() | |
} | ||
} | ||
} | ||
|
||
if(rumbleHappening) { // Are we currently in a rumble command? (Implicitly needs SamcoPreferences::toggles.rumbleActive) | ||
RumbleActivation(); // Continue processing our rumble command. | ||
// (This is to prevent making the lack of trigger pull actually activate a rumble command instead of skipping it like we should.) | ||
} else if(rumbleHappened) { // If rumble has happened, | ||
rumbleHappened = false; // well we're clear now that we've stopped holding. | ||
|
||
// If Rumble FF is enabled and Autofire is enabled, the motor needs to be disabled when the trigger is released. Otherwiseallow RumbleActivation to deal with the activation timer | ||
if(SamcoPreferences::toggles.rumbleFF && SamcoPreferences::toggles.autofireActive) { | ||
if(rumbleHappening || rumbleHappened) { | ||
digitalWrite(SamcoPreferences::pins.oRumble, LOW); // Make sure the rumble is OFF. | ||
rumbleHappening = false; // This rumble command is done now. | ||
rumbleHappened = false; // Make it clear we've stopped holding. | ||
} | ||
} else { | ||
if(rumbleHappening) { // Are we currently in a rumble command? (Implicitly needs SamcoPreferences::toggles.rumbleActive) | ||
RumbleActivation(); // Continue processing our rumble command. | ||
// (This is to prevent making the lack of trigger pull actually activate a rumble command instead of skipping it like we should.) | ||
} else if(rumbleHappened) { // If rumble has happened, | ||
rumbleHappened = false; // well we're clear now that we've stopped holding. | ||
} | ||
} | ||
} | ||
|
||
|
@@ -212,10 +221,12 @@ void FFB::RumbleActivation() | |
if(rumbleHappening) { // Are we in a rumble command rn? | ||
currentMillis = millis(); // Calibrate a timer to set how long we've been rumbling. | ||
if(SamcoPreferences::toggles.rumbleFF) { | ||
if(currentMillis - previousMillisRumble >= SamcoPreferences::settings.rumbleInterval / 2) { // If we've been waiting long enough for this whole rumble command, | ||
digitalWrite(SamcoPreferences::pins.oRumble, LOW); // Make sure the rumble is OFF. | ||
rumbleHappening = false; // This rumble command is done now. | ||
rumbleHappened = true; // And just to make sure, to prevent holding == repeat rumble commands. | ||
if(!SamcoPreferences::toggles.autofireActive) { // We only want to use the rumble timer is Autofire is not active. Otherwise, keep it going | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you meant "We only want to use the rumble timer if Autofire is not active. ..." |
||
if(currentMillis - previousMillisRumble >= SamcoPreferences::settings.rumbleInterval / 2) { // If we've been waiting long enough for this whole rumble command, | ||
digitalWrite(SamcoPreferences::pins.oRumble, LOW); // Make sure the rumble is OFF. | ||
rumbleHappening = false; // This rumble command is done now. | ||
rumbleHappened = true; // And just to make sure, to prevent holding == repeat rumble commands. | ||
} | ||
} | ||
} else { | ||
if(currentMillis - previousMillisRumble >= SamcoPreferences::settings.rumbleInterval) { // If we've been waiting long enough for this whole rumble command, | ||
|
@@ -264,4 +275,4 @@ void FFB::FFBShutdown() | |
triggerHeld = false; | ||
burstFiring = false; | ||
burstFireCount = 0; | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Otherwiseallow?" I think your typing was on autofire for a bit there.