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.
Dependencies: mbed mbed-rtos X_NUCLEO_IHM02A1
ST_DUO.cpp
00001 #include "SETUP.h" 00002 00003 00004 int StatusDUO=DUO_DEFAULT; 00005 00006 00007 extern DigitalIn InputKontrollmodul; 00008 extern DigitalIn CutSignal; 00009 extern DigitalIn FertigSignal; 00010 int val_CutSignal = 0; 00011 int val_FertigSignal = 0; 00012 00013 int Stepper1CurrentPos = 0; 00014 int Stepper1MarkPos = 0; 00015 00016 bool Fertig = false; 00017 00018 bool Fila_Good = false; 00019 00020 bool ABS = false; 00021 00022 bool PLA = true; 00023 00024 bool ButtonSTART = false; 00025 bool ButtonABBRUCH = false; 00026 00027 extern PwmOut Servo; 00028 00029 extern L6470 **motors; 00030 extern L6470B **motors2; 00031 00032 extern DigitalIn LS_1; 00033 extern DigitalIn LS_2; 00034 extern DigitalIn LS_3; 00035 00036 extern PwmOut Cutter_1; 00037 extern PwmOut Cutter_2; 00038 extern PwmOut Spleisser_1; 00039 extern PwmOut Spleisser_2; 00040 00041 00042 bool get_InputKontrollmodul() 00043 { 00044 val_CutSignal = CutSignal.read(); 00045 if( val_CutSignal == 1) 00046 { 00047 wait(0.01); 00048 if(val_CutSignal == 1) 00049 { 00050 return true; 00051 } 00052 } 00053 else if(val_CutSignal == 0) 00054 { 00055 wait(0.01); 00056 if(val_CutSignal == 0) 00057 { 00058 return false; 00059 } 00060 } 00061 else return false; 00062 } 00063 00064 bool get_FertigSignal() 00065 { 00066 val_FertigSignal = FertigSignal.read(); 00067 if( val_FertigSignal == 1) 00068 { 00069 wait(0.01); 00070 if(val_FertigSignal == 1) 00071 { 00072 return true; 00073 } 00074 } 00075 else if(val_FertigSignal == 0) 00076 { 00077 wait(0.01); 00078 if(val_FertigSignal == 0) 00079 { 00080 return false; 00081 } 00082 } 00083 else return false; 00084 } 00085 00086 void EntryDuoDefault() 00087 { 00088 StatusDUO=DUO_DEFAULT; 00089 } 00090 00091 void EntryDuoStart() 00092 { 00093 Stepper_1_Leerlauf(); 00094 Stepper_2_Leerlauf(); 00095 Stepper_3_Leerlauf(); 00096 if(LS_1 == 1) 00097 { 00098 Set_Servo_Bad_Fil(); 00099 } 00100 00101 DisplaySendeBefehl(0x0C); 00102 DisplaySendeBefehl(0x01); 00103 gotoxy(1,1); 00104 DisplaySendeString("Modus: DUO-Betrieb"); 00105 gotoxy(1,4); 00106 DisplaySendeString("Start PLA"); 00107 00108 PLA = true; 00109 ABS = false; 00110 00111 StatusDUO=DUO_START; 00112 00113 } 00114 00115 void EntryDuoEinlegen() 00116 { 00117 DisplaySendeBefehl(0x01); 00118 gotoxy(1,1); 00119 DisplaySendeString("Filament einlegen..."); 00120 gotoxy(1,4); 00121 DisplaySendeString(" Abbruch"); 00122 00123 Set_Servo_Bad_Fil(); 00124 00125 Stepper_3_SetPara(100, 100); 00126 Stepper_1_SetPara(100, 100); 00127 Stepper_1_Run('V', 300); 00128 Stepper_3_Run('V', 300); 00129 00130 StatusDUO=DUO_EINLEGEN; 00131 } 00132 00133 void DuoWechselFilament() 00134 { 00135 int static x = 0; 00136 00137 if((PLA == true)&& (x == 0)) 00138 { 00139 gotoxy(1,4); 00140 DisplaySendeString("Start ABS"); 00141 00142 PLA = false; 00143 ABS = true; 00144 x = 1; 00145 } 00146 00147 if( (ABS == true)&& (x == 0)) 00148 { 00149 gotoxy(1,4); 00150 DisplaySendeString("Start PLA"); 00151 00152 PLA = true; 00153 ABS = false; 00154 } 00155 00156 if(x == 1) 00157 { 00158 x = 0; 00159 } 00160 wait(0.3); 00161 StatusDUO=DUO_START; 00162 } 00163 00164 void EntryDuoFilaCut1() 00165 { 00166 /********************************* 00167 00168 CUT PROZESS 00169 00170 **********************************/ 00171 DisplaySendeBefehl(0x01); 00172 gotoxy(1,1); 00173 DisplaySendeString("Filament wird ge-"); 00174 gotoxy(1,3); 00175 DisplaySendeString("schnitten"); 00176 00177 Stepper_1_Stop(); 00178 Stepper_3_Stop(); 00179 Stepper_3_Leerlauf(); 00180 00181 Stepper_3_SetPara(100, 100); 00182 Stepper_1_SetPara(100, 100); 00183 00184 Set_Cutter(550, 0, 1); 00185 motors2[0]->move(StepperMotor::FWD, 128*400*4); 00186 motors[0]->move(StepperMotor::BWD, 128*400*0.3); 00187 Set_Cutter(650, 0, 1); 00188 00189 DisplaySendeBefehl(0x01); 00190 gotoxy(1,1); 00191 DisplaySendeString("Filament wird ge-"); 00192 gotoxy(1,3); 00193 DisplaySendeString("schnitten"); 00194 00195 motors2[0]->wait_while_active(); 00196 motors[0]->move(StepperMotor::FWD, 128*400*0.3); 00197 motors[0]->wait_while_active(); 00198 Stepper_3_Leerlauf(); 00199 // wait(10); 00200 Set_Servo_Good_Fil(); 00201 Stepper_1_SetHome(); 00202 Stepper_1_Run('V', 300); 00203 //Stepper_3_Run('V', 300); 00204 00205 00206 DisplaySendeBefehl(0x01); 00207 gotoxy(1,1); 00208 DisplaySendeString("Filament ist gut. "); 00209 gotoxy(1,3); 00210 DisplaySendeString("Wird gefoerdert... "); 00211 gotoxy(1,4); 00212 DisplaySendeString(" Abbruch"); 00213 00214 StatusDUO=DUO_FILA_CUT1; 00215 } 00216 00217 void EntryDuoFilaBad1() 00218 { 00219 DisplaySendeBefehl(0x01); 00220 gotoxy(1,1); 00221 DisplaySendeString("Schlechtes Filament "); 00222 gotoxy(1,3); 00223 DisplaySendeString("erkannt. "); 00224 gotoxy(1,2); 00225 DisplaySendeString("Wird aussortiert... "); 00226 gotoxy(1,4); 00227 DisplaySendeString(" Abbruch"); 00228 00229 Stepper_1_SetPara(TRAVELSPEED+100, TRAVELACC+300); 00230 Stepper_3_SetPara(TRAVELSPEED+100, TRAVELACC+300); 00231 Stepper_1_GoHome(); 00232 Set_Servo_Bad_Fil(); 00233 Stepper_1_Run('V', 300); 00234 Stepper_3_Run('V', 300); 00235 00236 StatusDUO=DUO_FILA_BAD1; 00237 } 00238 00239 void EntryDuoFilaGood2() 00240 { 00241 Stepper_1_Stop(); 00242 Stepper_1_MarkPos(); 00243 Stepper_1_SetPara(300, 300); 00244 motors[0]->move(StepperMotor::FWD, 128*400*10); 00245 00246 StatusDUO=DUO_FILA_GOOD2; 00247 } 00248 00249 void EntryDuoFilaGood3() 00250 { 00251 Stepper_1_Leerlauf(); 00252 Stepper_2_SetPara(300, 300); 00253 Stepper_1_SetPara(300, 300); 00254 Stepper_2_Run('V', 300); 00255 Stepper_1_Run('V', 300); 00256 00257 DisplaySendeBefehl(0x01); 00258 gotoxy(1,1); 00259 DisplaySendeString("Filament ist gut. "); 00260 gotoxy(1,3); 00261 DisplaySendeString("Wird gefoerdert... "); 00262 gotoxy(1,4); 00263 DisplaySendeString(" Abbruch"); 00264 00265 StatusDUO=DUO_FILA_GOOD3; 00266 } 00267 00268 void EntryDuoFilaCut2() 00269 { 00270 Stepper_2_Stop(); 00271 Stepper_1_Stop(); 00272 00273 /********************************* 00274 00275 CUT PROZESS 00276 00277 **********************************/ 00278 DisplaySendeBefehl(0x01); 00279 gotoxy(1,1); 00280 DisplaySendeString("Schlechtes Filament "); 00281 gotoxy(1,3); 00282 DisplaySendeString("erkannt. "); 00283 gotoxy(1,2); 00284 DisplaySendeString("Wird geschnitten! "); 00285 00286 Stepper_2_SetPara(100, 100); 00287 Stepper_1_SetPara(100, 100); 00288 00289 Set_Cutter(550, 0, 1); 00290 motors[1]->move(StepperMotor::FWD, 128*400*4); 00291 motors[0]->move(StepperMotor::BWD, 128*400*0.3); 00292 Set_Cutter(650, 0, 1); 00293 00294 DisplaySendeBefehl(0x01); 00295 gotoxy(1,1); 00296 DisplaySendeString("Schlechtes Filament "); 00297 gotoxy(1,3); 00298 DisplaySendeString("erkannt. "); 00299 gotoxy(1,2); 00300 DisplaySendeString("Wird geschnitten! "); 00301 00302 motors[1]->wait_while_active(); 00303 motors[0]->move(StepperMotor::FWD, 128*400*0.3); 00304 motors[0]->wait_while_active(); 00305 00306 // wait(10); 00307 Set_Servo_Good_Fil(); 00308 Stepper_1_SetHome(); 00309 Stepper_2_SetPara(400, 300); 00310 // motors[1]->move(StepperMotor::FWD, 128*400*); 00311 // motors[1]->wait_while_active(); 00312 Stepper_2_Run('V', 150); 00313 00314 00315 StatusDUO=DUO_FILA_CUT2; 00316 } 00317 00318 void EntryDuoFilaAusschuss() 00319 { 00320 Stepper_2_Stop(); 00321 Set_Servo_Bad_Fil(); 00322 Stepper_1_SetPara(TRAVELSPEED+100, TRAVELACC+300); 00323 Stepper_3_SetPara(TRAVELSPEED+100, TRAVELACC+300); 00324 Stepper_3_Run('V', 300); 00325 Stepper_1_Run('V', 300); 00326 00327 DisplaySendeBefehl(0x01); 00328 gotoxy(1,1); 00329 DisplaySendeString("Schlechtes Filament "); 00330 gotoxy(1,3); 00331 DisplaySendeString(" "); 00332 gotoxy(1,2); 00333 DisplaySendeString("Wird aussortiert... "); 00334 gotoxy(1,4); 00335 DisplaySendeString(" Abbruch"); 00336 00337 StatusDUO=DUO_FILA_AUSSCHUSS; 00338 } 00339 void EntryFilaCut31() 00340 { 00341 /********************************* 00342 00343 CUT PROZESS 00344 00345 **********************************/ 00346 DisplaySendeBefehl(0x01); 00347 gotoxy(1,1); 00348 DisplaySendeString("Filament wird ge-"); 00349 gotoxy(1,3); 00350 DisplaySendeString("schnitten"); 00351 00352 Stepper_1_Stop(); 00353 Stepper_3_Leerlauf(); 00354 00355 Stepper_3_SetPara(100, 100); 00356 Stepper_1_SetPara(100, 100); 00357 00358 Set_Cutter(550, 0, 1); 00359 motors2[0]->move(StepperMotor::FWD, 128*400*4); 00360 motors[0]->move(StepperMotor::BWD, 128*400*0.3); 00361 Set_Cutter(650, 0, 1); 00362 00363 DisplaySendeBefehl(0x01); 00364 gotoxy(1,1); 00365 DisplaySendeString("Filament wird ge-"); 00366 gotoxy(1,3); 00367 DisplaySendeString("schnitten"); 00368 00369 motors2[0]->wait_while_active(); 00370 motors[0]->move(StepperMotor::FWD, 128*400*0.3); 00371 motors[0]->wait_while_active(); 00372 Stepper_3_Leerlauf(); 00373 // wait(10); 00374 Set_Servo_Good_Fil(); 00375 Stepper_1_SetHome(); 00376 Stepper_1_Run('V', 300); 00377 00378 00379 DisplaySendeBefehl(0x01); 00380 gotoxy(1,1); 00381 DisplaySendeString("Filament ist gut. "); 00382 gotoxy(1,3); 00383 DisplaySendeString("Wird gefoerdert... "); 00384 gotoxy(1,4); 00385 DisplaySendeString(" Abbruch"); 00386 00387 StatusDUO=DUO_FILA_CUT3_1; 00388 } 00389 00390 void EntryDuoFilaCut32() 00391 { 00392 Stepper_1_SetHome(); 00393 00394 DisplaySendeBefehl(0x01); 00395 gotoxy(1,1); 00396 DisplaySendeString("Schlechtes Filament "); 00397 gotoxy(1,3); 00398 DisplaySendeString("erkannt. "); 00399 gotoxy(1,2); 00400 DisplaySendeString("Zu erst Spleissen. "); 00401 gotoxy(1,4); 00402 DisplaySendeString(" Abbruch"); 00403 00404 StatusDUO=DUO_FILA_CUT3_2; 00405 } 00406 00407 void EntryDuoSpleissenVorbeGood() 00408 { 00409 Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC); 00410 Stepper_1_Run('V', 40); 00411 00412 StatusDUO = DUO_SPLEISSEN_VORBE_GOOD; 00413 } 00414 00415 void EntryDuoSpleissenGood() 00416 { 00417 Stepper_1_Stop(); 00418 00419 DisplaySendeBefehl(0x01); 00420 DisplaySendeBefehl(0x0C); 00421 gotoxy(1, 1); 00422 DisplaySendeString("ACHTUNG:"); 00423 gotoxy(1, 2); 00424 DisplaySendeString("SPLEISSUNG!!!"); 00425 00426 00427 // Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC); 00428 // Stepper_1_Move('V', 0.11*400); 00429 00430 Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC); 00431 Stepper_2_SetPara(PRECISIONSPEED, PRECISIONACC); 00432 00433 motors[0]->move(StepperMotor::BWD, 128*400*0.22); 00434 motors[1]->move(StepperMotor::BWD, 128*400*0.23); 00435 00436 Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS); 00437 00438 motors[0]->wait_while_active(); 00439 motors[1]->wait_while_active(); 00440 00441 motors[0]->move(StepperMotor::FWD, 128*400*0.10); 00442 motors[1]->move(StepperMotor::FWD, 128*400*0.11); 00443 00444 Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS+2); 00445 00446 motors[0]->wait_while_active(); 00447 motors[1]->wait_while_active(); 00448 00449 00450 Stepper_1_SetPara(FILSPEED, FILACC); 00451 Stepper_2_SetPara(FILSPEED, FILACC); 00452 00453 motors[0]->move(StepperMotor::BWD, 0.65*400*128); 00454 Thread::wait(10); 00455 Stepper_2_Move('R', 0.85*400); 00456 00457 DisplaySendeBefehl(0x01); 00458 DisplaySendeBefehl(0x0C); 00459 gotoxy(1, 1); 00460 DisplaySendeString("Filament wird"); 00461 gotoxy(1, 2); 00462 DisplaySendeString("abgekuehlt"); 00463 00464 Thread::wait(COOLINGTIME*1000); 00465 00466 Stepper_1_SetPara(TRAVELSPEED+200, SLOWACC); 00467 Stepper_2_SetPara(TRAVELSPEED+200, SLOWACC); 00468 00469 motors[0]->move(StepperMotor::FWD, 128*400*1.5); 00470 motors[1]->move(StepperMotor::FWD, 128*400*1.5); 00471 motors[0]->wait_while_active(); 00472 motors[1]->wait_while_active(); 00473 00474 StatusDUO = DUO_SPLEISSEN_GOOD; 00475 } 00476 00477 void EntryDuoSpleissenVorbeBad() 00478 { 00479 Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC); 00480 Stepper_1_Run('V', 40); 00481 00482 StatusDUO = DUO_SPLEISSEN_VORBE_BAD; 00483 } 00484 00485 void EntryDuoSpleissenBad() 00486 { 00487 Stepper_1_Stop(); 00488 00489 DisplaySendeBefehl(0x01); 00490 DisplaySendeBefehl(0x0C); 00491 gotoxy(1, 1); 00492 DisplaySendeString("ACHTUNG:"); 00493 gotoxy(1, 2); 00494 DisplaySendeString("SPLEISSUNG!!!"); 00495 00496 00497 // Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC); 00498 // Stepper_1_Move('V', 0.11*400); 00499 00500 Stepper_1_SetPara(PRECISIONSPEED, PRECISIONACC); 00501 Stepper_2_SetPara(PRECISIONSPEED, PRECISIONACC); 00502 00503 motors[0]->move(StepperMotor::BWD, 128*400*0.22); 00504 motors[1]->move(StepperMotor::BWD, 128*400*0.23); 00505 00506 Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS); 00507 00508 motors[0]->wait_while_active(); 00509 motors[1]->wait_while_active(); 00510 00511 motors[0]->move(StepperMotor::FWD, 128*400*0.10); 00512 motors[1]->move(StepperMotor::FWD, 128*400*0.11); 00513 00514 Set_Spleisser(ARConTIME, ARCoffTIME, REPETITONS+2); 00515 00516 motors[0]->wait_while_active(); 00517 motors[1]->wait_while_active(); 00518 00519 00520 Stepper_1_SetPara(FILSPEED, FILACC); 00521 Stepper_2_SetPara(FILSPEED, FILACC); 00522 00523 motors[0]->move(StepperMotor::BWD, 0.65*400*128); 00524 Thread::wait(10); 00525 Stepper_2_Move('R', 0.85*400); 00526 00527 DisplaySendeBefehl(0x01); 00528 DisplaySendeBefehl(0x0C); 00529 gotoxy(1, 1); 00530 DisplaySendeString("Filament wird"); 00531 gotoxy(1, 2); 00532 DisplaySendeString("abgekuehlt"); 00533 00534 Thread::wait(COOLINGTIME*1000); 00535 00536 Stepper_1_SetPara(TRAVELSPEED+200, SLOWACC); 00537 Stepper_2_SetPara(TRAVELSPEED+200, SLOWACC); 00538 00539 motors[0]->move(StepperMotor::FWD, 128*400*1.5); 00540 motors[1]->move(StepperMotor::FWD, 128*400*1.5); 00541 motors[0]->wait_while_active(); 00542 motors[1]->wait_while_active(); 00543 00544 StatusDUO = DUO_SPLEISSEN_BAD; 00545 } 00546 00547 void EntryDuoSpleissenVorbeBad2() 00548 { 00549 Stepper_1_SetHome(); 00550 00551 DisplaySendeBefehl(0x01); 00552 gotoxy(1,1); 00553 DisplaySendeString("Schlechtes Filament "); 00554 gotoxy(1,3); 00555 DisplaySendeString("erkannt. "); 00556 gotoxy(1,2); 00557 DisplaySendeString("Zu erst Spleissen. "); 00558 gotoxy(1,4); 00559 DisplaySendeString(" Abbruch"); 00560 00561 StatusDUO = DUO_SPLEISSEN_VORBE_BAD; 00562 } 00563 00564 void EntryDuoBad2() 00565 { 00566 Stepper_1_SetPara(100, 100); 00567 Stepper_2_Leerlauf(); 00568 Stepper_1_GoHome(); 00569 Stepper_1_Stop(); 00570 Stepper_2_Stop(); 00571 00572 /********************************* 00573 00574 CUT PROZESS 00575 00576 **********************************/ 00577 DisplaySendeBefehl(0x01); 00578 gotoxy(1,1); 00579 DisplaySendeString("Filament wird ge-"); 00580 gotoxy(1,3); 00581 DisplaySendeString("schnitten"); 00582 00583 Stepper_2_SetPara(100, 100); 00584 Stepper_1_SetPara(100, 100); 00585 00586 Set_Cutter(550, 0, 1); 00587 motors[1]->move(StepperMotor::FWD, 128*400*4); 00588 motors[0]->move(StepperMotor::BWD, 128*400*0.3); 00589 Set_Cutter(650, 0, 1); 00590 00591 DisplaySendeBefehl(0x01); 00592 gotoxy(1,1); 00593 DisplaySendeString("Filament wird ge-"); 00594 gotoxy(1,3); 00595 DisplaySendeString("schnitten"); 00596 00597 motors[1]->wait_while_active(); 00598 motors[0]->move(StepperMotor::FWD, 128*400*0.3); 00599 motors[0]->wait_while_active(); 00600 00601 // wait(10); 00602 Set_Servo_Good_Fil(); 00603 Stepper_1_SetHome(); 00604 Stepper_2_SetPara(400, 300); 00605 // motors[1]->move(StepperMotor::FWD, 128*400*); 00606 // motors[1]->wait_while_active(); 00607 Stepper_2_Run('V', 150); 00608 00609 StatusDUO = DUO_FILA_BAD2; 00610 } 00611 00612 void EntryDuoFilaCut22() 00613 { 00614 StatusDUO = DUO_FILA_CUT2; 00615 } 00616 00617 void EntryDuoFertigBad() 00618 { 00619 Stepper_1_Stop(); 00620 00621 Stepper_1_SetPara(40, 100); 00622 Stepper_2_SetPara(300, 300); 00623 motors[0]->move(StepperMotor::FWD, 128*400*0.1); 00624 motors[0]->wait_while_active(); 00625 motors[1]->move(StepperMotor::FWD, 128*400*2); 00626 motors[1]->wait_while_active(); 00627 00628 00629 DisplaySendeBefehl(0x01); 00630 gotoxy(1,1); 00631 DisplaySendeString("Filament ist fertig."); 00632 gotoxy(1,2); 00633 DisplaySendeString("Bitte Messmodul ent-"); 00634 gotoxy(1,4); 00635 DisplaySendeString("fernen fuer Auswurf "); 00636 00637 while(InputKontrollmodul == 1){} 00638 00639 DisplaySendeBefehl(0x01); 00640 gotoxy(1,1); 00641 DisplaySendeString("ACHTUNG!"); 00642 gotoxy(1,3); 00643 DisplaySendeString("Nur Auswurf druecken"); 00644 gotoxy(1,2); 00645 DisplaySendeString("ohne Messmodul! "); 00646 gotoxy(1,4); 00647 DisplaySendeString(" Auswurf"); 00648 00649 while(ButtonABBRUCH==false) 00650 { 00651 ButtonABBRUCH = get_Button_2(); 00652 } 00653 00654 DisplaySendeBefehl(0x01); 00655 gotoxy(1,1); 00656 DisplaySendeString("Filament wegziehen, "); 00657 gotoxy(1,3); 00658 DisplaySendeString("wenn Schrittmotoren "); 00659 gotoxy(1,2); 00660 DisplaySendeString("nicht mehr greiffen."); 00661 00662 Stepper_1_SetPara(300, 300); 00663 Stepper_2_SetPara(300, 300); 00664 motors[1]->move(StepperMotor::FWD, 128*400*2); 00665 motors[1]->wait_while_active(); 00666 00667 Stepper_1_Run('R', 300); 00668 00669 while(LS_1 == 0){} 00670 00671 Stepper_2_Leerlauf(); 00672 00673 StatusDUO = DUO_FERTIG_BAD; 00674 00675 } 00676 00677 void EntryDuoFertigGood() 00678 { 00679 Stepper_1_Stop(); 00680 Stepper_1_SetPara(300, 300); 00681 Stepper_2_SetPara(300, 300); 00682 Stepper_2_Leerlauf(); 00683 Stepper_2_Run('V', 300); 00684 Stepper_1_Run('V', 300); 00685 while(LS_1 == 0) 00686 { 00687 00688 } 00689 Stepper_2_Leerlauf(); 00690 Stepper_1_Stop(); 00691 Stepper_1_SetPara(40, 100); 00692 00693 motors[0]->move(StepperMotor::FWD, 128*400*0.1); 00694 00695 DisplaySendeBefehl(0x01); 00696 gotoxy(1,1); 00697 DisplaySendeString("Filament ist fertig."); 00698 gotoxy(1,2); 00699 DisplaySendeString("Bitte Messmodul ent-"); 00700 gotoxy(1,4); 00701 DisplaySendeString("fernen fuer Auswurf "); 00702 00703 while(InputKontrollmodul == 1){} 00704 00705 DisplaySendeBefehl(0x01); 00706 gotoxy(1,1); 00707 DisplaySendeString("ACHTUNG!"); 00708 gotoxy(1,3); 00709 DisplaySendeString("Nur Auswurf druecken"); 00710 gotoxy(1,2); 00711 DisplaySendeString("ohne Messmodul! "); 00712 gotoxy(1,4); 00713 DisplaySendeString(" Auswurf"); 00714 00715 while(ButtonABBRUCH==false) 00716 { 00717 ButtonABBRUCH = get_Button_2(); 00718 } 00719 00720 DisplaySendeBefehl(0x01); 00721 gotoxy(1,1); 00722 DisplaySendeString("Filament wegziehen, "); 00723 gotoxy(1,3); 00724 DisplaySendeString("wenn Schrittmotoren "); 00725 gotoxy(1,2); 00726 DisplaySendeString("nicht mehr greiffen."); 00727 00728 Stepper_1_SetPara(300, 300); 00729 00730 Stepper_1_Run('R', 300); 00731 00732 while(LS_1 == 0){} 00733 00734 00735 StatusDUO = DUO_FERTIG_GOOD; 00736 } 00737 00738 void EntryDUO() 00739 { 00740 ButtonSTART = get_Button_1(); 00741 ButtonABBRUCH = get_Button_2(); 00742 Fila_Good = get_InputKontrollmodul(); 00743 Fertig = get_FertigSignal(); 00744 00745 switch(StatusDUO) 00746 { 00747 case DUO_DEFAULT: 00748 00749 EntryDuoStart(); 00750 break; 00751 00752 case DUO_START: 00753 printf("MODUS DUO\n\r"); 00754 if(ButtonSTART==true) 00755 { 00756 ButtonSTART=false; 00757 EntryDuoEinlegen(); 00758 } 00759 else if(ButtonABBRUCH == true) 00760 { 00761 ButtonABBRUCH=false; 00762 DuoWechselFilament(); 00763 } 00764 00765 break; 00766 00767 case DUO_EINLEGEN: 00768 if(Fila_Good == true) //für Test->==false wenn gedrückt(heisst Filament ist gut) 00769 { 00770 EntryDuoFilaCut1(); 00771 } 00772 00773 else if(ButtonABBRUCH == true) 00774 { 00775 ButtonABBRUCH=false; 00776 EntryDuoDefault(); 00777 } 00778 00779 break; 00780 00781 case DUO_FILA_CUT1: 00782 if(Fila_Good == false) //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht) 00783 { 00784 EntryDuoFilaBad1(); 00785 } 00786 else if(LS_3 == 0) 00787 { 00788 // EntryDuoDefault();// nur für test 00789 EntryDuoFilaGood2(); 00790 } 00791 else if(ButtonABBRUCH == true) 00792 { 00793 ButtonABBRUCH=false; 00794 EntryDuoDefault(); 00795 } 00796 break; 00797 00798 case DUO_FILA_BAD1: 00799 if(Fila_Good == true) //für Test->==false wenn gedrückt(heisst Filament ist gut) 00800 { 00801 EntryDuoFilaCut1(); 00802 } 00803 else if(ButtonABBRUCH == true) 00804 { 00805 ButtonABBRUCH=false; 00806 EntryDuoDefault(); 00807 } 00808 00809 break; 00810 00811 case DUO_FILA_GOOD2: 00812 Stepper1CurrentPos = Stepper_1_GetPosition(); 00813 Stepper1MarkPos = Stepper_1_GetMark(); 00814 if(Stepper1CurrentPos > ((Stepper1MarkPos+(128*400*LAENGE_LS3_To_STEPPER2))-100)) 00815 { 00816 EntryDuoFilaGood3(); 00817 } 00818 else if(Fila_Good == false) //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht) 00819 { 00820 EntryDuoFilaBad1(); 00821 } 00822 else if(ButtonABBRUCH == true) 00823 { 00824 ButtonABBRUCH=false; 00825 EntryDuoDefault(); 00826 } 00827 break; 00828 00829 case DUO_FILA_GOOD3: 00830 if(Fila_Good == false) //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht) 00831 { 00832 EntryDuoFilaCut2(); 00833 } 00834 else if(ButtonABBRUCH == true) 00835 { 00836 ButtonABBRUCH=false; 00837 EntryDuoDefault(); 00838 } 00839 break; 00840 00841 case DUO_FILA_CUT2: 00842 if((LS_3 == 1) && (LS_2 == 1)) 00843 { 00844 EntryDuoFilaAusschuss(); 00845 } 00846 else if(ButtonABBRUCH == true) 00847 { 00848 ButtonABBRUCH=false; 00849 EntryDuoDefault(); 00850 } 00851 break; 00852 00853 case DUO_FILA_AUSSCHUSS: 00854 if(LS_1 == 1) 00855 { 00856 EntryDuoFertigBad(); 00857 } 00858 00859 else if(Fila_Good == true) //für Test->==false wenn gedrückt(heisst Filament ist gut) 00860 { 00861 EntryFilaCut31(); 00862 } 00863 else if(ButtonABBRUCH == true) 00864 { 00865 ButtonABBRUCH=false; 00866 EntryDuoDefault(); 00867 } 00868 break; 00869 00870 case DUO_FILA_CUT3_1: 00871 if((Fila_Good == false)&&(Fertig == true)) //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht) 00872 { 00873 EntryDuoFertigGood(); 00874 } 00875 else if(Fila_Good == false) //für Test->==true wenn nicht gedrückt(heisst Filament ist schlecht) 00876 { 00877 EntryDuoFilaCut32(); 00878 } 00879 else if(LS_2 == 0) 00880 { 00881 EntryDuoSpleissenVorbeGood(); 00882 } 00883 else if(ButtonABBRUCH == true) 00884 { 00885 ButtonABBRUCH=false; 00886 EntryDuoDefault(); 00887 } 00888 00889 break; 00890 00891 case DUO_FILA_CUT3_2: 00892 if(Fertig == true) 00893 { 00894 EntryDuoFertigGood(); 00895 } 00896 else if(LS_2 == 0) 00897 { 00898 EntryDuoSpleissenVorbeBad(); 00899 } 00900 else if(ButtonABBRUCH == true) 00901 { 00902 ButtonABBRUCH=false; 00903 EntryDuoDefault(); 00904 } 00905 break; 00906 00907 case DUO_SPLEISSEN_VORBE_BAD: 00908 if(Fertig == true) 00909 { 00910 EntryDuoFertigGood(); 00911 } 00912 else if(LS_3 == 0) 00913 { 00914 EntryDuoSpleissenBad(); 00915 } 00916 else if(ButtonABBRUCH == true) 00917 { 00918 ButtonABBRUCH=false; 00919 EntryDuoDefault(); 00920 } 00921 break; 00922 00923 case DUO_SPLEISSEN_BAD: 00924 00925 EntryDuoBad2(); 00926 break; 00927 00928 case DUO_SPLEISSEN_VORBE_GOOD: 00929 if(Fertig == true) 00930 { 00931 EntryDuoFertigGood(); 00932 } 00933 else if(Fila_Good == false) //für Test->==true wenn gedrückt(heisst Filament ist schlecht) 00934 { 00935 EntryDuoSpleissenVorbeBad2(); 00936 } 00937 else if(LS_3 == 0) 00938 { 00939 EntryDuoSpleissenGood(); 00940 } 00941 else if(ButtonABBRUCH == true) 00942 { 00943 ButtonABBRUCH=false; 00944 EntryDuoDefault(); 00945 } 00946 break; 00947 00948 00949 case DUO_SPLEISSEN_GOOD: 00950 00951 EntryDuoFilaGood3(); 00952 break; 00953 00954 case DUO_FILA_BAD2: 00955 00956 EntryDuoFilaCut22(); 00957 break; 00958 00959 case DUO_FERTIG_BAD: 00960 EntryDuoDefault(); 00961 break; 00962 00963 case DUO_FERTIG_GOOD: 00964 EntryDuoDefault(); 00965 break; 00966 00967 } 00968 }
Generated on Mon Jul 25 2022 02:36:14 by
 1.7.2
 1.7.2