Wireless Stick library conflict

Hello there,

We are using Wireless sticks as controllers and node for a Lorawan network. For this, we use the esp32_lorawan library (#include <ESP32_LoRaWAN.h>); we also intend to use the heltec library to use the small display (#include <Heltec.h>).

However, apparently there is a conflict between this two libraries we have not been able to resolve:

‘DeviceClass_t’ does not name a type
In file included from /xx/xx/Arduino/Lora-XXXXXXXX/Lora-XXXXXXXX.ino:35:0:
/xx/xx/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/heltec.h:28:5: error: ‘LoRaClass’ does not name a type
LoRaClass LoRa;
exit status 1
Error compiling for board Wireless Stick.

For a program that work fine loading only either heltec.h or esp32_lorawan.h; i.e. the program compile and works if I load only the heltec.h library (and obviously, commenting out the references to lorawan, it will have display but not lorawan comms) or if I load only the esp32_lorawan (and commenting the displat directives out, it will have lorawan but no display).

We already have tried to change the loading order, to comment out references to Lora in heltec.h, and to put references to lora in a single file and then referencing this file in both libraries.

1 Like

could you post your code?

Most easy way would be try to include heltec.h in the example, here the first llines:


* HelTec Automation™ LoRaWAN 1.0.2 OTAA example use OTAA, CLASS A
* […]
* You can change some definition in “Commissioning.h” and “LoRaMac-definitions.h”

#include <heltec.h> //for display management, this will break the compilation.
#include <ESP32_LoRaWAN.h>
#include “Arduino.h”

In our code, conceptually:

//Libraries and other inclludes
#include <ESP32_LoRaWAN.h>
#include “Arduino.h”
#include “heltec.h”
#include <stdio.h>
#include <DS1302.h>
#include “EEPROM.h”
#include “Adafruit_VL53L0X.h”
#include “images.h”

uint32_t license[4] = {0xxxxx, 0xxxxx,0xxxxx,0xxxxx};
uint8_t DevEui[] = { 0x21, 0x5b, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx };
uint8_t AppEui[] = { 0x70, 0xB3, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx };
uint8_t AppKey[] = { 0x3f, 0x7e, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx, 0xxx };
uint16_t userChannelsMask[6]={ 0x0011,0x0000,0x0000,0x0000,0x0000,0x0000 };

DeviceClass_t loraWanClass = CLASS_A;
//more globals
void setup() {
//Diverse inicialization stuff
setupLora(); //our defined function to start the Lora thing
cicloLora(1); //our defined function, indicating here it should join the network
void loop() {
[…] //housekeeping stuff and state setting
switch (thisStatus){ //main switch
case 1:
Heltec.display[…] //Local display
cicloLora(0); //Lorawan notification, ok state
case 2:
Heltec.display[…] //local display, as above
cicloLora(8); //Lorawan notification, fatal failure
[…] //Other cases, involving local display as well as other communication cases

So, we can comment out the call to Heltec.h and the display, and the comms will work, or we can comment out the comms stuff, and the display will work. But trying to use both will result on an error, as previously stated:

Arduino: 1.8.13 (Linux), Board: “Wireless Stick, Disabled, 240MHz (WiFi/BT), 921600, Error, REGION_US915, Freq && DIO && PW”

In file included from /xxxxx.ino:30:0:
/xx/xx/Arduino/libraries/Heltec_ESP32_Dev-Boards/src/heltec.h:28:5: error: ‘LoRaClass’ does not name a type
LoRaClass LoRa;
exit status 1
Error compiling for board Wireless Stick.


maybe you can try this code:

Seems to be the original example, and the problem is the conflict between the heltec library we use for the display and the lorawan library which uses the same library for lorawan display. Or perhaps I did not understand what you are suggesting.

i’ve exact the same issue; The error occurs on an empty ino file while adding

 #include <ESP32_LoRaWAN.h>
 #include <Arduino.h>  
 #include <heltec.h>

The error differs a bit, when changing the order of the include.

ok, the problem is - both libraries define and use the display. This librarys are a mess. They are intended to use them alone…

but - you can just use the
#include <ESP32_LoRaWAN.h>
and then use the defined display here like that


Display is defined in ESP32_LoraWAN and you can just reuse this definition.

1 Like

Thank you very much on the suggestion, that works.