diff --git a/231124_DVT_Gantry_Xray_funktioniert.ino b/231124_DVT_Gantry_Xray_funktioniert.ino index d62f9d7..7baab11 100644 --- a/231124_DVT_Gantry_Xray_funktioniert.ino +++ b/231124_DVT_Gantry_Xray_funktioniert.ino @@ -30,7 +30,8 @@ #define PIN_STEPMOTOR_ABLE 19 #define PIN_STEPMOTOR_DIRECT 16 #define PIN_STEPMOTOR_CLOCK 17 -#define PIN_XRAY 13 +#define PIN_XRAY 14 +#define PIN_KV_SWITCH 27 #define PIN_FILAMENT_SWITCH 26 /* * ESP32 Polyfill Lib diff --git a/DVT_MainClass.h b/DVT_MainClass.h index c710bef..0415077 100644 --- a/DVT_MainClass.h +++ b/DVT_MainClass.h @@ -2,7 +2,6 @@ #define DVT_MAINCLASS_H #include -#include #include "DVT_Types.h" class Pin { @@ -48,6 +47,7 @@ Pin STEPMOTOR_ABLE = Pin(PIN_STEPMOTOR_ABLE,OUTPUT,HIGH); Pin STEPMOTOR_DIRECT = Pin(PIN_STEPMOTOR_DIRECT,OUTPUT,HIGH); Pin STEPMOTOR_CLOCK = Pin(PIN_STEPMOTOR_CLOCK,OUTPUT,HIGH); Pin XRAY_SWITCH = Pin(PIN_XRAY,OUTPUT,LOW); +Pin KV_SWITCH = Pin(PIN_KV_SWITCH, OUTPUT, LOW); Pin FILAMENT_SWITCH = Pin(PIN_FILAMENT_SWITCH,OUTPUT,LOW); #endif diff --git a/DVT_XRayClass.h b/DVT_XRayClass.h index 729a8da..32d4d4a 100644 --- a/DVT_XRayClass.h +++ b/DVT_XRayClass.h @@ -16,20 +16,22 @@ class XRay { this->xray_time = XRayTime; } void Signal() { - if (!this->CurState.State) { - this->CurState.State = true; - this->CurState.Time = millis(); - XRAY_SWITCH.SetState(this->CurState.State); - sysMSG("SYSTEM: XRAY Started"); - } + if (!this->CurState.State) { + this->CurState.State = true; + this->CurState.Time = millis(); + XRAY_SWITCH.SetState(this->CurState.State); + while (millis() - this->CurState.Time <= 20){} + KV_SWITCH.SetState(this->CurState.State); + sysMSG("SYSTEM: XRAY Started"); + } } - void RunTime() - { - if (this->CurState.State && millis() >= this->CurState.Time + this->xray_time) { - this->CurState.State = false; - XRAY_SWITCH.SetState(this->CurState.State); - sysMSG("SYSTEM: XRAY Stopped"); - } + void RunTime() { + if (this->CurState.State && millis() >= this->CurState.Time + this->xray_time) { + this->CurState.State = false; + XRAY_SWITCH.SetState(this->CurState.State); + KV_SWITCH.SetState(this->CurState.State); + sysMSG("SYSTEM: XRAY Stopped"); + } } void SetTime(int Time) { if (Time <= XRayMaxTime && Time != 0)