Skip to content
Snippets Groups Projects
Commit eeb26a89 authored by Jake Read's avatar Jake Read
Browse files

motor does axl homing

parent bc79029c
No related branches found
No related tags found
No related merge requests found
Subproject commit 09e3e90667034d09f34bbe4041b3f395461fad8a
Subproject commit 71bf90214692c6a2fb82d121708b91692648376a
......@@ -155,6 +155,38 @@ EP_ONDATA_RESPONSES onMotorSettingsData(uint8_t* data, uint16_t len){
Endpoint motorSettingsEP(&osap, "motorSettings", onMotorSettingsData);
// -------------------------------------------------------- 7: Home Routine
EP_ONDATA_RESPONSES onHomeData(uint8_t* data, uint16_t len){
uint16_t rptr = 0;
uint8_t axis = data[rptr ++];
float rate = ts_readFloat32(data, &rptr);
float offset = ts_readFloat32(data, &rptr);
// alright alright, this would be sliq if we had a little async-cpp api, alas,
if(axl_isMoving()){
return EP_ONDATA_REJECT;
} else {
axl_home(axis, rate, offset);
return EP_ONDATA_REJECT;
}
}
#define LIMIT_PIN 23
#define LIMIT_PORT 0
void axl_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 axl_checkLimit(void){
return (PORT->Group[LIMIT_PORT].IN.reg & (1 << LIMIT_PIN));
}
Endpoint homeEP(&osap, "home", onHomeData);
// -------------------------------------------------------- Arduino Setup
void setup() {
......@@ -164,6 +196,7 @@ void setup() {
DEBUG2PIN_SETUP;
// port begin
vpUSBSerial.begin();
vbUCBusDrop.begin(4);
// setup stepper machine
stepper_hw->init(false, 0.0F);
stepper_hw->setMicrostep(4);
......@@ -186,6 +219,7 @@ void loop() {
lastBlink = millis();
CLKLIGHT_TOGGLE;
updateStatesEP();
axl_printHomeState();
}
}
......
Subproject commit bc18a89d155622fd8ab959773c0eb967cedd9383
Subproject commit 97e593d51e42f77c12b9ed2ae561adc5136ae9cc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment