2010-08-24 01:14:01 -03:00
|
|
|
#ifndef Waypoints_h
|
|
|
|
#define Waypoints_h
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "WProgram.h"
|
|
|
|
#include <avr/eeprom.h>
|
|
|
|
|
|
|
|
class Waypoints
|
|
|
|
{
|
|
|
|
public:
|
2010-09-07 02:43:08 -03:00
|
|
|
Waypoints();
|
2010-08-24 01:14:01 -03:00
|
|
|
|
|
|
|
struct WP {
|
|
|
|
uint8_t id; // for commands
|
|
|
|
int8_t p1; // for commands
|
|
|
|
int32_t alt; // Altitude in centimeters (meters * 100)
|
|
|
|
int32_t lat; // Lattitude * 10**7
|
|
|
|
int32_t lng; // Longitude * 10**7
|
|
|
|
};
|
2010-09-07 02:43:08 -03:00
|
|
|
|
2010-09-18 16:18:55 -03:00
|
|
|
WP get_waypoint_with_index(uint8_t i);
|
|
|
|
WP get_current_waypoint(void);
|
|
|
|
|
2010-09-07 02:43:08 -03:00
|
|
|
void set_waypoint_with_index(Waypoints::WP wp, uint8_t i);
|
2010-08-24 01:14:01 -03:00
|
|
|
|
2010-09-07 02:43:08 -03:00
|
|
|
void set_start_byte(uint16_t start_byte);
|
|
|
|
void set_wp_size(uint8_t wp_size);
|
2010-08-24 01:14:01 -03:00
|
|
|
|
2010-09-18 16:18:55 -03:00
|
|
|
void next_index(void);
|
2010-08-24 01:14:01 -03:00
|
|
|
uint8_t get_index(void);
|
|
|
|
void set_index(uint8_t i);
|
|
|
|
|
|
|
|
uint8_t get_total(void);
|
2010-09-07 02:43:08 -03:00
|
|
|
void set_total(uint8_t total);
|
2010-08-24 01:14:01 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint16_t _start_byte;
|
|
|
|
uint8_t _wp_size;
|
|
|
|
uint8_t _index;
|
|
|
|
uint8_t _total;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|