-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Added feature to write serial data using web serial API #42
[Feature]: Added feature to write serial data using web serial API #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI!, @masterboy376 , Can you test if this function works. For that :
- Go to testing/tester.py
- In tester.py file add a function that listens for data and prints it.
- and for sending data send some dummy data for now.
- once you have made these changes, I will test these changes on actual hardware and if they pass I will merge this PR
@Witty-Wizard done |
@Witty-Wizard PTAL |
// It writes data from the serial port and dispatches it to the redux store | ||
export async function writeData(writer, isConnected, port, dataToWrite) { | ||
// While the port is connected and writable | ||
while (isConnected && port.writable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this line don't use a while loop as that will continue to send the same data,instead use an if statement
if (isConnected && port.writable)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@masterboy376, please look into this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing this on your system there is a tool com0com please try running the script on that, I am getting an error that access is denied. This is an issue related to multiprocessing module and how it handles serial communication.
|
This PR do the following:
writeData
function toSerial.js file which can be used to write serial data to the connect devices.Connect
function to initialize write whenever any new connection is established.Disconnect
function to release writer's lock and clear it from the state.