lib/RFM69/RFM69_ATC.cpp
//=============================================================================
// interruptHook() - gets called by the base class interrupt handler right after the header is fetched.
//=============================================================================
gets called by the base class interrupt handler right after the header is fetched.
gets called by the base class interrupt handler right after the header is fetched .
void RFM69_ATC::interruptHook(uint8_t CTLbyte) {
  ACK_RSSI_REQUESTED = CTLbyte & RFM69_CTL_RESERVE1; 
  if (ACK_RECEIVED && ACK_RSSI_REQUESTED) {
    if (DATALEN >= 1) {
      _ackRSSI = -1 * _spi->transfer(0); 
      DATALEN -= 1;   
      if (_targetRSSI != 0) {
        uint8_t maxLevel = _isRFM69HW ? 23 : 31;
        if (_ackRSSI < _targetRSSI && _powerLevel < maxLevel) {
          _powerLevel += _transmitLevelStep;
        }
        else if (_ackRSSI > _targetRSSI && _powerLevel > 0)
          _powerLevel--;
      }
    }
  }
}
void RFM69_ATC :: interruptHook ( uint8_t CTLbyte ) { ACK_RSSI_REQUESTED = CTLbyte & RFM69_CTL_RESERVE1 ; if ( ACK_RECEIVED && ACK_RSSI_REQUESTED ) { if ( DATALEN >= 1 ) { _ackRSSI = -1 * _spi -> transfer ( 0 ) ; DATALEN -= 1 ; if ( _targetRSSI != 0 ) { uint8_t maxLevel = _isRFM69HW ? 23 : 31 ; if ( _ackRSSI < _targetRSSI && _powerLevel < maxLevel ) { _powerLevel += _transmitLevelStep ; } else if ( _ackRSSI > _targetRSSI && _powerLevel > 0 ) _powerLevel -- ; } } } }
interruptHook() - gets called by the base class interrupt handler right after the header is fetched.
interruptHook () - gets called by the base class interrupt handler right after the header is fetched .
// TomWS1: extract the ACK RSSI request bit (could potentially merge with ACK_REQUESTED) // TomWS1: now see if this was an ACK with an ACK_RSSI response // the next two bytes contain the ACK_RSSI (assuming the datalength is valid) //rssi was sent as single byte positive value, get the real value by * -1 // and compensate data length accordingly // TomWS1: Now dither transmitLevel value (register update occurs later when transmitting);