Browse Source

V606 修改移液枪指令重发次数和间隔

master
zhaohe 7 months ago
parent
commit
e10bbf237a
  1. 19
      sdk/components/sensors/smtp2_v2/smtp2_v2.cpp
  2. 2
      usrc/project_configs.h

19
sdk/components/sensors/smtp2_v2/smtp2_v2.cpp

@ -13,6 +13,9 @@ using namespace smtp2;
#define OVERTIME 100
#define DUMP_HEX 1
#define RE_SEND_TIMES 3
#define RE_SEND_DELAY 800
// 模式2
void SMTP2V2::initialize(UART_HandleTypeDef* uart, uint8_t id, DMA_HandleTypeDef* hdma_rx, DMA_HandleTypeDef* hdma_tx) {
m_uart = uart;
@ -383,15 +386,17 @@ int32_t SMTP2V2::runaction(bool dump, const char* format, ...) {
}
int32_t SMTP2V2::_runaction(bool dump, const char* cmd) {
for (size_t i = 0; i < 3; i++) {
for (size_t i = 0; i < RE_SEND_TIMES; i++) {
if (i != 0) {
ZLOGE(TAG, "resend cmd .......................................................");
osDelay(200);
osDelay(RE_SEND_DELAY);
}
if (!_sendcmd(dump, "/1T\r")) continue;
if (!_sendcmd(dump, "/1CR\r")) continue;
if (!_sendcmd(dump, cmd)) continue;
return getAckEcode();
}
return getAckEcode();
@ -403,11 +408,12 @@ int32_t SMTP2V2::readstate(bool dump, const char* format, ...) {
vsnprintf(cmdbuf, sizeof(cmdbuf), format, args);
va_end(args);
for (size_t i = 0; i < 3; i++) {
for (size_t i = 0; i < RE_SEND_TIMES; i++) {
if (_sendcmd(dump, cmdbuf)) {
return getAckEcode();
}
osDelay(200);
osDelay(RE_SEND_DELAY);
ZLOGI(TAG, "readstate fail retry %d", i);
}
return getAckEcode();
}
@ -418,11 +424,12 @@ int32_t SMTP2V2::setstate(bool dump, const char* format, ...) {
vsnprintf(cmdbuf, sizeof(cmdbuf), format, args);
va_end(args);
for (size_t i = 0; i < 3; i++) {
for (size_t i = 0; i < RE_SEND_TIMES; i++) {
if (_sendcmd(dump, cmdbuf)) {
return getAckEcode();
}
osDelay(20);
osDelay(RE_SEND_DELAY);
ZLOGI(TAG, "setstate fail retry %d", i);
}
return getAckEcode();
}

2
usrc/project_configs.h

@ -1,5 +1,5 @@
#pragma once
#define PC_VERSION 605
#define PC_VERSION 606
#define PC_MANUFACTURER "http://www.iflytop.com/"
#define PC_PROJECT_NAME "a8000_subboard"
#define PC_IFLYTOP_ENABLE_OS 1

Loading…
Cancel
Save