Skip to content
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

preventative measure: Add in native debouncing for CAGs #5

Open
LRTNZ opened this issue Nov 26, 2020 · 3 comments
Open

preventative measure: Add in native debouncing for CAGs #5

LRTNZ opened this issue Nov 26, 2020 · 3 comments

Comments

@LRTNZ
Copy link
Collaborator

LRTNZ commented Nov 26, 2020

When you rapidly fire a CAG, KSP seems to just crash? Or at least that is the experiance that @TheDicko has been having.
The ideal solution would be for users to implement their own debouncing/rate limiting on the firing of CAG events. However, just to be sure, it would be best if this library were to implement such a thing, to avoid the need for users to worry about what may be causing such an odd issue in their controller, and consequentially spending many hours trying to hunt down a rather trivial bug.

@PBechon
Copy link
Collaborator

PBechon commented Nov 28, 2020

I could not reproduce the error to see if the debouncing corrects it.

Here is the Arduino code tested, no KSP crashed occured with KSP 1.10 and ActionGroupExtended v2.4.0.1.

The code waits for a SimPit connection and for the button connected to Arduino input 7 before spamming a toggle command for a CAG.

#include "KerbalSimpit.h"

KerbalSimpit mySimpit(Serial);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  pinMode(7, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);

  while (!mySimpit.init()) {
    delay(100);
  }

  digitalWrite(LED_BUILTIN, LOW);
  while(digitalRead(7)){
    delay(100);
  }
  digitalWrite(LED_BUILTIN, HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:
  mySimpit.toggleCAG(1);
}

@CallumDixon
Copy link
Contributor

Test it with toggling more than one CAG as this was only when I encountered unity crash

@LRTNZ
Copy link
Collaborator Author

LRTNZ commented Dec 1, 2020

Test it with toggling more than one CAG as this was only when I encountered unity crash

Was this when you were toggling more than one CAG per update cycle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants