fossasia / pslab-firmware

Firmware for PSLab Open Hardware Platform https://pslab.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CH1/CH2 gain not working

bessman opened this issue · comments

OSCILLOSCOPE_SetPGAGain takes the channel number as its first parameter over serial, with 1 referring to CH1 and 2 referring to CH2. The received value is currently interpreted directly as a tSPI_CS, which is incorrect. tSPI_CS maps:

1 -> SPI_CH2
2 -> SPI_PS (power source)

OSCILLOSCOPE_SetPGAGain therefore selects the wrong chip.

When reading the channel from serial, OSCILLOSCOPE_SetPGAGain should choose the correct tSPI_CS member, i.e.:

1 -> SPI_CH1
2 -> SPI_CH2