Skip to content
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

Conversation

masterboy376
Copy link

This PR do the following:

  1. Adds writeData function toSerial.js file which can be used to write serial data to the connect devices.
  2. Modifies Connect function to initialize write whenever any new connection is established.
  3. Modifies Disconnect function to release writer's lock and clear it from the state.

@Witty-Wizard Witty-Wizard added enhancement 🪄 New feature or request gssoc Issue created for GSSoC' 24 level2 Issue created for GSSoC' 24 labels May 12, 2024
Copy link
Contributor

@Witty-Wizard Witty-Wizard left a 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 :

  1. Go to testing/tester.py
  2. In tester.py file add a function that listens for data and prints it.
  3. and for sending data send some dummy data for now.
  4. once you have made these changes, I will test these changes on actual hardware and if they pass I will merge this PR

src/components/Serial/Serial.js Outdated Show resolved Hide resolved
@masterboy376
Copy link
Author

HI!, @masterboy376 , Can you test if this function works. For that :

  1. Go to testing/tester.py
  2. In tester.py file add a function that listens for data and prints it.
  3. and for sending data send some dummy data for now.
  4. 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

@masterboy376
Copy link
Author

@Witty-Wizard PTAL

@Witty-Wizard Witty-Wizard self-requested a review May 14, 2024 02:52
// 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) {
Copy link
Contributor

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)

Copy link
Contributor

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

Copy link
Contributor

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.

@Witty-Wizard Witty-Wizard added the do not merge 🚫 The overlords do not approve label May 22, 2024
Copy link

sonarcloud bot commented May 24, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge 🚫 The overlords do not approve enhancement 🪄 New feature or request gssoc Issue created for GSSoC' 24 level2 Issue created for GSSoC' 24 Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants