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.

398 lines
11 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KICAD, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2011 jean-pierre.charras
  5. * Copyright (C) 1992-2020 Kicad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 3
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * @file regulators_funct.cpp
  22. * Contains the partial functions of PCB_CALCULATOR_FRAME related to regulators
  23. */
  24. #include <wx/wx.h>
  25. #include <macros.h>
  26. #include "class_regulator_data.h"
  27. #include "pcb_calculator_frame.h"
  28. #include "pcb_calculator_settings.h"
  29. #include "dialogs/dialog_regulator_form.h"
  30. extern double DoubleFromString( const wxString& TextValue );
  31. void PCB_CALCULATOR_FRAME::OnRegulatorCalcButtonClick( wxCommandEvent& event )
  32. {
  33. RegulatorsSolve();
  34. }
  35. void PCB_CALCULATOR_FRAME::OnRegulatorResetButtonClick( wxCommandEvent& event )
  36. {
  37. m_RegulR1Value->SetValue( wxT( "10" ) );
  38. m_RegulR2Value->SetValue( wxT( "10" ) );
  39. m_RegulVrefValue->SetValue( wxT( "3" ) );
  40. m_RegulVoutValue->SetValue( wxT( "12" ) );
  41. m_choiceRegType->SetSelection( 0 );
  42. m_rbRegulR1->SetValue(1);
  43. m_rbRegulR2->SetValue(0);
  44. m_rbRegulVout->SetValue(0);
  45. RegulatorPageUpdate();
  46. }
  47. void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
  48. {
  49. switch( m_choiceRegType->GetSelection() )
  50. {
  51. default:
  52. case 0:
  53. m_bitmapRegul4pins->Show( true );
  54. m_bitmapRegul3pins->Show( false );
  55. m_RegulIadjValue->Enable( false );
  56. m_RegulFormula->SetLabel( wxT("Vout = Vref * (R1 + R2) / R2") );
  57. break;
  58. case 1:
  59. m_bitmapRegul4pins->Show( false );
  60. m_bitmapRegul3pins->Show( true );
  61. m_RegulIadjValue->Enable( true );
  62. m_RegulFormula->SetLabel( wxT("Vout = Vref * (R1 + R2) / R1 + Iadj * R2") );
  63. break;
  64. }
  65. // The new icon size must be taken in account
  66. m_panelRegulators->GetSizer()->Layout();
  67. // Enable/disable buttons:
  68. bool enbl = m_choiceRegulatorSelector->GetCount() > 0;
  69. m_buttonEditItem->Enable( enbl );
  70. m_buttonRemoveItem->Enable( enbl );
  71. m_panelRegulators->Refresh();
  72. }
  73. void PCB_CALCULATOR_FRAME::OnRegulTypeSelection( wxCommandEvent& event )
  74. {
  75. RegulatorPageUpdate();
  76. }
  77. void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
  78. {
  79. wxString name = m_choiceRegulatorSelector->GetStringSelection();
  80. REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
  81. if( item )
  82. {
  83. m_lastSelectedRegulatorName = item->m_Name;
  84. m_choiceRegType->SetSelection( item->m_Type );
  85. wxString value;
  86. value.Printf( wxT("%g"), item->m_Vref );
  87. m_RegulVrefValue->SetValue( value );
  88. value.Printf( wxT("%g"), item->m_Iadj );
  89. m_RegulIadjValue->SetValue( value );
  90. }
  91. // Call RegulatorPageUpdate to enable/sisable tools,
  92. // even if no item selected
  93. RegulatorPageUpdate();
  94. }
  95. /*
  96. * Called when ckicking on button Browse:
  97. * Select a new data file, and load it on request
  98. */
  99. void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
  100. {
  101. wxString fullfilename = GetDataFilename();
  102. wxString wildcard;
  103. wildcard.Printf( _("PCB Calculator data file (*.%s)|*.%s"),
  104. DataFileNameExt, DataFileNameExt );
  105. wxFileDialog dlg( m_panelRegulators,
  106. _("Select PCB Calculator Data File"),
  107. wxEmptyString, fullfilename,
  108. wildcard, wxFD_OPEN );
  109. if (dlg.ShowModal() == wxID_CANCEL)
  110. return;
  111. fullfilename = dlg.GetPath();
  112. if( fullfilename == GetDataFilename() )
  113. return;
  114. SetDataFilename( fullfilename );
  115. if( wxFileExists( fullfilename ) && m_RegulatorList.GetCount() > 0 ) // Read file
  116. {
  117. if( wxMessageBox( _("Do you want to load this file and replace current regulator list?" ) )
  118. != wxID_OK )
  119. return;
  120. }
  121. if( ReadDataFile() )
  122. {
  123. m_RegulatorListChanged = false;
  124. m_choiceRegulatorSelector->Clear();
  125. m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
  126. SelectLastSelectedRegulator();
  127. }
  128. else
  129. {
  130. wxString msg;
  131. msg.Printf( _("Unable to read data file \"%s\""), fullfilename );
  132. wxMessageBox( msg );
  133. }
  134. }
  135. void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
  136. {
  137. DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
  138. if( dlg.ShowModal() != wxID_OK )
  139. return;
  140. if( !dlg.IsOK() )
  141. {
  142. wxMessageBox( _("Bad or missing parameters!") );
  143. return;
  144. }
  145. REGULATOR_DATA * new_item = dlg.BuildRegulatorFromData();
  146. // Add new item, if not existing
  147. if( m_RegulatorList.GetReg( new_item->m_Name ) == NULL )
  148. {
  149. // Add item in list
  150. m_RegulatorList.Add( new_item );
  151. m_RegulatorListChanged = true;
  152. m_choiceRegulatorSelector->Clear();
  153. m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
  154. m_lastSelectedRegulatorName = new_item->m_Name;
  155. SelectLastSelectedRegulator();
  156. }
  157. else
  158. {
  159. wxMessageBox( _("This regulator is already in list. Aborted") );
  160. delete new_item;
  161. }
  162. }
  163. void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
  164. {
  165. wxString name = m_choiceRegulatorSelector->GetStringSelection();
  166. REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
  167. if( item == NULL )
  168. return;
  169. DIALOG_REGULATOR_FORM dlg( this, name );
  170. dlg.CopyRegulatorDataToDialog( item );
  171. if( dlg.ShowModal() != wxID_OK )
  172. return;
  173. REGULATOR_DATA * new_item = dlg.BuildRegulatorFromData();
  174. m_RegulatorList.Replace( new_item );
  175. m_RegulatorListChanged = true;
  176. SelectLastSelectedRegulator();
  177. }
  178. void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
  179. {
  180. wxString name = wxGetSingleChoice( _("Remove Regulator"), wxEmptyString,
  181. m_RegulatorList.GetRegList() );
  182. if( name.IsEmpty() )
  183. return;
  184. m_RegulatorList.Remove( name );
  185. m_RegulatorListChanged = true;
  186. m_choiceRegulatorSelector->Clear();
  187. m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
  188. if( m_lastSelectedRegulatorName == name )
  189. m_lastSelectedRegulatorName.Empty();
  190. SelectLastSelectedRegulator();
  191. }
  192. void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
  193. {
  194. // Find last selected in regulator list:
  195. int idx = -1;
  196. if( ! m_lastSelectedRegulatorName.IsEmpty() )
  197. {
  198. for( unsigned ii = 0; ii < m_RegulatorList.GetCount(); ii++ )
  199. if( m_RegulatorList.m_List[ii]->m_Name == m_lastSelectedRegulatorName )
  200. {
  201. idx = ii;
  202. break;
  203. }
  204. }
  205. m_choiceRegulatorSelector->SetSelection( idx );
  206. wxCommandEvent event;
  207. OnRegulatorSelection( event );
  208. }
  209. // Calculate a value from the 3 other values
  210. // Vref is given by the regulator properties, so
  211. // we can calculate only R1, R2 or Vout
  212. void PCB_CALCULATOR_FRAME::RegulatorsSolve()
  213. {
  214. int id;
  215. if( m_rbRegulR1->GetValue() )
  216. id = 0; // for R1 calculation
  217. else if( m_rbRegulR2->GetValue() )
  218. id = 1; // for R2 calculation
  219. else if( m_rbRegulVout->GetValue() )
  220. id = 2; // for Vout calculation
  221. else
  222. {
  223. wxMessageBox( wxT("Selection error" ) );
  224. return;
  225. }
  226. double r1, r2, vref, vout;
  227. wxString txt;
  228. m_RegulMessage->SetLabel( wxEmptyString);
  229. // Convert r1 and r2 in ohms
  230. int r1scale = 1000;
  231. int r2scale = 1000;
  232. // Read values from panel:
  233. txt = m_RegulR1Value->GetValue();
  234. r1 = DoubleFromString(txt) * r1scale;
  235. txt = m_RegulR2Value->GetValue();
  236. r2 = DoubleFromString(txt) * r2scale;
  237. txt = m_RegulVrefValue->GetValue();
  238. vref = DoubleFromString(txt);
  239. txt = m_RegulVoutValue->GetValue();
  240. vout = DoubleFromString(txt);
  241. // Some tests:
  242. if( vout < vref && id != 2)
  243. {
  244. m_RegulMessage->SetLabel( _("Vout must be greater than vref" ) );
  245. return;
  246. }
  247. if( vref == 0.0 )
  248. {
  249. m_RegulMessage->SetLabel( _("Vref set to 0 !" ) );
  250. return;
  251. }
  252. if( (r1 < 0 && id != 0 ) || (r2 <= 0 && id != 1) )
  253. {
  254. m_RegulMessage->SetLabel( _("Incorrect value for R1 R2" ) );
  255. return;
  256. }
  257. // Calculate
  258. if( m_choiceRegType->GetSelection() == 1)
  259. {
  260. // 3 terminal regulator
  261. txt = m_RegulIadjValue->GetValue();
  262. double iadj = DoubleFromString(txt);
  263. // iadj is given in micro amp, so convert it in amp.
  264. iadj /= 1000000;
  265. switch( id )
  266. {
  267. case 0:
  268. r1 = vref * r2 / ( vout - vref - (r2 * iadj) );
  269. break;
  270. case 1:
  271. r2 = ( vout - vref ) / ( iadj + (vref/r1) );
  272. break;
  273. case 2:
  274. vout = vref * (r1 + r2) / r1;
  275. vout += r2 * iadj;
  276. break;
  277. }
  278. }
  279. else
  280. { // Standard 4 terminal regulator
  281. switch( id )
  282. {
  283. case 0:
  284. r1 = ( vout / vref - 1 ) * r2;
  285. break;
  286. case 1:
  287. r2 = r1 / ( vout / vref - 1);
  288. break;
  289. case 2:
  290. vout = vref * (r1 + r2) / r2;
  291. break;
  292. }
  293. }
  294. // write values to panel:
  295. txt.Printf(wxT("%g"), r1 / r1scale );
  296. m_RegulR1Value->SetValue(txt);
  297. txt.Printf(wxT("%g"), r2 / r2scale);
  298. m_RegulR2Value->SetValue(txt);
  299. txt.Printf(wxT("%g"), vref);
  300. m_RegulVrefValue->SetValue(txt);
  301. txt.Printf(wxT("%g"), vout);
  302. m_RegulVoutValue->SetValue(txt);
  303. }
  304. void PCB_CALCULATOR_FRAME::Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg )
  305. {
  306. // Save current parameter values in config.
  307. aCfg->m_Regulators.r1 = m_RegulR1Value->GetValue();
  308. aCfg->m_Regulators.r2 = m_RegulR2Value->GetValue();
  309. aCfg->m_Regulators.vref = m_RegulVrefValue->GetValue();
  310. aCfg->m_Regulators.vout = m_RegulVoutValue->GetValue();
  311. aCfg->m_Regulators.data_file = GetDataFilename();
  312. aCfg->m_Regulators.selected_regulator = m_lastSelectedRegulatorName;
  313. aCfg->m_Regulators.type = m_choiceRegType->GetSelection();
  314. // Store the parameter selection that was recently calculated (R1, R2 or Vout)
  315. wxRadioButton * regprms[3] =
  316. {
  317. m_rbRegulR1, m_rbRegulR2, m_rbRegulVout
  318. };
  319. for( int ii = 0; ii < 3; ii++ )
  320. {
  321. if( regprms[ii]->GetValue() )
  322. {
  323. aCfg->m_Regulators.last_param = ii;
  324. break;
  325. }
  326. }
  327. }