 }
 
 static void rxtimeout_func(osjob_t *job) {
-  #ifdef LED_RED
-  digitalWrite(LED_RED, LOW); // on
-  digitalWrite(LED_GREEN, HIGH); // off
-  #else
   digitalWrite(LED_BUILTIN, LOW); // off
-  #endif
 }
 
 static void rx_func (osjob_t* job) {
-  #ifdef LED_RED
-  digitalWrite(LED_RED, HIGH); // off
-  digitalWrite(LED_GREEN, HIGH); // off
-  delay(10);
-  digitalWrite(LED_GREEN, LOW); // on
-  #else
-  digitalWrite(LED_BUILTIN, HIGH); // off
+  // Blink once to confirm reception and then keep the led on
+  digitalWrite(LED_BUILTIN, LOW); // off
   delay(10);
   digitalWrite(LED_BUILTIN, HIGH); // on
-  #endif
 
-  // Timeout RX (i.e. update led status) after 1 second without RX
-  os_setTimedCallback(&timeoutjob, os_getTime() + ms2osticks(2500), rxtimeout_func);
+  // Timeout RX (i.e. update led status) after 3 periods without RX
+  os_setTimedCallback(&timeoutjob, os_getTime() + ms2osticks(3*TX_INTERVAL), rxtimeout_func);
 
   // Reschedule TX so that it should not collide with the other side's
   // next TX
-  os_setTimedCallback(&txjob, os_getTime() + ms2osticks(500), tx_func);
+  os_setTimedCallback(&txjob, os_getTime() + ms2osticks(TX_INTERVAL/2), tx_func);
 
   Serial.print("Got ");
   Serial.print(LMIC.dataLen);

static void tx_func (osjob_t* job) {
  // say hello
  tx("Hello, world!", txdone_func);
  // reschedule job every 1000-1500ms, unless packets are received, then
  // rx_func will reschedule more often
  os_setTimedCallback(job, os_getTime() + ms2osticks(1000 + random(500)), tx_func);
}

// application entry point

  delay(1000);
  #endif

  pinMode(LED_BUILTIN, OUTPUT);

  // initialize runtime env
  os_init();

  // Set up these settings once, and use them for both TX and RX

  // Use a frequency in the g3 which allows 10% duty cycling.
  LMIC.freq = 869525000;
  // Maximum TX power
  LMIC.txpow = 27;
  // Use a medium spread factor. This can be increased up to SF12 for
  // better range, but then the interval should be (significantly)
  // lowered to comply with duty cycle limits as well.
  LMIC.datarate = DR_SF9;
  // This sets CR 4/5, BW125 (except for DR_SF7B, which uses BW250)
  LMIC.rps = updr2rps(LMIC.datarate);

  Serial.println("Started");
