Skip to content

Commit 2c54759

Browse files
authored
Merge pull request #462 from Hyperloop-UPV/develop
production again
2 parents 3d5a900 + 1dfa174 commit 2c54759

110 files changed

Lines changed: 1819 additions & 5909 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ jobs:
5353
competition-view: ${{ steps.filter.outputs.competition-view == 'true' || github.event.inputs.rebuild-competition-view == 'true' || inputs.build-competition-view == true }}
5454
steps:
5555
- uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
5658

5759
- uses: dorny/paths-filter@v3
5860
id: filter
5961
with:
60-
ref: "production"
62+
base: ${{ github.event.before }}
6163
filters: |
6264
backend:
6365
- 'backend/**/*'
@@ -113,7 +115,7 @@ jobs:
113115
with:
114116
workflow: build.yaml
115117
branch: production
116-
workflow_conclusion: success
118+
workflow_conclusion: completed
117119
name: backend-${{ matrix.platform }}
118120
path: backend/cmd
119121

.github/workflows/frontend-tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ jobs:
4141
- name: Install dependencies
4242
run: pnpm install --frozen-lockfile --filter=testing-view --filter=ui --filter=core
4343

44+
- name: Build frontend
45+
run: pnpm build --filter="./frontend/**"
46+
4447
- name: Run tests
4548
run: pnpm test --filter="./frontend/**"

