diff --git a/Kconfig b/Kconfig index 134bad0..66afea3 100644 --- a/Kconfig +++ b/Kconfig @@ -104,6 +104,15 @@ menu "Modbus configuration" help 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 int "Response timeout for ASCII communication mode (ms)" default 1000 diff --git a/freemodbus/modbus/include/mbconfig.h b/freemodbus/modbus/include/mbconfig.h index 7220045..171208a 100644 --- a/freemodbus/modbus/include/mbconfig.h +++ b/freemodbus/modbus/include/mbconfig.h @@ -121,8 +121,10 @@ PR_BEGIN_EXTERN_C * transmitting the frame. If the master is to slow with enabling its * 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 ) +#else +#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( CONFIG_FMB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ) #endif /*! \brief Maximum number of Modbus functions codes the protocol stack diff --git a/freemodbus/port/porttimer.c b/freemodbus/port/porttimer.c index 4fbfbfd..e0215cb 100644 --- a/freemodbus/port/porttimer.c +++ b/freemodbus/port/porttimer.c @@ -125,3 +125,8 @@ void vMBPortTimerClose(void) } #endif } + +void vMBPortTimersDelay(USHORT usTimeOutMS) +{ + vTaskDelay(usTimeOutMS / portTICK_PERIOD_MS); +} \ No newline at end of file