Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using json request overwrites when it pulls...

Featured Replies

Using 4.53 b19 and I'm working on a video to show how to use AAO for ESP32, and I've got AAO being connected wirelessly to the webapi and pulling altitude, instrument pressure setting, plane name, and a custom AAO L var for an altitude bug. When I pull the custom Lvar it overwrites it in AAO. So I thought I'd post as it seems like a bug. Below is a section of the relevant code where I create the Lvar part of the request and where I pull the data:

// Create "pulllvars" array and add a variable object
JsonArray pulllvars = jsonDoc.createNestedArray("pulllvars");
JsonObject bugObj = pulllvars.createNestedObject();
// This is a local AAO var, so no comma and variable type ", Number"
bugObj["var"] = "(L:AAO_Altitude_Bug)";
bugObj["value"] = 0.0;

...make the http request...

// Extract the custom AAO variables, in this case for the altitude bug
JsonArray pullLvarsResponse = jsonResponse["pulllvars"];
// Should be the first variable in this group
int currBugAlt = pullLvarsResponse[0]["value"].as<int>();

The loop is on a 200ms timer and below is the serialized result. You can see my other variables are working fine, you can even see where I've spun the encoder that in AAO increments the AAO_Altitude_Bug variable, as it can get a value but it is quickly overwritten with a 0. Using observe variables I can see me increasing it and it bouncing to 0 and if I disconnect the ESP32 the value stops being set to 0 and will stay at the properly incremented value.

Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":50.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}
Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":0.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}
Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":0.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}
Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":25.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}
Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":0.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}
Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":0.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}
Response:
{"deviceId":null,"axis":null,"buttons":null,"triggers":null,"getvars":[{"var":"(A:INDICATED ALTITUDE, feet)","value":13158.689453125,"clr":null},{"var":"(A:KOHLSMAN SETTING HG, inHg)","value":30.022851943969727,"clr":null}],"setvars":null,"pulllvars":[{"var":"(L:AAO_Altitude_Bug)","value":0.0,"clr":null}],"getstringvars":[{"var":"(A:TITLE, String)","value":"Pilatus PC-12/47 Fly7 OH-DEN","clr":null}],"setstringvars":null,"pullstringlvars":null,"scripts":null,"inits":null,"releasevars":null,"files":null,"commands":null}

I think what I'm doing should work as I can get the data briefly, but not sure how to stop it from getting set to 0. Any thoughts? Thanks!

  • Commercial Member

The "pull" features are meant to set the LVar to 0 / empty string when you query them, that's the point of the "pull". You would typically use it to avoid redundant processing and redundant transmission of data - or to have a measure of control over your external process from within AAO. I needed it for the various bridge programs that pull entire web pages from within the sim. With this method I also keep the size of the web requests down when processing images stored as Base64 strings (CAPTURETOFIP). I only need the data when it actually changes, so I use pull.

When you just want to read the value of a variable, use "getvars" / "getstringvars". 

Edited by Lorby_SI

LORBY-SI

  • Author

Awesome - thanks for the clarification. With how much I have your manual open I'm annoyed I missed the line at the top of page 163 that says pull will reset to zero. Sorry for the ping. Will get that project sorted out today then.

Edited by HadronFlux

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.