Skip to content

Commit

Permalink
Bugfix: Mavlink message length (#644)
Browse files Browse the repository at this point in the history
* Mavlink GPS message length bugfix

Bugfix for when Message == buffer size.
Only identified to date with specific ublox failure message.
  • Loading branch information
ShikOfTheRa authored Oct 22, 2021
1 parent 959003b commit 9f5bb78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions MW_OSD/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@
//#define ADSBDEBUG // Debug only
#define ADSBTTL 10 // Timout in seconds for valid ADSB data
#define ADSB_LIMIT 500000 // Max distance of aircraft included in scope.
#define ADSB_ALT 1000 // Flash ADSB data if aircraft within this altitude differential and distance in meters. Disabled when used with ADSBSEND
#define ADSB_DIST 2000 // Flash ADSB data if aircraft within this distance and altitude differential in meters. Disabled when used with ADSBSEND
#define ADSB_ALT 0 // 1000 Flash ADSB data if aircraft within this altitude differential and distance in meters. 0 to disable flashing. Disabled when used with ADSBSEND
#define ADSB_DIST 0 // 2000 Flash ADSB data if aircraft within this distance and altitude differential in meters. 0 to disable flashing. Disabled when used with ADSBSEND
#define ADSBALTAGL // When enabled, uses / sends AGL (relative to launch) instead of ASL (above sea level). ASL is not possible with all systems. AGL: buddyflight / ASL: aviation
// The following is for "Buddy Flights" to track one other aircraft.
//#define BUDDYFLIGHT // Sends mavlink ADSB to share position status via simulated ADSB sent via OSD tx pin.
Expand Down
2 changes: 1 addition & 1 deletion MW_OSD/Screen.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ void formatDistance(int32_t t_d2f, uint8_t t_units, uint8_t t_type, uint8_t t_ic
}


void displayItem(uint16_t t_position, int16_t t_value, uint8_t t_leadicon, uint8_t t_trailicon, uint8_t t_pdec )
void displayItem(uint16_t t_position, int32_t t_value, uint8_t t_leadicon, uint8_t t_trailicon, uint8_t t_pdec )
{
/*
* t_position = screen position
Expand Down
12 changes: 4 additions & 8 deletions MW_OSD/SerialMAVLINK.ino
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ void serialMAVCheck() {
#ifdef MAV_STATUS
case MAVLINK_MSG_ID_STATUSTEXT:
severity = serialBuffer[0];
nullifymessage = 1;
if (severity <= Settings[S_MAV_ALARMLEVEL]) {
fcMessageLength = MAVLINK_MSG_ID_STATUSTEXT_LEN - 1;
for (uint8_t z = MAVLINK_MSG_ID_STATUSTEXT_LEN - 1; z >= 1; z--) {
fontData[z] = serialBuffer[z]; // steal unused fontdata array to save memory
if ((fontData[z] >= 97) && (fontData[z] <= 122)){ // convert to upper font
Expand All @@ -511,15 +511,11 @@ void serialMAVCheck() {
else{
fontData[z] = 0x20;
}
if (nullifymessage == 1) {
if ((serialBuffer[z] == 0) || (serialBuffer[z] == 0x20)) {
fontData[z] = SYM_BLANK;
}
else {
nullifymessage = 0;
if (serialBuffer[z] == 0)
{
fcMessageLength = z;
fontData[z] = 0;
}
}
}
timer.fcMessage = MAV_STATUS_TIMER;
}
Expand Down

0 comments on commit 9f5bb78

Please sign in to comment.