Jump to content

[Hardware, Plugin] Arduino based physical display + serial port io+ tutorial (24-11-19)


zitronen

Recommended Posts

22 hours ago, aaronata said:

@Freshmeat I am using windows 10 but i did have HandshakeDisable set to 1. As for the logs, i didnt really find anything that could be useful but here. From KSP.log:


[WRN 13:47:35.467] [HighLogic]: =========================== Scene Change : From EDITOR to FLIGHT (Async) =====================
[LOG 13:47:35.608] [UIApp] OnDestroy: EngineersReport
[LOG 13:47:35.610] [UIApp] OnDestroy: ContractsApp
[LOG 13:47:35.612] [UIApp] OnDestroy: KSPedia
[LOG 13:47:35.678] UIMasterController: HideUI
[WRN 13:47:36.226] The referenced script on this Behaviour is missing!
[WRN 13:47:36.245] The referenced script on this Behaviour is missing!
[WRN 13:47:36.249] The referenced script on this Behaviour is missing!
[WRN 13:47:36.250] The referenced script on this Behaviour is missing!
[LOG 13:47:36.553] UICanvasPrefabSpawner FlightUI spawning Flight
[WRN 13:47:36.570] [UiApp] Awake: ResourceDisplay
[LOG 13:47:36.624] UIMasterController: HideUI
[LOG 13:47:36.629] AddonLoader: Instantiating addon 'AeroGUI' from assembly 'KSP'
[LOG 13:47:36.632] AddonLoader: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
[LOG 13:47:36.634] KSPSerialIO: Version 0.18.2
[LOG 13:47:36.635] KSPSerialIO: Getting serial ports...
[LOG 13:47:36.635] KSPSerialIO: Output packet size: 191/255
[LOG 13:47:36.638] KSPSerialIO: Found 5 serial ports
[LOG 13:47:36.638] KSPSerialIO: trying default port COM5
[LOG 13:47:36.653] KSPSerialIO: Handshake disabled, using COM5
[LOG 13:47:36.654] AddonLoader: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'
[LOG 13:47:36.684] ------------------- initializing flight mode... ------------------

KSPSerialIO or anything related to it is not mentioned after initializing flight mode. 

@aaronata Just checking: You are using COM5 for the Arduino, and you have nothing else blocking it (Arduino IDE serial monitor, the KSPserialIO debugger KingLuxor wrote, or something else)? The problem is that once handshake is disabled, KSP just spams packets. I am not certain, but shouldn't it make the TX light blink continuously? Something like this might help to see if you are getting something, but I need confirmation from greater minds than myself.

Link to comment
Share on other sites

@Freshmeat Alright so i installed a serial monitor program and shot a rocket into space, and the entire time the serial port was being spammed with packet, even when the arduino cut out. So maybe the usb to serial on the arduino gets freaked out after too many packets and starts denying them? Im going to try and do away with the usb cable and connect the rx and tx pins on the arduino to an actual serial port on my computer and see what happenes then. 

Link to comment
Share on other sites

Sounds weird, especially if you just are using the Demo13 sketch. Does the Arduino otherwise behave, when you run other sketches on it? I guess from you trying to go directly over com that you know quite more about electronics than I, though, so I do not think I can be helpful. Sorry.

Link to comment
Share on other sites

Maybe you can try changing the refresh rate in the config file, by default it's 5 times a second (0.2). It sounds like there's something wrong on your arduino end since KSP is sending out packets just fine.

Link to comment
Share on other sites

Ok I am on MAC os el capitan. I got the mod off of Ckan, and I am not even getting a handshake. I have closed the debugger window in the Arduino IDE, but it is still not working. Since Kerbal Stuff has been shut down, I can't get the mac version. Plz help! Thank You!

Link to comment
Share on other sites

8 hours ago, mb03 said:

Ok I am on MAC os el capitan. I got the mod off of Ckan, and I am not even getting a handshake. I have closed the debugger window in the Arduino IDE, but it is still not working. Since Kerbal Stuff has been shut down, I can't get the mac version. Plz help! Thank You!

 

You should be able to find what you need here (including a small guide / wiki) :)

https://github.com/unixunion/KSPSerialIO

[Web archive of the original kerbalstuff site here]
A word of warning though -- that's some pretty old code;

