Replies: 5 comments 11 replies
|
With the regular front page mechanism relying on what is returned from the Beware of the f-string syntax, where Maybe it would be feasible to call an update function there, with the page already having the main JS code. Not clear what you ask for with "how to repeat the Berry calculations", what the issue is? While I did not look much at the code, I did notice a conversion pattern repeated a lot. Instead of: BTW. The config function does calls like |
|
Quick Update: Spent some long sessions with Gemini to cleanup everything. I am in the process of expanding the code to show all three targets detected by the sensor. Will post the complete code once I have done that. One of the main flaws that I had in my code was the missing content_send command in the following code snippet The data was not getting into browser. Fix was to add:
Final Solution: Inside the javascript code the data is picked up by global variables: |
|
This is awesome. Would you consider packing it all in a Tasmota Extension so other users can easily load it? By the way, construct like: var gui_rows = string.format(
"{s}RD-03D Data<hr>{e}" ..
"{s}1st Target X{m}%i mm{e}" ..
"{s}1st Target Y{m}%i mm{e}" ..
"{s}1st Target Speed{m}%i cm/sec{e}" ..
[...]Can be better written with a single literal string (no need for var gui_rows = string.format(
"{s}RD-03D Data<hr>{e}"
"{s}1st Target X{m}%i mm{e}"
"{s}1st Target Y{m}%i mm{e}"
"{s}1st Target Speed{m}%i cm/sec{e}"
[...] |
|
Here is my main code which reads the serial data. I have stripped off the middle part for clarity. Currently I am reading the entire buffer. Most of the time the buffer will only have 30 bytes. Occasionally I can see two frames ie. 60 bytes. I want to improve this code to:
If I read one byte at a time from the incoming buffer, I can do it. However I believe that it will be ineficient. Could you suggest a way to read a sliding window of 30 bytes at a time and and then check for header and the tail? |




Uh oh!
There was an error while loading. Please reload this page.
I am attempting to write a driver for RD-03D mmwave Radar Sensor in Berry.
https://en.ai-thinker.com/pro_view-140.html
The sensor gives out a 30byte data stream periodically.
I used an ESP32-C6 with GPIO0 (Rx) and GPIO1(Tx) for the setup.
My script below probably needs lot of cleanup as this is the first time that I am trying to write a driver for such a device.
The above works in principle:

I have two issues:
Issue 1:
I am not quite sure as how to refresh the
webserver.content_sendcontent to be in sync withweb_sensor().I tried calling the function
self.web_add_main_button()but the radar blip does not get refreshed.Issue 2:
The placeholder for Radar Screen animation appears twice when I make a function call inside the
web_sensor()above.Still the auto refresh does not work.
The javascript code on its own gets refreshed but I do not know how to repeat the Berry calculations in this part:
Need some suggestions to get the data sent to Radar Animation when web sensor is invoked.
Also note that my serial data read part needs improvement to check the frame header and process the rest. I know how to do that.
Any other suggestions to improve the code is more than welcome.
Thanks in advance!
All reactions