/** * \brief Check the condition and call the adequate on_trigger_* method. * \param activator The item that activated the trigger. */ void bear::engine::with_trigger::check_condition( base_item* activator ) { if ( m_condition ) on_trigger_on(activator); else on_trigger_off(activator); } // with_trigger::check_condition()
void Envelope::process_trigger() { TRIGGER_STATE new_state = (analogRead(trigger_pin) > 100 ? ON : OFF); if (new_state != this->state) { this->state = new_state; if (new_state == ON) { on_trigger_on(); } else { on_trigger_off(); } } }