-
Tue 2021.10.05
reply to post #13
'I lost the ability to send from the website to the watch now, as pressing the button that calls the function Puck.write('E.showMessage("HELLO","Message")'); instead of making the watch show it as before, it asks for a new ble connection.'
Another struggle was maintaining page state and still update sections within the page. It was likely that a page refresh or something of the sort caused the OTA connection to be lost. One quick verification check, did a new reloading the page and then interacting with BLE allow the re-pairing and re-connecting to occur?
The trick is to update a part of the page without refreshing the entire page. This keeps the DOM intact after establishing the BLE connection. I played with hidden divs and iframes along with global vs local and attempts with IIFE but never really settled on one technique.
I was able to receive words from button press, but I'm a bit confused as of why it works only one time for each button press. This is all the code in my banglejs app:
setWatch(() => {
E.showMessage("sent");
Bluetooth.println("sent");
setTimeout(()=>g.clear(), 5000);
}, BTN3);
setWatch(() => {
E.showMessage("hear");
Bluetooth.println("hear");
setTimeout(()=>g.clear(), 5000);
}, BTN1);
I lost the ability to send from the website to the watch now, as pressing the button that calls the function Puck.write('E.showMessage("HELLO","Message")'); instead of making the watch show it as before, it asks for a new ble connection.