Skip to content

Commit b29155a

Browse files
Copilotsbasu107
andauthored
Rollback to Frontend adjustment commit (ad20d54) and rename sc1-data-format submodule to sc-data-format (#118)
* Initial plan * Rollback to Frontend adjustment PR (ad20d54) and update sc1-data-format to sc-data-format submodule Co-authored-by: sbasu107 <40325803+sbasu107@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sbasu107 <40325803+sbasu107@users.noreply.github.com>
1 parent 32067de commit b29155a

34 files changed

Lines changed: 116 additions & 1552 deletions

.github/workflows/deploy-frontend.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ jobs:
3939
working-directory: Frontend
4040
run: npm run build
4141
env:
42-
REACT_APP_API_URL: ${{ vars.REACT_APP_API_URL }}
43-
REACT_APP_WS_URL: ${{ vars.REACT_APP_WS_URL }}
4442
NODE_OPTIONS: --openssl-legacy-provider
4543
CI: false
4644

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[submodule "Backend/Data/sc1-data-format"]
2-
path = Backend/Data/sc1-data-format
3-
url = git@github.com:badgerloop-software/sc1-data-format.git
1+
[submodule "Backend/Data/sc-data-format"]
2+
path = Backend/Data/sc-data-format
3+
url = git@github.com:badgerloop-software/sc-data-format.git
44
branch = main
55
[submodule "Backend/file_sync"]
66
path = Backend/file_sync

Backend/config.py

Lines changed: 13 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,21 @@
11
import os
22

3-
# ==================== DEPLOYMENT MODE ====================
4-
# Determines how the application runs:
5-
# - "local": Full features (Redis Stack, Serial, DataGenerator/Replayer)
6-
# - "cloud": Cloud-compatible mode (Convex, Upstash Redis, no serial)
7-
DEPLOYMENT_MODE = os.getenv("DEPLOYMENT_MODE", "local")
3+
DATAFORMAT_PATH = f'{os.getcwd()}/Data/sc-data-format/format.json'
4+
HOST_PORT = 4001
85

9-
# ==================== PATHS ====================
10-
DATAFORMAT_PATH = os.getenv(
11-
"DATAFORMAT_PATH",
12-
f'{os.getcwd()}/Data/sc1-data-format/format.json'
13-
)
6+
REDIS_URL = '127.0.0.1'
7+
REDIS_PORT = 6379
8+
REDIS_DB = 0
149

15-
# ==================== SERVER SETTINGS ====================
16-
HOST_PORT = int(os.getenv("PORT", 4001)) # Render uses PORT env var
17-
HOST = os.getenv("HOST", "0.0.0.0")
10+
# TCP SETTINGS
11+
CAR_IP = '192.168.1.15'
12+
LOCAL_IP = '127.0.0.1'
13+
DATA_PORT = 4003
1814

19-
# ==================== REDIS SETTINGS ====================
20-
# Local mode: Redis Stack with TimeSeries module
21-
# Cloud mode: Upstash Redis (standard Redis, no TimeSeries)
22-
if DEPLOYMENT_MODE == "cloud":
23-
# Upstash Redis URL format: redis://default:password@host:port
24-
REDIS_URL = os.getenv("UPSTASH_REDIS_URL", "")
25-
REDIS_PORT = None # URL contains port
26-
REDIS_DB = 0
27-
USE_TIMESERIES = False
28-
else:
29-
REDIS_URL = os.getenv("REDIS_URL", "127.0.0.1")
30-
REDIS_PORT = int(os.getenv("REDIS_PORT", 6379))
31-
REDIS_DB = int(os.getenv("REDIS_DB", 0))
32-
USE_TIMESERIES = True
15+
#UDP SETTINGS
16+
UDP_PORT = 4003
3317

34-
# ==================== CONVEX SETTINGS ====================
35-
# Convex is used as the primary cloud database for real-time data
36-
CONVEX_URL = os.getenv("CONVEX_URL", "")
37-
CONVEX_DEPLOY_KEY = os.getenv("CONVEX_DEPLOY_KEY", "")
18+
VPS_URL = 'http://live.bsr-dev.org'
3819

39-
# ==================== DATA SOURCE SETTINGS ====================
40-
# Which data sources are enabled
41-
ENABLE_SERIAL = DEPLOYMENT_MODE == "local" # Serial only works locally
42-
ENABLE_UDP = DEPLOYMENT_MODE == "local" # UDP only works locally
43-
ENABLE_CONVEX = bool(CONVEX_URL) # Convex works in both modes
44-
45-
# ==================== NETWORK SETTINGS (Local Mode) ====================
46-
CAR_IP = os.getenv("CAR_IP", "192.168.1.15")
47-
LOCAL_IP = os.getenv("LOCAL_IP", "127.0.0.1")
48-
DATA_PORT = int(os.getenv("DATA_PORT", 4003))
49-
UDP_PORT = int(os.getenv("UDP_PORT", 4003))
50-
51-
# ==================== LEGACY VPS SETTINGS ====================
52-
VPS_URL = os.getenv("VPS_URL", "http://live.bsr-dev.org")
53-
54-
# ==================== RUNTIME DATA ====================
55-
# Filled by the program at startup
20+
#Filled by the program
5621
FORMAT = dict()
57-
58-
# ==================== HELPER FUNCTIONS ====================
59-
def is_cloud_mode():
60-
return DEPLOYMENT_MODE == "cloud"
61-
62-
def is_local_mode():
63-
return DEPLOYMENT_MODE == "local"
64-
65-
def print_config():
66-
"""Print current configuration for debugging"""
67-
print(f"=== Chase Car Dashboard Configuration ===")
68-
print(f"Deployment Mode: {DEPLOYMENT_MODE}")
69-
print(f"Host: {HOST}:{HOST_PORT}")
70-
print(f"Redis TimeSeries: {'Enabled' if USE_TIMESERIES else 'Disabled'}")
71-
print(f"Serial Enabled: {ENABLE_SERIAL}")
72-
print(f"UDP Enabled: {ENABLE_UDP}")
73-
print(f"Convex Enabled: {ENABLE_CONVEX}")
74-
print(f"=========================================")

Backend/core/comms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def start_comms():
313313
# Start two live comm channels
314314
#vps_thread = threading.Thread(target=lambda : asyncio.run(telemetry.remote_db_fetch(config.VPS_URL)))
315315
#vps_thread.start()
316-
socket_thread = threading.Thread(target=lambda: telemetry.listen_udp(config.UDP_PORT))
317-
socket_thread.start()
318-
#socket_thread = threading.Thread(target=lambda: telemetry.serial_read())
316+
#socket_thread = threading.Thread(target=lambda: telemetry.listen_udp(config.UDP_PORT))
319317
#socket_thread.start()
318+
socket_thread = threading.Thread(target=lambda: telemetry.serial_read())
319+
socket_thread.start()

Backend/core/core_api.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,9 @@
22
import serial.tools.list_ports
33
from . import comms
44
from pydantic import BaseModel
5-
import asyncio
65

76
router = APIRouter()
87

9-
@router.websocket("/single-values")
10-
async def single_values_websocket(websocket: WebSocket):
11-
await websocket.accept()
12-
13-
while True:
14-
try:
15-
# Wait for client request
16-
await websocket.receive_text()
17-
18-
# Prepare data
19-
if comms.solar_car_connection['udp'] or comms.solar_car_connection['lte'] or comms.solar_car_connection['serial']:
20-
latest_data = comms.frontend_data.copy()
21-
latest_data['solar_car_connection'] = True
22-
latest_data['udp_status'] = comms.solar_car_connection['udp']
23-
latest_data['lte_status'] = comms.solar_car_connection['lte']
24-
latest_data['serial_status'] = comms.solar_car_connection['serial']
25-
latest_data['timestamps'] = f'{latest_data.get("tstamp_hr", 0):02d}:{latest_data.get("tstamp_mn", 0):02d}:' \
26-
f'{latest_data.get("tstamp_sc", 0):02d}.{latest_data.get("tstamp_ms", 0)}'
27-
format_data = {}
28-
for key in latest_data.keys():
29-
format_data[key] = [latest_data[key]]
30-
json_data = {'response': format_data}
31-
await websocket.send_json(json_data)
32-
else:
33-
await websocket.send_json({'response': None})
34-
except Exception as e:
35-
print(f"WebSocket error: {e}")
36-
break
37-
388
@router.get("/single-values")
399
async def single_values():
4010
if comms.solar_car_connection['udp'] or comms.solar_car_connection['lte'] or comms.solar_car_connection['serial']:

Backend/core/data_sources/__init__.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

Backend/core/data_sources/base.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

Backend/core/data_sources/convex_source.py

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)