mirror of
https://github.com/espressif/openthread.git
synced 2026-08-17 16:09:51 +00:00
[cli] implement setting/getting cca threshold (#5532)
This commit adds a command to the CLI to be able to set (and get) the CCA threshold. This is useful when there is a LNA in the radio's RX path.
This commit is contained in:
@@ -23,6 +23,7 @@ Done
|
||||
|
||||
- [bbr](#bbr)
|
||||
- [bufferinfo](#bufferinfo)
|
||||
- [ccathreshold](#ccathreshold)
|
||||
- [channel](#channel)
|
||||
- [child](#child-list)
|
||||
- [childip](#childip)
|
||||
@@ -321,6 +322,25 @@ coap: 0 0
|
||||
Done
|
||||
```
|
||||
|
||||
### ccathreshold
|
||||
|
||||
Get the CCA threshold in dBm.
|
||||
|
||||
```bash
|
||||
> ccathreshold
|
||||
-75 dBm
|
||||
Done
|
||||
```
|
||||
|
||||
### ccathreshold \<ccathreshold\>
|
||||
|
||||
Set the CCA threshold.
|
||||
|
||||
```bash
|
||||
> ccathreshold -62
|
||||
Done
|
||||
```
|
||||
|
||||
### channel
|
||||
|
||||
Get the IEEE 802.15.4 Channel value.
|
||||
|
||||
@@ -678,6 +678,29 @@ otError Interpreter::ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[])
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Interpreter::ProcessCcaThreshold(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
if (aArgsLength == 0)
|
||||
{
|
||||
int8_t cca;
|
||||
|
||||
SuccessOrExit(error = otPlatRadioGetCcaEnergyDetectThreshold(mInstance, &cca));
|
||||
OutputLine("%d dBm", cca);
|
||||
}
|
||||
else
|
||||
{
|
||||
long value;
|
||||
|
||||
SuccessOrExit(error = ParseLong(aArgs[0], value));
|
||||
SuccessOrExit(error = otPlatRadioSetCcaEnergyDetectThreshold(mInstance, static_cast<int8_t>(value)));
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Interpreter::ProcessChannel(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
+6
-3
@@ -278,9 +278,11 @@ private:
|
||||
const Command *FindCommand(const char *aName) const;
|
||||
otError ParsePingInterval(const char *aString, uint32_t &aInterval);
|
||||
static otError ParseJoinerDiscerner(char *aString, otJoinerDiscerner &aJoinerDiscerner);
|
||||
otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]);
|
||||
otError ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[]);
|
||||
otError ProcessChannel(uint8_t aArgsLength, char *aArgs[]);
|
||||
|
||||
otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]);
|
||||
otError ProcessCcaThreshold(uint8_t aArgsLength, char *aArgs[]);
|
||||
otError ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[]);
|
||||
otError ProcessChannel(uint8_t aArgsLength, char *aArgs[]);
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
otError ProcessBackboneRouter(uint8_t aArgsLength, char *aArgs[]);
|
||||
|
||||
@@ -549,6 +551,7 @@ private:
|
||||
{"bbr", &Interpreter::ProcessBackboneRouter},
|
||||
#endif
|
||||
{"bufferinfo", &Interpreter::ProcessBufferInfo},
|
||||
{"ccathreshold", &Interpreter::ProcessCcaThreshold},
|
||||
{"channel", &Interpreter::ProcessChannel},
|
||||
#if OPENTHREAD_FTD
|
||||
{"child", &Interpreter::ProcessChild},
|
||||
|
||||
@@ -47,6 +47,12 @@ expect "Done"
|
||||
send "bufferinfo\n"
|
||||
expect "Done"
|
||||
|
||||
send "ccathreshold -62\n"
|
||||
expect "Done"
|
||||
send "ccathreshold\n"
|
||||
expect -- "-62 dBm"
|
||||
expect "Done"
|
||||
|
||||
send "parent\n"
|
||||
expect "Done"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user