meshtastic / js

JS/TS library for interfacing with Meshtastic devices
https://meshtastic.org
GNU General Public License v3.0
77 stars 36 forks source link

auto-refresh from radio at interval #77

Closed p9malino26 closed 10 months ago

p9malino26 commented 10 months ago

This PR solves the problem where the application does not constantly update from the radio. For example, this creates a problem in the Meshtastic Web app where you can't receive messages and you have to first send a message in order to display new messages.

This change makes readFromRadio be called at 1-second intervals, so that the application will refresh every second.

n.b. This works for Bluetooth connection only.

CLAassistant commented 10 months ago

CLA assistant check
All committers have signed the CLA.

sachaw commented 10 months ago

How portable is NodeJS.Timeout will that have any conflicts with other runtimes?

p9malino26 commented 10 months ago

This will only run in the browser though, right? It has no problems running on Chromium on my machine.

sachaw commented 10 months ago

I'll merge this for now, But I'd say it doesn't fix the underlying problem. What's meant to happen is that there is an event listener on one of the BLE characteristics that triggers the readFromRadio. But as per your description, I assume that isn't working.