Fix SPICE simulator plot bug.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1944
This commit is contained in:
parent
9e3ac0eafb
commit
22bdf37fc2
|
@ -2,6 +2,8 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 CERN
|
* Copyright (C) 2016 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -522,9 +524,13 @@ bool SIM_PLOT_PANEL::AddTrace( const wxString& aName, int aPoints,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int i = 0; i < aPoints; i++ )
|
for( int i = 0; i < aPoints; i++ )
|
||||||
|
{
|
||||||
|
// log( 0 ) is not valid.
|
||||||
|
if( tmp[i] != 0.0 )
|
||||||
tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB
|
tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trace->SetData( std::vector<double>( aX, aX + aPoints ), tmp );
|
trace->SetData( std::vector<double>( aX, aX + aPoints ), tmp );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue