 lmic_event_cb_t myEventCb;
 lmic_rxmessage_cb_t myRxMessageCb;
 
+const char * const evNames[] = {
+    "<<zero>>",
+    "EV_SCAN_TIMEOUT", "EV_BEACON_FOUND",
+    "EV_BEACON_MISSED", "EV_BEACON_TRACKED", "EV_JOINING",
+    "EV_JOINED", "EV_RFU1", "EV_JOIN_FAILED", "EV_REJOIN_FAILED",
+    "EV_TXCOMPLETE", "EV_LOST_TSYNC", "EV_RESET",
+    "EV_RXCOMPLETE", "EV_LINK_DEAD", "EV_LINK_ALIVE", "EV_SCAN_FOUND",
+    "EV_TXSTART", "EV_TXCANCELED", "EV_RXSTART", "EV_JOIN_TXCOMPLETE"
+};
 
 /*
 

                              Serial.print("-");
                      Serial.print(nwkKey[i], HEX);
              }
              Serial.println("");
            }
            break;
        /*

    // Reset the MAC state. Session and pending data transfers will be discarded.
    LMIC_reset();

    LMIC_setClockError(5 * MAX_CLOCK_ERROR / 100);

    // do the network-specific setup prior to join.
    setupForNetwork(false);

    // Start job (sending automatically starts OTAA too)
    do_send(&sendjob);
}

void setupForNetwork(bool preJoin) {
#if defined(CFG_us915)
    LMIC_selectSubBand(1);

    if (! preJoin) {
//        LMIC_setLinkCheckMode(0);
//        LMIC_setDrTxpow(DR_SF7, 14);
    }
#endif
}

void loop() {
    os_runloop_once();
    while ((LMIC.opmode & OP_TXRXPEND) == 0 && 
           ! os_queryTimeCriticalJobs(ms2osticks(1000)) &&
           eventPrintOne())
        ;
}