@zitronen had issues adapting to v1.1 of the game (not sure which version you've got going).
There's a good chance that it may not work. But not being in Mac-land, I cannot confirm this.

Edited by Sputnix
Link to comment
Share on other sites

It won't work, and hasn't been updated for KSP 1.1 yet, so it's a few versions behind.

I've been maintaining my fork and building releases for a little while, but also haven't updated for a few months. :( Expecting to get around to that pretty soon though!

Link to comment
Share on other sites

Yeah the CKAN version is windows only, because of the serial port library. I remember it being pretty easy to move to 1.1, only a few lines need to be changed, and adding a reference to a different .dll.

Link to comment
Share on other sites

So I've just published a new version of the plugin with (yet another) complete overhaul of how the plugin interfaces with a serial port. It's more robust and less laggy than the previous cross platform attempt. But it could use some more folks testing it out.

I've tested this on my MacBook Air, and Linux gaming rig. It also doesn't (yet) work on Windows 10. But I think I know what I can do about that.

Get it from http://spacedock.info/mod/850/KSP Serial IO (cross platform) , and let me know how it goes.

Edited by stibbons
Link to comment
Share on other sites

21 hours ago, stibbons said:

So I've just published a new version of the plugin with (yet another) complete overhaul of how the plugin interfaces with a serial port. It's more robust and less laggy than the previous cross platform attempt. But it could use some more folks testing it out.

I've tested this on my MacBook Air, and Linux gaming rig. It also doesn't (yet) work on Windows 10. But I think I know what I can do about that.

Get it from http://spacedock.info/mod/850/KSP Serial IO (cross platform) , and let me know how it goes.

I'll give it a test, once it needs testing on darn win10.

Link to comment
Share on other sites

Just now, Benji said:

I'll give it a test, once it needs testing on darn win10.

My primary platform is Linux, which is why I'm invested in seeing some cross platform support. I was really hoping this change would also help with Windows 10, but while it works everywhere else, KSP on my Win10 install was either not reading the port at all, or locking up hard. Was pretty impressive actually. :wink:

I'll let you know when I have anything useful there.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Zitronen! I'm new of this group and this is my first post! I'm truly interested in building a simpit and I read all your thread and other more, but I couldn't find what I was looking for. I own an Arduino Mega 2560, I tried your Demo 13 with a simple hardware with 5 switches just to learn about it and it works well. My question is about the limit of 10 action groups: how would be possible to extend them? I tried using the mod Action Group Extended but it only work up to the 10th group!

Unfortunately I have no practice in programming, and I'm learning while I do things, so I was just trying to undestand if it's possible to do or not!
Thanks a lot, that would be extremely helpful to me! And if someone already posted a question like that and I didn't notice, sorry, my fault! :wink:

Link to comment
Share on other sites

Zitronen stated earlier that he does not want to include mods in the setup. Eventually, I think I will work around it by adding an Arduino Leonardo micro to send keyboard signals to KSP through another USB port, and work from there.

Link to comment
Share on other sites

Pretty much what @Freshmeat said. The plugin would need to be updated to integrate with Action Groups Extended, and the changes to the serial protocol that would require seem to me likely fairly involved. The keyboard emulation trick is probably the best way, at least for the time being.

Link to comment
Share on other sites

Oh, whatever! So I'll probably try to make my way through keyboard emulation with the Leonardo! I believe it's a sin that a mod with such an enormous field of application like this is limited in the number of action groups, specially for simpit uses, which requires a lot of switches and input. Anyway, I understand that there must be good reasons for that! And despite this fact, that's a great mod! Keep on! :D

Link to comment
Share on other sites

It's kinda bothersome for me as well. I wanted to have "flags" to indicate when I change ships, which switches are "wrong", so I can manually reset them, and then hit a flag alarm reset button. Under the current state, I'd only be able to do that with 14 of x action groups... Other than the basic ten, plus lights, brakes, gear, and abort... There's no provision unless custom coding is done... Granted, custom coding would be needed for my idea too. It could also apply to RCS and SAS controls as well. Any toggle.

You need to just store every local toggle state as a local value. Then compare it to the toggle state of the incoming packet. If there is a mis match, then indicate the mis-match and light the flag alarm. It could even be a thing that's manually controlled. press a vessel change button, and it flags toggles for x seconds. All these ideas... No C coding experience to execute them with... ;.;

Link to comment
Share on other sites

A long while ago the author of the more action groups mod was looking into how we can hook into his plug in, but have not heard from him since so I have completely forgotten about it. The real question is why squad haven't increased the number of action groups?

Anyway, considering how easy it is to emulate joystick and keyboard, options exist for people needing more action groups, I don't think it justifies the amount of work involved. You have to think about what happens for people not using the AGE plug in. Do we still keep the same packet format with the additional 250 inputs? Do we keep a separate format?

About my policy of not officially supporting other mods, everyone have different ideas of what they want their system to do, some people want mechjeb integration, some people want KOS, I can't possibly support all the things. If you really must have it, you are more than welcome to fork the code like many people have have maintain your own version of the plug in.

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...