Example #1
0
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();
        }
    }
}
Example #3
0
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();
        }
    }
}
Example #4
0
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();
    }
}
Example #5
0
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();
    }
}
Example #6
0
/**
 * UART 3 - for wifi
 */
void uart3InturruptHandle(void) {
	unsigned long ulStatus;
	unsigned char ble[15];
	ble[14] = '\0';
	unsigned long val;
	bool msg = false;

//
// Get the interrrupt status.
//
	ulStatus = ROM_UARTIntStatus(UART3_BASE, true);

//
// Clear the asserted interrupts.
//
	ROM_UARTIntClear(UART3_BASE, ulStatus);

//
// Loop while there are characters in the receive FIFO.
//
	while (UARTCharsAvail(UART3_BASE)) {
		//
		// Read the next character from the UART and write it back to the UART.
		//
		val = UARTCharGetNonBlocking(UART3_BASE);
		ble[i] = val;
		if (val == '\n' || val == '\r' || i == 13) {
			i = -1;
			msg = true;
		}

//		UARTCharPutNonBlocking(UART3_BASE, val);
		i++;
	}
	if (msg) {
		if (strncmp((char*) ble, "gps", 3) == 0) {// && (strncmp((char*) ble, "accl", 4) == 0)
//					UARTCharPutNonBlocking(UART3_BASE, 'p');
			sendGPSData();
			msg = false;
//
		} else if (strncmp((char*) ble, "accl", 4) == 0) {
			sendAcclData();
			msg = false;
		} else if (strncmp((char*) ble, "mag", 3) == 0) {
			//sendMagnetoData();
			sendHeading();
			msg = false;
		} else if (strncmp((char*) ble, "ser", 3) == 0) {
			if (ble[3] == '+') {
				servoSet(servo, 1800);
			} else if (ble[3] == '-') {
				servoSet(servo, 1388);
			} else {
				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);

				//Delay for 1 millisecond.  Each SysCtlDelay is about 3 clocks.

				SysCtlDelay(SysCtlClockGet() / (1000 * 3));

				//Turn off the LED

				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);

				servoSet(servo, 1500);
			}

		}
		msg = false;
	}

}
Example #7
0
void portAIntHandler(void) {
	GPIOPinIntClear(GPIO_PORTA_BASE, GPIO_PIN_5);

	unsigned char irq = 0;
	nRF24L01_IRQ(&irq, recDataBuffer);
	if (irq & (1 << RX_DR)) {

		delay_ms(1); //IMPORTANT, delay > max retransmission delay

		if (strncmp((char*) recDataBuffer, "gps", 3) == 0) { // && (strncmp((char*) ble, "accl", 4) == 0)

			//nrf24l01p_send((unsigned char*) "lablala");
			//					UARTCharPutNonBlocking(UART3_BASE, 'p');
			sendGPSData();

			//
		} else if (strncmp((char*) recDataBuffer, "accl", 4) == 0) {
			sendAcclData();

		} else if (strncmp((char*) recDataBuffer, "mag", 3) == 0) {
			//sendMagnetoData();
			sendHeading();

		} else if (strncmp((char*) recDataBuffer, "ser", 3) == 0) {
			if (recDataBuffer[3] == '+') {
				servoSet(servo, 1800);
			} else if (recDataBuffer[3] == '-') {
				servoSet(servo, 1388);
			} else {
				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);

				//Delay for 1 millisecond.  Each SysCtlDelay is about 3 clocks.

				SysCtlDelay(SysCtlClockGet() / (1000 * 3));

				//Turn off the LED

				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);

				servoSet(servo, 1500);
			}

		}

	}

	//UARTprintf("irq %x", irq);
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3);
	SysCtlDelay(SysCtlClockGet() / (1000 * 2));
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0);

#ifdef DEBUG
	if (irq & (1 << MAX_RT)) {
		UARTprintf("Max_RT.\n");
	}
	if (irq & (1 << TX_DS)) {
		//UARTprintf("TX_DS.\n");
	}
	if (irq & (1 << RX_DR)) {
		UARTprintf("RX_DR\n");
	}
#endif

}