From df477ae79ba3e9a80ad3aa5a47fbee57dc4d5315 Mon Sep 17 00:00:00 2001 From: Sultan Qasim Khan Date: Wed, 24 Apr 2024 10:42:28 -0400 Subject: [PATCH] RadioWrapper: fix long range PHY advertising --- fw/RadioWrapper.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fw/RadioWrapper.c b/fw/RadioWrapper.c index bdd518a..5e5d540 100644 --- a/fw/RadioWrapper.c +++ b/fw/RadioWrapper.c @@ -830,13 +830,18 @@ int RadioWrapper_advertiseExt3(RadioWrapper_Callback callback, const uint16_t *a adv37.commandNo = 0x1823; adv37.condition.rule = COND_STOP_ON_FALSE; adv37.phyMode.mainMode = (primaryPhy == PHY_CODED_S2) ? 2 : primaryPhy; - adv37.phyMode.coding = (primaryPhy == PHY_CODED_S2) ? 6 : 4; + adv37.phyMode.coding = (primaryPhy == PHY_CODED_S2) ? 7 : 4; adv37.pParams = ¶ms; memset(¶ms, 0, sizeof(params)); params.advConfig.deviceAddrType = advRandom ? 1 : 0; params.auxPtrTargetType = TRIG_ABSTIME; - params.auxPtrTargetTime = RF_getCurrentTime() + 8000; + if (primaryPhy == PHY_1M) + params.auxPtrTargetTime = RF_getCurrentTime() + 2*4000; + else if (primaryPhy == PHY_CODED_S8) + params.auxPtrTargetTime = RF_getCurrentTime() + 5*4000; + else // PHY_CODED_S2 + params.auxPtrTargetTime = RF_getCurrentTime() + 3*4000; params.pAdvPkt = (uint8_t *)&advPkt; params.pDeviceAddress = (uint16_t *)advAddr; @@ -871,7 +876,7 @@ int RadioWrapper_advertiseExt3(RadioWrapper_Callback callback, const uint16_t *a adv2.condition.rule = COND_NEVER; adv2.channel = secondaryChan; adv2.phyMode.mainMode = (secondaryPhy == PHY_CODED_S2) ? 2 : secondaryPhy; - adv2.phyMode.coding = (secondaryPhy == PHY_CODED_S2) ? 6 : 4; + adv2.phyMode.coding = (secondaryPhy == PHY_CODED_S2) ? 7 : 4; adv2.pParams = ¶ms2; memset(¶ms2, 0, sizeof(params2));