Jump to content

[KSP 1.10.0] Kerbal Simpit: A KSP serial mod for hardware controllers (1.4.1)


stibbons

Recommended Posts

Version 1.1.1 should be available through CKAN soon.

The only change in this version is fixing the data sent by the Action Group channel. Sorry, I haven't had time to get much work done on all of the fun stuff in the backlog.

Link to comment
Share on other sites

On 20.6.2017 at 10:55 AM, stibbons said:

Version 1.1.1 should be available through CKAN soon.

The only change in this version is fixing the data sent by the Action Group channel. Sorry, I haven't had time to get much work done on all of the fun stuff in the backlog.

Thanks, all ActionGroups report correctly now. Didn't test Staging, but I'm guessing it's fine.

Link to comment
Share on other sites

6 hours ago, Benji said:

Thanks, all ActionGroups report correctly now. Didn't test Staging, but I'm guessing it's fine.

If you do test it, you'll notice it works a little differently to the other groups. When the flight scene starts, the stage bit is 0. It remains 0 until the next stage is activated. Then it will return 1 until the next stage is activated, and so on. That's what the game is returning, and I thought it best to pass that on.

In other news, I started on the vessel control stuff this evening. Hoping to get another release with rotation, translation, throttle and wheel control sorted out this weekend.

Link to comment
Share on other sites

1 minute ago, stibbons said:

If you do test it, you'll notice it works a little differently to the other groups. When the flight scene starts, the stage bit is 0. It remains 0 until the next stage is activated. Then it will return 1 until the next stage is activated, and so on. That's what the game is returning, and I thought it best to pass that on.

In other news, I started on the vessel control stuff this evening. Hoping to get another release with rotation, translation, throttle and wheel control sorted out this weekend.

Yeah, that'S what i learned, when I played around with the (at that time wrong) integers I was receiving. Peraps someday, bu for now I don't need informations on staging events.

 

Another thing, that just crossed my code:


    case SCENE_CHANGE_MESSAGE:
      lcd_info.clear();
    break;

I was doing this, but it's not reacting on entering or leaving flight scene.

 

Link to comment
Share on other sites

Hi Guys... not been on for a while and am well impressed at the progress you have made.  So, from my end... Bit the bullet and bought some lcd & tft displays for my uno.  I have managed to get the tft printing text but for the love of god cannot add the simpit code into arduino ide without it giving me compiling errors.  I notice some of you have mentioned the lcd displays.  Any chance you could stick up some examples so that I can try and figure out what I am doing wrong???  All I am trying to do at the moment is get it to display altitude info from KSP...

 

Much appreciated.. keep up the good work!!!

 

Jez

Link to comment
Share on other sites

2 hours ago, Gizzum said:

Hi Guys... not been on for a while and am well impressed at the progress you have made.  So, from my end... Bit the bullet and bought some lcd & tft displays for my uno.  I have managed to get the tft printing text but for the love of god cannot add the simpit code into arduino ide without it giving me compiling errors.  I notice some of you have mentioned the lcd displays.  Any chance you could stick up some examples so that I can try and figure out what I am doing wrong???  All I am trying to do at the moment is get it to display altitude info from KSP...

 

Much appreciated.. keep up the good work!!!

 

Jez

 

Sure. What are the errors and what's your code?

 

These are the "important" bits in my code, concerning LCD-stuff:

The thing with the adress: 0x27. Pure luck. There have to be specifications for your LCD, but I just tried different adresses, someone claimed it had to be 0x3F, but that did not work. I kept it in comment tho.

//Initilizing the LCD
//20x4 LCD
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//#define I2C_ADDR    0x3F
#define I2C_ADDR    0x27
#define BACKLIGHT_PIN 3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7


LiquidCrystal_I2C lcd_orbit_info(I2C_ADDR,
                      En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,
                      BACKLIGHT_PIN, POSITIVE);
  
  ...
  //Some things to do to setup
