private int readPowerSupply() { double num; switch (this._readPowerSupplyTaskId) { case ReadPowerSupply_Task.None: if (this.send_ReadPowerSupplyCommand(CurrentStrengthUnit.mA) != 0) { return -1; } this._readPowerSupplyTaskId = ReadPowerSupply_Task.Read_mA; return 0; case ReadPowerSupply_Task.Read_mA: num = Math.Round((double) ((24.4 * (0x3ff - this._powerSupply_readout)) / 1000.0), 1); if (num < 1.2) { if (this.send_ReadPowerSupplyCommand(CurrentStrengthUnit.uA) == 0) { this._readPowerSupplyTaskId = ReadPowerSupply_Task.Read_uA; } goto Label_015E; } if (num < 24.2) { this.tsrMainToolStrip.setCurrentText(num.ToString("0.##") + " mA"); break; } this.tsrMainToolStrip.setCurrentText("> 24.2mA"); break; case ReadPowerSupply_Task.Read_uA: num = Math.Round((double) (48.8 * (0x3ff - this._powerSupply_readout)), 1); if (num > 1.2) { this.tsrMainToolStrip.setCurrentText(num.ToString("0.##") + " \x00b5A"); } else { this.tsrMainToolStrip.setCurrentText("< 1\x00b5A"); } this._readPowerSupplyTaskId = ReadPowerSupply_Task.StopRead; this.readPowerSupply(); goto Label_015E; case ReadPowerSupply_Task.StopRead: if (this._task_id == Task.ReadPowerSupply) { this._task_id = Task.None; this._readPowerSupplyTaskId = ReadPowerSupply_Task.None; this.unLockDeviceButtons(); } goto Label_015E; default: goto Label_015E; } this._readPowerSupplyTaskId = ReadPowerSupply_Task.StopRead; this.readPowerSupply(); Label_015E: return 0; }
public int startReadPowerSupply(bool continuousMode) { this._task_id = Task.ReadPowerSupply; this._readPowerSupplyTaskId = ReadPowerSupply_Task.None; return this.readPowerSupply(); }