Update

Dependencies:   mbed mbed-rtos X_NUCLEO_IHM02A1

Files at this revision

API Documentation at this revision

Comitter:
scherfa2
Date:
Thu May 16 20:10:32 2019 +0000
Parent:
41:1a2ba8849aa6
Commit message:
Update

Changed in this revision

Buttons.cpp Show annotated file Show diff for this revision Revisions of this file
Display.cpp Show annotated file Show diff for this revision Revisions of this file
SETUP.h Show annotated file Show diff for this revision Revisions of this file
ST_DUO.cpp Show annotated file Show diff for this revision Revisions of this file
ST_DUO.h Show annotated file Show diff for this revision Revisions of this file
ST_SOLO.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/Buttons.cpp	Wed May 15 00:47:19 2019 +0000
+++ b/Buttons.cpp	Thu May 16 20:10:32 2019 +0000
@@ -5,66 +5,6 @@
 extern DigitalIn Button2;
 
 
-/*
-extern volatile bool buttonSTART_pressed;  // Used in the main loop
-extern volatile bool buttonSTART_enabled;  // Used for debouncing
-extern Timeout buttonSTART_timeout;        // Used for debouncing
-
-extern volatile bool buttonAbbruch_pressed;  // Used in the main loop
-extern volatile bool buttonAbbruch_enabled;  // Used for debouncing
-extern Timeout buttonAbbruch_timeout;        // Used for debouncing
-
-*/
-
-/* --------------------------- START_BUTTON --------------------------------- 
-// Enables button when bouncing is over
-void buttonSTART_enabled_cb(void)
-{
-    buttonSTART_enabled = true;
-}
-void buttonSTART_diable_cb(void)
-{
-    buttonSTART_enabled = false;
-}
-
-// ISR handling button pressed event
-void buttonSTART_onpressed_cb(void)
-{
-    if (buttonSTART_enabled) { // Disabled while the button is bouncing
-        buttonSTART_enabled = false;
-        buttonSTART_pressed = true; // To be read by the main loop
-            
-        buttonSTART_timeout.attach(callback(buttonSTART_enabled_cb), 0.300); // Debounce time 300 ms
-    }
-}
-/* ---------------------------------- END ----------------------------------- */
-
-
-
-
-/* ------------------------- ABBRUCH_BUTTON --------------------------------- 
-// Enables button when bouncing is over
-void buttonAbbruch_enabled_cb(void)
-{
-    buttonAbbruch_enabled = true;
-}
-void buttonAbbruch_diable_cb(void)
-{
-    buttonAbbruch_enabled = false;
-}
-
-// ISR handling button pressed event
-void buttonAbbruch_onpressed_cb(void)
-{
-    if (buttonAbbruch_enabled) { // Disabled while the button is bouncing
-        buttonAbbruch_enabled = false;
-        buttonAbbruch_pressed = true; // To be read by the main loop
-            
-        buttonAbbruch_timeout.attach(callback(buttonAbbruch_enabled_cb), 0.300); // Debounce time 300 ms
-    }
-}
-*/
-
 bool get_Button_1()
 {
      if(Button1 == 1)
--- a/Display.cpp	Wed May 15 00:47:19 2019 +0000
+++ b/Display.cpp	Thu May 16 20:10:32 2019 +0000
@@ -48,20 +48,7 @@
     bit6=0;
     bit7=0;
     wait_ms(1); 
-    /*
-    PORTB= PORTB & 0b11111000;      // RW=0,E=0,RS=0    
-    _delay_ms(1);                   // delay>40ns tAS
-    PORTB= PORTB | 0b00000100;      // E=1, Rest wie bis anhin  
-    _delay_ms(1);                   // delay>460ns tpw
-    PORTA = Befehl;                 // Daten für Befehl
-    _delay_ms(1);                   // delay>80ns tsp2          
-    PORTB= PORTB & 0b11111011;      // E=0, Rest wie bis anhin
-    _delay_ms(1);                   // delay>10ns thd1 &(5ns thd2)
-    PORTB= PORTB & 0b11111100;      // RW=0,RS=0
-    PORTA= 0;                       // Port A löschen (gesendete Daten)
-    _delay_ms(1);                   // alle delays ab E=1 >500ns tc
-    
-    */
+
 }
 /**************************************************************
 Sende-Zeichen-Funktion für das Display Midas
@@ -98,21 +85,7 @@
     bit6=0;
     bit7=0;
     wait_ms(1);
-    
-    
-    /*PORTB= PORTB & 0b11111000;      // RW=0,E=0,RS=0
-    PORTB= PORTB | 0b00000001;      // RS=1
-    _delay_ms(1);                   // delay>40ns tsp1
-    PORTB= PORTB | 0b00000100;      // E=1, Rest wie bis anhin
-    _delay_ms(1);                   // delay>230ns tpw
-    PORTA = Zeichen;                // Daten für Zeichen
-    _delay_ms(1);                   // delay>80ns tsp2      
-    PORTB= PORTB & 0b11111011;      // E=0, Rest wie bis anhin
-    _delay_ms(1);                   // delay>10ns thd1 &(5ns thd2)
-    PORTB= PORTB & 0b11111100;      // RW=0,RS=0    
-    PORTA= 0;                       // Port A löschen (gesendete Daten)                 
-    _delay_ms(1);                   // alle delays ab E=1 >500ns tc*/
-    
+     
 }
 
 /**************************************************************
@@ -145,23 +118,7 @@
     wait_ms(1);
     DisplaySendeBefehl(0b00000001);
     wait_ms(3);
-    DisplaySendeBefehl(0b00000110);
-     
-    
-         
-       
-        
-
-    /*_delay_ms(20);                     // delay>15ms
-    DisplaySendeBefehl(0b00110000);     // Instruktion
-    _delay_ms(5);                       // delay>4.1ms  
-    DisplaySendeBefehl(0b00110000);     // Instruktion
-    _delay_ms(5);                       // delay>100us 
-    DisplaySendeBefehl(0b00110000);     // Instruktion
-    DisplaySendeBefehl(0b00111100);     // 8bit-,2line-,5x11dots mode
-    DisplaySendeBefehl(0b00001000);     // Display off
-    DisplaySendeBefehl(0b00000001);     // Display clear
-    DisplaySendeBefehl(0b00000110);     // Entry mode set*/
+    DisplaySendeBefehl(0b00000110);        
 }
 
 /**************************************************************
--- a/SETUP.h	Wed May 15 00:47:19 2019 +0000
+++ b/SETUP.h	Thu May 16 20:10:32 2019 +0000
@@ -89,6 +89,7 @@
     // Kommunikation_Filamentmessung
     #define CUT_SIGNAL      PB_2
     #define COM_SIGNAL      PB_12
+    #define FERTIG_SIGNAL   PC_11
     // PC11 Reserve!!!!
 
     // Kommunikation Aufrollen
@@ -103,8 +104,8 @@
 
     // Weiche
     #define SERVO_FR              240 // [Hz]
-    #define GOOD_FIL             25.5 // [°] (max 90)
-    #define BAD_FIL                55 // [°] (min 0)
+    #define GOOD_FIL             31.5 // [°] (max 90)
+    #define BAD_FIL                61 // [°] (min 0)
     
     // Cutter
     #define CUTTER_FRQ_1        20000 // [Hz]
@@ -123,7 +124,8 @@
     #define FILACC                800
     #define COOLINGTIME             5 // [s]
     
-    
+    // DUO-Betrieb
+    #define LAENGE_LS3_To_STEPPER2  2
 
     // SOLO-Betrieb
     #define WARTEZEIT              60 // [s]
--- a/ST_DUO.cpp	Wed May 15 00:47:19 2019 +0000
+++ b/ST_DUO.cpp	Thu May 16 20:10:32 2019 +0000
@@ -6,8 +6,14 @@
 
 extern DigitalIn InputKontrollmodul;
 extern DigitalIn CutSignal;
+extern DigitalIn FertigSignal;
 int val_CutSignal = 0;
+int val_FertigSignal = 0;
 
+int Stepper1CurrentPos = 0;
+int Stepper1MarkPos = 0;
+
+bool Fertig = false;
 
 bool Fila_Good = false;
 
@@ -55,7 +61,27 @@
      else return false;
 }
 
-
+bool get_FertigSignal()
+{     
+    val_FertigSignal = FertigSignal.read();
+     if( val_FertigSignal == 1)
+     {
+         wait(0.01);
+         if(val_FertigSignal == 1)
+         {
+             return true;
+         }   
+     }
+     else if(val_FertigSignal == 0)
+     {
+         wait(0.01);
+         if(val_FertigSignal == 0)
+         {
+             return false;
+         } 
+     }
+     else return false;
+}
 
 void EntryDuoDefault()
 {
@@ -67,7 +93,10 @@
     Stepper_1_Leerlauf();
     Stepper_2_Leerlauf();
     Stepper_3_Leerlauf();
-    Set_Servo_Bad_Fil();
+    if(LS_1 == 1)
+    {
+        Set_Servo_Bad_Fil();
+    }
     
     DisplaySendeBefehl(0x0C);
     DisplaySendeBefehl(0x01);
@@ -87,10 +116,10 @@
 {   
     DisplaySendeBefehl(0x01);
     gotoxy(1,1);
-    DisplaySendeString("Filament einlgenen");
+    DisplaySendeString("Filament einlegen...");
     gotoxy(1,4);
     DisplaySendeString("             Abbruch");
-    
+    Set_Servo_Bad_Fil();
     Stepper_1_Run('V', 300);
     
     StatusDUO=DUO_EINLEGEN;
@@ -147,25 +176,25 @@
     Stepper_1_SetPara(100, 100);
  
     Set_Cutter(500, 0, 1);
-    motors2[0]->move(StepperMotor::FWD, 128*400*5);
+    motors2[0]->move(StepperMotor::FWD, 128*400*4);
     motors[0]->move(StepperMotor::BWD, 128*400*0.3);
     Set_Cutter(600, 0, 1);
     
     motors2[0]->wait_while_active();
     motors[0]->move(StepperMotor::FWD, 128*400*0.3);
     motors[0]->wait_while_active();
-    
-    wait(10);
+    Stepper_3_Leerlauf();
+   // wait(10);
     Set_Servo_Good_Fil();
     Stepper_1_SetHome();
-    Stepper_1_Run('V', 150);
+    Stepper_1_Run('V', 300);
    
     
     DisplaySendeBefehl(0x01);
     gotoxy(1,1);
-    DisplaySendeString("Filament ist gut    ");
+    DisplaySendeString("Filament ist gut.   ");
     gotoxy(1,3);
-    DisplaySendeString("wird gefoerdert...  ");
+    DisplaySendeString("Wird gefoerdert...  ");
     gotoxy(1,4);
     DisplaySendeString("             Abbruch"); 
     
@@ -173,21 +202,506 @@
 }
 
 void EntryDuoFilaBad1()
-{
+{   
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Schlechtes Filament ");
+    gotoxy(1,3);
+    DisplaySendeString("erkannt.            ");
+    gotoxy(1,2);
+    DisplaySendeString("Wird aussortiert... ");
+    gotoxy(1,4);
+    DisplaySendeString("             Abbruch"); 
+    
     Stepper_1_SetPara(TRAVELSPEED+100, TRAVELACC+300);
     Stepper_1_GoHome();
-   // Set_Servo_Bad_Fil();
-   //Stepper_1_Run('V', 150);
+    Set_Servo_Bad_Fil();
+    Stepper_1_Run('V', 300);
+   
+    StatusDUO=DUO_FILA_BAD1;
+}
+
+void EntryDuoFilaGood2()
+{
+    Stepper_1_Stop();
+    Stepper_1_MarkPos();
+    Stepper_1_SetPara(300, 300);
+    motors[0]->move(StepperMotor::FWD, 128*400*10);
+    
+    StatusDUO=DUO_FILA_GOOD2;
+}
+
+void EntryDuoFilaGood3()
+{
+    Stepper_1_Leerlauf();
+    Stepper_2_SetPara(300, 300);
+    Stepper_2_Run('V', 300);
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament ist gut.   ");
+    gotoxy(1,3);
+    DisplaySendeString("Wird gefoerdert...  ");
+    gotoxy(1,4);
+    DisplaySendeString("             Abbruch");
+    
+    StatusDUO=DUO_FILA_GOOD3;
+}
+
+void EntryDuoFilaCut2()
+{
+    Stepper_2_Stop();
+    Stepper_1_Stop();
+    
+    /*********************************
+    
+            CUT PROZESS 
+    
+    **********************************/
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Schlechtes Filament ");
+    gotoxy(1,3);
+    DisplaySendeString("erkannt.            ");
+    gotoxy(1,2);
+    DisplaySendeString("Wird geschnitten!   ");
+    
+    Stepper_2_SetPara(100, 100);
+    Stepper_1_SetPara(100, 100);
+ 
+    Set_Cutter(500, 0, 1);
+    motors[1]->move(StepperMotor::FWD, 128*400*4);
+    motors[0]->move(StepperMotor::BWD, 128*400*0.3);
+    Set_Cutter(600, 0, 1);
+    
+    motors[1]->wait_while_active();
+    motors[0]->move(StepperMotor::FWD, 128*400*0.3);
+    motors[0]->wait_while_active();
+    
+   // wait(10);
+    Set_Servo_Good_Fil();
+    Stepper_1_SetHome();
+    Stepper_2_SetPara(400, 300);
+   // motors[1]->move(StepperMotor::FWD, 128*400*);
+   // motors[1]->wait_while_active();
+    Stepper_2_Run('V', 150);
    
