Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export PATH := /usr/local/bin:$(PATH)
XBUILD=xbuild
XBUILD=msbuild
# You can use "Debug" for a debug build.
CONFIG=Release

KSPDIR=/Users/hugo/Local\ Files/KSP/MyMOD/
# This is the default dir for a Steam installation.
KSPDIR=$(shell echo ~)/Library/Application\ Support/Steam/steamapps/common/Kerbal\ Space\ Program
INSTALLDIR=$(KSPDIR)/GameData/KSPSerialIO
CONFIGDIR=$(INSTALLDIR)/PluginData/KSPSerialIO

Expand All @@ -16,6 +18,8 @@ KSPSerial.dll:
$(XBUILD) /p:Configuration=$(CONFIG)

install:
mkdir -p $(INSTALLDIR)
mkdir -p $(CONFIGDIR)
cp KSPSerialIO/bin/$(CONFIG)/KSPSerialIO.dll $(INSTALLDIR)
cp KSPSerialIO/bin/$(CONFIG)/PsimaxSerial.dll $(INSTALLDIR)
#cp ../PsiMaxSerial/PsiMaxSerial/Release/Mono.Posix.dll $(INSTALLDIR)
Expand All @@ -26,9 +30,9 @@ clean:

package: all
mkdir -p $(PACKAGECONFIGDIR)
mkdir -p KSPSerialIO/bin/$(CONFIG)
cp KSPSerialIO/bin/$(CONFIG)/KSPSerialIO.dll $(PACKAGEDIR)
cp KSPSerialIO/bin/$(CONFIG)/PsimaxSerial.dll $(PACKAGEDIR)
#cp ../PsimaxSerial/PsimaxSerial/bin/Release/Mono.Posix.dll $(PACKAGEDIR)
cp config.xml $(PACKAGECONFIGDIR)
cd package; zip -r -9 ../KSPSerialIO-cross-$(PLUGINVERSION).zip KSPSerialIO
rm -r package
Expand Down
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,59 @@ This is a fork of the [KSPSerialIO](http://forum.kerbalspaceprogram.com/index.ph
plugin for Kerbal Space Program. KSPSerialIO provides a serial interface for
KSP. This fork of the plugin runs on MacOS and is customized by hugopeeters for use with his KerbalController.

Furtherly modified by gargrag, to be used on macOS, with a custom controller, and a Steam installation of the game.

## Building on macOS (Former OSX)
In order to build this you will need to have installed [brew package manager](https://brew.sh/).
1. Install mono libraries by running `brew install mono`
1. If you have the game installed with Steam, then there's no change required, if you have the game installed with a different method, you will need to modify the `INSTALLDIR` variable on the `Makefile`.

1. `make` command will use `msbuild` (xbuild is being deprecated). to build the image.

1. `make install` command will copy the plugin and configuration into the respective game directories.

If you need to start from scratch again, you can use `make clean` to clean up the enviroment by deleting all the generated artifacts.

## Changing the configuration
In order for this plugin to work correctly, you will need to specify the serial port assigned to your arduino board on the `config.xml` file, as well as the Baud rate and handshake delay.

Once you have the right configuration, you can run `make install` again, to copy the `config.xml` file to the proper destination.

### Detecting the serial port
An easy way to detect this, is to connect your arduino board to your computer, open the [arduino IDE](https://www.arduino.cc/en/main/software), press `command + shift + M` and note the path on the serial monitor title bar. For example `/dev/cu.usbmodem14601`

![Screen Shot 2020-06-22 at 5 47 01 PM](https://user-images.githubusercontent.com/967311/85348595-ea843c80-b4b0-11ea-893a-3ab5afe80678.png)

## Verification
To verify that the plugin is being loaded, and that is successfully communicating with your Arduino board, you can check the Kerbal Space Program log.

For macOS and Steam installation, it's located in ` ~/Library/Application\ Support/Steam/steamapps/common/Kerbal\ Space\ Program/KSP.log`

So you can run `tail -f ~/Library/Application\ Support/Steam/steamapps/common/Kerbal\ Space\ Program/KSP.log` on a terminal, this will keep showing the last lines of the file.

And with that terminal open, and the `tail` command running, open the game. At some point you will see something like:

```
[LOG 22:22:37.071] [AddonLoader]: Instantiating addon 'KSPSerialPort' from assembly 'KSPSerialIO'
[LOG 22:22:37.077] KSPSerialIO: Version 0.18.7.0
[LOG 22:22:37.077] KSPSerialIO: Getting serial ports...
[LOG 22:22:37.077] KSPSerialIO: Output packet size: 200/255
[LOG 22:22:37.082] KSPSerialIO: Dude do you even win32 serial port??
[LOG 22:22:37.082] KSPSerialIO: Found 1 serial ports
[LOG 22:22:37.082] KSPSerialIO: trying default port /dev/cu.usbmodem14601
[LOG 22:22:37.085] KSPSerialIO: Serial Worker thread started
[LOG 22:22:37.086] KSPSerialIO: Trying to read port that isn't open. Sleeping
[LOG 22:22:39.603] KSPSerialIO: Handshake received - 314
[LOG 22:22:39.695] KSPSerialIO-hp: found KSP Display at /dev/cu.usbmodem14601
```

This means that the game is loading the plugin, and that it's talking with your Arduino board. Otherwise, you will see the error, and from there you will need to debug.



## What doesn't work (yet)

See the issues list on the github page (<https://github.com/hugopeeters/KSPSerialIO/issues>)
* Automatic port detection, you will need to specify this on the `config.xml` every time.

## License

Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<double name="refresh">0.2</double>
<string name="DefaultPort">/dev/cu.usbmodem30</string>
<string name="DefaultPort">/dev/cu.usbmodem14601</string>
<int name="BaudRate">38400</int>
<int name="HandshakeDelay">2500</int>
<int name="HandshakeDisable">0</int>
Expand Down