J-M-L:
Millis does not work the way you wrote it. It’s the rest of the code that performs the expected time management. Programming requires precision.
Historically, the word precision belongs to the field of "Instrument Design", and it is used in conjunction with accuracy. For example: measuring instruments used in the research field should be both precise and accurate.
In practical programming, is it really possible to maintain precision?
My history lessons go a bit beyond that... historically it comes from latin præcisio (cutting short) and used in Middle French (ca. 1400-1600) Age. Precision was the quality of being precise
in English According to a dictionary
precision noun
pre·ci·sion | \ pri-ˈsi-zhən
the quality or state of being precise
precise adjective
pre·cise | \ pri-ˈsīs
1 : exactly or sharply defined or stated
2 : minutely exact
3 : strictly conforming to a pattern, standard, or convention
4 : distinguished from every other
I used it in the sens of “ strictly conforming to a pattern, standard, or convention”
GypsumFantastic:
This thread has everything. Etymology, metrology, and a whole lot of very poor advice about how blocking code is better than blocking code.
Another ridiculous thread that could've been solved on the first reply with reference to a simple library. Install it via the Libraries Manager, take a mental note for further posts like this, and refer to the lib's cpp file if you have any questions on the theory behind non-blocking timing for Arduinos.
@ Arnav
I mentioned that already- when you don’t know you’d be better off refraining from trying to boost your post count or at the very minimum - because it’s a free speech place - write in a way that shows you are offering hypothesis.
Most of what you write is approximative at best and often plain wrong. There are enough fake news and alternate truth those days, please don’t bring that here. Thx
GypsumFantastic:
There's a yield() in there that I didn't know about.
that's for being safe across multiple architectures (multi-core) that require some other processes to do their own cooking (ESP for example where a watchdog will come bark at you).
/**
* Empty yield() hook.
*
* This function is intended to be used by library writers to build
* libraries or sketches that supports cooperative threads.
*
* Its defined as a weak symbol and it can be redefined to implement a
* real cooperative scheduler.
*/
static void __empty() {
// Empty
}
void yield(void) __attribute__ ((weak, alias("__empty")));
the optimizer will likely get rid of the call if not implemented.