Skip to content

Commit 3095a53

Browse files
committed
update config
1 parent 354ca9e commit 3095a53

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

backend/cmd/config.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ import (
55
"github.com/HyperloopUPV-H8/h9-backend/internal/vehicle"
66
)
77

8+
type App struct {
9+
AutomaticWindowOpening bool `toml:"automatic_window_opening"`
10+
}
11+
812
type Adj struct {
9-
Branch string
10-
Test bool
13+
Branch string `toml:"branch"`
14+
Test bool `toml:"test"`
1115
}
1216

1317
type Network struct {
14-
Manual bool
18+
Manual bool `toml:"manual"`
1519
}
1620

1721
type Transport struct {
@@ -33,15 +37,16 @@ type Blcu struct {
3337
}
3438

3539
type TCP struct {
36-
BackoffMinMs int `toml:"backoff_min_ms"` // Minimum backoff duration in milliseconds
37-
BackoffMaxMs int `toml:"backoff_max_ms"` // Maximum backoff duration in milliseconds
38-
BackoffMultiplier float64 `toml:"backoff_multiplier"` // Exponential backoff multiplier
39-
MaxRetries int `toml:"max_retries"` // Maximum number of retries before cycling (0 or negative = infinite)
40-
ConnectionTimeout int `toml:"connection_timeout_ms"` // Connection timeout in milliseconds
41-
KeepAlive int `toml:"keep_alive_ms"` // Keep-alive interval in milliseconds
40+
BackoffMinMs int `toml:"backoff_min_ms"`
41+
BackoffMaxMs int `toml:"backoff_max_ms"`
42+
BackoffMultiplier float64 `toml:"backoff_multiplier"`
43+
MaxRetries int `toml:"max_retries"`
44+
ConnectionTimeout int `toml:"connection_timeout_ms"`
45+
KeepAlive int `toml:"keep_alive_ms"`
4246
}
4347

4448
type Config struct {
49+
App App
4550
Vehicle vehicle.Config
4651
Server server.Config
4752
Adj Adj

backend/cmd/config.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77
# 3. Toggle the Fault Propagation to your needs (treu/false)
88
# 4. Check the TCP configuration and make sure to use the needed Keep Alive settings
99

10+
# Control Station general configuration
11+
[app]
12+
automatic_window_opening = "both" # Leave blank to open no windows (<blank>, ethernet-view, control-station, both)
1013

1114
# Vehicle Configuration
1215
[vehicle]
1316
boards = ["HVSCU", "PCU", "BLCU"]
1417

1518
# ADJ (Architecture Description JSON) Configuration
1619
[adj]
17-
branch = "software" # Leave blank when using ADJ as a submodule (like this: "")
18-
test = true # Enable test mode
20+
branch = "main" # Leave blank when using ADJ as a submodule (like this: "")
21+
test = true # Enable test mode
1922

2023
# Network Configuration
2124
[network]

backend/cmd/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,11 @@ func main() {
432432
}()
433433
}
434434

435-
browser.OpenURL("http://" + config.Server["ethernet-view"].Addr)
436-
browser.OpenURL("http://" + config.Server["control-station"].Addr)
435+
// Open browser tabs
436+
if config.App.AutomaticWindowOpening {
437+
browser.OpenURL("http://" + config.Server["ethernet-view"].Addr)
438+
browser.OpenURL("http://" + config.Server["control-station"].Addr)
439+
}
437440

438441
interrupt := make(chan os.Signal, 1)
439442
signal.Notify(interrupt, os.Interrupt)

0 commit comments

Comments
 (0)