MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/schematic/AlarmTimerLogic.cpp

54 lines
739 B
C++
Raw Normal View History

2024-06-07 11:12:56 +03:00
/*
* AlarmTimer.cpp
*
* Created on: 26 мая 2021 г.
* Author: sozonov
*/
#include "AlarmTimerLogic.hh"
void AlarmTimerLogic::stop() {
current_state = false;
otf_pause = true;
}
void AlarmTimerLogic::start() {
if( not otf_pause )
time_start = clock();
current_state = true;
}
void AlarmTimerLogic::reset() {
time_start = clock();
current_time = 0;
current_state= false;
otf_alarm = false;
otf_pause = false;
}
void AlarmTimerLogic::process() {
if( current_state && not otf_alarm ) {
current_time = clock() - time_start;
if( current_time >= time_out ) {
alarm();
otf_alarm = true;
stop();
}
}
}