Query the current TX spreading factor

Hi there,
I run a CubeCell AB01 in the TTN. How can the current TX spreading factor be queried in the program code?
Objective: Automatic adjustment of the duty cycle in the program in order to comply with the fair use policy in TTN.
Many thanks for your help

Heltec: How can the current TX spreading factor be queried in the program code?