Skip to content

Commit

Permalink
Fixes global handler. It was sending each identify twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz committed Feb 1, 2024
1 parent 5787d3f commit 50ef530
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/openlcb/DccAccyConsumer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,31 @@ protected:
void handle_identify_global(const EventRegistryEntry &registry_entry,
EventReport *event, BarrierNotifiable *done) OVERRIDE
{
AutoNotify an(done);
if (event->dst_node && event->dst_node != node_)
{
return done->notify();
return;
}
if (registry_entry.event ==
TractionDefs::ACTIVATE_BASIC_DCC_ACCESSORY_EVENT_BASE)
{
event->event_write_helper<1>()->WriteAsync(node_,
Defs::MTI_CONSUMER_IDENTIFIED_RANGE, WriteHelper::global(),
eventid_to_buffer(EncodeRange(
TractionDefs::ACTIVATE_BASIC_DCC_ACCESSORY_EVENT_BASE,
4095)),
done->new_child());
}
if (registry_entry.event ==
TractionDefs::INACTIVATE_BASIC_DCC_ACCESSORY_EVENT_BASE)
{
event->event_write_helper<2>()->WriteAsync(node_,
Defs::MTI_CONSUMER_IDENTIFIED_RANGE, WriteHelper::global(),
eventid_to_buffer(EncodeRange(
TractionDefs::INACTIVATE_BASIC_DCC_ACCESSORY_EVENT_BASE,
4095)),
done->new_child());
}
event->event_write_helper<1>()->WriteAsync(node_,
Defs::MTI_CONSUMER_IDENTIFIED_RANGE, WriteHelper::global(),
eventid_to_buffer(EncodeRange(
TractionDefs::ACTIVATE_BASIC_DCC_ACCESSORY_EVENT_BASE, 4095)),
done->new_child());
event->event_write_helper<2>()->WriteAsync(node_,
Defs::MTI_CONSUMER_IDENTIFIED_RANGE, WriteHelper::global(),
eventid_to_buffer(EncodeRange(
TractionDefs::INACTIVATE_BASIC_DCC_ACCESSORY_EVENT_BASE, 4095)),
done->new_child());
done->notify();
}

void handle_event_report(const EventRegistryEntry &registry_entry,
Expand Down

0 comments on commit 50ef530

Please sign in to comment.