Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ucbus-stepper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jake Read
ucbus-stepper
Commits
f9cf7843
Commit
f9cf7843
authored
2 years ago
by
Jake Read
Browse files
Options
Downloads
Patches
Plain Diff
add limit-halt-output
parent
a76660c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
firmware/axl-stepper/src/main.cpp
+33
-4
33 additions, 4 deletions
firmware/axl-stepper/src/main.cpp
with
33 additions
and
4 deletions
firmware/axl-stepper/src/main.cpp
+
33
−
4
View file @
f9cf7843
...
...
@@ -18,8 +18,11 @@
//OSAP osap("axl-stepper_z-front-right");
//OSAP osap("axl-stepper_y-left");
//OSAP osap("axl-stepper_y-right");
OSAP
osap
(
"axl-stepper_x"
);
//
OSAP osap("axl-stepper_x");
//OSAP osap("axl-stepper_e");
OSAP
osap
(
"axl-stepper_z"
);
//OSAP osap("axl-stepper_rl");
//OSAP osap("axl-stepper_rr");
VPort_ArduinoSerial
vpUSBSerial
(
&
osap
,
"arduinoUSBSerial"
,
&
Serial
);
...
...
@@ -232,6 +235,10 @@ EP_ONDATA_RESPONSES onPrecalculatedMoveData(uint8_t* data, uint16_t len){
Endpoint
precalculatedMoveEP
(
&
osap
,
"precalculatedMoves"
,
onPrecalculatedMoveData
);
// -------------------------------------------------------- 9: Limit Halt-Output:
Endpoint
limitHaltEP
(
&
osap
,
"limitOutput"
);
// -------------------------------------------------------- Arduino Setup
void
setup
()
{
...
...
@@ -257,6 +264,12 @@ uint32_t lastBlink = 0;
uint32_t
blinkInterval
=
50
;
// ms
uint8_t
dummy
[
128
];
uint32_t
lastLimitCheck
=
0
;
uint32_t
limitCheckInterval
=
1
;
// ms, helps debounce
uint8_t
limitStates
=
0
;
uint32_t
errLightOnTime
=
0
;
boolean
errLightOn
=
false
;
void
loop
()
{
osap
.
loop
();
stepper_hw
->
dacRefresh
();
...
...
@@ -267,9 +280,25 @@ void loop() {
updateStatesEP
();
//axl_printHomeState();
}
// if(haltLightOnTime + 250 < millis()){
// ERRLIGHT_OFF;
// }
// this, i.e, could be on the endpoint's loop code, non?
if
(
lastLimitCheck
+
limitCheckInterval
<
millis
()){
lastLimitCheck
=
millis
();
// shift left one & tack bit on the end,
limitStates
=
limitStates
<<
1
;
limitStates
|=
axl_checkLimit
()
?
1
:
0
;
// this is the positive-edge mask,
if
(
limitStates
==
0b00001111
){
ERRLIGHT_ON
;
errLightOnTime
=
millis
();
errLightOn
=
true
;
dummy
[
0
]
=
1
;
limitHaltEP
.
write
(
dummy
,
1
);
}
}
if
(
errLightOn
&&
errLightOnTime
+
250
<
millis
()){
ERRLIGHT_OFF
;
errLightOn
=
false
;
}
}
// -------------------------------------------------------- Small-Time Ops
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment