cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.69k stars 397 forks source link

Review LoRa time sync settings #741

Closed mloeschner closed 3 years ago

mloeschner commented 3 years ago

It seems to me that time snyc via LoRa is always active, since in https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/lmic_config.h#L32 LMIC_ENABLE_DeviceTimeReq is set to 1.

The code to evaluate the actual setting is in https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/lorawan.cpp#L16-L20.

I removed the definition in lmic_config.h but I'm not sure if I had overseen anything.

cyberman54 commented 3 years ago

LMIC_ENABLE_DeviceTimeReq in _lmicconfig.h controls if the LMIC stack will process DeviceTimeRequests on MAC layer, or not. It's a compiler option to reduce code size - useful, if time sync is not needed by the node and flash ROM space on the node is short.

You can keep this compiler option enabled, even if your LORAWAN network server does not support DeviceTimeRequests, like TTN v2, if you don't care about code size. Since ESP32 provides huge flash ROM size, paxcounter enables the compiler option.

User control, if network time is actually used or not, is given in paxcounter.conf by #define TIME_SYNC_LORAWAN. Don't touch this (0 = default), if you don't need network time, or if your LORAWAN network server does not provide network time.

I don't think this is a bug, nor could be an issue causing any problems.

mloeschner commented 3 years ago

Thanks for the clarification.