Freshmeat Posted October 10, 2018 Share Posted October 10, 2018 On 10/9/2018 at 1:16 AM, ohMorrissey said: I have my simpit finished and functional, control and all (windows 10 btw!) Is there anything that could cause intermittent connection drops? The code multi tasks to read 5 ICs and write to one screen but it doesn't stop talking to KSP while it does so, was wondering if there is anything else? First of all, it is a sick setup you have. Very cool looking, and from the looks of it highly functional. Second, when I had dropouts, I had some more demanding tasks only run once or twice per second. It is quite sufficient to know for instance your fuel level to that timescale. And as zitronen said, increase your buffer. A Mega has a ton of ram compared to an Uno. Quote Link to comment Share on other sites More sharing options...
ohMorrissey Posted October 11, 2018 Share Posted October 11, 2018 On 10/10/2018 at 8:34 PM, zitronen said: You can try increasing the size of the rx buffer in HardwareSerial.h in your Arduino install. If that doesn't work or if you are very low on SRAM you can turn down the refresh rate in the plugin config file. I'll give both a try individually then together if it doesn't help enough, Ill let you know On 10/11/2018 at 12:29 AM, Freshmeat said: Second, when I had dropouts, I had some more demanding tasks only run once or twice per second. It is quite sufficient to know for instance your fuel level to that timescale. And as zitronen said, increase your buffer. A Mega has a ton of ram compared to an Uno. My more demanding functions are run once over about 60 loops, I use a global timer, Originally when I used my IC's the shift in and shift out functions caused SerialIO to drop out (They use bout 30ms worth of the delay function), so now it runs over multiple loops, eg: int GlobalTimer = 1; void loop(){ input(); if (GlobalTimer == 1) { // Pulse latch pin } if (GlobalTimer == 20) { // Read first pulse from ICs } if (GlobalTimer == 23) { // Read Second pulse from ICs, etc for all 8 pulses, 3 ms apart } if (GlobalTimer == 60){ // Run HUD functions GlobalTimer = 0; } GlobalTimer++; delay(1); } Quote Link to comment Share on other sites More sharing options...
Freshmeat Posted October 12, 2018 Share Posted October 12, 2018 @ohMorrissey Yes, like that. Only I used milis() instead to get a realtime delay. Quote Link to comment Share on other sites More sharing options...
zitronen Posted October 14, 2018 Author Share Posted October 14, 2018 Yeah don't use delay(), since it stops everything, really bad. instead of GlobalTimer++; delay(1); Do it this way now = micros(); dt = now - dtOld; if (dt >= 1000) { dtOld = now; GlobalTimer++; } Also do you really need to update stuff every 60ms? Quote Link to comment Share on other sites More sharing options...
sec3 Posted October 21, 2018 Share Posted October 21, 2018 (edited) btw. my Board runs well at KSP V1.5.1 / Serial IO V1.4 / Arduino V18.4 (? i have the *.ino-base with just 54 attributes to TargetdV) / Win7 PS: Dez. 2018 -> KSP V 1.6.0 works well. Edited December 20, 2018 by sec3 Quote Link to comment Share on other sites More sharing options...
zitronen Posted October 24, 2018 Author Share Posted October 24, 2018 @sec3 Cool, thanks for letting me know! Quote Link to comment Share on other sites More sharing options...
c4ooo Posted February 23, 2019 Share Posted February 23, 2019 (edited) So, with the fuel data work right now, there is no way to detect if an side booster/engine has run out of fuel, should something be done about it? Also should I fix the stupid thing where you can only target Vessels and not celestial bodies? Edited February 23, 2019 by c4ooo Quote Link to comment Share on other sites More sharing options...
zitronen Posted February 28, 2019 Author Share Posted February 28, 2019 Not really sure how to do the fuel thing. If you want to add something that checks for planets, please do! Quote Link to comment Share on other sites More sharing options...
cyberKerb Posted March 2, 2019 Share Posted March 2, 2019 (edited) Question for people using Teensys - did you get it working in Win10? I ask as I was able to connect the Teensy to the debugging tool with a bit of tweaking. Messages are sent back and forth no prob. However, if I try to connect with KSP, it gives the "no display found" error. I'm not sure why it would work for the debugger tool and not KSP. I'm using Teensy 3.6, Arduino 1.8.7, KSP 1.6.1 I can get it working no probs with Arduino - just having some issue getting Teensy up and running with KSP. Any help would be greatly... ummm... helpful and appreciated. Edit: (FIXED!) Checking the specific reason of my failed connection the log file give this error: "CreateFile Failed: 2" - this led me to search way back in this thread and I found a suggestion to change the port name to something lower than COM10 might work, and it did. So for WIn10, if you're getting "CreateFile Failed: 2" errors AND have a COM port higher than COM9, try change to a lower COM port. So I'm back up and running again. This time on a Teensy 3.6! Edited March 3, 2019 by wile1411 Quote Link to comment Share on other sites More sharing options...
cyberKerb Posted March 3, 2019 Share Posted March 3, 2019 (edited) Ok - follow up query for @zitronen regarding the issues I experienced. Just curious - was there a reason (maybe KSP limitation) on why the mod used "OpenNETCF.IO.Ports" instead of "System.IO.Ports" that is in the Debug tool? It seems that the KSPSERIALIO debugtool doesn't require the serialport.dll and is a little more robust with COM ports > COM9. However, the OpenNETCF SerialPort.dll included with this mod seems to be unable to utilize higher COM ports for some reason. At least that is the comments I see in this thread and with my own experience. Saw the OP issues notes (sorry! ) Edited March 4, 2019 by wile1411 Quote Link to comment Share on other sites More sharing options...
zitronen Posted March 4, 2019 Author Share Posted March 4, 2019 It's because Unity does not have System.IO.Ports like MS .net. It can't access serial ports. If it did it would have made everyone's life so much easier. Quote Link to comment Share on other sites More sharing options...
zitronen Posted March 31, 2019 Author Share Posted March 31, 2019 (edited) Hi guys, I've just started to play some KSP again, realised I forgot to actually put the new version out. Update 0.19.1: Changes: Added pro-grade, maneuver, and target pitch and heading angles, as well as normal vector, thanks to @c4ooo Recompiled against KSP version 1.6.1, seems to work OK Plugin download link: https://sites.google.com/site/zitronfiles/KSPSerialIO_019_1.zip Arduino code dowload: https://sites.google.com/site/zitronfiles/KSPIODemo17.zip If you were using a previous version (demo 16), just add the following to your arduino code data structure: int16_t ProgradePitch; //56 Pitch Of the Prograde Vector; int_16 ranging from (-0x8000(-360 degrees) to 0x7FFF(359.99ish degrees)); int16_t ProgradeHeading; //57 Heading Of the Prograde Vector; see above for range (Prograde vector depends on navball mode, eg Surface/Orbit/Target) int16_t ManeuverPitch; //58 Pitch Of the Maneuver Vector; see above for range; (0 if no Maneuver node) int16_t ManeuverHeading; //59 Heading Of the Maneuver Vector; see above for range; (0 if no Maneuver node) int16_t TargetPitch; //60 Pitch Of the Target Vector; see above for range; (0 if no Target) int16_t TargetHeading; //61 Heading Of the Target Vector; see above for range; (0 if no Target) int16_t NormalHeading; //62 Heading Of the Prograde Vector; see above for range; (Pitch of the Heading Vector is always 0) Edited March 31, 2019 by zitronen Quote Link to comment Share on other sites More sharing options...
Freshmeat Posted April 2, 2019 Share Posted April 2, 2019 (edited) First of all, thank you for keeping the mod alive. I have spent literally hundreds of hours building control panels, and learned everything I know about electronics and microcontrollers due to this plugin, knowledge that turned out handy in my job as well. Second, just to be sure: When you are flying prograde, your VData.ProgradePitch will have same value as VData.Pitch, right? Then you have just solved a thorn in my code as the data I could get from kRPC was troublesome. Third, I am not certain what you mean by NormalHeading value. How does it differ from Heading? Fourth: Welcome back to the explody rockets. Edited April 2, 2019 by Freshmeat Quote Link to comment Share on other sites More sharing options...
c4ooo Posted April 4, 2019 Share Posted April 4, 2019 (edited) On 4/2/2019 at 10:56 AM, Freshmeat said: Second, just to be sure: When you are flying prograde, your VData.ProgradePitch will have same value as VData.Pitch, right? Then you have just solved a thorn in my code as the data I could get from kRPC was troublesome. Third, I am not certain what you mean by NormalHeading value. How does it differ from Heading? Yep pretty much, although of course if you pull up sharply, VData.ProgradePitch will lag behind VData.Pitch (changing your pitch doesn't immediately change vertical velocity). As for the NormalHeading value, this should be the Heading of the Normal vector. There is no Pitch for the Normal vector becouse it always sits on the orbital plane (Pitch = 0). I didn't know this at the time of my pull request, but sending this isn't necessary - the NormalHeading should always be ProgradeHeading + 90. Thus it probz wont hurt to remove it. Also you can easily get the Radial vector pitch/heading from the the Prograde and Normal vectors, so no need to send that either. Edited April 4, 2019 by c4ooo Quote Link to comment Share on other sites More sharing options...
Freshmeat Posted April 5, 2019 Share Posted April 5, 2019 @c4ooo: Thanks for clarifying. I want to have an alarm going off whenever I deviate to much from prograde as my constructions are not always that aerodynamically stable. BTW @zitronen: Why in the range from -360 to 360 instead of -180 to 180? I can perfectly live with it, but it seems like a strange choice. The word normal is a funny one. In math, it is the perpendicular, but in everyday use, it is what is expected, hence my confusion. Quote Link to comment Share on other sites More sharing options...
c4ooo Posted April 5, 2019 Share Posted April 5, 2019 5 hours ago, Freshmeat said: BTW @zitronen: Why in the range from -360 to 360 instead of -180 to 180? I can perfectly live with it, but it seems like a strange choice. IIRC I didn't like the idea of negative headings. Otherwise, the range -180 to 180 could have been used Quote Link to comment Share on other sites More sharing options...
EccentricTea Posted April 5, 2019 Share Posted April 5, 2019 I Love that this thread is still alive, I have a bit of a bug that I was wondering if you guys have seen before. When I load up a rocket so going from the V.A.B. to the launch pad occasionally ~30-40% of the time its seems like things don't load right. I have no control over the rocket and the stages on the left hand side are all missing. the work around that I found is just to return to the V.A.B. and just reload the rocket and most of the time that fixes it. I'm not sure if this has to do with me changing the baud rate in the config file and code to 115200. Or if this is a handshake issue where I just need to increase the handshake wait time. I'm also using an arduino mega with almost every IO being used (yes it's a big control panel) and I'm not sure if having so many IO's is causing a delay. Quote Link to comment Share on other sites More sharing options...
Freshmeat Posted April 6, 2019 Share Posted April 6, 2019 @EccentricTea There is a HandshakeDelay in the config file. Try setting it up, I have mine at 3000 ms. Quote Link to comment Share on other sites More sharing options...
zitronen Posted April 9, 2019 Author Share Posted April 9, 2019 On 4/5/2019 at 10:31 AM, Freshmeat said: @c4ooo: Thanks for clarifying. I want to have an alarm going off whenever I deviate to much from prograde as my constructions are not always that aerodynamically stable. Yeah this should work. Just divide the raw prograde pitch/heading value by 50.0 to get heading in degrees. On 4/5/2019 at 8:30 PM, EccentricTea said: I Love that this thread is still alive, I have a bit of a bug that I was wondering if you guys have seen before. When I load up a rocket so going from the V.A.B. to the launch pad occasionally ~30-40% of the time its seems like things don't load right. I have no control over the rocket and the stages on the left hand side are all missing. the work around that I found is just to return to the V.A.B. and just reload the rocket and most of the time that fixes it. I'm not sure if this has to do with me changing the baud rate in the config file and code to 115200. Or if this is a handshake issue where I just need to increase the handshake wait time. I'm also using an arduino mega with almost every IO being used (yes it's a big control panel) and I'm not sure if having so many IO's is causing a delay. If what freshmeat said doesn't work, can you post the debug log? It can be either the plugin not detecting your arduino or something wrong in the arduino code. Quote Link to comment Share on other sites More sharing options...
EccentricTea Posted April 10, 2019 Share Posted April 10, 2019 Dumb question but how do I find the Debug log? Quote Link to comment Share on other sites More sharing options...
c4ooo Posted April 15, 2019 Share Posted April 15, 2019 On 4/10/2019 at 7:31 PM, EccentricTea said: Dumb question but how do I find the Debug log? It should be in the same folder as the game's exe file, or in a sub folder titled "logs" iirc Quote Link to comment Share on other sites More sharing options...
EccentricTea Posted April 15, 2019 Share Posted April 15, 2019 well I think I figured it out, and it a bit specific to my setup since I'm using almost every I/O on the arduino mega and I'm running 8 max7219 Ledcontrol chips so its controlling over 512 leds and that is taking so long the code freezes up so I'm decreasing how many are getting updated each time through the code and so far thats working. Quote Link to comment Share on other sites More sharing options...
Freshmeat Posted April 17, 2019 Share Posted April 17, 2019 @EccentricTea Same happened to me, should have thought about that as well when I tried to help. A lot of functions only need updating every second,. I used to do it on 250ms rolling updates, spreading the computationally expensive updates even (Arduinos are not exactly found of trigonometry). BTW, do you have any pictures of your console? I am rather intrigued by now. Quote Link to comment Share on other sites More sharing options...
EccentricTea Posted April 17, 2019 Share Posted April 17, 2019 Do I have to upload the photos to another site first just to point a URL at it to get the photo in my post or is there a better way? Quote Link to comment Share on other sites More sharing options...
Freshmeat Posted April 18, 2019 Share Posted April 18, 2019 14 hours ago, EccentricTea said: Do I have to upload the photos to another site first just to point a URL at it to get the photo in my post or is there a better way? You will need to upload to somewhere else. The forum used to play well with Imgur, but you can use whatever you fancy. If you make a thread over at Fan Works, we can all chime in with our applause. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.