Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-Custom MTS-Serial
Fork of mDot_AT_firmware_CUSTOM by
To change channel plans replace AS923 with AU915, EU868, KR920 or US915 on line 15
#define CHANNEL_PLAN CP_AS923
Diff: CommandTerminal/CmdRxFrequency.cpp
- Revision:
- 15:36db31c18231
- Parent:
- 14:e80ace5a6834
--- a/CommandTerminal/CmdRxFrequency.cpp Mon Aug 29 10:05:41 2016 -0500
+++ b/CommandTerminal/CmdRxFrequency.cpp Wed Aug 31 11:57:27 2016 -0500
@@ -1,26 +1,26 @@
#include "CmdRxFrequency.h"
-CmdRxFrequency::CmdRxFrequency() :
- Command("Rx Frequency", "AT+RXF", "Set the Rx frequency for +RECV,+RECVC", "US:(0,902000000-928000000) EU:(0,863000000-870000000)")
+CmdRxFrequency::CmdRxFrequency()
+:
+ Command("Rx Frequency", "AT+RXF", "Set the Rx frequency for +RECV,+RECVC", "SEE PLAN")
{
_queryable = true;
}
-uint32_t CmdRxFrequency::action(std::vector<std::string> args)
-{
- if (args.size() == 1)
- {
+uint32_t CmdRxFrequency::action(std::vector<std::string> args) {
+ if (args.size() == 1) {
CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getRxFrequency());
}
else if (args.size() == 2)
- {
-
+ {
+
int frequency = 0;
sscanf(args[1].c_str(), "%d", &frequency);
if (CommandTerminal::Dot()->setRxFrequency(frequency) != mDot::MDOT_OK)
- {
-
- CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
+ {
+
+ CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());
+ ;
return 1;
}
}
@@ -28,28 +28,22 @@
return 0;
}
-bool CmdRxFrequency::verify(std::vector<std::string> args)
-{
+bool CmdRxFrequency::verify(std::vector<std::string> args) {
if (args.size() == 1)
return true;
if (args.size() == 2)
- {
+ {
int frequency;
if (sscanf(args[1].c_str(), "%d", &frequency) != 1) {
CommandTerminal::setErrorMessage("Invalid argument");
return false;
}
-
if (frequency != 0 && (frequency < int(CommandTerminal::Dot()->getMinFrequency()) || frequency > int(CommandTerminal::Dot()->getMaxFrequency()))) {
- if (CommandTerminal::Dot()->getFrequencyBand() == mDot::FB_EU868)
- CommandTerminal::setErrorMessage("Invalid frequency, expects (0,863000000-870000000)");
- else if (CommandTerminal::Dot()->getFrequencyBand() == mDot::FB_AU915)
- CommandTerminal::setErrorMessage("Invalid frequency, expects (0,915000000-928000000)");
- else
- CommandTerminal::setErrorMessage("Invalid frequency, expects (0,902000000-928000000)");
-
+ char tmp[256];
+ sprintf(tmp, "Invalid frequency, expects (0,%lu-%lu)", CommandTerminal::Dot()->getMinFrequency(), CommandTerminal::Dot()->getMaxFrequency());
+ CommandTerminal::setErrorMessage(tmp);
return false;
}
