     } else if (strcmp(appEui, "0000000000000000") == 0) {
       ttn.personalize(devAddr, nwkSKey, appSKey);
     } else {
-      ttn.join();
+      ttn.join(RETRIES, 10000);
     }
     joined_network = 1;
   }

#define COMMISSIONING_MODE  1
#define APPS_STATE          2

//TheThingsNetwork anonymous config
static const char *devAddr = "26011F0F";
static const char *nwkSKey = "ADAFF80790E39125AD12F170768A6A97";

    }
    if(serialDataIn.startsWith("rejoin"))                               //rejoins LoRa network with new keys (i.e. reboot)
    {
      joined_network = ttn.join(RETRIES, 10000);         //Join TTN network and show progress on via serial
      if (joined_network) {
        usbserial.print("ack\n");
        current_state = APPS_STATE;
