fossasia / pslab-android

PSLab Android App https://play.google.com/store/apps/details?id=io.pslab
https://pslab.io
Apache License 2.0
2.04k stars 803 forks source link

Analogue waveform not generated correctly if digital waveform is used at the same time #2470

Open marcnause opened 1 month ago

marcnause commented 1 month ago

Actual Behaviour

If an analogue waveform and a digital waveform is generated with the PSLab device at the same time, the analogue waveform is not generated as selected.

Expected Behaviour

If an analogue waveform and a digital waveform is generated with the PSLab device at the same time, both waveforms are generated as selected.

Or if this is a limitation of the PSLab hardware, it should not be possible to generate analogue and digital waveforms at the same time.

Steps to reproduce it

  1. Connect Sine Wave 1 with CH1
  2. Connect Square Wave 1 with CH3
  3. Open app
  4. Go to Wave Generator
  5. Set frequency for analogue waveform
  6. Set frequency for digital waveform
  7. Start waveforms
  8. Go to oscilloscope

Screenshots of the issue

Screenshot_20240605-231558

Would you like to work on the issue?

Maybe.

marcnause commented 1 month ago

@bessman, do you know if this is a limitation of the PSLab hardware?

bessman commented 4 weeks ago

This is partly a limitation in the hardware, partly in the firmware.

Channels SI1/SQ4 are both controlled by MCU pin 56, same for pins SI2/SQ3 which are controlled by MCU pin 57. This means that the hardware cannot generate a square wave on SQ4/SQ3 and simultaneously generate an analog wave on SI1/SI2.

However, the hardware should be able to generate a square wave on SQ3 (or SQ1, SQ2, just not SQ4) and simultaneously generate an analog wave on SI1. This does not currently work due to a firmware limitation; the firmware function responsible for generating square waves on SQ3 and SQ4 use certain registers which are also used by the analog waveform generator.

The hardware limitation should be communicated to the user in some way. I should be able to remove the firmware limitation, but until then it should also be communicated to the user.

marcnause commented 4 weeks ago

Thank you for the clarification, @bessman!

I don't know what would be the best way to communicate the limitation to the user in an elegant way. Maybe change the UI to somehow indicate an analogue mode and a digital mode!?