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

Make arrays for arms #175

Open
wants to merge 14 commits into
base: Maslow-Main
Choose a base branch
from

Conversation

davidelang
Copy link

This is a major effort to change from many individual variables to arrays. By the end of it, many separate functions will be collapsed, reducing code duplication. It is a work in progress, but each commit is designed to stand alone as an improvement over the prior state, without changing anything that would be visible to the user or the UI code.

@davidelang davidelang marked this pull request as draft November 15, 2024 05:57
@davidelang
Copy link
Author

Since each commit is intended to not change anything, it could be merged at any point and the remaining work done as an additional PR, but I have it marked as a draft for now.

But since it is so invasive, if other people want to work on the codebase, it may be worth merging it to avoid merge headaches in the future

@davidelang
Copy link
Author

one to-do for this is to look at the bool arrays and see if they can/should be replaced by bitmasks. I think that will simplify some things (and eliminate some fooAll variables) but that sort of change is beyond the current focus of this PR.

@davidelang davidelang force-pushed the make_arrays_for_arms branch 2 times, most recently from ab8546d to 2681867 Compare November 15, 2024 09:41
see [Projects] Modifying Maslow 4 to a cut Area of 28'x6' to cut synthetic fabric
for a use case.
instead of using magic numbers (0-3) to reference the arms,
create constants tl/tr/bl/br
convert Maslow.cpp to use these constants instead of numbers

this first commit adds a minor amount of clarity, but it's real
value will show up in later commits in the series
change many variables from separate per-axis variables to an array
indexed by the arm constants

This is a large diff, but it is separate so that it can easily be
reviewed and validated as 'obvioulsy' correct (or not)
This number is the length past where retraction stops that the belt
actually extends.

This can be from putting a stop on the belt so it doesn't retract
all the way (useful so that you can do retraction without having
to disconnect from anchors) or an added length added to the belt
to be able to reach additional distances

In both cases, you figure out what value to put in by retracting
with and without the modification

if you are adding a clamp, retract without the modification,
extend, add the clamp and then retract again. The distance reported
when the belt is fully retracted is the value to enter for that arm.

If you are adding an extension, clamp the router in place, hook
the belt to an anchor (further away than your extension), retract
until it stops, extend, hook up your extension, retract again. The
absolute value of the distance reported is what you enter for that
arm.
This should not make any difference unless there is something
buried somewhere that is doing calculations based on the old order

but not being sure how the dats is passed to the UI for calibration
this may be the case.
@davidelang davidelang marked this pull request as ready for review November 15, 2024 12:49
@davidelang
Copy link
Author

this series addresses #168 #169 #167 #165
It's compile tested after each commit, but not field tested.
I recommend doing the review on a commit at a time rather than on the entire series

@md8n @BarbourSmith

@davidelang
Copy link
Author

trying again to link things
fixes #168
fixes #169
fixes #167
fixes #165

@BarbourSmith
Copy link
Owner

This one is ready to merge?

@davidelang
Copy link
Author

davidelang commented Dec 3, 2024 via email

@@ -833,31 +833,31 @@ static Error maslow_retract_TL(const char* value, WebUI::AuthenticationLevel aut
return Error::ConfigurationInvalid;
}
sys.set_state(State::Homing);
Maslow.retractTL();
Maslow.retract(tl);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting an issue that tl is not defined in this scope. It seems like it should be since Maslow.h is included, but this is preventing this from building for me

@davidelang
Copy link
Author

davidelang commented Dec 4, 2024 via email

@BarbourSmith
Copy link
Owner

I shoulda seen that. I can easily make that change. Testing now.

@BarbourSmith
Copy link
Owner

When I go to run calibration on this PR it spools out the belt endlessly, have you tried calibration on it?

@davidelang
Copy link
Author

davidelang commented Dec 4, 2024 via email

@BarbourSmith
Copy link
Owner

Gotcha, I'll try to find time to do that, but it might take me a bit

@BarbourSmith
Copy link
Owner

It's a lot easier for me to merge things if they've been tested at least a bit on hardware

@davidelang
Copy link
Author

davidelang commented Dec 4, 2024 via email

@davidelang
Copy link
Author

checking on this what were you able to merge?

@BarbourSmith
Copy link
Owner

By far the hardest part of programming isn’t writing the code, it’s writing the code that works and fixing it when it doesn’t. 90% of the work is in the testing and debugging, and it’s especially hard to try to debug someone else’s code which has issues. If you can get this code to work and test it on a machine I’m happy to merge it in (it’s a great idea), but if it doesn’t work it’s probably going to be faster for me to close this PR and write it from scratch testing along the way.

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

Successfully merging this pull request may close these issues.

2 participants