sparkfun / SparkFun_AS3935_Lightning_Detector_Arduino_Library

Other
37 stars 19 forks source link

Esp32 compiling error #7

Closed takenalias closed 5 years ago

takenalias commented 5 years ago

Hi, I am running version 1.3.3 of this library, but it is still not compiling and is coming up with the following error.

I am having this issue on an esp32, no modifications to the example script except the interrupt pin number.

Arduino: 1.8.9 (Windows 10), Board: "Adafruit ESP32 Feather, 80MHz, 921600, None"

Example2_More_Lightning_Features_I2C:33:38: error: invalid conversion from 'int' to 'SF_AS3935_I2C_ADDRESS' [-fpermissive]

SparkFun_AS3935 lightning(AS3935_ADDR);

                                  ^

In file included from C:\Users\x\Documents\Arduino\libraries\SparkFun_AS3935_Lightning_Detector_Arduino_Library\examples\Example2_More_Lightning_Features_I2C\Example2_More_Lightning_Features_I2C.ino:19:0:

C:\Users\x\Documents\Arduino\libraries\SparkFun_AS3935_Lightning_Detector_Arduino_Library\src/SparkFun_AS3935.h:77:5: note: initializing argument 1 of 'SparkFun_AS3935::SparkFun_AS3935(SF_AS3935_I2C_ADDRESS)'

 SparkFun_AS3935(enum SF_AS3935_I2C_ADDRESS address);

 ^

exit status 1 invalid conversion from 'int' to 'SF_AS3935_I2C_ADDRESS' [-fpermissive]

gon0 commented 5 years ago

Same on ESP8266 LOLIN D1 mini pro with 1.3.3 of this library (Arduino 1.8.9):

Example1_BasicLightning_I2C:30:38: error: invalid conversion from 'int' to 'SF_AS3935_I2C_ADDRESS' [-fpermissive]

 SparkFun_AS3935 lightning(AS3935_ADDR);

                                      ^

In file included from C:\Users\x\AppData\Local\Temp\arduino_modified_sketch_616929\Example1_BasicLightning_I2C.ino:18:0:

C:\Users\x\Documents\Arduino\libraries\SparkFun_AS3935_Lightning_Detector_Arduino_Library\src/SparkFun_AS3935.h:77:5: error:   initializing argument 1 of 'SparkFun_AS3935::SparkFun_AS3935(SF_AS3935_I2C_ADDRESS)' [-fpermissive]

     SparkFun_AS3935(enum SF_AS3935_I2C_ADDRESS address);

     ^

exit status 1
invalid conversion from 'int' to 'SF_AS3935_I2C_ADDRESS' [-fpermissive]

Edit: Had a look into the code.

change

// Address is set to default. 
SparkFun_AS3935 lightning(AS3935_ADDR);

to

// Address is set to default. 
SparkFun_AS3935 lightning(AS3935_DEFAULT_ADDRESS);

and it compiles

edspark commented 5 years ago

Thank you the issue @takenalias and for giving a work around @gon0. I have fixed the issue with the latest release v1.3.4, so a work around is no long necessary.