added worlwide band support; modified join procedure
This commit is contained in:
parent
82eb2b5cff
commit
2be4721c68
@ -11,11 +11,11 @@ HAS_DISPLAY u8x8(MY_OLED_RST, MY_OLED_SCL, MY_OLED_SDA);
|
|||||||
const char lora_datarate[] = {"1211100908077BFSNA"};
|
const char lora_datarate[] = {"1211100908077BFSNA"};
|
||||||
#elif defined(CFG_us915)
|
#elif defined(CFG_us915)
|
||||||
const char lora_datarate[] = {"100908078CNA121110090807"};
|
const char lora_datarate[] = {"100908078CNA121110090807"};
|
||||||
#if defined(CFG_as923)
|
#elif defined(CFG_as923)
|
||||||
const char lora_datarate[] = {"1211100908077BFSNA"};
|
const char lora_datarate[] = {"1211100908077BFSNA"};
|
||||||
#if defined(CFG_au921)
|
#elif defined(CFG_au921)
|
||||||
const char lora_datarate[] = {"1211100908078CNA1211109C8C7C"};
|
const char lora_datarate[] = {"1211100908078CNA1211109C8C7C"};
|
||||||
#if defined(CFG_in866)
|
#elif defined(CFG_in866)
|
||||||
const char lora_datarate[] = {"121110090807FSNA"};
|
const char lora_datarate[] = {"121110090807FSNA"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ void get_hard_deveui(uint8_t *pdeveui) {
|
|||||||
uint8_t i2c_ret;
|
uint8_t i2c_ret;
|
||||||
|
|
||||||
// Init this just in case, no more to 100KHz
|
// 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.beginTransmission(MCP_24AA02E64_I2C_ADDRESS);
|
||||||
Wire.write(MCP_24AA02E64_MAC_ADDRESS);
|
Wire.write(MCP_24AA02E64_MAC_ADDRESS);
|
||||||
i2c_ret = Wire.endTransmission();
|
i2c_ret = Wire.endTransmission();
|
||||||
@ -249,6 +249,7 @@ void onEvent(ev_t ev) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_TXSTART:
|
case EV_TXSTART:
|
||||||
|
if (!(LMIC.opmode & OP_JOINING))
|
||||||
strcpy_P(buff, PSTR("TX START"));
|
strcpy_P(buff, PSTR("TX START"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ void lora_send(osjob_t *job) {
|
|||||||
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message,
|
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message,
|
||||||
SendBuffer.MessageSize, (cfg.countermode & 0x02));
|
SendBuffer.MessageSize, (cfg.countermode & 0x02));
|
||||||
ESP_LOGI(TAG, "%d bytes sent to LoRa", SendBuffer.MessageSize);
|
ESP_LOGI(TAG, "%d bytes sent to LoRa", SendBuffer.MessageSize);
|
||||||
//sprintf(display_line7, "PACKET QUEUED");
|
// sprintf(display_line7, "PACKET QUEUED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reschedule job every 0,5 - 1 sec. including a bit of random to prevent
|
// reschedule job every 0,5 - 1 sec. including a bit of random to prevent
|
||||||
|
14
src/main.cpp
14
src/main.cpp
@ -166,7 +166,21 @@ void setup() {
|
|||||||
ESP_LOGI(TAG, "Starting LMIC...");
|
ESP_LOGI(TAG, "Starting LMIC...");
|
||||||
os_init(); // initialize lmic run-time environment on core 1
|
os_init(); // initialize lmic run-time environment on core 1
|
||||||
LMIC_reset(); // initialize lmic MAC
|
LMIC_reset(); // initialize lmic MAC
|
||||||
|
LMIC_setLinkCheckMode(0);
|
||||||
LMIC_setClockError(MAX_CLOCK_ERROR * CLOCK_ERROR_PROCENTAGE / 100);
|
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
|
LMIC_startJoining(); // start joining
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user