From 0cd3f09ec71d6a83aeb4333b201baa46a03dc661 Mon Sep 17 00:00:00 2001 From: Sascha Stojanov Date: Tue, 2 Feb 2021 21:10:53 +0100 Subject: [PATCH] Update readme, clean up output --- README.md | 22 +++++++++++++--------- gopilot/main.go | 10 ++++++---- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8cdf5b9..1e82e97 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,13 @@ The GoPilot is just another browser-based VFR map for Microsoft's Flight Simulat * Teleport Service * Pick a point on the map, select the desired altitude, heading and airspeed and off you go -## How do I run the GoPilot? +## Releases -There are no releases yet. At the moment you can only run the program from the command line. +Download the latest version [here](https://github.com/grumpypixel/msfs2020-gopilot/releases) -Windows Command Prompt: -```console -$ build.bat -$ gopilot.exe -``` +## How do I build GoPilot myself? + +Assuming you have installed Go on your machine and cloned/downloaded the repo, you can build & run GoPilot as follows: Bash: ```console @@ -34,7 +32,11 @@ $ CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o gopilot.exe gopilot/main.g $ ./gopilot.exe ``` -Note: You should start GoPilot on the same Windows machine your Simulator is running. +Windows Command Prompt: +```console +$ build.bat +$ gopilot.exe +``` ## GoPilot command-line options @@ -54,7 +56,7 @@ $ gopilot.exe --name POTATOSQUAD --searchpath ../.. --address 0.0.0.13370 --time The gopilot.exe starts a local web server which you can connect to with a browser. -So open the browser of your choice and type the following into the address bar: +Now open the browser of your choice and type the following into the address bar: ```console http://localhost:8888/ @@ -73,6 +75,8 @@ The following web server routes are available: * `/teleport` opens the Teleport Service. Be advised not to teleport yourself into the ground mistakenly. * `/mehmap` opens a plain & simple map without distractions. (So no HUD. No nothing. Meh.) * `/setdata` opens an *experimental* page where you can manually set data on the *sim object*. DO NOT USE THIS if you don't know what you're doing. This might (and probably will) CRASH your simulator. Seriously. +* `/simvars` display all registered simulation variables (no auto-update) +* `/debug` display debug information (also no auto-update) Examples: * `http://localhost:8888/vfrmap` or simply: `http://localhost:8888` diff --git a/gopilot/main.go b/gopilot/main.go index 4bbcf93..c59f693 100644 --- a/gopilot/main.go +++ b/gopilot/main.go @@ -41,6 +41,8 @@ const ( defaultConnectionName = "GoPilot" defaultServerAddress = "0.0.0.0:8888" defaultSearchPath = "." + githubRoot = "http://github.com/grumpypixel/msfs2020-gopilot/" + githubReleases = "http://github.com/grumpypixel/msfs2020-gopilot/releases" defaultConnectionTimeout = 600 connectRetrySeconds = 1 requestDataInterval = time.Millisecond * 250 @@ -67,6 +69,7 @@ func init() { } func main() { + fmt.Printf("\nWelcome to %s\nProject page: %s\nReleases: %s\n\n", appTitle, githubRoot, githubReleases) parseParameters() locateLibrary(params.searchPath) @@ -88,7 +91,7 @@ func parseParameters() { func locateLibrary(additionalSearchPath string) { if simconnect.LocateLibrary(additionalSearchPath) == false { fullpath := path.Join(additionalSearchPath, simconnect.SimConnectDLL) - fmt.Printf("DLL not found in given search paths.\nUnpacking library to: %s\n", fullpath) + fmt.Printf("DLL not found in given search paths\nUnpacking library to: %s\n", fullpath) if err := simconnect.UnpackDLL(fullpath); err != nil { fmt.Println("Unable to unpack DLL error:", err) return @@ -150,7 +153,7 @@ func (app *App) initWebServer(address string, shutdown chan bool) { assetsDir := "/assets/" webServer.Run(routes, assetsDir) - fmt.Println("Web Server listening on address", address) + fmt.Println("Web Server listening on", address) fmt.Println("Your network interfaces:") webServer.ListNetworkInterfaces() } @@ -170,7 +173,7 @@ func (app *App) connect(name string, timeoutSeconds int64) error { count++ if err := app.mate.Open(name); err != nil { if count%10 == 0 { - fmt.Printf("...attempts: %d\n", count) + fmt.Printf("Connection attempts... %d\n", count) } } else { return nil @@ -210,7 +213,6 @@ func (app *App) handleSocketMessages() { for { select { case event := <-app.socket.EventReceiver: - fmt.Println("main eventreceiver") eventType := event.Type switch eventType { case websockets.SocketEventConnected: