Browse Source

去掉部分警告

master
zhaohe 2 years ago
parent
commit
d69f8551a6
  1. 4
      chip/basic/logger.hpp
  2. 10
      chip/zuart.cpp
  3. 10
      components/cmdscheduler/cmd_scheduler.cpp
  4. 2
      components/cmdscheduler/cmd_scheduler.hpp
  5. 4
      components/dwin/text_displayer.cpp
  6. 5
      components/flash/znvs.cpp
  7. 5
      components/flash/znvs.hpp
  8. 10
      components/iflytop_can_slave_module_master_end/stepmotor.cpp
  9. 14
      components/iflytop_can_slave_module_master_end/stepmotor.hpp
  10. 2
      components/mini_servo_motor/feite_servo_motor.cpp
  11. 1
      components/motor_laser_code_scanner/motor_laser_code_scanne.cpp
  12. 1
      components/sensors/smtp2/smtp2.cpp
  13. 3
      components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  14. 2
      components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp
  15. 2
      components/zprotocols/zcancmder
  16. 16
      os/zoslogger.cpp
  17. 13
      os/zoslogger.hpp

4
chip/basic/logger.hpp

@ -18,7 +18,7 @@ extern bool g_enable_log;
#define ZEARLY_LOGD(TAG, fmt, ...) \
if (g_enable_log) { \
zchip_log("%08lu DEBU [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
}
#define ZEARLY_LOGE(TAG, fmt, ...) \
if (g_enable_log) { \
zchip_log("%08lu ERRO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
@ -36,7 +36,7 @@ extern bool g_enable_log;
zchip_clock_early_delayus(1000 * 1000); \
} \
}
void zchip_log(const char* fmt, ...);
void zchip_log(const char* fmt, ...) ;
void zchip_loggger_init(zchip_uart_t* huart);
void zchip_loggger_enable(bool enable);
}

10
chip/zuart.cpp

@ -1,10 +1,8 @@
#include "zuart.hpp"
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
using namespace iflytop;
static ZUART *s_uart_table[10];
@ -164,9 +162,13 @@ void ZUART::periodicJob() {
}
clearRxData();
}
if (m_isRxing) {
if (!(HAL_UART_GetState(m_huart) == HAL_UART_STATE_BUSY_RX || HAL_UART_GetState(m_huart) == HAL_UART_STATE_BUSY_TX_RX)) {
HAL_UART_Receive_IT(m_huart, &onebyte, 1);
}
}
}
/*******************************************************************************
* *
*******************************************************************************/

10
components/cmdscheduler/cmd_scheduler.cpp

