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.
Diff: main.cpp
- Revision:
- 31:7896ac3a5a1c
- Parent:
- 30:27838f6fdfd6
- Child:
- 32:5bd3f0d073ac
--- a/main.cpp Fri May 25 17:28:28 2018 +0000
+++ b/main.cpp Fri May 25 23:53:27 2018 +0000
@@ -82,6 +82,8 @@
int y_steps_to_run;
int z_steps_to_run;
+int cleaning_glue_status = 0;
+
float x_distance_to_run;
float y_distance_to_run;
float z_distance_to_run;
@@ -148,8 +150,11 @@
void cancelProgram(void);
+void clean_glue(void);
+
// MAIN PROGRAM ----------------------------------------------------------------------------------------------
int main(){
+ ihm.baud(9600);
printf("\nStarting...\r\n");
t.start();
@@ -676,7 +681,7 @@
char recv;
char last_recv;
- float timeoutTime = 0.5;
+ float timeoutTime = 1.0;
//save
int save = 0;
@@ -709,6 +714,12 @@
//send saved
int send_saved = 0;
+ //clean
+ int clean = 0;
+
+ //delete
+ int delete_saved = 0;
+
printf("\n\nReceiving...\n\r");
t.reset();
@@ -755,6 +766,11 @@
wait(1);
ihm_class.sendSaved();
return;
+ } else if(clean){
+ cleaning_glue_status = !cleaning_glue_status;
+ clean_glue();
+ } else if(delete_saved){
+ saved = saved - 1;
}
break;
}
@@ -792,6 +808,14 @@
send_saved = 1;
}
+ if(recv == 'g'){
+ clean = 1;
+ }
+
+ if(recv == 'd'){
+ delete_saved = 1;
+ }
+
if(save){
if(recv == 'M'){
mode = 1;
@@ -978,4 +1002,16 @@
move(ppsMax, x_minus, y_minus, z_minus, 3000, 0, 0);
move(ppsMax, x_minus, y_minus, z_minus, 0, 3000, 0);
move(ppsMax, x_minus, y_minus, z_minus, 0, 0, 1000);
+}
+
+void clean_glue(void){
+ printf("Cleaning glue\n\r");
+ killJog();
+ if(cleaning_glue_status){
+ printf("Activating\n\r");
+ glueValve = 1;
+ } else {
+ printf("Deactivating\n\r");
+ glueValve = 0;
+ }
}
\ No newline at end of file