-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Added $MS for motor status. Fixed bug in MachineConfig for user outputs. #93
base: Devt
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the comments are addressed, I don't have any further issues with this, but overall, it has the feel of a debugging tool that was intended for a special purpose use. Do we want to keep it around?
@@ -79,6 +79,7 @@ namespace Machine { | |||
|
|||
if (_userOutputs == nullptr) { | |||
_userOutputs = new UserOutputs(); | |||
_userOutputs->init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is unnecessary since I moved the array population to the UserOutputs constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
namespace MotorDrivers { | ||
class Nullmotor : public MotorDriver { | ||
int32_t direction = 0; | ||
int32_t steps = 0; | ||
int state = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is state actually used anywhere? It gets set and unset but other than that I don't see anywhere that the information goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a left-over. I have to check. Let's first decide what to do with the PR.
public: | ||
Nullmotor() = default; | ||
|
||
bool set_homing_mode(bool isHoming) { return false; } | ||
|
||
bool isReal() override { return false; } | ||
|
||
void step() override { | ||
Assert(!disabled, "Cannot step motor while disabled."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is unwise to Assert in something that is usually called from an ISR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I agree that asserts are "unwise" in an ISR. However, the rationale here was that it should "crash early" if things go wrong. After all, if the ena/dir is incorrect, it will just crash - but then again, if it's wrong and a machine moves there are bigger issues... It was a bit of a trade-off here.
} | ||
|
||
void set_direction(bool dir) override { | ||
Assert(!disabled, "Cannot set direction while disabled."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, Assert from ISR
I only see your comments now, I really have to fix my github preferences... not sure why I didn't get a proper notification. Anyways,
I have to clarify I think. This is indeed intended to be a debugging tool, specifically to test the behavior of the stepper engine with motor movements. I considered adding a 'debug_motor', but since I noticed that I'm usually developing on null_motor, it made more sense to just add it here. It does 2 things:
Since these are quite basic functionalities of the stepper engine, I made this PR. A better place would be to make a proper unit test from this... but due to all the dependencies to other components I don't see that happening anytime soon. FTR: I'm perfectly fine with closing the PR if it's not relevant enough. |
As the title describes. Seems to be more bugs tho...