Skip to content

Commit

Permalink
chore: ⚡ updates indicators and state models
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Vieira <[email protected]>
  • Loading branch information
lucasvmx committed May 10, 2024
1 parent d4b1d25 commit bc13a67
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 55 deletions.
123 changes: 69 additions & 54 deletions model/indicators/indicators.go
Original file line number Diff line number Diff line change
@@ -1,54 +1,69 @@
package indicators

import (
"strings"

"github.com/lucasvmx/WarTelemetry/utils"
)

// Indicators struct contains data about aircraft indicators
type Indicators struct {
Valid bool `json:"valid"`
AircraftName string `json:"type"`
Speed float32 `json:"speed"`
Pedals float32 `json:"pedals"`
Pedals1 float32 `json:"pedals1"`
Pedals2 float32 `json:"pedals2"`
Pedals3 float32 `json:"pedals3"`
StickElevator float32 `json:"stick_elevator"`
StickElevator1 float32 `json:"stick_elevator1"`
StickAilerons float32 `json:"stick_ailerons"`
Vario float32 `json:"vario"`
AltitudeHour float32 `json:"altitude_hour"`
AltitudeMin float32 `json:"altitude_min"`
Altitude10k float32 `json:"altitude_10k"`
AviaHorizonRoll float32 `json:"aviahorizon_roll"`
AviaHorizonPitch float32 `json:"aviahorizon_pitch"`
Bank float32 `json:"bank"`
Turn float32 `json:"turn"`
Compass float32 `json:"compass"`
Compass1 float32 `json:"compass1"`
Compass2 float32 `json:"compass2"`
ClockHour float32 `json:"clock_hour"`
ClockMin float32 `json:"clock_min"`
ClockSec float32 `json:"clock_sec"`
RpmMin float32 `json:"rpm_min"`
RpmMin1 float32 `json:"rpm1_min"`
GAcceleration float32 `json:"g_meter"`
AngleOfAttack float32 `json:"aoa"`
SuperCharger float32 `json:"supercharger"`
PropellerPitch float32 `json:"prop_pitch"`
}

var path string = "indicators"
var url string = ""

func GetURL() string {
if len(url) == 0 {
url = utils.GetBaseURL()
url = strings.ReplaceAll(url, "$hostname$", utils.GetHostname())
url = strings.ReplaceAll(url, "$path$", path)
}

return url
}
package indicators

import (
"strings"

"github.com/lucasvmx/WarTelemetry/utils"
)

// Indicators struct contains data about aircraft indicators
type Indicators struct {
Valid bool `json:"valid"`
Army string `json:"army"`
AircraftName string `json:"type"`
Speed float32 `json:"speed"`
Pedals float32 `json:"pedals"`
Pedals1 float32 `json:"pedals1"`
Pedals2 float32 `json:"pedals2"`
Pedals3 float32 `json:"pedals3"`
Pedals4 float32 `json:"pedals4"`
StickElevator float32 `json:"stick_elevator"`
StickElevator1 float32 `json:"stick_elevator1"`
StickAilerons float32 `json:"stick_ailerons"`
Vario float32 `json:"vario"`
AltitudeHour float32 `json:"altitude_hour"`
AltitudeMin float32 `json:"altitude_min"`
Altitude10k float32 `json:"altitude_10k"`
AviaHorizonRoll float32 `json:"aviahorizon_roll"`
AviaHorizonPitch float32 `json:"aviahorizon_pitch"`
Bank float32 `json:"bank"`
Turn float32 `json:"turn"`
Compass float32 `json:"compass"`
Compass1 float32 `json:"compass1"`
Compass2 float32 `json:"compass2"`
ClockHour float32 `json:"clock_hour"`
ClockMin float32 `json:"clock_min"`
ClockSec float32 `json:"clock_sec"`
RpmMin float32 `json:"rpm_min"`
RpmMin1 float32 `json:"rpm1_min"`
GAcceleration float32 `json:"g_meter"`
AngleOfAttack float32 `json:"aoa"`
SuperCharger float32 `json:"supercharger"`
PropellerPitch float32 `json:"prop_pitch"`
Vne float32 `json:"vne"`
Weapon1 float32 `json:"weapon1"`
Weapon2 float32 `json:"weapon2"`
Weapon3 float32 `json:"weapon3"`
Weapon4 float32 `json:"weapon4"`
Gears float32 `json:"gears"`
GearLampDown float32 `json:"gear_lamp_down"`
GearLampUp float32 `json:"gear_lamp_up"`
GearLampOff float32 `json:"gear_lamp_off"`
CarbTemperature float32 `json:"carb_temperature"`
AirbrakeLever float64 `json:"airbrake_lever"`
AirbrakeIndicator float64 `json:"airbrake_indicator"`
Trimmer float64 `json:"trimmer"`
}

var path string = "indicators"
var url string = ""

func GetURL() string {
if len(url) == 0 {
url = utils.GetBaseURL()
url = strings.ReplaceAll(url, "$hostname$", utils.GetHostname())
url = strings.ReplaceAll(url, "$path$", path)
}

return url
}
2 changes: 1 addition & 1 deletion model/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type AircraftState struct {
Fuel uint32 `json:"Mfuel"`
Fuel0 float32 `json:"Mfuel0"`
Gear int `json:"gear"`
Airbrake int `json:"airbrake"`
AirbrakePercent int `json:"airbrake"`

// Engine 1
ThrottleEngine1 float32 `json:"throttle1"`
Expand Down

0 comments on commit bc13a67

Please sign in to comment.