Boo0ns / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Design problem in creating a new Uploader for Arduino #508

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, the design for supporting Uploaders supports only Avrdude. In the 
existing design if we wanted to add support for FooUploader I would need to 
extend Uploader with FooUploader. However, the code that implements the change 
is hard coded to only accept AvrdudeUploader.

Since the actual Uploader isn't shown to the user do we want it be selected by 
"upload.using" then that value selects which uploader object to use?

====Sketche.java
Uploader uploader;
// download the program 
//
uploader = new AvrdudeUploader();
boolean success = uploader.uploadUsingPreferences(buildPath,
                                                      suggestedClassName,
                                                      verbose);
====
====Editor.java

protected void handleBurnBootloader(final String target, final String 
programmer) {
...
          Uploader uploader = new AvrdudeUploader();
====

I'd really like to find a generic way to do this by using preferences entirely, 
but the current design is all Uploaders overide the base uploader.

Original issue reported on code.google.com by rick.rickanderson on 20 Mar 2011 at 8:12

GoogleCodeExporter commented 9 years ago
Quick fix:
                Uploader uploader = new AvrdudeUploader();

            if (Base.getBoardPreferences().get("upload.using").equals("foodude")) 
            {
                uploader = new FoodudeUploader();
            }

Original comment by rick.rickanderson on 20 Mar 2011 at 9:06

GoogleCodeExporter commented 9 years ago
I implemented a slightly more generic fix here:
https://github.com/ajd4096/Arduino/commit/3c43d9956f2943aa33b947c1411c051d902001
db

I added a "BasicUploader" which lets you fire off any external exe.

I mainly use it for bootloadHID, but you can use cygwin's sh.exe to run scripts 
as well.

Original comment by ajd4...@gmail.com on 23 Mar 2012 at 4:06