mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-17 17:11:30 +10:00
Fix isFromUs and account for channel hashes instead of indexes
This commit is contained in:
@@ -459,4 +459,15 @@ bool Channels::setDefaultPresetCryptoForHash(ChannelHash channelHash)
|
||||
int16_t Channels::setActiveByIndex(ChannelIndex channelIndex)
|
||||
{
|
||||
return setCrypto(channelIndex);
|
||||
}
|
||||
|
||||
int8_t Channels::getIndexByHash(ChannelHash channelHash)
|
||||
{
|
||||
// Iterate through all channels to find the one with matching hash
|
||||
for (ChannelIndex i = 0; i < getNumChannels(); i++) {
|
||||
if (getHash(i) == channelHash) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1; // Hash not found
|
||||
}
|
||||
Reference in New Issue
Block a user