         serial_byte_count = 0;
         payload_state = 2;
         rx_payload.unserialize(input_string);
-//        Serial.println();
-//        Serial.print(rx_payload.getDeviceId()); Serial.print(", ");
-//        Serial.print(rx_payload.getMsgId()); Serial.print(", ");
-//        Serial.print(rx_payload.getA()); Serial.print(", ");
-//        Serial.print(rx_payload.getB()); Serial.print(", ");
-//        Serial.print(rx_payload.getC()); Serial.print(", ");
-//        Serial.print(rx_payload.getD()); Serial.print(", ");
-//        Serial.print(rx_payload.getE()); Serial.print(", ");
-//        Serial.println(rx_payload.getF());
-        
       }
     } else {
       // Passthru other serial messages.
       //Serial.print(char(in));
       
-    }
-  }
-
-  uint8_t i;
-  // check if there are any new TCP clients
-  if (server.hasClient()) {
-    uint8_t allocated = 0;
-    for (i = 0; i < MAX_SRV_CLIENTS; i++) {
-      if (allocated == 0) {
-        //find free/disconnected spot
-        if (!serverClients[i] || !serverClients[i].connected()) {
-          if (serverClients[i]) {
-            serverClients[i].stop();
-          }
-          serverClients[i] = server.available();
-          serverClients[i].setNoDelay(true);
-          serverClients[i].setTimeout(100);
-          Serial.print("New client: "); Serial.println(i);
-          allocated = 1;
-        }
-      }
-    }
-    //no free/disconnected spot so reject
-    WiFiClient serverClient = server.available();
-    serverClient.stop();
-  }
-  
-  // check clients for data
-  for (i = 0; i < MAX_SRV_CLIENTS; i++) {
-    if (serverClients[i] && serverClients[i].connected()) {
-      if (serverClients[i].available()) {
-        // Ignore client input
-        serverClients[i].flush();
-      }
     }
   }
 


    // No need to ping if we're sending real data.
    ping_last = currentMillis;
    
    size_t len = Payload_SIZE;
    uint8_t sbuf[len];
    rx_payload.serialize(sbuf);

    // push payload data to all connected clients
    for(i = 0; i < MAX_SRV_CLIENTS; i++){
      if (serverClients[i] && serverClients[i].connected()) {
        if (!serverClients[i].write('\t')) { // Payload start byte
          serverClients[i].stop();
        }
        else {
          serverClients[i].write(sbuf, len);
          serverClients[i].write('\n');
        }
      }
    }
  } 
  // Keep TCP clients connected with a ping.
  else if (currentMillis - ping_last >= ping_interval) {
    ping_last = currentMillis;

    ping_payload.setMsgId(++ping_msg_id);
    //ping_payload.setF(1234);
    // Send a ping message.
    size_t len = Payload_SIZE;
    uint8_t sbuf[len];
    ping_payload.serialize(sbuf);

    // push payload data to all connected clients
    for(i = 0; i < MAX_SRV_CLIENTS; i++){
      if (serverClients[i] && serverClients[i].connected()) {
        if (!serverClients[i].write('\t')) { // Payload start byte
          serverClients[i].stop();
          Serial.print("Stopped: ");
          Serial.println(i);
        }
        else {
          serverClients[i].write(sbuf, len);
          serverClients[i].write('\n');
        }
      }
    }
  }


  // Update the display  
  if (currentMillis - previousMillis >= interval) {

  
}

void broadcast_udp() {
    size_t len = Payload_SIZE;
    uint8_t sbuf[len];
    rx_payload.serialize(sbuf);
    Udp.beginPacketMulticast(ipMulti, portMulti, WiFi.localIP());
    Udp.write('\t'); // Payload start byte
    Udp.write(sbuf, len);
    Udp.write('\n');
    Udp.endPacket();  
    Udp.stop();  
}

