void sendTelemetry(void) { if (millis() - lastCycleTime >= CYCLETIME) { lastCycleTime = millis(); cycleNum++; // Frame 1: sent every 200ms sendAccel(); sendBaro(); sendTemperature1(); sendTelemetryTail(); if ((cycleNum % 5) == 0) { // Frame 2: Sent every 1s if (sensors(SENSOR_GPS)) { sendGPS(); sendTelemetryTail(); } } if (cycleNum == 25) { //Frame 3: Sent every 5s cycleNum = 0; sendTime(); sendTelemetryTail(); } } }
void handleFrSkyTelemetry(void) { if (!canSendFrSkyTelemetry()) { return; } uint32_t now = millis(); if (!hasEnoughTimeLapsedSinceLastTelemetryTransmission(now)) { return; } lastCycleTime = now; cycleNum++; // Sent every 125ms sendAccel(); sendVario(); sendTelemetryTail(); if ((cycleNum % 4) == 0) { // Sent every 500ms sendBaro(); sendHeading(); sendTelemetryTail(); } if ((cycleNum % 8) == 0) { // Sent every 1s sendTemperature1(); if (feature(FEATURE_VBAT)) { sendVoltage(); sendVoltageAmp(); sendAmperage(); sendFuelLevel(); } #ifdef GPS if (sensors(SENSOR_GPS)) sendGPS(); #endif sendTelemetryTail(); } if (cycleNum == 40) { //Frame 3: Sent every 5s cycleNum = 0; sendTime(); sendTelemetryTail(); } }
void sendFRSKYTelemetry(void) { static uint32_t lastCycleTime = 0; static uint8_t cycleNum = 0; if (currentTimeMS - lastCycleTime >= CYCLETIME) { lastCycleTime = currentTimeMS; cycleNum++; // Sent every 125ms sendAccel(); sendTelemetryTail(); if ((cycleNum % 4) == 0) // Sent every 500ms { sendBaro(); sendHeading(); sendTelemetryTail(); } if ((cycleNum % 8) == 0) // Sent every 1s { sendTemperature1(); if (feature(FEATURE_VBAT)) { sendVoltage(); sendVoltageAmp(); } if (sensors(SENSOR_GPS)) sendGPS(); sendTelemetryTail(); } if (cycleNum == 40) //Frame 3: Sent every 5s { cycleNum = 0; sendTime(); sendTelemetryTail(); } } }
void sendTelemetry(void) { if (mcfg.telemetry_softserial == TELEMETRY_UART && !f.ARMED) return; if (serialTotalBytesWaiting(core.telemport) != 0) return; if (millis() - lastCycleTime >= CYCLETIME) { lastCycleTime = millis(); cycleNum++; // Sent every 125ms sendAccel(); sendTelemetryTail(); if ((cycleNum % 4) == 0) { // Sent every 500ms sendBaro(); sendHeading(); sendTelemetryTail(); } if ((cycleNum % 8) == 0) { // Sent every 1s sendTemperature1(); if (feature(FEATURE_VBAT)) { sendVoltage(); sendVoltageAmp(); } if (sensors(SENSOR_GPS)) sendGPS(); sendTelemetryTail(); } if (cycleNum == 40) { //Frame 3: Sent every 5s cycleNum = 0; sendTime(); sendTelemetryTail(); } } }
void handleFrSkyTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle) { if (!frskyTelemetryEnabled) { return; } uint32_t now = millis(); if (!hasEnoughTimeLapsedSinceLastTelemetryTransmission(now)) { return; } lastCycleTime = now; cycleNum++; // Sent every 125ms sendAccel(); sendVario(); sendTelemetryTail(); if ((cycleNum % 4) == 0) { // Sent every 500ms if (lastCycleTime > DELAY_FOR_BARO_INITIALISATION) { //Allow 5s to boot correctly sendBaro(); } sendHeading(); sendTelemetryTail(); } if ((cycleNum % 8) == 0) { // Sent every 1s sendTemperature1(); sendThrottleOrBatterySizeAsRpm(rxConfig, deadband3d_throttle); if (feature(FEATURE_VBAT)) { sendVoltage(); sendVoltageAmp(); sendAmperage(); sendFuelLevel(); } #ifdef GPS if (sensors(SENSOR_GPS)) { sendSpeed(); sendGpsAltitude(); sendSatalliteSignalQualityAsTemperature2(); sendGPSLatLong(); } else { sendFakeLatLongThatAllowsHeadingDisplay(); } #else sendFakeLatLongThatAllowsHeadingDisplay(); #endif sendTelemetryTail(); } if (cycleNum == 40) { //Frame 3: Sent every 5s cycleNum = 0; sendTime(); sendTelemetryTail(); } }
void handleFrSkyTelemetry(void) { if (!canSendFrSkyTelemetry()) { return; } uint32_t now = millis(); if (!hasEnoughTimeLapsedSinceLastTelemetryTransmission(now)) { return; } lastCycleTime = now; cycleNum++; // Sent every 125ms sendAccel(); sendVario(); sendTelemetryTail(); if ((cycleNum % 4) == 0) { // Sent every 500ms if (lastCycleTime > DELAY_FOR_BARO_INITIALISATION) { //Allow 5s to boot correctly sendBaro(); } sendHeading(); sendTelemetryTail(); } if ((cycleNum % 8) == 0) { // Sent every 1s sendTemperature1(); sendThrottleOrBatterySizeAsRpm(); if (feature(FEATURE_VBAT)) { sendVoltage(); sendVoltageAmp(); sendAmperage(); sendFuelLevel(); } #ifdef GPS if (sensors(SENSOR_GPS)) { sendSpeed(); sendGpsAltitude(); sendSatalliteSignalQualityAsTemperature2(); } #endif // Send GPS information to display compass information if (sensors(SENSOR_GPS) || (telemetryConfig->gpsNoFixLatitude != 0 && telemetryConfig->gpsNoFixLongitude != 0)) { sendGPS(); } sendTelemetryTail(); } if (cycleNum == 40) { //Frame 3: Sent every 5s cycleNum = 0; sendTime(); sendTelemetryTail(); } }