Skip to content

Commit

Permalink
ardupilot: Don't early return on NAMED_VALUE_FLOAT messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Jan 17, 2025
1 parent 01b7c21 commit a4b221f
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/libs/vehicle/ardupilot/ardupilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,19 @@ export abstract class ArduPilotVehicle<Modes> extends Vehicle.AbstractVehicle<Mo
createDataLakeVariable(new DataLakeVariable(path, path, 'number'))
}
setDataLakeVariableData(path, mavlink_message.message.value)
return
} else {
// For all other messages, use the flattener
const flattened = flattenData(mavlink_message.message)
flattened.forEach(({ path, value }) => {
if (value === null) return
if (typeof value !== 'string' && typeof value !== 'number') return
if (getDataLakeVariableInfo(path) === undefined) {
createDataLakeVariable(new DataLakeVariable(path, path, typeof value === 'string' ? 'string' : 'number'))
}
setDataLakeVariableData(path, value)
})
}

// For all other messages, use the flattener
const flattened = flattenData(mavlink_message.message)
flattened.forEach(({ path, value }) => {
if (value === null) return
if (typeof value !== 'string' && typeof value !== 'number') return
if (getDataLakeVariableInfo(path) === undefined) {
createDataLakeVariable(new DataLakeVariable(path, path, typeof value === 'string' ? 'string' : 'number'))
}
setDataLakeVariableData(path, value)
})

// Update our internal messages
this._messages.set(mavlink_message.message.type, { ...mavlink_message.message, epoch: new Date().getTime() })

Expand Down

0 comments on commit a4b221f

Please sign in to comment.