Skip to content

Commit

Permalink
Remove those turnery's for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
CapnBry committed Mar 20, 2024
1 parent 58b0803 commit 59301fc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib/DEVICE/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ void devicesTriggerEvent()

static int _devicesUpdate(unsigned long now)
{
int32_t core = CURRENT_CORE;
const int32_t core = CURRENT_CORE;
const int32_t coreMulti = (core == -1) ? 0 : core;

bool newModelMatch = connectionHasModelMatch && teamraceHasModelMatch;
bool handleEvents = eventFired[core==-1?0:core] || lastConnectionState[core==-1?0:core] != connectionState || lastModelMatch[core==-1?0:core] != newModelMatch;
eventFired[core==-1?0:core] = false;
lastConnectionState[core==-1?0:core] = connectionState;
lastModelMatch[core==-1?0:core] = newModelMatch;
bool handleEvents = eventFired[coreMulti] || lastConnectionState[coreMulti] != connectionState || lastModelMatch[coreMulti] != newModelMatch;
eventFired[coreMulti] = false;
lastConnectionState[coreMulti] = connectionState;
lastModelMatch[coreMulti] = newModelMatch;

for(size_t i=0 ; i<deviceCount ; i++)
{
Expand Down

0 comments on commit 59301fc

Please sign in to comment.