added worlwide band support; modified join procedure

This commit is contained in:
Klaus K Wilting 2018-10-22 14:06:47 +02:00
parent 82eb2b5cff
commit 2be4721c68
3 changed files with 21 additions and 6 deletions

View File

@ -11,11 +11,11 @@ HAS_DISPLAY u8x8(MY_OLED_RST, MY_OLED_SCL, MY_OLED_SDA);
const char lora_datarate[] = {"1211100908077BFSNA"};
#elif defined(CFG_us915)
const char lora_datarate[] = {"100908078CNA121110090807"};
#if defined(CFG_as923)
#elif defined(CFG_as923)
const char lora_datarate[] = {"1211100908077BFSNA"};
#if defined(CFG_au921)
#elif defined(CFG_au921)
const char lora_datarate[] = {"1211100908078CNA1211109C8C7C"};
#if defined(CFG_in866)
#elif defined(CFG_in866)
const char lora_datarate[] = {"121110090807FSNA"};
#endif

View File

@ -112,7 +112,7 @@ void get_hard_deveui(uint8_t *pdeveui) {
uint8_t i2c_ret;
// Init this just in case, no more to 100KHz
Wire.begin(SDA, SCL, 100000);
Wire.begin(MY_OLED_SDA, MY_OLED_SCL, 100000);
Wire.beginTransmission(MCP_24AA02E64_I2C_ADDRESS);
Wire.write(MCP_24AA02E64_MAC_ADDRESS);
i2c_ret = Wire.endTransmission();
@ -249,6 +249,7 @@ void onEvent(ev_t ev) {
break;
case EV_TXSTART:
if (!(LMIC.opmode & OP_JOINING))
strcpy_P(buff, PSTR("TX START"));
break;

View File

@ -166,7 +166,21 @@ void setup() {
ESP_LOGI(TAG, "Starting LMIC...");
os_init(); // initialize lmic run-time environment on core 1
LMIC_reset(); // initialize lmic MAC
LMIC_setLinkCheckMode(0);
LMIC_setClockError(MAX_CLOCK_ERROR * CLOCK_ERROR_PROCENTAGE / 100);
#ifdef CFG_US915
// Set the data rate to Spreading Factor 7. This is the fastest supported
// rate for 125 kHz channels, and it minimizes air time and battery power. Set
// the transmission power to 14 dBi (25 mW).
LMIC_setDrTxpow(DR_SF7, 14);
// in the US, with TTN, it saves join time if we start on subband 1 (channels
// 8-15). This will get overridden after the join by parameters from the
// network. If working with other networks or in other regions, this will need
// to be changed.
LMIC_selectSubBand(1);
#endif
LMIC_startJoining(); // start joining
#endif