From 93c18d2c8af97da51004032152f5a8cd290531e3 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 11 Nov 2023 15:48:21 +0800 Subject: [PATCH] remove some warning --- chip/basic/chip_helper.cpp | 5 +++-- components/hardware/uart/zuart_helper.cpp | 2 +- components/mini_servo_motor/feite_servo_motor.cpp | 2 +- components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp | 6 +++--- components/sensors/smtp2/smtp2.cpp | 2 +- os/zos_thread.hpp | 2 +- os/zthread.cpp | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/chip/basic/chip_helper.cpp b/chip/basic/chip_helper.cpp index 53f4fd4..7431f3e 100644 --- a/chip/basic/chip_helper.cpp +++ b/chip/basic/chip_helper.cpp @@ -335,14 +335,15 @@ IRQn_Type chip_tim_get_irq(TIM_HandleTypeDef* tim) { uint32_t chip_get_timer_clock_sorce_freq(TIM_HandleTypeDef* tim) { uint32_t timClkFreq = 0; +#if 0 uint32_t pclk1Freq = HAL_RCC_GetPCLK1Freq(); uint32_t pclk2Freq = HAL_RCC_GetPCLK2Freq(); uint32_t sysClkFreq = HAL_RCC_GetSysClockFreq(); +#endif uint32_t pFLatency; RCC_ClkInitTypeDef clkconfig; HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); - bool isAPB2 = false; #ifdef TIM1 @@ -409,7 +410,7 @@ bool chip_calculate_prescaler_and_autoreload_by_expect_freq(uint32_t timerInClk, arr = arr - 1; psc = psc - 1; - uint16_t comparevalue = 50 / 100.0 * arr; + // uint16_t comparevalue = 50 / 100.0 * arr; *prescaler = psc; *autoreload = arr; diff --git a/components/hardware/uart/zuart_helper.cpp b/components/hardware/uart/zuart_helper.cpp index 4712a9a..7a07495 100644 --- a/components/hardware/uart/zuart_helper.cpp +++ b/components/hardware/uart/zuart_helper.cpp @@ -5,7 +5,7 @@ using namespace iflytop; #define __DEBUG 0 #if __DEBUG -static void dumphex(char* tag, uint8_t* data, uint8_t len) { +static void dumphex(const char* tag, uint8_t* data, uint8_t len) { printf("%s:", tag); for (int i = 0; i < len; i++) { printf("%02x ", data[i]); diff --git a/components/mini_servo_motor/feite_servo_motor.cpp b/components/mini_servo_motor/feite_servo_motor.cpp index d99c288..f979319 100644 --- a/components/mini_servo_motor/feite_servo_motor.cpp +++ b/components/mini_servo_motor/feite_servo_motor.cpp @@ -13,7 +13,7 @@ using namespace feite; return false; \ } -static void dumphex(char* tag, uint8_t* data, uint8_t len) { +static void dumphex(const char* tag, uint8_t* data, uint8_t len) { #if 0 printf("%s:", tag); for (int i = 0; i < len; i++) { diff --git a/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp b/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp index 56ae028..1d38615 100644 --- a/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp +++ b/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp @@ -61,7 +61,7 @@ int32_t MiniRobotCtrlModule::rotate(s32 speed, s32 torque, s32 run_time, action_ if (m_thread.getExitFlag() && run_time != 0) break; if (m_thread.getExitFlag() && run_time == 0) break; - if (run_time != 0 && zos_haspassedms(entertime) > run_time) { + if (run_time != 0 && (zos_haspassedms(entertime) > (uint32_t)run_time)) { stop(0); call_status_cb(status_cb, 0); break; @@ -363,7 +363,7 @@ int32_t MiniRobotCtrlModule::motor_move_to_torque(int32_t targetpos, int32_t tor while (true) { if (m_thread.getExitFlag()) break; - if (overtime != 0 && zos_haspassedms(entertime) > overtime) { + if (overtime != 0 && zos_haspassedms(entertime) > (uint32_t)overtime) { ZLOGI(TAG, "%d motor_move_to_torque %d overtime", m_module_id, m_id); stop(0); set_errorcode(err::kmotor_run_overtime); @@ -397,4 +397,4 @@ int32_t MiniRobotCtrlModule::motor_move_to_zero_backward(int32_t findzerospeed, int32_t MiniRobotCtrlModule::motor_read_pos(int32_t *pos) { if (!m_bus->getNowPos(m_id, *pos)) return err::ksubdevice_overtime; return 0; -} \ No newline at end of file +} diff --git a/components/sensors/smtp2/smtp2.cpp b/components/sensors/smtp2/smtp2.cpp index f3ef250..e93a4bf 100644 --- a/components/sensors/smtp2/smtp2.cpp +++ b/components/sensors/smtp2/smtp2.cpp @@ -392,7 +392,7 @@ int32_t SMTP2::sendcmd_block(const char* cmd, size_t txlen, char* rxbuf, size_t HAL_StatusTypeDef rxstatus = HAL_UART_Receive(m_uart, (uint8_t*)&rxbuf[rxnum], 1, 3); if (rxstatus != HAL_OK) break; if ('\n' == rxbuf[rxnum]) break; - if (rxnum >= rxbuflen - 2) break; + if (rxnum >= int(rxbuflen - 2)) break; } // printf("SMTP2:m_rxbuf:(%d) %s\n", rxnum, rxbuf); rxlen = rxnum; diff --git a/os/zos_thread.hpp b/os/zos_thread.hpp index d84e767..193ab67 100644 --- a/os/zos_thread.hpp +++ b/os/zos_thread.hpp @@ -4,7 +4,7 @@ namespace iflytop { class ZOSThread { osThreadId _defaultTaskHandle; - int _stack_size; + uint32_t _stack_size; osPriority _priority; function _func; const char* _threadname; diff --git a/os/zthread.cpp b/os/zthread.cpp index 1064277..ad2bc07 100644 --- a/os/zthread.cpp +++ b/os/zthread.cpp @@ -58,7 +58,7 @@ void ZThread::threadcb() { } void ZThread::init(const char *threadname, int stack_size, osPriority priority) { - int r_task_create = 0; + // int r_task_create = 0; ZASSERT(threadname); m_lock = xSemaphoreCreateMutex();