Pcb_calculator: track width tool: make resistivity value read only.

The formula used to calculate the track width is valid only for copper tracks.
So the resistivity value displayed in the panel is only for info, and cannot
be modified.
This commit is contained in:
jean-pierre charras 2021-05-13 10:35:23 +02:00
parent e4ac0fb5a1
commit 8513ca974c
3 changed files with 15 additions and 9 deletions

View File

@ -253,7 +253,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_panelRegulators->SetSizer( bSizerMainReg );
m_panelRegulators->Layout();
bSizerMainReg->Fit( m_panelRegulators );
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), false );
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true );
m_panelAttenuators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerAtt;
bSizerAtt = new wxBoxSizer( wxHORIZONTAL );
@ -1488,7 +1488,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_panelViaSize->SetSizer( bSizerViaSize );
m_panelViaSize->Layout();
bSizerViaSize->Fit( m_panelViaSize );
m_Notebook->AddPage( m_panelViaSize, _("Via Size"), true );
m_Notebook->AddPage( m_panelViaSize, _("Via Size"), false );
m_panelTrackWidth = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerTrackWidth;
bSizerTrackWidth = new wxBoxSizer( wxHORIZONTAL );
@ -1539,11 +1539,11 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_TW_CuLength_choiceUnit->SetSelection( 0 );
fgSizerTWprms->Add( m_TW_CuLength_choiceUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
m_staticText103 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Resistivity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText103 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Copper resistivity:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText103->Wrap( -1 );
fgSizerTWprms->Add( m_staticText103, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM, 5 );
m_TWResistivity = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TWResistivity = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
fgSizerTWprms->Add( m_TWResistivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_resistivityUnits = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("ohm-meter"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -144,7 +144,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Regulators</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -12443,7 +12443,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Via Size</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -17331,7 +17331,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Resistivity:</property>
<property name="label">Copper resistivity:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -17410,7 +17410,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxTE_READONLY</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>

View File

@ -41,6 +41,8 @@ wxString tracks_width_versus_current_formula =
extern double DoubleFromString( const wxString& TextValue );
// The IPC2221 formula used to calculate track width is valid only for copper material
const double copper_resistivity = 1.72e-8;
void PCB_CALCULATOR_FRAME::writeTrackWidthConfig()
{
@ -216,7 +218,7 @@ void PCB_CALCULATOR_FRAME::OnTWResetButtonClick( wxCommandEvent& event )
m_TrackDeltaTValue->SetValue( wxString::Format( "%g", 10.0 ) );
m_TrackLengthValue->SetValue( wxString::Format( "%g", 20.0 ) );
m_TW_CuLength_choiceUnit->SetSelection( 0 );
m_TWResistivity->SetValue( wxString::Format( "%g", 1.72e-8 ) );
m_TWResistivity->SetValue( wxString::Format( "%g", copper_resistivity ) );
m_ExtTrackWidthValue->SetValue( wxString::Format( "%g", 0.2 ) );
m_TW_ExtTrackWidth_choiceUnit->SetSelection( 0 );
m_ExtTrackThicknessValue->SetValue( wxString::Format( "%g", 0.035 ) );
@ -429,7 +431,11 @@ void PCB_CALCULATOR_FRAME::initTrackWidthPanel()
m_TrackDeltaTValue->SetValue( cfg->m_TrackWidth.delta_tc );
m_TrackLengthValue->SetValue( cfg->m_TrackWidth.track_len );
m_TW_CuLength_choiceUnit->SetSelection( cfg->m_TrackWidth.track_len_units );
#if 0 // the IPC formula is valid for copper traces, so we do not currently adjust the resistivity
m_TWResistivity->SetValue( cfg->m_TrackWidth.resistivity );
#else
m_TWResistivity->SetValue( wxString::Format( "%g", copper_resistivity ) );
#endif
m_ExtTrackWidthValue->SetValue( cfg->m_TrackWidth.ext_track_width );
m_TW_ExtTrackWidth_choiceUnit->SetSelection( cfg->m_TrackWidth.ext_track_width_units );
m_ExtTrackThicknessValue->SetValue( cfg->m_TrackWidth.ext_track_thickness );