Skip to content
Snippets Groups Projects
Commit 983f0655 authored by Pierre Korysko's avatar Pierre Korysko
Browse files

Fixed Z axis minimum limit switch

Changed sign of X/Y interlock
Temp modifications of communication through ethernet - fixed IP
parent d1702e6c
No related branches found
No related tags found
1 merge request!4Matlab class
......@@ -30,11 +30,14 @@
//byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0x72, 0xF7};
// MAC address for the Arduino on the 4DRobot
byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0x84, 0xEF};
//byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0x84, 0xEF};
// MAC address for the Arduino on the 4DRobot 2
byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0x71, 0xAC};
//To use DHCP or not to use DHCP, that's the question.
// Comment out to use static IP configuration
#define USE_DHCP
//#define USE_DHCP
#ifndef USE_DHCP
IPAddress ip(192, 168, 1, 177);
......@@ -67,7 +70,7 @@ const unsigned long temp_update_interval = 1000; //[ms]
// TODO: Tune stepWait, positions
// Note: Servo may prefer pin 9 (PWM)?
const int grabber_servo_pin = 9;
const int grabber_closed = 86; //[deg]
const int grabber_closed = 70; //[deg]
const int grabber_open = 130; //[deg]
const int grabber_min = 0; //[deg]
const int grabber_max = 180; //[deg]
......@@ -96,10 +99,10 @@ const bool stepper_backward[] = {HIGH,LOW,LOW};
//TODO: PIN4 ALSO IN USE BY ETHERNET
//TODO: Verify reproducibility of zeroing, we may need debounce?
const uint8_t stepper_switchMAX_pin[] = {33,27,42}; //positive steps limit switch pins
const uint8_t stepper_switchMIN_pin[] = {32,26,43}; //negative steps limit switch pins
const uint8_t stepper_switchMAX_pin[] = {33,27,43}; //positive steps limit switch pins
const uint8_t stepper_switchMIN_pin[] = {32,26,42}; //negative steps limit switch pins
//TODO: Verify active/inactive -> HIGH/LOW
// Note: Needs pulldown/pullup resistor
// Note: Needs pulldown/pullup resistori
// Note: Probably safest to define on-limit = open, so if a switch fails the axis is safe (but stopped)
const bool stepper_switch_active = LOW; //On limit switch when pin active
const bool stepper_switch_inactive = HIGH; //On limit switch when pin inactive
......@@ -113,14 +116,14 @@ const unsigned int stepper_accelerate_steps = 100; // When accelerating, how ma
// When at high speed, ramp down to slow speed when
// pos < accelerate_steps+slowzone or pos > (rail_length-accelerate_steps-slowzone)
//TODO: Tune distances
const unsigned long int stepper_rail_length[] = {1000,1000,1000}; // [steps] Total length of the rails
const unsigned long int stepper_rail_length[] = {4900,6800,1760}; // [steps] Total length of the rails
const unsigned long int stepper_slowzone_steps = 50; // [steps] Take it easy when approaching limit switches
//Interlocks
const long int stepper_Zpos_unlockXY = 200; // [steps] Only allow XY movements when
// Zpos > Zpos_unlockXY and Z axis
const long int stepper_Zpos_unlockXY = 1400; // [steps] Only allow XY movements when
// Zpos < Zpos_unlockXY and Z axis
// in absolute mode
const unsigned long int stepper_onlimit_steps = 50; // [steps] Number of steps to allow movement
const unsigned long int stepper_onlimit_steps = 100; // [steps] Number of steps to allow movement
// per command when a limit switch
// is active
// ***** INTERNAL CONFIGS **********************
......
......@@ -18,7 +18,7 @@ void stepper_control() {
// error if we try to move locked axis
if( (stepper_go_axis != STEPPER_Z) and
( (not stepper_mode_absolute[STEPPER_Z]) or
(stepper_pos[STEPPER_Z] <= stepper_Zpos_unlockXY)
(stepper_pos[STEPPER_Z] >= stepper_Zpos_unlockXY)
)
) {
//We are trying to move a locked axis
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment