diff --git a/apps/chrg/applications/bsp/chrg_rel.c b/apps/chrg/applications/bsp/chrg_rel.c index 407b4a6..5290732 100644 --- a/apps/chrg/applications/bsp/chrg_rel.c +++ b/apps/chrg/applications/bsp/chrg_rel.c @@ -24,7 +24,7 @@ struct chrg_rel_t chrgrel[TOTAL_NOR_CHS] = { /***************************************************************** 函数名称: chrg_nor_sw_rel -函数描述: 北向继电器组 组合切换。 +函数描述: 北向继电器组 组合切换。P0=1 是sink,P1=1是source,P0和P1互斥 输入参数: ch: 通道索引 id: sink/source 输出参数: - 返回说明: - @@ -37,11 +37,11 @@ void chrg_nor_sw_rel (eIDX_NOR_CH ch, eIDX_ID id) } if (ID_SOURCE == id) { - rt_pin_write(chrgrel[ch].p2, PIN_HIGH); - rt_pin_write(chrgrel[ch].p0, PIN_LOW); + rt_pin_write(chrgrel[ch].p2, PIN_LOW); rt_pin_write(chrgrel[ch].p1, PIN_HIGH); + rt_pin_write(chrgrel[ch].p0, PIN_LOW); } else if (ID_SINK == id) { - rt_pin_write(chrgrel[ch].p2, PIN_HIGH); + rt_pin_write(chrgrel[ch].p2, PIN_LOW); rt_pin_write(chrgrel[ch].p1, PIN_LOW); rt_pin_write(chrgrel[ch].p0, PIN_HIGH); } else { @@ -80,22 +80,26 @@ INIT_DEVICE_EXPORT(chrg_nor_rel_init); int rel_test (int argc, char **argv) { if (argc < 3) { - rt_kprintf("help : %s <0|1|2|3> [0, 1]", argv[0]); + rt_kprintf("help : %s <0|1|2|3> [1, 2]", argv[0]); return -1; } int idx = atoi(argv[2]); if ((idx > 3)||(idx < 0)) { - rt_kprintf("help : %s <0|1|2|3> [0, 1]", argv[0]); + rt_kprintf("help : %s <0|1|2|3> [1, 2]", argv[0]); return -1; } if (strcmp(argv[1], "set") == 0) { if (argc != 4) { - rt_kprintf("help : %s <0|1|2|3> [0, 1]", argv[0]); + rt_kprintf("help : %s <0|1|2|3> [1, 2]", argv[0]); return -1; } rt_uint8_t val = (rt_uint8_t)atoi(argv[3]); + if ((idx > 2)||(idx < 1)) { + rt_kprintf("help : %s <0|1|2|3> [1, 2]", argv[0]); + return -1; + } chrg_nor_sw_rel((eIDX_NOR_CH)idx, (eIDX_ID)val); } else if (strcmp(argv[1], "get") == 0) { rt_uint8_t data[3] = {0}; diff --git a/apps/chrg/applications/thread/chrg_north.c b/apps/chrg/applications/thread/chrg_north.c index 0ec7838..bb334f1 100644 --- a/apps/chrg/applications/thread/chrg_north.c +++ b/apps/chrg/applications/thread/chrg_north.c @@ -76,7 +76,7 @@ int chrg_north_send (rt_uint8_t *data, rt_size_t length) struct chrg_tty_t *pTTY = chrgnorth.tty; if (RT_NULL != pTTY) { - //LOG_HEX("sendN", 32, data, length); + LOG_HEX("sendN", 32, data, length); ret = chrg_tty_send(pTTY, data, length); } diff --git a/apps/chrg/applications/thread/chrg_roll_nor.c b/apps/chrg/applications/thread/chrg_roll_nor.c index e3e06d0..0f2005e 100644 --- a/apps/chrg/applications/thread/chrg_roll_nor.c +++ b/apps/chrg/applications/thread/chrg_roll_nor.c @@ -33,7 +33,7 @@ const rt_base_t sw_uart[TOTAL_NOR_CHS] = { }; struct chrg_rollnor_t chrgrollnor = { - .run = RUN_AUTO, + .run = RUN_CONSOLE, // RUN_AUTO, .ch = IDX_NOR_CH1, }; @@ -294,7 +294,7 @@ void chrg_roll_nor_thread_entry (void *data) if (crc == pMB_R->payload[pMB_R->length-1]) { // 数据正确 if (RUN_AUTO != run) { // 恢复自动轮巡 rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER); - pROLL->run = RUN_AUTO; +//todo pROLL->run = RUN_AUTO; rt_mutex_release(pTHR->mutex); } else { chrg_roll_nor_parse(pROLL, pMB_R->payload); @@ -317,7 +317,7 @@ void chrg_roll_nor_thread_entry (void *data) } else { if (RUN_AUTO != run) { // 非自动轮巡 rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER); - pROLL->run = RUN_AUTO; // 切换会自动轮巡 +//todo pROLL->run = RUN_AUTO; // 切换会自动轮巡 rt_mutex_release(pTHR->mutex); } } @@ -422,6 +422,7 @@ static int sink (int argc, char **argv) if (0 == ret) { pROLL->ch = ch; pROLL->type = 0; // sink + pROLL->run = RUN_CONSOLE; } else { rt_kprintf("help : %s get|set [0-3] vc|pd|ccline|cclvl\r\n", argv[0]); } @@ -505,6 +506,7 @@ static int source (int argc, char **argv) if (0 == ret) { pROLL->ch = ch; pROLL->type = 1; // source + pROLL->run = RUN_CONSOLE; } else { rt_kprintf("help : %s get|set [0-3] vc|pd|cclvl\r\n", argv[0]); } diff --git a/apps/chrg/applications/thread/chrg_south.c b/apps/chrg/applications/thread/chrg_south.c index 1ea78e3..8450882 100644 --- a/apps/chrg/applications/thread/chrg_south.c +++ b/apps/chrg/applications/thread/chrg_south.c @@ -380,7 +380,7 @@ void chrg_south_thread_entry (void *data) } rt_ringbuffer_put(pSOU->rb, pSOU->rx_buf, len); - LOG_HEX("recvS", 32, pSOU->rx_buf, len); + //LOG_HEX("recvS", 32, pSOU->rx_buf, len); if (1 == pSOU->frame.findhead) { if (rt_tick_get() >= pSOU->frame.last_tick + 100) { // 100ms diff --git a/apps/chrg/chrg.uvprojx b/apps/chrg/chrg.uvprojx index 8c08ee5..99c5125 100644 --- a/apps/chrg/chrg.uvprojx +++ b/apps/chrg/chrg.uvprojx @@ -16,8 +16,8 @@ STM32F405RG STMicroelectronics - Keil.STM32F4xx_DFP.3.1.0 - https://www.keil.com/pack/ + Keil.STM32F4xx_DFP.2.16.0 + http://www.keil.com/pack/ IRAM(0x20000000-0x2001FFFF) IRAM2(0x10000000-0x1000FFFF) IROM(0x8000000-0x80FFFFF) CLOCK(25000000) CPUTYPE("Cortex-M4") FPU2 "Startup\ST\STM32F4xx\startup_stm32f40_41xxx.s" ("STM32F40/41xxx Startup Code") @@ -82,7 +82,7 @@ 1 0 - fromelf --bin !L -o @L.bin + fromelf --bin !L -o build/@L.bin 0 0 diff --git a/apps/chrg/template.uvprojx b/apps/chrg/template.uvprojx index 277bc21..0244c23 100644 --- a/apps/chrg/template.uvprojx +++ b/apps/chrg/template.uvprojx @@ -81,7 +81,7 @@ 1 0 - fromelf --bin !L -o @L.bin + fromelf --bin !L -o build/@L.bin 0 0