mirror of
https://gitea.ecohim.ru:3000/RS485_Relay/RS485_Relay2_fw.git
synced 2025-08-10 01:19:11 +03:00
Unofficial update by Zhironkin
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
volatile uint8_t recv_buffer[BUFFERS_SIZE];
|
||||
volatile uint8_t send_buffer[BUFFERS_SIZE];
|
||||
|
||||
extern uint16_t uart_rx_counter;
|
||||
extern uint16_t uart_rx_len;
|
||||
|
||||
uint16_t bytes_to_send = 0;
|
||||
uint16_t last_rx_time = 0xFFFF;
|
||||
enum recv_state cmd_receiving = RECV_IDLE;
|
||||
@@ -30,7 +33,16 @@ void UART_RxCpltCallback(void)
|
||||
// Check destination address
|
||||
if (recv_buffer[5] != BOARD_ADRESS)
|
||||
{
|
||||
cmd_receiving = RECV_ERROR;
|
||||
|
||||
// if(recv_buffer[5]==BOARD_ADRESS_Panel || recv_buffer[5]==BOARD_ADRESS_DAC )
|
||||
// {
|
||||
|
||||
// memset(&recv_buffer[0],0,BUFFERS_SIZE);
|
||||
|
||||
last_rx_time =0;
|
||||
|
||||
// }
|
||||
cmd_receiving = RECV_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,14 +88,15 @@ void modbus_loop_iterate()
|
||||
{
|
||||
if (cmd_receiving == RECV_ERROR)
|
||||
{
|
||||
//delay_ms(30); // poor man's way to synchronize packets
|
||||
// HAL_Delay(10); // poor man's way to synchronize packets
|
||||
if(last_rx_time>=BUS_IDLE_TIME)
|
||||
{
|
||||
{
|
||||
cmd_receiving = RECV_IDLE;
|
||||
// memset(&recv_buffer[0],0,BUFFERS_SIZE);
|
||||
//TXEN_485 = 1;
|
||||
//delay_us(10);
|
||||
//TXEN_485 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cmd_receiving == RECV_IDLE)
|
||||
{
|
||||
|
Reference in New Issue
Block a user