Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 150 → Rev 151

/trunk/GPS.c
556,7 → 556,11
if(CheckDelay(WPTime))
{
GPS_pWaypoint = WPList_Next(); // goto to next waypoint, return NULL if end of list has been reached
if(GPS_pWaypoint == NULL) GPS_pWaypoint = WPList_Begin(); // reset WPList to begin
if(GPS_pWaypoint == NULL) GPS_pWaypoint = WPList_End(); // goto last WP if next one not exist
if(GPS_pWaypoint != NULL) // if new WP exist
{ // update WP hold time stamp immediately!
WPTime = SetDelay(GPS_pWaypoint->HoldTime * 1000); // update hold time stamp
}
NCFlags &= ~NC_FLAG_TARGET_REACHED;
}
} // EOF if(WPArrived)
/trunk/Navi-Ctrl.Uv2
176,7 → 176,7
ALDICDR ()
ALDMISC ()
ALDSCAT (.\scripts\flash_str9.ld)
OPTDL (SARM.DLL)(-cSTR91x)(DARMST9.DLL)(-pSTR911)(SARM.DLL)(-cSTR91x)(TARMST9.DLL)(-pSTR911)
OPTDL (SARM.DLL)(-cSTR91x)(DARMST9.DLL)(-pSTR910)(SARM.DLL)(-cSTR91x)(TARMST9.DLL)(-pSTR910)
OPTDBG 48126,0,()()()()()()()()()() (BIN\UL2ARM.DLL)()()()
FLASH1 { 9,0,0,0,1,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0 }
FLASH2 (BIN\UL2ARM.DLL)
/trunk/main.h
4,7 → 4,7
 
#define VERSION_MAJOR 0
#define VERSION_MINOR 16
#define VERSION_PATCH 5
#define VERSION_PATCH 6
 
#define VERSION_SERIAL_MAJOR 10
#define VERSION_SERIAL_MINOR 1
/trunk/mkprotocol.c
91,6 → 91,8
if(pTxBuff->Locked == FALSE)
{ // tx-buffer is not in use
// lock the buffer
pTxBuff->Locked = TRUE;
pTxBuff->Position = 0;
pTxBuff->pData[pTxBuff->Position++] = '#'; // Start character
pTxBuff->pData[pTxBuff->Position++] = 'a' + Address; // Address (a=0; b=1,...)
162,7 → 164,6
pTxBuff->pData[pTxBuff->Position++] = '\r';
pTxBuff->DataBytes = pTxBuff->Position;
pTxBuff->Position = 0; // reset buffer position for transmision
pTxBuff->Locked = TRUE; // mark as used
} // EOF buffer not in use
}
 
/trunk/uart0.c
379,17 → 379,17
UART0_Transmit(); // output pending bytes in tx buffer
if(UART0_tx_buffer.Locked == TRUE) return;
 
if(UART0_Request_ErrorMessage && (UART0_tx_buffer.Locked == FALSE))
else if(UART0_Request_ErrorMessage && (UART0_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART0_tx_buffer, 'E', NC_ADDRESS, 1, (u8 *)&ErrorMSG, sizeof(ErrorMSG));
UART0_Request_ErrorMessage = FALSE;
}
if(UART0_Request_VersionInfo && (UART0_tx_buffer.Locked == FALSE))
else if(UART0_Request_VersionInfo && (UART0_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART0_tx_buffer, 'V', NC_ADDRESS,1, (u8 *)&UART_VersionInfo, sizeof(UART_VersionInfo));
UART0_Request_VersionInfo = FALSE;
}
if(( (UART0_NaviData_Interval && CheckDelay(UART0_NaviData_Timer) ) || UART0_Request_NaviData) && (UART0_tx_buffer.Locked == FALSE))
else if(( ((UART0_NaviData_Interval >0) && CheckDelay(UART0_NaviData_Timer) ) || UART0_Request_NaviData) && (UART0_tx_buffer.Locked == FALSE))
{
NaviData.Errorcode = ErrorCode;
MKProtocol_CreateSerialFrame(&UART0_tx_buffer, 'O', NC_ADDRESS,1, (u8 *)&NaviData, sizeof(NaviData));
/trunk/uart1.c
529,24 → 529,30
Echo = 0; // reset echo value
UART1_Request_Echo = FALSE;
}
if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
else if((UART1_Request_DebugLabel != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'A', NC_ADDRESS, 2, &UART1_Request_DebugLabel, sizeof(UART1_Request_DebugLabel), (u8 *) ANALOG_LABEL[UART1_Request_DebugLabel], 16);
UART1_Request_DebugLabel = 0xFF;
}
if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_ConfirmFrame && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'B', NC_ADDRESS, 1, &UART1_ConfirmFrame, sizeof(UART1_ConfirmFrame));
UART1_ConfirmFrame = 0;
}
if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE))
else if(( ((UART1_NaviData_Interval > 0) && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE))
{
NaviData.Errorcode = ErrorCode;
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS,1, (u8 *)&NaviData, sizeof(NaviData));
UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval);
UART1_Request_NaviData = FALSE;
}
else if( (( (UART1_DebugData_Interval > 0) && CheckDelay(UART1_DebugData_Timer)) || UART1_Request_DebugData) && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'D', NC_ADDRESS, 1,(u8 *)&DebugOut, sizeof(DebugOut));
UART1_DebugData_Timer = SetDelay(UART1_DebugData_Interval);
UART1_Request_DebugData = FALSE;
}
 
