Bug 1840

Summary: Request: use the output of a decoder as input for a math channel
Product: PulseView Reporter: cedric <cedric.dewijs>
Component: Protocol decodingAssignee: Nobody <nobody>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unreleased development snapshot   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Screenshot showing a mockup for a math channel taking the output of a decoder as input

Description cedric 2023-04-15 18:43:27 CEST
Created attachment 795 [details]
Screenshot showing a mockup for a math channel taking the output of a decoder as input

Overview:

I would like to use the output of a decoder as input for a math channel, for instance for plotting the PWM value of a motor driver, along with the output of the encoder decoder (so I see the motor RPM), so I can see at a glance if my PID controller works correctly.

Steps to Reproduce:
1) Start Pulseview
2) Remove all analog channels, except A2 (trangle), remove all digital channels except D0,D1,D2, and choose pattern-> graycode.
3) From the top, choose 100 samples, and 100Hz, then press run.
4) Press "add protocol decoder", choose encoding - gray code. Now the docoder automatically attached itself to D0,D1,D2, and decodes 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 1 2 3 and so on at "Gray Code phases"
5) Click "Add math channel". the signal trace "Math1" appears.
6) Click "Math1", and then the 4 symbols at the end of the line "expression". Now the "Math Expression Editor" appears.
7) Enter the following expression and click OK. now the math channel displays the same triangle as A2
var theSample := sample ('A2',s);

Actual Results:
It's not possible to use the "Gray Code: Phases" as an input to a math  channel, only analog inputs (in this example only A2 can be chosen)

Expected Results:
I would like to be able to enter something like this expression in the math Expression editor, and end up with a trangle displying the values the gray code decoder has figured out:
var theSample := sample ('Gray Code: Phases',s);

Build Date & Hardware: I build it myself on 04/15/2023 on a 64 bit AMD machine.
PulseView 0.5.0-git-62c0968
libsigrok 0.6.0-git/4:0:0 (rt: 0.6.0-git-5bce22ac/4:0:0)
Kernel version: $ uname -a 
Linux cedric 6.2.11-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 13 Apr 2023 16:59:24 +0000 x86_64 GNU/Linux

Additional Builds and Platforms:
Not tested

Additional Information:
See the attached screenshot for a mockup of what I would like math1 to be