Skip to content

Commit

Permalink
analog/buttons: make sure analog buttons are forcefully refreshed if …
Browse files Browse the repository at this point in the history
…requested
  • Loading branch information
paradajz committed Dec 2, 2024
1 parent 00473f2 commit 164beb1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/firmware/application/io/analog/Analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void Analog::updateSingle(size_t index, bool forceRefresh)
{
analogDescriptor_t descriptor;
fillAnalogDescriptor(index, descriptor);
descriptor.event.forcedRefresh = true;

descriptor.newValue = _lastValue[index];
descriptor.oldValue = _lastValue[index];
Expand Down
18 changes: 16 additions & 2 deletions src/firmware/application/io/buttons/Buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,22 @@ Buttons::Buttons(HWA& hwa,
buttonDescriptor_t descriptor;
fillButtonDescriptor(index, descriptor);

// event.value in this case contains state information only
processButton(index, event.value, descriptor);
if (!event.forcedRefresh)
{
// event.value in this case contains state information only
processButton(index, event.value, descriptor);
}
else
{
if (descriptor.type == type_t::LATCHING)
{
sendMessage(index, latchingState(index), descriptor);
}
else
{
sendMessage(index, state(index), descriptor);
}
}
});

MIDIDispatcher.listen(messaging::eventType_t::TOUCHSCREEN_BUTTON,
Expand Down

0 comments on commit 164beb1

Please sign in to comment.