mDot AT-Firmware for testing
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdTxPower.cpp
- Revision:
- 9:ff62b20f7000
- Parent:
- 1:e52ae6584f1c
- Child:
- 14:f9a77400b622
--- a/CommandTerminal/CmdTxPower.cpp Mon Apr 04 13:17:44 2016 +0000 +++ b/CommandTerminal/CmdTxPower.cpp Mon Apr 04 09:00:31 2016 -0500 @@ -1,10 +1,10 @@ #include "CmdTxPower.h" CmdTxPower::CmdTxPower(mDot* dot, mts::MTSSerial& serial) : - Command(dot, "Tx Power", "AT+TXP", "Set the Tx power for all channels"), _serial(serial) + Command(dot, "Tx Power", "AT+TXP", "Set the radio TX power before antenna gain in dBm"), _serial(serial) { _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(2-20)"; + _usage = "(0-20)"; _queryable = true; } @@ -20,13 +20,12 @@ else if (args.size() == 2) { int32_t code; - uint32_t power = 0; - sscanf(args[1].c_str(), "%lu", &power); + int power = 0; + sscanf(args[1].c_str(), "%d", &power); if ((code = _dot->setTxPower(power)) != mDot::MDOT_OK) { - std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError(); - setErrorMessage(error); + setErrorMessage(_dot->getLastError());; return 1; } } @@ -41,15 +40,15 @@ if (args.size() == 2) { - uint32_t power = 0; - if (sscanf(args[1].c_str(), "%lu", &power) != 1) { + int power = 0; + if (sscanf(args[1].c_str(), "%d", &power) != 1) { setErrorMessage("Invalid argument"); return false; } - if (power < 2 || power > 20) + if (power < 0 || power > 20) { - setErrorMessage("Invalid power, expects (2-20)"); + setErrorMessage("Invalid power, expects (0-20)"); return false; }