Subversion Repositories NaviCtrl

Rev

Rev 280 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

#ifndef _WAYPOINTS_H
#define _WAYPOINTS_H

#include "ubx.h"

#define POINT_TYPE_INVALID 255
#define POINT_TYPE_WP   0
#define POINT_TYPE_POI  1

extern u8 POIIndex;     // list index of GPS Point representing the current POI, can be maximal WPCount

typedef struct
{
        GPS_Pos_t Position;             // the gps position of the waypoint, see ubx.h for details
        s16 Heading;                    // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List
        u8  ToleranceRadius;    // in meters, if the MK is within that range around the target, then the next target is triggered
        u8  HoldTime;                   // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered
        u8  Event_Flag;                 // future implementation
        u8  Index;              // to indentify different waypoints, workaround for bad communications PC <-> NC
        u8  Type;                               // typeof Waypoint
        u8  WP_EventChannelValue;  //
    s16 DesiredAltitude;
        u8      ClimbingSpeed;
        u8  reserve[6];             // reserve
} __attribute__((packed)) Point_t;

extern Point_t* GPS_pPoi;                                               // pointer to the actual point of interrest
extern u8 POICount;


// Init List, return TRUE on success
u8 PointList_Init(void);
// Clear List, return TRUE on success
u8 PointList_Clear(void);
// Returns number of points in the list
u8 PointList_GetCount(void);
// return pointer to point at position
Point_t* PointList_GetAt(u8 index);
// appends a point to the list, returns TRUE on success
u8 PointList_Append(Point_t* pwp);
// goto the first WP in the list and return pointer to it
Point_t* PointList_WPBegin(void);
// goto the last WP in the list and return pointer to it
Point_t* PointList_WPEnd(void);
// goto next WP in the list and return pointer to it
Point_t* PointList_WPNext(void);
// disables waypoint function
void PointList_WPActive(u8 set);
// returns pointer to actual POI
Point_t* PointList_GetPOI(void);


#endif // _WAYPOINTS_H