Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix strncpy/truncate warning; fix unused CRSF timing stats #5

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uin
count32b = (len + 3) / 4;
for (i = 0; i < count32b; i++, src += 4)
{
USBx_DFIFO(ch_ep_num) = *((__packed uint32_t *)src);
USBx_DFIFO((uint32_t)ch_ep_num) = *((uint32_t *)src);
}
}
return HAL_OK;
Expand All @@ -843,7 +843,7 @@ void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len)

for ( i = 0; i < count32b; i++, dest += 4 )
{
*(__packed uint32_t *)dest = USBx_DFIFO(0);
*(uint32_t *)dest = USBx_DFIFO(0);

}
return ((void *)dest);
Expand Down
2 changes: 1 addition & 1 deletion src/main/cms/cms.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
buff[0] = 0x0;
if ((p->type == OME_Submenu) && p->func && (p->flags & OPTSTRING)) {
// Special case of sub menu entry with optional value display.
char *str = ((CMSMenuOptFuncPtr)p->func)();
char *str = ((CMSMenuOptFuncPtr)(long)p->func)();
strncpy( buff, str, CMS_DRAW_BUFFER_LEN);
}
strncat(buff, ">", CMS_DRAW_BUFFER_LEN);
Expand Down
4 changes: 2 additions & 2 deletions src/main/cms/cms_menu_vtx_smartaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ static OSD_Entry saCmsMenuConfigEntries[] = {
{ "OP MODEL", OME_TAB, saCmsConfigOpmodelByGvar, &(OSD_TAB_t){ &saCmsOpmodel, 2, saCmsOpmodelNames }, DYNAMIC },
{ "FSEL MODE", OME_TAB, saCmsConfigFreqModeByGvar, &saCmsEntFselMode, DYNAMIC },
{ "PIT FMODE", OME_TAB, saCmsConfigPitFModeByGvar, &saCmsEntPitFMode, 0 },
{ "POR FREQ", OME_Submenu, (CMSEntryFuncPtr)saCmsORFreqGetString, &saCmsMenuPORFreq, OPTSTRING },
{ "POR FREQ", OME_Submenu, (CMSEntryFuncPtr)(long)saCmsORFreqGetString, &saCmsMenuPORFreq, OPTSTRING },
#ifdef USE_EXTENDED_CMS_MENUS
{ "STATX", OME_Submenu, cmsMenuChange, &saCmsMenuStats, 0 },
#endif /* USE_EXTENDED_CMS_MENUS */
Expand Down Expand Up @@ -534,7 +534,7 @@ static OSD_Entry saCmsMenuFreqModeEntries[] = {
{ "- SMARTAUDIO -", OME_Label, NULL, NULL, 0 },

{ "", OME_Label, NULL, saCmsStatusString, DYNAMIC },
{ "FREQ", OME_Submenu, (CMSEntryFuncPtr)saCmsUserFreqGetString, &saCmsMenuUserFreq, OPTSTRING },
{ "FREQ", OME_Submenu, (CMSEntryFuncPtr)(long)saCmsUserFreqGetString, &saCmsMenuUserFreq, OPTSTRING },
{ "POWER", OME_TAB, saCmsConfigPowerByGvar, &saCmsEntPower, 0 },
{ "SET", OME_Submenu, cmsMenuChange, &saCmsMenuCommence, 0 },
{ "CONFIG", OME_Submenu, cmsMenuChange, &saCmsMenuConfig, 0 },
Expand Down
11 changes: 6 additions & 5 deletions src/main/drivers/beesign.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ static uint8_t beesignCRC(const beesign_frame_t *pPackage) {
return crc;
}

static uint8_t beesignChkID(uint8_t id) {
UNUSED(id);
return BEESIGN_OK;
}
// compiler reports unused
//static uint8_t beesignChkID(uint8_t id) {
// UNUSED(id);
// return BEESIGN_OK;
//}

uint8_t beesignReceive(uint8_t **pRcvFrame) {
if (!receiveFrameValid) {
Expand Down Expand Up @@ -608,7 +609,7 @@ bool checkBeesignSerialPort(void) {

void beesignUpdate(timeUs_t currentTimeUs) {
UNUSED(currentTimeUs);
if (checkBeesignSerialPort) {
if (checkBeesignSerialPort()) {
#ifdef USE_OSD_BEESIGN
static uint32_t beesignTaskCounter = 0;
static uint32_t beesignSendNextCounterPoint = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/main/io/spektrum_vtx_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const uint8_t vtxBsPi[SPEKTRUM_VTX_POWER_COUNT] = {
#endif // USE_VTX_BEESIGN

uint8_t convertSpektrumVtxPowerIndex(uint8_t sPower) {
#if !(defined(USE_VTX_RTC6705) || defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP))
UNUSED(sPower);
#endif
uint8_t devicePower = 0;
const vtxDevice_t *vtxDevice = vtxCommonDevice();
switch (vtxCommonGetDeviceType(vtxDevice)) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/msc/usbd_msc_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@
#define USBD_MANUFACTURER_STRING "STMicroelectronics"
#define USBD_PRODUCT_HS_STRING "Mass Storage in HS Mode"
#define USBD_PRODUCT_FS_STRING "Mass Storage in FS Mode"
#define USBD_CONFIGURATION_HS_STRING "MSC Config"
#define USBD_INTERFACE_HS_STRING "MSC Interface"
#define USBD_CONFIGURATION_HS_STRING "MSC Config in HS Mode"
#define USBD_INTERFACE_HS_STRING "MSC Interface in HS Mode"
#define USBD_CONFIGURATION_FS_STRING "MSC Config in FS Mode"
#define USBD_INTERFACE_FS_STRING "MSC Interface in FS Mode"
/**
* @}
*/
Expand Down
8 changes: 4 additions & 4 deletions src/main/pg/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ PG_REGISTER_WITH_RESET_FN(boardConfig_t, boardConfig, PG_BOARD_CONFIG, 0);

void pgResetFn_boardConfig(boardConfig_t *boardConfig) {
if (boardInformationIsSet()) {
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH);
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
boardConfig->boardInformationSet = true;
} else {
#if !defined(GENERIC_TARGET)
strncpy(boardConfig->boardName, targetName, MAX_BOARD_NAME_LENGTH);
strncpy(boardConfig->boardName, targetName, MAX_BOARD_NAME_LENGTH + 1);
#if defined(TARGET_MANUFACTURER_IDENTIFIER)
strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH + 1);
#endif
boardConfig->boardInformationSet = true;
#else
Expand Down
1 change: 1 addition & 0 deletions src/main/rx/crsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ typedef struct crsfPayloadLinkstatistics_s {
} crsfLinkStatistics_t;

static void handleCrsfLinkStatisticsFrame(const crsfLinkStatistics_t* statsPtr, timeUs_t currentTimeUs) {
UNUSED(currentTimeUs);
const crsfLinkStatistics_t stats = *statsPtr;
CRSFsetLQ(stats.uplink_Link_quality);
CRSFsetRFMode(stats.rf_Mode);
Expand Down
7 changes: 4 additions & 3 deletions src/main/telemetry/ghst.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ static void ghstInitializeFrame(sbuf_t *dst)
sbufWriteU8(dst, GHST_ADDR_RX);
}

STATIC_UNIT_TESTED uint8_t *getGhstFrame(){
return ghstFrame;
}
//compiler reports unused
//STATIC_UNIT_TESTED uint8_t *getGhstFrame(){
// return ghstFrame;
//}

static void ghstFinalize(sbuf_t *dst)
{
Expand Down
8 changes: 4 additions & 4 deletions src/main/vcp_hal/usbd_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
#define USBD_MANUFACTURER_STRING FC_FIRMWARE_NAME
#define USBD_PRODUCT_HS_STRING "STM32 Virtual ComPort in HS Mode"
#define USBD_PRODUCT_FS_STRING "STM32 Virtual ComPort in FS Mode"
#define USBD_CONFIGURATION_HS_STRING "VCP Config"
#define USBD_INTERFACE_HS_STRING "VCP Interface"
#define USBD_CONFIGURATION_FS_STRING "VCP Config"
#define USBD_INTERFACE_FS_STRING "VCP Interface"
#define USBD_CONFIGURATION_HS_STRING "VCP Config in HS Mode"
#define USBD_INTERFACE_HS_STRING "VCP Interface in HS Mode"
#define USBD_CONFIGURATION_FS_STRING "VCP Config in FS Mode"
#define USBD_INTERFACE_FS_STRING "VCP Interface in FS Mode"

/* Private macro -------------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
Expand Down
Loading