Jump to content

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


zitronen

Recommended Posts

9 hours ago, Ray61 said:

Awesome mod, I'm grateful you've kept it updated!

I'm currently building a control box based off of Hugo Peter's awesome design (https://www.instructables.com/id/KerbalController-a-Custom-Control-Panel-for-Rocket/), however, I've run into one issue I can't solve.

Whenever there is any input on the joysticks, SAS turns off. It turns back on once there is no longer any input on the joystick , however, it reverts back to mode 1.  I would like SAS to stay on in the mode i have it set for while I input control on the joysticks. Any help is greatly appreciated. Here is the code Hugo included with the instructable:

 

I think this is actually intentional by design of this mod.  On the configuration file on your computer, check the value "SAStol".  From the documentation on the first post of this thread:

Quote

SASTol: The SAS will override your controls when you turn it on, this value allows you to override SAS if you move the roll pitch yaw control over a certain limit (10% travel by default)

Maybe try setting the value to 1 to disable the override?  If I'm reading it right, but I've never messed with this function myself so I could be totally confused on the actual effect.

 

Edited by tsaven
Link to comment
Share on other sites

19 hours ago, tsaven said:

Maybe try setting the value to 1 to disable the override?  If I'm reading it right, but I've never messed with this function myself so I could be totally confused on the actual effect.

 

It does prevent any input from disabling SAS, but it also prevents the input from controlling the vessel! Good idea though. I hadn't even noticed that setting, I have just been looking through the arduino code.

Link to comment
Share on other sites

Is anyone having trouble with i2c LCD readouts being too slow for updating or just not updating at all? like my LCD just decides to not change its information at all. i know its not the lcd cause when running a different program it displays stuff in real time. is there a way to make the demo code update faster so the data is being fed at a more constant rate and doesn't freeze?

 

RvoqrTV.jpg

(LCD Says 6.59 km)

Link to comment
Share on other sites

11 hours ago, YoshiFan501 said:

Is anyone having trouble with i2c LCD readouts being too slow for updating or just not updating at all? like my LCD just decides to not change its information at all. i know its not the lcd cause when running a different program it displays stuff in real time. is there a way to make the demo code update faster so the data is being fed at a more constant rate and doesn't freeze?

(LCD Says 6.59 km)

Yep - been there a few times. From my own experience, it was usually the serial buffer filling up because I coded it badly. This resulted in the time it took the Arduino to display the LCD taking too long and it would miss a few receives from the computer. I lowered how fast I was sending data to the Arduino until it got steady and they I investigated what I could do to speedup the process with getting data to the LCD.

Link to comment
Share on other sites

 

3 hours ago, cyberKerb said:

Yep - been there a few times. From my own experience, it was usually the serial buffer filling up because I coded it badly. This resulted in the time it took the Arduino to display the LCD taking too long and it would miss a few receives from the computer. I lowered how fast I was sending data to the Arduino until it got steady and they I investigated what I could do to speedup the process with getting data to the LCD.

May I ask how you did that? and were using the KSPIODemo files or your own custom code?

Link to comment
Share on other sites

17 hours ago, YoshiFan501 said:

Is anyone having trouble with i2c LCD readouts being too slow for updating or just not updating at all? like my LCD just decides to not change its information at all. i know its not the lcd cause when running a different program it displays stuff in real time. is there a way to make the demo code update faster so the data is being fed at a more constant rate and doesn't freeze?

 

 

I'm only just a super-babby at anything programming and Arduino related, but from fiddling with the demo code it seems that all of the input testing is done with a long procession of "if" commands.  This means that the controller is spending a ton of cycles continually checking the various digital or analog pins for to see if they're HIGH or LOW, and in my (super inexperienced) mind this is a lot of wasted cycles that are pointlessly slowing things down.

In my mind, re-structuring the demo code to make more active use of Interrupts as opposed to continually checking all of the pins could make things a LOT more efficient.  That way it'll only run the interrupt function when the pin goes HIGH or LOW, and the rest of the time it will just ignore and spend more time dealing with data being sent to it from the computer.

The downside of this plan is that most of the Arduino boards only have a limited number of hardware interrupt pins; I think the Uno has just two, and the Mega 2560 (which it looks like you're using) has six. 

The Leonardo/Due have all of their digital pins available for interrupts, but they also bring their own suite of issues (mostly that they're 3.3v and most accessories are 5v, necessitating a possible re-design of your system or use of a lot of level shifters)

Link to comment
Share on other sites

3 hours ago, YoshiFan501 said:

May I ask how you did that? and were using the KSPIODemo files or your own custom code?

I was using the KSPIO Demo files. The config.xml file that comes with the mod under \GameData\KSPSerialIO\PluginData\KSPSerialIO  has a setting called refreshrate. Set it to a second (or two or three, just something slow) and then go through your own code and ensure you are not use 'delay' anywhere at all. I quickly learnt that is very important. Here the source I used to learn that from: https://www.baldengineer.com/millis-tutorial.html

My solution was custom kludge code  written as I learnt the necessary code to get the data to the LCD. I used the LiquidCrystal_I2C library to drive the LCD display and incorporated the guide from here: https://learn.adafruit.com/i2c-spi-lcd-backpack Sorry it's non-specific as I don't have any of my test code anymore. I know others on the forum here have used the LCD module - they might have more tips for you.

 

Link to comment
Share on other sites

4 hours ago, cyberKerb said:

I was using the KSPIO Demo files. The config.xml file that comes with the mod under \GameData\KSPSerialIO\PluginData\KSPSerialIO  has a setting called refreshrate. Set it to a second (or two or three, just something slow) and then go through your own code and ensure you are not use 'delay' anywhere at all. I quickly learnt that is very important. Here the source I used to learn that from: https://www.baldengineer.com/millis-tutorial.html

My solution was custom kludge code  written as I learnt the necessary code to get the data to the LCD. I used the LiquidCrystal_I2C library to drive the LCD display and incorporated the guide from here: https://learn.adafruit.com/i2c-spi-lcd-backpack Sorry it's non-specific as I don't have any of my test code anymore. I know others on the forum here have used the LCD module - they might have more tips for you.

 

I found that disabling handshake and increasing the serial buffer did the trick for me!

Link to comment
Share on other sites

On 8/16/2019 at 10:27 PM, tsaven said:

 

I'm only just a super-babby at anything programming and Arduino related, but from fiddling with the demo code it seems that all of the input testing is done with a long procession of "if" commands.  This means that the controller is spending a ton of cycles continually checking the various digital or analog pins for to see if they're HIGH or LOW, and in my (super inexperienced) mind this is a lot of wasted cycles that are pointlessly slowing things down.

In my mind, re-structuring the demo code to make more active use of Interrupts as opposed to continually checking all of the pins could make things a LOT more efficient.  That way it'll only run the interrupt function when the pin goes HIGH or LOW, and the rest of the time it will just ignore and spend more time dealing with data being sent to it from the computer.

The downside of this plan is that most of the Arduino boards only have a limited number of hardware interrupt pins; I think the Uno has just two, and the Mega 2560 (which it looks like you're using) has six. 

The Leonardo/Due have all of their digital pins available for interrupts, but they also bring their own suite of issues (mostly that they're 3.3v and most accessories are 5v, necessitating a possible re-design of your system or use of a lot of level shifters)

I wouldn't worry about if statements. If statements themselves take almost no time (maybe 1 or 2 CPU cycles at 62.5ns per cycle), the digitalRead/digitalWrite functions are the slow bit, they take a few micro seconds. By default the IO pins are only checked every 25ms, when a control packet is sent to KSP, not all the time. 25ms is enough to check many 1000s of IOs with if statements. Of course you can use interrupts, but it won't make much difference in speed. Printing to LCDs, floating point math, sending and receiving serial data take far more time.

Link to comment
Share on other sites

26 minutes ago, zitronen said:

I wouldn't worry about if statements. [...] Printing to LCDs, floating point math, sending and receiving serial data take far more time.

Excellent information, thank you. As I said I’m still really new at this so I appreciate the correction. 

I’m curious as to why printing to LCDs is so time intensive? What about sending Ic2 data?

Link to comment
Share on other sites

1 hour ago, richfiles said:

I certainly hope that KSP 2 cooperates with the level of mod access needed to continue this, and that you continue to support this amazing mod when KSP 2 releases.

I'll have you know that your post is how I learned about the existence of KSP 2.  Kinda flipping out...

Link to comment
Share on other sites

On 8/19/2019 at 11:38 PM, richfiles said:

I certainly hope that KSP 2 cooperates with the level of mod access needed to continue this, and that you continue to support this amazing mod when KSP 2 releases.

I think it's a bit too early to say what we can do at this stage, but this is definitely something that interest me.

 

I still remember when I first landed on the Mun :), this was like KSP 0.07, without landing legs, manoeuvre nodes or even quick save! I paid $10 for KSP, got all expansions for free. Pretty good deal! I do wish Squad and the original crew was making KSP 2, but definitely exciting times.

Link to comment
Share on other sites

Hey @zitronen, where's the best place in the various tabs for me to start putting the code to display various data from the game?  Things like the AP, PE, heading, velocity, etc?

Should that be in the "void Indicators" loop in the Utilities tab, or should it be somewhere else?

Is there some documentation somewhere that explains what your concept of what each tab does and how they pass data to each other?

(I'm super super green to all of this so I don't know if I'm even asking the right question)

 

Link to comment
Share on other sites

There are 2 main loops, a input and output with separate tabs. Input() has a if statement that checks if a packet is received from KSP, so put you LEDs, displays stuff in here so they only executes when you receive something new. Output() function has a if statement that checks against a timer, put your switches, axis and other controls in the controls() function this is triggered every 25ms. Avoid running stuff constantly in the background so the code has enough time to process the serial data when not doing your stuff. Remember the arduino is single threaded, it can only do one thing at a time.

Edited by zitronen
Link to comment
Share on other sites

Hey their !!!

I really need help.

I'm trying to connect my Arduino Controller to the Game but i have a problem.

first here is the project i try to do : https://www.instructables.com/id/KerbalController-a-Custom-Control-Panel-for-Rocket/

My problem is that when i load a vessel, the Controller says "Handshaking" (so that a good things) but when the loading is finish, the game says "IO Awake" and "KerbalController not found"

And that doesn't work .

I run KSP on Win 10 and i try with 1.3.1 version.

If you have any idea please contact me

I'm actually drawning with all those codes :/

Link to comment
Share on other sites

You can try the latest version plugin 0.19.1 and arduino demo 17 (I updated links in first post). They should be compatible with KSP 1.7-1.3.

Please post the KSP debug log, and tell us which version of the plugin and arduino code you are using.

Edited by zitronen
Link to comment
Share on other sites

On 8/11/2019 at 12:33 AM, tsaven said:

Hey Zitronen, thank you for this mod and for the continued attention to it.

I'm curious, is there a reason why you've decided not to mark is as compatible with newer KSP versions for CKAN?  Is it a matter of not being able to do enough testing to validate that it's actually compatible?

Thanks again!

*edit* I'm very new to hobby electronics, but I loaded up your demo with LEDs and it's worked.

CKAN should be updated now.

Link to comment
Share on other sites

1 hour ago, zitronen said:

You can try the latest version plugin 0.19.1 and arduino demo 17 (I updated links in first post). They should be compatible with KSP 1.7-1.3.

Please post the KSP debug log, and tell us which version of the plugin and arduino code you are using.

I don't anderstand how i can use this arduino code because i don't use the same stuff.

Here is what i actually try to use to connect my arduino to the game : https://drive.google.com/drive/folders/1SHWhqOnSo50zbIeUkZVlonPxghBNxAmD?usp=sharing

in Fact i really don't know what i'm doing :/

 

And here is my arduino Code : https://drive.google.com/open?id=1y8R_eqpL3abc2lsp855oy_8B9abDdWMW

Edited by BlockMars162
Link to comment
Share on other sites

If you are new, I would suggest starting with something simple, follow the instructions on the first post. Start with a button and LED. If you are using code from someone else and you have a problem, I can't really help you.

Also please post the debug log https://wiki.kerbalspaceprogram.com/wiki/Debug_Toolbar

Link to comment
Share on other sites

19 hours ago, zitronen said:

If you are new, I would suggest starting with something simple, follow the instructions on the first post. Start with a button and LED. If you are using code from someone else and you have a problem, I can't really help you.

Also please post the debug log https://wiki.kerbalspaceprogram.com/wiki/Debug_Toolbar

Hi ,

Here is the log :

I try to use the latest version your plugin with the arduino code of my project.

When i load a vessel, KSP say that he has find a Controller and succeed to connect to it ( i also see in the log that the game receive the HandShaking (314)  )

And my arduino say also Handshaking but when the loading is finish, nothing happend and i can't use the Controller...

 

[HighLogic]: =========================== Scene Change : From MAINMENU to SPACECENTER (Async) =====================
[LOG 12:57:15.909] [UIMasterController]: HideUI
[LOG 12:57:17.665] [UIMasterController]: HideUI
[LOG 12:57:17.731] [ScenarioDestructibles]: Loading... 0 objects registered
[LOG 12:57:17.777] [AsteroidSpawner]: New object found near Kerbin: Ast. HSJ-227!
[LOG 12:57:18.025] [UiApp] Awake: KSPedia
[LOG 12:57:18.025] [ApplicationLauncher] OnSceneLoadedGUIReady: scene SPACECENTER ShouldBeVisible() True ShouldBeOnTop() False iIsPositionedAtTop True
[LOG 12:57:18.026] [ApplicationLauncher] SpawnSimpleLayout: HorizontalRightLeft
[LOG 12:57:18.028] [ApplicationLauncher] SetVisible: 
[LOG 12:57:18.048] [UIApp] OnDestroy: ContractsApp
[LOG 12:57:18.096] [MessageSystem] Reposition 0.02 11507
[LOG 12:57:18.331] [UIApp] Adding KSPedia to Application Launcher
[LOG 12:57:18.381] Flight State Captured
[LOG 12:57:18.384] Saving Achievements Tree...
[LOG 12:57:18.386] [MessageSystem] Save Messages
[LOG 12:57:18.394] Game State Saved to saves/default/persistent
[LOG 12:57:18.464] [UIMasterController]: ShowUI
[LOG 12:57:19.647] Flight State Captured
[LOG 12:57:19.648] Saving Achievements Tree...
[LOG 12:57:19.649] [MessageSystem] Save Messages
[LOG 12:57:19.655] Game State Saved to saves/default/persistent
[LOG 12:57:22.631] [UIMasterController] RemoveCanvas:VesselSpawnDialog
[LOG 12:57:25.085] [ReflectionUtil]: Found 4 types with UpgradeModule attribute in 3 assemblies.
[LOG 12:57:25.096] [KSPUpgradePipeline]: ComSat Lx (Stock) updated from 1.2.0 to 1.3.1.
[LOG 12:57:25.097] [UIMasterController] RemoveCanvas:VesselSpawnDialog
[LOG 12:57:25.103] [Pre-Flight Check]: Checking for CraftWithinPartCountLimit: PASS!
[LOG 12:57:25.104] [Pre-Flight Check]: Checking for CraftWithinSizeLimits: PASS!
[LOG 12:57:25.104] [Pre-Flight Check]: Checking for CraftWithinMassLimits: PASS!
[LOG 12:57:25.105] [Pre-Flight Check]: Checking for ExperimentalPartsAvailable: PASS!
[LOG 12:57:25.106] [Pre-Flight Check]: Checking for CanAffordLaunchTest: PASS!
[LOG 12:57:25.107] [Pre-Flight Check]: Checking for FacilityOperational: PASS!
[LOG 12:57:25.107] [Pre-Flight Check]: Checking for FacilityOperational: PASS!
[LOG 12:57:25.108] [Pre-Flight Check]: Checking for NoControlSources: PASS!
[LOG 12:57:25.112] [Pre-Flight Check]: Checking for WrongVesselTypeForLaunchSite: PASS!
[LOG 12:57:25.112] [Pre-Flight Check]: All Checks Complete. Go for Launch!
[LOG 12:57:25.113] Launching vessel from LaunchPad. Craft file: Z:\Games\Kerbal Space Program 1.3.1\Ships\VAB\ComSat Lx.craft
[LOG 12:57:25.114] Flight State Captured
[LOG 12:57:25.115] Saving Achievements Tree...
[LOG 12:57:25.115] [MessageSystem] Save Messages
[LOG 12:57:25.121] Game State Saved to saves/default/persistent
[LOG 12:57:25.128] [UIMasterController]: HideUI
[LOG 12:57:25.134] [HighLogic]: =========================== Scene Change : From SPACECENTER to FLIGHT (Async) =====================
[LOG 12:57:25.286] [UIApp] OnDestroy: KSPedia
[LOG 12:57:25.299] [PlanetariumCamera]: Focus: Kerbin
[LOG 12:57:25.300] [UIMasterController]: HideUI
[LOG 12:57:25.796] UICanvasPrefabSpawner FlightUI spawning Flight
[LOG 12:57:25.815] UICanvasPrefabSpawner FlightUI spawning VesselLabels
[LOG 12:57:25.816] [UiApp] Awake: ResourceDisplay
[LOG 12:57:25.821] [AddonLoader]: Instantiating addon 'AeroGUI' from assembly 'KSP'
[LOG 12:57:25.823] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
[LOG 12:57:25.825] KSPSerialIO: Version 0.19.1
[LOG 12:57:25.826] KSPSerialIO: Getting serial ports...
[LOG 12:57:25.827] KSPSerialIO: Output packet size: 214/255
[LOG 12:57:25.828] KSPSerialIO: Found 3 serial ports
[LOG 12:57:25.829] KSPSerialIO: trying default port COM3
[LOG 12:57:28.970] KSPSerialIO: found KSP Display at COM3
[LOG 12:57:28.971] [AddonLoader]: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'
[LOG 12:57:28.972] [PlanetariumCamera]: Focus: Kerbin
[LOG 12:57:28.973] [UIMasterController]: HideUI
[LOG 12:57:29.025] ------------------- initializing flight mode... ------------------
[LOG 12:57:29.029] [MessageSystem] Save Messages
[LOG 12:57:29.030] Loading Depletion Nodes
[LOG 12:57:29.031] DepNodeCount:  0
[LOG 12:57:29.032] Loading Biome Nodes
[LOG 12:57:29.032] BiomeNodeCount:  0
[LOG 12:57:29.033] Loading Planet Nodes
[LOG 12:57:29.033] PlanetNodeCount:  0
[LOG 12:57:29.036] [ScenarioDestructibles]: Loading... 0 objects registered
[ERR 12:57:29.037] Invalid integer value! Field lastSeed, value 5.592988E+08 on object of type ScenarioDiscoverableObjects

[LOG 12:57:29.041] Loading ship from file: Z:\Games\Kerbal Space Program 1.3.1\Ships\VAB\ComSat Lx.craft
[LOG 12:57:29.080] ComSat Lx loaded!
[LOG 12:57:30.273] putting ship to ground: 0
[LOG 12:57:30.277] [ComSat Lx]: Ready to Launch - waiting to start physics...
[LOG 12:57:30.290] [FLIGHT GLOBALS]: Switching To Vessel ComSat Lx ---------------------- 
[LOG 12:57:30.292] setting new dominant body: Kerbin
FlightGlobals.mainBody: Kerbin
[LOG 12:57:30.293] Reference Frame: Rotating
[LOG 12:57:30.300] Vessel assembly complete!
[LOG 12:57:30.300] all systems started
[LOG 12:57:33.588] DragCubeSystem: Rendering procedural drag for fairingSize1
[LOG 12:57:33.699] [AsteroidSpawner]: New object found near Kerbin: Ast. HSJ-227!
[LOG 12:57:33.711] KSPSerialIO: Handshake received - 314
[LOG 12:57:34.026] [UiApp] Awake: CurrencyWidgetsApp
[LOG 12:57:34.031] [UiApp] Awake: ResourceDisplay
[LOG 12:57:34.031] [UiApp] Awake: KSPedia
[LOG 12:57:34.032] [ApplicationLauncher] OnSceneLoadedGUIReady: scene FLIGHT ShouldBeVisible() True ShouldBeOnTop() True iIsPositionedAtTop False
[LOG 12:57:34.033] [ApplicationLauncher] SpawnSimpleLayout: VerticalTopDown
[LOG 12:57:34.035] [KnowledgeBase] OnAppLauncherReady 11890
[LOG 12:57:34.050] [UIApp] OnDestroy: ContractsApp
[LOG 12:57:34.060] [MessageSystem] Reposition 0.02 11891
[LOG 12:57:34.087] [FlightIntegrator]: Reloaded drag cube for zeroed cube root part probeCoreOcto on vessel ComSat Lx
[LOG 12:57:34.097] [FlightIntegrator]: Vessel ComSat Lx has been unloaded 1.79769313486232E+308, applying analytic temperature 309.438332144723
[LOG 12:57:34.144] [PlanetariumCamera]: Focus: ComSat Lx
[LOG 12:57:34.160] [UIApp] Adding ResourceDisplay to Application Launcher
[LOG 12:57:34.162] [UIApp] Adding ResourceDisplay to Application Launcher
[LOG 12:57:34.171] [ResourceDisplay] OnAppStarted(): id: -184620
[LOG 12:57:34.174] [GenericAppFrame] Reposition 0.1171657 11895
[LOG 12:57:34.175] [ResourceDisplay] OnAppStarted(): id: 104194
[LOG 12:57:34.176] ResourceDisplay already exist, destroying this instance
[LOG 12:57:34.177] [UIApp] OnDestroy: ResourceDisplay
[LOG 12:57:34.193] CURRENCY WIDGET False False False
[LOG 12:57:34.196] [UIApp] OnDestroy: CurrencyWidgetsApp
[LOG 12:57:34.203] [UIApp] Adding KSPedia to Application Launcher
[WRN 12:57:34.247] HighlightingSystem : Framebuffer depth data is not available and can't be used to occlude highlighting. Highlighting occluders enabled.
[LOG 12:57:34.332] [UIMasterController]: ShowUI
[LOG 12:57:34.337] Flight State Captured
[LOG 12:57:34.337] Saving Achievements Tree...
[LOG 12:57:34.338] [MessageSystem] Save Messages
[LOG 12:57:34.348] Game State Saved as persistent
[LOG 12:57:35.333] Unpacking ComSat Lx
[LOG 12:57:49.067] [AsteroidSpawner]: New object found near Kerbin: Ast. JWU-359!
[LOG 12:57:56.505] [UIApp] OnDestroy: KSPedia
[LOG 12:57:56.507] KbApp.OnDestroy Vessel Crew
[LOG 12:57:56.508] KbApp.OnDestroy NullName
[LOG 12:57:56.509] KbApp.OnDestroy Planet Parameters
[LOG 12:57:56.511] KbApp.OnDestroy Planet Resources
[LOG 12:57:56.527] [UIApp] OnDestroy: ResourceDisplay
[LOG 12:57:56.528] KbApp.OnDestroy Planet Info
[LOG 12:57:56.529] KbApp.OnDestroy Vessel Info
[LOG 12:57:56.539] [UIApp] OnDestroy: MessageSystem

 

Link to comment
Share on other sites

Is there documentation anywhere of how many decimal points are sent for each floating point variable?  I'm having a heck of a time getting my Mach readout to work and I think I've been formatting it wrong, but it's hard to tell when I don't know how big (in terms of characters) the incoming variable is.

It would also be useful to have documented somewhere what structure the other variables are sent in, especially the time-related ones.  Seconds, minutes, hours, etc?

Edited by tsaven
Link to comment
Share on other sites

On 8/29/2019 at 12:06 PM, BlockMars162 said:

Hi ,

Here is the log :

I try to use the latest version your plugin with the arduino code of my project.

When i load a vessel, KSP say that he has find a Controller and succeed to connect to it ( i also see in the log that the game receive the HandShaking (314)  )

And my arduino say also Handshaking but when the loading is finish, nothing happend and i can't use the Controller...

 


[HighLogic]: =========================== Scene Change : From MAINMENU to SPACECENTER (Async) =====================
[LOG 12:57:15.909] [UIMasterController]: HideUI
[LOG 12:57:17.665] [UIMasterController]: HideUI
[LOG 12:57:17.731] [ScenarioDestructibles]: Loading... 0 objects registered
[LOG 12:57:17.777] [AsteroidSpawner]: New object found near Kerbin: Ast. HSJ-227!
[LOG 12:57:18.025] [UiApp] Awake: KSPedia
[LOG 12:57:18.025] [ApplicationLauncher] OnSceneLoadedGUIReady: scene SPACECENTER ShouldBeVisible() True ShouldBeOnTop() False iIsPositionedAtTop True
[LOG 12:57:18.026] [ApplicationLauncher] SpawnSimpleLayout: HorizontalRightLeft
[LOG 12:57:18.028] [ApplicationLauncher] SetVisible: 
[LOG 12:57:18.048] [UIApp] OnDestroy: ContractsApp
[LOG 12:57:18.096] [MessageSystem] Reposition 0.02 11507
[LOG 12:57:18.331] [UIApp] Adding KSPedia to Application Launcher
[LOG 12:57:18.381] Flight State Captured
[LOG 12:57:18.384] Saving Achievements Tree...
[LOG 12:57:18.386] [MessageSystem] Save Messages
[LOG 12:57:18.394] Game State Saved to saves/default/persistent
[LOG 12:57:18.464] [UIMasterController]: ShowUI
[LOG 12:57:19.647] Flight State Captured
[LOG 12:57:19.648] Saving Achievements Tree...
[LOG 12:57:19.649] [MessageSystem] Save Messages
[LOG 12:57:19.655] Game State Saved to saves/default/persistent
[LOG 12:57:22.631] [UIMasterController] RemoveCanvas:VesselSpawnDialog
[LOG 12:57:25.085] [ReflectionUtil]: Found 4 types with UpgradeModule attribute in 3 assemblies.
[LOG 12:57:25.096] [KSPUpgradePipeline]: ComSat Lx (Stock) updated from 1.2.0 to 1.3.1.
[LOG 12:57:25.097] [UIMasterController] RemoveCanvas:VesselSpawnDialog
[LOG 12:57:25.103] [Pre-Flight Check]: Checking for CraftWithinPartCountLimit: PASS!
[LOG 12:57:25.104] [Pre-Flight Check]: Checking for CraftWithinSizeLimits: PASS!
[LOG 12:57:25.104] [Pre-Flight Check]: Checking for CraftWithinMassLimits: PASS!
[LOG 12:57:25.105] [Pre-Flight Check]: Checking for ExperimentalPartsAvailable: PASS!
[LOG 12:57:25.106] [Pre-Flight Check]: Checking for CanAffordLaunchTest: PASS!
[LOG 12:57:25.107] [Pre-Flight Check]: Checking for FacilityOperational: PASS!
[LOG 12:57:25.107] [Pre-Flight Check]: Checking for FacilityOperational: PASS!
[LOG 12:57:25.108] [Pre-Flight Check]: Checking for NoControlSources: PASS!
[LOG 12:57:25.112] [Pre-Flight Check]: Checking for WrongVesselTypeForLaunchSite: PASS!
[LOG 12:57:25.112] [Pre-Flight Check]: All Checks Complete. Go for Launch!
[LOG 12:57:25.113] Launching vessel from LaunchPad. Craft file: Z:\Games\Kerbal Space Program 1.3.1\Ships\VAB\ComSat Lx.craft
[LOG 12:57:25.114] Flight State Captured
[LOG 12:57:25.115] Saving Achievements Tree...
[LOG 12:57:25.115] [MessageSystem] Save Messages
[LOG 12:57:25.121] Game State Saved to saves/default/persistent
[LOG 12:57:25.128] [UIMasterController]: HideUI
[LOG 12:57:25.134] [HighLogic]: =========================== Scene Change : From SPACECENTER to FLIGHT (Async) =====================
[LOG 12:57:25.286] [UIApp] OnDestroy: KSPedia
[LOG 12:57:25.299] [PlanetariumCamera]: Focus: Kerbin
[LOG 12:57:25.300] [UIMasterController]: HideUI
[LOG 12:57:25.796] UICanvasPrefabSpawner FlightUI spawning Flight
[LOG 12:57:25.815] UICanvasPrefabSpawner FlightUI spawning VesselLabels
[LOG 12:57:25.816] [UiApp] Awake: ResourceDisplay
[LOG 12:57:25.821] [AddonLoader]: Instantiating addon 'AeroGUI' from assembly 'KSP'
[LOG 12:57:25.823] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
[LOG 12:57:25.825] KSPSerialIO: Version 0.19.1
[LOG 12:57:25.826] KSPSerialIO: Getting serial ports...
[LOG 12:57:25.827] KSPSerialIO: Output packet size: 214/255
[LOG 12:57:25.828] KSPSerialIO: Found 3 serial ports
[LOG 12:57:25.829] KSPSerialIO: trying default port COM3
[LOG 12:57:28.970] KSPSerialIO: found KSP Display at COM3
[LOG 12:57:28.971] [AddonLoader]: Instantiating addon 'KSPSerialIO' from assembly 'KSPSerialIO'
[LOG 12:57:28.972] [PlanetariumCamera]: Focus: Kerbin
[LOG 12:57:28.973] [UIMasterController]: HideUI
[LOG 12:57:29.025] ------------------- initializing flight mode... ------------------
[LOG 12:57:29.029] [MessageSystem] Save Messages
[LOG 12:57:29.030] Loading Depletion Nodes
[LOG 12:57:29.031] DepNodeCount:  0
[LOG 12:57:29.032] Loading Biome Nodes
[LOG 12:57:29.032] BiomeNodeCount:  0
[LOG 12:57:29.033] Loading Planet Nodes
[LOG 12:57:29.033] PlanetNodeCount:  0
[LOG 12:57:29.036] [ScenarioDestructibles]: Loading... 0 objects registered
[ERR 12:57:29.037] Invalid integer value! Field lastSeed, value 5.592988E+08 on object of type ScenarioDiscoverableObjects

[LOG 12:57:29.041] Loading ship from file: Z:\Games\Kerbal Space Program 1.3.1\Ships\VAB\ComSat Lx.craft
[LOG 12:57:29.080] ComSat Lx loaded!
[LOG 12:57:30.273] putting ship to ground: 0
[LOG 12:57:30.277] [ComSat Lx]: Ready to Launch - waiting to start physics...
[LOG 12:57:30.290] [FLIGHT GLOBALS]: Switching To Vessel ComSat Lx ---------------------- 
[LOG 12:57:30.292] setting new dominant body: Kerbin
FlightGlobals.mainBody: Kerbin
[LOG 12:57:30.293] Reference Frame: Rotating
[LOG 12:57:30.300] Vessel assembly complete!
[LOG 12:57:30.300] all systems started
[LOG 12:57:33.588] DragCubeSystem: Rendering procedural drag for fairingSize1
[LOG 12:57:33.699] [AsteroidSpawner]: New object found near Kerbin: Ast. HSJ-227!
[LOG 12:57:33.711] KSPSerialIO: Handshake received - 314
[LOG 12:57:34.026] [UiApp] Awake: CurrencyWidgetsApp
[LOG 12:57:34.031] [UiApp] Awake: ResourceDisplay
[LOG 12:57:34.031] [UiApp] Awake: KSPedia
[LOG 12:57:34.032] [ApplicationLauncher] OnSceneLoadedGUIReady: scene FLIGHT ShouldBeVisible() True ShouldBeOnTop() True iIsPositionedAtTop False
[LOG 12:57:34.033] [ApplicationLauncher] SpawnSimpleLayout: VerticalTopDown
[LOG 12:57:34.035] [KnowledgeBase] OnAppLauncherReady 11890
[LOG 12:57:34.050] [UIApp] OnDestroy: ContractsApp
[LOG 12:57:34.060] [MessageSystem] Reposition 0.02 11891
[LOG 12:57:34.087] [FlightIntegrator]: Reloaded drag cube for zeroed cube root part probeCoreOcto on vessel ComSat Lx
[LOG 12:57:34.097] [FlightIntegrator]: Vessel ComSat Lx has been unloaded 1.79769313486232E+308, applying analytic temperature 309.438332144723
[LOG 12:57:34.144] [PlanetariumCamera]: Focus: ComSat Lx
[LOG 12:57:34.160] [UIApp] Adding ResourceDisplay to Application Launcher
[LOG 12:57:34.162] [UIApp] Adding ResourceDisplay to Application Launcher
[LOG 12:57:34.171] [ResourceDisplay] OnAppStarted(): id: -184620
[LOG 12:57:34.174] [GenericAppFrame] Reposition 0.1171657 11895
[LOG 12:57:34.175] [ResourceDisplay] OnAppStarted(): id: 104194
[LOG 12:57:34.176] ResourceDisplay already exist, destroying this instance
[LOG 12:57:34.177] [UIApp] OnDestroy: ResourceDisplay
[LOG 12:57:34.193] CURRENCY WIDGET False False False
[LOG 12:57:34.196] [UIApp] OnDestroy: CurrencyWidgetsApp
[LOG 12:57:34.203] [UIApp] Adding KSPedia to Application Launcher
[WRN 12:57:34.247] HighlightingSystem : Framebuffer depth data is not available and can't be used to occlude highlighting. Highlighting occluders enabled.
[LOG 12:57:34.332] [UIMasterController]: ShowUI
[LOG 12:57:34.337] Flight State Captured
[LOG 12:57:34.337] Saving Achievements Tree...
[LOG 12:57:34.338] [MessageSystem] Save Messages
[LOG 12:57:34.348] Game State Saved as persistent
[LOG 12:57:35.333] Unpacking ComSat Lx
[LOG 12:57:49.067] [AsteroidSpawner]: New object found near Kerbin: Ast. JWU-359!
[LOG 12:57:56.505] [UIApp] OnDestroy: KSPedia
[LOG 12:57:56.507] KbApp.OnDestroy Vessel Crew
[LOG 12:57:56.508] KbApp.OnDestroy NullName
[LOG 12:57:56.509] KbApp.OnDestroy Planet Parameters
[LOG 12:57:56.511] KbApp.OnDestroy Planet Resources
[LOG 12:57:56.527] [UIApp] OnDestroy: ResourceDisplay
[LOG 12:57:56.528] KbApp.OnDestroy Planet Info
[LOG 12:57:56.529] KbApp.OnDestroy Vessel Info
[LOG 12:57:56.539] [UIApp] OnDestroy: MessageSystem

 

That means it's connected. If you plug in some LEDs as described in the first post, do they work? If your inputs don't work, it's because there are problems for things like switches and axis controls in Windows 10, which are related to serial port drivers. Some arduino boards work some don't, some people report cheap ones from China have better chance of working. You can try searching this thread for previous attempts.

7 hours ago, tsaven said:

Is there documentation anywhere of how many decimal points are sent for each floating point variable?  I'm having a heck of a time getting my Mach readout to work and I think I've been formatting it wrong, but it's hard to tell when I don't know how big (in terms of characters) the incoming variable is.

It would also be useful to have documented somewhere what structure the other variables are sent in, especially the time-related ones.  Seconds, minutes, hours, etc?

Uh.. floats have a variable number of decimal points, that's why they are called "floating" point. Mach number is a sent as a float. Arduinos only support 32bit floats, they have about 7 significant digits (M=1.235678, M=12.345678 M=123.45678, etc.), times are always in seconds, but some are signed (int) because they can be negative and some are unsigned (UInt). The only time related variable that is a float is "deltaTime" which is the time interval in seconds since last serial packet was sent from KSP, used for calculating derivatives.

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...