with 36errors
Dependencies: MTS-Serial libxDot-dev-mbed5-deprecated
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 Wed Jul 13 2022 06:20:58 by 1.7.2