![](/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
CommandTerminal/CmdDisableDutyCycle.cpp@18:f5d28d621bb0, 2018-03-02 (annotated)
- Committer:
- pferland
- Date:
- Fri Mar 02 20:01:38 2018 +0000
- Revision:
- 18:f5d28d621bb0
- Parent:
- 14:f9a77400b622
Added ability to force the AT terminal to use the USB debug port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
14:f9a77400b622 | 1 | #include "CmdDisableDutyCycle.h" |
Mike Fiore |
14:f9a77400b622 | 2 | |
Mike Fiore |
14:f9a77400b622 | 3 | CmdDisableDutyCycle::CmdDisableDutyCycle() |
Mike Fiore |
14:f9a77400b622 | 4 | : Command("Disable Duty Cycle", "AT+DD", "Disable duty cycle for TESTING PURPOSES ONLY!!! This setting will not be saved to config.", "(0-1)") { |
Mike Fiore |
14:f9a77400b622 | 5 | _queryable = true; |
Mike Fiore |
14:f9a77400b622 | 6 | } |
Mike Fiore |
14:f9a77400b622 | 7 | |
Mike Fiore |
14:f9a77400b622 | 8 | uint32_t CmdDisableDutyCycle::action(std::vector<std::string> args) { |
Mike Fiore |
14:f9a77400b622 | 9 | |
Mike Fiore |
14:f9a77400b622 | 10 | if (args.size() == 1) { |
Mike Fiore |
14:f9a77400b622 | 11 | CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getDisableDutyCycle()); |
Mike Fiore |
14:f9a77400b622 | 12 | } else if (args.size() == 2) { |
Mike Fiore |
14:f9a77400b622 | 13 | CommandTerminal::Dot()->setDisableDutyCycle(args[1] == "1"); |
Mike Fiore |
14:f9a77400b622 | 14 | } |
Mike Fiore |
14:f9a77400b622 | 15 | |
Mike Fiore |
14:f9a77400b622 | 16 | return 0; |
Mike Fiore |
14:f9a77400b622 | 17 | } |
Mike Fiore |
14:f9a77400b622 | 18 | |
Mike Fiore |
14:f9a77400b622 | 19 | bool CmdDisableDutyCycle::verify(std::vector<std::string> args) { |
Mike Fiore |
14:f9a77400b622 | 20 | |
Mike Fiore |
14:f9a77400b622 | 21 | if (args.size() > 2) { |
Mike Fiore |
14:f9a77400b622 | 22 | CommandTerminal::setErrorMessage("Invalid parameter, expects (0-1)"); |
Mike Fiore |
14:f9a77400b622 | 23 | return false; |
Mike Fiore |
14:f9a77400b622 | 24 | } |
Mike Fiore |
14:f9a77400b622 | 25 | |
Mike Fiore |
14:f9a77400b622 | 26 | if (args.size() == 2) { |
Mike Fiore |
14:f9a77400b622 | 27 | int bytes; |
Mike Fiore |
14:f9a77400b622 | 28 | |
Mike Fiore |
14:f9a77400b622 | 29 | sscanf(args[1].c_str(), "%d", &bytes); |
Mike Fiore |
14:f9a77400b622 | 30 | |
Mike Fiore |
14:f9a77400b622 | 31 | if (!(bytes == 0 || bytes == 1)) { |
Mike Fiore |
14:f9a77400b622 | 32 | CommandTerminal::setErrorMessage("Invalid parameter, expects (0-1)"); |
Mike Fiore |
14:f9a77400b622 | 33 | return false; |
Mike Fiore |
14:f9a77400b622 | 34 | } |
Mike Fiore |
14:f9a77400b622 | 35 | } |
Mike Fiore |
14:f9a77400b622 | 36 | |
Mike Fiore |
14:f9a77400b622 | 37 | return true; |
Mike Fiore |
14:f9a77400b622 | 38 | } |