Jump to content

Jonathan MB

Members
  • Posts

    4
  • Joined

  • Last visited

Jonathan MB's Achievements

Newbie

Newbie (1/4)

2

Reputation

  1. I'm trying to create a simple waveforms script TCP REPL to remote control the Waveforms software to allow some external automation of I2C while still being able to use other parts of Waveforms software like scope. It reads data from the socket until it receives a "\n", evaluates the line and sends the return values in JSON format. This part works very well, I can connect to it and get correct responses. However, if I disconnect the client, server.isConnected() still shows true, despite there being no connection. The server port remains open and I can reconnect to it, however no data is being transmitted or received. Is there another way to detect connection loss or automatically allow reconnecting? Thanks! This is the code so far, it never reaches the print("Not Connected"). var server = Tcp(); var text = ""; var delimiter = "\n"; if(!server.listen("127.0.0.1", 50000)) throw "server error"; while(wait(0.01)){ if(!server.isConnected()){ print("Not Connected"); server.listen("127.0.0.1", 50000); while(wait(0.01)){ server.waitForNewConnection(0.1); if(server.isConnected()){break;} } print("New Connection"); } recv = server.readText(); if(!recv) {continue;} text += recv; var delimiterIndex = 0; while((delimiterIndex = text.indexOf(delimiter)) !== -1) { const line = text.slice(0, delimiterIndex); text = text.slice(delimiterIndex + delimiter.length); try { var resp = eval(line); } catch (e) { var resp = e; } if(server.isConnected()){ server.writeText(JSON.stringify(resp)+"\n"); } } } print("Disconnect"); server.disconnect(); server.close();
  2. Sorry for the late reply, changing project priorities, the usual... Anyway, that looks great, thanks! Also, just in general, the level of support in this forum and especially by you is incredible! Thank you so much for making a $100 range measurement equippment easier and faster to use than above 10k professional scopes!
  3. Hi everyone, I'd like to compare the I2S input to the anlog output of a Class-D Amp in "Scope" in Waveforms. With V3.22.27 this is kindof possible by first adding a digital I2S channel and then adding a custom Math channel with the formula "I2S". However this doesn't doesn't apply the two's complement claculation and always shows both channels, resulting in a chopped waveform compared to the . Is there a way to also apply the Settings for the digital I2S channel (especially "Format:" and "Show:") to the waveform displayed in the scope? Here's a screenshot. The green waveform is the current way it's decoded it and the bottom black waveform would be the ideal version: I've tried to cheat it a bit by manually "decoding" the two's complement in the custom math function but I'm not able to get rid of the chopping. Thanks! Ps. to everyone working on this project, it's absolutely incredibly how much is possible with such an inexpensive tool and great software! I'll chose Waveforms over the laggy touch screen interface of a $10,000 Rhode&Schwarz every day ;)
×
×
  • Create New...