Comments (5)
Interesting, I wonder what it should be? I'd like to refactor a bunch of this to make it a bit easier to add test cases.
from filament-scale-enhanced.
I just noticed that this is trying to sleep 10 usec, so it won't behave differently in 2 vs 3. It will sleep 60+ usec on both however. It isn't really possible to sleep less than that in Python - time.sleep(0) returns "instantly" and the delay is just due to Python being not very fast.
HX711 datasheet says the minimum clock time is 0.2 usec, so just calling time.sleep(0)
(or basically any Python function) should be long enough. However leaving the current sleep won't hurt, as long as you never change it to sleep while the clock is high.
Here is the relevant cpython code from 2.7:
https://github.com/python/cpython/blob/v2.7.18/Modules/timemodule.c#L1041-L1044
The number of microseconds is converted to a long, so it has to be equal or greater than 1 usec.
In modern Python it is rounded up instead of down: https://github.com/python/cpython/blob/main/Modules/timemodule.c#L2072
from filament-scale-enhanced.
I've never had to really care that much about tight timing, so that's really neat. Though I note that python can't time down to the microsecond level, at best it'll be in the realm of millisecond accuracy. And I'm guessing we're talking about the output settling time here, which has 2 values:
time (ms) | |
---|---|
RATE = 0 | 400 |
RATE = DVDD | 50 |
So we're either not waiting long enough or really not waiting long enough. It's probably largely academic at this point, but I might change it to ensure that it's actually doing what is intended.
from filament-scale-enhanced.
I hadn't considered the effect of the settling time, although that only applies when the chip is powered down. Sleeping for 50 to 400 milliseconds is not a problem though.
The tricky one is the PD_CLK timing (page 5, T3 and T4) - measured in microseconds not milliseconds.
from filament-scale-enhanced.
Yeah, likely an academic problem at this point. It works as is, so I'm inclined to leave it for now.
from filament-scale-enhanced.
Related Issues (20)
- Use of other GPIO Pins HOT 2
- Configurable Board Mode
- Configurable Pins
- Plugin not showing up HOT 5
- IDEX dual extruder HOT 1
- Add "Print Pause" function HOT 1
- Support Multiple Sensors
- Need to tare and calibrate every reboot HOT 7
- Contextual Save
- Inconsistent Weight Readings HOT 11
- use average to avoid reading fluctuations HOT 3
- calibrate for printing mode HOT 1
- Suggestions on how to solve the accuracy and NaN issues. HOT 3
- ValueError: A different mode has already been set! HOT 4
- compatible with octoprint 1.73 HOT 3
- use a different GPIO lib for support for non pi boards
- Add support for NAU7802 I2C load cell ADC HOT 12
- ioBroker connection HOT 1
- Adding tear, remaining mass, and calibrate to octo dash HOT 2
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 filament-scale-enhanced.