mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 02:32:23 +00:00
Create channel-mute toggle function
This commit is contained in:
@@ -343,6 +343,16 @@ void Channels::setChannel(const meshtastic_Channel &c)
|
|||||||
old = c; // slam in the new settings/role
|
old = c; // slam in the new settings/role
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Channels::setMute(ChannelIndex chIndex)
|
||||||
|
{
|
||||||
|
if (chIndex < channelFile.channels_count) {
|
||||||
|
meshtastic_Channel *ch = channelFile.channels + chIndex;
|
||||||
|
ch->settings.mute = !ch->settings.mute;
|
||||||
|
} else {
|
||||||
|
LOG_ERROR("Failed to mute. Invalid channel index %d > %d", chIndex, channelFile.channels_count);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
bool Channels::anyMqttEnabled()
|
bool Channels::anyMqttEnabled()
|
||||||
{
|
{
|
||||||
#if USERPREFS_EVENT_MODE && !MESHTASTIC_EXCLUDE_MQTT
|
#if USERPREFS_EVENT_MODE && !MESHTASTIC_EXCLUDE_MQTT
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ class Channels
|
|||||||
*/
|
*/
|
||||||
void setChannel(const meshtastic_Channel &c);
|
void setChannel(const meshtastic_Channel &c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the mute state of the channel associated with the channel index.
|
||||||
|
* I.e. if it's off turn it on and vice-versa.
|
||||||
|
*/
|
||||||
|
void setMute(ChannelIndex chIndex);
|
||||||
|
|
||||||
/** Return a human friendly name for this channel (and expand any short strings as needed)
|
/** Return a human friendly name for this channel (and expand any short strings as needed)
|
||||||
*/
|
*/
|
||||||
const char *getName(size_t chIndex);
|
const char *getName(size_t chIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user