Skip to content

Commit d82b2a2

Browse files
authored
Merge branch 'ripplebiz:dev' into dev
2 parents 539f99a + eb978f1 commit d82b2a2

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/helpers/CustomLR1110.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,35 @@ class CustomLR1110 : public LR1110 {
99
public:
1010
CustomLR1110(Module *mod) : LR1110(mod) { }
1111

12+
RadioLibTime_t getTimeOnAir(size_t len) override {
13+
uint32_t symbolLength_us = ((uint32_t)(1000 * 10) << this->spreadingFactor) / (this->bandwidthKhz * 10) ;
14+
uint8_t sfCoeff1_x4 = 17; // (4.25 * 4)
15+
uint8_t sfCoeff2 = 8;
16+
if(this->spreadingFactor == 5 || this->spreadingFactor == 6) {
17+
sfCoeff1_x4 = 25; // 6.25 * 4
18+
sfCoeff2 = 0;
19+
}
20+
uint8_t sfDivisor = 4*this->spreadingFactor;
21+
if(symbolLength_us >= 16000) {
22+
sfDivisor = 4*(this->spreadingFactor - 2);
23+
}
24+
const int8_t bitsPerCrc = 16;
25+
const int8_t N_symbol_header = this->headerType == RADIOLIB_SX126X_LORA_HEADER_EXPLICIT ? 20 : 0;
26+
27+
// numerator of equation in section 6.1.4 of SX1268 datasheet v1.1 (might not actually be bitcount, but it has len * 8)
28+
int16_t bitCount = (int16_t) 8 * len + this->crcTypeLoRa * bitsPerCrc - 4 * this->spreadingFactor + sfCoeff2 + N_symbol_header;
29+
if(bitCount < 0) {
30+
bitCount = 0;
31+
}
32+
// add (sfDivisor) - 1 to the numerator to give integer CEIL(...)
33+
uint16_t nPreCodedSymbols = (bitCount + (sfDivisor - 1)) / (sfDivisor);
34+
35+
// preamble can be 65k, therefore nSymbol_x4 needs to be 32 bit
36+
uint32_t nSymbol_x4 = (this->preambleLengthLoRa + 8) * 4 + sfCoeff1_x4 + nPreCodedSymbols * (this->codingRate + 4) * 4;
37+
38+
return((symbolLength_us * nSymbol_x4) / 4);
39+
}
40+
1241
bool isReceiving() {
1342
uint16_t irq = getIrqStatus();
1443
bool detected = ((irq & LR1110_IRQ_HEADER_VALID) || (irq & LR1110_IRQ_HAS_PREAMBLE));

variants/heltec_wireless_paper/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ build_flags =
4040
-D MAX_CONTACTS=100
4141
-D MAX_GROUP_CHANNELS=8
4242
-D DISPLAY_CLASS=E213Display
43-
-D BLE_PIN_CODE=0 ; dynamic, random PIN
43+
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
4444
-D BLE_DEBUG_LOGGING=1
4545
-D OFFLINE_QUEUE_SIZE=256
4646
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}

variants/heltec_wireless_paper/target.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
#define RADIOLIB_STATIC_ONLY 1
44
#include <RadioLib.h>
5-
#include <helpers/AutoDiscoverRTCClock.h>
6-
#include <helpers/CustomSX1262Wrapper.h>
7-
#include <helpers/HeltecV3Board.h>
85
#include <helpers/RadioLibWrappers.h>
6+
#include <helpers/HeltecV3Board.h>
7+
#include <helpers/CustomSX1262Wrapper.h>
8+
#include <helpers/AutoDiscoverRTCClock.h>
99
#include <helpers/SensorManager.h>
1010
#ifdef DISPLAY_CLASS
1111
#include <helpers/ui/E213Display.h>

0 commit comments

Comments
 (0)