/trunk/params.c |
---|
35,21 → 35,6 |
} |
break; |
case NCPARAMS_WP_LIST_LOAD: |
// read wp list from file |
if(PointList_ReadFromFile(*pvalue)) |
{ //and move all wp relative so that 1st wp gets current positition |
// PointList_Move(1, &GPSData.Position); |
} |
else PointList_Clear(); |
break; |
break; |
case NCPARAMS_WP_LIST_SAVE: |
PointList_SaveToFile(*pvalue); |
break; |
default: |
break; |
} |
/trunk/params.h |
---|
10,8 → 10,6 |
#define NCPARAMS_SHOW_TARGET 5 |
#define NCPARAMS_WP_EVENT_ONCE 6 |
#define NCPARAMS_WP_EVENT_FOREVER 7 |
#define NCPARAMS_WP_LIST_LOAD 8 |
#define NCPARAMS_WP_LIST_SAVE 9 |
#define NCPARAM_STATE_UNDEFINED 0 |
#define NCRARAM_STATE_VALID 1 |
/trunk/uart1.c |
---|
102,6 → 102,7 |
u8 UART1_Request_MotorData = FALSE; |
u8 UART1_Request_Echo = FALSE; |
u8 UART1_Request_ParameterId = 0; |
u8 UART1_Request_WPLStore = FALSE; |
u8 UART1_Request_Parameter = FALSE; |
u8 UART1_Request_SystemTime = FALSE; |
u8 UART1_DisplayKeys = 0; |
181,6 → 182,7 |
UART_VersionInfo_t UART_VersionInfo; |
NaviData_t NaviData; |
Data3D_t Data3D; |
WPL_Store_t WPL_Store; |
u16 Echo; // 2 bytes recieved will be sent back as echo |
u32 UART1_DebugData_Timer = 0; |
515,6 → 517,30 |
UART1_Request_ReadPoint = SerialMsg.pData[0]; |
break; |
case 'i':// Store WP List to file |
{ |
memcpy((u8*)&WPL_Store, SerialMsg.pData, sizeof(WPL_Store)); |
WPL_Store.Name[11] = 0; // make sure the string is terminated |
WPL_Store.reserved[0] = 0; |
if(WPL_Store.Index != 0) |
{ |
if(WPL_Store.Type == WPL_STORE_TYPE_REL) |
{ |
if(PointList_Move(1, &(GPSData.Position))) |
{ |
WPL_Store.reserved[0] = PointList_SaveToFile(WPL_Store.Index, WPL_Store.Name); |
} |
} |
else |
{ |
WPL_Store.reserved[0] = PointList_SaveToFile(WPL_Store.Index, WPL_Store.Name); |
} |
} |
UART1_Request_WPLStore = TRUE; |
} |
break; |
case 'j':// Set/Get NC-Parameter |
switch(SerialMsg.pData[0]) |
{ |
1014,6 → 1040,11 |
UART1_MotorData_Timer = SetDelay(UART1_MotorData_Interval); |
UART1_Request_MotorData = FALSE; |
} |
else if(UART1_Request_WPLStore) |
{ |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'I', NC_ADDRESS, 2,(u8 *)&(WPL_Store.Index), 1, (u8 *)&(WPL_Store.reserved[0]), 1 ); |
UART1_Request_WPLStore = FALSE; |
} |
else if((((NMEA_Interval > 0) && CheckDelay(NMEA_Timer))) && (UART1_tx_buffer.Locked == FALSE)) |
{ |
CreateNmeaGGA(); |
/trunk/uart1.h |
---|
87,8 → 87,18 |
s16 Compass; // angle between north and head of the MK |
} __attribute__((packed)) Attitude_t; |
#define WPL_STORE_TYPE_REL 0 |
#define WPL_STORE_TYPE_ABS 1 |
typedef struct |
{ |
u8 Index; |
u8 Type; |
u8 reserved[8]; |
s8 Name[12]; |
} __attribute__((packed)) WPL_Store_t; |
typedef struct |
{ |
u16 Distance; // distance to target in dm |
s16 Bearing; // course to target in deg |
} __attribute__((packed)) GPS_PosDev_t; |
/trunk/waypoints.c |
---|
355,7 → 355,7 |
#define LINE_MAX 70 |
#define WP_FILE_VERSION_COMPATIBLE 3 |
// save actual point list to SD card |
u8 PointList_SaveToFile(u8 place) |
u8 PointList_SaveToFile(u8 place, s8 * name) |
{ |
File_t *fp; |
s8 wpline[LINE_MAX], retval = 0; |
379,6 → 379,8 |
} |
// Create general section and key entries |
fputs_("[General]\r\n", fp); |
sprintf(wpline, "Name=%s\r\n", name); |
fputs_(wpline, fp); |
sprintf(wpline, "FileVersion=%d\r\n", WP_FILE_VERSION_COMPATIBLE); |
fputs_(wpline, fp); |
sprintf(wpline, "NumberOfWaypoints=%d\r\n", PointCount); |
/trunk/waypoints.h |
---|
45,7 → 45,7 |
// returns pointer to actual POI |
Point_t* PointList_GetPOI(void); |
// save actual point list to SD card |
u8 PointList_SaveToFile(u8 place); |
u8 PointList_SaveToFile(u8 place, s8 * name); |
// load actual point list from SD card |
u8 PointList_ReadFromFile(u8 place); |
// move actual point list to ref pos., the point in the list marked by RefIndex get the RefPos afterwards |