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

Q: Report position and smooth stop in the middle of process #98

Open
LinuksGuru opened this issue Sep 30, 2020 · 1 comment
Open

Q: Report position and smooth stop in the middle of process #98

LinuksGuru opened this issue Sep 30, 2020 · 1 comment

Comments

@LinuksGuru
Copy link

LinuksGuru commented Sep 30, 2020

Hi! I'm having some problems with library. Right now I can init, start, stop motors, with smooth acceleration/deceleration (with Python on Raspberry Pi). Unfortunately, there are 2 things which don't work yet for me.

  1. Report position. Code snippets attached. Returned position is always "0". Looks like coded something wrong. If you have samples how to properly use "report position" it would be great.

  2. Smooth stop command when move is still NOT complete. I have no idea if its possible to reset (re-init) number of steps while motor still spinning. If this is technically possible, report position feature is required (p 1).

Thanks in advance for any help.

PS. Unfortunately googling "firmata accelstepper example" yields nothing useful.

def accStepFmt_Step(brd, dev_no, num_steps):
    cmd = bytearray([acc.ACCELSTEPPER_STEP, dev_no])
    cmd.extend(ecn.encodeIntTo7bitSysex(num_steps))
    brd.send_sysex(acc.ACCELSTEPPER_DATA, cmd)

def accStepFmt_ReportPosRequest(brd, dev_no):
    cmd = bytearray([acc.ACCELSTEPPER_REPORT_POSITION, dev_no])
    return brd.send_sysex(acc.ACCELSTEPPER_DATA, cmd)
  
def accStepFmt_ReportPosReply(brd, dev_no):
    sb = bytearray([0] * 5)
    cmd = bytearray([acc.ACCELSTEPPER_REPORT_POSITION, dev_no, sb[0], sb[1], sb[2], sb[3], sb[4]])
    brd.send_sysex(acc.ACCELSTEPPER_DATA, cmd)
    return ecn.bytesToInt(sb)

@LinuksGuru
Copy link
Author

LinuksGuru commented Oct 1, 2020

This is actually follow-up of this bug report
#99

Anyway, if someone can provide sample how to properly implement ACCELSTEPPER_REPORT_POSITION
in Python on RapPi it would be very nice. Main doesn't work and vice versa.

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

No branches or pull requests

1 participant