HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Oct 20, 2014, 05:49 AM
Registered User
Joined May 2014
22 Posts
Discussion
Frsky telemetry send alarm

I work on a project around arduino and i want to send an alarm through the telemetry to the taranis transmitter and see or hear this alarm !

this is my actual code:
Code:
#ifdef FRSKYSPORT
// Frsky Sensor-ID to use. 
#define SENSOR_ID_RPM           0xE4
// Frsky-specific
#define START_STOP              0x7e
#define DATA_FRAME              0x10
//Frsky DATA ID's 
#define FR_ID_RPM_FIRST         0x0500
#define FR_ID_RPM_LAST          0x050F 
//Frsky pin-telemetry
#define PIN_SPORT               1//ne pas utiliser la pin TX(1)
//Baud Rate speed
#define _FrSkySPort_BAUD        57600

/*<SoftSerial> identique a la librairie <SoftwareSerial> , mais utilise la librairie <TinyPinChange> 
qui autorise le choix de la pin qui recoit les interruptions.*/
#include <SoftSerial.h>
SoftSerial _FrSkySPort_Serial(PIN_SPORT, PIN_SPORT,true); // RX, TX

short crc;// used for crc calc of frsky-packet
boolean waitingForSensorId = false;
uint8_t nextDefault = 0;

// ***********************************************************************
void FrSkySPort_Init(void)  {
  _FrSkySPort_Serial.begin(_FrSkySPort_BAUD);
}

// ***********************************************************************
void FrSkySPort_Update(void) {
  uint8_t data = 0;
  while ( _FrSkySPort_Serial.available()) 
  {
    data =  _FrSkySPort_Serial.read();
    if(data == START_STOP)
    {
      waitingForSensorId = true; 
      continue; 
    }
    if(!waitingForSensorId)
      continue;
    FrSkySPort_ProcessSensorRequest(data);
    waitingForSensorId = false;
  }
}

// ***********************************************************************
void FrSkySPort_ProcessSensorRequest(uint8_t sensorId) 
{
  switch(sensorId)
  {
  case SENSOR_ID_RPM:
    FrSkySPort_SendPackage(FR_ID_RPM_FIRST,vitesse1 * nbPales );//  * 2 if number of blades on Taranis is set to 2
    FrSkySPort_SendPackage(FR_ID_RPM_LAST,vitesse2 * nbPales);//  * 2 if number of blades on Taranis is set to 2
    break;
  }
}

// ***********************************************************************
void FrSkySPort_SendByte(uint8_t byte) {
  _FrSkySPort_Serial.write(byte);
  // CRC update
  crc += byte;         //0-1FF
  crc += crc >> 8;   //0-100
  crc &= 0x00ff;
  crc += crc >> 8;   //0-0FF
  crc &= 0x00ff;
}

// ***********************************************************************
void FrSkySPort_SendCrc() {
  _FrSkySPort_Serial.write(0xFF-crc);
  crc = 0;          // CRC reset
}

// ***********************************************************************
void FrSkySPort_SendPackage(uint16_t id, uint32_t value) {

 // _FrSkySPort_C3 |= 32;      //  Transmit direction, to S.Port
  FrSkySPort_SendByte(DATA_FRAME);
  uint8_t *bytes = (uint8_t*)&id;
  FrSkySPort_SendByte(bytes[0]);
  FrSkySPort_SendByte(bytes[1]);
  bytes = (uint8_t*)&value;
  FrSkySPort_SendByte(bytes[0]);
  FrSkySPort_SendByte(bytes[1]);
  FrSkySPort_SendByte(bytes[2]);
  FrSkySPort_SendByte(bytes[3]);
  FrSkySPort_SendCrc();
  _FrSkySPort_Serial.flush();
 // _FrSkySPort_C3 ^= 32;      // Transmit direction, from S.Port

}

void sendAlarmToFrskySport()
{
//code to add here ...  
}
#endif
This code send the speeds of two glow motors (in rpm) .
I want an alarm when one motor is off !!!
Is it possible to do that with the Frsky Sport telemetry ?

Thanks for your help !

Pierre
pierrotm777 is online now Find More Posts by pierrotm777
Last edited by pierrotm777; Oct 21, 2014 at 03:57 AM.
Reply With Quote
Sign up now
to remove ads between posts
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Sold Turnigy 9XR, FrSky XJT Telemetry module, and FrSky LCD Telemetry display jimstreet Aircraft - General - Radio Equipment (FS/W) 1 Apr 06, 2014 02:26 PM
Discussion Lost Plane Alarm - Recommend One that doesn't send SOS? jcowgar FPV Equipment 0 Nov 08, 2013 04:01 PM
Discussion Frsky Telemetry voltage alarms Chris True Radios 6 Oct 25, 2012 01:30 AM
Discussion Connectng FrSky telemetry to FrSky module?? ZSimon Radios 5 Aug 16, 2012 04:19 PM
Sold FrSky Futaba Telemetry Module and Telemetry Receiver Dan777 Aircraft - General - Radio Equipment (FS/W) 1 Jul 08, 2012 09:46 PM