Skip to content

Commit

Permalink
Update geotag data whilst connected.
Browse files Browse the repository at this point in the history
Absorb the geotag updates into the disconnect detection event.
Now, as long as we are connected to the camera, we can provide GPS
updates.
  • Loading branch information
gkoh committed Aug 15, 2024
1 parent 88a993a commit 1184cbb
Showing 1 changed file with 11 additions and 8 deletions.
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

0 comments on commit 1184cbb

Please sign in to comment.