-   StatusDUO=DUO_FILA_BAD1;
+    
+    StatusDUO=DUO_FILA_CUT2;    
+}
+
+void EntryDuoFilaAusschuss()
+{
+    Stepper_2_Stop();
+    Set_Servo_Bad_Fil();
+    Stepper_3_Leerlauf();
+    Stepper_1_Run('V', 300);
+              
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Schlechtes Filament ");
+    gotoxy(1,3);
+    DisplaySendeString("                    ");
+    gotoxy(1,2);
+    DisplaySendeString("Wird aussortiert... ");
+    gotoxy(1,4);
+    DisplaySendeString("             Abbruch");  
+    
+    StatusDUO=DUO_FILA_AUSSCHUSS;    
+}
+void EntryFilaCut31()
+{
+    /*********************************
+    
+            CUT PROZESS 
+    
+    **********************************/
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament wird  ge-");
+    gotoxy(1,3);
+    DisplaySendeString("schnitten");
+    
+    Stepper_1_Stop();
+    Stepper_3_Leerlauf();
+
+    Stepper_3_SetPara(100, 100);
+    Stepper_1_SetPara(100, 100);
+ 
+    Set_Cutter(500, 0, 1);
+    motors2[0]->move(StepperMotor::FWD, 128*400*4);
+    motors[0]->move(StepperMotor::BWD, 128*400*0.3);
+    Set_Cutter(600, 0, 1);
+    
+    motors2[0]->wait_while_active();
+    motors[0]->move(StepperMotor::FWD, 128*400*0.3);
+    motors[0]->wait_while_active();
+    Stepper_3_Leerlauf();
+   // wait(10);
+    Set_Servo_Good_Fil();
+    Stepper_1_SetHome();
+    Stepper_1_Run('V', 300);
+   
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament ist gut.   ");
+    gotoxy(1,3);
+    DisplaySendeString("Wird gefoerdert...  ");
+    gotoxy(1,4);
+    DisplaySendeString("             Abbruch"); 
+    
+    StatusDUO=DUO_FILA_CUT3_1;
+}
+
+void EntryDuoFilaCut32()
+{
+    Stepper_1_SetHome();
+    
+    StatusDUO=DUO_FILA_CUT3_2;
+}
+
+void EntryDuoSpleissenVorbeGood()
+{
+    Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC);
+    Stepper_1_Run('V', 40);
+    
+    StatusDUO = DUO_SPLEISSEN_VORBE_GOOD;
+}
+
+void EntryDuoSpleissenGood()
+{
+    Stepper_1_Stop();
+    
+    DisplaySendeBefehl(0x01);
+    DisplaySendeBefehl(0x0C);
+    gotoxy(1, 1);
+    DisplaySendeString("ACHTUNG:");
+    gotoxy(1, 2);
+    DisplaySendeString("SPLEISSENUNG!!!");
+   
+    Stepper_2_MarkPos();
+    
+   // Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC);
+   // Stepper_1_Move('V', 0.11*400);
+    
+    Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC);
+    Stepper_2_SetPara(PRECISIONSPEED, PRECISIONACC);
+    
+    motors[0]->move(StepperMotor::BWD, 128*400*0.25);
+    motors[1]->move(StepperMotor::BWD, 128*400*0.26);
+
+    Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS);
+    
+    motors[0]->wait_while_active();
+    motors[1]->wait_while_active();
+    
+    motors[0]->move(StepperMotor::FWD, 128*400*0.13);
+    motors[1]->move(StepperMotor::FWD, 128*400*0.14);
+    
+    Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS+2);
+    
+    motors[0]->wait_while_active();
+    motors[1]->wait_while_active();
+    
+    
+    Stepper_1_SetPara(FILSPEED, FILACC);
+    Stepper_2_SetPara(FILSPEED, FILACC);
+
+    motors[0]->move(StepperMotor::BWD, 0.55*400*128);
+    Thread::wait(10);
+    Stepper_2_Move('R', 0.65*400);
+    
+    DisplaySendeBefehl(0x01);
+    DisplaySendeBefehl(0x0C);
+    gotoxy(1, 1);
+    DisplaySendeString("Filament wird");
+    gotoxy(1, 2);
+    DisplaySendeString("abgekuehlt");
+
+    Thread::wait(COOLINGTIME*1000);
+    
+    Stepper_1_SetPara(TRAVELSPEED+200, SLOWACC);
+    Stepper_2_SetPara(TRAVELSPEED+200, SLOWACC);
+    
+    motors[0]->move(StepperMotor::FWD, 128*400*0.8);
+    motors[1]->move(StepperMotor::FWD, 128*400*0.8);
+    motors[0]->wait_while_active();
+    motors[1]->wait_while_active();
+    
+    Stepper_1_Leerlauf(); 
+    
+    Stepper_2_GoMark();
+    
+    StatusDUO = DUO_SPLEISSEN_GOOD;
+}
+
+void EntryDuoSpleissenVorbeBad()
+{
+    Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC);
+    Stepper_1_Run('V', 40);
+    
+    StatusDUO = DUO_SPLEISSEN_VORBE_BAD;
 }
 
