Update
Dependencies: mbed mbed-rtos X_NUCLEO_IHM02A1
Diff: ST_DUO.cpp
- Revision:
- 38:3776ee18e56f
- Parent:
- 35:758191d5c6e1
- Child:
- 40:117b324843ee
--- a/ST_DUO.cpp Fri May 10 17:31:36 2019 +0000 +++ b/ST_DUO.cpp Mon May 13 10:11:48 2019 +0000 @@ -2,58 +2,176 @@ int StatusDUO=DUO_DEFAULT; + +bool ButtonSTART = false; +bool ButtonABBRUCH = false; + + +/* extern volatile bool buttonSTART_pressed; extern volatile bool buttonSTART_enabled; + +extern volatile bool buttonAbbruch_pressed; +extern volatile bool buttonAbbruch_enabled; +*/ + + + extern PwmOut Servo; +extern L6470 **motors; +extern L6470B **motors2; + +extern DigitalIn LS_1; +extern DigitalIn LS_2; +extern DigitalIn LS_3; + +extern PwmOut Cutter_1; +extern PwmOut Cutter_2; +extern PwmOut Spleisser_1; +extern PwmOut Spleisser_2; + +void EntryDuoDefault() +{ + StatusDUO=DUO_DEFAULT; +} + void EntryDuoStart() { + Stepper_1_Leerlauf(); + Stepper_2_Leerlauf(); + Stepper_3_Leerlauf(); + + DisplaySendeBefehl(0x0C); + DisplaySendeBefehl(0x01); + gotoxy(1,1); + DisplaySendeString("Modus: DUO-Betrieb"); + gotoxy(1,4); + DisplaySendeString("Start PLA"); + + StatusDUO=DUO_START; + +} + +void EntryDuoFilamentIN() +{ + DisplaySendeBefehl(0x01); gotoxy(1,1); - DisplaySendeString("Modus: DUO-Betrieb"); + DisplaySendeString("Betrieb gestartet "); gotoxy(1,3); - DisplaySendeString("Betrieb gestartet"); + DisplaySendeString("Filament einlegen "); + gotoxy(1,4); + DisplaySendeString(" Abbruch"); + + // Set_Cutter(200, 200, 2); - //SpleisserMotorFWD(); + motors[0]->run(StepperMotor::FWD, 100); + StatusDUO=DUO_FilamentIN; +} + +void EntryDuoSchneiden1() +{ + Stepper_1_SetHome(); + + DisplaySendeBefehl(0x01); + gotoxy(1,1); + DisplaySendeString("Filament an Eingang"); + gotoxy(1,3); + DisplaySendeString("Wird gefoerdert..."); + gotoxy(1,4); + DisplaySendeString("Spleissen Abbruch"); - //Test pwm - //ServoAusschuss(0.001, 0.5); + StatusDUO=DUO_Schneiden1; + +} +void EntryDuoSchneiden2() +{ + Stepper_1_SetHome(); - StatusDUO=DUO_START; + DisplaySendeBefehl(0x01); + gotoxy(1,1); + DisplaySendeString("Spleissen"); + gotoxy(1,3); + DisplaySendeString(""); + gotoxy(1,4); + DisplaySendeString(" Abbruch"); + + + + Set_Spleisser(200, 200, 2); + Stepper_2_Move('V', 400); + printf("Spleissen\r\n"); + + + StatusDUO=DUO_Schneiden2; + } void EntryDUO() { + ButtonSTART = get_Button_1(); + ButtonABBRUCH = get_Button_2(); + switch(StatusDUO) { case DUO_DEFAULT: - printf("DUO_MODUS\r\n"); - // SpleisserMotorFWD(); - + //buttonAbbruch_diable_cb(); + //buttonSTART_enabled_cb(); + EntryDuoStart(); + break; - if(buttonSTART_pressed==true) - { - /* - buttonSTART_pressed=false; - buttonSTART_diable_cb(); - EntryDuoStart(); - */ + case DUO_START: + if(ButtonSTART==true) + { + + ButtonSTART=false; + // buttonSTART_diable_cb(); + //buttonAbbruch_enabled_cb(); + EntryDuoFilamentIN(); } break; - case DUO_START: - printf("DUO_START\r\n"); + case DUO_FilamentIN: + if(LS_1 == 0) + { + EntryDuoSchneiden1(); + } + + if(ButtonABBRUCH == true) + { + ButtonABBRUCH = false; + //buttonAbbruch_pressed=false; + //buttonAbbruch_diable_cb(); + EntryDuoDefault(); + } + + break; + + case DUO_Schneiden1: + if(ButtonABBRUCH == true) + { + ButtonABBRUCH = false; + //buttonAbbruch_pressed=false; + //buttonAbbruch_diable_cb(); + EntryDuoDefault(); + } + if(ButtonSTART == true) + { + ButtonSTART = false; + EntryDuoSchneiden2(); + + } break; - case DUO_FilamentIN: - break; - - case DUO_Schneiden1: - break; - case DUO_Schneiden2: + if(ButtonABBRUCH == true) + { + ButtonABBRUCH = false; + EntryDuoDefault(); + } break; case DUO_Spleissen: @@ -73,4 +191,3 @@ } } -