@@ -1463,27 +1463,32 @@ export abstract class MAVLinkVehicle<Modes> extends Vehicle.AbstractVehicle<Mode
14631463 }
14641464 setDataLakeVariableData ( path , mavlinkPackage . message . value )
14651465
1466- // Create duplicated variables for legacy purposes (that was how they were stored in the old generic-variables system)
1467- const oldVariablePath = mavlinkPackage . message . name . join ( '' ) . replaceAll ( '\x00' , '' )
1468- if ( getDataLakeVariableInfo ( oldVariablePath ) === undefined ) {
1469- createDataLakeVariable ( { id : oldVariablePath , name : `(Legacy) ${ oldVariablePath } ` , type : 'number' } )
1466+ if ( messageSystemId !== this . currentSystemId || messageComponentId !== 1 ) {
1467+ // Create duplicated variables for legacy purposes (that was how they were stored in the old generic-variables system)
1468+ const oldVariablePath = mavlinkPackage . message . name . join ( '' ) . replaceAll ( '\x00' , '' )
1469+ if ( getDataLakeVariableInfo ( oldVariablePath ) === undefined ) {
1470+ createDataLakeVariable ( { id : oldVariablePath , name : `(Legacy) ${ oldVariablePath } ` , type : 'number' } )
1471+ }
1472+ setDataLakeVariableData ( oldVariablePath , mavlinkPackage . message . value )
14701473 }
1471- setDataLakeVariableData ( oldVariablePath , mavlinkPackage . message . value )
14721474 } else {
14731475 // For all other messages, use the flattener
14741476 const flattened = flattenData ( mavlinkPackage . message )
14751477 flattened . forEach ( ( { path, value } ) => {
14761478 if ( value === null ) return
14771479 if ( typeof value !== 'string' && typeof value !== 'number' ) return
14781480
1479- // Create the variable in the old style path for legacy purposes (that was how they were stored in the old generic-variables system)
1480- const oldStylePath = `${ path } `
1481- if ( getDataLakeVariableInfo ( oldStylePath ) === undefined ) {
1482- createDataLakeVariable ( {
1483- id : oldStylePath ,
1484- name : `(Legacy) ${ path } ` ,
1485- type : typeof value === 'string' ? 'string' : 'number' ,
1486- } )
1481+ if ( messageSystemId !== this . currentSystemId || messageComponentId !== 1 ) {
1482+ // Create the variable in the old style path for legacy purposes (that was how they were stored in the old generic-variables system)
1483+ const oldStylePath = `${ path } `
1484+ if ( getDataLakeVariableInfo ( oldStylePath ) === undefined ) {
1485+ createDataLakeVariable ( {
1486+ id : oldStylePath ,
1487+ name : `(Legacy) ${ path } ` ,
1488+ type : typeof value === 'string' ? 'string' : 'number' ,
1489+ } )
1490+ }
1491+ setDataLakeVariableData ( oldStylePath , value )
14871492 }
14881493
14891494 // Create the variable in the new style path
@@ -1495,9 +1500,6 @@ export abstract class MAVLinkVehicle<Modes> extends Vehicle.AbstractVehicle<Mode
14951500 type : typeof value === 'string' ? 'string' : 'number' ,
14961501 } )
14971502 }
1498-
1499- // Set the value in the variables in both styles (legacy and new)
1500- setDataLakeVariableData ( oldStylePath , value )
15011503 setDataLakeVariableData ( newStylePath , value )
15021504 } )
15031505 }
0 commit comments