Comments (5)
@mdingena It is possible, but it is not documented and I have not done a lot of testing on it. The reason this function exists at all is complicated and historic. I am going to show you how, but please do not file bug reports when the API changes without notice. This is an undocumented feature and the reason we have not added it to the docs is that the API is kind of ugly and I would prefer to ship a long-term solution.
ANALOG = 1
DIGITAL = 0
pos = get_position()
pin = 13
return new_sensor_reading({
mode = DIGITAL,
pin = pin,
value = read_pin(pin),
x = pos.x,
y = pos.y,
z = pos.z
})
from farmbot_os.
Thanks for the bug report @mdingena and particularly for the screenshots (they help us understand the problem better). Gabriel has started work on the UI fixes, which will be deployed shortly. I will investigate the read_pin
matter.
from farmbot_os.
I've done some troubleshooting. I've got both a Read Sensor command and an Assertion command in the tool verification sequence. I do this because I want a sensor data point and also want to make a programmatic decision based on the value.
I had a hunch that reading the pin twice in rapid succession was causing issues. I've added a Wait command (2000 ms) but the Assertion still goes to "failure" when the tool is actually attached. I found that manually reading the tool verification pin after this sequence incorrectly goes to "failure", the reading is incorrect also, and it requires me to detach the tool by hand and read the pin manually so that it correctly reads the tool is not there before it will correctly read attached and detached states.
Then I removed the manual Read Sensor command from the sequence altogether. And lo and behold, it will now consistently read the tool verification pin correctly.
It seems that:
- Using Read Sensor and Assertion with
read_pin
in the same sequence can be incompatible in some scenarios. - After incorrectly reading the pin, it becomes "stuck" in that mode until you modify the situation so that what it's stuck on is what it's going to read. I.e. when it thinks the tool is not attached, you need to detach the tool and re-read the pin for it to become "unstuck" on "not attached".
from farmbot_os.
Thanks for the update @mdingena. That's very helpful for isolating a root cause and glad you were able to find a workaround in the interim.
from farmbot_os.
Is it possible to add a "sensor data point" via Lua? Then I can read the pin once, and then save it both as a data point and return it for the Assertion success/fail triggers.
If fixing the bug is too hard to address in the short-term, an interim solution could be that you detect if both a Read Sensor and Assertion block containing read_pin
are present in the same sequence, and prevent the sequence from saving, or something.
from farmbot_os.
Related Issues (20)
- [Farmware] Did you stop supporting the local webserver on port 27347? HOT 10
- Need to Configure VintageNet `:internet_host` setting
- [bug, cosmetic] unhandled message in error state: after Farmware exits normally HOT 8
- A simulator for the farmbot HOT 10
- Feture Reuest: "After Unlock" Sequence Callback
- Unused variable warning is polluting the Serial Console :) 10.1.3 HOT 9
- "since last reflash" metrics and flags
- Lua Persistent Storage (K/V store)
- Mark As command does not update plant age
- Seems to be an issue HOT 2
- Can't flash Arduino with firmware HOT 5
- DIdnt see a Doc project, so putting this here. Hyperlink issue with doc webpage HOT 1
- fail to falsh fambot _os HOT 5
- WiFi Adapters HOT 6
- how can i change the broker ? HOT 2
- Boot Sequence execution may be delayed by earlier (overdue) FarmEvent sequence executions HOT 2
- Water keeps running if FB stalls during the execution of a sequence / Risk of flooding HOT 1
- Sequence Not Found error is not sent back to MQTT RPC Client
- Configurator Improvements
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 farmbot_os.