preventative measure: Add in native debouncing for CAGs
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.
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);
}
Test it with toggling more than one CAG as this was only when I encountered unity crash
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?