From d0b848b6cc008354192b02e9090d5d86f66590ee Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Fri, 12 Jan 2024 15:49:11 -0300 Subject: [PATCH] blueos: Allow fetching ArduPilot firmware version --- src/libs/blueos.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libs/blueos.ts b/src/libs/blueos.ts index e05570187..53fcf42a8 100644 --- a/src/libs/blueos.ts +++ b/src/libs/blueos.ts @@ -100,3 +100,16 @@ export const getMavlink2RestVersion = async (vehicleAddress: string): Promise => { + try { + const url = `http://${vehicleAddress}/ardupilot-manager/v1.0/firmware_info` + const ardupilotFirmwareRawInfo: RawArdupilotFirmwareInfo = await ky.get(url, { timeout: 5000 }).json() + return ardupilotFirmwareRawInfo.version + } catch (error) { + throw new Error(`Could not get Ardupilot firmware version. ${error}`) + } +}