Skip to content

Commit

Permalink
Refactored ISI measurement. See #458.
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Mar 21, 2023
1 parent 2af60e7 commit 4089624
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
20 changes: 4 additions & 16 deletions scopeprotocols/ISIMeasurement.cpp
Expand Up @@ -2,7 +2,7 @@
* *
* libscopeprotocols *
* *
* Copyright (c) 2012-2022 Andrew D. Zonenberg and contributors *
* Copyright (c) 2012-2023 Andrew D. Zonenberg and contributors *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
Expand Down Expand Up @@ -37,7 +37,7 @@ using namespace std;
ISIMeasurement::ISIMeasurement(const string& color)
: Filter(color, CAT_MEASUREMENT)
{
AddStream(Unit(Unit::UNIT_FS), "data", Stream::STREAM_TYPE_ANALOG);
AddStream(Unit(Unit::UNIT_FS), "data", Stream::STREAM_TYPE_ANALOG_SCALAR);

//Set up channels
CreateInput("DDJ");
Expand Down Expand Up @@ -65,19 +65,14 @@ string ISIMeasurement::GetProtocolName()
return "ISI";
}

bool ISIMeasurement::IsScalarOutput()
{
return true;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Actual decoder logic

void ISIMeasurement::Refresh()
{
if(!VerifyAllInputsOK())
{
SetData(NULL, 0);
m_streams[0].m_value = 0;
return;
}

Expand Down Expand Up @@ -114,12 +109,5 @@ void ISIMeasurement::Refresh()
float rising_pp = rising_max - falling_min;
float falling_pp = falling_max - falling_min;

float isi = max(rising_pp, falling_pp);

auto cap = SetupEmptyUniformAnalogOutputWaveform(din, 0);
cap->m_samples.push_back(isi);
cap->m_timescale = 1;
SetData(cap, 0);

cap->MarkModifiedFromCpu();
m_streams[0].m_value = max(rising_pp, falling_pp);
}
4 changes: 1 addition & 3 deletions scopeprotocols/ISIMeasurement.h
Expand Up @@ -2,7 +2,7 @@
* *
* libscopeprotocols *
* *
* Copyright (c) 2012-2022 Andrew D. Zonenberg and contributors *
* Copyright (c) 2012-2023 Andrew D. Zonenberg and contributors *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
Expand Down Expand Up @@ -42,8 +42,6 @@ class ISIMeasurement : public Filter

virtual void Refresh();

virtual bool IsScalarOutput();

static std::string GetProtocolName();

virtual bool ValidateChannel(size_t i, StreamDescriptor stream);
Expand Down

0 comments on commit 4089624

Please sign in to comment.