Fix SPICE simulator plot bug.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1944
This commit is contained in:
Wayne Stambaugh 2021-07-09 16:44:23 -04:00
parent 9e3ac0eafb
commit 22bdf37fc2
1 changed files with 7 additions and 1 deletions

View File

@ -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,7 +524,11 @@ 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++ )
tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB {
// log( 0 ) is not valid.
if( tmp[i] != 0.0 )
tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB
}
} }
} }