PES_4_Spleisser / Mbed 2 deprecated SpleisserProgramm_V11

Dependencies:   mbed mbed-rtos X_NUCLEO_IHM02A1

Revision:
37:a74d377d8f74
Parent:
36:ba2e7eddbafa
Child:
38:3776ee18e56f
diff -r ba2e7eddbafa -r a74d377d8f74 ST_SOLO.cpp
--- a/ST_SOLO.cpp	Wed May 08 09:35:40 2019 +0000
+++ b/ST_SOLO.cpp	Fri May 10 17:31:36 2019 +0000
@@ -77,7 +77,11 @@
 extern DigitalIn LS_2;
 extern DigitalIn LS_3;
 
-extern L6470 **motors;
+extern L6470  **motors;
+extern L6470B **motors2;
+
+extern XNucleoIHM02A1 *x_nucleo_ihm02a1_1;
+extern XNucleoIHM02A12 *x_nucleo_ihm02a1_2;
 
 extern DigitalIn  mybutton;
 
@@ -92,6 +96,9 @@
 int val_LS2 = 0;
 int val_LS3 = 0;
 
+int count = 0;
+
+
 Timer machNichts;
 
 void enable_Buttons()
@@ -103,15 +110,14 @@
 void entry_SOLO_DEFAULT()
 {
     StatusSOLO = SOLO_DEFAULT;
+    DisplaySendeBefehl(0x01);
     machNichts.stop();
     machNichts.reset();
     zeit = 0;
     val_LS1 = LS_1.read();
     if(val_LS1 == 0) {
         while(val_LS1 == 0) {
-            Stepper_1_Run('R', 200);
-            DisplaySendeBefehl(0x01);
-            DisplaySendeBefehl(0x0C);
+            Stepper_1_Run('R', 500);
             gotoxy(1, 1);
             DisplaySendeString("ABBRUCH:");
             gotoxy(1, 2);
@@ -124,16 +130,14 @@
     val_LS3 = LS_3.read();
     if(val_LS3 == 0) {
         while(val_LS3 == 0) {
-            Stepper_3_Run('V', 200);
-            DisplaySendeBefehl(0x01);
-            DisplaySendeBefehl(0x0C);
+            Stepper_2_Run('V', 500);
             gotoxy(1, 1);
             DisplaySendeString("ABBRUCH:");
             gotoxy(1, 2);
             DisplaySendeString("Filament links");
             gotoxy(1, 4);
             DisplaySendeString("entfernen");
-            val_LS1 = LS_1.read();
+            val_LS3 = LS_3.read();
         }
     }
     DisplaySendeBefehl(0x01);
@@ -183,6 +187,7 @@
 
 void entry_SOLO_Spleissen()
 {
+    DisplaySendeBefehl(0x01);
     StatusSOLO = SOLO_Spleissen;
 }
 
@@ -194,8 +199,8 @@
             enable_Buttons();
 
             Stepper_1_Leerlauf();
-            Stepper_3_Leerlauf();
-            
+            Stepper_2_Leerlauf();
+
 
             DisplaySendeBefehl(0x0C);
             gotoxy(1, 1);
@@ -215,11 +220,14 @@
             }
 
 
+
             if(buttonSTART_pressed == true) {
                 buttonSTART_pressed = false;
                 buttonSTART_diable_cb();
+                //entry_SOLO_EinlegenOUT();
                 entry_SOLO_EinlegenIN();
             }
+
             break;
 
 
@@ -253,7 +261,7 @@
 
             val_LS2 = LS_2.read();
             if(val_LS2 == 1) {
-                Stepper_1_Run('V', 200);
+                Stepper_1_Run('V', 100);
             } else if (val_LS2 == 0) {
                 Stepper_1_Stop();
                 entry_SOLO_INtoSPLEISSER();
@@ -316,9 +324,9 @@
 
             val_LS3 = LS_3.read();
             if(val_LS3 == 1) {
-                Stepper_3_Run('R', 200);        /// das isch no Scheisse
+                Stepper_2_Run('R', 100);        /// das isch no Scheisse
             } else if (val_LS3 == 0) {
-                Stepper_3_Stop();
+                Stepper_2_Stop();
                 entry_SOLO_OUTtoSPLEISSER();
             }
             break;
@@ -352,17 +360,75 @@
             break;
 
         case SOLO_Spleissen:
-            DisplaySendeBefehl(0x0C);
+
+            //DisplaySendeBefehl(0x0C);
             gotoxy(1, 1);
             DisplaySendeString("Spleissen");
             gotoxy(1, 3);
-            DisplaySendeString("Spleissent");
+            DisplaySendeString("Spleissen");
+
+
+            motors[1]->set_max_speed(50);
+            //motors[1]->set_acceleration(5);
+            Stepper_2_Move('R', 1.3*400);
+            StatusSOLO = SOLO_FERTIG;
+
             break;
 
         case SOLO_FERTIG:
+
+            motors[1]->set_max_speed(50);
+            motors[1]->set_acceleration(10);
+            motors[0]->set_max_speed(55);
+            motors[0]->set_acceleration(10);
+
+            //motors[0]->move(StepperMotor::FWD, 0.2*400*128);
+            motors[1]->move(StepperMotor::FWD, 0.05*400*128);
+            
+            //Set_Cutter(400, 200, 4);
+
+            motors[1]->wait_while_active();
+
+            
+
+            motors[1]->set_max_speed(300);
+            motors[1]->set_acceleration(300);
+            motors[0]->set_max_speed(400);
+            motors[0]->set_acceleration(400);
+
+            motors[0]->move(StepperMotor::FWD, 1.2*400*128);
+            motors[1]->move(StepperMotor::FWD, 1*400*128);
+            motors[1]->wait_while_active();
+            Stepper_2_Leerlauf();
+            /*
+            motors[0]->perform_prepared_actions();
+            motors2[0]->perform_prepared_actions();
+            */
+
+
+
+
+            //motors2[0]->perform_prepared_actions();
+
+            //Stepper_3_Move('V', 1.3*400);
+
+
+
+
+
+            /*
+            Stepper_3_Move('V', 1*400);
+            Stepper_1_Move('V', 1*400);
+            */
+
+            StatusSOLO = SOLO_STOERUNG;
             break;
 
         case SOLO_STOERUNG:
+            gotoxy(1, 1);
+            DisplaySendeString("fertigfertig");
+            gotoxy(1, 3);
+            DisplaySendeString("fertigfertig");
             break;
 
     }