![](/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
Codes/TelnetCommands/telnet_setparam.cpp
- Committer:
- rebonatto
- Date:
- 2014-07-21
- Revision:
- 2:86c3cb25577b
- Parent:
- 0:c64e1194230b
File content as of revision 2:86c3cb25577b:
#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; }