1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00
This commit is contained in:
Bertrand Songis 2019-08-26 15:11:04 +02:00
parent b8e29bf175
commit 1f08f2c315
2 changed files with 10 additions and 2 deletions

View file

@ -107,7 +107,7 @@ TASK_FUNCTION(mixerTask)
static uint32_t lastRunTime;
s_pulses_paused = true;
while (1) {
while (true) {
#if defined(PCBTARANIS) && defined(SBUS)
// SBUS trainer
processSbusInput();

View file

@ -34,7 +34,6 @@ bool isFaiForbidden(source_t idx)
TelemetrySensor * sensor = &g_model.telemetrySensors[(idx-MIXSRC_FIRST_TELEM)/3];
switch (telemetryProtocol) {
case PROTOCOL_TELEMETRY_FRSKY_SPORT:
if (sensor->id == RSSI_ID) {
return false;
@ -355,11 +354,20 @@ void TelemetryItem::eval(const TelemetrySensor & sensor)
}
}
uint32_t angle = abs(gpsItem.gps.latitude - gpsItem.pilotLatitude);
#if defined(STM32)
uint32_t dist = uint64_t(EARTH_RADIUS * M_PI / 180) * angle / 1000000;
#else
// TODO search later why it breaks Sky9x
uint32_t dist = EARTH_RADIUS * angle / 1000000;
#endif
uint32_t result = dist * dist;
angle = abs(gpsItem.gps.longitude - gpsItem.pilotLongitude);
#if defined(STM32)
dist = uint64_t(gpsItem.distFromEarthAxis) * angle / 1000000;
#else
dist = gpsItem.distFromEarthAxis * angle / 1000000;
#endif
result += dist * dist;
// Length on ground (ignoring curvature of the earth)