add missing file
This commit is contained in:
parent
039c093b15
commit
c19810162a
2 changed files with 66 additions and 0 deletions
28
src/items/signal.cpp
Normal file
28
src/items/signal.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "signal.h"
|
||||
|
||||
Microcontroller *Signal::micro = nullptr;
|
||||
|
||||
Signal::Signal(uint8_t id, uint8_t address, uint8_t subaddress, uint8_t type, int8_t initalValue)
|
||||
: Item(address | (subaddress << 8), QString("Turnout ")+QString::number(id), initalValue),
|
||||
subaddress_(subaddress), signalId_(id), type_(type)
|
||||
{
|
||||
itemId_ = address | (subaddress << 8);
|
||||
name_ = QString("Signal ")+QString::number(id);
|
||||
}
|
||||
|
||||
void Signal::setValue(int8_t value)
|
||||
{
|
||||
Item::setValue(value);
|
||||
if(micro)
|
||||
micro->signalSetValue(signalId_, value);
|
||||
}
|
||||
|
||||
bool Signal::hasSlow()
|
||||
{
|
||||
return type_ & TYPE_HAS_SLOW;
|
||||
}
|
||||
|
||||
bool Signal::hasExpect()
|
||||
{
|
||||
return type_ & TYPE_HAS_EXPECT;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue