mDot AT-Firmware for testing
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/CmdWakePin.cpp
- Revision:
- 9:ff62b20f7000
- Parent:
- 4:666017851052
- Child:
- 14:f9a77400b622
--- a/CommandTerminal/CmdWakePin.cpp Mon Apr 04 13:17:44 2016 +0000 +++ b/CommandTerminal/CmdWakePin.cpp Mon Apr 04 09:00:31 2016 -0500 @@ -2,10 +2,10 @@ CmdWakePin::CmdWakePin(mDot* dot, mts::MTSSerial& serial) : - Command(dot, "Wake Pin", "AT+WP", "Wakeup DIO pin of sleep mode (default: DI8), deep-sleep uses DIO7"), + Command(dot, "Wake Pin", "AT+WP", "Wakeup DIO pin of sleep mode (1-8) (default: DI8, 1:DIN), deep-sleep uses DIO7"), _serial(serial) { _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(2-8)"; + _usage = "(1-8)"; _queryable = true; } @@ -16,9 +16,8 @@ _serial.writef("%s\r\n", mDot::pinName2Str(_dot->getWakePin()).c_str()); } else if (args.size() == 2) { - int32_t code; - uint32_t pin; - sscanf(args[1].c_str(), "%lu", &pin); + int pin; + sscanf(args[1].c_str(), "%d", &pin); _dot->setWakePin(mDot::pinNum2Name(pin)); } @@ -31,14 +30,14 @@ return true; if (args.size() == 2) { - uint32_t pin; - if (sscanf(args[1].c_str(), "%lu", &pin) != 1) { + int pin; + if (sscanf(args[1].c_str(), "%d", &pin) != 1) { setErrorMessage("Invalid argument"); return false; } - if (pin < 2 || pin > 8) { - setErrorMessage("Invalid pin, expects (2-8)"); + if (pin < 1 || pin > 8) { + setErrorMessage("Invalid pin, expects (1-8)"); return false; }