From 55f1960faa7c166fbaed16e239378be48ebd7606 Mon Sep 17 00:00:00 2001 From: Alex Savin Date: Thu, 29 May 2025 00:28:27 -0400 Subject: [PATCH] Fixed an issues with the windows and tires --- vehicle.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vehicle.go b/vehicle.go index 2219de4..f3e7a97 100644 --- a/vehicle.go +++ b/vehicle.go @@ -634,13 +634,13 @@ func (v *Vehicle) GetVehicleStatus() { submatchall := re.FindAllString(pos, -1) v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall)) - if window, ok := v.Windows[submatchall[0]+submatchall[1]]; ok { + if window, ok := v.Windows[pos]; ok { window.Status = child.Data().(string) window.Updated = time.Now() } else { window.Status = child.Data().(string) window.Updated = time.Now() - v.Windows[submatchall[0]+submatchall[1]] = Window{ + v.Windows[pos] = Window{ Position: submatchall[0], Status: child.Data().(string), Updated: time.Now(), @@ -659,13 +659,13 @@ func (v *Vehicle) GetVehicleStatus() { submatchall := re.FindAllString(pos, -1) v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall)) - if tire, ok := v.Tires[submatchall[0]+submatchall[1]]; ok { + if tire, ok := v.Tires[pos]; ok { tire.PressurePsi = child.Data().(int) tire.Updated = time.Now() } else { tire.PressurePsi = child.Data().(int) tire.Updated = time.Now() - v.Tires[submatchall[0]+submatchall[1]] = Tire{ + v.Tires[pos] = Tire{ Position: submatchall[0], PressurePsi: child.Data().(int), Updated: time.Now(), @@ -806,13 +806,13 @@ func (v *Vehicle) GetVehicleCondition() { submatchall := re.FindAllString(pos, -1) v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall)) - if window, ok := v.Windows[submatchall[0]+submatchall[1]]; ok { + if window, ok := v.Windows[pos]; ok { window.Status = child.Data().(string) window.Updated = time.Now() } else { window.Status = child.Data().(string) window.Updated = time.Now() - v.Windows[submatchall[0]+submatchall[1]] = Window{ + v.Windows[pos] = Window{ Position: submatchall[0], Status: child.Data().(string), Updated: time.Now(), @@ -831,13 +831,13 @@ func (v *Vehicle) GetVehicleCondition() { submatchall := re.FindAllString(pos, -1) v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall)) - if tire, ok := v.Tires[submatchall[0]+submatchall[1]]; ok { + if tire, ok := v.Tires[pos]; ok { tire.PressurePsi = child.Data().(int) tire.Updated = time.Now() } else { tire.PressurePsi = child.Data().(int) tire.Updated = time.Now() - v.Tires[submatchall[0]+submatchall[1]] = Tire{ + v.Tires[pos] = Tire{ Position: submatchall[0], PressurePsi: child.Data().(int), Updated: time.Now(),