2023-11-24 21:08:24 +00:00
|
|
|
#ifndef DVT_XRAYCLASS_H
|
|
|
|
#define DVT_XRAYCLASS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "DVT_MainClass.h"
|
|
|
|
|
|
|
|
class XRay {
|
|
|
|
private:
|
|
|
|
DVT_State_t CurState;
|
|
|
|
int xray_time;
|
|
|
|
public:
|
|
|
|
XRay(int Time) {
|
|
|
|
if (Time <= XRayMaxTime && Time != 0)
|
|
|
|
this->xray_time = Time;
|
|
|
|
else
|
|
|
|
this->xray_time = XRayTime;
|
|
|
|
}
|
|
|
|
void Signal() {
|
2023-11-28 14:16:20 +00:00
|
|
|
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");
|
|
|
|
}
|
2023-11-24 21:08:24 +00:00
|
|
|
}
|
2023-11-28 14:16:20 +00:00
|
|
|
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");
|
|
|
|
}
|
2023-11-24 21:08:24 +00:00
|
|
|
}
|
|
|
|
void SetTime(int Time) {
|
|
|
|
if (Time <= XRayMaxTime && Time != 0)
|
|
|
|
this->xray_time = Time;
|
|
|
|
else
|
|
|
|
this->xray_time = XRayTime;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XRay XRAY = XRay(XRayTime);
|
|
|
|
|
|
|
|
#endif
|