mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
Fix over-clever macro.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1344 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
bf59d7abc7
commit
f8ed279b14
@ -18,11 +18,11 @@ class AP_GPS_Shim : public GPS
{
|
||||
public:
|
||||
AP_GPS_Shim() : GPS(NULL) {}
|
||||
virtual void init(void) {};
|
||||
virtual bool read(void) {
bool updated = _updated;
_updated = false;
return _updated
};
|
||||
virtual bool read(void) {
bool updated = _updated;
_updated = false;
return _updated;
}
|
||||
|
||||
/// Set-and-mark-updated macro for the public member variables; each instance
|
||||
/// defines a member function set_<variable>(<type>)
|
||||
///
#define __GPS_SHIM_SET(__name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(time);
__GPS_SHIM_SET(latitude);
__GPS_SHIM_SET(longitude);
__GPS_SHIM_SET(altitude);
__GPS_SHIM_SET(ground_speed);
__GPS_SHIM_SET(ground_course);
__GPS_SHIM_SET(speed_3d);
__GPS_SHIM_SET(hdop);
#undef __GPS_SHIM_SET
private:
|
||||
///
#define __GPS_SHIM_SET(__type, __name) void set_##__name(__type v) { __name = v; _updated = true; }
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(time);
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(latitude);
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(longitude);
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(altitude);
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(ground_speed);
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(ground_course);
name) void set_##__name(typeof(GPS::__name) v) { __name = v; _updated = true; }
__GPS_SHIM_SET(speed_3d);
hdop);
#undef __GPS_SHIM_SET
private:
|
||||
bool _updated; ///< set anytime a member is updated, cleared when read() returns true
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user