1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

Revert "fixed: vtxSAIsReady() returns true before vtx is initialized fixed: vtxSAGetPowerIndex() is trying to decode power index from mW"

This reverts commit 71a4e32bf1.
This commit is contained in:
Roman Lut 2020-12-29 03:00:31 +02:00
parent 71a4e32bf1
commit 895a7625e8
2 changed files with 3 additions and 5 deletions

View file

@ -195,7 +195,6 @@ static void saPrintSettings(void)
LOG_D(VTX, "BootIntoPitMode: %s", saDevice.willBootIntoPitMode ? "yes" : "no"); LOG_D(VTX, "BootIntoPitMode: %s", saDevice.willBootIntoPitMode ? "yes" : "no");
} }
/*
int saDacToPowerIndex(int dac) int saDacToPowerIndex(int dac)
{ {
for (int idx = saPowerCount - 1 ; idx >= 0 ; idx--) { for (int idx = saPowerCount - 1 ; idx >= 0 ; idx--) {
@ -205,7 +204,6 @@ int saDacToPowerIndex(int dac)
} }
return 0; return 0;
} }
*/
int saDbiToMw(uint16_t dbi) { int saDbiToMw(uint16_t dbi) {
@ -796,7 +794,7 @@ vtxDevType_e vtxSAGetDeviceType(const vtxDevice_t *vtxDevice)
static bool vtxSAIsReady(const vtxDevice_t *vtxDevice) static bool vtxSAIsReady(const vtxDevice_t *vtxDevice)
{ {
return vtxDevice != NULL && (saDevice.power >= 0 ); return vtxDevice != NULL && !(saDevice.power == 0);
//wait until power reading exists //wait until power reading exists
} }
@ -914,7 +912,7 @@ static bool vtxSAGetPowerIndex(const vtxDevice_t *vtxDevice, uint8_t *pIndex)
return false; return false;
} }
*pIndex = saDevice.power; *pIndex = ((saDevice.version == SA_1_0) ? saDacToPowerIndex(saDevice.power) : saDevice.power);
return true; return true;
} }

View file

@ -72,7 +72,7 @@ typedef enum {
typedef struct smartAudioDevice_s { typedef struct smartAudioDevice_s {
smartAudioVersion_e version; smartAudioVersion_e version;
int8_t channel; int8_t channel;
int8_t power; // -1 - not initialized, 0 - power level unknown, or power level index 1..n. For SA_2_1 device you can get power in mW: saPowerTable[index-1].mW int8_t power;
int8_t mode; int8_t mode;
uint16_t freq; uint16_t freq;
uint16_t orfreq; uint16_t orfreq;