Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On during first move (RM Issue #73, #75) #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 60 additions & 54 deletions config/config.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,61 +1,67 @@
;
; Config file for HPC laser
; Config file for HPC-3020 laser
; With 400 steps/rev motors and 16microstepping, external (leadshine)
; Prepared by Peter Brier ([email protected])
;
; Save on MBED in the root, as "config.txt"
;
net.ip 192.168.123.111 ; IP address [xxx.xxx.xxx.xxx]
net.netmask 255.255.255.0 ; netmask [xxx.xxx.xxx.xxx]
net.gateway 192.168.123.254 ; gateway
net.dns 192.168.123.194 ; DNS server
net.dhcp 0 ; Enable DHCP for IP address [0/1]
net.port 69 ; Communication socket port number []

sys.debug 1 ; debug flags bit0=verbose,
; bit1=log to serial, bit2=log to file
sys.autohome 1 ; Enable automatic homing at startup [1/0]
;(or wait for cover to close)
sys.nodisplay 0 ; Disable the display [1/0]
sys.i2cbaud 0 ; I2C display baudrate [Hz]

laser.enable 0 ; Laser enable signal polarity [0/1]
laser.on 0 ; Laser on signal polarity [0/1]
laser.pwm.min 90 ; minimum pwm value [%]
laser.pwm.max 0 ; maximum pwm value [%]
laser.pwm.freq 1000 ; pwm frequency [Hz]

motion.enable 0 ; Enable signal state to enable motors [0/1]
motion.homespeed 100 ; Homing speed [mm/sec]
motion.speed 100 ; max linear speed [mm/sec]
motion.accel 500 ; linear acceleration [mm/sec2]
motion.tolerance 50 ; tolerance [1/1000 units]

; old firmware: set speed in [usec]
motion.highspeed 100 ; speed in [usec]

; Next values are valid for axis x,y,z and e
x.pol 0 ; home/limit sensor polarity [1/0]
x.scale -158516 ; axis scaling [steps/meter]
; use negative number to invert direction [1/0]
x.homedir 0 ; state of the direction signal when homing
x.home 350000 ; home positions [um]
x.min 0 ; minimal position [um]
x.max 345000 ; maximum position [um]
x.rest 310000 ; rest position [um]
x.speed 1000 ; maximum speed [mm/sec]
x.invert 0 ; Invert signal polarity for step signal [1/0]
net.ip 192.168.123.111 ; IP address [xxx.xxx.xxx.xxx]
net.netmask 255.255.255.0 ; netmask [xxx.xxx.xxx.xxx]
net.gateway 192.168.123.0 ; gateway
net.dns 192.168.123.1 ; DNS server
net.dhcp 0 ; Enable DHCP for IP address [0/1]
net.port 69 ; Communication socket port number [69 default TFTP]

sys.debug 1 ; debug flags bit0=verbose, bit1=log to serial, bit2=log to file
sys.autohome 1 ; Enable automatic homing at startup [1], or wait for cover to close [0]
sys.nodisplay 0 ; Disable the display [1/0]
sys.i2cbaud 0 ; I2C display baudrate [Hz]

laser.enable 0 ; Laser enable signal polarity [0/1]
laser.on 0 ; Laser on signal polarity [0/1]
laser.pwm.min 0 ; minimum pwm value [%]
laser.pwm.max 100 ; maximum pwm value [%]
laser.pwm.freq 20000 ; pwm frequency [Hz]
laser.pwm.modulate 0 ; Use speed PWM speed depending modulation


motion.enable 0 ; Enable signal state to enable motors [0/1]
motion.homespeed 100 ; Homing speed [mm/sec]
motion.speed 100 ; max linear speed [mm/sec]
motion.accel 500 ; linear acceleration [mm/sec2]
motion.tolerance 50 ; tolerance [1/1000 units]

; Next set of parameter values are valid for axis x,y,z and e
x.pol 0 ; home/limit sensor polarity [1/0]
x.scale -158516 ; axis scaling [steps/meter], use negative number to invert direction
x.homedir 0 ; state of the direction signal when homing
x.home 330000 ; home positions [um]
x.min 0 ; minimal position [um]
x.max 325000 ; maximum position [um]
x.rest 310000 ; rest position [um]
x.speed 100 ; maximum speed [mm/sec]
x.invert 1 ; Invert signal polarity for step signal [1/0]

; Now for the Y-axis:
y.pol 0 ; home/limit sensor polarity [1/0]
y.scale -158516 ; axis scaling [steps/meter]
; use negative number to invert direction [1/0]
y.homedir 1 ; state of the direction signal when homing
y.home 20000 ; home positions [um]
y.min 20000 ; minimal position [um]
y.max 180000 ; maximum position [um]
y.rest 25000 ; rest position [um]
y.speed 1000 ; maximum speed [mm/sec]
y.invert 0 ; Invert signal polarity for step signal [1/0]
y.pol 0
y.scale 158516
y.homedir 1
y.home 210000
y.min 1000
y.max 180000
y.rest 210000
y.speed 1000
y.invert 0

; Z-axis not in use for HPC
; z.min 0
; z.max 200000
; z.home 100000
;z.pol 0
;z.scale 1000
;z.homedir 1
;z.home 10000
;z.min 0
;z.max 10000
;z.rest 1
;z.speed 100
;z.invert 1

; EOF
Binary file added laoslaser-9-3-2013.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion laser/LaosMenu/LaosMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void LaosMenu::Handle() {
default:
if (runfile == NULL) {
runfile = sd.openfile(jobname, "rb");
if (! runfile)
if (!runfile)
screen=MAIN;
else
mot->reset();
Expand Down
9 changes: 8 additions & 1 deletion laser/LaosMotion/LaosMotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ LaosMotion::~LaosMotion()
**/
void LaosMotion::reset()
{
step = command = xstep = xdir = ystep = ydir = zstep = zdir = 0;
step = 0;
command = 0;
xstep = xdir = ystep = ydir = zstep = zdir = 0;
ofsx = ofsy = ofsz = 0;
*laser = LASEROFF;
enable = cfg->enable;
cover.mode(PullUp);
printf("\n..Reset..\n");
}


Expand Down Expand Up @@ -220,6 +223,7 @@ void LaosMotion::write(int i)
static int x=0,y=0,z=0,power=10000;
//if ( plan_queue_empty() )
//printf("Empty\n");
// printf(" s=%d ", step);
if ( step == 0 )
{
command = i;
Expand Down Expand Up @@ -304,6 +308,8 @@ void LaosMotion::write(int i)
power = val;
printf("power: %d\n", power);
break;
default:
printf("Unknown parameter: %d, value=%d\n", param, val);
}
break;
}
Expand Down Expand Up @@ -337,6 +343,7 @@ void LaosMotion::write(int i)
}
break;
default: // I do not understand: stop motion
printf("Unknown command: %d\n", command);
step = 0;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions laser/LaosMotion/LaosMotion.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@


// the state of the laser OUTPUT
#define LASEROFF 1
#define LASERON 0
#define LASEROFF (!cfg->lon)
#define LASERON (cfg->lon)

/** Motion Controll system
*
Expand Down
16 changes: 12 additions & 4 deletions laser/LaosMotion/grbl/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,22 @@ static inline void trapezoid_generator_reset()
// Set the step timer. Note: this starts the ticker at an interval of "cycles"
static inline void set_step_timer (uint32_t cycles)
{
volatile static double p;
volatile static double p,q;
volatile static uint32_t pnom=1, pcyc=1;
timer.attach_us(&st_interrupt,cycles);
// p = to_double(pwmofs + mul_f( pwmscale, ((power>>6) * c_min) / ((10000>>6)*cycles) ) );
// p = ( to_double(c_min) * current_block->power) / ( 10000.0 * (double)cycles);
// p = (60E6/nominal_rate) / cycles; // nom_rate is steps/minute,
//
//printf("%f,%f,%f\n\r", (float)(60E6/nominal_rate), (float)cycles, (float)p);
// printf("%d: %f %f\n\r", (int)current_block->power, (float)p, (float)c_min/(float(c) ));
p = (double)(cfg->pwmmin/100.0 + ((current_block->power/10000.0)*((cfg->pwmmax - cfg->pwmmin)/100.0)));
if ( cfg->pwmmod ) // Use speed modulation?
q = (60E6/current_block->nominal_rate) / cycles; // nom_rate is steps/minute,
else
q = 1;

//printf("%d,%d(%c): %d %f %f\n\r", (int)current_block->power, (int) current_block->nominal_speed, (*laser? '1' : '0'),
//cycles, (float)p, (float)c_min/(float(c) ));

p = (double)(cfg->pwmmin/100.0 + ((q*current_block->power/10000.0)*((cfg->pwmmax - cfg->pwmmin)/100.0)));
pwm = p;
}

Expand Down
2 changes: 1 addition & 1 deletion laser/LaosMotion/pins.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern DigitalIn zmax;
// laser
extern PwmOut pwm; // O1: PWM (Yellow)
extern DigitalOut laser_enable; // O2: enable laser
extern DigitalOut o3; // 03: NC
extern DigitalOut o3; // 03: NC

#define LASER_PIN p5 // note: we define the laser pin here and do not allocate the laser DigitalOut()
extern DigitalOut *laser; // O4: LaserON (White), do not statically allocte: because this will cause the laser to switch on at reboot
Expand Down
Loading