void setup()
{
  //Start the LCD
  lcd_orbit_info.begin(20,4);
  lcd_orbit_info.backlight();
  lcd_orbit_info.clear();
  
  ...//getting messages from SimPit
  
    switch(messageType)
  	{
    case ALTITUDE_MESSAGE:
      if (msgSize == sizeof(altitudeMessage))
      {
        altitudeMessage Altitude;
        Altitude = parseAltitude(msg);
        //Converting to km
        lcd_orbit_info_print_float_ralign(Altitude.sealevel/1000.0, 3, 1);
      }
    break;
    }
  
  ...//Print on the LCD, ralign = right-align
  
  
void lcd_orbit_info_print_float_ralign(float number, int decimals, int line)
{
  //count the digits, to know the position t oright allign
  int digits = 0;
  for (float temp = number; temp > 10.0; temp = temp / 10.0)
  {
    digits++;
  }
  lcd_orbit_info.setCursor(18-(decimals+digits),line);
  lcd_orbit_info.print(number, decimals);
}

 

 

 

I just reread and realized, you're talking TFT stuff? Something like this: https://hifiduino.files.wordpress.com/2012/03/dsc01440.jpg ??

If you are talking TFT, I can send you my files I developed using KSPIO with my DUE. When I started this helped a lot: http://www.rinkydinkelectronics.com/resource/UTFT/UTFT.pdf

On 22.6.2017 at 5:38 PM, stibbons said:

In other news, I started on the vessel control stuff this evening. Hoping to get another release with rotation, translation, throttle and wheel control sorted out this weekend.

I can't wait to try out some sticks.

Edited by Benji
Link to comment
Share on other sites

32 minutes ago, Benji said:

Sure. What are the errors and what's your code?

A thousand times this. I can't read minds, and can't tell you what's wrong with code without seeing it. A full bug report contains:

  • What you tried (hardware setup, code)
  • What you expected
  • What you got (error messages, unexpected behaviour)
33 minutes ago, Benji said:

The thing with the adress: 0x27. Pure luck. There have to be specifications for your LCD, but I just tried different adresses, someone claimed it had to be 0x3F, but that did not work. I kept it in comment tho.

The Arduino playground has a great i2c_scanner sketch. Hook up your device, run that sketch, and it will output any found addresses on the i2c bus. Super handy for dealing with slightly mysterious devices.

Link to comment
Share on other sites

1 minute ago, stibbons said:

The Arduino playground has a great i2c_scanner sketch. Hook up your device, run that sketch, and it will output any found addresses on the i2c bus. Super handy for dealing with slightly mysterious devices.

Uhh, that's neat. I'll keep that in mind for when I hook up a second. Thanks.

Link to comment
Share on other sites

I've just uploaded plugin version 1.2.0, which adds channels for vessel rotation, translation, wheel commands and the main throttle. CKAN should have it in the next hour or two.

The rotation, translation and wheel control channels will override things like SAS when non-zero commands are sent. Note that if you send, say, a rotation command, that command will remain in effect until the plugin receives another rotation command.

The throttle channel is slightly different. If the plugin receives a throttle packet, from then on the throttle can only be controlled by the plugin. Pretty sure that suits my use case, but if it's a problem I'll look at expanding it so that the plugin can yield control somehow.

I've also released version 1.1.0 of the Arduino library. To use these new channels, update your library to the latest version using the Arduino IDE library manager. As well as including structs and constants for the new channels, the new library adds a more useful `send()` function, that lets you send arbitrary payloads without having to convert them to byte arrays manually. Here's a really quick example of how you can tell the game to translate your vessel forwards at full speed:

// Create a translationMessage object
translationMessage myTranslation;
// Set the Z axis to its highest value to translate forward
myTranslation.Z = 32767;
// The mask variable tells the plugin which parts of this
// translationMessage are valid commands, and which ones
// to ignore. This enables separate controllers to control
// separate axes. Set to 7 to make valid for all axes.
myTranslation.mask = 7;
// Send our message to the game.
mySimpit.send(TRANSLATION_MESSAGE, myTranslation);

 

Link to comment
Share on other sites

On 2017-6-23 at 1:42 AM, Benji said:

 

Another thing, that just crossed my code:


    case SCENE_CHANGE_MESSAGE:
      lcd_info.clear();
    break;

I was doing this, but it's not reacting on entering or leaving flight scene.

 

I just realised I never actually wrote the plugin code to send a message on scene changes. Um, sorry about that. :)

