fix modbus slave wait before send option

This commit is contained in:
Alex Lisitsyn
2023-12-22 17:38:18 +08:00
parent f0e78b6d27
commit e12c7ff02c
3 changed files with 17 additions and 1 deletions

View File

@ -104,6 +104,15 @@ menu "Modbus configuration"
help help
This option defines the number of data bits per ASCII character. This option defines the number of data bits per ASCII character.
config FMB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS
int "Wait before send for ASCII communication mode (ms)"
default 0
range 0 1000
depends on FMB_COMM_MODE_ASCII_EN
help
This option defines timeout before slave sends the response in ASCII communication mode.
This allows to work with slow masters. Zero means delay before send is disabled.
config FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS config FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS
int "Response timeout for ASCII communication mode (ms)" int "Response timeout for ASCII communication mode (ms)"
default 1000 default 1000

View File

@ -121,8 +121,10 @@ PR_BEGIN_EXTERN_C
* transmitting the frame. If the master is to slow with enabling its * transmitting the frame. If the master is to slow with enabling its
* receiver then he will not receive the response correctly. * receiver then he will not receive the response correctly.
*/ */
#ifndef MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS #ifndef CONFIG_FMB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS
#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( 0 ) #define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( 0 )
#else
#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( CONFIG_FMB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS )
#endif #endif
/*! \brief Maximum number of Modbus functions codes the protocol stack /*! \brief Maximum number of Modbus functions codes the protocol stack

View File

@ -125,3 +125,8 @@ void vMBPortTimerClose(void)
} }
#endif #endif
} }
void vMBPortTimersDelay(USHORT usTimeOutMS)
{
vTaskDelay(usTimeOutMS / portTICK_PERIOD_MS);
}