Browse Source

esync触发

external_Interrupt
tianjialong 2 years ago
parent
commit
ab5ef4f250
  1. 17
      usersrc/udpclient.c
  2. 1
      usersrc/udpclient.h
  3. 1
      usersrc/usermain.c

17
usersrc/udpclient.c

@ -18,6 +18,7 @@
} }
static bool udp_client_active_flag; static bool udp_client_active_flag;
static bool genlock_and_esync_active_flag;
/* 定义端口号 */ /* 定义端口号 */
#define UDP_REMOTE_PORT 8881 /* 远端端口 */ #define UDP_REMOTE_PORT 8881 /* 远端端口 */
@ -186,7 +187,9 @@ void udp_client_parse(int recv_datalen)
{ {
if (recv_datalen >= adwin_config_protocol_size) if (recv_datalen >= adwin_config_protocol_size)
{ {
// adwin_config_protocol_t *rxcmd = (adwin_config_protocol_t *)s_receBuf;
adwin_config_protocol_t *rxcmd = (adwin_config_protocol_t *)s_receBuf;
active_report_data_structer.time_stamp_s = rxcmd->time_stamp_s;
genlock_and_esync_active_flag = true;
} }
else if (recv_datalen <= basic_report_data_size) else if (recv_datalen <= basic_report_data_size)
{ {
@ -258,3 +261,15 @@ void udp_cllient_active(void)
} }
} }
} }
void udp_cllient_genlock_and_esync_active(void)
{
if (genlock_and_esync_active_flag)
{
active_report_data_structer_update();
printf("encoder1:%d,encoder2:%d\r\n", active_report_data_structer.encoder_1_count, active_report_data_structer.encoder_2_count);
active_report_data_structer.time_stamp_s = 0;
genlock_and_esync_active_flag = false;
}
}

1
usersrc/udpclient.h

@ -8,3 +8,4 @@ void udp_client_send_string(char *pData);
void udp_client_recv(void); void udp_client_recv(void);
void udp_client_parse(int recv_datalen); void udp_client_parse(int recv_datalen);
void udp_cllient_active(void); void udp_cllient_active(void);
void udp_cllient_genlock_and_esync_active(void);

1
usersrc/usermain.c

@ -94,6 +94,7 @@ void user_main()
while (1) while (1)
{ {
udp_cllient_genlock_and_esync_active();
udp_cllient_active(); udp_cllient_active();
zkey_schedule(); zkey_schedule();
udp_client_recv(); udp_client_recv();

Loading…
Cancel
Save