Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CmdDisableDutyCycle.cpp
00001 #include "CmdDisableDutyCycle.h" 00002 00003 CmdDisableDutyCycle::CmdDisableDutyCycle() 00004 : Command("Disable Duty Cycle", "AT+DD", "Disable duty cycle for TESTING PURPOSES ONLY!!! This setting will not be saved to config.", "(0-1)") { 00005 _queryable = true; 00006 } 00007 00008 uint32_t CmdDisableDutyCycle::action(std::vector<std::string> args) { 00009 00010 if (args.size() == 1) { 00011 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getDisableDutyCycle()); 00012 } else if (args.size() == 2) { 00013 CommandTerminal::Dot()->setDisableDutyCycle(args[1] == "1"); 00014 } 00015 00016 return 0; 00017 } 00018 00019 bool CmdDisableDutyCycle::verify(std::vector<std::string> args) { 00020 00021 if (args.size() > 2) { 00022 CommandTerminal::setErrorMessage("Invalid parameter, expects (0-1)"); 00023 return false; 00024 } 00025 00026 if (args.size() == 2) { 00027 int bytes; 00028 00029 sscanf(args[1].c_str(), "%d", &bytes); 00030 00031 if (!(bytes == 0 || bytes == 1)) { 00032 CommandTerminal::setErrorMessage("Invalid parameter, expects (0-1)"); 00033 return false; 00034 } 00035 } 00036 00037 return true; 00038 }
Generated on Tue Jul 12 2022 20:40:03 by
