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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jake Read
ucbus-stepper
Commits
ae944adc
Commit
ae944adc
authored
2 years ago
by
Jake Read
Browse files
Options
Downloads
Patches
Plain Diff
close to completion on axl rework
parent
9d2a4f8b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
firmware/axl-stepper/src/axl
+1
-1
1 addition, 1 deletion
firmware/axl-stepper/src/axl
firmware/axl-stepper/src/main.cpp
+65
-20
65 additions, 20 deletions
firmware/axl-stepper/src/main.cpp
firmware/axl-stepper/src/osape
+1
-1
1 addition, 1 deletion
firmware/axl-stepper/src/osape
with
67 additions
and
22 deletions
axl
@
3d62ffa4
Compare
bda32c5b
...
3d62ffa4
Subproject commit
bda32c5b94c68a6f674d8ccac94a9abf4524e9d5
Subproject commit
3d62ffa48024d7c43844653dac7199f1bbacc254
This diff is collapsed.
Click to expand it.
firmware/axl-stepper/src/main.cpp
+
65
−
20
View file @
ae944adc
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
//OSAP osap("axl-stepper_y-right");
//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_e");
//
OSAP osap("axl-stepper_z");
OSAP
osap
(
"axl-stepper_z"
);
OSAP
osap
(
"axl-stepper_rl"
);
//
OSAP osap("axl-stepper_rl");
// OSAP osap("axl-stepper_rr");
// OSAP osap("axl-stepper_rr");
// -------------------------------------------------------- 0: USB Serial
// -------------------------------------------------------- 0: USB Serial
...
@@ -136,7 +136,7 @@ Endpoint precalculatedSegmentEP(&osap, "segmentsIn", onSegmentData);
...
@@ -136,7 +136,7 @@ Endpoint precalculatedSegmentEP(&osap, "segmentsIn", onSegmentData);
// -------------------------------------------------------- 5: Halt Input
// -------------------------------------------------------- 5: Halt Input
EP_ONDATA_RESPONSES
onHaltInData
(
uint8_t
*
data
,
uint16_t
len
){
EP_ONDATA_RESPONSES
onHaltInData
(
uint8_t
*
data
,
uint16_t
len
){
axl_halt
(
AXL_HALT_REQUEST
);
axl_halt
(
data
[
0
]
);
return
EP_ONDATA_REJECT
;
return
EP_ONDATA_REJECT
;
}
}
...
@@ -172,9 +172,41 @@ EP_ONDATA_RESPONSES onMotorSettingsData(uint8_t* data, uint16_t len){
...
@@ -172,9 +172,41 @@ EP_ONDATA_RESPONSES onMotorSettingsData(uint8_t* data, uint16_t len){
Endpoint
motorSettingsEP
(
&
osap
,
"motorSettings"
,
onMotorSettingsData
);
Endpoint
motorSettingsEP
(
&
osap
,
"motorSettings"
,
onMotorSettingsData
);
// --------------------------------------------------------
9
: Limit Halt-Output:
// --------------------------------------------------------
10
: Limit Halt-Output:
// Endpoint limitHaltEP(&osap, "limitOutput");
Endpoint
limitHaltEP
(
&
osap
,
"limitSwitchState"
);
#define LIMIT_PIN 23
#define LIMIT_PORT 0
void
limitSetup
(
void
){
PORT
->
Group
[
LIMIT_PORT
].
DIRCLR
.
reg
=
(
1
<<
LIMIT_PIN
);
PORT
->
Group
[
LIMIT_PORT
].
PINCFG
[
LIMIT_PIN
].
bit
.
INEN
=
1
;
// pullup
PORT
->
Group
[
LIMIT_PORT
].
OUTSET
.
reg
=
(
1
<<
LIMIT_PIN
);
}
boolean
checkLimit
(
void
){
return
(
PORT
->
Group
[
LIMIT_PORT
].
IN
.
reg
&
(
1
<<
LIMIT_PIN
));
}
// -------------------------------------------------------- 11: Motion State
boolean
beforeMotionStateQuery
(
void
);
Endpoint
motionStateEP
(
&
osap
,
"motionState"
,
beforeMotionStateQuery
);
uint8_t
dummyMotionStateData
[
1
];
boolean
beforeMotionStateQuery
(
void
){
if
(
axl_isMoving
()){
dummyMotionStateData
[
0
]
=
1
;
}
else
{
dummyMotionStateData
[
0
]
=
0
;
}
motionStateEP
.
write
(
dummyMotionStateData
,
1
);
return
true
;
}
// -------------------------------------------------------- Arduino Setup
// -------------------------------------------------------- Arduino Setup
...
@@ -191,6 +223,8 @@ void setup() {
...
@@ -191,6 +223,8 @@ void setup() {
stepper_hw
->
setMicrostep
(
4
);
stepper_hw
->
setMicrostep
(
4
);
// setup controller
// setup controller
axl_setup
();
axl_setup
();
// setup limit swootch
limitSetup
();
// ticker begin:
// ticker begin:
// d51ClockUtils->start_ticker_a(AXL_TICKER_INTERVAL_US);
// d51ClockUtils->start_ticker_a(AXL_TICKER_INTERVAL_US);
}
}
...
@@ -199,9 +233,16 @@ void setup() {
...
@@ -199,9 +233,16 @@ void setup() {
uint32_t
lastBlink
=
0
;
uint32_t
lastBlink
=
0
;
uint32_t
blinkInterval
=
50
;
// ms
uint32_t
blinkInterval
=
50
;
// ms
uint8_t
axlData
[
256
];
uint8_t
axlData
[
256
];
uint16_t
axlDataLen
=
0
;
uint16_t
axlDataLen
=
0
;
uint32_t
lastLimitCheck
=
0
;
uint32_t
limitCheckInterval
=
1
;
// ms, helps to debounce, bummer to be running this often
uint8_t
limitTrace
=
0
;
// 8-wide 1-bit state trace... for edge-masking,
boolean
limitState
=
false
;
uint8_t
dummy
[
2
]
=
{
0
,
0
};
// lol, typed endpoints wanted !
void
loop
()
{
void
loop
()
{
osap
.
loop
();
osap
.
loop
();
// check for halt info...
// check for halt info...
...
@@ -227,21 +268,25 @@ void loop() {
...
@@ -227,21 +268,25 @@ void loop() {
// updateStatesEP();
// updateStatesEP();
//axl_printHomeState();
//axl_printHomeState();
}
}
// // this, i.e, could be on the endpoint's loop code, non?
// this, i.e, could be on an endpoint's loop code, non?
// if(lastLimitCheck + limitCheckInterval < millis()){
if
(
lastLimitCheck
+
limitCheckInterval
<
millis
()){
// lastLimitCheck = millis();
lastLimitCheck
=
millis
();
// // shift left one & tack bit on the end,
// shift left one & tack bit on the end,
// limitStates = limitStates << 1;
limitTrace
=
limitTrace
<<
1
;
// limitStates |= axl_checkLimit() ? 1 : 0;
limitTrace
|=
checkLimit
()
?
1
:
0
;
// // this is the positive-edge mask,
// swap on positive or -ve edges,
// if(limitStates == 0b00001111){
if
(
limitTrace
==
0b11111111
&&
limitState
==
false
){
// ERRLIGHT_ON;
ERRLIGHT_ON
;
// errLightOnTime = millis();
limitState
=
true
;
// errLightOn = true;
dummy
[
0
]
=
1
;
// dummy[0] = 1;
limitHaltEP
.
write
(
dummy
,
1
);
// limitHaltEP.write(dummy, 1);
}
else
if
(
limitTrace
==
0b00000000
&&
limitState
==
true
){
// }
ERRLIGHT_OFF
;
// }
limitState
=
false
;
dummy
[
0
]
=
0
;
limitHaltEP
.
write
(
dummy
,
1
);
}
}
// if(errLightOn && errLightOnTime + 250 < millis()){
// if(errLightOn && errLightOnTime + 250 < millis()){
// ERRLIGHT_OFF;
// ERRLIGHT_OFF;
// errLightOn = false;
// errLightOn = false;
...
...
This diff is collapsed.
Click to expand it.
osape
@
e656c969
Compare
02d0a15f
...
e656c969
Subproject commit
02d0a15f90372e1f15f37ca4e0882b956d2eec70
Subproject commit
e656c969af1ca5785108d0007294441ffafbb732
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