1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

Whitespace tidy

This commit is contained in:
Martin Budden 2018-01-10 16:56:54 +00:00
parent 940d85e20b
commit 3747d6742b
50 changed files with 584 additions and 583 deletions

View file

@ -118,7 +118,7 @@ static uint8_t runcamDeviceReceivePacket(runcamDevice_t *device, uint8_t command
if (!runcamDeviceIsResponseReceiveDone(command, data, dataPos, &isDone)) {
return 0;
}
if (isDone) {
responseDataLen = dataPos;
break;
@ -180,11 +180,11 @@ static void runcamDeviceSendPacket(runcamDevice_t *device, uint8_t command, uint
static bool runcamDeviceSendRequestAndWaitingResp(runcamDevice_t *device, uint8_t commandID, uint8_t *paramData, uint8_t paramDataLen, uint8_t *outputBuffer, uint8_t *outputBufferLen)
{
int max_retries = 1;
// here using 1000ms as timeout, because the response from 5 key simulation command need a long time about >= 600ms,
// here using 1000ms as timeout, because the response from 5 key simulation command need a long time about >= 600ms,
// so set a max value to ensure we can receive the response
int timeoutMs = 1000;
int timeoutMs = 1000;
// only the command sending on initializing step need retry logic,
// only the command sending on initializing step need retry logic,
// otherwise, the timeout of 1000 ms is enough for the response from device
if (commandID == RCDEVICE_PROTOCOL_COMMAND_GET_DEVICE_INFO) {
max_retries = 5;
@ -254,7 +254,7 @@ static void sendCtrlCommand(runcamDevice_t *device, rcsplit_ctrl_argument_e argu
// get the device info(firmware version, protocol version and features, see the
// definition of runcamDeviceInfo_t to know more)
static bool runcamDeviceGetDeviceInfo(runcamDevice_t *device, uint8_t *outputBuffer)
static bool runcamDeviceGetDeviceInfo(runcamDevice_t *device, uint8_t *outputBuffer)
{
// Send "who are you" command to device to detect the device whether is running RCSplit FW1.0 or RCSplit FW1.1
int max_retries = 2;
@ -301,7 +301,7 @@ static bool runcamDeviceGetDeviceInfo(runcamDevice_t *device, uint8_t *outputBuf
}
}
return runcamDeviceSendRequestAndWaitingResp(device, RCDEVICE_PROTOCOL_COMMAND_GET_DEVICE_INFO, NULL, 0, outputBuffer, NULL);
return runcamDeviceSendRequestAndWaitingResp(device, RCDEVICE_PROTOCOL_COMMAND_GET_DEVICE_INFO, NULL, 0, outputBuffer, NULL);
}
static bool runcamDeviceSend5KeyOSDCableConnectionEvent(runcamDevice_t *device, uint8_t operation, uint8_t *outActionID, uint8_t *outErrorCode)
@ -514,7 +514,7 @@ static bool runcamDeviceDecodeSettings(sbuf_t *buf, runcamDeviceSetting_t *outSe
case RCDP_SETTING_PARSE_WAITING_ID: {
settingIterator->id = sbufReadU8(buf);
parseStep = RCDP_SETTING_PARSE_WAITING_NAME;
}
}
break;
case RCDP_SETTING_PARSE_WAITING_NAME: {
const char *str = (const char *)sbufConstPtr(buf);
@ -522,9 +522,9 @@ static bool runcamDeviceDecodeSettings(sbuf_t *buf, runcamDeviceSetting_t *outSe
memset(settingIterator->name, 0, RCDEVICE_PROTOCOL_MAX_SETTING_NAME_LENGTH);
strncpy(settingIterator->name, str, RCDEVICE_PROTOCOL_MAX_SETTING_NAME_LENGTH);
sbufAdvance(buf, nameLen);
parseStep = RCDP_SETTING_PARSE_WAITING_VALUE;
}
}
break;
case RCDP_SETTING_PARSE_WAITING_VALUE: {
const char *str = (const char *)sbufConstPtr(buf);
@ -535,7 +535,7 @@ static bool runcamDeviceDecodeSettings(sbuf_t *buf, runcamDeviceSetting_t *outSe
parseStep = RCDP_SETTING_PARSE_WAITING_ID;
settingIterator++;
}
}
break;
}
}
@ -627,7 +627,7 @@ bool runcamDeviceGetSettings(runcamDevice_t *device, uint8_t parentSettingID, ru
if (!runcamDeviceDecodeSettings(&dataBuf, outSettingList, maxSettingItemCount)) {
return false;
}
return true;
}
@ -648,13 +648,13 @@ static bool runcamDeviceDecodeSettingDetail(sbuf_t *buf, runcamDeviceSettingDeta
outSettingDetail->stepSize = sbufReadU8(buf);
break;
case RCDEVICE_PROTOCOL_SETTINGTYPE_UINT16:
case RCDEVICE_PROTOCOL_SETTINGTYPE_INT16:
case RCDEVICE_PROTOCOL_SETTINGTYPE_INT16:
outSettingDetail->value = sbufReadU16(buf);
outSettingDetail->minValue = sbufReadU16(buf);
outSettingDetail->maxValue = sbufReadU16(buf);
outSettingDetail->stepSize = sbufReadU8(buf);
break;
case RCDEVICE_PROTOCOL_SETTINGTYPE_FLOAT:
case RCDEVICE_PROTOCOL_SETTINGTYPE_FLOAT:
outSettingDetail->value = sbufReadU32(buf);
outSettingDetail->minValue = sbufReadU32(buf);
outSettingDetail->maxValue = sbufReadU32(buf);
@ -684,7 +684,7 @@ static bool runcamDeviceDecodeSettingDetail(sbuf_t *buf, runcamDeviceSettingDeta
result = strtok(NULL, delims);
i++;
}
}
}
break;
case RCDEVICE_PROTOCOL_SETTINGTYPE_STRING: {
const char *tmp = (const char *)sbufConstPtr(buf);
@ -692,7 +692,7 @@ static bool runcamDeviceDecodeSettingDetail(sbuf_t *buf, runcamDeviceSettingDeta
sbufAdvance(buf, strlen(tmp) + 1);
outSettingDetail->maxStringSize = sbufReadU8(buf);
}
}
break;
case RCDEVICE_PROTOCOL_SETTINGTYPE_FOLDER:
break;
@ -743,7 +743,7 @@ bool runcamDeviceWriteSetting(runcamDevice_t *device, uint8_t settingID, uint8_t
}
memset(response, 0, sizeof(runcamDeviceWriteSettingResponse_t));
response->resultCode = 1; // initialize the result code to failed
response->resultCode = 1; // initialize the result code to failed
uint8_t paramsBufLen = sizeof(uint8_t) + paramDataLen;
uint8_t paramsBuf[RCDEVICE_PROTOCOL_MAX_DATA_SIZE];