MSP_SET_RAW_GPS does not generate a response

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download

MSP_SET_RAW_GPS does not generate a response

Postby Tommie » Thu Jun 21, 2012 12:15 am

Due to an added break statement, MSP_SET_RAW_GPS does not generate a response while including unreachable code in its switch branch:

Code: Select all
   case MSP_SET_RAW_GPS:
     f.GPS_FIX = read8();
     GPS_numSat = read8();
     GPS_coord[LAT] = read32();
     GPS_coord[LON] = read32();
     GPS_altitude = read16();
     GPS_speed = read16();
     GPS_update |= 2; break;              // New data signalisation to GPS functions
     headSerialReply(0);
     break;


As a sidenote, is there any documentation what GPS_update should contain? Until recently, it was only used as a boolean flag, now it seems to be some kind of bitmask?
Tommie
 
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MSP_SET_RAW_GPS does not generate a response

Postby kos » Thu Jun 21, 2012 12:33 am

User avatar
kos
 
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: MSP_SET_RAW_GPS does not generate a response

Postby Tommie » Thu Jun 21, 2012 12:38 am

Yes, I am aware of that change. Did I mention that multiple instructions per line of code is considered harmful?
Tommie
 
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MSP_SET_RAW_GPS does not generate a response

Postby Alexinparis » Thu Jun 21, 2012 1:15 pm

ok, noted ;)
GPS_update was a boolean, and MIS (one OSD developper) found usefull to use the second bit for GPS_FROM_OSD feature.
for other needs it's still compatible with a boolean value.
Alexinparis
 
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MSP_SET_RAW_GPS does not generate a response

Postby Tommie » Thu Jun 21, 2012 1:17 pm

Please document such behaviour; code might rely on stuff like (GPS_Update == 1) and fail miserably.

Each variable should be accompanied by a comment describing its data format and purpose (e.g. it is not trivial to guess that headFreeHoldMode is not a boolean flag, but holds the reference heading in...what exactly? degrees? degrees/100?).
Tommie
 
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MSP_SET_RAW_GPS does not generate a response

Postby Mis » Thu Jun 21, 2012 9:38 pm

The "break;" instruction after GPS_update |= 2; is obviously wrong. Please remove this.
Mis
 
Posts: 203
Joined: Fri Apr 01, 2011 12:23 am


Return to Software development

Who is online

Users browsing this forum: No registered users and 2 guests

cron