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

Define NO_OTA_NETWORK to disable all network-related functionality #191

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

vshymanskyy
Copy link
Contributor

@vshymanskyy vshymanskyy commented Mar 12, 2023

I've developed a custom firmware delivery mechanism (i.e. using a cellular or packet radio connection on an ESP32), so I'd like to disable the built-in implementation.

@JAndrassy
Copy link
Owner

the change in cpp does nothing

@vshymanskyy
Copy link
Contributor Author

It should disable the compilation unit, optimizing the build speed and not relying on the link-time code elimination.
Should I revert this change?

@JAndrassy
Copy link
Owner

It should disable the compilation unit, optimizing the build speed and not relying on the link-time code elimination. Should I revert this change?

the cpp will always be compiled and it will not see the define from ino or other cpp.
It should be enough to change in ArduinoOTA.h

#ifdef NO_OTA_NETWORK 
// don't create ArduinoOTA instance

#elif defined(ethernet_h_) || defined(ethernet_h) // Ethernet library

@vshymanskyy
Copy link
Contributor Author

vshymanskyy commented Mar 13, 2023 via email

@JAndrassy
Copy link
Owner

if you write a custom firmware in PlatformIO you could just include InternalStorage.h

@vshymanskyy
Copy link
Contributor Author

As I'm building for multiple platforms, essentially I need to copy this section of code:

#ifdef __AVR__
#if FLASHEND >= 0xFFFF
#include "InternalStorageAVR.h"
#endif
#elif defined(ARDUINO_ARCH_STM32)
#include <InternalStorageSTM32.h>
#elif defined(ARDUINO_ARCH_RP2040)
#include <InternalStorageRP2.h>
#elif defined(ESP8266) || defined(ESP32)
#include "InternalStorageESP.h"
#else
#include "InternalStorage.h"
#endif

This could be moved to a separate header, in this case I could include it directly.

@JAndrassy
Copy link
Owner

JAndrassy commented Mar 16, 2023

you can copy that section to your firmware and remove the lines for platforms your firmware doesn't support. then it is only a few lines

btw: I am curios now. First I thought you work on Edgent improvements, but that would require Arduino IDE compatibility. Then I thought you make some IoT firmware for a big customer, but that would be one platform. :-)

@vshymanskyy
Copy link
Contributor Author

vshymanskyy commented Mar 16, 2023

Yeagh, copying those lines is what we do now, but at the same time it's something I'd like to avoid. I.e. ArduinoOTA could get updated at any point with new platform support, at which point it would require changes in our libraries as well.

You're correct, ArduinoOTA will be compiled in Arduino IDE in many cases, I just thought it's a good opportunity to improve the PlatformIO developer experience as well.

It's related to the Edgent development (and to customers of all sizes), however we're not disclosing the details yet. ;)

@JAndrassy
Copy link
Owner

ok, then, as I write in one of the previous comments, I would prefer to have just the #ifdef NO_OTA_NETWORK before the #elifs for the networking libraries. this basically just suppresses the warning in the final #else and/or ignores any networking library included before ArduinoOTA.h.

@vshymanskyy
Copy link
Contributor Author

Works for me. Just reverted the other changes

@JAndrassy JAndrassy merged commit 28a22f0 into JAndrassy:master Mar 16, 2023
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.

None yet

2 participants