Giter VIP home page Giter VIP logo

Comments (5)

Pharap avatar Pharap commented on May 29, 2024

I can't seem to replicate this problem just using Arduino IDE 1.8.5.

Do you get an error from compiling a sketch like this?:

void setup()
{
	while(!Serial);
	Serial.println(random());
}

void loop()
{
}

It might also be helpful to know which board you're compiling for.

Also, perhaps try adding #include <stdlib.h> near the top of Details.h (underneath the #pragma once, near the other #includes).

from fixedpointsarduino.

marciopamplona avatar marciopamplona commented on May 29, 2024

The function random(void) doesn't exist in the arduino environment. The random function need an argument:
https://cdn.arduino.cc/reference/en/language/functions/random-numbers/random/

I'm compiling for ESP8266 in the Linux OS.

Including the <stdlib.h> doesn't make difference.

To reproduce: install a new arduino IDE, install the library from the library manager, open the example and compile.

from fixedpointsarduino.

Pharap avatar Pharap commented on May 29, 2024

I think this is an ESP8266-specific problem.

From the looks of it ESP8266 isn't an Arduino chip either, I can't find it on the board list and it's not AVR-based.
Most Arduino boards have access to extern long random(void); defined in \hardware\tools\avr\avr\include\stdlib.h, but from the looks of it ESP8266 doesn't have this for some reason.

If the ESP8266 has a specific define that I can use to detect it and either selectively disable the random function or implement randomSFixed and randomUFixed using RAND_MAX then I can offer that as a fix, but that's about all I can do.

from fixedpointsarduino.

Pharap avatar Pharap commented on May 29, 2024

I've gone over the code and added a feature to disable the random functions.

In addition to this I have made a branch that should detect when the library is being compiled for ESP8226 and respond by disabling the random functions.
I don't however have an ESP8226 to test on so I will have to ask you @marciopamplona to test this branch for me to confirm whether or not this fixes the problem:

https://github.com/Pharap/FixedPointsArduino/tree/ESP8266-Support

If that doesn't detect the ESP8266 then try the master branch and make sure to #define FIXED_POINTS_NO_RANDOM before you #include <FixedPoints.h>.

If the ESP8226-Support branch works then I'll merge it into the master branch and release a new version.
If the ESP8226-Support branch doesn't work but the master branch does then I'll add a warning in README.md that code for the ESP8226 needs to #define FIXED_POINTS_NO_RANDOM.

from fixedpointsarduino.

Pharap avatar Pharap commented on May 29, 2024

Fixed by #11.
Fix tested by @eried with Arduino IDE 1.8.5.

from fixedpointsarduino.

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.