Comments (5)
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 #include
s).
from fixedpointsarduino.
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.
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.
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.
Fixed by #11.
Fix tested by @eried with Arduino IDE 1.8.5.
from fixedpointsarduino.
Related Issues (20)
- Support the use of volatile HOT 2
- Add more integer cast operators HOT 2
- Add bitshift operators HOT 6
- Replace use of void in zero-parameter functions
- Use of 'inline' in 'RawType' is redundant
- Add support for postincrement and postdecrement HOT 3
- Provide trigonometry functions HOT 1
- Disable random number functionality for non-AVR boards
- Add random number support for other board targets
- Update the dates on all licence headers
- Replace use of LargerType in constructors with ShiftType HOT 1
- Fix shift overflow bug in preincrement and predecrement operators
- Consider replacing some member functions and operators with free functions
- Consider providing constants in a separate namespace
- Provide formatting and printing functions
- Consider providing templates implementing other ways of expressing fixed points
- Add template aliases SQ and UQ in FixedPointsCommon
- Investigate the potential of adding specalisations for fixed points with zero-width fractions
- Make casting negative numbers more predictable. HOT 2
- Converting to float provides an incorrect result for certain types.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fixedpointsarduino.