CongducPham / LowCostLoRaGw

Low-cost LoRa IoT & gateway with SX12XX (SX1261/62/68; SX1272/76/77/78/79; SX1280/81), RaspberryPI and Arduino boards
699 stars 352 forks source link

Arduino_LoRa_Temp: Compiling Error: 'LSC_MIC' was not declared in this scope #249

Open robshep opened 5 years ago

robshep commented 5 years ago

I have copied the Arduino LoRa Temp example into a new sketch folder and copied a number of libraries into the src.

I haven't yet changed any src (apart from some <> to "" includes)

I can't find this variale declared anywhere in the src tree.

Thanks

sketch/local_lsc.cpp: In function 'uint8_t local_lsc_create_pkt(uint8_t*, uint8_t, uint8_t, uint8_t, uint8_t)':
local_lsc.cpp:99: error: 'LSC_MIC' was not declared in this scope
       for(int i = 0; i < pl+LSC_MIC; i++)
                             ^
local_lsc.cpp:112: error: 'LSC_MIC' was not declared in this scope
       memcpy(message,cipher+OFFSET_PAYLOADLENGTH,pl+LSC_MIC);
                                                     ^
exit status 1
'LSC_MIC' was not declared in this scope
$ ls -1
AES-128_V10.cpp
AES-128_V10.h
Arduino_LoRa_temp.ino
Base64.cpp
Base64.h
Encrypt_V31.cpp
Encrypt_V31.h
LSC_Encrypt.cpp
LSC_Encrypt.h
SX1272.cpp
SX1272.h
band_config.h
local_lorawan.cpp
local_lorawan.h
local_lsc.cpp
local_lsc.h
my_temp_sensor_code.cpp
my_temp_sensor_code.h
CongducPham commented 5 years ago

OK, I've fixed a missing line in LSC_Encrypt.h. However, to use LoRaWAN you do not need it. You just have to have the following #define in Arduino_LoRa_temp example:

define WITH_EEPROM

//#define WITH_APPKEY //if you are low on program memory, comment STRING_LIB to save about 2K

define STRING_LIB

define LOW_POWER

define LOW_POWER_HIBERNATE

//Use LoRaWAN AES-like encryption

define WITH_AES

//Use our Lightweight Stream Cipher (LSC) algorithm //#define WITH_LSC //If you want to upload on TTN without LoRaWAN you have to provide the 4 bytes DevAddr and uncomment #define EXTDEVADDR //#define EXTDEVADDR //Use native LoRaWAN packet format to send to LoRaWAN gateway

define LORAWAN

//when sending to a LoRaWAN gateway but with no native LoRaWAN format, just to set the correct sync word, DO NOT use if LORAWAN is uncommented //#define USE_LORAWAN_SW //#define WITH_ACK //this will enable a receive window after every transmission //#define WITH_RCVW //force 20dBm, use with caution, test ony //#define USE_20DBM ///////////////////////////////////////////////////////////////////