Jump to content

OKB_Carba

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by OKB_Carba

  1. Hello Zitronen, Thank you for your quick answer. I think that I've tried this before but I've just tried again to check what happens but the result is the same. With your code above, what happens is that once I activate the assigned pin the SAS activates, but not the prograde mode EDIT: I'm trying to simplify the problem by just forcing a value in the setSASMode Control Packet. But the result it's the same. If I remove the "MainControls" line nothing occurs (SAS or any other modes are not activated). It was a long shot :| void controls() { if (Connected) { if (digitalRead(PROGRADEPIN)){ MainControls(SAS, HIGH); //Tested with and without this line setSASMode(); } else { //setNavballMode(NAVBallTARGET); MainControls(SAS, LOW); } void setSASMode() { // CPacket.NavballSASMode &= B11110000; // CPacket.NavballSASMode += m; CPacket.NavballSASMode &= B11110011; //Forcing a value different to default value }
  2. 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!
  3. Hello community! I've been playing KSP for some time and being a visitor of this forum since the beginning. Now I'm equipped with a new computer and I'm kicking off an ambitious project for building a controller. So I want to share with the whole community my progress and also ask for your wise advises in the likely case that I got stuck Thank you all,
×
×
  • Create New...