Error: no return statement in function returning non-void from SparkFun MPU9250 Library

Hello,

I’m trying to add the MPU-9250 to a device I’m fabbing for an open source FPV project (ExpressLRS/Backpack).

I want to use the “SparkFun MPU-9250 Digital Motion Processing (DMP) Arduino Library” because of its DMP access.

I added the library to the project in PlatformIO using the normal process (PlatformIO>QuickAccess>PIO home>Libraries> add to project button).

Before adding the library, I could build the target binaries no problem using the ExpressLRS flashing tool.

After adding the library I get the error messages:

pio\libdeps\Rapidfire_ESP01F_Backpack_via_UART\SparkFun MPU-9250 Digital Motion Processing _DMP_ Arduino Library\src\util\inv_mpu.c: In function 'reg_int_cb':
.pio\libdeps\Rapidfire_ESP01F_Backpack_via_UART\SparkFun MPU-9250 Digital Motion Processing _DMP_ Arduino Library\src\util\inv_mpu.c:52:1: error: no return statement in function returning non-void [-Werror=return-type]

and

.pio\libdeps\Rapidfire_ESP01F_Backpack_via_UART\SparkFun MPU-9250 Digital Motion Processing _DMP_ Arduino Library\src\util\arduino_mpu9250_log.cpp: In function 'int _MLPrintLog(int, const char*, const char*, ...)':
.pio\libdeps\Rapidfire_ESP01F_Backpack_via_UART\SparkFun MPU-9250 Digital Motion Processing _DMP_ Arduino Library\src\util\arduino_mpu9250_log.cpp:37:1: error: no return statement in function returning non-void [-Werror=return-type]

I can see that both functions are declared as int but have no return value. Is this an error in the code? That would suprise me given that the source is SparkFun. Is there a fix or workaround for this? Any help would be very appreciated! thanks!

ESP01F meaning an ESP8285 module? The library says it’s SAMD only…

And the Adafruit SAMD core probably has different compiler settings, so no -Werror=return-type that prevents compilation of this buggy code.

The source file in question is not from SparkFun, it’s from the sensor manufacturers themselves.

So yeah I think you can just fork the library and add the missing return statements, if there were non before return 0; should be fine.

Thanks for the reply!

should I look for another library that supports ESP?

Well if you get it to compile first you can check out if it works anyways.