ATC custom transmitLevelStep++
This commit is contained in:
parent
90c6606a9d
commit
065c912125
|
|
@ -42,6 +42,7 @@ bool RFM69_ATC::initialize(uint8_t freqBand, uint16_t nodeID, uint8_t networkID)
|
||||||
ACK_RSSI_REQUESTED = 0; // TomWS1: init to none
|
ACK_RSSI_REQUESTED = 0; // TomWS1: init to none
|
||||||
//_powerBoost = false; // TomWS1: require someone to explicitly turn boost on!
|
//_powerBoost = false; // TomWS1: require someone to explicitly turn boost on!
|
||||||
_transmitLevel = 31; // TomWS1: match default value in PA Level register
|
_transmitLevel = 31; // TomWS1: match default value in PA Level register
|
||||||
|
_transmitLevelStep = 1; //increment 1 step at a time by default
|
||||||
return RFM69::initialize(freqBand, nodeID, networkID); // use base class to initialize most everything
|
return RFM69::initialize(freqBand, nodeID, networkID); // use base class to initialize most everything
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,8 +149,14 @@ void RFM69_ATC::interruptHook(uint8_t CTLbyte) {
|
||||||
// if (_ackRSSI < _targetRSSI && _transmitLevel < 51) _transmitLevel++;
|
// if (_ackRSSI < _targetRSSI && _transmitLevel < 51) _transmitLevel++;
|
||||||
// else if (_ackRSSI > _targetRSSI && _transmitLevel > 32) _transmitLevel--;
|
// else if (_ackRSSI > _targetRSSI && _transmitLevel > 32) _transmitLevel--;
|
||||||
// } else {
|
// } else {
|
||||||
if (_ackRSSI < _targetRSSI && _transmitLevel < 31) { _transmitLevel++; /*Serial.println("\n ======= _transmitLevel ++ ======");*/ }
|
if (_ackRSSI < _targetRSSI && _transmitLevel < 31)
|
||||||
else if (_ackRSSI > _targetRSSI && _transmitLevel > 0) { _transmitLevel--; /*Serial.println("\n ======= _transmitLevel -- ======");*/ }
|
{
|
||||||
|
//_transmitLevel++;
|
||||||
|
_transmitLevel += _transmitLevelStep;
|
||||||
|
if (_transmitLevel > 31) _transmitLevel = 31;
|
||||||
|
}
|
||||||
|
else if (_ackRSSI > _targetRSSI && _transmitLevel > 0)
|
||||||
|
_transmitLevel--;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -166,14 +173,14 @@ bool RFM69_ATC::sendWithRetry(uint16_t toAddress, const void* buffer, uint8_t bu
|
||||||
send(toAddress, buffer, bufferSize, true);
|
send(toAddress, buffer, bufferSize, true);
|
||||||
sentTime = millis();
|
sentTime = millis();
|
||||||
while (millis() - sentTime < retryWaitTime)
|
while (millis() - sentTime < retryWaitTime)
|
||||||
{
|
if (ACKReceived(toAddress)) return true;
|
||||||
if (ACKReceived(toAddress))
|
if (_transmitLevel < 31) {
|
||||||
{
|
//_transmitLevel++;
|
||||||
return true;
|
_transmitLevel += _transmitLevelStep;
|
||||||
}
|
if (_transmitLevel > 31) _transmitLevel = 31;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_transmitLevel < 31) _transmitLevel++;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ class RFM69_ATC: public RFM69 {
|
||||||
uint8_t setLNA(uint8_t newReg); // TWS: function to control LNA reg for power testing purposes
|
uint8_t setLNA(uint8_t newReg); // TWS: function to control LNA reg for power testing purposes
|
||||||
int16_t _targetRSSI; // if non-zero then this is the desired end point RSSI for our transmission
|
int16_t _targetRSSI; // if non-zero then this is the desired end point RSSI for our transmission
|
||||||
uint8_t _transmitLevel; // saved powerLevel in case we do auto power adjustment, this value gets dithered
|
uint8_t _transmitLevel; // saved powerLevel in case we do auto power adjustment, this value gets dithered
|
||||||
|
uint8_t _transmitLevelStep; // saved powerLevel in case we do auto power adjustment, this value gets dithered
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void interruptHook(uint8_t CTLbyte);
|
void interruptHook(uint8_t CTLbyte);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue