From bc13a673f850d9169cb14d9cae83354c1b6ab74d Mon Sep 17 00:00:00 2001 From: Lucas Vieira Date: Fri, 10 May 2024 11:59:09 -0300 Subject: [PATCH] chore: :zap: updates indicators and state models Signed-off-by: Lucas Vieira --- model/indicators/indicators.go | 123 ++++++++++++++++++--------------- model/state/state.go | 2 +- 2 files changed, 70 insertions(+), 55 deletions(-) diff --git a/model/indicators/indicators.go b/model/indicators/indicators.go index 9133a26..67917f8 100644 --- a/model/indicators/indicators.go +++ b/model/indicators/indicators.go @@ -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 +} diff --git a/model/state/state.go b/model/state/state.go index 9e92dd4..505e97a 100644 --- a/model/state/state.go +++ b/model/state/state.go @@ -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"`