From a0c0220ee592ae48e51193ed31068ccb492914a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20F=C3=ADsica?= Date: Thu, 12 Jun 2025 17:21:42 +0200 Subject: [PATCH] Change blcu order ids to match board's ids --- backend/cmd/config.toml | 4 ++-- backend/pkg/boards/blcu.go | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/cmd/config.toml b/backend/cmd/config.toml index 6e3e54ceb..35cd72b8f 100644 --- a/backend/cmd/config.toml +++ b/backend/cmd/config.toml @@ -38,8 +38,8 @@ keep_alive_ms = 1000 # Keep-alive interval in milliseconds # BLCU (Boot Loader Control Unit) Configuration [blcu] ip = "127.0.0.1" # TFTP server IP address -download_order_id = 1 # Packet ID for download orders (0 = use default) -upload_order_id = 2 # Packet ID for upload orders (0 = use default) +download_order_id = 701 # Packet ID for download orders (0 = use default) +upload_order_id = 700 # Packet ID for upload orders (0 = use default) # TFTP Configuration [tftp] diff --git a/backend/pkg/boards/blcu.go b/backend/pkg/boards/blcu.go index d14919782..641cf83d5 100644 --- a/backend/pkg/boards/blcu.go +++ b/backend/pkg/boards/blcu.go @@ -3,11 +3,12 @@ package boards import ( "bytes" "fmt" + "time" + "github.com/HyperloopUPV-H8/h9-backend/pkg/abstraction" "github.com/HyperloopUPV-H8/h9-backend/pkg/transport" "github.com/HyperloopUPV-H8/h9-backend/pkg/transport/network/tftp" dataPacket "github.com/HyperloopUPV-H8/h9-backend/pkg/transport/packet/data" - "time" ) // TODO! Get from ADE @@ -15,12 +16,12 @@ const ( BlcuName = "BLCU" BlcuId = abstraction.BoardId(1) - AckId = abstraction.BoardEvent("ACK") + AckId = abstraction.BoardEvent("ACK") DownloadEventId = abstraction.BoardEvent("DOWNLOAD") - UploadEventId = abstraction.BoardEvent("UPLOAD") + UploadEventId = abstraction.BoardEvent("UPLOAD") - BlcuDownloadOrderId = 1 - BlcuUploadOrderId = 2 + BlcuDownloadOrderId = 701 + BlcuUploadOrderId = 700 ) type TFTPConfig struct { @@ -119,7 +120,7 @@ func (boards *BLCU) download(notification DownloadEvent) error { client, err := tftp.NewClient(boards.ip, tftp.WithBlockSize(boards.tftpConfig.BlockSize), tftp.WithRetries(boards.tftpConfig.Retries), - tftp.WithTimeout(time.Duration(boards.tftpConfig.TimeoutMs) * time.Millisecond), + tftp.WithTimeout(time.Duration(boards.tftpConfig.TimeoutMs)*time.Millisecond), ) if err != nil { return ErrNewClientFailed{ @@ -191,7 +192,7 @@ func (boards *BLCU) upload(notification UploadEvent) error { client, err := tftp.NewClient(boards.ip, tftp.WithBlockSize(boards.tftpConfig.BlockSize), tftp.WithRetries(boards.tftpConfig.Retries), - tftp.WithTimeout(time.Duration(boards.tftpConfig.TimeoutMs) * time.Millisecond), + tftp.WithTimeout(time.Duration(boards.tftpConfig.TimeoutMs)*time.Millisecond), ) if err != nil { return ErrNewClientFailed{