sxjack / uav_electronic_ids

Arduino classes for various UAV electronic IDs and ATM/UTM interfaces.
MIT License
62 stars 27 forks source link

Around line 497 #33

Open Greg-C10 opened 1 month ago

Greg-C10 commented 1 month ago

I was having an issue with positions in the uav array resetting. Found that msecs was greater then uavs[i].last_seen. Since these are unsigned, what would have been negative result rolls back to the max - ??. Therefore whenever msecs> uavs[i].last_seen, it always produces a true result. In my case it was somewhere around a few negative milliseconds. But the result was my array positions were being overwritten and open for use. I made the following changes. Probably need to check other areas where that could happen.

Before:

if ((uavs[i].last_seen)&& ((msecs - uavs[i].last_seen) > 300000L)) {

After:

if ((uavs[i].last_seen) && (msecs > uavs[i].last_seen) && ((msecs - uavs[i].last_seen) > 300000L))