Hello everyone!
Since some weeks ago I'm working in my own controller. @zitronen thank you for the work done and for sharing it here!
Programming and building hardware is not new for me but it's the first time that I work in an Arduino project used as an interface with a PC program/game. I hope to start my own thread soon and show you my progress.
So far I have a prototype code which implements almost all functions that I want to implement in my controller. But I'm completely stuck in setting the SAS Modes! I've tried several iterations of the base code, but I'm not able to select any other mode than just the "SAS" one. I've been reviewing all the pages of this post since this feature was implemented in the Plugin and with the directions given by @c4ooo but I still haven't found what I'm missing to make it work.
In my code I have the code showed below, it's basically the baseline code but adapted to implement an additional SAS Mode. Anyone knows what I'm doing wrong? I'm sure that I'm failing in a very basic thing!
This is defined in the main tab
//pins for input
#define PROGRADEPIN 12
//Input enums
#define PROGRADE 8
Code in the output tab:
void controls() {
if (Connected) {
if (digitalRead(SASPIN)) { //--------- This is how you do main controls
MainControls(SAS, HIGH);
setSASMode(SMSAS); //setting SAS mode
}
//Tested also standalone (without the previous lines and just with an "IF")
else if (digitalRead(PROGRADEPIN)){ //same estructure as above
MainControls(PROGRADE, HIGH); //Input enum for PROGRADE SAS Mode
setSASMode(SMPrograde); //Setting SMPrograde
}
else {
//setNavballMode(NAVBallTARGET);
MainControls(SAS, LOW);
}
KSPBoardSendData(details(CPacket));
}
}
Controls are also initialized:
void controlsInit() {
pinMode(PROGRADEPIN, INPUT_PULLUP);
}
Thank you for the help in advance Kerbonauts!