fossasia / pslab-python

Python Library for PSLab Desktop: https://pslab.io
GNU General Public License v3.0
1.62k stars 227 forks source link

update tria function #224

Closed suvanbanerjee closed 3 months ago

suvanbanerjee commented 3 months ago

Changed the function to abs(x % 4 - 2) and span to [0, 4] @bessman I don't have the required hardware to record the serial traffic. Closes #218

suvanbanerjee commented 3 months ago

@bessman please confirm is this correct or I have to do something else.

bessman commented 3 months ago

There is some kind of problem with the new implementation. Blue curve is old, orange is new: update_tria

I can't immediately see what the problem is. I'll give it a think and get back to you.

bessman commented 3 months ago

Only the span should be changed, not the function. The -1 in the function is necessary to get correct analog offset; pslab-android corrects for this offset in loadTable instead.

Please revert the change to tria, but keep the new span. Replace the recorded test data (tests/recordings/waveform_generator/test_triangle_wave.json) with this updated recording: test_triangle_wave.json

Verify that the test passes (pytest -k test_triangle_wave), then update the PR.

suvanbanerjee commented 3 months ago

@bessman test are working fine image

bessman commented 3 months ago

Good work, thanks!