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

How to use Customize frame parser in Project Editor to phase my data. #185

Open
maming214 opened this issue Apr 4, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@maming214
Copy link

for example ,i have data such as AA BB 0A 0B F4
AA BB is frame head,F4 is this data of sum check
if frame head and check is right ,i will phase it ,or i will not phase it.
How to use Customize frame parser in Project Editor to phase my data.
can you give me an example ,thank you

@maming214 maming214 added the enhancement New feature or request label Apr 4, 2024
@alex-spataru
Copy link
Member

Hi! You need to write your own JavaScript code for that. I haven't tried doing this with my projects, but my rough guess would be:

  1. You still need to use frame start/end delimiters for Serial Studio to know how to differentiate between one frame and the other.
  2. Define a CSV-like frame format for your project and define your groups & widgets as you would normally do.
  3. The frame parsing function takes as an input the data between the frame delimiters and returns an array. In your case, we need to parse each byte & push it to the generated array, compute the checksum and compare it with the checksum contained in the received data.
  4. If both checksums are equal, return the generated array. If there is a difference, simply return an empty array so that Serial Studio ignores it.

Important note: I haven't really tried using Serial Studio and sending raw data directly. Later this week, I will build a simple Arduino-based example that encodes each reading from the ADC pins as a byte, add a simple 8-bit checksum & generate a Serial Studio project for that. It might be necessary for me to modify Serial Studio codebase, I'll keep you updated.

For the future, another idea for binary/hex frames would be to specify only the header byte (e.g. frame start sequence) and the index of the byte that specifies the length of the frame data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants