Hey, I've been working on rewriting a bluetooth driver (written in C#) in TS with the web serial API. this is a uni project I'm working on but for the life of me I can't figure out what's going wrong. if you press startDevice (starts measuring), and then press stopDevice, it doesn't execute the commands properly and it becomes a chaos. like it takes 2-3 presses to stop it, but at that point it starts delaying all commands through one another.
Context for the image: When sending the start command, it executes everything besides the :END? command, and when you press the stopDevice button it starts with executing the stop command, but doesn't actually send the :STOP command, but sends the :END? command from the start command I believe? pressing the stopDevice button once more, will execute the stop command properly, but also doesn't execute the :END? command from that one. trying startDevice once more will result in an error.
does anyone maybe know the issue, or work arounds I could try? I've tried using releaseLock() to make some kind of reset for the reader and writer but this always ends up with the error "writer has been locked" or "reader has been locked" even tho I reinstated the writer/reader