+void EntryDuoSpleissenBad()
+{
+    Stepper_1_Stop();
+    
+    DisplaySendeBefehl(0x01);
+    DisplaySendeBefehl(0x0C);
+    gotoxy(1, 1);
+    DisplaySendeString("ACHTUNG:");
+    gotoxy(1, 2);
+    DisplaySendeString("SPLEISSENUNG!!!");
+    
+    Stepper_2_MarkPos();
+    
+   // Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC);
+   // Stepper_1_Move('V', 0.11*400);
+    
+    Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC);
+    Stepper_2_SetPara(PRECISIONSPEED, PRECISIONACC);
+    
+    motors[0]->move(StepperMotor::BWD, 128*400*0.25);
+    motors[1]->move(StepperMotor::BWD, 128*400*0.26);
+
+    Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS);
+    
+    motors[0]->wait_while_active();
+    motors[1]->wait_while_active();
+    
+    motors[0]->move(StepperMotor::FWD, 128*400*0.13);
+    motors[1]->move(StepperMotor::FWD, 128*400*0.14);
+    
+    Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS+2);
+    
+    motors[0]->wait_while_active();
+    motors[1]->wait_while_active();
+    
+    
+    Stepper_1_SetPara(FILSPEED, FILACC);
+    Stepper_2_SetPara(FILSPEED, FILACC);
+
+    motors[0]->move(StepperMotor::BWD, 0.55*400*128);
+    Thread::wait(10);
+    Stepper_2_Move('R', 0.65*400);
+    
+    DisplaySendeBefehl(0x01);
+    DisplaySendeBefehl(0x0C);
+    gotoxy(1, 1);
+    DisplaySendeString("Filament wird");
+    gotoxy(1, 2);
+    DisplaySendeString("abgekuehlt");
+
+    Thread::wait(COOLINGTIME*1000);
+    
+    Stepper_1_SetPara(TRAVELSPEED+200, SLOWACC);
+    Stepper_2_SetPara(TRAVELSPEED+200, SLOWACC);
+    
+    motors[0]->move(StepperMotor::FWD, 128*400*0.8);
+    motors[1]->move(StepperMotor::FWD, 128*400*0.8);
+    motors[0]->wait_while_active();
+    motors[1]->wait_while_active();
+    
+    Stepper_1_Leerlauf(); 
+    
+    Stepper_2_GoMark();
+       
+    StatusDUO = DUO_SPLEISSEN_BAD;
+}
+
+void EntryDuoSpleissenVorbeBad2()
+{
+    Stepper_1_SetHome();
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Schlechtes Filament ");
+    gotoxy(1,3);
+    DisplaySendeString("erkannt.            ");
+    gotoxy(1,2);
+    DisplaySendeString("Zu erst Spleissen.  ");
+    gotoxy(1,4);
+    DisplaySendeString("             Abbruch");
+    
+    StatusDUO = DUO_SPLEISSEN_VORBE_BAD;
+}
+
+void EntryDuoBad2()
+{
+    Stepper_1_SetPara(100, 100);
+    Stepper_2_Leerlauf();
+    Stepper_1_GoHome();
+    Stepper_1_Stop();
+    Stepper_2_Stop();
+    
+    /*********************************
+    
+            CUT PROZESS 
+    
+    **********************************/
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament wird  ge-");
+    gotoxy(1,3);
+    DisplaySendeString("schnitten");
+    
+    Stepper_2_SetPara(100, 100);
+    Stepper_1_SetPara(100, 100);
+ 
+    Set_Cutter(500, 0, 1);
+    motors[1]->move(StepperMotor::FWD, 128*400*4);
+    motors[0]->move(StepperMotor::BWD, 128*400*0.3);
+    Set_Cutter(600, 0, 1);
+    
+    motors[1]->wait_while_active();
+    motors[0]->move(StepperMotor::FWD, 128*400*0.3);
+    motors[0]->wait_while_active();
+    
+   // wait(10);
+    Set_Servo_Good_Fil();
+    Stepper_1_SetHome();
+    Stepper_2_SetPara(400, 300);
+    motors[1]->move(StepperMotor::FWD, 128*400*4);
+    motors[1]->wait_while_active();
+    Stepper_2_Run('V', 150);    
+    
+    StatusDUO = DUO_FILA_BAD2;
+}
+
+void EntryDuoFilaCut22()
+{
+    StatusDUO = DUO_FILA_CUT2;
+}
+
+void EntryDuoFertigBad()
+{
+    Stepper_1_Stop();
+    
+    Stepper_1_SetPara(40, 100);
+    Stepper_2_SetPara(300, 300);
+    motors[0]->move(StepperMotor::FWD, 128*400*0.1);
+    motors[0]->wait_while_active();
+    motors[1]->move(StepperMotor::FWD, 128*400*2);
+    motors[1]->wait_while_active();
+    
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament ist fertig.");
+    gotoxy(1,2);
+    DisplaySendeString("Bitte Messmodul ent-");
+    gotoxy(1,4);
+    DisplaySendeString("fernen fuer Auswurf ");
+    
+    while(InputKontrollmodul == 1){}
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("ACHTUNG!");
+    gotoxy(1,3);
+    DisplaySendeString("Nur Auswurf druecken");
+    gotoxy(1,2);
+    DisplaySendeString("ohne Messmodul!     ");
+    gotoxy(1,4);
+    DisplaySendeString("             Auswurf");
+    
+    while(ButtonABBRUCH==false)
+    {
+        ButtonABBRUCH = get_Button_2();
+    }
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament wegziehen, ");
+    gotoxy(1,3);
+    DisplaySendeString("wenn Schrittmotoren ");
+    gotoxy(1,2);
+    DisplaySendeString("nicht mehr greiffen.");
+    
+    Stepper_1_SetPara(300, 300);
+    Stepper_2_SetPara(300, 300);
+    motors[1]->move(StepperMotor::FWD, 128*400*2);
+    motors[1]->wait_while_active();
+    
+    Stepper_1_Run('R', 300); 
+    
+    while(LS_1 == 0){}
+    
+    Stepper_2_Leerlauf();
+    
+    StatusDUO = DUO_FERTIG_BAD;
+    
+}
+
+void EntryDuoFertigGood()
+{
+    Stepper_1_Stop();
+    Stepper_1_SetPara(300, 300);
+    Stepper_2_SetPara(300, 300);
+    Stepper_2_Leerlauf();
+    Stepper_2_Run('V', 300);
+    Stepper_1_Run('V', 300);
+    while(LS_1 == 0)
+    {
+         
+    }
+    Stepper_2_Leerlauf();
+    Stepper_1_Stop();
+    Stepper_1_SetPara(40, 100);
+    
+    motors[0]->move(StepperMotor::FWD, 128*400*0.1);
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament ist fertig.");
+    gotoxy(1,2);
+    DisplaySendeString("Bitte Messmodul ent-");
+    gotoxy(1,4);
+    DisplaySendeString("fernen fuer Auswurf ");
+
+    while(InputKontrollmodul == 1){}
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("ACHTUNG!");
+    gotoxy(1,3);
+    DisplaySendeString("Nur Auswurf druecken");
+    gotoxy(1,2);
+    DisplaySendeString("ohne Messmodul!     ");
+    gotoxy(1,4);
+    DisplaySendeString("             Auswurf");
+    
+    while(ButtonABBRUCH==false)
+    {
+        ButtonABBRUCH = get_Button_2();
+    }
+    
+    DisplaySendeBefehl(0x01);
+    gotoxy(1,1);
+    DisplaySendeString("Filament wegziehen, ");
+    gotoxy(1,3);
+    DisplaySendeString("wenn Schrittmotoren ");
+    gotoxy(1,2);
+    DisplaySendeString("nicht mehr greiffen.");
+    
+    Stepper_1_SetPara(300, 300);
+    
+    Stepper_1_Run('R', 300); 
+    
+    while(LS_1 == 0){}
+    
+    
+    StatusDUO = DUO_FERTIG_GOOD;    
+}
 
 void EntryDUO()
 {
     ButtonSTART = get_Button_1();
     ButtonABBRUCH = get_Button_2();
     Fila_Good = get_InputKontrollmodul();
+    Fertig = get_FertigSignal();
     
     switch(StatusDUO)
     {     
@@ -212,7 +726,7 @@
        break;
        
        case DUO_EINLEGEN:
-       if(Fila_Good == false)        //für Test->==false wenn gedrückt(heisst Filament ist gut)
+       if(Fila_Good == true)        //für Test->==false wenn gedrückt(heisst Filament ist gut)
         {
             EntryDuoFilaCut1();     
         }
@@ -226,14 +740,14 @@
        break;
        
        case DUO_FILA_CUT1:
-       if(Fila_Good == true)        //für Test->==true wenn gedrückt(heisst Filament ist schlecht) 
+       if(Fila_Good == false)        //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht) 
         {
             EntryDuoFilaBad1();
         }
        else if(LS_3 == 0)
         {
-            EntryDuoDefault();// nur für test
-            //EntryFilaGood2();  
+           // EntryDuoDefault();// nur für test
+            EntryDuoFilaGood2();  
         }
        else if(ButtonABBRUCH == true)
         {
@@ -243,9 +757,9 @@
        break;
        
        case DUO_FILA_BAD1:
-       if(Fila_Good == false)       //für Test->==false wenn gedrückt(heisst Filament ist gut)
+       if(Fila_Good == true)       //für Test->==false wenn gedrückt(heisst Filament ist gut)
         {
-               
+            EntryDuoFilaCut1();
         }
        else if(ButtonABBRUCH == true)
         {
@@ -256,39 +770,159 @@
        break;
        
        case DUO_FILA_GOOD2:
+        Stepper1CurrentPos = Stepper_1_GetPosition();
+        Stepper1MarkPos = Stepper_1_GetMark();
+        if(Stepper1CurrentPos > ((Stepper1MarkPos+(128*400*LAENGE_LS3_To_STEPPER2))-100))
+        {
+            EntryDuoFilaGood3();
+        }
+        else if(Fila_Good == false)  //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht)
+        {
+            EntryDuoFilaBad1();
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        } 
        break;
        
        case DUO_FILA_GOOD3:
-       break;
+       if(Fila_Good == false)  //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht)
+        {
+            EntryDuoFilaCut2();
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
+       break; 
        
        case DUO_FILA_CUT2:
+       if((LS_3 == 1) && (LS_2 == 1))
+        {
+               EntryDuoFilaAusschuss();
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
        break;
        
        case DUO_FILA_AUSSCHUSS:
+       if(LS_1 == 1)
+        {
+            EntryDuoFertigBad();
+        }
+       
+        else if(Fila_Good == true)        //für Test->==false wenn gedrückt(heisst Filament ist gut)
+        {
+            EntryFilaCut31();     
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
        break;
        
        case DUO_FILA_CUT3_1:
+       if((Fila_Good == false)&&(Fertig == true)) //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht)
+        {
+            EntryDuoFertigGood();
+        }
+        else if(Fila_Good == false)  //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht)
+        {
+            EntryDuoFilaCut32();
+        }
+        else if(LS_2 == 0)
+        {
+            EntryDuoSpleissenVorbeGood();
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
+        
        break;
        
        case DUO_FILA_CUT3_2:
+       if(Fertig == true)
+        {
+            EntryDuoFertigGood();
+        }
+        else if(LS_2 == 0)
+        {
+            EntryDuoSpleissenVorbeBad();
+        }
+       else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
        break;
        
        case DUO_SPLEISSEN_VORBE_BAD:
+       if(Fertig == true)
+        {
+            EntryDuoFertigGood();
+        }
+         if(LS_3 == 0)
+        {
+            EntryDuoSpleissenBad();
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
        break;
        
        case DUO_SPLEISSEN_BAD:
+       
+        EntryDuoBad2();
        break;
        
        case DUO_SPLEISSEN_VORBE_GOOD:
+       if(Fertig == true)
+        {
+            EntryDuoFertigGood();
+        }
+         if(Fila_Good == false)  //für Test->==true wenn gedrückt(heisst Filament ist schlecht)
+        {
+            EntryDuoSpleissenVorbeBad2();
+        }
+        else if(LS_3 == 0)
+        {
+            EntryDuoSpleissenGood();
+        }
+        else if(ButtonABBRUCH == true)
+        {
+            ButtonABBRUCH=false;
+            EntryDuoDefault();
+        }
        break;
        
+       
        case DUO_SPLEISSEN_GOOD:
+       
+        EntryDuoFilaGood3();
        break;
        
        case DUO_FILA_BAD2:
+        
+        EntryDuoFilaCut22();
        break;
        
        case DUO_FERTIG_BAD:
+        EntryDuoDefault();
+       break;
+       
+       case DUO_FERTIG_GOOD:
+        EntryDuoDefault();
        break;
              
     }   
--- a/ST_DUO.h	Wed May 15 00:47:19 2019 +0000
+++ b/ST_DUO.h	Thu May 16 20:10:32 2019 +0000
@@ -19,7 +19,8 @@
     DUO_SPLEISSEN_VORBE_GOOD,
     DUO_SPLEISSEN_GOOD,
     DUO_FILA_BAD2,
-    DUO_FERTIG_BAD
+    DUO_FERTIG_BAD,
+    DUO_FERTIG_GOOD
 };
 
 void EntryDUO();
--- a/ST_SOLO.h	Wed May 15 00:47:19 2019 +0000
+++ b/ST_SOLO.h	Thu May 16 20:10:32 2019 +0000
@@ -15,5 +15,6 @@
 };
 
 void EntrySOLO();
+void Fkt_SOLO_Spleissen();
 
 #endif
--- a/main.cpp	Wed May 15 00:47:19 2019 +0000
+++ b/main.cpp	Thu May 16 20:10:32 2019 +0000
@@ -52,6 +52,9 @@
 int val_InputKontrollmodul = 0;
 
 DigitalIn CutSignal(CUT_SIGNAL);
+DigitalIn FertigSignal(FERTIG_SIGNAL);
+
+
 /* Motor Control Expansion Board. */
 XNucleoIHM02A1 *x_nucleo_ihm02a1_1;
 XNucleoIHM02A12 *x_nucleo_ihm02a1_2;