I'll push out a new release that includes it very soon. 

Link to comment
Share on other sites

On 23/06/2017 at 10:57 PM, stibbons said:

A thousand times this. I can't read minds, and can't tell you what's wrong with code without seeing it. A full bug report contains:

  • What you tried (hardware setup, code)
  • What you expected
  • What you got (error messages, unexpected behaviour)

The Arduino playground has a great i2c_scanner sketch. Hook up your device, run that sketch, and it will output any found addresses on the i2c bus. Super handy for dealing with slightly mysterious devices.

Apologies... it was a rushed post as we were travelling off to see relatives for the weekend. I will have another try tonight and get back with errors and code etc. 

Link to comment
Share on other sites

Stock Actiongroups 1 - 10 perform as intended. Hurray. (2-dimensional keypads are wired in a weird way, took me a while to figure out rows collumns and all backwards)

But my Altitude, Apoapsis, etc readings are gone into jibberish. I saw a commit, changing from const bytes to enums.

I'm positive I would get it in some time but I'm not having much time this week, so I'll just ask.

Can you give me an example on how to register to the MESSAGES and read their enums(?) their transmitting.

 

Thanks a lot.

Link to comment
Share on other sites

2 hours ago, Benji said:

I saw a commit, changing from const bytes to enums.

Hrmn. All that change does is modify how the packet constants (ALTITUDE_MESSAGE, APSIDES_MESSAGE and so on) are defined in the Arduino library. It doesn't affect the functionality in any way. I won't be able to wire up a display to show exactly what is being received by my test Arduino until tomorrow evening, but did just run the altitude trigger demo sketch and it's still working the way it should for me.

Would you mind uploading the code you're using somewhere, and I'll take a look at it tomorrow?

Link to comment
Share on other sites

Ok guys...

I have bought this. https://www.amazon.co.uk/gp/product/B01J34JO0K/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

I have used one of the examples from mcufriend and have the TFT printing stuff.

 

So I copied the code into my KSP...

#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
#include <KerbalSimpit.h>
#include <KerbalSimpitMessageTypes.h>
#include <PayloadStructs.h>

#define WHITE   0x0000
#define YELLOW    0x001F
#define CYAN     0xF800
#define MAGENTA   0x07E0
#define RED    0x07FF
#define GREEN 0xF81F
#define BLUE  0xFFE0
#define BLACK   0xFFFF

MCUFRIEND_kbv tft;
// KerbalSimPit object
KerbalSimPit mySimPit(Serial);

// work in line numbers.  Font height in ht
int16_t ht = 16, top = 2, line, lines = 28, scroll;

void setup()
{
    Serial.begin(115200);
    while (!mySimPit.init()) {
      delay(100);
    }
    mySimPit.inboundHandler(messageHandler);
    mySimPit.registerChannel(ALTITUDE_MESSAGE);
  
    tft.reset();
    uint16_t id = tft.readID();
    tft.begin(id);
    tft.setRotation(0);     //Portrait
    tft.fillScreen(MAGENTA);
    tft.setTextColor(WHITE, RED);
    tft.setTextSize(2);     // System font is 8 pixels.  ht = 8*2=16
    tft.setCursor(100, 0);
    tft.print("Hello World");
    if (id == 0x9320 || id == 0x9325 || id == 0xB509) {
        top = 0;                      // these controllers scroll full screen
        lines = tft.height() / ht;    // we are in portrait mode
    }
}

