Skip to content

Commit d7d1ba5

Browse files
authored
Merge pull request #742 from ExpressLRS/fix-rx-ax-tx-local-build
Fix rx-as-tx for local builds
2 parents 00d4d98 + 7d64514 commit d7d1ba5

File tree

1 file changed

+15
-3
lines changed
  • src/api/src/services/BinaryFlashingStrategy

1 file changed

+15
-3
lines changed

src/api/src/services/BinaryFlashingStrategy/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,20 @@ export default class BinaryFlashingStrategyService implements FlashingStrategy {
339339
return `${regulatoryDomain}/${platformioTarget}/firmware.bin`;
340340
}
341341

342-
getCompileTarget(config: DeviceDescription): string {
343-
let target = `${config.firmware}_via_UART`;
342+
getCompileTarget(
343+
config: DeviceDescription,
344+
userDefines: UserDefine[]
345+
): string {
346+
const rxAsTx =
347+
userDefines.find((item) => {
348+
return item.key === UserDefineKey.RX_AS_TX && item.enabled;
349+
}) !== undefined;
350+
const firmwareName = rxAsTx
351+
? config.firmware.replace('_RX', '_TX')
352+
: config.firmware;
353+
354+
let target = `${firmwareName}_via_UART`;
355+
344356
if (config.upload_methods.includes('stlink')) {
345357
target = `${config.firmware}_via_STLINK`;
346358
}
@@ -510,7 +522,7 @@ export default class BinaryFlashingStrategyService implements FlashingStrategy {
510522

511523
// we were not able to find cloud binaries, so we will build them on the spot
512524
if (firmwareDescriptionsPath === firmwareSourcePath) {
513-
const target = this.getCompileTarget(config);
525+
const target = this.getCompileTarget(config, params.userDefines);
514526
sourceFirmwareBinPath = await this.compileBinary(
515527
target,
516528
firmwareSourcePath,

0 commit comments

Comments
 (0)