Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 36:4d0e131146e6, committed 2019-02-26
- Comitter:
- lucasfontenla
- Date:
- Tue Feb 26 00:55:02 2019 +0000
- Parent:
- 35:4a527ba7281a
- Commit message:
- Uploading for Projeto Mecatronico 2019
Changed in this revision
| classes.h | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/classes.h Mon Jun 11 20:05:47 2018 +0000
+++ b/classes.h Tue Feb 26 00:55:02 2019 +0000
@@ -44,6 +44,7 @@
}
void action_complete(void){
+ printf("Action complete\n\r");
send("a");
}
@@ -69,6 +70,7 @@
buffer.push_back(c);
}
}
+ saved++;
}
void translate_gcode(string line, int line_number){
--- a/main.cpp Mon Jun 11 20:05:47 2018 +0000
+++ b/main.cpp Tue Feb 26 00:55:02 2019 +0000
@@ -22,7 +22,7 @@
DigitalOut ledXY(D10);
DigitalOut ledZ(D11);
-DigitalOut glueValve(D12);
+DigitalOut glueValve(D9);
// hardware input signal
// end-of-stroke sensors
@@ -162,21 +162,9 @@
printf("\nStarting...\r\n");
enable = 1;
+ glueValve = 0;
t.start();
- /*
- enable = 0;
- while (1){
- moving_test();
- }*/
-
- /*
- while(1){
- glueValve = 1;
- wait(1);
- glueValve = 0;
- wait(1);
- }*/
// interrupções de fim de curso
@@ -189,7 +177,7 @@
endZ.fall(&endZ_press);
endZ.rise(&endZ_release);
- //joyClick.fall(&joystickClick);
+ joyClick.fall(&joystickClick);
while(1){
if(ihm.readable()){
@@ -242,7 +230,7 @@
}
}
void endZ_release(void){
- printf("Z - release\n\r");
+ //printf("Z - release\n\r");
z_block_min = 0;
z_block_max = 0;
}
@@ -343,6 +331,8 @@
printf("Zero X\n\r");
float time = 1.0/pps/2.0;
+ int offsetX;
+
if(dirX != x_minus){
dirX = x_minus;
}
@@ -360,18 +350,24 @@
wait(time);
}
+ offsetX = distance_to_steps(10.0, xPitch);
+
+ move(ppsMax, x_plus, y_plus, z_plus, offsetX, 0, 0);
+
printf("X zero\n\r");
totalX = 0;
X = steps_to_distance(totalX, xPitch);
Y = steps_to_distance(totalY, yPitch);
Z = steps_to_distance(totalZ, zPitch);
- ihm_class.send_position(X, Y, Z);
+ //ihm_class.send_position(X, Y, Z);
}
void zeroY(int pps){
printf("Zero Y\n\r");
float time = 1.0/pps/2.0;
+ int offsetY;
+
if(dirY != y_minus){
dirY = y_minus;
}
@@ -389,6 +385,10 @@
wait(time);
}
+ offsetY = distance_to_steps(10.0, yPitch);
+
+ move(ppsMax, x_plus, y_plus, z_plus, 0, offsetY, 0);
+
printf("Y zero\n\r");
totalY = 0;
@@ -402,6 +402,8 @@
printf("Zero Z\n\r");
float time = 1.0/pps/2.0;
+ int offsetZ;
+
if(dirZ != z_minus){
dirZ = z_minus;
}
@@ -419,6 +421,10 @@
wait(time);
}
+ offsetZ = distance_to_steps(5.0, yPitch);
+
+ move(ppsMax, x_plus, y_plus, z_plus, 0, 0, offsetZ);
+
printf("Z zero\n\r");
totalZ = 0;
@@ -478,7 +484,7 @@
resting_points = maxPoints-saved;
printf("Pontos restantes: %d\n\r", resting_points);
- ihm_class.send_position(X, Y, Z);
+ //ihm_class.send_position(X, Y, Z);
}
void jog(void){
@@ -661,7 +667,7 @@
printf("Total points: %d\n\r", total_points);
- for(int i = 0; i <= total_points; i++){
+ for(int i = 0; i < total_points; i++){
if(ihm.readable()){
readSerial();
}
@@ -814,8 +820,10 @@
if(gcode_move_upload){
automatic_run(saved, false);
gcode_move_upload = 0;
+ ihm_class.action_complete();
} else {
- automatic_run(saved, true);
+ automatic_run(saved, true);
+ ihm_class.action_complete();
}
} else if(jog_mode){
if(kill_jog_mode){