[nv14] Improve support for old NV14 Radio Module FW (#1329)
* Improve support for old Radio Module FW * Change OLD RSSI scaling to 100 - 40 range * change boolean variable name
This commit is contained in:
@@ -125,6 +125,8 @@ int32_t GetSensorValueFlySkyNv14(const FlyskyNv14Sensor* sensor,
|
|||||||
int32_t value = 0;
|
int32_t value = 0;
|
||||||
const nv14SensorData* sensorData =
|
const nv14SensorData* sensorData =
|
||||||
reinterpret_cast<const nv14SensorData*>(data + sensor->offset);
|
reinterpret_cast<const nv14SensorData*>(data + sensor->offset);
|
||||||
|
static bool pre_10_0_14_RmFw = false;
|
||||||
|
|
||||||
if (sensor->bytes == 1)
|
if (sensor->bytes == 1)
|
||||||
value = sensorData->UINT8;
|
value = sensorData->UINT8;
|
||||||
else if (sensor->bytes == 2)
|
else if (sensor->bytes == 2)
|
||||||
@@ -132,23 +134,32 @@ int32_t GetSensorValueFlySkyNv14(const FlyskyNv14Sensor* sensor,
|
|||||||
else if (sensor->bytes == 4)
|
else if (sensor->bytes == 4)
|
||||||
value = sensorData->UINT32;
|
value = sensorData->UINT32;
|
||||||
|
|
||||||
|
if (NV14internalModuleFwVersion <= 0x1000E) {
|
||||||
|
if (sensor->id == FLYSKY_SENSOR_RX_SIGNAL) {
|
||||||
|
if (value <= 10)
|
||||||
|
pre_10_0_14_RmFw = true;
|
||||||
|
else
|
||||||
|
pre_10_0_14_RmFw = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// For older RF module FW Sgml is in [0, 10] range
|
// For older RF module FW Sgml is in [0, 10] range
|
||||||
// and we need to use RSSI for alarm
|
// and we need to use RSSI for alarm
|
||||||
if (NV14internalModuleFwVersion < 0x1000E) {
|
if (pre_10_0_14_RmFw) {
|
||||||
if (sensor->id == FLYSKY_SENSOR_RX_RSSI) {
|
if (sensor->id == FLYSKY_SENSOR_RX_RSSI) {
|
||||||
if (value < -200) value = -200;
|
if (value < -200) value = -200;
|
||||||
// if g_model.rssiAlarms.flysky_telemetry == 1
|
// if g_model.rssiAlarms.flysky_telemetry == 1
|
||||||
// RSSI will be kept within native FlySky range [-90, -60]
|
// RSSI will be kept within native FlySky range [-90, -60]
|
||||||
if (!g_model.rssiAlarms.flysky_telemetry) {
|
if (!g_model.rssiAlarms.flysky_telemetry) {
|
||||||
value += 200;
|
value *= 2;
|
||||||
value /= 2;
|
value += 220;
|
||||||
}
|
}
|
||||||
telemetryData.rssi.set(value);
|
telemetryData.rssi.set(value);
|
||||||
}
|
}
|
||||||
} else if (sensor->id == FLYSKY_SENSOR_RX_SIGNAL) {
|
} else if (sensor->id == FLYSKY_SENSOR_RX_SIGNAL) {
|
||||||
telemetryData.rssi.set(value);
|
telemetryData.rssi.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sensor->id == FLYSKY_SENSOR_PRESSURE) {
|
if (sensor->id == FLYSKY_SENSOR_PRESSURE) {
|
||||||
switch(sensor->subId)
|
switch(sensor->subId)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user