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
Post Reply
Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

MSP_SET_RAW_GPS does not generate a response

Post by Tommie »

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?

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

Post by kos »


Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MSP_SET_RAW_GPS does not generate a response

Post by Tommie »

Yes, I am aware of that change. Did I mention that multiple instructions per line of code is considered harmful?

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MSP_SET_RAW_GPS does not generate a response

Post by Alexinparis »

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.

Tommie
Posts: 438
Joined: Sun Apr 08, 2012 9:50 am

Re: MSP_SET_RAW_GPS does not generate a response

Post by Tommie »

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?).

Mis
Posts: 203
Joined: Fri Apr 01, 2011 12:23 am

Re: MSP_SET_RAW_GPS does not generate a response

Post by Mis »

The "break;" instruction after GPS_update |= 2; is obviously wrong. Please remove this.

Post Reply