Preprocessor macro for detecting export compiled binary

Is there a macro that can be checked to define something one of two ways depending if uploading the sketch locally (Ctrl+u) vs. exporting the compiled binary (Ctrl+Alt+s)?

Kind of like a DEBUG vs RELEASE mode. When exporting the compiled binary I would like to point to a different URL in my code than when testing.

I compared the verbose output for both types of builds and did not see any differences.



I think the only way you could accomplish this is by modifying platform.txt to somehow do it via the recipe.hooks.savehex.presavehex hook:

Thanks! This definitely looks like the right place. But I'm still wondering how to determine which build method was used Ctrl+U or Ctrl+Alt+S.

Is there a way to add a Sketch menu item to build the project so I can add a build-release with say Ctrl+Shift+U? that would be nice.

The savehex hooks are only called when doing export compiled binary. But they're called after compilation is complete, so I don't see how you could make that do what you want?

There is no way to add items to other menus short of modifying the IDE itself and maintaining your own custom version.

I think the much easier way to switch between release and debug version would be to do like

#define RELEASE

at top of sketch for a release, and comment it out when not doing a release, and use that in a #ifdef.

Dr. Azzy - I agree. That is what I am doing now. Only some times I forget to change that prior to exporting compiled binary. I just thought if there was a way to hook which menu item was used to start the build then I could make sure RELEASE was defined every time the binary was exported.