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.

148 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 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 <settings/app_settings.h>
  27. class PCB_CALCULATOR_SETTINGS : public APP_SETTINGS_BASE
  28. {
  29. public:
  30. struct ATTENUATOR
  31. {
  32. double attenuation;
  33. double zin;
  34. double zout;
  35. };
  36. struct ATTENUATORS
  37. {
  38. int type;
  39. std::unordered_map<std::string, ATTENUATOR> attenuators;
  40. };
  41. struct ELECTRICAL
  42. {
  43. int spacing_units;
  44. wxString spacing_voltage;
  45. };
  46. struct REGULATORS
  47. {
  48. wxString r1;
  49. wxString r2;
  50. wxString vref;
  51. wxString vout;
  52. wxString data_file;
  53. wxString selected_regulator;
  54. int type;
  55. int last_param;
  56. };
  57. struct TRACK_WIDTH
  58. {
  59. wxString current;
  60. wxString delta_tc;
  61. wxString track_len;
  62. int track_len_units;
  63. wxString resistivity;
  64. wxString ext_track_width;
  65. int ext_track_width_units;
  66. wxString ext_track_thickness;
  67. int ext_track_thickness_units;
  68. wxString int_track_width;
  69. int int_track_width_units;
  70. wxString int_track_thickness;
  71. int int_track_thickness_units;
  72. };
  73. /// Map of TRANSLINE_PRM id to value
  74. typedef std::map<std::string, double> TL_PARAM_MAP;
  75. /// Map of TRANSLINE_PRM id to units selection
  76. typedef std::map<std::string, int> TL_PARAM_UNITS_MAP;
  77. struct TRANSMISSION_LINE
  78. {
  79. int type;
  80. /// Transline parameters, per transline type
  81. std::map<std::string, TL_PARAM_MAP> param_values;
  82. /// Transline parameter units selections, per transline type
  83. std::map<std::string, TL_PARAM_UNITS_MAP> param_units;
  84. };
  85. struct VIA_SIZE
  86. {
  87. wxString hole_diameter;
  88. int hole_diameter_units;
  89. wxString thickness;
  90. int thickness_units;
  91. wxString length;
  92. int length_units;
  93. wxString pad_diameter;
  94. int pad_diameter_units;
  95. wxString clearance_diameter;
  96. int clearance_diameter_units;
  97. wxString characteristic_impedance;
  98. int characteristic_impedance_units;
  99. wxString applied_current;
  100. wxString plating_resistivity;
  101. wxString permittivity;
  102. wxString temp_rise;
  103. wxString pulse_rise_time;
  104. };
  105. PCB_CALCULATOR_SETTINGS();
  106. virtual ~PCB_CALCULATOR_SETTINGS() {}
  107. virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
  108. ATTENUATORS m_Attenuators;
  109. int m_BoardClassUnits;
  110. int m_ColorCodeTolerance;
  111. ELECTRICAL m_Electrical;
  112. int m_LastPage;
  113. REGULATORS m_Regulators;
  114. TRACK_WIDTH m_TrackWidth;
  115. TRANSMISSION_LINE m_TransLine;
  116. VIA_SIZE m_ViaSize;
  117. protected:
  118. virtual std::string getLegacyFrameName() const override { return "pcb_calculator"; }
  119. };
  120. #endif