============================================================================= interruptHook() - gets called by the base class interrupt handler right after the header is fetched. =============================================================================
| 119 | // interruptHook() - gets called by the base class interrupt handler right after the header is fetched. |
| 120 | //============================================================================= |
| 121 | void RFM69_ATC::interruptHook(uint8_t CTLbyte) { |
| 122 | ACK_RSSI_REQUESTED = CTLbyte & RFM69_CTL_RESERVE1; // TomWS1: extract the ACK RSSI request bit (could potentially merge with ACK_REQUESTED) |
| 123 | // TomWS1: now see if this was an ACK with an ACK_RSSI response |
| 124 | if (ACK_RECEIVED && ACK_RSSI_REQUESTED) { |
| 125 | // the next two bytes contain the ACK_RSSI (assuming the datalength is valid) |
| 126 | if (DATALEN >= 1) { |
| 127 | _ackRSSI = -1 * _spi->transfer(0); //rssi was sent as single byte positive value, get the real value by * -1 |
| 128 | DATALEN -= 1; // and compensate data length accordingly |
| 129 | // TomWS1: Now dither transmitLevel value (register update occurs later when transmitting); |
| 130 | if (_targetRSSI != 0) { |
| 131 | uint8_t maxLevel = _isRFM69HW ? 23 : 31; |
| 132 | if (_ackRSSI < _targetRSSI && _powerLevel < maxLevel) { |
| 133 | _powerLevel += _transmitLevelStep; |
| 134 | } |
| 135 | else if (_ackRSSI > _targetRSSI && _powerLevel > 0) |
| 136 | _powerLevel--; |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | //============================================================================= |
| 143 | // sendWithRetry() - overrides the base to allow increasing power when repeated ACK requests fail |
nothing calls this directly
no outgoing calls
no test coverage detected