.github/workflows/release.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ jobs:
8686
echo "Updated version to:"
8787
cat package.json | grep version
8888
89+
- name: Install Linux build dependencies
90+
if: runner.os == 'Linux'
91+
run: |
92+
sudo apt-get update
93+
sudo apt-get install -y rpm libarchive-tools
94+
8995
# Download ONLY the appropriate backend for this platform
9096
- name: Download Linux backend
9197
if: runner.os == 'Linux'
@@ -182,6 +188,8 @@ jobs:
182188
electron-app/dist/*.exe
183189
electron-app/dist/*.AppImage
184190
electron-app/dist/*.deb
191+
electron-app/dist/*.rpm
192+
electron-app/dist/*.pacman
185193
electron-app/dist/*.dmg
186194
electron-app/dist/*.zip
187195
electron-app/dist/*.yml

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Hyperloop Control Station H11
2+
![Testing View](https://raw.githubusercontent.com/Hyperloop-UPV/webpage/5c1c827d82d380689856ee61af43da30da22e0fc/src/assets/backgrounds/testing-view.png)
23

34
## Monorepo usage
45

backend/cmd/config.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ max_retries = 0 # Maximum retries before cycling (0 = infinite retr
3333
connection_timeout_ms = 1000 # Connection timeout in milliseconds
3434
keep_alive_ms = 1000 # Keep-alive interval in milliseconds
3535

36-
# BLCU (Boot Loader Control Unit) Configuration
37-
[blcu]
38-
ip = "127.0.0.1" # TFTP server IP address
39-
download_order_id = 0 # Packet ID for download orders (0 = use default)
40-
upload_order_id = 0 # Packet ID for upload orders (0 = use default)
41-
4236
# TFTP Configuration
4337
[tftp]
4438
block_size = 131072 # TFTP block size in bytes (128kB)

backend/cmd/dev-config.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ timeout_ms = 5000 # Timeout for TFTP operations in milliseconds
6666
backoff_factor = 2 # Backoff factor for retries
6767
enable_progress = true # Enable progress updates during transfers
6868

69-
# BLCU Configuration
70-
[blcu]
71-
ip = "10.10.10.5" # BLCU IP address
72-
download_order_id = 0 # Order ID for download operations (0 = use default)
73-
upload_order_id = 0 # Order ID for upload operations (0 = use default)
69+
7470

7571
# Logging Configuration
7672
[logging]

backend/cmd/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"os"
66
"os/signal"
77

8-
adj_module "github.com/HyperloopUPV-H8/h9-backend/internal/adj"
98
"github.com/HyperloopUPV-H8/h9-backend/internal/config"
109
"github.com/HyperloopUPV-H8/h9-backend/internal/flags"
1110
"github.com/HyperloopUPV-H8/h9-backend/internal/pod_data"
1211
"github.com/HyperloopUPV-H8/h9-backend/internal/update_factory"
1312
vehicle_models "github.com/HyperloopUPV-H8/h9-backend/internal/vehicle/models"
13+
adj_module "github.com/HyperloopUPV-H8/h9-backend/pkg/adj"
1414
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport"
1515
"github.com/HyperloopUPV-H8/h9-backend/pkg/websocket"
1616
trace "github.com/rs/zerolog/log"
@@ -23,7 +23,6 @@ const (
2323
TcpServer = "TCP_SERVER"
2424
UDP = "UDP"
2525
SNTP = "SNTP"
26-
BlcuAck = "blcu_ack"
2726
AddStateOrder = "add_state_order"
2827
RemoveStateOrder = "remove_state_order"
2928
)
@@ -62,7 +61,7 @@ func main() {
6261
}
6362

6463
// <--- vehicle orders --->
65-
vehicleOrders, err := vehicle_models.NewVehicleOrders(podData.Boards, adj.Info.Addresses[BLCU])
64+
vehicleOrders, err := vehicle_models.NewVehicleOrders(podData.Boards)
6665
if err != nil {
6766
trace.Fatal().Err(err).Msg("creating vehicleOrders")
6867
}

backend/cmd/orchestrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"runtime/pprof"
88
"strings"
99

10-
adj_module "github.com/HyperloopUPV-H8/h9-backend/internal/adj"
1110
"github.com/HyperloopUPV-H8/h9-backend/internal/config"
1211
"github.com/HyperloopUPV-H8/h9-backend/internal/flags"
1312
"github.com/HyperloopUPV-H8/h9-backend/internal/pod_data"
1413
"github.com/HyperloopUPV-H8/h9-backend/pkg/abstraction"
14+
adj_module "github.com/HyperloopUPV-H8/h9-backend/pkg/adj"
1515
"github.com/HyperloopUPV-H8/h9-backend/pkg/logger"
1616
data_logger "github.com/HyperloopUPV-H8/h9-backend/pkg/logger/data"
1717
order_logger "github.com/HyperloopUPV-H8/h9-backend/pkg/logger/order"

backend/cmd/setup_transport.go

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ import (
77
"net"
88
"time"
99

10-
adj_module "github.com/HyperloopUPV-H8/h9-backend/internal/adj"
1110
"github.com/HyperloopUPV-H8/h9-backend/internal/common"
1211
"github.com/HyperloopUPV-H8/h9-backend/internal/config"
1312
"github.com/HyperloopUPV-H8/h9-backend/internal/pod_data"
1413
"github.com/HyperloopUPV-H8/h9-backend/internal/utils"
1514
"github.com/HyperloopUPV-H8/h9-backend/pkg/abstraction"
16-
"github.com/HyperloopUPV-H8/h9-backend/pkg/boards"
15+
adj_module "github.com/HyperloopUPV-H8/h9-backend/pkg/adj"
1716
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport"
1817
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport/network/tcp"
1918
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport/network/udp"
20-
blcu_packet "github.com/HyperloopUPV-H8/h9-backend/pkg/transport/packet/blcu"
2119
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport/packet/data"
2220
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport/packet/order"
2321
"github.com/HyperloopUPV-H8/h9-backend/pkg/transport/packet/protection"
@@ -45,11 +43,6 @@ func configureTransport(
4543
transp.SetTargetIp(adj.Info.Addresses[board.Name], abstraction.TransportTarget(board.Name))
4644
}
4745

48-
// If BLCU is configured set BLCU packet ID mappings
49-
if common.Contains(config.Vehicle.Boards, "BLCU") {
50-
configureBLCUTransport(adj, transp, config)
51-
}
52-
5346
// Start handling TCP CLIENT connections
5447
configureTCPClientTransport(adj, podData, transp, config)
5548

@@ -61,36 +54,6 @@ func configureTransport(
6154

6255
}
6356

64-
// configureBLCUTransport sets the packet IDs and target IP for the BLCU board.
65-
// It prefers values from config, falls back to ADJ and finally to a loopback default.
66-
func configureBLCUTransport(adj adj_module.ADJ,
67-
transp *transport.Transport,
68-
config config.Config) {
69-
// Use configurable packet IDs or defaults
70-
downloadOrderID := config.Blcu.DownloadOrderId
71-
uploadOrderID := config.Blcu.UploadOrderId
72-
if downloadOrderID == 0 {
73-
downloadOrderID = boards.DefaultBlcuDownloadOrderId
74-
}
75-
if uploadOrderID == 0 {
76-
uploadOrderID = boards.DefaultBlcuUploadOrderId
77-
}
78-
79-
transp.SetIdTarget(abstraction.PacketId(downloadOrderID), abstraction.TransportTarget("BLCU"))
80-
transp.SetIdTarget(abstraction.PacketId(uploadOrderID), abstraction.TransportTarget("BLCU"))
81-
82-
// Use BLCU address from config, ADJ, or default
83-
blcuIP := config.Blcu.IP
84-
if blcuIP == "" {
85-
if adjBlcuIP, exists := adj.Info.Addresses[BLCU]; exists {
86-
blcuIP = adjBlcuIP
87-
} else {
88-
blcuIP = "127.0.0.1"
89-
}
90-
}
91-
transp.SetTargetIp(blcuIP, abstraction.TransportTarget("BLCU"))
92-
}
93-
9457
func configureTCPClientTransport(
9558
adj adj_module.ADJ,
9659
podData pod_data.PodData,
@@ -247,9 +210,6 @@ func getTransportDecEnc(info adj_module.Info, podData pod_data.PodData) (*presen
247210
encoder.SetPacketEncoder(id, dataEncoder)
248211
}
249212

250-
// Register BLCU ack decoder
251-
decoder.SetPacketDecoder(abstraction.PacketId(info.MessageIds[BlcuAck]), blcu_packet.NewDecoder())
252-
253213
// TODO Solve this foking mess, I have tried...
254214
stateOrdersDecoder := order.NewDecoder(binary.LittleEndian)
255215
stateOrdersDecoder.SetActionId(abstraction.PacketId(info.MessageIds[AddStateOrder]), stateOrdersDecoder.DecodeAdd)

backend/cmd/setup_vehicle.go

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ import (
1212
h "github.com/HyperloopUPV-H8/h9-backend/pkg/http"
1313
"github.com/HyperloopUPV-H8/h9-backend/pkg/websocket"
1414

15-
adj_module "github.com/HyperloopUPV-H8/h9-backend/internal/adj"
1615
"github.com/HyperloopUPV-H8/h9-backend/internal/common"
1716
"github.com/HyperloopUPV-H8/h9-backend/internal/config"
1817
"github.com/HyperloopUPV-H8/h9-backend/internal/pod_data"
1918
"github.com/HyperloopUPV-H8/h9-backend/internal/update_factory"
2019
"github.com/HyperloopUPV-H8/h9-backend/pkg/abstraction"
21-
"github.com/HyperloopUPV-H8/h9-backend/pkg/boards"
20+
adj_module "github.com/HyperloopUPV-H8/h9-backend/pkg/adj"
2221
"github.com/HyperloopUPV-H8/h9-backend/pkg/broker"
23-
blcu_topics "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/blcu"
2422
connection_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/connection"
2523
data_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/data"
2624
logger_topic "github.com/HyperloopUPV-H8/h9-backend/pkg/broker/topics/logger"
@@ -75,7 +73,6 @@ func configureBroker(subloggers abstraction.SubloggersMap, loggerHandler *logger
7573
})
7674

7775
broker.SetPool(pool)
78-
blcu_topics.RegisterTopics(broker, pool)
7976

8077
return broker, cleanup
8178
}
@@ -101,45 +98,6 @@ func configureVehicle(
10198
vehicle.SetIdToBoardName(idToBoard)
10299
vehicle.SetTransport(transp)
103100

104-
// Register BLCU board for handling bootloader operations
105-
if blcuIP, exists := adj.Info.Addresses[BLCU]; exists {
106-
blcuId, idExists := adj.Info.BoardIds["BLCU"]
107-
if !idExists {
108-
return fmt.Errorf("BLCU IP found in ADJ but board ID missing")
109-
} else {
110-
// Get configurable order IDs or use defaults
111-
downloadOrderId := config.Blcu.DownloadOrderId
112-
uploadOrderId := config.Blcu.UploadOrderId
113-
if downloadOrderId == 0 {
114-
downloadOrderId = boards.DefaultBlcuDownloadOrderId
115-
}
116-
if uploadOrderId == 0 {
117-
uploadOrderId = boards.DefaultBlcuUploadOrderId
118-
}
119-
120-
tftpConfig := boards.TFTPConfig{
121-
BlockSize: config.TFTP.BlockSize,
122-
Retries: config.TFTP.Retries,
123-
TimeoutMs: config.TFTP.TimeoutMs,
124-
BackoffFactor: config.TFTP.BackoffFactor,
125-
EnableProgress: config.TFTP.EnableProgress,
126-
}
127-
blcuBoard := boards.NewWithConfig(blcuIP, tftpConfig, abstraction.BoardId(blcuId), downloadOrderId, uploadOrderId)
128-
vehicle.AddBoard(blcuBoard)
129-
vehicle.SetBlcuId(abstraction.BoardId(blcuId))
130-
131-
trace.
132-
Info().
133-
Str("ip", blcuIP).
134-
Int("id", int(blcuId)).
135-
Uint16("download_order_id", downloadOrderId).
136-
Uint16("upload_order_id", uploadOrderId).
137-
Msg("BLCU board registered")
138-
}
139-
} else {
140-
trace.Warn().Msg("BLCU not found in ADJ configuration - bootloader operations unavailable")
141-
}
142-
143101
return nil
144102

145103
}

0 commit comments

Comments
 (0)