void loop()
{
    mySimPit.update();
    tft.setCursor(0, (scroll + top) * ht);
    if (++scroll >= lines) scroll = 0;
    tft.vertScroll(top * ht, lines * ht, (scroll) * ht);
    tft.println(String(myAltitude.sealevel) + ": [" + String(scroll) + "]  ");
    delay(100);
    line++;
}

void messageHandler(byte messageType, byte msg[], byte msgSize) {
  switch(messageType) {
  case ALTITUDE_MESSAGE:
    if (msgSize == sizeof(altitudeMessage)) {
      altitudeMessage myAltitude;
      myAltitude = parseAltitude(msg);
    }
    break;
  }
}

and I get the errors...

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

KSP:18: error: 'KerbalSimPit' does not name a type
 KerbalSimPit mySimPit(Serial);
 ^
/Users/Jez/Dropbox/Arduino/KSP/KSP.ino: In function 'void setup()':
KSP:26: error: 'mySimPit' was not declared in this scope
     while (!mySimPit.init()) {
             ^
KSP:29: error: 'mySimPit' was not declared in this scope
     mySimPit.inboundHandler(messageHandler);
     ^
/Users/Jez/Dropbox/Arduino/KSP/KSP.ino: In function 'void loop()':
KSP:49: error: 'mySimPit' was not declared in this scope
     mySimPit.update();
     ^
KSP:53: error: 'myAltitude' was not declared in this scope
     tft.println(String(myAltitude.sealevel) + ": [" + String(scroll) + "]  ");
                        ^
exit status 1
'KerbalSimPit' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I think I need to buy some arduino books as I am getting headache from this!

Any ideas or am I being a complete leatherman? (the ultimate tool!)

Jez

Link to comment
Share on other sites

2 hours ago, Gizzum said:

Ok guys...

I have bought this. https://www.amazon.co.uk/gp/product/B01J34JO0K/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

I have used one of the examples from mcufriend and have the TFT printing stuff.

 

So I copied the code into my KSP...


#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
#include <KerbalSimpit.h>
#include <KerbalSimpitMessageTypes.h>
#include <PayloadStructs.h>

#define WHITE   0x0000
#define YELLOW    0x001F
#define CYAN     0xF800
#define MAGENTA   0x07E0
#define RED    0x07FF
#define GREEN 0xF81F
#define BLUE  0xFFE0
#define BLACK   0xFFFF

MCUFRIEND_kbv tft;
// KerbalSimPit object
KerbalSimPit mySimPit(Serial);

// work in line numbers.  Font height in ht
int16_t ht = 16, top = 2, line, lines = 28, scroll;

void setup()
{
    Serial.begin(115200);
    while (!mySimPit.init()) {
      delay(100);
    }
    mySimPit.inboundHandler(messageHandler);
    mySimPit.registerChannel(ALTITUDE_MESSAGE);
  
    tft.reset();
    uint16_t id = tft.readID();
    tft.begin(id);
    tft.setRotation(0);     //Portrait
    tft.fillScreen(MAGENTA);
    tft.setTextColor(WHITE, RED);
    tft.setTextSize(2);     // System font is 8 pixels.  ht = 8*2=16
    tft.setCursor(100, 0);
    tft.print("Hello World");
    if (id == 0x9320 || id == 0x9325 || id == 0xB509) {
        top = 0;                      // these controllers scroll full screen
        lines = tft.height() / ht;    // we are in portrait mode
    }
}

void loop()
{
    mySimPit.update();
    tft.setCursor(0, (scroll + top) * ht);
    if (++scroll >= lines) scroll = 0;
    tft.vertScroll(top * ht, lines * ht, (scroll) * ht);
    tft.println(String(myAltitude.sealevel) + ": [" + String(scroll) + "]  ");
    delay(100);
    line++;
}

void messageHandler(byte messageType, byte msg[], byte msgSize) {
  switch(messageType) {
  case ALTITUDE_MESSAGE:
    if (msgSize == sizeof(altitudeMessage)) {
      altitudeMessage myAltitude;
      myAltitude = parseAltitude(msg);
    }
    break;
  }
}

and I get the errors...


Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

KSP:18: error: 'KerbalSimPit' does not name a type
 KerbalSimPit mySimPit(Serial);
 ^
/Users/Jez/Dropbox/Arduino/KSP/KSP.ino: In function 'void setup()':
KSP:26: error: 'mySimPit' was not declared in this scope
     while (!mySimPit.init()) {
             ^
KSP:29: error: 'mySimPit' was not declared in this scope
     mySimPit.inboundHandler(messageHandler);
     ^
/Users/Jez/Dropbox/Arduino/KSP/KSP.ino: In function 'void loop()':
KSP:49: error: 'mySimPit' was not declared in this scope
     mySimPit.update();
     ^
KSP:53: error: 'myAltitude' was not declared in this scope
     tft.println(String(myAltitude.sealevel) + ": [" + String(scroll) + "]  ");
                        ^
exit status 1
'KerbalSimPit' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I think I need to buy some arduino books as I am getting headache from this!

Any ideas or am I being a complete leatherman? (the ultimate tool!)

Jez

It's
KerbalSimpit mySimPit(Serial);

now. A small -p-.

Also, wow, the TFT is huge.

Edited by Benji
Link to comment
Share on other sites

4 minutes ago, Benji said:

It's
KerbalSimpit mySimPit(Serial);

now. A small -p-.

Also, wow, the TFT is huge.

You have got to be f*****g S******g me!  God I love it when that happens... cheers Benji.

Jez Leatherman!

Link to comment
Share on other sites

5 hours ago, stibbons said:

Hrmn. All that change does is modify how the packet constants (ALTITUDE_MESSAGE, APSIDES_MESSAGE and so on) are defined in the Arduino library. It doesn't affect the functionality in any way. I won't be able to wire up a display to show exactly what is being received by my test Arduino until tomorrow evening, but did just run the altitude trigger demo sketch and it's still working the way it should for me.

Would you mind uploading the code you're using somewhere, and I'll take a look at it tomorrow?

Brrr. Me.Being.really.dumb.

I had a bad loose contact in one of the ground cables. I don't know, why this affected the LCD to display jibberish, but it's okai now.

1 minute ago, Gizzum said:

You have got to be f*****g S******g me!  God I love it when that happens... cheers Benji.

Jez Leatherman!

Ja, since that change I'm really looking through all new commits stibbons is releasing.

Link to comment
Share on other sites

Now I am getting...

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/Jez/Dropbox/Arduino/KSP/KSP.ino: In function 'void loop()':
KSP:53: error: 'myAltitude' was not declared in this scope
     tft.println(myAltitude.sealevel);
                 ^
exit status 1
'myAltitude' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Really???

Link to comment
Share on other sites

5 minutes ago, Gizzum said:

Now I am getting...


Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/Jez/Dropbox/Arduino/KSP/KSP.ino: In function 'void loop()':
KSP:53: error: 'myAltitude' was not declared in this scope
     tft.println(myAltitude.sealevel);
                 ^
exit status 1
'myAltitude' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Really???

That's what my altitude code looks like:

before void loop():

  SimPit.registerChannel(ALTITUDE_MESSAGE);



  switch(messageType)
  {
    
    case SCENE_CHANGE_MESSAGE:
      lcd_orbit_info.clear();
    break;
      
    case ALTITUDE_MESSAGE:
      if (msgSize == sizeof(altitudeMessage))
      {
        altitudeMessage Altitude;
        Altitude = parseAltitude(msg);
        //Converting to km
        lcd_orbit_info_print_float_ralign(Altitude.sealevel/1000.0, 3, 1);
        
        if (Altitude.surface < 3001)
        {
          //A "logarithmic" way to plot
          analogWrite(meter_altitude_to_surface, (int)(Altitude.surface / 17.75 / sqrt(Altitude.surface / 3000)));
          //Plotting it linear
          //analogWrite(meter_altitude_to_surface, (int)(Altitude.surface / 17.75));
        }
        else
        {
          analogWrite(meter_altitude_to_surface, VMETER_MAX);
        }
      }
    break;

 

Link to comment
Share on other sites

10 minutes ago, Benji said:

That's what my altitude code looks like:


before void loop():

  SimPit.registerChannel(ALTITUDE_MESSAGE);



  switch(messageType)
  {
    
    case SCENE_CHANGE_MESSAGE:
      lcd_orbit_info.clear();
    break;
      
    case ALTITUDE_MESSAGE:
      if (msgSize == sizeof(altitudeMessage))
      {
        altitudeMessage Altitude;
        Altitude = parseAltitude(msg);
        //Converting to km
        lcd_orbit_info_print_float_ralign(Altitude.sealevel/1000.0, 3, 1);
        
        if (Altitude.surface < 3001)
        {
          //A "logarithmic" way to plot
          analogWrite(meter_altitude_to_surface, (int)(Altitude.surface / 17.75 / sqrt(Altitude.surface / 3000)));
          //Plotting it linear
          //analogWrite(meter_altitude_to_surface, (int)(Altitude.surface / 17.75));
        }
        else
        {
          analogWrite(meter_altitude_to_surface, VMETER_MAX);
        }
      }
    break;

 

When you say before void loop(): do you mean in setup(): ?? or outside setup as well?

Link to comment
Share on other sites

@stibbons: Do you already send apside times? 'Cause I'm using this code, but it never jumpes into < case APSIDESTIME_MESSAGE > . At least seconds should be printed, but it's not.

case APSIDESTIME_MESSAGE:
      if (msgSize == sizeof(apsidesTimeMessage))
      {
        apsidesTimeMessage ApsidesTime;
        ApsidesTime = parseApsidesTime(msg);
          lcd_orbit_info_print_text("Seconds", 1, 0);
          //Converting to km
          lcd_orbit_info_print_int(ApsidesTime.apoapsis, 0, 0);
          //Converting to km
          lcd_orbit_info_print_int(ApsidesTime.periapsis, 2, 0);
      }
    break;

It's weird. APSIDESTIME_MESSAGE is in the keywords.txt, but it's not highlighted. Funny thing, all MESSAGES are in green, but APSIDES_MESSAGE is in red. But all is LITERAL 1 in keywords.txt even APSIDESTIME_MESSAGE .

Also, I tried making my own keywords.txt. But the IDE didn't react to that. When I inserted some LITERALS into your keywords it works.

So I think, at some point my IDE is a bit wonky with keyword files.

 

35 minutes ago, Gizzum said:

When you say before void loop(): do you mean in setup(): ?? or outside setup as well?

Yes, inside setup. Sorry.

Edited by Benji
more thoughts
Link to comment
Share on other sites

44 minutes ago, Gizzum said:

 


Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"

 

Hmm, I'm really curious how the plugin and the code react with your huge TFT on an Uno.

Back when I experimented with KSPIO I had to upgrade to a Due, to provide enough speed to draw on a TFT. Because the connection to KSP broke down every time I send information to the TFT.

Now, I'm using a Mega again, but I will be using a Due as second board to draw on my TFT, once Simpit provides multi-board funcionality.

So, what I was saying, please keep me informed on how Simpit performs... Thanks

 

I really don't want to use a Due, I would like a second Mega. The 16bit really slows down the compilation process and I wasn't having any fun with 16bit integers.

 

 

@stibbons: The 3 direction and 3 translation axis are clear, also throttle, but what is the wheel control in KSP. I never understood that one and never used it, but now, as it is included in Simpit I really would like to know. I searched, but the internet and wikis couldn't really help me to understand.

Edited by Benji
Link to comment
Share on other sites

16 minutes ago, Benji said:

Hmm, I'm really curious how the plugin and the code react with your huge TFT on an Uno.

Back when I experimented with KSPIO I had to upgrade to a Due, to provide enough speed to draw on a TFT. Because the connection to KSP broke down every time I send information to the TFT.

Now, I'm using a Mega again, but I will be using a Due as second board to draw on my TFT, once Simpit provides multi-board funcionality.

So, what I was saying, please keep me informed on how Simpit performs... Thanks

 

I really don't want to use a Due, I would like a second Mega. The 16bit really slows down the compilation process and I wasn't having any fun with 16bit integers.

Only got it working!!!  works well with just altitude at the moment... there is a small lag but close enough for government work!!! I need to write the code to clear the screen when changing scenes and also get the cursor positioned correctly but initial tests are SWEET!!. using a uno r3 btw

Thanks so much for your help Benjji.  I'll keep you updated.  the tft display is approx 74mm x 51mm and sits nicely on the duo.  Once i get it working I will try and do a vid and post it up.

 

Jez

Link to comment
Share on other sites

35 minutes ago, Gizzum said:

Only got it working!!!  works well with just altitude at the moment... there is a small lag but close enough for government work!!! I need to write the code to clear the screen when changing scenes and also get the cursor positioned correctly but initial tests are SWEET!!. using a uno r3 btw

Thanks so much for your help Benjji.  I'll keep you updated.  the tft display is approx 74mm x 51mm and sits nicely on the duo.  Once i get it working I will try and do a vid and post it up.

 

Jez

Beware,


    case SCENE_CHANGE_MESSAGE:

is not reacting at the moment. Will be implemented very soon.

Link to comment
Share on other sites

9 hours ago, Benji said:

I had a bad loose contact in one of the ground cables. I don't know, why this affected the LCD to display jibberish, but it's okai now.

Dang. Glad it's working now though. :) 

9 hours ago, Benji said:

Ja, since that change I'm really looking through all new commits stibbons is releasing.

Sorry folks. The prereleases did include a couple of major breaking changes. But since 1.0 I'm sticking to semantic versioning - the API won't break until version 2.

8 hours ago, Benji said:

Do you already send apside times? 'Cause I'm using this code, but it never jumpes into < case APSIDESTIME_MESSAGE > . At least seconds should be printed, but it's not.

I do, and did briefly check that it was working as it should before I released anything. But I'll take a closer look at it this evening.

7 hours ago, Gizzum said:

Only got it working!!!  works well with just altitude at the moment... there is a small lag but close enough for government work!!! I need to write the code to clear the screen when changing scenes and also get the cursor positioned correctly but initial tests are SWEET!!. using a uno r3 btw

Glad it's working! The default RefreshRate parameter is 40ms, and it might be worth tuning that. Decreasing might result in less lag. But if your issue is how quickly the TFT can be refreshed, you might find that increasing the RefreshRate

It's probably worth pointing out that there's no ongoing handshake / synchronisation process in my protocol. The hardware can happily ignore/drop packets if it's not fast enough to process them all. That could easily result in display lag, but will not interrupt communications entirely.

8 hours ago, Benji said:

Now, I'm using a Mega again, but I will be using a Due as second board to draw on my TFT, once Simpit provides multi-board funcionality.

Multi-device functionality has been in place for quite a while. :D You need to add a new SerialPort section in the config file, just duplicate the one that's there. I'd like to eventually add an in-game interface for configuring serial connections, but that's still a fair way off unfortunately.

8 hours ago, Benji said:

The 3 direction and 3 translation axis are clear, also throttle, but what is the wheel control in KSP. I never understood that one and never used it, but now, as it is included in Simpit I really would like to know.

So, KSP transparently maps wheel steering and throttle to the regular rotation keys. If you build a simple rover and launch it, you can use WASD to drive it. But the API has always had separate functionality for wheel steering and throttle. If you launch a rover and start sending regular rotation packets, you'll see the pitch/roll/yaw indicators move but the wheels won't do anything.

I think wheel steering and throttle was the very first change I added to KSPSerialIO, because I was frustrated about not being able to use my custom joysticks to drive rovers. :)

You may want to duplicate the current keyboard behaviour, and send rotation and wheel packets at the same time. But it might also be useful to have a separate toggle switch to flip between vessel rotation, or controlling the wheels.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...