From 2c09ce9bb797d158c9f66efb1bde05d8cd0701aa Mon Sep 17 00:00:00 2001
From: Jonah Aden <151240959+adenjonah@users.noreply.github.com>
Date: Tue, 14 May 2024 01:57:13 -0700
Subject: [PATCH] added windows powershell script

---
 run_lmcc_windows.ps1 | 50 ++++++++++++++++++++++++++++++++++++++------
 tss_data.json        |  2 +-
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/run_lmcc_windows.ps1 b/run_lmcc_windows.ps1
index d3cca48..02e6c5d 100644
--- a/run_lmcc_windows.ps1
+++ b/run_lmcc_windows.ps1
@@ -1,7 +1,45 @@
-# Install dependencies
-Write-Output "Installing Dependencies..."
-npm install
+# Check and install Python if not installed
+function Install-Python {
+    if (-not (Get-Command python3 -ErrorAction SilentlyContinue)) {
+        Write-Output "Python3 could not be found. Installing Python3..."
+        Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.9.5/python-3.9.5-amd64.exe" -OutFile "python-installer.exe"
+        Start-Process -FilePath "python-installer.exe" -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
+        Remove-Item -Path "python-installer.exe" -Force
 
-# Start the app using npm start
-Write-Output "Starting the app..."
-npm start
+        # Verify installation
+        if (-not (Get-Command python3 -ErrorAction SilentlyContinue)) {
+            Write-Output "Python3 installation failed. Please install Python3 manually."
+            exit 1
+        }
+    } else {
+        Write-Output "Python3 is already installed."
+    }
+}
+
+# Install Python dependencies
+function Install-PythonDependencies {
+    Write-Output "Installing Python dependencies..."
+    python3 -m pip install --upgrade pip
+    python3 -m pip install -r requirements.txt
+}
+
+# Install npm dependencies
+function Install-NpmDependencies {
+    Write-Output "Installing npm dependencies..."
+    npm install
+}
+
+# Start the servers
+function Start-Servers {
+    Write-Output "Starting the server with npm start..."
+    Start-Process -NoNewWindow -FilePath "npm" -ArgumentList "start"
+
+    Write-Output "Starting the FastAPI server with uvicorn..."
+    Start-Process -NoNewWindow -FilePath "python" -ArgumentList "-m uvicorn server:app --host 0.0.0.0 --port 8000 --reload"
+}
+
+# Execute functions
+Install-Python
+Install-PythonDependencies
+Install-NpmDependencies
+Start-Servers
diff --git a/tss_data.json b/tss_data.json
index dbd1307..88b7958 100644
--- a/tss_data.json
+++ b/tss_data.json
@@ -1 +1 @@
-{"timestamp": "2024-05-14T01:54:59.389964", "eva": {"eva": {"started": true, "paused": false, "completed": false, "total_time": 769, "uia": {"started": false, "completed": false, "time": 0}, "dcu": {"started": false, "completed": false, "time": 0}, "rover": {"started": false, "completed": false, "time": 0}, "spec": {"started": false, "completed": false, "time": 0}}}, "telemetry": {"telemetry": {"eva_time": 769, "eva1": {"batt_time_left": 5077.148926, "oxy_pri_storage": 23.755802, "oxy_sec_storage": 8.369159, "oxy_pri_pressure": 0.0, "oxy_sec_pressure": 251.074402, "oxy_time_left": 3469, "heart_rate": 90.0, "oxy_consumption": 0.103292, "co2_production": 0.097232, "suit_pressure_oxy": 3.072312, "suit_pressure_co2": 0.056858, "suit_pressure_other": 11.5542, "suit_pressure_total": 14.683371, "fan_pri_rpm": 0.0, "fan_sec_rpm": 30001.0, "helmet_pressure_co2": 0.101604, "scrubber_a_co2_storage": 0.0, "scrubber_b_co2_storage": 100.095428, "temperature": 72.118309, "coolant_ml": 20.508068, "coolant_gas_pressure": 0.0, "coolant_liquid_pressure": 113.769783}, "eva2": {"batt_time_left": 3384.893799, "oxy_pri_storage": 24.231962, "oxy_sec_storage": 12.298765, "oxy_pri_pressure": 0.002643, "oxy_sec_pressure": 368.961212, "oxy_time_left": 3945, "heart_rate": 90.0, "oxy_consumption": 0.0974, "co2_production": 0.091963, "suit_pressure_oxy": 3.072322, "suit_pressure_cO2": 0.056769, "suit_pressure_other": 11.5542, "suit_pressure_total": 14.68329, "fan_pri_rpm": 0.0, "fan_sec_rpm": 30001.0, "helmet_pressure_co2": 0.10206, "scrubber_a_co2_storage": 0.0, "scrubber_b_co2_storage": 100.08062, "temperature": 80.719376, "coolant_ml": 22.034748, "coolant_gas_pressure": 9.842337, "coolant_liquid_pressure": 126.975426}}}}
\ No newline at end of file
+{"timestamp": "2024-05-14T01:57:13.301608", "eva": {"eva": {"started": true, "paused": false, "completed": false, "total_time": 903, "uia": {"started": false, "completed": false, "time": 0}, "dcu": {"started": false, "completed": false, "time": 0}, "rover": {"started": false, "completed": false, "time": 0}, "spec": {"started": false, "completed": false, "time": 0}}}, "telemetry": {"telemetry": {"eva_time": 903, "eva1": {"batt_time_left": 5077.148926, "oxy_pri_storage": 23.755802, "oxy_sec_storage": 7.128418, "oxy_pri_pressure": 0.0, "oxy_sec_pressure": 213.852325, "oxy_time_left": 3335, "heart_rate": 90.0, "oxy_consumption": 0.095405, "co2_production": 0.099593, "suit_pressure_oxy": 3.072351, "suit_pressure_co2": 0.165967, "suit_pressure_other": 11.5542, "suit_pressure_total": 14.792519, "fan_pri_rpm": 0.0, "fan_sec_rpm": 30001.0, "helmet_pressure_co2": 0.194281, "scrubber_a_co2_storage": 0.0, "scrubber_b_co2_storage": 100.095428, "temperature": 73.808022, "coolant_ml": 20.508068, "coolant_gas_pressure": 0.0, "coolant_liquid_pressure": 116.435379}, "eva2": {"batt_time_left": 3384.893799, "oxy_pri_storage": 24.231962, "oxy_sec_storage": 11.058024, "oxy_pri_pressure": 0.001433, "oxy_sec_pressure": 331.740204, "oxy_time_left": 3811, "heart_rate": 90.0, "oxy_consumption": 0.100635, "co2_production": 0.101986, "suit_pressure_oxy": 3.072343, "suit_pressure_cO2": 0.165773, "suit_pressure_other": 11.5542, "suit_pressure_total": 14.792315, "fan_pri_rpm": 0.0, "fan_sec_rpm": 30001.0, "helmet_pressure_co2": 0.194499, "scrubber_a_co2_storage": 0.0, "scrubber_b_co2_storage": 100.08062, "temperature": 74.974472, "coolant_ml": 22.034748, "coolant_gas_pressure": 0.0, "coolant_liquid_pressure": 127.080276}}}}
\ No newline at end of file