static tmr10ms_t s_varioTmr;
tmr10ms_t tmr10ms = get_tmr10ms();
.......
if ((int16_t)(s_varioTmr-tmr10ms) < 0) {
uint8_t SoundVarioBeepTime = (1600 - verticalSpeed) / 100;
uint8_t SoundVarioBeepFreq = (verticalSpeed * 10 + 16000) >> 8;
s_varioTmr = tmr10ms + (SoundVarioBeepTime*2);
AUDIO_VARIO(SoundVarioBeepFreq, SoundVarioBeepTime);
}
else if ((appId >> 8) == 0) {
// The old FrSky IDs
uint8_t id = (uint8_t)appId;
uint16_t value = HUB_DATA_U16(packet);
processHubPacket(id, value);
}
else if (appId == BETA_BARO_ALT_ID) {
int32_t baroAltitude = SPORT_DATA_S32(packet);
setBaroAltitude(10 * (baroAltitude >> 8));
}
else if (appId == BETA_VARIO_ID) {
int32_t varioSpeed = SPORT_DATA_S32(packet);
frskyData.hub.varioSpeed = 10 * (varioSpeed >> 8);
}
#define BETA_VARIO_ID 0x8030
#define BETA_BARO_ALT_ID 0x8010
case BARO_ALT_AP_ID:
if (frskyData.hub.baroAltitude_ap > 9)
frskyData.hub.varioHighPrecision = true;
if (!frskyData.hub.varioHighPrecision)
frskyData.hub.baroAltitude_ap *= 10;
setBaroAltitude((int32_t)100 * frskyData.hub.baroAltitude_bp + (frskyData.hub.baroAltitude_bp >= 0 ? frskyData.hub.baroAltitude_ap : -frskyData.hub.baroAltitude_ap));
break;
#if defined(VARIO)
uint8_t varioSource = g_model.frsky.varioSource - VARIO_SOURCE_A1;
if (varioSource == appId-ADC1_ID) {
frskyData.hub.varioSpeed = applyChannelRatio(varioSource, frskyData.analog[varioSource].value);
}
#endif