OK, that’s not really a surprise and it’s related to the version of the Heltec support software that you have installed.
The good news, perhaps, is that I can now reproduce your problem on a fresh installation of the IDE (2.3.4) after loading Espressif esp32
(3.0.7) through the Board Manager and Heltec ESP32 Dev Boards
(2.1.2) through the Library Manager. I also had to load a couple of Adafruit libraries—Adafruit BusIO
(1.16.2) and Adafruit GFX Library (1.11.11)
—(Library Manager) to run the Heltec LoRaSend.ino
example and the OneWire
(2.3.8) and DallasTemperature
(3.9.0) libraries to complete this test.
And just by the way, if you want people to help you solve a problem, providing that level of detail about your environment at the outset will make it much easier for them to help you.
The perhaps not so good news is that, while I can offer a procedure to get around the problem in the present case, it is by no means a satisfactory long term solution. There is a problem somewhere between the way the Arduino IDE compiles/loads software and, apparently, the way Heltec has recently decided to distribute its support software. I am still running v1.0.0 of the Heltec ESP32 support software on my main development host, and it handles everything I’m doing just fine, even with the V3 boards. But the latest version, v2.1.2, has a radically different structure to my v1.0.0 version making it almost impossible to identify the exact location of issues that arise as a result of recent changes. It now includes precompiled code units and there seems to be an issue with the order in which these, or elements within, are loaded by the IDE. I don’t know whether this is an IDE problem or a Heltec problem—you may have to go over to the IDE forum to work through that one.
The following is the sequence I had to follow to get the sketch provided above to compile in this environment. First of all, change the line:
Mcu.begin();
to
Mcu.begin(HELTEC_BOARD,SLOW_CLK_TPYE);
as it appears in the current version of the LoRaSender.ino
example—and no, that’s not a typo there, the variable is SLOW_CLK_TPYE
, not SLOW_CLK_TYPE
.
Note to Heltec: If you decide to fix this misspelling at some point, be kind to your users and keep the misspelled version as well, so you don’t break existing code that depends on the original [mis]spelling. And it would also have been considerate to have retained a version of the Mcu.begin()
method in the current library that did not require any parameters, for the same reason.
To compile this sketch then, I had to do the following:
- Open a new [empty] sketch
- Paste in the following
#include
statements before the [empty] setup()
function
#include <Wire.h>
#include <DallasTemperature.h>
and compile that [empty] sketch.
- Now paste in the content of the
LoRaSender.ino
sketch, after the above two lines and over the currently empty setup()
and loop()
methods, and compile the resulting sketch.
You will now see a message like the following in the IDE Output
panel
Library Heltec ESP32 Dev-Boards has been declared precompiled:
Using precompiled library in /Users/xxx/Documents/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/esp32s3
and the compilation should complete successfully.
If you don’t follow this two-step compilation process, you never see this message and the compilation fails as you have noted, so it would seem that something goes amiss with this precompiled code unit—like I say, I don’t really know whether this is an IDE or a Heltec problem.
Someone with a deeper understanding than I, of how the IDE assembles code, might be able to explain more precisely what’s going on here but I believe that the IDE just reuses binaries that it’s already created if it doesn’t think the source code has changed. By compiling the library code in the above order, it would seem that we stop the compilation of the LoRaWan_APP
library from interfering with the assembly of the Wire
library, which would suggest that this might be more a problem that should be addressed by Heltec than the Arduino IDE developers.
Caveat emptor: I have not tried to actually execute any sketch so compiled, so I have no idea whether or not there are even deeper issues within…