[SX128x] Fixed type conflict in max()
This commit is contained in:
parent
46be852915
commit
7c9f422e0c
1 changed files with 5 additions and 5 deletions
|
@ -841,8 +841,8 @@ uint32_t SX128x::getTimeOnAir(size_t len) {
|
||||||
|
|
||||||
// get SF coefficients
|
// get SF coefficients
|
||||||
float coeff1 = 0;
|
float coeff1 = 0;
|
||||||
uint8_t coeff2 = 0;
|
int16_t coeff2 = 0;
|
||||||
uint8_t coeff3 = 0;
|
int16_t coeff3 = 0;
|
||||||
if(sf < 7) {
|
if(sf < 7) {
|
||||||
// SF5, SF6
|
// SF5, SF6
|
||||||
coeff1 = 6.25;
|
coeff1 = 6.25;
|
||||||
|
@ -861,13 +861,13 @@ uint32_t SX128x::getTimeOnAir(size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get CRC length
|
// get CRC length
|
||||||
uint8_t N_bitCRC = 16;
|
int16_t N_bitCRC = 16;
|
||||||
if(_crcLoRa == SX128X_LORA_CRC_OFF) {
|
if(_crcLoRa == SX128X_LORA_CRC_OFF) {
|
||||||
N_bitCRC = 0;
|
N_bitCRC = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get header length
|
// get header length
|
||||||
uint8_t N_symbolHeader = 20;
|
int16_t N_symbolHeader = 20;
|
||||||
if(_headerType == SX128X_LORA_HEADER_IMPLICIT) {
|
if(_headerType == SX128X_LORA_HEADER_IMPLICIT) {
|
||||||
N_symbolHeader = 0;
|
N_symbolHeader = 0;
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,7 @@ uint32_t SX128x::getTimeOnAir(size_t len) {
|
||||||
uint32_t N_symbolPreamble = (_preambleLengthLoRa & 0x0F) * (uint32_t(1) << ((_preambleLengthLoRa & 0xF0) >> 4));
|
uint32_t N_symbolPreamble = (_preambleLengthLoRa & 0x0F) * (uint32_t(1) << ((_preambleLengthLoRa & 0xF0) >> 4));
|
||||||
|
|
||||||
// calculate the number of symbols
|
// calculate the number of symbols
|
||||||
N_symbol = (float)N_symbolPreamble + coeff1 + 8.0 + ceil(max(8 * len + N_bitCRC - coeff2 + N_symbolHeader, 0) / (float)coeff3) * (float)(_cr + 4);
|
N_symbol = (float)N_symbolPreamble + coeff1 + 8.0 + ceil(max((int16_t)(8 * len + N_bitCRC - coeff2 + N_symbolHeader), (int16_t)0) / (float)coeff3) * (float)(_cr + 4);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// long interleaving - abandon hope all ye who enter here
|
// long interleaving - abandon hope all ye who enter here
|
||||||
|
|
Loading…
Add table
Reference in a new issue