diff --git a/Assets/.DS_Store b/Assets/.DS_Store index f1c944e..a089053 100644 Binary files a/Assets/.DS_Store and b/Assets/.DS_Store differ diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 076ee57..824c172 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -46,7 +46,8 @@ public class API : MonoBehaviour private string unit; private GameObject webSocketController; private WebSocketController webSocketControllerScript; - + private bool isButtonPressed = false; // Boolean to keep voltage updated as long as the turbine is rotating + void Start() { @@ -54,6 +55,14 @@ public class API : MonoBehaviour EmergencyButtonClick(); } + private void Update() + { + if (isButtonPressed) + { + voltageValue.text = webSocketControllerScript.voltageValue.ToString(); + } + } + public void OnButtonClick() { webSocketController = GameObject.FindGameObjectWithTag("WebController"); @@ -62,6 +71,7 @@ public class API : MonoBehaviour } public void EmergencyButtonClick() { + isButtonPressed = false; loc.SetText("----"); windDirValue.SetText("----"); temperatureValue.SetText("----"); @@ -96,6 +106,8 @@ public class API : MonoBehaviour public void ExtractDataFromJson(string json) { + isButtonPressed = true; // Boolean to keep voltage updated as long as the turbine is rotating + ApiResponse response = JsonUtility.FromJson<ApiResponse>(json); //Debug.Log("Api response worked!!!!"); @@ -109,7 +121,7 @@ public void ExtractDataFromJson(string json) for (int i = 0; i < dataPoints.Count; i++) { DataPoint point = dataPoints[i]; - voltageValue.text = webSocketControllerScript.voltageValue.ToString(); + loc.SetText("Kista"); if (point.name == "wd") {