Giter Club home page Giter Club logo

Comments (10)

dolfandringa avatar dolfandringa commented on August 23, 2024

It seems like setting lib_compat_mode = off makes platformio not check if libraries are compatible with the current platform/framework. So you can just omit the framework from platformio.ini and then the standard arduino libraries then will get included just fine. What I personally did is define a macro with -DNATIVE and then make a custom lib MockLib.h which itself includes ArduinoFake.h and I can add additional fake stuff in there as required. MockLib.h then only gets included in NATIVE is defined. I am still having some issues, but this got me a lot further. Is this how this is supposed to be done?

from arduinofake.

FabioBatSilva avatar FabioBatSilva commented on August 23, 2024

I think the lib_compat_mode issue is related to #5

What version of ArduinoFake are you using ?

from arduinofake.

dolfandringa avatar dolfandringa commented on August 23, 2024

What version of ArduinoFake are you using ?

0.2.0

from arduinofake.

dolfandringa avatar dolfandringa commented on August 23, 2024

Manually setting lib_compat_mode=off in my platformio.ini works, but it doesn't happen automatically.

from arduinofake.

FabioBatSilva avatar FabioBatSilva commented on August 23, 2024

I think 0.2.0 didn't include the libCompatMode=off

I've tagged 0.2.1 yesterday.
Can you try bumping the version or perhaps point your dependency to git / master and test it out ?

from arduinofake.

dolfandringa avatar dolfandringa commented on August 23, 2024

I both installed the latest version, and then removed it and installed the git version, and with both, I need to manually specify the lib_compat_mode=off in platformio.ini in order to get the DallasTemperature library to load. here is a very simple example that works with lib_compat_mode = off in platformio.ini but doesn't without it (error: MyLib.h: No such file or directory). https://github.com/dolfandringa/pio_arduinofake_unittest

from arduinofake.

minayaserrano avatar minayaserrano commented on August 23, 2024

Same here. The arduino-mock example (https://github.com/platformio/platformio-examples/tree/develop/unit-testing/arduino-mock) is broken. It works adding lib_compat_mode=off in platformio.ini.

But this workaround doesn't work to me, because other external dependencies don't work with this configuration. For example, in my project I am using U8g2lib (https://github.com/olikraus/u8g2) and when U8g2lib try to load .h files it seems that it can't find them:

In file included from .platformio/lib/U8g2_ID942/src/U8g2lib.cpp:40:0:
.platformio/lib/U8g2_ID942/src/U8g2lib.h:49:10: fatal error: Print.h: No such file or directory

I don't know if I'm missing something or if I can help with something.

from arduinofake.

aviborg avatar aviborg commented on August 23, 2024

Not sure if it applies to to this issue but seems like I have a similar problem. Using 0.2.2.

Processing test_desktop in native environment
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Building...
In file included from .pio\libdeps\native\ArduinoFake\src/arduino/WString.h:25,
                 from .pio\libdeps\native\ArduinoFake\src/arduino/Arduino.h:223,
                 from .pio\libdeps\native\ArduinoFake\src/ArduinoFake.h:13,
                 from .pio\libdeps\native\ArduinoFake\src/Arduino.h:1,
                 from src/HanReader/DlmsReader.h:4,
                 from test\test_desktop\test_main.cpp:1:
.pio\libdeps\native\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp: In instantiation of 'typename ArduinoJson6172_F1::enable_if<ArduinoJson6172_F1::is_pointer<T>::value, T>::type ArduinoJson6172_F1::pgm_read(const void*) [with T = const __FlashStringHelper*; typename ArduinoJson6172_F1::enable_if<ArduinoJson6172_F1::is_pointer<T>::value, T>::type = const __FlashStringHelper*]':
.pio\libdeps\native\ArduinoJson\src/ArduinoJson/Deserialization/DeserializationError.hpp:103:12:   required from here
.pio\libdeps\native\ArduinoFake\src/arduino/pgmspace.h:106:29: error: 'const void*' is not a pointer-to-object type
 #define pgm_read_ptr(addr) (*(const void *)(addr))
                            ~^~~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\native\test\test_desktop\test_main.o] Error 1

from arduinofake.

askreet avatar askreet commented on August 23, 2024

I'm having the same issue @aviborg. This is all a bit lower level than my comfort zone, but ArduinoFake defines pgm_read_ptr as:

#define pgm_read_ptr(addr) (*(const void *)(addr))

Which seems to ultimately evaluate to a void type (versus a void*), where casting doesn't make sense (as highlighted by ArduinoJson's error). I wonder if that should really be:

#define pgm_read_ptr(addr) (const void *)(addr)

from arduinofake.

tomec-martin avatar tomec-martin commented on August 23, 2024

It seems that it is enougth to change:
#define pgm_read_ptr(addr) (*(const void * const *)(addr))
Pull request is above...

from arduinofake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.