Skip to content

Commit

Permalink
fix Windows MSVC stupidity again
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
  • Loading branch information
Ho-Ro committed Apr 2, 2022
1 parent fe0393d commit 5973a32
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 95 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include(cmake/CPackInfos.cmake)

if(MSVC)
# NOMINMAX to avoid clash with std::min or std::max due to silly macros min and max
add_compile_options(/W4 /D_CRT_SECURE_NO_WARNINGS)
add_compile_options(/W4 /D_CRT_SECURE_NO_WARNINGS /DNOMINMAX)
else()
add_compile_options(-Wall -Wextra -pedantic)
endif()
Expand Down
2 changes: 1 addition & 1 deletion openhantek/src/OH_BUILD.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Do not edit, will be re-created at each commit!
#define OH_BUILD "20220402 - commit 979"
#define OH_BUILD "20220402 - commit 980"
4 changes: 1 addition & 3 deletions openhantek/src/docks/VoltageDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ VoltageDock::VoltageDock( DsoSettingsScope *scope, const Dso::ControlSpecificati
if ( scope->verboseLevel > 1 )
qDebug() << " VoltageDock::VoltageDock()";

const size_t MATH = 2;

// Initialize lists for comboboxes
for ( Dso::Coupling c : spec->couplings )
if ( c == Dso::Coupling::DC || scope->hasACcoupling || scope->hasACmodification )
Expand Down Expand Up @@ -136,7 +134,7 @@ VoltageDock::VoltageDock( DsoSettingsScope *scope, const Dso::ControlSpecificati
if ( channel < this->spec->channels )
mask = channel + 1;
else
mask = Dso::mathChannelsUsed( Dso::MathMode( this->scope->voltage[ MATH ].couplingOrMathIndex ) );
mask = Dso::mathChannelsUsed( Dso::MathMode( this->scope->voltage[ 2 ].couplingOrMathIndex ) );
}
emit usedChannelChanged( channel, mask ); // channel bit mask 0b01, 0b10, 0b11
} );
Expand Down
36 changes: 18 additions & 18 deletions openhantek/src/post/spectrumgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ void SpectrumGenerator::process( PPresult *result ) {
channelData->spectrum.samples.resize( size_t( sampleCount ) );

// calculate the peak-to-peak value of the displayed part of trace
double mini = INT_MAX;
double maxi = INT_MIN;
double min = INT_MAX;
double max = INT_MIN;
double horizontalFactor = result->data( channel )->voltage.interval / scope->horizontal.timebase;
unsigned dotsOnScreen = unsigned( DIVS_TIME / horizontalFactor + 0.99 ); // round up
unsigned preTrigSamples = unsigned( scope->trigger.position * dotsOnScreen );
Expand All @@ -226,14 +226,14 @@ void SpectrumGenerator::process( PPresult *result ) {
for ( int position = left; // left side of trace
position <= right; // right side
++position ) {
if ( channelData->voltage.samples[ unsigned( position ) ] < mini )
mini = channelData->voltage.samples[ unsigned( position ) ];
if ( channelData->voltage.samples[ unsigned( position ) ] > maxi )
maxi = channelData->voltage.samples[ unsigned( position ) ];
if ( channelData->voltage.samples[ unsigned( position ) ] < min )
min = channelData->voltage.samples[ unsigned( position ) ];
if ( channelData->voltage.samples[ unsigned( position ) ] > max )
max = channelData->voltage.samples[ unsigned( position ) ];
}
channelData->vmin = mini;
channelData->vmax = maxi;
// channelData->vpp = maxi - mini;
channelData->vmin = min;
channelData->vmax = max;
// channelData->vpp = max - min;

// calculate the average value
double dc = 0.0;
Expand Down Expand Up @@ -261,7 +261,7 @@ void SpectrumGenerator::process( PPresult *result ) {

// Do discrete real to half-complex transformation
// Record length should be multiple of 2, 3, 5: done, is 10000 = 2^a * 5^b
fftHcSpectrum = fftw_alloc_real( size_t( qMax( SAMPLESIZE, sampleCount ) ) );
fftHcSpectrum = fftw_alloc_real( size_t( std::max( SAMPLESIZE, sampleCount ) ) );
if ( nullptr == fftHcSpectrum ) // error
break;
if ( post->reuseFftPlan ) { // build one optimized plan and reuse it for all transformations
Expand Down Expand Up @@ -367,8 +367,8 @@ void SpectrumGenerator::process( PPresult *result ) {
double peakSpectrum = offsetLimit; // get a start value for peak search
int peakFreqPos = 0; // initial position of max spectrum peak
position = 0;
mini = INT_MAX;
maxi = INT_MIN;
min = INT_MAX;
max = INT_MIN;
for ( auto &oneSample : channelData->spectrum.samples ) {
// spectrum is power spectrum, but show amplitude spectrum -> 10 * log...
double value = 10 * log10( oneSample ) + offset;
Expand All @@ -381,14 +381,14 @@ void SpectrumGenerator::process( PPresult *result ) {
peakSpectrum = value;
peakFreqPos = position;
}
if ( value < mini )
mini = value;
if ( value > maxi )
maxi = value;
if ( value < min )
min = value;
if ( value > max )
max = value;
++position;
}
channelData->dBmin = mini;
channelData->dBmax = maxi;
channelData->dBmin = min;
channelData->dBmax = max;

// Calculate both peak frequencies (correlation and spectrum) in Hz
double pF = channelData->spectrum.interval * peakFreqPos;
Expand Down
16 changes: 8 additions & 8 deletions openhantek/translations/openhantek_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2312,27 +2312,27 @@
<translation>Spannung</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<location filename="../src/docks/VoltageDock.cpp" line="55"/>
<source>CH&amp;%1</source>
<translation>CH&amp;%1</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="59"/>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<source>MA&amp;TH</source>
<translation>MA&amp;TH</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="62"/>
<location filename="../src/docks/VoltageDock.cpp" line="60"/>
<source>Voltage range per vertical screen division</source>
<translation>Spannung pro vertikaler Teilung</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="74"/>
<location filename="../src/docks/VoltageDock.cpp" line="72"/>
<source>Select DC or AC coupling</source>
<translation>Wähle AC- oder DC-Kopplung</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="77"/>
<location filename="../src/docks/VoltageDock.cpp" line="75"/>
<source>Select the mathematical operation for this channel</source>
<translation>Berechnungen für diesen Kanal</translation>
</message>
Expand All @@ -2341,17 +2341,17 @@
<translation type="vanished">&amp;MATH</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<location filename="../src/docks/VoltageDock.cpp" line="61"/>
<source>Invert</source>
<translation>Invertiert</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="65"/>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<source>Set probe attenuation, scroll or type a value to select</source>
<translation>Wähle Tastkopf-Abschwächung, Mausrad oder direkte Eingabe möglich</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="68"/>
<location filename="../src/docks/VoltageDock.cpp" line="66"/>
<source>x</source>
<translation></translation>
</message>
Expand Down
16 changes: 8 additions & 8 deletions openhantek/translations/openhantek_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2079,42 +2079,42 @@
<translation>Voltaje</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<location filename="../src/docks/VoltageDock.cpp" line="55"/>
<source>CH&amp;%1</source>
<translation></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="59"/>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<source>MA&amp;TH</source>
<translation></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="62"/>
<location filename="../src/docks/VoltageDock.cpp" line="60"/>
<source>Voltage range per vertical screen division</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="74"/>
<location filename="../src/docks/VoltageDock.cpp" line="72"/>
<source>Select DC or AC coupling</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="77"/>
<location filename="../src/docks/VoltageDock.cpp" line="75"/>
<source>Select the mathematical operation for this channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<location filename="../src/docks/VoltageDock.cpp" line="61"/>
<source>Invert</source>
<translation>Invertir</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="65"/>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<source>Set probe attenuation, scroll or type a value to select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="68"/>
<location filename="../src/docks/VoltageDock.cpp" line="66"/>
<source>x</source>
<translation></translation>
</message>
Expand Down
16 changes: 8 additions & 8 deletions openhantek/translations/openhantek_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2247,32 +2247,32 @@
<translation>Tension</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<location filename="../src/docks/VoltageDock.cpp" line="55"/>
<source>CH&amp;%1</source>
<translation></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="59"/>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<source>MA&amp;TH</source>
<translation></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="62"/>
<location filename="../src/docks/VoltageDock.cpp" line="60"/>
<source>Voltage range per vertical screen division</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="74"/>
<location filename="../src/docks/VoltageDock.cpp" line="72"/>
<source>Select DC or AC coupling</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="77"/>
<location filename="../src/docks/VoltageDock.cpp" line="75"/>
<source>Select the mathematical operation for this channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="65"/>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<source>Set probe attenuation, scroll or type a value to select</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -2281,7 +2281,7 @@
<translation type="vanished">&amp;MATH</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<location filename="../src/docks/VoltageDock.cpp" line="61"/>
<source>Invert</source>
<translation>Inverser</translation>
</message>
Expand All @@ -2290,7 +2290,7 @@
<translation type="vanished">x10</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="68"/>
<location filename="../src/docks/VoltageDock.cpp" line="66"/>
<source>x</source>
<translation></translation>
</message>
Expand Down
16 changes: 8 additions & 8 deletions openhantek/translations/openhantek_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1696,42 +1696,42 @@
<translation>Tensione</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<location filename="../src/docks/VoltageDock.cpp" line="55"/>
<source>CH&amp;%1</source>
<translation></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="59"/>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<source>MA&amp;TH</source>
<translation></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="62"/>
<location filename="../src/docks/VoltageDock.cpp" line="60"/>
<source>Voltage range per vertical screen division</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="74"/>
<location filename="../src/docks/VoltageDock.cpp" line="72"/>
<source>Select DC or AC coupling</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="77"/>
<location filename="../src/docks/VoltageDock.cpp" line="75"/>
<source>Select the mathematical operation for this channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<location filename="../src/docks/VoltageDock.cpp" line="61"/>
<source>Invert</source>
<translation>Invertire</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="65"/>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<source>Set probe attenuation, scroll or type a value to select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="68"/>
<location filename="../src/docks/VoltageDock.cpp" line="66"/>
<source>x</source>
<translation></translation>
</message>
Expand Down
16 changes: 8 additions & 8 deletions openhantek/translations/openhantek_pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2275,27 +2275,27 @@
<translation>Napięcie</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<location filename="../src/docks/VoltageDock.cpp" line="55"/>
<source>CH&amp;%1</source>
<translation>CH&amp;%1</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="59"/>
<location filename="../src/docks/VoltageDock.cpp" line="57"/>
<source>MA&amp;TH</source>
<translation>MA&amp;TH</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="62"/>
<location filename="../src/docks/VoltageDock.cpp" line="60"/>
<source>Voltage range per vertical screen division</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="74"/>
<location filename="../src/docks/VoltageDock.cpp" line="72"/>
<source>Select DC or AC coupling</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="77"/>
<location filename="../src/docks/VoltageDock.cpp" line="75"/>
<source>Select the mathematical operation for this channel</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -2304,17 +2304,17 @@
<translation type="vanished">&amp;MATH</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<location filename="../src/docks/VoltageDock.cpp" line="61"/>
<source>Invert</source>
<translation>Odwróć</translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="65"/>
<location filename="../src/docks/VoltageDock.cpp" line="63"/>
<source>Set probe attenuation, scroll or type a value to select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/docks/VoltageDock.cpp" line="68"/>
<location filename="../src/docks/VoltageDock.cpp" line="66"/>
<source>x</source>
<translation></translation>
</message>
Expand Down
Loading

0 comments on commit 5973a32

Please sign in to comment.