exception DHT22 => needs update to dhtxx V1.4.0 (s...
# help
k

https://cdn.discordapp.com/attachments/1150781774859866132/1150781775006683176/2023-09-11_15h14_53.png

Version: v1.11.2 SDK version: v2.0.0-alpha.99 Build date: 2023-09-06T05:08:05Z ESP32 development board PKG: dhtxx V 1.3.1
f
Is this reproducible?
And if you downgrade to the previous version, does it work again?
k
how does the downgrade work ?
it worked with previous release
f
You would just download an older Jaguar from the release page of the github repository.
Ok. I will try to find a dht22 and try to reproduce.
Do you know which release still worked?
k
I downloaded the toit-dhtxx on 18.08.20023 and the example worked.
f
Ok. I will see which SDK version was current at that time. I have a dht22 with me and will try to reproduce at work.
k
Version: v1.10.2 SDK version: v2.0.0-alpha.94 Build date: 2023-08-09T14:57:38Z works fine
f
That's before we migrated to esp-idf V5. Maybe something went wrong during the upgrade
k
Is there a function/command to force a reset of ESP32 programmatically ? (I want to use same behaviour with/without deep sleep)
f
deep-sleep 0 is basically a reset. I don't think there is no way to reboot that also resets the RTC memory. You could try to pull down/up the reset pin by just writing to it from a different pin. Feels a bit weird, but might actually work.
I can reproduce with a DHT11. It gets one sensor reading and then crashes with the same error. Investigating (although I'm not sure I can fully solve it here, because I'm missing an oscilloscope).
k
deep-sleep 0 is basically a reset. 👍🏻 Thank you, that will do.
f
So the 1-wire protocol still works, but the DHT one doesn't. And it's not even close. (It should see 40? events, but only gets 2). Looking now, whether the 1-wire RMT peripheral is initialized differently than the DHT.
I was wrong: with the latest SDK I don't get any valid reading. Not even one.
It looks like the new RMT (from esp-idf v5) reports
1-0
signals when there are transitions that happen, but that are over the threshold duration. This wasn't the case before, and it throws the driver. I'm trying to figure out what the easiest way to work around this is.
This patch made it work for me. https://github.com/toitware/toit-dhtxx/pull/9
I will release a new version once it's reviewed and checked in.
Released, and should soon make it to the package registry.
Let me know if it doesn't fix your issue.
k
🎯 good shot it works ! Thank you.
f
thanks for reporting.
k
How to save states over restarts ( if no PSRAM is installed, standard ESP32 Dev board) ? Do I have to use flash memory (bucket store ) ?
f
You have two options: 1. write into flash, or 2. write into RTC memory
In both cases you would use a bucket.
Copy code
// Flash-storage:
  flash-bucket := storage.Bucket.open --flash "toit.io/flash-example"
  // RAM-storage:
  ram-bucket := storage.Bucket.open --ram "toit.io/ram-example"
These can then be accessed like a map:
Copy code
ram-bucket["foo"] = [1, 2, 3]
ram-bucket.get "foo"
ram-bucket.remove "foo"
k
👍🏻 Thank you, (it works)
I would ask the "oracle of toit" 😉 why the resize is used in the map_ implemention:

https://cdn.discordapp.com/attachments/1150781774859866132/1154317140950777867/image.png

I assume, the argument target is a List of the right size and cannot see, why resize is then used.
f
Most of the time the target list is just the empty list. But it would make more sense to already provide a list with the correct size.
k
map: is calling map_ with [] empty "target/List".

https://cdn.discordapp.com/attachments/1150781774859866132/1154498505994403980/image.png

... reason I dive into this is to understand blocks. I didnt spend time enough in the past ...
so the good understanding of the toit language is the basis of understanding of all the examples.
and the more I learn and understand the more gemstones i find 🙂
One year ago my attempts to walk with toit were not very successful. This year the long run tests are successful ! And it is fun to develop with jaguar.
f
Glad to hear!
k
I dont want to irritate you with irrelevants... But i find the "bool=" unclear. Is it intended to suppress "false"?

https://cdn.discordapp.com/attachments/1150781774859866132/1154689511083757578/image.png

https://cdn.discordapp.com/attachments/1150781774859866132/1154689511331201094/image.png

f
It's just saying that the parameter is optional.
Unfortunately it's not straight-forward to actually show what the default value is.
I need to refactor the compiler/toitdoc-generator to make this possible, and that would require some work.
I don't like it either...
k
... bad look for me - born as a muggle 😢