if((( (UART1_Data3D_Interval > 0) && CheckDelay(UART1_Data3D_Timer) ) || UART1_Request_Data3D) && (UART1_tx_buffer.Locked == FALSE))
else if((( (UART1_Data3D_Interval > 0) && CheckDelay(UART1_Data3D_Timer) ) || UART1_Request_Data3D) && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'C', NC_ADDRESS, 1,(u8 *)&Data3D, sizeof(Data3D));
UART1_Data3D_Timer = SetDelay(UART1_Data3D_Interval);
553,12 → 559,12
UART1_Request_Data3D = FALSE;
}
 
if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_Request_ExternalControl && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'G', NC_ADDRESS, 1, (u8 *)&ExternControl, sizeof(ExternControl));
UART1_Request_ExternalControl = FALSE;
}
if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_Request_Display && (UART1_tx_buffer.Locked == FALSE))
{
LCD_PrintMenu();
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'H', NC_ADDRESS, 2, &UART1_DisplayLine, sizeof(UART1_DisplayLine), (u8*)&DisplayBuff[UART1_DisplayLine * 20], 20);
566,30 → 572,23
if(UART1_DisplayLine >= 4) UART1_DisplayLine = 0;
UART1_Request_Display = FALSE;
}
if(UART1_Request_Display1 && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_Request_Display1 && (UART1_tx_buffer.Locked == FALSE))
{
LCD_PrintMenu();
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'L', NC_ADDRESS, 3, (u8*)&MenuItem, sizeof(MenuItem), (u8*)&MaxMenuItem, sizeof(MaxMenuItem),(u8*)DisplayBuff, sizeof(DisplayBuff));
UART1_Request_Display1 = FALSE;
}
if(UART1_Request_VersionInfo && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_Request_VersionInfo && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'V', NC_ADDRESS,1, (u8 *)&UART_VersionInfo, sizeof(UART_VersionInfo));
UART1_Request_VersionInfo = FALSE;
}
if(( (UART1_NaviData_Interval && CheckDelay(UART1_NaviData_Timer) ) || UART1_Request_NaviData) && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_Request_ErrorMessage && (UART1_tx_buffer.Locked == FALSE))
{
NaviData.Errorcode = ErrorCode;
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'O', NC_ADDRESS,1, (u8 *)&NaviData, sizeof(NaviData));
UART1_NaviData_Timer = SetDelay(UART1_NaviData_Interval);
UART1_Request_NaviData = FALSE;
}
if(UART1_Request_ErrorMessage && (UART1_tx_buffer.Locked == FALSE))
{
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'E', NC_ADDRESS, 1, (u8 *)&ErrorMSG, sizeof(ErrorMSG));
UART1_Request_ErrorMessage = FALSE;
}
if(UART1_Request_SendFollowMe && (UART1_tx_buffer.Locked == FALSE) && (GPSData.NumOfSats >= 4)) // sending for "Follow me"
else if(UART1_Request_SendFollowMe && (UART1_tx_buffer.Locked == FALSE) && (GPSData.NumOfSats >= 4)) // sending for "Follow me"
{
GPS_CopyPosition(&(GPSData.Position),&(FollowMe.Position));
FollowMe.Position.Status = NEWDATA;
604,13 → 603,13
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 's', NC_ADDRESS, 1, (u8 *)&FollowMe, sizeof(FollowMe));
UART1_Request_SendFollowMe = FALSE;
}
if(UART1_Request_NewWaypoint && (UART1_tx_buffer.Locked == FALSE))
else if(UART1_Request_NewWaypoint && (UART1_tx_buffer.Locked == FALSE))
{
u8 WPNumber = WPList_GetCount();
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'W', NC_ADDRESS, 1, &WPNumber, sizeof(WPNumber));
UART1_Request_NewWaypoint = FALSE;
}
if((UART1_Request_ReadWaypoint != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
else if((UART1_Request_ReadWaypoint != 0xFF) && (UART1_tx_buffer.Locked == FALSE))
{
u8 WPNumber = WPList_GetCount();
if (UART1_Request_ReadWaypoint < WPNumber)
/trunk/waypoints.c
89,7 → 89,7
WPList[i].Heading = -1;
WPList[i].ToleranceRadius = 0; // in meters, if the MK is within that range around the target, then the next target is triggered
WPList[i].HoldTime = 0; // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered
WPList[i].Event_Flag = 0; // future implementation
WPList[i].Event_Flag = 0; // future implementation
}
return TRUE;
}
116,12 → 116,28
Waypoint_t* WPList_Begin(void)
{
WPIndex = 0; // reset list index
NaviData.WaypointIndex = WPIndex;
NaviData.WaypointIndex = WPIndex + 1;
if(WPNumber > 0) return(&(WPList[WPIndex])); // if list is not empty return pointer to first waypoint in the list
else return NULL; // else return NULL
 
}
 
// jump to the end of the list, and returns the last waypoint
Waypoint_t* WPList_End(void)
{
if(WPNumber > 0)
{
NaviData.WaypointIndex = WPNumber;
WPIndex = WPNumber - 1;
return(&(WPList[WPIndex])); // if list is not empty return pointer to first waypoint in the list
}
else
{
return NULL; // else return NULL
}
 
}
 
// returns a pointer to the next waypoint or NULL if the end of the list has been reached
Waypoint_t* WPList_Next(void)
{
128,7 → 144,7
if((WPIndex + 1) < WPNumber) // if the next WPIndex exist
{
WPIndex++; // goto next
NaviData.WaypointIndex = WPIndex;
NaviData.WaypointIndex = WPIndex + 1;
return(&(WPList[WPIndex])); // return pointer to this waypoint
}
else return(NULL);
/trunk/waypoints.h
18,6 → 18,7
u8 WPList_GetCount(void);
u8 WPList_Append(Waypoint_t* pwp);
Waypoint_t* WPList_Begin(void);
Waypoint_t* WPList_End(void);
Waypoint_t* WPList_Next(void);
Waypoint_t* WPList_GetAt(u8 index);