from rigol_py_rig.rigol import RigolOsc
from rigol_py_rig.siglent import SiglentGen, ChannelID

import matplotlib.pyplot as plt


# uv
def main():

    gen = SiglentGen("TCPIP::10.112.1.17::INSTR")

    gen.channels[ChannelID.CH1].apply_sine(2e3, 1, 0)
    gen.channels[ChannelID.CH1].set_output(1)

    return

    # osc = RigolOsc("TCPIP::10.112.1.9::INSTR")
    print(osc.getTrigStatus())
    osc.single()

    # osc.setPoints(depth)

    ret = osc.channels[0].getWaveform()

    print(osc.channels[0].getOffset())

    print(f"Y inc {osc.channels[0].getYincrement()}")
    print(f"X inc {osc.channels[0].getXincrement()}")

    print(f"Y orogin {osc.channels[0].getYOrigin()}")
    print(f"Y reference {osc.channels[0].getYReference()}")

    plt.plot(osc.channels[0].genTimeArray(ret), ret)
    plt.show()


if __name__ == "__main__":
    main()
