IS_ONE_OF macro to make long chains of conditions more concise and easy to follow (#4860)

* Is one of macro

* Moar

* Whoops

* Trunk

* isOneOf function backed macro
This commit is contained in:
Ben Meadors
2024-09-25 13:50:00 -05:00
committed by GitHub
parent 9dd769586f
commit 4128d75ad4
8 changed files with 46 additions and 20 deletions

View File

@@ -32,6 +32,7 @@
#include "graphics/Screen.h"
#include "main.h"
#include "mesh/generated/meshtastic/config.pb.h"
#include "meshUtils.h"
#include "modules/Modules.h"
#include "shutdown.h"
#include "sleep.h"
@@ -627,9 +628,9 @@ void setup()
#endif
// only play start melody when role is not tracker or sensor
if (config.power.is_power_saving == true && (config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER ||
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER ||
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR))
if (config.power.is_power_saving == true &&
IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER, meshtastic_Config_DeviceConfig_Role_SENSOR))
LOG_DEBUG("Tracker/Sensor: Skipping start melody\n");
else
playStartMelody();