Skip to content

Commit

Permalink
FCS packets shown on display for other porotocols
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-ortega committed May 3, 2017
1 parent 534dd04 commit d33a44f
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 19 deletions.
17 changes: 5 additions & 12 deletions src/main/io/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extern int32_t telemetry_lat;
extern int32_t telemetry_lon;
extern int16_t telemetry_alt;
extern int16_t telemetry_sats;
extern uint8_t telemetry_failed_cs;
extern positionVector_t targetPosition;
extern positionVector_t trackerPosition;
extern bool gotFix;
Expand Down Expand Up @@ -632,23 +633,15 @@ void showCliModePage(void)
}

void showTelemetryPage(void){

uint16_t chars = 0;
uint8_t sentences = 0;
uint8_t failed_cs = 0;

uint8_t rowIndex = PAGE_TITLE_LINE_COUNT;
i2c_OLED_set_line(rowIndex++);
if(!PROTOCOL(TP_MFD)) {
if(PROTOCOL(TP_GPS_TELEMETRY)){
TinyGPS_stats(&chars,&sentences,&failed_cs);
}
if(telemetry_sats>99)
telemetry_sats = 99;
if(PROTOCOL(TP_GPS_TELEMETRY))
tfp_sprintf(lineBuffer, "Sats: %02d FCS:%d", telemetry_sats,failed_cs);
else
tfp_sprintf(lineBuffer, "Sats: %02d ", telemetry_sats);
//if(PROTOCOL(TP_GPS_TELEMETRY))
tfp_sprintf(lineBuffer, "Sats: %02d FCS:%d", telemetry_sats,telemetry_failed_cs);
//else
//tfp_sprintf(lineBuffer, "Sats: %02d ", telemetry_sats);
padLineBuffer();
i2c_OLED_set_line(rowIndex++);
i2c_OLED_send_string(lineBuffer);
Expand Down
3 changes: 2 additions & 1 deletion src/main/tracker/frskyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ void parseTelemHubByte(uint8_t c) {
frskyd_setAlt();
frskyd_setSats();
gotFix = true;
}
} else
telemetry_failed_cs++;
}

3 changes: 2 additions & 1 deletion src/main/tracker/frskyx.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ void processSportPacket(uint8_t *packet)
}
if ((NS == 'N' || NS == 'S') && (EW == 'E' || EW == 'W')) {
gotFix = true;
}
} else
telemetry_failed_cs++;
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/tracker/ltm.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ void ltm_encodeTargetData(uint8_t c) {
dataState = IDLE;
}
else { // wrong checksum, drop packet
dataState = IDLE;

dataState = IDLE;
telemetry_failed_cs++;
}
}
else LTM_Buffer[LTM_Index++]=c;
Expand Down
4 changes: 1 addition & 3 deletions src/main/tracker/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ bool gotAlt;
bool gotFix;
bool settingHome;
bool gotTelemetry=false;
bool lostTelemetry=false;
bool lostTelemetry=true;

//TRACKER STATE VARS
bool homeSet;
Expand Down Expand Up @@ -778,8 +778,6 @@ void updateReadTelemetry(void){

LED0_ON;



if(!PROTOCOL(TP_SERVOTEST)) {
gotTelemetry = true;
lostTelemetry = false;
Expand Down
2 changes: 2 additions & 0 deletions src/main/tracker/mavlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ void mavlink_encodeTargetData(uint8_t c) {
mavlink_message_t msg;
if (mavlink_parse_char(0, c, &msg, &status)) {
mavlink_handleMessage(&msg);
if (status.parse_error > 0)
telemetry_failed_cs++;
}
}

1 change: 1 addition & 0 deletions src/main/tracker/rvosd.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void rvosd_encodeTargetData(uint8_t c) {
}
else{
//needed?
telemetry_failed_cs++;
}
frame_started = false;
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/tracker/telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ int32_t telemetry_time = 0;
int32_t telemetry_date = 0;
int16_t telemetry_age = 0;

uint8_t telemetry_failed_cs = 0;

float telemetry_course = 0.0f;
float telemetry_speed = 0.0f;
float telemetry_declination = 0.0f;
Expand All @@ -47,6 +49,10 @@ uint8_t a;

uint8_t LOCAL_GPS;

uint16_t chars = 0;

uint8_t sentences = 0;

int32_t getTargetLat() {
return telemetry_lat;
}
Expand All @@ -64,6 +70,10 @@ uint16_t getSats() {
}

void encodeTargetData(uint8_t c) {

uint16_t chars = 0;
uint8_t sentences = 0;

if(PROTOCOL(TP_MFD))
mfd_encodeTargetData(c);
else if(PROTOCOL(TP_GPS_TELEMETRY))
Expand All @@ -83,6 +93,9 @@ void encodeTargetData(uint8_t c) {
}

void gps_encodeTargetData(uint8_t c) {
//if(PROTOCOL(TP_GPS_TELEMETRY)){
TinyGPS_stats(&chars,&sentences,&telemetry_failed_cs);
//}
if (TinyGPS_encode(c)) {
unsigned long fix_age;
get_position(&telemetry_lat, &telemetry_lon, &fix_age);
Expand Down
1 change: 1 addition & 0 deletions src/main/tracker/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern float telemetry_pitch;
extern float telemetry_roll;
extern float telemetry_yaw;
extern uint8_t telemetry_diy_gps;
extern uint8_t telemetry_failed_cs;

int16_t getTargetAlt();
void encodeTargetData(uint8_t c);
Expand Down

0 comments on commit d33a44f

Please sign in to comment.