nesnes / teleplot

Ridiculously-simple telemetry viewer. Plots charts in browser from any apps (bash, C++, and more!)
MIT License
115 stars 16 forks source link

UDP not giving data in Teleplot #39

Open AmberElferink opened 6 days ago

AmberElferink commented 6 days ago

I cannot seem UDP plotting to work on teleplot, even running the basic python example. image

default code I'm running

import socket
import math
import time

teleplotAddr = ("127.0.0.1",47269)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

def sendTelemetry(name, value):
    now = time.time() * 1000
    msg = name+":"+str(now)+":"+str(value)+"|g"
    sock.sendto(msg.encode(), teleplotAddr)

i=0
while i < 1000:

    sendTelemetry("sin", math.sin(i))
    sendTelemetry("cos", math.cos(i))

    i+=0.1
    time.sleep(0.01)
AmberElferink commented 5 days ago

I think this is because I was using Serial communication before. After restarting my computer it did work. So removing the serial port from the Teleplot menu is not enough. If you just start Teleplot without at any point having connected to Serial, it shows the play button top right. Clicking that gives the data as expected while running the python script.

And that only seems to work within the same window the python script is running. A second VSCode running with Teleplot will not show the play button.