Master to Develop

This commit is contained in:
Thomas Göttgens
2022-12-28 15:30:23 +01:00
parent f632933b93
commit 94cb100e3f
10 changed files with 79 additions and 5 deletions

View File

@@ -196,6 +196,17 @@ Channel &Channels::getByIndex(ChannelIndex chIndex)
return *ch;
}
Channel &Channels::getByName(const char* chName)
{
for (ChannelIndex i = 0; i < getNumChannels(); i++) {
if (strcasecmp(channelFile.channels[i].settings.name, chName) == 0) {
return channelFile.channels[i];
}
}
return getByIndex(getPrimaryIndex());
}
void Channels::setChannel(const Channel &c)
{
Channel &old = getByIndex(c.index);

View File

@@ -40,6 +40,9 @@ class Channels
/** Return the Channel for a specified index */
Channel &getByIndex(ChannelIndex chIndex);
/** Return the Channel for a specified name, return primary if not found. */
Channel &getByName(const char* chName);
/** Using the index inside the channel, update the specified channel's settings and role. If this channel is being promoted
* to be primary, force all other channels to be secondary.
*/

View File

@@ -35,7 +35,9 @@ typedef enum _TelemetrySensorType {
/* 6-Axis inertial measurement sensor */
TelemetrySensorType_QMI8658 = 10,
/* 3-Axis magnetic sensor */
TelemetrySensorType_QMC5883L = 11
TelemetrySensorType_QMC5883L = 11,
/* High accuracy temperature and humidity */
TelemetrySensorType_SHT31 = 12
} TelemetrySensorType;
/* Struct definitions */
@@ -91,8 +93,8 @@ extern "C" {
/* Helper constants for enums */
#define _TelemetrySensorType_MIN TelemetrySensorType_SENSOR_UNSET
#define _TelemetrySensorType_MAX TelemetrySensorType_QMC5883L
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_QMC5883L+1))
#define _TelemetrySensorType_MAX TelemetrySensorType_SHT31
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_SHT31+1))