From 184c7c813a7abc67d1fed77a881f8c9d67cda045 Mon Sep 17 00:00:00 2001 From: Gabor Date: Thu, 28 Mar 2024 18:15:03 +0100 Subject: [PATCH] Add some more firmware update progress messages --- src/dividat-driver/firmware/main.go | 4 ++++ src/dividat-driver/senso/update_firmware.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/dividat-driver/firmware/main.go b/src/dividat-driver/firmware/main.go index fb7634e..38a04b6 100644 --- a/src/dividat-driver/firmware/main.go +++ b/src/dividat-driver/firmware/main.go @@ -97,6 +97,7 @@ func Update(parentCtx context.Context, image io.Reader, deviceSerial *string, co dfuHost = *configuredAddr } else { ctx, cancel := context.WithTimeout(parentCtx, 60*time.Second) + onProgress("Looking for Senso in bootloader mode.") discoveredAddr, err := discover("_sensoUpdate._udp", deviceSerial, ctx, onProgress) cancel() if err != nil { @@ -111,6 +112,7 @@ func Update(parentCtx context.Context, image io.Reader, deviceSerial *string, co cancel() if err == nil { dfuHost = legacyDiscoveredAddr + onProgress("Senso discovered via _sensoControl._tcp") } else if controllerHost != "" { onProgress(fmt.Sprintf("Could not discover update service, trying to fall back to previous discovery %s.", controllerHost)) dfuHost = controllerHost @@ -122,9 +124,11 @@ func Update(parentCtx context.Context, image io.Reader, deviceSerial *string, co } } else { dfuHost = discoveredAddr + onProgress("Senso discovered via _sensoUpdate._udp") } } + onProgress("Preparing to transmit firmware.") // 4: Transmit firmware via TFTP time.Sleep(5 * time.Second) // Wait to ensure proper TFTP startup err := putTFTP(dfuHost, tftpPort, image, onProgress) diff --git a/src/dividat-driver/senso/update_firmware.go b/src/dividat-driver/senso/update_firmware.go index ad4a3b2..deed05a 100644 --- a/src/dividat-driver/senso/update_firmware.go +++ b/src/dividat-driver/senso/update_firmware.go @@ -30,6 +30,8 @@ func (handle *Handle) ProcessFirmwareUpdateRequest(command UpdateFirmware, onUpd handle.log.Info("Processing firmware update request.") handle.setUpdatingFirmware(true) if handle.cancelCurrentConnection != nil { + msg := "Disconnecting from the Senso" + onUpdate(FirmwareUpdateMessage{FirmwareUpdateProgress: &msg}) handle.cancelCurrentConnection() } image, err := decodeImage(command.Image)