![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Versão do protegemed que calcula o tempo em ms da fuga, calcula o numero de onverflow (valores muito baixo) e underflow (valores muito altos). Além disso, calcula um valor médio a partir dos valores capturados e não apenas pela fft.
Dependencies: EthernetInterface mbed-rtos mbed
Diff: Codes/TelnetCommands/telnet_setparam.cpp
- Revision:
- 0:c64e1194230b
diff -r 000000000000 -r c64e1194230b Codes/TelnetCommands/telnet_setparam.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Codes/TelnetCommands/telnet_setparam.cpp Wed Jul 09 21:16:23 2014 +0000 @@ -0,0 +1,100 @@ +#include "TelnetServer.h" + +#include "Settings.h" + +char *wrong_args_msg_set = "Wrong number of arguments.\r\n\r\nUsage: setparam <parameter name> <parameter value>\r\n"; +char *param_not_found_msg_set = "Parameter not found.\r\n\r\n"; +char *bad_argument_set = "The parameter supplied does not have a valid format.\r\n\r\n"; + +int TelnetServer::SetParamCommand(TCPSocketConnection *conn,char** argv,int argc) +{ + + if(argc != 3) + { + conn->send(wrong_args_msg_set,strlen(wrong_args_msg_set)); + return 0; + } + + + if(!strcmp(argv[1],"ipserver")) + { + ip_addr_t addr; + if(ipaddr_aton(argv[2],&addr) != ERR_OK) + { + conn->send(bad_argument_set,strlen(bad_argument_set)); + } + else + { + Settings::set_IpAddress(argv[2]); + Settings::WriteFile(); + } + return 0; + } + + if(!strcmp(argv[1],"module")) + { + Settings::set_ModuleNumber(atoi(argv[2])); + Settings::WriteFile(); + return 0; + } + + int i; + for(i=0;i<3;i++) + { + char b[12]; + sprintf(b,"outlet%d",i); + if(!strcmp(argv[1],b)) + { + Settings::set_Outlet(i,atoi(argv[2])); + Settings::WriteFile(); + return 0; + } + } + for(i=0;i<6;i++) + { + char b[12]; + sprintf(b,"gain%d",i); + if(!strcmp(argv[1],b)) + { + Settings::set_Gain(i,atof(argv[2])); + Settings::WriteFile(); + return 0; + } + + sprintf(b,"offset%d",i); + if(!strcmp(argv[1],b)) + { + Settings::set_Offset(i,atoi(argv[2])); + Settings::WriteFile(); + return 0; + } + + sprintf(b,"limit%d",i); + if(!strcmp(argv[1],b)) + { + Settings::set_Limit(i,atof(argv[2])); + Settings::WriteFile(); + return 0; + } + + sprintf(b,"outlet_number%d",i); + if(!strcmp(argv[1],b)) + { + Settings::set_OutletNumber(i,atoi(argv[2])); + Settings::WriteFile(); + return 0; + } + + sprintf(b,"purpose%d",i); + if(!strcmp(argv[1],b)) + { + Settings::set_Purpose(i,argv[2][0]); + Settings::WriteFile(); + return 0; + } + } + + conn->send(param_not_found_msg_set,strlen(param_not_found_msg_set)); + return 0; + +} \ No newline at end of file