![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
AT terminal for the mDot using the USB debug port instead of the serial port.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdJoinRx2Frequency.cpp
- Revision:
- 16:d5cf2af81a6d
- Parent:
- 14:f9a77400b622
--- a/CommandTerminal/CmdJoinRx2Frequency.cpp Fri Nov 04 17:04:54 2016 -0500 +++ b/CommandTerminal/CmdJoinRx2Frequency.cpp Mon Jun 19 14:33:21 2017 -0500 @@ -10,17 +10,18 @@ uint32_t CmdJoinRx2Frequency::action(std::vector<std::string> args) { if (args.size() == 1) - { + { CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getJoinRx2Frequency()); } else if (args.size() == 2) - { + { int frequency = 0; sscanf(args[1].c_str(), "%d", &frequency); if (CommandTerminal::Dot()->setJoinRx2Frequency(frequency) != mDot::MDOT_OK) - { - CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; + { + CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); + ; return 1; } } @@ -32,8 +33,7 @@ if (args.size() == 1) return true; - if (args.size() == 2) - { + if (args.size() == 2) { int frequency = ULONG_MAX; if (sscanf(args[1].c_str(), "%d", &frequency) != 1) { CommandTerminal::setErrorMessage("Invalid argument"); @@ -41,16 +41,11 @@ } 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; } - return true; }