@ -47,7 +47,7 @@ void CmdScheduler::schedule() {
}
}
// ZLOGI(TAG, "cmdstr2: %s %d %d", cmdstr, strlen(cmdstr),m_rxsize);
for (size_t i = 0; i < m_rxsize; i++) {
for (int i = 0; i < m_rxsize; i++) {
if (rxbuf[i] != '\0') {
ZLOGI(TAG, "docmd: %s", &rxbuf[i]);
int inext = strlen(&rxbuf[i]) + i;
@ -72,7 +72,9 @@ void CmdScheduler::callcmd(const char* cmd, CmdProcessContext& context) {
memset(argv, 0, sizeof(argv));
strcpy(cmdcache, cmd);
prase_cmd(cmdcache, strlen(cmdcache), argc, argv);
if(argc == 0){
return;
}
// printf("argc:%d\n", argc);
// for (size_t i = 0; i < argc; i++) {
// printf("argv[%d]:%s\n", i, argv[i]);
@ -96,7 +98,7 @@ void CmdScheduler::prase_cmd(char* input, int inputlen, int& argc, char* argv[])
}
int j = 0;
for (size_t i = 0; input[i] == 0 || i < inputlen; i++) {
for (int i = 0; input[i] == 0 || i < inputlen; i++) {
if (input[i] != 0 && j == 0) {
argv[argc++] = &input[i];
j = 1;
@ -108,4 +110,4 @@ void CmdScheduler::prase_cmd(char* input, int inputlen, int& argc, char* argv[])
continue;
}
}
}
}

2
components/cmdscheduler/cmd_scheduler.hpp

@ -26,7 +26,7 @@ class CmdScheduler {
bool m_dataisready = false;
char cmdcache[100];
char cmdcache[1024] = {0};
public:
void initialize(UART_HandleTypeDef* huart, uint32_t rxbufsize);

4
components/dwin/text_displayer.cpp

@ -52,9 +52,9 @@ void TextDisplayer::setFont(uint16_t EncodeMode, uint8_t font0id, uint8_t font1i
m_descript.TextLength = 256;
}
void TextDisplayer::setPos(uint16_t x, uint16_t y, uint16_t width, uint16_t hight) {
uint16_t startx = x;
// uint16_t startx = x;
uint16_t endx = x + width;
uint16_t starty = y;
// uint16_t starty = y;
uint16_t endy = y + hight;
m_descript.PosX = x;

5
components/flash/znvs.cpp

@ -5,6 +5,9 @@
#include "sdk\components\flash\zsimple_flash.hpp"
#define TAG "config"
#ifdef IFLYTOP_NVS_CONFIG_MAX_ITEM_NUM
using namespace iflytop;
using namespace std;
#define MARK_S 0x123456
@ -157,3 +160,5 @@ bool ZNVS::get_config_bool(const char* key, bool default_val) { GET_CFG(bool
void ZNVS::set_config_bool(const char* key, bool val) { SET_CFG(bool); }
void ZNVS::flush() { zsimple_flash_write((uint8_t*)&m_cfg, sizeof(m_cfg)); }
#endif

5
components/flash/znvs.hpp

@ -2,6 +2,8 @@
#include "project_configs.h"
#include "sdk/os/zos.hpp"
#ifdef IFLYTOP_NVS_CONFIG_MAX_ITEM_NUM
namespace iflytop {
using namespace std;
@ -75,4 +77,5 @@ class ZNVS {
cfg_t* get_and_create_cfg(const char* key, type_t type, uint8_t* default_val, uint8_t len);
};
} // namespace iflytop
} // namespace iflytop
#endif

10
components/iflytop_can_slave_module_master_end/stepmotor.cpp

@ -136,6 +136,16 @@ void StepMotor::clearException() {
}
m_canMaster->writeReg(m_id, m_baseCtrlPoint + SAMC_REG_ACT_CLEAR_EXCEPTION, 0, 20);
}
int32_t StepMotor::readpos() {
if (m_fakeMotorl) {
ZLOGE(TAG, "call stepmotor fail,motor is null");
return 0;
}
int32_t pos = 0;
m_canMaster->readReg(m_id, m_baseCtrlPoint + SAMC_REG_STAT_CURRENT_POS, pos, 20);
return pos;
}
namespace iflytop {
StepMotor g_nullStepMotor;

14
components/iflytop_can_slave_module_master_end/stepmotor.hpp

@ -28,13 +28,13 @@ class StepMotor {
bool setVelocity(int32_t velocity);
int32_t getVelocity();
bool setAcc(int32_t acc);
bool setDec(int32_t dec);
bool moveTo(int32_t pos);
bool moveBy(int32_t pos);
bool rotate(int32_t direction);
void clearException();
bool setAcc(int32_t acc);
bool setDec(int32_t dec);
bool moveTo(int32_t pos);
bool moveBy(int32_t pos);
bool rotate(int32_t direction);
int32_t readpos();
void clearException();
int32_t getPos();
bool stop();

2
components/mini_servo_motor/feite_servo_motor.cpp

@ -314,8 +314,8 @@ bool FeiTeServoMotor::tx_and_rx(uint8_t* tx, uint8_t txdatalen, uint8_t* rx, uin
uint32_t enter_ticket = HAL_GetTick();
dumphex("tx:", tx, txdatalen);
HAL_UART_Receive_DMA(m_uart, (uint8_t*)rx, expectrxsize);
HAL_UART_Transmit(m_uart, tx, txdatalen, 1000);
HAL_UART_Receive_DMA(m_uart, (uint8_t*)rx, expectrxsize);
bool overtime_flag = false;
while (HAL_UART_GetState(m_uart) == HAL_UART_STATE_BUSY_RX || //

1
components/motor_laser_code_scanner/motor_laser_code_scanne.cpp

@ -2,6 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sdk\components\zprotocols\errorcode\errorcode.hpp"
using namespace iflytop;

1
components/sensors/smtp2/smtp2.cpp

@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sdk\components\zprotocols\errorcode\errorcode.hpp"
using namespace iflytop;

3
components/step_motor_ctrl_module/step_motor_ctrl_module.cpp

@ -2,6 +2,7 @@
#include "sdk/components/errorcode/errorcode.hpp"
#include <stdlib.h>
using namespace iflytop;
#define TAG "StepMotorCtrlModule"
void StepMotorCtrlModule::initialize(int id, IStepperMotor* stepM, ZGPIO* zero_gpio, ZGPIO* end_gpio) {
@ -140,7 +141,7 @@ int32_t StepMotorCtrlModule::move_to_zero_with_calibrate(int32_t nowx, action_cb
return;
}
int32_t calibrate_x, calibrate_y;
int32_t calibrate_x;
calibrate_x = dx + nowx;
m_param.shift_x = calibrate_x;

2
components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

@ -29,7 +29,7 @@ void XYRobotCtrlModule::initialize(IStepperMotor* stepM1, //
int32_t XYRobotCtrlModule::move_to(int32_t x, int32_t y, action_cb_status_t status_cb) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "move_to x:%d y:%d", x, y);
int32_t m1pos, m2pos;
//int32_t m1pos, m2pos;
m_thread.stop();
/**
* @TODO:Ìí¼ÓÏÞλ¼ì²é

2
components/zprotocols/zcancmder

@ -1 +1 @@
Subproject commit fca927c9a222ea031e6516df2bdef9b7f1f300b7
Subproject commit 272fe1ac5a48f2093f87c7429bf444a15b0de097

16
os/zoslogger.cpp

@ -1,6 +1,20 @@
#include "zoslogger.hpp"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
iflytop::zmutex glog_mutex;
extern "C" {
void zos_loggger_init() { glog_mutex.init(); }
void zos_loggger_init() { glog_mutex.init(); }
void zos_log(const char* fmt, ...) {
if (g_enable_log) {
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
}
}
}

13
os/zoslogger.hpp

@ -12,36 +12,37 @@ extern bool g_enable_log;
#define ZLOG_RELEASE(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf(TAG "" fmt "\n", ##__VA_ARGS__); \
zos_log(TAG "" fmt "\n", ##__VA_ARGS__); \
}
#define ZLOGI(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu INFO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
zos_log("%08lu INFO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGD(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu DEBU [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
zos_log("%08lu DEBU [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGE(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu ERRO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
zos_log("%08lu ERRO [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZLOGW(TAG, fmt, ...) \
if (g_enable_log) { \
iflytop::zlock_guard lock(glog_mutex); \
printf("%08lu WARN [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
zos_log("%08lu WARN [%-8s] " fmt "\n", zchip_clock_get_ticket(), TAG, ##__VA_ARGS__); \
}
#define ZASSERT(cond) \
if (!(cond)) { \
while (1) { \
printf("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \
zos_log("ASSERT: %s [%s:%d]\n", #cond, __FILE__, __LINE__); \
zchip_clock_early_delayus(1000 * 1000); \
} \
}
void zos_log(const char* fmt, ...) ;
void zos_loggger_init();
}
Loading…
Cancel
Save