TheThingsNetwork / arduino-device-lib

Arduino Library for TTN Devices
MIT License
207 stars 96 forks source link

Make airtime a public property and split trackAirtime into calculateAirtime #160

Closed amkuipers closed 7 years ago

amkuipers commented 7 years ago

In v1.0, sendBytes updates private airtime in class TheThingsNetwork. In beta, examples just send data and delay for 20s or so. In production there is a need for users to control airtime, and it would be great if the library supports it. I am not aware if TTN Uno has a RTC to 'reset daily used airtime'. But some assistance in calculating a delay/sleep would help. Example: delay_ms = calc_delay( sizeof (user_data_upstream) + sizeof (user_data_downstream )), that uses the private fp and sf, etc, to calculate the minimum delay. If an RTC is available, the used airtime can be recorded per day, and the calc_delay() can use the remaining airtime in the calculation. Documentation then can have examples that use that delay, or less; multiply the delay by 2, or use something like max( calc_delay(..), SIX_HOUR).

FokkeZB commented 7 years ago

I suggest we:

johanstokking commented 7 years ago

@FokkeZB agreed

FokkeZB commented 7 years ago

Closed by #162