|
|
@ -61,6 +61,9 @@ Includes |
|
|
#define BRIDGE_IDLE_DONE_US 2500000U /* sweep 중 성공 라인 사이 최대 무응답 허용 시간 */ |
|
|
#define BRIDGE_IDLE_DONE_US 2500000U /* sweep 중 성공 라인 사이 최대 무응답 허용 시간 */ |
|
|
#define BRIDGE_TOTAL_WAIT_US 30000000U /* sweep 전체 브리지 최대 대기 시간 */ |
|
|
#define BRIDGE_TOTAL_WAIT_US 30000000U /* sweep 전체 브리지 최대 대기 시간 */ |
|
|
|
|
|
|
|
|
|
|
|
#define OWI_LONG_READ_SETTLE_US 30000U |
|
|
|
|
|
#define OWI_LONG_READ_RETRY_US 10000U |
|
|
|
|
|
|
|
|
/* =========================
|
|
|
/* =========================
|
|
|
* UART RX Buffers |
|
|
* UART RX Buffers |
|
|
* ========================= */ |
|
|
* ========================= */ |
|
|
@ -125,6 +128,43 @@ static void RS485_Bridge_ResetFifo(void) |
|
|
g_rs485_bridge_done = 0; |
|
|
g_rs485_bridge_done = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
|
uint8_t active; |
|
|
|
|
|
uint8_t scan_started; |
|
|
|
|
|
uint8_t current_scan_addr; |
|
|
|
|
|
app_job_t job; |
|
|
|
|
|
} app_runtime_job_t; |
|
|
|
|
|
|
|
|
|
|
|
static app_runtime_job_t g_app_runtime_job; |
|
|
|
|
|
|
|
|
|
|
|
static void app_runtime_reset(void) |
|
|
|
|
|
{ |
|
|
|
|
|
memset(&g_app_runtime_job, 0, sizeof(g_app_runtime_job)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void rs485_abort_and_reset_pipeline(void) |
|
|
|
|
|
{ |
|
|
|
|
|
/* bridge 정리 */ |
|
|
|
|
|
g_rs485_bridge_active = 0; |
|
|
|
|
|
g_rs485_bridge_done = 0; |
|
|
|
|
|
RS485_Bridge_ResetFifo(); |
|
|
|
|
|
|
|
|
|
|
|
/* RX 상태 정리 */ |
|
|
|
|
|
rs485_rx_done = 0; |
|
|
|
|
|
rs485_rx_index = 0; |
|
|
|
|
|
rs485_rx_length = 0; |
|
|
|
|
|
memset((void*)rs485_rx_buffer, 0, sizeof(rs485_rx_buffer)); |
|
|
|
|
|
|
|
|
|
|
|
/* 현재 job 중단 */ |
|
|
|
|
|
app_runtime_reset(); |
|
|
|
|
|
|
|
|
|
|
|
/* 대기 queue 비우기 */ |
|
|
|
|
|
app_scheduler_clear(); |
|
|
|
|
|
|
|
|
|
|
|
/* UART0 recover 요청 */ |
|
|
|
|
|
g_rs485_need_recover = 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static int RS485_Bridge_ReadLine(char *out, int out_sz, uint32_t timeout_us) |
|
|
static int RS485_Bridge_ReadLine(char *out, int out_sz, uint32_t timeout_us) |
|
|
{ |
|
|
{ |
|
|
int n = 0; |
|
|
int n = 0; |
|
|
@ -252,6 +292,29 @@ static unsigned char hex2byte(char h, char l) |
|
|
return (unsigned char)((hi << 4) | lo); |
|
|
return (unsigned char)((hi << 4) | lo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static uint8_t is_long_owi_read_len(uint8_t len) |
|
|
|
|
|
{ |
|
|
|
|
|
return (len == 119u || len == 127u); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static app_owi_result_t do_stable_owi_read(uint8_t id, uint8_t read_len) |
|
|
|
|
|
{ |
|
|
|
|
|
app_owi_result_t r; |
|
|
|
|
|
|
|
|
|
|
|
if (is_long_owi_read_len(read_len)) { |
|
|
|
|
|
delay_us(OWI_LONG_READ_SETTLE_US); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
r = app_owi_read_basic(id, (int)read_len); |
|
|
|
|
|
|
|
|
|
|
|
if ((!r.ok || r.timeout || r.read_len < read_len) && is_long_owi_read_len(read_len)) { |
|
|
|
|
|
delay_us(OWI_LONG_READ_RETRY_US); |
|
|
|
|
|
r = app_owi_read_basic(id, (int)read_len); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return r; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* =========================
|
|
|
/* =========================
|
|
|
* Prefix mode |
|
|
* Prefix mode |
|
|
* ========================= */ |
|
|
* ========================= */ |
|
|
@ -263,15 +326,6 @@ typedef enum { |
|
|
|
|
|
|
|
|
static PrefixMode s_prefix_mode = PREFIX_NONE; |
|
|
static PrefixMode s_prefix_mode = PREFIX_NONE; |
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
|
uint8_t active; |
|
|
|
|
|
uint8_t scan_started; |
|
|
|
|
|
uint8_t current_scan_addr; |
|
|
|
|
|
app_job_t job; |
|
|
|
|
|
} app_runtime_job_t; |
|
|
|
|
|
|
|
|
|
|
|
static app_runtime_job_t g_app_runtime_job; |
|
|
|
|
|
|
|
|
|
|
|
/* =========================
|
|
|
/* =========================
|
|
|
* parse x-prefix: xNNc_001011:... |
|
|
* parse x-prefix: xNNc_001011:... |
|
|
* ========================= */ |
|
|
* ========================= */ |
|
|
@ -718,23 +772,20 @@ static int run_connect_verify_one_channel(const app_job_t *job, uint8_t ch) |
|
|
/* 재시도 전 OFF 처리 */ |
|
|
/* 재시도 전 OFF 처리 */ |
|
|
if (attempt > 0) { |
|
|
if (attempt > 0) { |
|
|
Cal_Init(); |
|
|
Cal_Init(); |
|
|
delay_us(30000); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* prefix / gate */ |
|
|
|
|
|
if (job->mode == 'C') { |
|
|
|
|
|
s_prefix_mode = PREFIX_CAL; |
|
|
|
|
|
Cal_Init(); |
|
|
|
|
|
} else { |
|
|
|
|
|
s_prefix_mode = PREFIX_EOL; |
|
|
|
|
|
Eol_Init(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
/* prefix / gate */ |
|
|
|
|
|
if (job -> mode == 'C') { |
|
|
|
|
|
s_prefix_mode = PREFIX_CAL; |
|
|
|
|
|
Cal_Init(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
s_prefix_mode = PREFIX_EOL; |
|
|
|
|
|
Eol_Init(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* 현재 채널만 선택 */ |
|
|
Gate_SetByNum(ch, job->hash_on, job->anaout_on, job->check_on); |
|
|
Gate_SetByNum(ch, job->hash_on, job->anaout_on, job->check_on); |
|
|
GateCtrl_SelectChannel(ch); |
|
|
GateCtrl_SelectChannel(ch); |
|
|
|
|
|
|
|
|
delay_us(30000); |
|
|
|
|
|
|
|
|
|
|
|
/* 1) OWT 28 003 + first3 */ |
|
|
/* 1) OWT 28 003 + first3 */ |
|
|
r_write1 = app_owi_write_t_basic(0x28u, write1_data, 3); |
|
|
r_write1 = app_owi_write_t_basic(0x28u, write1_data, 3); |
|
|
if (!r_write1.ok || r_write1.timeout) { |
|
|
if (!r_write1.ok || r_write1.timeout) { |
|
|
@ -797,11 +848,12 @@ static int execute_connect_verify_sequence(CmdSource src, const app_job_t *job) |
|
|
|
|
|
|
|
|
/* 000 이면 1~20 sweep */ |
|
|
/* 000 이면 1~20 sweep */ |
|
|
if (job->channel == 0u) { |
|
|
if (job->channel == 0u) { |
|
|
|
|
|
|
|
|
for (ch = 1; ch <= 20; ch++) { |
|
|
for (ch = 1; ch <= 20; ch++) { |
|
|
uint8_t ok = (uint8_t)run_connect_verify_one_channel(job, ch); |
|
|
uint8_t ok = (uint8_t)run_connect_verify_one_channel(job, ch); |
|
|
|
|
|
|
|
|
if (ok) { |
|
|
if (ok) { |
|
|
print_connect_sweep_result(src, ch, 1); |
|
|
print_connect_sweep_result(src, ch, 1); |
|
|
success_count++; |
|
|
success_count++; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -809,6 +861,7 @@ static int execute_connect_verify_sequence(CmdSource src, const app_job_t *job) |
|
|
if (success_count == 0u) { |
|
|
if (success_count == 0u) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
@ -825,7 +878,6 @@ static int execute_connect_verify_sequence(CmdSource src, const app_job_t *job) |
|
|
} else { |
|
|
} else { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
} |
|
|
} |
|
|
delay_us(30000); |
|
|
|
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
@ -838,16 +890,15 @@ static int execute_direct_read_sequence(CmdSource src, const app_job_t *job) |
|
|
|
|
|
|
|
|
if (!job) return 0; |
|
|
if (!job) return 0; |
|
|
|
|
|
|
|
|
/* 일반 OW 패턴만 처리 */ |
|
|
|
|
|
if (job->type != APP_JOB_PROTO_OW) return 0; |
|
|
if (job->type != APP_JOB_PROTO_OW) return 0; |
|
|
if (job->proto != APP_PROTO_OWIW) return 0; |
|
|
if (job->proto != APP_PROTO_OWIW) return 0; |
|
|
if (job->id != 0x28u) return 0; |
|
|
if (job->id != 0x28u) return 0; |
|
|
if (job->len != 3u) return 0; |
|
|
if (job->len != 3u) return 0; |
|
|
if (job->addr != g_fixed_addr) return 0; |
|
|
if (job->addr != g_fixed_addr) return 0; |
|
|
|
|
|
|
|
|
if (job->channel < 1 || job->channel > 20) { |
|
|
if (job->channel < 1 || job->channel > 20) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -861,41 +912,38 @@ static int execute_direct_read_sequence(CmdSource src, const app_job_t *job) |
|
|
|
|
|
|
|
|
Gate_SetByNum(job->channel, job->hash_on, job->anaout_on, job->check_on); |
|
|
Gate_SetByNum(job->channel, job->hash_on, job->anaout_on, job->check_on); |
|
|
GateCtrl_SelectChannel(job->channel); |
|
|
GateCtrl_SelectChannel(job->channel); |
|
|
|
|
|
//delay_us(30000);
|
|
|
|
|
|
|
|
|
/* payload 3바이트 패턴으로 read 길이 결정 */ |
|
|
|
|
|
if (job->payload[0] == 0x2E && job->payload[1] == 0x00 && job->payload[2] == 0x1F) { |
|
|
if (job->payload[0] == 0x2E && job->payload[1] == 0x00 && job->payload[2] == 0x1F) { |
|
|
read_len = 65; /* outmem */ |
|
|
read_len = 65; |
|
|
} |
|
|
} |
|
|
else if (job->payload[0] == 0x22 && job->payload[1] == 0x00 && job->payload[2] == 0x3A) { |
|
|
else if (job->payload[0] == 0x22 && job->payload[1] == 0x00 && job->payload[2] == 0x3A) { |
|
|
read_len = 119; /* shadow */ |
|
|
read_len = 119; |
|
|
} |
|
|
} |
|
|
else if (job->payload[0] == 0x26 && job->payload[1] == 0x00 && job->payload[2] == 0x3E) { |
|
|
else if (job->payload[0] == 0x26 && job->payload[1] == 0x00 && job->payload[2] == 0x3E) { |
|
|
read_len = 127; /* nvm */ |
|
|
read_len = 127; |
|
|
} |
|
|
} |
|
|
else if (job->payload[0] == 0x0B && job->payload[1] == 0x04 && job->payload[2] == 0x06) { |
|
|
else if (job->payload[0] == 0x0B && job->payload[1] == 0x04 && job->payload[2] == 0x06) { |
|
|
read_len = 23; /* acquiredata */ |
|
|
read_len = 23; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
return 0; /* 일반 ow는 기존 처리로 넘김 */ |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 1) GUI에서 보낸 ow 명령 그대로 write */ |
|
|
|
|
|
r_write = app_owi_write_basic(0x28u, job->payload, 3); |
|
|
r_write = app_owi_write_basic(0x28u, job->payload, 3); |
|
|
if (!r_write.ok || r_write.timeout) { |
|
|
if (!r_write.ok || r_write.timeout) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 2) 대응되는 read 수행 */ |
|
|
r_read = do_stable_owi_read(0x28u, read_len); |
|
|
r_read = app_owi_read_basic(0x28u, read_len); |
|
|
|
|
|
if (!r_read.ok || r_read.timeout || r_read.read_len < read_len) { |
|
|
if (!r_read.ok || r_read.timeout || r_read.read_len < read_len) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 3) 읽은 값만 출력 */ |
|
|
|
|
|
print_owi_read_result(src, &r_read); |
|
|
print_owi_read_result(src, &r_read); |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
@ -968,6 +1016,7 @@ static int execute_write_coeff_sequence(CmdSource src, const app_job_t *job) |
|
|
|
|
|
|
|
|
Gate_SetByNum(job->channel, job->hash_on, job->anaout_on, job->check_on); |
|
|
Gate_SetByNum(job->channel, job->hash_on, job->anaout_on, job->check_on); |
|
|
GateCtrl_SelectChannel(job->channel); |
|
|
GateCtrl_SelectChannel(job->channel); |
|
|
|
|
|
//delay_us(30000);
|
|
|
|
|
|
|
|
|
coeff_data = &job->payload[3]; |
|
|
coeff_data = &job->payload[3]; |
|
|
|
|
|
|
|
|
@ -1000,9 +1049,11 @@ static int execute_write_coeff_sequence(CmdSource src, const app_job_t *job) |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delay_us(30000); |
|
|
|
|
|
|
|
|
/* 4) or28127 */ |
|
|
/* 4) or28127 */ |
|
|
r_read2 = app_owi_read_basic(0x28u, 127); |
|
|
r_read2 = do_stable_owi_read(0x28u, 127u); |
|
|
if (!r_read2.ok || r_read2.timeout || r_read2.read_len < 127) { |
|
|
if (!r_read2.ok || r_read2.timeout || r_read2.read_len < 127) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
@ -1074,6 +1125,7 @@ static int execute_shadow_write_copy_nvm_sequence(CmdSource src, const app_job_t |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (job->channel < 1 || job->channel > 20) { |
|
|
if (job->channel < 1 || job->channel > 20) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
@ -1091,6 +1143,7 @@ static int execute_shadow_write_copy_nvm_sequence(CmdSource src, const app_job_t |
|
|
|
|
|
|
|
|
Gate_SetByNum(job->channel, job->hash_on, job->anaout_on, job->check_on); |
|
|
Gate_SetByNum(job->channel, job->hash_on, job->anaout_on, job->check_on); |
|
|
GateCtrl_SelectChannel(job->channel); |
|
|
GateCtrl_SelectChannel(job->channel); |
|
|
|
|
|
//delay_us(30000);
|
|
|
|
|
|
|
|
|
/* 마지막 2바이트를 GUI CRC로 사용 */ |
|
|
/* 마지막 2바이트를 GUI CRC로 사용 */ |
|
|
gui_crc = &job->payload[119]; |
|
|
gui_crc = &job->payload[119]; |
|
|
@ -1208,7 +1261,7 @@ static int execute_shadow_write_copy_nvm_sequence(CmdSource src, const app_job_t |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
delay_us(5000); |
|
|
//delay_us(5000);
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (poll_count >= 50u) { |
|
|
if (poll_count >= 50u) { |
|
|
@ -1298,8 +1351,8 @@ static int execute_shadow_write_copy_nvm_sequence(CmdSource src, const app_job_t |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 17) or28127 */ |
|
|
/* 17) or28127 */ |
|
|
r_read = app_owi_read_basic(0x28u, 127); |
|
|
r_read = do_stable_owi_read(0x28u, 127u); |
|
|
if (!r_read.ok || r_read.timeout || r_read.read_len < 127) { |
|
|
if (!r_read.ok || r_read.timeout || r_read.read_len < 127) { |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
OUT_PRINT(src, "Fail\r\n"); |
|
|
send_end_response(src); |
|
|
send_end_response(src); |
|
|
@ -1321,30 +1374,32 @@ static int execute_owi_service_from_job(CmdSource src, const app_job_t *job) |
|
|
app_owi_result_t r; |
|
|
app_owi_result_t r; |
|
|
|
|
|
|
|
|
if (!job) return 0; |
|
|
if (!job) return 0; |
|
|
|
|
|
|
|
|
// connect
|
|
|
/* connect */ |
|
|
if (execute_connect_verify_sequence(src, job)) { |
|
|
if (execute_connect_verify_sequence(src, job)) { |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// nvm, shadow, outmem
|
|
|
/* nvm, shadow, outmem direct read */ |
|
|
if (execute_direct_read_sequence(src, job)) { |
|
|
if (execute_direct_read_sequence(src, job)) { |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// write_coefficient
|
|
|
/* write coefficient */ |
|
|
if (execute_write_coeff_sequence(src, job)) { |
|
|
if (execute_write_coeff_sequence(src, job)) { |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// shadow_write to copy nvm
|
|
|
/* shadow_write -> copy nvm */ |
|
|
if (execute_shadow_write_copy_nvm_sequence(src, job)) { |
|
|
if (execute_shadow_write_copy_nvm_sequence(src, job)) { |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (job->addr != g_fixed_addr) return 0; |
|
|
if (job->addr != g_fixed_addr) return 0; |
|
|
|
|
|
|
|
|
if (job->channel < 1 || job->channel > 20) { |
|
|
if (job->channel < 1 || job->channel > 20) { |
|
|
OUT_PRINT(src, "Err:ch_range\r\n"); |
|
|
OUT_PRINT(src, "Err:ch_range\r\n"); |
|
|
|
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1365,17 +1420,22 @@ static int execute_owi_service_from_job(CmdSource src, const app_job_t *job) |
|
|
} else { |
|
|
} else { |
|
|
r = app_owi_write_basic(job->id, job->payload, (uint8_t)job->len); |
|
|
r = app_owi_write_basic(job->id, job->payload, (uint8_t)job->len); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
print_owi_write_result(src, &r); |
|
|
print_owi_write_result(src, &r); |
|
|
|
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (job->type == APP_JOB_PROTO_OR) { |
|
|
if (job->type == APP_JOB_PROTO_OR) { |
|
|
r = app_owi_read_basic(job->id, (int)job->len); |
|
|
r = app_owi_read_basic(job->id, (int)job->len); |
|
|
print_owi_read_result(src, &r); |
|
|
print_owi_read_result(src, &r); |
|
|
|
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
OUT_PRINT(src, "Err:job_exec\r\n"); |
|
|
|
|
|
send_end_response(src); |
|
|
|
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void forward_line_rs485_and_bridge(const char *line) |
|
|
static void forward_line_rs485_and_bridge(const char *line) |
|
|
@ -1485,22 +1545,25 @@ static void forward_line_rs485_and_bridge(const char *line) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!got_any_line) { |
|
|
if (!got_any_line) { |
|
|
OUT_PRINT(CMD_SRC_PC, "Err:rs485_no_response\r\n"); |
|
|
OUT_PRINT(CMD_SRC_PC, "Err:rs485_no_response\r\n"); |
|
|
} else { |
|
|
rs485_abort_and_reset_pipeline(); |
|
|
char dbg[128]; |
|
|
return; |
|
|
|
|
|
} else { |
|
|
if (line_len > 0) { |
|
|
char dbg[128]; |
|
|
sprintf(dbg, "Err:rs485_no_end partial=%s\r\n", linebuf); |
|
|
|
|
|
} else { |
|
|
if (line_len > 0) { |
|
|
sprintf(dbg, "Err:rs485_no_end partial=<none>\r\n"); |
|
|
sprintf(dbg, "Err:rs485_no_end partial=%s\r\n", linebuf); |
|
|
} |
|
|
} else { |
|
|
|
|
|
sprintf(dbg, "Err:rs485_no_end partial=<none>\r\n"); |
|
|
OUT_PRINT(CMD_SRC_PC, dbg); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
g_rs485_bridge_active = 0; |
|
|
OUT_PRINT(CMD_SRC_PC, dbg); |
|
|
|
|
|
rs485_abort_and_reset_pipeline(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int execute_owi_service_from_line(CmdSource src, const char *line) |
|
|
static int execute_owi_service_from_line(CmdSource src, const char *line) |
|
|
{ |
|
|
{ |
|
|
uint8_t addr = 0, ch = 0; |
|
|
uint8_t addr = 0, ch = 0; |
|
|
@ -1555,6 +1618,7 @@ static int execute_owi_service_from_line(CmdSource src, const char *line) |
|
|
if (payload_pos >= len) { |
|
|
if (payload_pos >= len) { |
|
|
if (mode == 'E') { |
|
|
if (mode == 'E') { |
|
|
OUT_PRINT(src, "<ACK>XE51\r\n"); |
|
|
OUT_PRINT(src, "<ACK>XE51\r\n"); |
|
|
|
|
|
send_end_response(src); |
|
|
return 1; |
|
|
return 1; |
|
|
} else { |
|
|
} else { |
|
|
OUT_PRINT(src, "Err:CAL_need_payload\r\n"); |
|
|
OUT_PRINT(src, "Err:CAL_need_payload\r\n"); |
|
|
@ -1839,6 +1903,7 @@ static void process_one_line_now(CmdSource src, const char *input_line) |
|
|
if (rem <= 0) { |
|
|
if (rem <= 0) { |
|
|
if (mode == 'E') { |
|
|
if (mode == 'E') { |
|
|
OUT_PRINT(src, "<ACK>XE51\r\n"); |
|
|
OUT_PRINT(src, "<ACK>XE51\r\n"); |
|
|
|
|
|
send_end_response(src); |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
OUT_PRINT(src, "Err:CAL_need_payload\r\n"); |
|
|
OUT_PRINT(src, "Err:CAL_need_payload\r\n"); |
|
|
@ -1958,11 +2023,6 @@ static void process_one_line(CmdSource src, const volatile uint8_t *rx_buf, uint |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void app_runtime_reset(void) |
|
|
|
|
|
{ |
|
|
|
|
|
memset(&g_app_runtime_job, 0, sizeof(g_app_runtime_job)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void app_runtime_try_start(void) |
|
|
static void app_runtime_try_start(void) |
|
|
{ |
|
|
{ |
|
|
if (g_app_runtime_job.active) return; |
|
|
if (g_app_runtime_job.active) return; |
|
|
|