Spleisser Grundstrucktur

Dependencies:   mbed mbed-rtos X_NUCLEO_IHM02A1

Files at this revision

API Documentation at this revision

Comitter:
hagenrap
Date:
Mon Apr 22 14:46:03 2019 +0000
Parent:
33:de144094bdd1
Commit message:
pwm; ;

Changed in this revision

PWM2.cpp Show annotated file Show diff for this revision Revisions of this file
PWM2.h Show annotated file Show diff for this revision Revisions of this file
Papierkorb/PWM.h 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_SOLO.cpp 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PWM2.cpp	Mon Apr 22 14:46:03 2019 +0000
@@ -0,0 +1,66 @@
+#include "SETUP.h"
+
+PwmOut pwmServo(SERVO);
+PwmOut pwmCutter(CUTTER_ARC);
+PwmOut pwmSpleisser_1(SPLEISSER_ARC_1);
+PwmOut pwmSpleisser_2(SPLEISSER_ARC_2);
+
+
+bool ServoInit = false;
+
+
+float duty1 = (GOOD_FIL*0.2666666+22)/100;
+float duty2 = (BAD_FIL*0.2666666+22)/100;
+
+
+void Set_Cutter_ARC()
+{
+    pwmCutter.period(1/(float)FREQ_CUTTER);
+    pwmCutter = (float)DUTY_CUTTER/100;
+}
+
+void Reset_Cutter_ARC()
+{
+    pwmCutter = 0;
+}
+
+void Set_SP_1_ARC()
+{
+    pwmSpleisser_1.period(1/(float)FREQ_SP_1);
+    pwmSpleisser_1 = (float)DUTY_SP/100;
+}
+
+void Set_SP_2_ARC()
+{
+    pwmSpleisser_2.period(1/(float)FREQ_SP_2);
+    pwmSpleisser_2 = (float)DUTY_SP/100;
+}
+
+void Reset_SP_ARC()
+{
+    pwmSpleisser_1= 0;
+    pwmSpleisser_2= 0;
+}
+
+void Set_Servo_Good_Fil()
+{
+    if(ServoInit == false)
+    {
+        pwmServo.period(1/(float)SERVO_FR);
+        ServoInit = true;
+        
+    }
+    printf("pwm\n\r");
+    pwmServo = duty1;
+
+}
+
+void Set_Servo_Bad_Fil()
+{
+    pwmServo.period(1/(float)SERVO_FR);
+    pwmServo = duty2;
+}
+
+
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PWM2.h	Mon Apr 22 14:46:03 2019 +0000
@@ -0,0 +1,15 @@
+#ifndef  MBED_PWM2_H
+#define MBED_PWM2_H
+
+
+void Set_Cutter_ARC();
+void Reset_Cutter_ARC();
+
+void Set_SP_1_ARC();
+void Set_SP_2_ARC();
+void Reset_SP_ARC();
+
+void Set_Servo_Good_Fil();
+void Set_Servo_Bad_Fil();
+
+#endif
--- a/Papierkorb/PWM.h	Mon Apr 22 11:56:38 2019 +0000
+++ b/Papierkorb/PWM.h	Mon Apr 22 14:46:03 2019 +0000
@@ -8,5 +8,6 @@
 void pwm_io(int p_us, float dc);
 void pwm_io2(int p_us, float dc);
 
+
 #endif
 
--- a/SETUP.h	Mon Apr 22 11:56:38 2019 +0000
+++ b/SETUP.h	Mon Apr 22 14:46:03 2019 +0000
@@ -38,7 +38,7 @@
 #include "DevSPI.h"
 #include "XNucleoIHM02A1.h"
 #include "Display.h"
-
+#include "PWM2.h"
 // -----------------------------------------------------------------------------
 // GPIO
 // -----------------------------------------------------------------------------
@@ -97,12 +97,15 @@
     #define SERVO_FR        240  // [Hz]
     #define GOOD_FIL        60.5 // [°] (max 90)
     #define BAD_FIL         0    // [°] (min 0)
-
-
+    
+    // Cutter
+    #define FREQ_CUTTER     20000 // [Hz]
+    #define DUTY_CUTTER     70    // [%]
 
-
-    
-    
+    // Spleisser
+    #define FREQ_SP_1       20000 // [Hz]
+    #define FREQ_SP_2       17000 // [Hz]
+    #define DUTY_SP         70    // [%]
     
 
 
--- a/ST_DUO.cpp	Mon Apr 22 11:56:38 2019 +0000
+++ b/ST_DUO.cpp	Mon Apr 22 14:46:03 2019 +0000
@@ -3,6 +3,7 @@
 
 int StatusDUO=DUO_DEFAULT;
 
+
 void EntryDUO()
 {
     switch(StatusDUO)
--- a/ST_SOLO.cpp	Mon Apr 22 11:56:38 2019 +0000
+++ b/ST_SOLO.cpp	Mon Apr 22 14:46:03 2019 +0000
@@ -1,7 +1,8 @@
 #include "SETUP.h"
 
+int StatusSOLO=SOLO_DEFAULT;
 
-int StatusSOLO=SOLO_DEFAULT;
+
 
 
 
@@ -10,16 +11,27 @@
     switch(StatusSOLO)
     {     
        case SOLO_DEFAULT:
-       /*** BEISPIEL FÜR RAPHI
-       if(evTasterStart == 1)
+       
+       // Weiche auf gute Filament stellen
+       Set_Servo_Good_Fil();
+       wait(1);
+       //wait(1);
+       //Set_Servo_Bad_Fil();
+       //wait(1);
+       printf("Start druecken\n\r");
+       
+       
+       
+       /*
+       if (button1_pressed)
        {
-        
-        entryEinlegenIn();
-        StatusSOLO=SOLO_EinlegenIN;
+            StatusSOLO = SOLO_EinlegenIN;
         }*/
-        
-        printf("SOLO_MODUS\n\r");
-        Thread::wait(1000);
+       
+       
+       
+       
+       
        break;
        
        case SOLO_EinlegenIN:
--- a/main.cpp	Mon Apr 22 11:56:38 2019 +0000
+++ b/main.cpp	Mon Apr 22 14:46:03 2019 +0000
@@ -57,7 +57,7 @@
     
     SchrittmotorenInit();
     button1.fall(callback(button1_onpressed_cb)); // Attach ISR to handle button press event
-
+    
  while(1)
     {
         switch (StatusSpleisser)