Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update geotag data whilst connected. #114

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/furble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ static void remote_control(FurbleCtx *fctx) {
do {
ez.yield();

furble_gps_update_geodata(camera);

if (fctx->reconnected) {
show_shutter_control(shutter_lock, shutter_lock_start_ms);
fctx->reconnected = false;
Expand Down Expand Up @@ -140,12 +138,19 @@ static void remote_control(FurbleCtx *fctx) {
} while (camera->isConnected());
}

uint16_t disconnectDetect(void *private_data) {
/**
* Refresh the camera connection status, this includes:
* * disconnect detection
* * geotag updates
*/
static uint16_t statusRefresh(void *private_data) {
FurbleCtx *fctx = static_cast<FurbleCtx *>(private_data);
Furble::Camera *camera = fctx->camera;

if (camera->isConnected())
if (camera->isConnected()) {
furble_gps_update_geodata(camera);
return 500;
}

String buttons = ez.buttons.get();
String header = ez.header.title();
Expand Down Expand Up @@ -177,7 +182,7 @@ static void menu_remote(FurbleCtx *fctx) {
submenu.addItem("Disconnect");
submenu.downOnLast("first");

ez.addEvent(disconnectDetect, fctx, 500);
ez.addEvent(statusRefresh, fctx, 500);

do {
submenu.runOnce();
Expand All @@ -191,7 +196,7 @@ static void menu_remote(FurbleCtx *fctx) {
}
} while (submenu.pickName() != "Disconnect");

ez.removeEvent(disconnectDetect);
ez.removeEvent(statusRefresh);

fctx->camera->disconnect();
ez.backlight.inactivity(USER_SET);
Expand Down Expand Up @@ -245,8 +250,6 @@ static void menu_connect(bool scan) {

FurbleCtx fctx = {Furble::CameraList::get(i - 1), false};

furble_gps_update_geodata(fctx.camera);

ezProgressBar progress_bar(FURBLE_STR, "Connecting ...", "");
if (fctx.camera->connect(settings_load_esp_tx_power(), &update_progress_bar, &progress_bar)) {
if (scan) {
Expand Down