I had a need for estimating TX time also when I implemented frequency hopping: I need to keep track of gateway time on all hopping nodes. The gateway includes a timestamp in all packets, but it takes some time for the packet to arrive. I use the following function to estimate TX time of the packet:
uint16_t SX1231Driver::estimateTxTime( uint8_t len )
{
if( len ) len--;
return (((uint32_t)(( 3 /*preamble*/ + 2 /*id*/ + 1 /*len*/ + 2 /*crc*/ ) +
( len / 16 + 1 ) * 16 ) /* align len because of encryption */
* readConst( &(profiles[ _profile ].microsPerByte ) ) ) + 500 ) / 1000;
}
This basically counts all bytes in the transmission and estimates TX time in ms. Note that this is at the driver level so the txflags, sender and target need to be included in len (3 extra bytes on top of your content). Also note that len is aligned to 16
byte blocks since that's how AES encryption works.
At least for my purposes this was a useful approximation.
Joe