GithubHelp home page GithubHelp logo

Compile error when excluding UART about sps30 HOT 6 CLOSED

paulvha avatar paulvha commented on August 17, 2024
Compile error when excluding UART

from sps30.

Comments (6)

paulvha avatar paulvha commented on August 17, 2024 1

There is a check on BOTH UART and I2C begin disabled during compile to cause an error message, but indeed only in that situation it could happen. The compiler s pre-processor is in error in it should handle the #if defined rules correctly and include and exclude the right code as a result. But there is always a work-around :-)

regards
Paul

from sps30.

davidjohngraham avatar davidjohngraham commented on August 17, 2024

I have added return(0xff); after line 763 in sps30.cpp, which fixes the compiler error. I'm not sure if this is the most appropriate error code to use?

from sps30.

paulvha avatar paulvha commented on August 17, 2024

HI Dave
I have just tried this on Arduino IDE and commenting out #define INCLUDE_UART 1 does not cause an error. I looked that the code. Actually, this must be a compiler error. The I2C code is returning an error if not successful (unless you disabled I2C also ..) and the compiler should notice that. I know of others that use the SPS30 code , but never heard about this problem. What you could try instead of satisfying the compiler with a fake return, is to comment out the last lines in the subroutine that are handling the UART. Just to see what happens

from sps30.

davidjohngraham avatar davidjohngraham commented on August 17, 2024

Hi Paul

Yes, commenting out the lines that handle the UART also works.

I think the complier error may result from a change in version 2.2.0 of the Particle device os (see particle-iot/device-os#2323).

My C++ skills are not sufficient to determine whether this is a genuine issue with your code, or in the Particle implementation.

from sps30.

davidjohngraham avatar davidjohngraham commented on August 17, 2024

I'm guessing that the error results from the fact that no value is returned under the theoretically possible condition that UART is disabled and if (_Sensor_Comms == I2C_COMMS) is FALSE at line 735. I accept that this condition can't arise in practise if we're using i2c comms, but the compiler doesn't know that.

Happy to be corrected if I've misunderstood.

from sps30.

paulvha avatar paulvha commented on August 17, 2024

closed

from sps30.

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.