mDot AT-Firmware for testing

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Revision:
14:f9a77400b622
Parent:
9:ff62b20f7000
--- a/CommandTerminal/CmdWakePin.cpp	Fri Nov 04 19:10:24 2016 +0000
+++ b/CommandTerminal/CmdWakePin.cpp	Fri Nov 04 14:25:43 2016 -0500
@@ -1,25 +1,23 @@
 #include "CmdWakePin.h"
 
-CmdWakePin::CmdWakePin(mDot* dot, mts::MTSSerial& serial)
-:
-  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 = "(1-8)";
+CmdWakePin::CmdWakePin()
+#if defined(TARGET_MTS_MDOT_F411RE)
+: Command("Wake Pin", "AT+WP", "Wakeup DIO pin of sleep mode (1-8) (default: DI8, 1:DIN), deep-sleep uses DIO7", "(1-8)")
+#else
+: Command("Wake Pin", "AT+WP", "Wakeup GPIO pin of sleep mode (1-6) (default: WAKE, 1:UART1_RX), deep-sleep uses WAKE", "(1-6)")
+#endif /* TARGET_MTS_MDOT_F411RE */
+   {
     _queryable = true;
 }
 
 uint32_t CmdWakePin::action(std::vector<std::string> args) {
     if (args.size() == 1) {
-        if (_dot->getVerbose())
-            _serial.writef("%s: ", name());
-
-        _serial.writef("%s\r\n", mDot::pinName2Str(_dot->getWakePin()).c_str());
+        CommandTerminal::Serial()->writef("%s\r\n", mDot::pinName2Str(CommandTerminal::Dot()->getWakePin()).c_str());
     } else if (args.size() == 2) {
         int pin;
         sscanf(args[1].c_str(), "%d", &pin);
 
-        _dot->setWakePin(mDot::pinNum2Name(pin));
+        CommandTerminal::Dot()->setWakePin(mDot::pinNum2Name(pin));
     }
 
     return 0;
@@ -32,18 +30,23 @@
     if (args.size() == 2) {
         int pin;
         if (sscanf(args[1].c_str(), "%d", &pin) != 1) {
-            setErrorMessage("Invalid argument");
+            CommandTerminal::setErrorMessage("Invalid argument");
             return false;
         }
 
+#if defined(TARGET_MTS_MDOT_F411RE)
         if (pin < 1 || pin > 8) {
-            setErrorMessage("Invalid pin, expects (1-8)");
+            CommandTerminal::setErrorMessage("Invalid pin, expects (1-8)");
+#else
+        if (pin < 1 || pin > 6) {
+            CommandTerminal::setErrorMessage("Invalid pin, expects (1-6)");
+#endif /* TARGET_MTS_MDOT_F411RE */
             return false;
         }
 
         return true;
     }
 
-    setErrorMessage("Invalid arguments");
+    CommandTerminal::setErrorMessage("Invalid arguments");
     return false;
 }