diff --git a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c index bba817877..2e4e8c88b 100755 --- a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c +++ b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c @@ -1197,10 +1197,11 @@ static void * sf_commu_mcu_task(void * argv) } else { + mcubuf_reset(); memcpy(mcu_buf, &buffer[start], copy_size); mcu_buf_len = copy_size; sf_commu_parse_mcu_data(mcu_buf, mcu_buf_len); - mcubuf_reset(); + } start = -1; end = -1; @@ -1326,7 +1327,8 @@ int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int int ret = -1; int retries = 0; // 重试次数 unsigned int i = 0; - + unsigned char tmpreg[3] = {0}; + unsigned char tmpval[3] = {0}; if (gsfd == -1) sf_commu_mcu_open(); @@ -1351,7 +1353,12 @@ int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int printf("%s:%d error\r\n", __FUNCTION__, __LINE__); ret = -1; retries++; // 错误时增加重试次数 - + ret = sf_getRegFromMcu_depack(mcu_buf, mcu_buf_len, &tmpreg[0], &tmpval[0]); + if (ret > 0) + { + MLOGD("MCU send 0x05, reg_value[%d,%d]\n\n",tmpreg[0], tmpval[0]); + sf_getRegFromMcu_ack(tmpreg[0], tmpval[0]); + } } else { diff --git a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c index 7690d8305..d75194d76 100755 --- a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c +++ b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c @@ -97,14 +97,19 @@ UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) { UINT32 i; unsigned int pnum = num; + for(i = 0; i < num; i++) + { + printf("W_addr[%d]=0x%02x\n", reg[i], data[i]); + } if(0 <= sf_commu_set_mcu_many(reg, data, &pnum)) { - for(i = 0; i < num; i++) - { - printf("W_addr[%d]=0x%02x\n", reg[i], data[i]); - } + // for(i = 0; i < num; i++) + // { + // printf("W_addr[%d]=0x%02x\n", reg[i], data[i]); + // } return SUCCESS; } + printf("%s:%d FAIL write err\n", __FUNCTION__, __LINE__); return FAIL; }