-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channel scan configuration #1190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jgromes thank you very much!! I think two points could use a slight change, but overall much appreciated and very useful :)
@jgromes thanks for the changes. I will test the CAD specifics later, and I am currently looking at EDIT: hmm, this is not as easy as I thought - would it be an idea to keep the IRQ parameters, but give them their new abstract form that is then resolved into the module-specific IRQs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spent the past hour investigating the new things in this PR. The problem I encountered, is that it is not possible to configure multiple flags through the RadioIrqFlags_t
type as it is now, because the IRQ flags are not unique bits, but rather indices. This will require some rethinking, as using bits then again doesn't work as a straight index into irqMap
... hmm.
Part of the problem is that most methods (re)configure the IRQs themselves. The new functions to set IRQs are all good, but overruled as soon as a method is called. |
That should be fairly straight-forward, we can have
That is indeed a bit more tricky. I think we can leave it as it is now and revisit later, since CAD configures the flags on the module level, not on the PHY level. But at least these new abstractions allow us to get rid of the |
New IRQs passed the test through LoRaWAN's
Specifically casting the |
And the actual CAD is working all good now, too :) ChannelScanConfig_t cadCfg;
cadCfg.cad.symNum = 0xFF;
cadCfg.cad.detPeak = 0xFF;
cadCfg.cad.detMin = 0xFF;
cadCfg.cad.exitMode = 0x01;
cadCfg.cad.irqFlags = 0;
cadCfg.cad.irqFlags |= (1UL << RADIOLIB_IRQ_CAD_DONE);
cadCfg.cad.irqFlags |= (1UL << RADIOLIB_IRQ_CAD_DETECTED);
cadCfg.cad.irqFlags |= (1UL << RADIOLIB_IRQ_PREAMBLE_DETECTED);
cadCfg.cad.irqFlags |= (1UL << RADIOLIB_IRQ_HEADER_VALID);
cadCfg.cad.irqFlags |= (1UL << RADIOLIB_IRQ_RX_DONE);
cadCfg.cad.irqFlags |= (1UL << RADIOLIB_IRQ_TIMEOUT);
cadCfg.cad.irqMask = cadCfg.cad.irqMask;
state = this->phyLayer->startChannelScan(cadCfg); Depending on how we would want to resolve this, all looks very good to me - thank you very much!! |
Ah, the error was caused by the old SX127x start receive method, which exposed the Rx mode directly to user. That no longer makes sense, so the Rx mode is now deduced based on timeout - fixed now. FYI because if the changes to the channel scanning and receive methods, I will keep this open until I can run some basic checks on a few devices, hopefully in the next few days. |
@StevenCellist @GUVWAF I was able to test this on SX1278, SX1262 and LR1110, all seems to be working (as in: transmission, reception and CAD). Hopefully I didn't miss something :) |
Thank you very much!! |
Added channel scan configuration via PHY. Currently implemented for SX126x, SX128x and LR11x0.