Changeset 42bad281f223c00abe6af881022d49977ac483d4
- Timestamp:
- 03/04/11 11:43:42 (2 years ago)
- Children:
- 47bf006ff320470525f4b3355342f2d7628cdf52
- Parents:
- 1ccee93ef7bc44a5da992218395cbfcc0e289cc8
- git-committer:
- Matias De la Puente <mfpuente.ar@…> (03/04/11 11:43:42)
- Files:
-
- 8 edited
-
data/programmers/avrdude.xml (modified) (2 diffs)
-
data/programmers/lpc21isp.xml (modified) (2 diffs)
-
data/programmers/pickit2.xml (modified) (2 diffs)
-
data/programmers/picstartplus.xml (modified) (1 diff)
-
libi4uccore/optionslogic.vala (modified) (1 diff)
-
libi4uccore/programmer.vala (modified) (2 diffs)
-
libi4uccore/programmerloader.vala (modified) (1 diff)
-
libi4uccore/programmerslogic.vala (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
data/programmers/avrdude.xml
r9ab0cbf r42bad28 5 5 <write_flash> 6 6 <command>avrdude %options -U flash:w:%firmware</command> 7 <required_options>Device,Programmer</required_options> 8 <optional_options>SerialPort,BaudRate,BitClock,ConfigFile,DisableAutoErase,ISPClockDelay,DoNotWrite,DoNotverify,ExtendedParam,VerboseOutput,QuellOutput</optional_options> 7 9 </write_flash> 8 10 <read_flash> 9 11 <command>avrdude %options -U flash:r:%firmware:i</command> 12 <required_options>Device,Programmer</required_options> 13 <optional_options>SerialPort,BaudRate,BitClock,ConfigFile,ISPClockDelay,DoNotverify,ExtendedParam,VerboseOutput,QuellOutput</optional_options> 10 14 </read_flash> 11 15 <verify_flash> 12 16 <command>avrdude %options -U flash:v:%firmware</command> 17 <required_options>Device,Programmer</required_options> 18 <optional_options>SerialPort,BaudRate,BitClock,ConfigFile,ISPClockDelay,DoNotverify,ExtendedParam,VerboseOutput,QuellOutput</optional_options> 13 19 </verify_flash> 14 20 </actions> … … 71 77 <description lang="es">No escribir nada al dispositivo</description> 72 78 </option> 73 <option name="Do n'tverify" format="-V" value_type="None" optional="true" most_used="false">79 <option name="DoNotverify" format="-V" value_type="None" optional="true" most_used="false"> 74 80 <label lang="en">Don't verify</label> 75 81 <label lang="es">No verificar</label> -
data/programmers/lpc21isp.xml
r9ab0cbf r42bad28 5 5 <write_flash> 6 6 <command>lpc21isp %optional_options -wipe -verify %firmware %required_options</command> 7 <required_options>FirmwareType,SerialPort,BaudRate,OscillatorFrequency</required_options> 8 <optional_options>DebugMode,DoNotStartMCU,Attempts,ControlLines,ControlLinesSwapped,ControlLinesInverted,EnableLogging,UseHalfduplex</optional_options> 7 9 </write_flash> 8 10 </actions> … … 78 80 <description lang="es">Elegir velocidad de transmisión</description> 79 81 </option> 80 <option name="Oscillator frequency" format="%value" value_type="Entry" optional="false" most_used="true">82 <option name="OscillatorFrequency" format="%value" value_type="Entry" optional="false" most_used="true"> 81 83 <label lang="en">Oscillator frequency</label> 82 84 <label lang="es">Frecuencia del oscilador</label> -
data/programmers/pickit2.xml
r9ab0cbf r42bad28 5 5 <write_flash> 6 6 <command>pk2cmd %options -F%firmware -M</command> 7 <required_options>PK2DeviceFilePath,Device</required_options> 8 <optional_options>UnitID,ProgrammingSpeed,DisablePE,ExternallyPowered,VPPFirst,PreserveEEData,BlankCheck,OSCCAL,PowerDevice</optional_options> 7 9 </write_flash> 8 10 <read_flash> 9 11 <command>pk2cmd %options -GF%firmware</command> 12 <required_options>PK2DeviceFilePath,Device</required_options> 13 <optional_options>UnitID,ProgrammingSpeed,DisablePE,ExternallyPowered,VPPFirst,BlankCheck,PowerDevice</optional_options> 10 14 </read_flash> 11 15 <verify_flash> 12 16 <command>pk2cmd %options -F%firmware -Y</command> 17 <required_options>PK2DeviceFilePath,Device</required_options> 18 <optional_options>UnitID,ProgrammingSpeed,DisablePE,ExternallyPowered,VPPFirst,BlankCheck,PowerDevice</optional_options> 13 19 </verify_flash> 14 20 <erase_flash> 15 21 <command>pk2cmd %options -E</command> 22 <required_options>PK2DeviceFilePath,Device</required_options> 23 <optional_options>UnitID,ProgrammingSpeed,DisablePE,ExternallyPowered,VPPFirst,PreserveEEData,BlankCheck,OSCCAL</optional_options> 16 24 </erase_flash> 17 25 <read_fuses> 18 26 <command>pk2cmd %options -GC</command> 27 <required_options>PK2DeviceFilePath,Device</required_options> 28 <optional_options>UnitID,ProgrammingSpeed,DisablePE,ExternallyPowered,VPPFirst,BlankCheck,PowerDevice</optional_options> 19 29 </read_fuses> 20 30 <get_version> 21 31 <command>pk2cmd %options -?V</command> 32 <required_options>PK2DeviceFilePath</required_options> 22 33 </get_version> 23 34 </actions> … … 85 96 <description lang="es">Programar memoria OSCCAL</description> 86 97 </option> 87 <option name="Release MCLR" format="-R" value_type="None" optional="true" most_used="true">98 <option name="ReleaseMCLR" format="-R" value_type="None" optional="true" most_used="true"> 88 99 <label lang="en">Release MCLR</label> 89 100 <label lang="es">Liberar MCLR</label> -
data/programmers/picstartplus.xml
r9ab0cbf r42bad28 5 5 <write_flash> 6 6 <command>picp %options -bp -wp %firmware</command> 7 <required_options>SerialPort,Device</required_options> 8 <optional_options>CommLineDebug,ISPProtocol,QuietMode</optional_options> 7 9 </write_flash> 8 10 <read_flash> 9 11 <command>picp %options -rp %firmware</command> 12 <required_options>SerialPort,Device</required_options> 13 <optional_options>CommLineDebug,ISPProtocol,QuietMode</optional_options> 10 14 </read_flash> 11 15 <erase_flash> 12 16 <command>picp %options -ef</command> 17 <required_options>SerialPort,Device</required_options> 18 <optional_options>CommLineDebug,ISPProtocol,QuietMode</optional_options> 13 19 </erase_flash> 14 20 <read_fuses> 15 21 <command>picp %options -rc</command> 22 <required_options>SerialPort,Device</required_options> 23 <optional_options>CommLineDebug,ISPProtocol,QuietMode</optional_options> 16 24 </read_fuses> 17 25 <get_version> 18 <command>picp %options-v</command>26 <command>picp -v</command> 19 27 </get_version> 20 28 </actions> 21 29 <options> 22 <option name="Comm line debug" format="-c" value_type="None" optional="true" most_used="false">30 <option name="CommLineDebug" format="-c" value_type="None" optional="true" most_used="false"> 23 31 <label lang="en">Comm line debug</label> 24 32 <label lang="es">Depuración de la lÃnea de comunicación</label> -
libi4uccore/optionslogic.vala
r9ab0cbf r42bad28 108 108 } 109 109 110 public string get_options (string? format=null) throws OptionError 111 { 110 public string get_options (Gee.List<string>? required_options, Gee.List<string>? optional_options, string? format=null) throws OptionError 111 { 112 // Return empty string if there's no options added 112 113 if (_options == null) 113 114 return ""; 114 var required_options = ""; 115 var optional_options = ""; 116 foreach (var option_view in _option_views) 117 { 118 if (option_view.sensitive && option_view.active) 119 { 120 if (option_view.value == null || option_view.value == "") 121 throw new OptionError.OPTION_VALUE_MISSING (_("Option value missing: ") + option_view.name); 122 var option = get_option (option_view.name); 123 var option_value = option_view.value; 124 if (option.value_type == "FilePath" || option.value_type == "FolderPath") 125 option_value = Shell.quote (option_value);_option_settings[option_view.name].name = option_view.name; 126 var option_str = " " + option.format.replace ("%value", option_value); 127 if (option.optional) 128 optional_options += option_str; 129 else 130 required_options += option_str; 131 } 132 } 115 116 // Fill required_options_str 117 var required_options_str = ""; 118 if (required_options != null) 119 foreach (var option_name in required_options) 120 { 121 var option_view = get_option_view (option_name); 122 if (option_view == null) 123 continue; 124 if (option_view.sensitive && option_view.active) 125 { 126 if (option_view.value == null || option_view.value == "") 127 throw new OptionError.OPTION_VALUE_MISSING (_("Option value missing: ") + option_name); 128 var option = get_option (option_name); 129 var option_value = option_view.value; 130 if (option.value_type == "FilePath" || option.value_type == "FolderPath") 131 option_value = Shell.quote (option_value); 132 _option_settings[option_name].name = option_name; 133 required_options_str += " " + option.format.replace ("%value", option_value); 134 } 135 } 136 137 // Fill optional_options_str 138 var optional_options_str = ""; 139 if (optional_options != null) 140 foreach (var option_name in optional_options) 141 { 142 var option_view = get_option_view (option_name); 143 if (option_view == null) 144 continue; 145 if (option_view.sensitive && option_view.active) 146 { 147 if (option_view.value == null || option_view.value == "") 148 throw new OptionError.OPTION_VALUE_MISSING (_("Option value missing: ") + option_name); 149 var option = get_option (option_name); 150 var option_value = option_view.value; 151 if (option.value_type == "FilePath" || option.value_type == "FolderPath") 152 option_value = Shell.quote (option_value); 153 _option_settings[option_name].name = option_name; 154 optional_options_str += " " + option.format.replace ("%value", option_value); 155 } 156 } 157 133 158 if (format == null) 134 return @"$required_options $optional_options";159 return @"$required_options_str $optional_options_str"; 135 160 var formatted_options = format; 136 formatted_options = formatted_options.replace ("%required_options", required_options );137 formatted_options = formatted_options.replace ("%optional_options", optional_options );138 formatted_options = formatted_options.replace ("%options", @"$required_options $optional_options");161 formatted_options = formatted_options.replace ("%required_options", required_options_str); 162 formatted_options = formatted_options.replace ("%optional_options", optional_options_str); 163 formatted_options = formatted_options.replace ("%options", @"$required_options_str $optional_options_str"); 139 164 return formatted_options; 140 165 } 141 166 142 public bool valid_required_options () 143 { 167 public bool valid_required_options (Gee.List<string>? required_options) 168 { 169 // Return false if there's no options added 144 170 if (_options == null) 145 171 return false; 146 172 173 // Return true if there's no required options 174 if (required_options == null || required_options.size == 0) 175 return true; 176 147 177 // Check if the required options are valid 148 178 var valid_options = true; 149 foreach (var option in _options) 150 { 151 if (!option.optional) 152 { 153 var option_view = get_option_view (option.name); 154 if (option_view == null) 155 return false; 156 valid_options &= option_view.value != null && option_view.value != ""; 157 } 179 foreach (var option_name in required_options) 180 { 181 var option_view = get_option_view (option_name); 182 if (option_view == null) 183 return false; 184 valid_options &= option_view.value != null && option_view.value != ""; 158 185 } 159 186 return valid_options; -
libi4uccore/programmer.vala
r9ab0cbf r42bad28 90 90 private HashMap<string, string> _description = new HashMap<string, string> (); 91 91 private ArrayList<Option> _options = new ArrayList<Option> (); 92 private HashMap<string, Gee.List<string>> _required_options = new HashMap<string, Gee.List<string>> (); 93 private HashMap<string, Gee.List<string>> _optional_options = new HashMap<string, Gee.List<string>> (); 92 94 private string _lang; 93 95 … … 112 114 public Gee.Map<string, string> description { get { return _description; } } 113 115 public Gee.List<Option> options { get { return _options; } } 116 public Gee.Map<string, Gee.List<string>> required_options { get { return _required_options; } } 117 public Gee.Map<string, Gee.List<string>> optional_options { get { return _optional_options; } } 114 118 115 119 public string locale_description -
libi4uccore/programmerloader.vala
rd6d5a30 r42bad28 221 221 break; 222 222 223 case "required_options": 224 var required_options_list = new ArrayList<string> (); 225 foreach (var option_name in text.split (",")) 226 required_options_list.add (option_name); 227 _programmer.required_options[_action] = required_options_list; 228 break; 229 230 case "optional_options": 231 var optional_options_list = new ArrayList<string> (); 232 foreach (var option_name in text.split (",")) 233 optional_options_list.add (option_name); 234 _programmer.optional_options[_action] = optional_options_list; 235 break; 236 223 237 case "label": 224 238 _new_option.label[_lang] = text; -
libi4uccore/programmerslogic.vala
r9ab0cbf r42bad28 57 57 _view.write_flash_clicked.connect (on_write_flash_clicked); 58 58 _view.read_flash_clicked.connect (on_read_flash_clicked); 59 _view.verify_flash_clicked.connect (() => run_command ( _current_programmer.verify_flash_command));59 _view.verify_flash_clicked.connect (() => run_command ("verify_flash", _current_programmer.verify_flash_command)); 60 60 _view.erase_flash_clicked.connect (on_erase_flash_clicked); 61 61 _view.write_fuses_clicked.connect (on_write_fuses_clicked); 62 _view.read_fuses_clicked.connect (() => run_command ( _current_programmer.read_fuses_command));63 _view.get_version_clicked.connect (() => run_command ( _current_programmer.get_version_command));62 _view.read_fuses_clicked.connect (() => run_command ("read_fuses", _current_programmer.read_fuses_command)); 63 _view.get_version_clicked.connect (() => run_command ("get_version", _current_programmer.get_version_command)); 64 64 _view.stop_clicked.connect (() => _command_runner.stop ()); 65 65 _command_runner.finished.connect (on_command_finished); … … 73 73 try 74 74 { 75 var filtered_command = _options_logic.get_options (_current_programmer.write_flash_command); 75 var required_options = _current_programmer.required_options["write_flash"]; 76 var optional_options = _current_programmer.optional_options["write_flash"]; 77 var filtered_command = _options_logic.get_options (required_options, optional_options, _current_programmer.write_flash_command); 76 78 77 79 var firmware = File.new_for_uri (uri).get_path (); … … 142 144 { 143 145 if (_app.view_factory.show_yes_no_message (_("Are you sure you want to write the flash memory?")) == DialogResponse.YES) 144 run_command ( _current_programmer.write_flash_command);146 run_command ("write_flash", _current_programmer.write_flash_command); 145 147 } 146 148 … … 154 156 _app.settings.working_folder = folder_uri; 155 157 _read_firmware = firmware_uri; 156 run_command ( _current_programmer.read_flash_command);158 run_command ("read_flash", _current_programmer.read_flash_command); 157 159 } 158 160 } … … 161 163 { 162 164 if (_app.view_factory.show_yes_no_message (_("Are you sure you want to erase the flash memory?")) == DialogResponse.YES) 163 run_command ( _current_programmer.erase_flash_command);165 run_command ("erase_flash", _current_programmer.erase_flash_command); 164 166 } 165 167 … … 167 169 { 168 170 if (_app.view_factory.show_yes_no_message (_("Are you sure you want to write the fuses?")) == DialogResponse.YES) 169 run_command ( _current_programmer.write_fuses_command);171 run_command ("write_fuses", _current_programmer.write_fuses_command); 170 172 } 171 173 … … 192 194 } 193 195 194 private void run_command (string command )196 private void run_command (string command, string format) 195 197 { 196 198 try 197 199 { 198 var filtered_command = _options_logic.get_options (command); 200 var required_options = _current_programmer.required_options[command]; 201 var optional_options = _current_programmer.optional_options[command]; 202 var filtered_command = _options_logic.get_options (required_options, optional_options, format); 199 203 200 204 if (_read_firmware == null) … … 238 242 _current_programmer.is_valid_firmware_type (_view.pages_panel.current_page.tab_title); 239 243 240 if (!_options_logic.valid_required_options ()) 241 return; 242 243 this.can_write_flash = _current_programmer.can_write_flash; 244 _view.write_flash_sensitive = valid_page && _current_programmer.can_write_flash; 245 _view.read_flash_sensitive = _current_programmer.can_read_flash; 246 _view.verify_flash_sensitive = valid_page && _current_programmer.can_verify_flash; 247 _view.erase_flash_sensitive = _current_programmer.can_erase_flash; 248 _view.write_fuses_sensitive = _current_programmer.can_write_fuses; 249 _view.read_fuses_sensitive = _current_programmer.can_read_fuses; 250 _view.get_version_sensitive = _current_programmer.can_get_version; 244 var write_flash_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["write_flash"]); 245 var read_flash_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["read_flash"]); 246 var verify_flash_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["verify_flash"]); 247 var erase_flash_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["erase_flash"]); 248 var write_fuses_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["write_fuses"]); 249 var read_fuses_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["read_fuses"]); 250 var get_version_valid_options = _options_logic.valid_required_options (_current_programmer.required_options["get_version"]); 251 252 this.can_write_flash = _current_programmer.can_write_flash && write_flash_valid_options; 253 _view.write_flash_sensitive = valid_page && _current_programmer.can_write_flash && write_flash_valid_options; 254 _view.read_flash_sensitive = _current_programmer.can_read_flash && read_flash_valid_options; 255 _view.verify_flash_sensitive = valid_page && _current_programmer.can_verify_flash && verify_flash_valid_options; 256 _view.erase_flash_sensitive = _current_programmer.can_erase_flash && erase_flash_valid_options; 257 _view.write_fuses_sensitive = _current_programmer.can_write_fuses && write_fuses_valid_options; 258 _view.read_fuses_sensitive = _current_programmer.can_read_fuses && read_fuses_valid_options; 259 _view.get_version_sensitive = _current_programmer.can_get_version && get_version_valid_options; 251 260 _view.stop_sensitive = _command_runner.is_running; 252 261 }
Note: See TracChangeset
for help on using the changeset viewer.

