Goto CoreXY to work
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#define HOME_SPEED_FAST 10000
|
||||
#define HOME_SPEED_SLOW 2000
|
||||
#define HOME_SPEED_VERY_SLOW 500
|
||||
#define OPERATING_SPEED 9000
|
||||
|
||||
enum HOME_AXIS_DIRECTION {
|
||||
TOP_LEFT = X_DIRECTION_TOP | Y_DIRECTION_LEFT,
|
||||
@@ -44,14 +45,62 @@ struct MotorPosition {
|
||||
int y;
|
||||
};
|
||||
|
||||
struct BoardMessurements {
|
||||
int x_padding;
|
||||
int y_padding;
|
||||
|
||||
int x_num;
|
||||
int y_num;
|
||||
|
||||
int cell_x;
|
||||
int cell_y;
|
||||
};
|
||||
|
||||
BoardMessurements calcBoardMessurements(MotorPosition p0, MotorPosition p1, int grid_x, int grid_y);
|
||||
MotorPosition calcPosition(BoardMessurements * messurements, int x, int y);
|
||||
|
||||
void vTaskInitMotorHome(void *pvParameters);
|
||||
|
||||
#define HOME_COUNT 20
|
||||
class CoreXYMaschine {
|
||||
private:
|
||||
TMC2209_UART * uart_driver0;
|
||||
TMC2209_UART * uart_driver1;
|
||||
TMC2209_step_dual * step_driver;
|
||||
|
||||
bool enableMotors = false;
|
||||
|
||||
bool posUnknow = true;
|
||||
MotorPosition current_pos;
|
||||
|
||||
BoardMessurements boardMessurements;
|
||||
SemaphoreHandle_t xMoveMutex;
|
||||
|
||||
enum HOME_AXIS_DIRECTION ORIGIN = TOP_LEFT;
|
||||
|
||||
int untilNextHome = HOME_COUNT;
|
||||
|
||||
public:
|
||||
CoreXYMaschine(TMC2209_UART * uart_driver0, TMC2209_UART * uart_driver1, TMC2209_step_dual * step_driver);
|
||||
|
||||
void runTasks();
|
||||
void homeFast(MotorPosition * last_pos, bool ignoreMutex);
|
||||
void home(MotorPosition * last_pos);
|
||||
|
||||
void initLimitSW();
|
||||
void debugPrintSwitch(uint32_t switchPin);
|
||||
void debugAllSwitchStates();
|
||||
|
||||
void setMotorEnabled(bool enabled);
|
||||
bool getMotorEnabled();
|
||||
|
||||
void setBoardMessurements(BoardMessurements messurements);
|
||||
void gotoPosition(int x, int y);
|
||||
};
|
||||
|
||||
void homeXY(TMC2209_step_dual * driver, HOME_AXIS_DIRECTION direction, unsigned int speed, unsigned int backupSpace, MotorPosition * last_pos);
|
||||
MotorPosition homeSequence(TMC2209_step_dual * driver, MotorPosition * last_pos);
|
||||
|
||||
|
||||
void initLimitSwitches();
|
||||
extern absolute_time_t debounce_cooldown_ticks;
|
||||
extern absolute_time_t limit_debounce_tick;
|
||||
void isr_LimitSwitch(unsigned int gpio, uint32_t event_mask);
|
||||
|
||||
void waitForSwitch(uint32_t switchPin);
|
||||
|
||||
void debugPrintSwitch(uint32_t switchPin);
|
||||
void printAllSwitchStates();
|
||||
Reference in New Issue
Block a user