Skip to content

Geofencing (dl2rxe)#347

Open
githubmicha wants to merge 10 commits into
richonguzman:mainfrom
githubmicha:main
Open

Geofencing (dl2rxe)#347
githubmicha wants to merge 10 commits into
richonguzman:mainfrom
githubmicha:main

Conversation

@githubmicha
Copy link
Copy Markdown

Hi Ricardo,

Based on your excellent tracker software, I’ve added a geofencing feature that deactivates the tracker, pauses transmission or switches it off when it’s within a defined area. I need this feature so that I don’t constantly transmit my location (even during experiments) when I’m at home anyway.
Unfortunately, I’m no programming expert and have only tried it out with a TTGO T-Beam 1.2.
If you like, you’re welcome to reuse the code or the idea. Please forgive me if I’ve done something wrong here; this is my first attempt with GitHub and the like.

For the configuration in tracker_conf.json

Definition of the circle:
geofence_latitude = 50.0; // 50.000
geofence_longitude = 10.0; // 10.000
geofence_radius = 1000 ; / 1000 m
geofence_mode = ‘inactive’;

Possible modes:
inactive: normal tracker operation
pause: if the tracker is within the circle, it does not transmit
poweroff: if the tracker is within the circle, it switches off. (Tested with TTGO v1.2). This mode can only be exited if the GPS signal is invalid or the tracker is outside the circle.

Kind regards, Micha, DL2RXE, near Berlin, Germany

@richonguzman
Copy link
Copy Markdown
Owner

hi

nice idea... but after checking the code: how does the Tx is not active when checking the geoFence ?

@githubmicha
Copy link
Copy Markdown
Author

Thank you for the positive feedback.

The sendNewPacket function in lora_utils.cpp is terminated after

if (geofence_pause) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, ‘LoRa Tx’, ‘TX BLOCKED by geofence’);
transmitFlag = true;
return;
}

without actually starting the transmission.
As the function does not return any other values, this is perfectly feasible.

I’ve just noticed that the <> message is still being displayed; that needs to be suppressed.
The “Geofence TX pausing” message could also show the distance, but that isn’t really necessary.

If you want to make any changes, feel free.

more information
surpress TX-Message during geofence
@richonguzman
Copy link
Copy Markdown
Owner

maybe the validation of the Tx should not be with transmitFlag, but in the "beaconUpdate" part. right?

@githubmicha
Copy link
Copy Markdown
Author

That’s probably better for the programme logic. Then the transmission won’t be carried out in the first place. This also means the short <> message won’t be displayed. Very good.
Do it in a way that suits your programming style; I’m unfortunately just an interested amateur.

I’ve further improved the display in geofence.cpp.

        displayShow(‘GEOFENCE’,“”, ‘TX pausing’,‘Radius: ’ + String(double(currentBeacon->geofence_radius),0)+‘ m’,‘Distance: ’ + String(distance,0) + ‘ m’,‘’, 100);

This displays the distances.

@richonguzman
Copy link
Copy Markdown
Owner

awesome then.

will try to add this soon enough!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants