using MrEModuleSdk.Devices.Mre3;
using MrEModuleSdk.Dto;
using System;

namespace Mre3Example
{
    public partial class Mre3Example
    {
        private static void RunReadoutValuesExample(IMrE3SdkComDeviceController controller)
        {
            Console.WriteLine("Readout values example");
            Console.WriteLine("Shows several commonly read values and demonstrates a writable parameter.");
            Console.WriteLine();

            Console.WriteLine($"Output stage temperature: {controller.TemperatureManager.ReadBoardOutputStageTemperature():F2} deg C");
            Console.WriteLine($"Proxy temperature: {controller.TemperatureManager.ReadProxyTemperature():F2} deg C");
            Console.WriteLine($"Mirror temperature: {controller.TemperatureManager.ReadDeviceTemperature():F2} deg C");
            Console.WriteLine($"Front-end voltage: {controller.MiscellaneousFeatures.GetUfe():F3} V");
            Console.WriteLine($"Operation mode: {controller.MiscellaneousFeatures.GetOperationMode()}");
            Console.WriteLine($"Current limit on axis X: {controller.SignalFlowManager.OutputStage.LinearOutput.ReadCurrentLimit(EAxis.X):F3} A");
            Console.WriteLine($"Current limit on axis Y before update: {controller.SignalFlowManager.OutputStage.LinearOutput.ReadCurrentLimit(EAxis.Y):F3} A");

            controller.SignalFlowManager.OutputStage.LinearOutput.WriteCurrentLimit(EAxis.Y, 0.4f);
            Console.WriteLine($"Current limit on axis Y after update: {controller.SignalFlowManager.OutputStage.LinearOutput.ReadCurrentLimit(EAxis.Y):F3} A");

            WaitForEnter();
        }
    }
}
