Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison math modes #413

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/OpenHantek6022_User_Manual.odt
Binary file not shown.
12 changes: 12 additions & 0 deletions openhantek/src/hantekdso/mathchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ void MathChannel::calculate( DSOsamples &result ) {
? 1.0
: 0.0 );
break;
case Dso::MathMode::GREAT_CH1_CH2:
for ( auto it = mathChannel.begin(), end = mathChannel.end(); it != end; ++it, ++ch1Iterator, ++ch2Iterator )
*it = ( ( *ch1Iterator ) > ( *ch2Iterator )
? 1.0
: 0.0 );
break;
case Dso::MathMode::GREAT_CH2_CH1:
for ( auto it = mathChannel.begin(), end = mathChannel.end(); it != end; ++it, ++ch1Iterator, ++ch2Iterator )
*it = ( ( *ch2Iterator ) > ( *ch1Iterator )
? 1.0
: 0.0 );
break;
default:
for ( auto it = mathChannel.begin(), end = mathChannel.end(); it != end; ++it )
*it = 0.0;
Expand Down
7 changes: 6 additions & 1 deletion openhantek/src/hantekdso/mathmodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Unit mathModeUnit( MathMode mode ) {
if ( mode == MathMode::MUL_CH1_CH2 || mode == MathMode::SQ_CH1 || mode == MathMode::SQ_CH2 )
return UNIT_VOLTSQUARE;
else if ( mode == MathMode::AND_CH1_CH2 || mode == MathMode::AND_NOT_CH1_CH2 || mode == MathMode::AND_CH1_NOT_CH2 ||
mode == MathMode::AND_NOT_CH1_NOT_CH2 || mode == MathMode::EQU_CH1_CH2 || mode == MathMode::SIGN_AC_CH1 ||
mode == MathMode::AND_NOT_CH1_NOT_CH2 || mode == MathMode::EQU_CH1_CH2 || mode == MathMode::GREAT_CH1_CH2 ||
mode == MathMode::GREAT_CH2_CH1 || mode == MathMode::SIGN_AC_CH1 ||
mode == MathMode::SIGN_AC_CH2 || mode == MathMode::SIGN_CH1 || mode == MathMode::SIGN_CH2 ||
mode == MathMode::TRIG_CH2 || mode == MathMode::TRIG_CH1 || mode == MathMode::TRIG_CH2 )
return UNIT_NONE; // logic values 0 or 1
Expand Down Expand Up @@ -48,6 +49,10 @@ QString mathModeString( MathMode mode ) {
return QCoreApplication::tr( "CH1 & /CH2" );
case MathMode::EQU_CH1_CH2:
return QCoreApplication::tr( "CH1 == CH2" );
case MathMode::GREAT_CH1_CH2:
return QCoreApplication::tr( "CH1 > CH2" );
case MathMode::GREAT_CH2_CH1:
return QCoreApplication::tr( "CH2 > CH1" );
case MathMode::LP10_CH1:
return QCoreApplication::tr( "CH1 LP10" );
case MathMode::LP10_CH2:
Expand Down
4 changes: 3 additions & 1 deletion openhantek/src/hantekdso/mathmodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ enum class MathMode : unsigned {
AND_NOT_CH1_CH2,
AND_CH1_NOT_CH2,
EQU_CH1_CH2,
GREAT_CH1_CH2,
GREAT_CH2_CH1,
// unary arithmetical functions
LP10_CH1,
LP10_CH2,
Expand All @@ -47,7 +49,7 @@ enum class MathMode : unsigned {
// this "extern" declaration must match the Enum definition in "mathchannel.cpp"
extern Enum< Dso::MathMode, Dso::MathMode::ADD_CH1_CH2, Dso::MathMode::TRIG_CH2 > MathModeEnum;

const auto LastBinaryMathMode = MathMode::EQU_CH1_CH2;
const auto LastBinaryMathMode = MathMode::GREAT_CH2_CH1;
const auto LastMathMode = MathMode::TRIG_CH2;

Unit mathModeUnit( MathMode mode );
Expand Down