fix:修复示波器获取失败的问题
This commit is contained in:
@@ -10,7 +10,7 @@ namespace server.Controllers;
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize(Roles = "User")]
|
||||
[Authorize]
|
||||
public class OscilloscopeApiController : ControllerBase
|
||||
{
|
||||
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
@@ -298,21 +298,11 @@ public class OscilloscopeApiController : ControllerBase
|
||||
if (oscilloscope == null)
|
||||
return BadRequest("用户未绑定有效的实验板");
|
||||
|
||||
// 并行获取所有数据
|
||||
var freqTask = oscilloscope.GetADFrequency();
|
||||
var vppTask = oscilloscope.GetADVpp();
|
||||
var maxTask = oscilloscope.GetADMax();
|
||||
var minTask = oscilloscope.GetADMin();
|
||||
var waveformTask = oscilloscope.GetWaveformData();
|
||||
|
||||
await Task.WhenAll(freqTask.AsTask(), vppTask.AsTask(), maxTask.AsTask(),
|
||||
minTask.AsTask(), waveformTask.AsTask());
|
||||
|
||||
var freqResult = await freqTask;
|
||||
var vppResult = await vppTask;
|
||||
var maxResult = await maxTask;
|
||||
var minResult = await minTask;
|
||||
var waveformResult = await waveformTask;
|
||||
var freqResult = await oscilloscope.GetADFrequency();
|
||||
var vppResult = await oscilloscope.GetADVpp();
|
||||
var maxResult = await oscilloscope.GetADMax();
|
||||
var minResult = await oscilloscope.GetADMin();
|
||||
var waveformResult = await oscilloscope.GetWaveformData();
|
||||
|
||||
if (!freqResult.IsSuccessful)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user