mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-4 Flight/Telemetry More bug fixes after testing telemetry
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@506 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
27f56a014b
commit
bc472102b4
@ -88,9 +88,10 @@ static void exampleTask(void* parameters)
|
||||
ExampleSettingsGet(&settings);
|
||||
|
||||
// TODO: Remove, this is temporary for testing (force settings)
|
||||
// will remove when default setting values are implemented
|
||||
settings.StepDirection = EXAMPLESETTINGS_STEPDIRECTION_UP;
|
||||
settings.StepSize = 1;
|
||||
settings.UpdatePeriod = 10;
|
||||
settings.UpdatePeriod = 100;
|
||||
|
||||
// Get the object data
|
||||
ExampleObject2Get(&data);
|
||||
|
@ -121,7 +121,7 @@ int main()
|
||||
//xTaskCreate(TaskSDCard, (signed portCHAR *)"SDCard", configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 2), NULL);
|
||||
|
||||
/* Initialize modules */
|
||||
//SystemModInitialize();
|
||||
SystemModInitialize();
|
||||
TelemetryInitialize();
|
||||
//ExampleModEventInitialize();
|
||||
ExampleModPeriodicInitialize();
|
||||
|
@ -195,7 +195,7 @@ int32_t UAVTalkProcessInputStream(uint8_t rxbyte)
|
||||
if (rxCount == 4)
|
||||
{
|
||||
// Search for object, if not found reset state machine
|
||||
objId = (tmpBuffer[0] << 24) | (tmpBuffer[1] << 16) | (tmpBuffer[2] << 8) | (tmpBuffer[3]);
|
||||
objId = (tmpBuffer[3] << 24) | (tmpBuffer[2] << 16) | (tmpBuffer[1] << 8) | (tmpBuffer[0]);
|
||||
obj = UAVObjGetByID(objId);
|
||||
if (obj == 0)
|
||||
{
|
||||
@ -249,7 +249,7 @@ int32_t UAVTalkProcessInputStream(uint8_t rxbyte)
|
||||
tmpBuffer[rxCount++] = rxbyte;
|
||||
if (rxCount == 2)
|
||||
{
|
||||
instId = (tmpBuffer[0] << 8) | (tmpBuffer[1]);
|
||||
instId = (tmpBuffer[1] << 8) | (tmpBuffer[0]);
|
||||
cs = updateChecksum(cs, tmpBuffer, 2);
|
||||
rxCount = 0;
|
||||
// If there is a payload get it, otherwise receive checksum
|
||||
@ -276,7 +276,7 @@ int32_t UAVTalkProcessInputStream(uint8_t rxbyte)
|
||||
tmpBuffer[rxCount++] = rxbyte;
|
||||
if (rxCount == 2)
|
||||
{
|
||||
csRx = (tmpBuffer[0] << 8) | (tmpBuffer[1]);
|
||||
csRx = (tmpBuffer[1] << 8) | (tmpBuffer[0]);
|
||||
if (csRx == cs)
|
||||
{
|
||||
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
|
||||
@ -456,10 +456,10 @@ static int32_t sendSingleObject(UAVObjHandle obj, uint16_t instId, uint8_t type)
|
||||
// Setup type and object id fields
|
||||
objId = UAVObjGetID(obj);
|
||||
txBuffer[0] = type;
|
||||
txBuffer[1] = (uint8_t)((objId >> 24) & 0xFF);
|
||||
txBuffer[2] = (uint8_t)((objId >> 16) & 0xFF);
|
||||
txBuffer[3] = (uint8_t)((objId >> 8) & 0xFF);
|
||||
txBuffer[4] = (uint8_t)(objId & 0xFF);
|
||||
txBuffer[1] = (uint8_t)(objId & 0xFF);
|
||||
txBuffer[2] = (uint8_t)((objId >> 8) & 0xFF);
|
||||
txBuffer[3] = (uint8_t)((objId >> 16) & 0xFF);
|
||||
txBuffer[4] = (uint8_t)((objId >> 24) & 0xFF);
|
||||
|
||||
// Setup instance ID if one is required
|
||||
if (UAVObjIsSingleInstance(obj))
|
||||
@ -468,8 +468,8 @@ static int32_t sendSingleObject(UAVObjHandle obj, uint16_t instId, uint8_t type)
|
||||
}
|
||||
else
|
||||
{
|
||||
txBuffer[5] = (uint8_t)((instId >> 8) & 0xFF);
|
||||
txBuffer[6] = (uint8_t)(instId & 0xFF);
|
||||
txBuffer[5] = (uint8_t)(instId & 0xFF);
|
||||
txBuffer[6] = (uint8_t)((instId >> 8) & 0xFF);
|
||||
dataOffset = 7;
|
||||
}
|
||||
|
||||
@ -501,8 +501,8 @@ static int32_t sendSingleObject(UAVObjHandle obj, uint16_t instId, uint8_t type)
|
||||
// Calculate checksum
|
||||
cs = 0;
|
||||
cs = updateChecksum(cs, txBuffer, dataOffset+length);
|
||||
txBuffer[dataOffset+length] = (uint8_t)((cs >> 8) & 0xFF);
|
||||
txBuffer[dataOffset+length+1] = (uint8_t)(cs & 0xFF);
|
||||
txBuffer[dataOffset+length] = (uint8_t)(cs & 0xFF);
|
||||
txBuffer[dataOffset+length+1] = (uint8_t)((cs >> 8) & 0xFF);
|
||||
|
||||
// Send buffer
|
||||
if (outStream!=NULL) (*outStream)(txBuffer, dataOffset+length+CHECKSUM_LENGTH);
|
||||
|
Loading…
x
Reference in New Issue
Block a user