t0nyz0 / BambuBoard

Bambu Dashboard for viewing near real time data from the Bambu X1 Carbon 3D printer.
https://t0nyz.com/projects/bambuboard
MIT License
30 stars 5 forks source link

Model image doesn't refresh #8

Open seankda opened 1 month ago

seankda commented 1 month ago

When the window is left open and new models are printed, everything but the image refreshes.

t0nyz0 commented 1 month ago

I havent seen this one. Are you using OBS mode or the normal dashboard?

seankda commented 1 month ago

Don't mind the print progress or anything having to do with the time since I had some delay taking pictures from the raspberry pi and a browser window. I have to manually refresh the window for the image to update and I've tested it on the pi, desktop and mobile. By the looks of it, the filament weight didn't update either. I can record a video after this print to show what it looks like when I start a new print.

Browser with the page refreshed image

Raspberry pi without the page refreshed rasp

t0nyz0 commented 1 month ago

I like that slimmed down version.

The model image, filament weight and total prints all come from the API call to Bambu, while the other information like the print progress and remaining minutes come directly from the printer itself. If I had to guess, there is a connection issue with the API call.

The weird thing is that usually if there is something wrong with your email/password it will never work, not even the first time. You will just see "Loading.."

If you have any firewalls I would whitelist these urls: https://bambulab.com/api/sign-in/form https://api.bambulab.com/v1/user-service/my/tasks

In the code it will grab the new model image each time it sees the layers go to "0" and the print status is "running", the best way I could find to track the start of a print.

image

Maybe some how yours never goes to 0?

seankda commented 1 month ago

I have the old print opened on both windows. After manually refreshing the window on the right, you can see the image, filament weight and total prints update. After some time, you'll see the window that was refreshed finally catch up and receive the print status, time remaining, ETA, model and layer. https://github.com/user-attachments/assets/1ba43665-e247-4073-aa27-7fc68a449de6

I haven't refreshed the browser on my pi so you'll actually see the model image from the first picture I attached and the filament weight and total prints have not updated. image

I don't have firewalls enabled but I can double check. This is also happening on my pi and phone as well (both don't have firewalls).

Also, that slimmed down version is just the lowest resolution on my pi and zoomed in lol

seankda commented 1 month ago

I havent seen this one. Are you using OBS mode or the normal dashboard?

Normal dashboard

t0nyz0 commented 1 month ago

Ah ok seeing that video actually helps a lot. That response time from the printer is extremely low. The lowest I've ever seen. My theory on that is that your latency is so high that we are getting timeouts, each timeout the BambuBoard application waits 3 seconds before attempting to reconnect again, I can lower this to 1 second to see if that might help. This is likely why you are seeing such huge delays like that.

I have a feeling that the reason your image doesnt display is because it moves off of Layer 1 before the dashboard regains the connection in time to see that it needs to refresh the image. The wifi signal is showing 80%, but keep in mind that the code is very forgiving on the Wifi signal, thats more like 60%. I'll adjust the code so the Wifi signal is 100% accurate to what Bambu tells us, right now there is a 15-20% variance.

Few more questions if you dont mind:

  1. Anyway you can test by moving the printer closer to the wifi? Or wifi closer to the printer...
  2. What version of the Rapsberry pi are you running? 1, 2, 3, 4 or 5?
  3. Are you on a Bambu X1, X1C, X1E or P1P? (The reason I ask, the P1P has a much slower processor, cant handle as much MQTT traffic)
seankda commented 1 month ago

Ah ok seeing that video actually helps a lot. That response time from the printer is extremely low. The lowest I've ever seen. My theory on that is that your latency is so high that we are getting timeouts, each timeout the BambuBoard application waits 3 seconds before attempting to reconnect again, I can lower this to 1 second to see if that might help. This is likely why you are seeing such huge delays like that.

I have a feeling that the reason your image doesnt display is because it moves off of Layer 1 before the dashboard regains the connection in time to see that it needs to refresh the image. The wifi signal is showing 80%, but keep in mind that the code is very forgiving on the Wifi signal, thats more like 60%. I'll adjust the code so the Wifi signal is 100% accurate to what Bambu tells us, right now there is a 15-20% variance.

Few more questions if you dont mind:

  1. Anyway you can test by moving the printer closer to the wifi? Or wifi closer to the printer...
  2. What version of the Rapsberry pi are you running? 1, 2, 3, 4 or 5?
  3. Are you on a Bambu X1, X1C, X1E or P1P? (The reason I ask, the P1P has a much slower processor, cant handle as much MQTT traffic)
  1. I'm not able to do either but since space is really limited and people use the internet around the clock for work. I did try to connect a wifi extender individually and simultaneously to the pi/p1s but it doesn't look like it helped. Another thing to note though is that I have a mini PC in the same room that I use for Plex streaming and it can stream 4k over wifi just fine.
  2. I'm running a 3b+ and I can try a 4 as well.
  3. Bambu P1S

If it's just the latency due to my printer's limitations, it's not a big deal! If anything I can just get an auto refresher so that it updates the other sections

t0nyz0 commented 1 month ago

Yea I've had many P1P owners reach out to me on not just this application but others I wrote that deal with Bambu MQTT. They are having similar issues. If we send too many request to the P1P it starts to backup (or maybe throttle us) from making more request. Where I never seen any more than a 4-5 second response time on X1C; its more like 4-5 min max on P1P. I think Bambu throttles the request to keep from overloading the CPU/Memory, which makes sense.

I wish I had a P1P for testing but I never give up on a challenge. Although I might close this ticket. I am going to continue to work on P1P support and will come back and update this ticket when I figured it out. Even if that means we have to separate a "P1P" version into its own repo.

t0nyz0 commented 1 month ago

With that said, if you havent already, try version 1.0.9 or above. Improvements were made to verify that only 1 connection to the printer is maintained at one time. Any other version below that could have hundreds of active connections due to a bug in the code.