Skip to content

Commit

Permalink
blueos: Allow fetching ArduPilot firmware version
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl authored and patrickelectric committed Jan 31, 2024
1 parent ea33d71 commit d0b848b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/libs/blueos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,16 @@ export const getMavlink2RestVersion = async (vehicleAddress: string): Promise<st
}
}

/* eslint-disable jsdoc/require-jsdoc */
type RawArdupilotFirmwareInfo = { version: string; type: string }
/* eslint-enable jsdoc/require-jsdoc */

export const getArdupilotVersion = async (vehicleAddress: string): Promise<string> => {
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}`)
}
}

0 comments on commit d0b848b

Please sign in to comment.