示例#1
0
static void cmd_webserver(Stream *chp, int argc, char* argv[])
{
   if (argc < 1) {
      chprintf(chp, "Usage: webserver on|off|info|auth\r\n");
   }
   else if (strncasecmp("on", argv[0], 2) == 0) { 
     chprintf(chp, "***** HTTP SERVER ON *****\r\n");
     SET_BYTE_PARAM(HTTP_ON, 1);
     wifi_restart();
   }
   else if (strncasecmp("off", argv[0], 2) == 0) {
     chprintf(chp, "***** HTTP SERVER OFF *****\r\n");
     SET_BYTE_PARAM(HTTP_ON, 0);
     wifi_restart();
   }
   else if (strncasecmp("info", argv[0], 2) == 0) {
      chprintf(chp, "Webserver is %s\r\n", (GET_BYTE_PARAM(HTTP_ON) ? "on" : "off"));
   }
   else if (strncasecmp("auth", argv[0], 3) == 0) {
      chprintf(chp, "Enter username: "******"Enter password: "******"Ok\r\n");
      }
   }
}
示例#2
0
char* parseSymbol(char* val, char* buf)
{
   if (strlen(val) != 2) 
      sprintf(buf, "ERROR. Symbol should be two characters");
   else {
      SET_BYTE_PARAM(SYMBOL_TAB, val[0]);
      SET_BYTE_PARAM(SYMBOL, val[1]);
      sprintf(buf, "OK");
   }
   return buf;
}
示例#3
0
void reset_params()
{
    /* If version was changed */
    if ( GET_BYTE_PARAM(VERSION_KEY) < CURRENT_VERSION_KEY )
    {
        /* Some of the EEPROM parameters may need to be reset */
        SET_BYTE_PARAM(VERSION_KEY, CURRENT_VERSION_KEY);
    }
}
示例#4
0
char* parseDigipathTokens(int argc, char* argv[], char* buf)
{
   __digilist_t digis;
   uint8_t ndigis;
   if (argc==1 && strncasecmp("off", argv[0], 3)==0)
      ndigis = 0;
   else {
      ndigis = args2digis(digis, argc, argv);
      SET_PARAM(DIGIS, digis);     
   }
   SET_BYTE_PARAM(NDIGIS, ndigis);
   sprintf(buf, "OK");
   return buf;
}
示例#5
0
static void cmd_setvolume(Stream *chp, int argc, char *argv[]) {
  uint8_t vol=0;
  if (argc==0)
     vol= GET_BYTE_PARAM(TRX_VOLUME);
  else {
     if (argc > 0) 
        sscanf(argv[0], "%hhu", &vol);
     if (vol>8) vol=8;
  
     SET_BYTE_PARAM(TRX_VOLUME, vol);
     radio_setVolume(vol);
  }
  chprintf(chp, "VOLUME: %d\r\n", vol);
}
示例#6
0
static void cmd_setsquelch(Stream *chp, int argc, char *argv[]) {
   uint8_t sq=0;
   if (argc == 0)
      sq = GET_BYTE_PARAM(TRX_SQUELCH);
   else {
      if (argc > 0) 
         sscanf(argv[0], "%hhu", &sq);
      if (sq>8) sq=8; 
      
      SET_BYTE_PARAM(TRX_SQUELCH, sq);
      radio_setSquelch(sq);
   }
   chprintf(chp, "SQUELCH: %d\r\n", sq); 
}