Skip to content
Permalink
Browse files

only calculate first_slot when needed while updating pins

  • Loading branch information
brucelowekamp committed Dec 10, 2019
1 parent 028b2b2 commit ce2858bcfcf0a70a0831065ca7c138e2496e99a7
Showing with 3 additions and 4 deletions.
  1. +3 −3 plugins/gpio/GPIODriver.cpp
  2. +0 −1 plugins/gpio/GPIODriver.h
@@ -48,7 +48,6 @@ using std::vector;

GPIODriver::GPIODriver(const Options &options)
: m_options(options),
m_first_slot(options.start_address - 1),
m_term(false),
m_dmx_changed(false) {
}
@@ -167,12 +166,13 @@ bool GPIODriver::UpdateGPIOPins(const DmxBuffer &dmx) {
TURN_OFF,
NO_CHANGE,
};
const uint16_t first_slot = m_options.start_address - 1;

for (uint16_t i = 0;
i < m_gpio_pins.size() && (i + m_first_slot < dmx.Size());
i < m_gpio_pins.size() && (i + first_slot < dmx.Size());
i++) {
Action action = NO_CHANGE;
uint8_t slot_value = dmx.Get(i + m_first_slot);
uint8_t slot_value = dmx.Get(i + first_slot);

switch (m_gpio_pins[i].state) {
case ON:
@@ -113,7 +113,6 @@ class GPIODriver : private ola::thread::Thread {
typedef std::vector<GPIOPin> GPIOPins;

const Options m_options;
const uint16_t m_first_slot;
GPIOPins m_gpio_pins;

DmxBuffer m_buffer;

0 comments on commit ce2858b

Please sign in to comment.
You can’t perform that action at this time.