You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
3.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #ifndef _PCB_CALCULATOR_SETTINGS_H
  24. #define _PCB_CALCULATOR_SETTINGS_H
  25. #include <array>
  26. #include <unordered_map>
  27. #include <settings/app_settings.h>
  28. class PCB_CALCULATOR_SETTINGS : public APP_SETTINGS_BASE
  29. {
  30. public:
  31. struct ATTENUATOR
  32. {
  33. double attenuation;
  34. double zin;
  35. double zout;
  36. };
  37. struct ATTENUATORS
  38. {
  39. int type;
  40. std::unordered_map<std::string, ATTENUATOR> attenuators;
  41. };
  42. struct ELECTRICAL
  43. {
  44. int spacing_units;
  45. wxString spacing_voltage;
  46. };
  47. struct REGULATORS
  48. {
  49. wxString r1;
  50. wxString r2;
  51. wxString vref;
  52. wxString vout;
  53. wxString data_file;
  54. wxString selected_regulator;
  55. int type;
  56. int last_param;
  57. };
  58. struct TRACK_WIDTH
  59. {
  60. wxString current;
  61. wxString delta_tc;
  62. wxString track_len;
  63. int track_len_units;
  64. wxString resistivity;
  65. wxString ext_track_width;
  66. int ext_track_width_units;
  67. wxString ext_track_thickness;
  68. int ext_track_thickness_units;
  69. wxString int_track_width;
  70. int int_track_width_units;
  71. wxString int_track_thickness;
  72. int int_track_thickness_units;
  73. };
  74. /// Map of TRANSLINE_PRM id to value
  75. typedef std::map<std::string, double> TL_PARAM_MAP;
  76. /// Map of TRANSLINE_PRM id to units selection
  77. typedef std::map<std::string, int> TL_PARAM_UNITS_MAP;
  78. struct TRANSMISSION_LINE
  79. {
  80. int type;
  81. /// Transline parameters, per transline type
  82. std::map<std::string, TL_PARAM_MAP> param_values;
  83. /// Transline parameter units selections, per transline type
  84. std::map<std::string, TL_PARAM_UNITS_MAP> param_units;
  85. };
  86. struct VIA_SIZE
  87. {
  88. wxString hole_diameter;
  89. int hole_diameter_units;
  90. wxString thickness;
  91. int thickness_units;
  92. wxString length;
  93. int length_units;
  94. wxString pad_diameter;
  95. int pad_diameter_units;
  96. wxString clearance_diameter;
  97. int clearance_diameter_units;
  98. wxString characteristic_impedance;
  99. int characteristic_impedance_units;
  100. wxString applied_current;
  101. wxString plating_resistivity;
  102. wxString permittivity;
  103. wxString temp_rise;
  104. wxString pulse_rise_time;
  105. };
  106. PCB_CALCULATOR_SETTINGS();
  107. virtual ~PCB_CALCULATOR_SETTINGS() {}
  108. virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
  109. protected:
  110. virtual std::string getLegacyFrameName() const override { return "pcb_calculator"; }
  111. public:
  112. ATTENUATORS m_Attenuators;
  113. int m_BoardClassUnits;
  114. int m_ColorCodeTolerance;
  115. ELECTRICAL m_Electrical;
  116. int m_LastPage;
  117. REGULATORS m_Regulators;
  118. TRACK_WIDTH m_TrackWidth;
  119. TRANSMISSION_LINE m_TransLine;
  120. VIA_SIZE m_ViaSize;
  121. };
  122. #endif