HelTecAutomation / ESP32_LoRaWAN

Transplanted from Semtech LoRaWAN(https://github.com/Lora-net/LoRaMac-node) protocol to "ESP32 + Arduino" platform. Use RTC, support deep sleep, only working with ESP32 + LoRa boards made by HelTec Automation(TM). Need a unique license to use it.
337 stars 108 forks source link

Changing APP EUI, KEY and DEV EUI without changing defined in the library #16

Open DeveloppeurPascal opened 4 years ago

DeveloppeurPascal commented 4 years ago

An idea for a next release of this library.

It is convenient to have OTAA parameters (APP_EUI, APPKEY, DEV_EUI) as defined in the library when you only have one device, but when you have several devices it is useless. It must be possible to change them as a variable in the code of our programs.

As it stands, the proposed library does not allow to industrialize the work with Heltec cards. That's a pity.

DestinyFxxker commented 4 years ago

This is very easy to do, thank you for your suggestion, maybe we will make adjustments in the next version.

DeveloppeurPascal commented 4 years ago

Thanks. For the others I fixed the problem for me by changing values to DevEui[], AppEui[] and AppKey[] global variables as first lines of setup() function.

The last great limit is for the LICENSE variable and MCU activation.

DeveloppeurPascal commented 4 years ago

For automating DevEui, I change it from ChipId with this code :

uint64_t chipid = ESP.getEfuseMac(); for (int i = 0; i < 8; i++) { if (i < 2) { DevEui[i] = 0; } else { DevEui[i] = chipid % 256; chipid = chipid / 256; } }

So if ChipId is 12 34 56 78 9A BC, my DevEui will be 00 00 BC 9A 78 56 34 12.

Ajaynithish commented 4 years ago

@DeveloppeurPascal where to mention the user data in this library? i can't find one void PrepareMsgFrame( uint8_t port, uint8_t Msg2Send[], uint8_t length ) is this is the one? @solotaker @Heltec-Aaron-Lee @gibus27

DestinyFxxker commented 4 years ago

@DeveloppeurPascal where to mention the user data in this library? i can't find one void PrepareMsgFrame( uint8_t port, uint8_t Msg2Send[], uint8_t length ) is this is the one? @solotaker @Heltec-Aaron-Lee @gibus27

Yes, use like this:

      uint8_t msg[] = "Msg test 43";
      PrepareMsgFrame( AppPort, msg , sizeof(msg)-1);
Ajaynithish commented 4 years ago

@DeveloppeurPascal how did you defined the parameters outside the library. I've been trying it for weeks, all I get is ERROR:undefined reference. any one any hint @solotaker @gibus27 @Heltec-Aaron-Lee

Heltec-Aaron-Lee commented 4 years ago

what parameters?

Ajaynithish commented 4 years ago

The dev addr , netsessionkey.... But i found it thanks for the response