Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leonardo upload fix #37

Closed
wants to merge 10 commits into from
Closed

Leonardo upload fix #37

wants to merge 10 commits into from

Conversation

guicho271828
Copy link

Reset leonardo and wait for the connection
to be established.

Reset leonardo and wait for the connection
to be established.
@jaysonlarose
Copy link

A) Why isn't this committed to main yet? :)
B) I noticed this fork after adding my own fix. After fighting with the Perl module that ard-reset-arduino uses for about 20 minutes, I gave up and implemented basically the same thing as a python one-liner:

ifndef RESET_CMD
ifeq ($(BOARD_TAG),leonardo)
RESET_CMD = python -c "from serial import Serial;from time import sleep;s=Serial('$(ARD_PORT)', 57600);s.close();s.open();s.close();s.setBaudrate(1200);s.open();s.close()"
else
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino $(ARD_RESET_OPTS)
endif
endif

I noticed that if the port was already set at 1200 baud, the reset would not occur, so I added in a little bit to switch it up to 57600 first.

Cheers!

@sudar
Copy link
Owner

sudar commented May 19, 2013

This pull request doesn't cleanly merge with master anymore. If you can send a new pull request which merges with the current master without any issues, then I will merge it.

1. Merge remote-tracking branch 'refs/remotes/sudar/master'

Conflicts:
	.gitignore
	arduino-mk/Arduino.mk

2. reflected the advise from jaysonlarose.
3. I guess raw_eeprom should require `reset' on leonardo... I'm not sure.
@guicho271828
Copy link
Author

I haven't tested it yet, so I don't know if this works.
my board is at the lab and I'm home now.

.. by the way, do you know how to prevent the commit from automatically sending a pull request?
I didn't mean it. I'm using github for syncing the code between the lab and the home.

@sudar
Copy link
Owner

sudar commented May 28, 2013

I haven't tested it yet, so I don't know if this works.
my board is at the lab and I'm home now.

Let me know once you have done the testing. If it works, then I will merge the pull request

.. by the way, do you know how to prevent the commit from automatically sending a pull request?
I didn't mean it. I'm using github for syncing the code between the lab and the home.

If you have created a pull request with a branch, then any commit you make to that branch after that will be referenced in the pull request.

Generally it is a good idea to create a separate branch and then send pull request to that branch with just the code changes which you want. This way you can continue to do your personal/normal changes in the master branch.

@guicho271828
Copy link
Author

thanks sudar, I will create a new personal branch after these commits.

In today's commits above, I confirmed it successfully uploads programs to leonardo.
I fixed my part of the code to suit the current convention (call get_arduino_port etc.) , so It would look a lot cleaner.

TODO: MacOSX stuff (reset_stty)

@sudar
Copy link
Owner

sudar commented May 31, 2013

Sorry @guicho271828 this still doesn't merge cleanly with the current master..

May be you might have to do pull the latest master and the apply your changes on top of it.

Also check #33. It touched lot of code which is also touched by your commits.

@matthijskooijman
Copy link
Contributor

As for erroring out on a leonardo with a raw_ command, perhaps it makes more sense to add something like:

ifneq ($(filter raw_upload raw_eeprom, $(MAKECMDGOALS)),)
  $(error message)
endif

(add more raw_targets if needed).

This doesn't need modification of the actual targets and dependencies, keeping those a bit more clear.

@guicho271828
Copy link
Author

  1. merged the current master.
    • renamed some target in accordance with %upload -> do_upload etc. they are always used internally, so the exported interface is not changed.
    • use submake also for do_eeprom.
  2. added [raw_]sudo_upload/eeprom . for those who just want to try Arduino-Makefile, this would help.
  3. the default path of avrdude.conf relative to $ARDUINO_TOOLS_DIR was deprecated in the current official arduino distribution, both on 1.0.4 and 1.5.x.

@guicho271828
Copy link
Author

@matthijskooijman I agree. thank you for your advice.

@guicho271828
Copy link
Author

@sudar

Sorry @guicho271828 this still doesn't merge cleanly with the current master..
May be you might have to do pull the latest master and the apply your changes on top of it.
Also check #33. It touched lot of code which is also touched by your commits.

I merged sudar/master again.
I think I'm still not good at github-based coding, so I'm not sure I'm doing well this time.
Is it only that @matthijskooijman 's commit was applied first? and then I had to merge the new master state?

@matthijskooijman
Copy link
Contributor

Because of all the merging, conflicting changes and fixes to your own code, it's now hard to see what you're patches actually change to the code.

I would suggest you create a clean new set of patches, based on sudar's most recent master branch. Possibly git rebase can help you here, though it might create so many conflicts that it would be easier to just start over. For the latter, you could try "git reset origin/master" to reset your branch, but not your working copy, to sudar's master, and then use git add -p to commit the relevant bits in separate patches (if needed, perhaps one big patch would also be ok?)

@sudar
Copy link
Owner

sudar commented Jun 6, 2013

Because of all the merging, conflicting changes and fixes to your own code, it's now hard to see what you're patches actually change to the code.

Yes, it is very difficult to see the changes. Also you might have to close this pull request and open a new one with your patch, so we can cleanly see what is getting changed.

I think I'm still not good at github-based coding, so I'm not sure I'm doing well this time.

Do let me know if you need any help with git or github. If it is too overwhelming for you, then you can send me your current working directory as a zip file and I can generate the patches for you.

@matthijskooijman
Copy link
Contributor

Yes, it is very difficult to see the changes. Also you might have to close this pull request and open a new one with your patch, so we can cleanly see what is getting changed.

AFAIU, you can also just use git push -f to force push into the branch that generated this pullrequest, and github will remove the old commits from it and just show the new ones.

@guicho271828
Copy link
Author

thank you both. so the point is: difficult to see the changes.

Also you might have to close this pull request and open a new one with your patch

I follow this advice first.

@sudar
Copy link
Owner

sudar commented Jun 8, 2013

@guicho271828 I had a look at your repo and I found three changes

  • Fix to work with Leonardo
  • Change to avrdude path
  • Added sudo targets

Out of this, I guess the 2 and 3rd changes are for your personal use.

It would be nice if you can send a pull request for the first change alone. If you are still struggling with git/github, then let me know and I can create a patch on your behalf.

@sudar
Copy link
Owner

sudar commented Jun 8, 2013

@guicho271828 I took your code changes for leonardo and created a separate branch. Check it out at https://github.com/sudar/Arduino-Makefile/tree/leonardo

I tested it with both my Uno and Leonardo and it seems to be working fine. Can you also check if it works? I will merge it with the master branch once you confirm it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants