override setValue functions
This commit is contained in:
parent
958083f6a3
commit
a8e997258b
|
@ -153,6 +153,52 @@ bool Universe::isSyncronized() const
|
|||
};
|
||||
|
||||
|
||||
void Universe::setValue (const uint16_t address, const uint8_t value)
|
||||
{
|
||||
// address valid?
|
||||
if (address < 1 || address > null_start_data.size())
|
||||
return;
|
||||
|
||||
// set active_data_slots to at least this address
|
||||
if (address >= active_data_slots)
|
||||
active_data_slots = address + 1; // + start code
|
||||
|
||||
// data not changed!
|
||||
if (slot(address) == value)
|
||||
return;
|
||||
|
||||
// set the value
|
||||
DMX::Universe::setValue(address, value);
|
||||
}
|
||||
|
||||
|
||||
void Universe::setValue (const uint16_t start, const uint16_t footprint,
|
||||
const uint8_t* data)
|
||||
{
|
||||
// start and footprint valid?
|
||||
if (start < 1 || start + footprint >= null_start_data.size())
|
||||
return;
|
||||
|
||||
// set active_data_slots to at least end of footprint
|
||||
if (start + footprint >= active_data_slots)
|
||||
active_data_slots = start + footprint + 1; // + start code
|
||||
|
||||
// get a copy of the current values
|
||||
null_start_mutex.lock();
|
||||
uint8_t og[footprint];
|
||||
std::copy(std::begin(null_start_data) + start,
|
||||
std::begin(null_start_data) + start + footprint, og);
|
||||
null_start_mutex.unlock();
|
||||
|
||||
// data not changed!
|
||||
if (memcmp(data, og, footprint) == 0)
|
||||
return;
|
||||
|
||||
// set the values
|
||||
DMX::Universe::setValue(start, footprint, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Universe::source
|
||||
* @return
|
||||
|
|
|
@ -56,6 +56,11 @@ public:
|
|||
virtual bool isSyncronized() const;
|
||||
virtual void synchronize(uint8_t = 0);
|
||||
|
||||
// DMX::Universe overrides
|
||||
void setValue (const uint16_t address, const uint8_t value) override;
|
||||
void setValue (const uint16_t start, const uint16_t footprint,
|
||||
const uint8_t* data) override;
|
||||
|
||||
/**
|
||||
* @brief destination IP address
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue