49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#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() {
|
|
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);
|
|
KV_SWITCH.SetState(this->CurState.State);
|
|
sysMSG("SYSTEM: XRAY Stopped");
|
|
}
|
|
}
|
|
void SetTime(int Time) {
|
|
if (Time <= XRayMaxTime && Time != 0)
|
|
this->xray_time = Time;
|
|
else
|
|
this->xray_time = XRayTime;
|
|
}
|
|
};
|
|
|
|
|
|
|
|
XRay XRAY = XRay(XRayTime);
|
|
|
|
#endif
|