Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5da82a6ec3 |
@@ -8,47 +8,54 @@ available peripheral: [CDashDisplay](https://github.com/ESilva15/CDashDisplay).
|
|||||||
If anyone finds this project useful for anything at all it would be pretty cool.
|
If anyone finds this project useful for anything at all it would be pretty cool.
|
||||||
My main goal is to learn and have some fun.
|
My main goal is to learn and have some fun.
|
||||||
|
|
||||||
Currently it can read from a `.ibt` file or live telemetry from iRacing.
|
|
||||||
It can only be ran from the terminal:
|
## Usage
|
||||||
`go run . offline -p <port> -i <ibt-file>`
|
To launch the software, compile (TBD) or just run it with: `go run . tui`
|
||||||
|
|
||||||
|
You should see something like this:
|
||||||

|

|
||||||
|
|
||||||
|
The current behaviour is very opaque.
|
||||||
|
|
||||||
or to view the live data:
|
What is happening in the background is the software looks up for the configured
|
||||||
`go run . live -p <port>`
|
devices and for available telemetry providers.
|
||||||
|
|
||||||
|
Once it finds a device, in this case the CDashDisplay, it will try to configure
|
||||||
|
it against the available telemetry provider.
|
||||||
|
|
||||||
|
After configuring it it will automatically start streaming data from the
|
||||||
|
telemetry provider into the CDashDisplay.
|
||||||
|
|
||||||
|
Using the `arrows` you can navigate to the `stream` item on the list and then
|
||||||
|
go to the update button and press `s` to see the output on the terminal.
|
||||||
|
|
||||||
|
I upgraded the backend significantly and there's plenty of work to be done on
|
||||||
|
the frontend. I know its quite bad right now.
|
||||||
|
|
||||||
|
|
||||||
|
## Compatibility:
|
||||||
Games implemented so far:
|
Games implemented so far:
|
||||||
- [iRacing](https://www.iracing.com/) using the [goirsdk](https://github.com/ESilva15/goirsdk)
|
- [iRacing](https://www.iracing.com/) using the [goirsdk](https://github.com/ESilva15/goirsdk)
|
||||||
|
- [BeamNG.drive](https://www.beamng.com/game/) using the [gobngsdk](https://github.com/ESilva15/gobngsdk)
|
||||||
|
|
||||||
|
Peripherals:
|
||||||
|
- [CDashDisplay](https://github.com/ESilva15/CDashDisplay)
|
||||||
|
|
||||||
<!-- Games being implemented: -->
|
<!-- Games being implemented: -->
|
||||||
<!-- - [BeamNG.drive](https://www.beamng.com/game/) using the [gobngsdk](https://github.com/ESilva15/gobngsdk) -->
|
|
||||||
<!---->
|
<!---->
|
||||||
<!-- Games to be implemented: -->
|
<!-- Games to be implemented: -->
|
||||||
<!-- - [Assetto Corsa](https://assettocorsa.gg/) -->
|
<!-- - [Assetto Corsa](https://assettocorsa.gg/) -->
|
||||||
|
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
- [X] Implement the interface for a data source
|
|
||||||
- [ ] Configuration of the peripherals via ESDI
|
|
||||||
- [ ] Detection of the display
|
|
||||||
- [ ] LapTime Calculator
|
|
||||||
- [ ] A very long list useful stuff like flags, position, more info about
|
|
||||||
other drivers, track conditions and so on so forth
|
|
||||||
- [ ] Telemetry analysis tool
|
|
||||||
- [ ] Better user interface
|
|
||||||
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
### Mockservers
|
### Mockservers
|
||||||
To mock [BeamNG.drive](https://www.beamng.com/game/), I built
|
I'm using a mockserver developed by myself that pretty much mimicks the telemetry
|
||||||
[BeaMNGMockOg](https://github.com/ESilva15/BeamNGMockOg) (should have though longer
|
output from the actual simulators. It uses the SDKs I developed to do so with the
|
||||||
about the name).
|
added bonus of being able to run the project on Linux and mainly develop it.
|
||||||
You create a recording by launching the BeamNG and then launching the mockserver with:
|
|
||||||
`BeamNGMockOg record -a 127.0.0.1 -p 4443 -o output.bin`.
|
Just go to [TelemetryMockserver on GitHub](https://github.com/ESilva15/TelemetryMockserver) and follow
|
||||||
|
the instructions there.
|
||||||
|
|
||||||
To replay the recording:
|
|
||||||
`BeamNGMockOg replay [--loop] -a 127.0.0.1 -p 4443 -i input.bin`
|
|
||||||
|
|
||||||
### Troubleshooting
|
### Troubleshooting
|
||||||
#### Can't see BeamNG data coming through
|
#### Can't see BeamNG data coming through
|
||||||
@@ -74,4 +81,3 @@ pprof:
|
|||||||
## Shameless begging
|
## Shameless begging
|
||||||
Hey, doesn't hurt to try, its free either way:
|
Hey, doesn't hurt to try, its free either way:
|
||||||
[Buy me a coffee!](buymeacoffee.com/ESilva_15)
|
[Buy me a coffee!](buymeacoffee.com/ESilva_15)
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
package constants
|
package constants
|
||||||
|
|
||||||
// Peripheral Names
|
|
||||||
const (
|
|
||||||
CDashDisplay = "CDashDisplay"
|
|
||||||
UIView = "UIView"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Provider Names
|
// Provider Names
|
||||||
const (
|
const (
|
||||||
IRacingProviderName = "iRacing"
|
IRacingProviderName = "iRacing"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package uidevice
|
package uidevice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"esdi/constants"
|
|
||||||
"esdi/peripheral"
|
"esdi/peripheral"
|
||||||
"esdi/telemetry"
|
"esdi/telemetry"
|
||||||
)
|
)
|
||||||
@@ -10,7 +9,7 @@ type UIDevice struct {
|
|||||||
dataChan chan telemetry.TelemetryData
|
dataChan chan telemetry.TelemetryData
|
||||||
}
|
}
|
||||||
|
|
||||||
const NAME = constants.UIView
|
const NAME = "UIView"
|
||||||
|
|
||||||
func NewUIDevice() (peripheral.Peripheral, error) {
|
func NewUIDevice() (peripheral.Peripheral, error) {
|
||||||
return &UIDevice{
|
return &UIDevice{
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 113 KiB |
@@ -1,16 +1,13 @@
|
|||||||
// Package devices will define the available devices we can communicate with
|
// Package devices will define the available devices we can communicate with
|
||||||
package devices
|
package devices
|
||||||
|
|
||||||
import (
|
import "esdi/peripheral/types"
|
||||||
"esdi/constants"
|
|
||||||
"esdi/peripheral/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IDs for our devices. They need to be correctly mapped on the devices
|
// IDs for our devices. They need to be correctly mapped on the devices
|
||||||
// themselves so we can discover them
|
// themselves so we can discover them
|
||||||
const (
|
const (
|
||||||
CDashDisplayDevID = 0x01
|
CDashDisplayDevID = 0x01
|
||||||
CDashDisplayDevName = constants.CDashDisplay
|
CDashDisplayDevName = "CDashDisplay"
|
||||||
ESBtnBoxDevID = 0x02
|
ESBtnBoxDevID = 0x02
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -107,11 +107,6 @@ func (ds *DeviceService) StopStream() {
|
|||||||
ds.streamCancel = nil
|
ds.streamCancel = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *DeviceService) SetPeripheralUserConfigMode(pname string) error {
|
|
||||||
ds.PSS.setDeviceBeingConfiguredByUser(pname)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTelemetryChannel sets the TelemCh to the passed channel
|
// SetTelemetryChannel sets the TelemCh to the passed channel
|
||||||
func (ds *DeviceService) SetTelemetryChannel(ch <-chan telemetry.TelemetryData) {
|
func (ds *DeviceService) SetTelemetryChannel(ch <-chan telemetry.TelemetryData) {
|
||||||
ds.TelemCh = ch
|
ds.TelemCh = ch
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ const (
|
|||||||
DeviceIsConnected
|
DeviceIsConnected
|
||||||
DeviceIsUnconfigured
|
DeviceIsUnconfigured
|
||||||
DeviceIsConfiguring
|
DeviceIsConfiguring
|
||||||
DeviceBeingConfiguredByUser
|
|
||||||
DeviceIsConfigured
|
DeviceIsConfigured
|
||||||
DeviceIsStreaming
|
DeviceIsStreaming
|
||||||
)
|
)
|
||||||
@@ -51,8 +50,6 @@ func DeviceStateToStr(state DeviceState) string {
|
|||||||
return "DeviceIsUnconfigured"
|
return "DeviceIsUnconfigured"
|
||||||
case DeviceIsConfiguring:
|
case DeviceIsConfiguring:
|
||||||
return "DeviceIsConfiguring"
|
return "DeviceIsConfiguring"
|
||||||
case DeviceBeingConfiguredByUser:
|
|
||||||
return "DeviceBeingConfiguredByUser"
|
|
||||||
case DeviceIsConfigured:
|
case DeviceIsConfigured:
|
||||||
return "DeviceIsConfigured"
|
return "DeviceIsConfigured"
|
||||||
case DeviceIsStreaming:
|
case DeviceIsStreaming:
|
||||||
@@ -297,14 +294,6 @@ func (pss *PeripheralStateStore) setDeviceIsConfiguring(pname string) {
|
|||||||
pss.store[pname].State = DeviceIsConfiguring
|
pss.store[pname].State = DeviceIsConfiguring
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pss *PeripheralStateStore) setDeviceBeingConfiguredByUser(pname string) {
|
|
||||||
pss.Logger.Info("device is being configured by the user", "device", pname)
|
|
||||||
pss.mu.Lock()
|
|
||||||
defer pss.mu.Unlock()
|
|
||||||
|
|
||||||
pss.store[pname].State = DeviceBeingConfiguredByUser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pss *PeripheralStateStore) setDeviceConfigured(pname string) {
|
func (pss *PeripheralStateStore) setDeviceConfigured(pname string) {
|
||||||
pss.Logger.Info("device is configured and ready for data", "device", pname)
|
pss.Logger.Info("device is configured and ready for data", "device", pname)
|
||||||
|
|
||||||
@@ -468,8 +457,6 @@ func (pss *PeripheralStateStore) HandleDeviceState() {
|
|||||||
case DeviceIsConfigured:
|
case DeviceIsConfigured:
|
||||||
// Nothing to do here
|
// Nothing to do here
|
||||||
pss.handleDeviceIsConfigured(pName)
|
pss.handleDeviceIsConfigured(pName)
|
||||||
case DeviceBeingConfiguredByUser:
|
|
||||||
// Nothing to do here, need to wait for the user to finish
|
|
||||||
case DeviceIsStreaming:
|
case DeviceIsStreaming:
|
||||||
//
|
//
|
||||||
case DeviceReconnected:
|
case DeviceReconnected:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func (t *TelemetryService) onFindProvider(prov telem.TelemetryProvider) {
|
|||||||
ch := t.StartStream()
|
ch := t.StartStream()
|
||||||
t.startedStreaming(ch)
|
t.startedStreaming(ch)
|
||||||
|
|
||||||
t.Messages <- "provider switch completed\n"
|
t.Messages <- "provider switch completed"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *TelemetryService) onProviderStopsMidStream() {
|
func (t *TelemetryService) onProviderStopsMidStream() {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"esdi/constants"
|
|
||||||
"esdi/devices/cdashdisplay"
|
"esdi/devices/cdashdisplay"
|
||||||
"esdi/services"
|
"esdi/services"
|
||||||
"esdi/tui/internal/views"
|
"esdi/tui/internal/views"
|
||||||
@@ -586,21 +585,3 @@ func (lc *LayoutController) changeSelectedLoadout() {
|
|||||||
lc.LayoutToolView.ShowLayoutList()
|
lc.LayoutToolView.ShowLayoutList()
|
||||||
lc.App.SetFocus(lc.LayoutToolView.LayoutActions.LayoutSelection.Tree)
|
lc.App.SetFocus(lc.LayoutToolView.LayoutActions.LayoutSelection.Tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ##### Event Listener
|
|
||||||
// OnLayoutToolOpen we need to change focus to the layout tool and move the
|
|
||||||
// device out of streaming mode or whatever.
|
|
||||||
// - start by making sure that device is able to be configured
|
|
||||||
func (lc *LayoutController) OnLayoutToolOpen() {
|
|
||||||
// Get the device from somewhere
|
|
||||||
cdash, err := lc.DevService.GetPeripheral(constants.CDashDisplay)
|
|
||||||
if err != nil {
|
|
||||||
lc.Messages <- "failed to acquire CDashDisplay " + err.Error() + "\n"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
lc.DevService.SetPeripheralUserConfigMode(cdash.Name())
|
|
||||||
|
|
||||||
// Change focus to the layout tree
|
|
||||||
lc.App.SetFocus(lc.LayoutToolView.LayoutTree.Tree)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -77,8 +77,7 @@ func (mc *DeviceController) AddDeviceAPIListItems() {
|
|||||||
"layout-tool",
|
"layout-tool",
|
||||||
mc.LayoutCtrl.LayoutToolView.Flex,
|
mc.LayoutCtrl.LayoutToolView.Flex,
|
||||||
)
|
)
|
||||||
|
mc.App.SetFocus(mc.LayoutCtrl.LayoutToolView.LayoutTree.Tree)
|
||||||
mc.LayoutCtrl.OnLayoutToolOpen()
|
|
||||||
})
|
})
|
||||||
mc.DeviceAPIView.DevAPIList.
|
mc.DeviceAPIView.DevAPIList.
|
||||||
AddItem("stream", "stream data to the display", func() {
|
AddItem("stream", "stream data to the display", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user