espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.97k stars 7.11k forks source link

(Modbus) Change CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND value at runtime (IDFGH-12020) #13085

Closed mattiaVDM closed 5 months ago

mattiaVDM commented 5 months ago

Is your feature request related to a problem?

I'm working on a Modbus project where is required to change the timeout parameter at runtime, but it is not possible with the current implementation. The timers depends on the value of CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND, defined in sdkconfig and used inside: ` void vMBMasterPortTimersRespondTimeoutEnable(void) { uint64_t xToutUs = (MB_MASTER_TIMEOUT_MS_RESPOND * 1000);

vMBMasterSetCurTimerMode(MB_TMODE_RESPOND_TIMEOUT);
ESP_LOGD(MB_PORT_TAG,"%s Respond enable timeout.", __func__);
(void)xMBMasterPortTimersEnable(xToutUs);

}

` This makes impossible to do changes to the master timeout value without recompiling the code.

Describe the solution you'd like.

I'd like to have a way to set the response timeout at runtime if possible.

Describe alternatives you've considered.

No response

Additional context.

No response

alisitsyn commented 5 months ago

Hi @mattiaVDM,

Thanks for the issue. This is known issue and was not implemented because of the requirement that the public interface for v1.0.x should not be changed. The timeout setting will be the part of communication options structure in next release and can be changed upon creation. This can be applied to the v1.0.x as well. Can this cover your requirements or only runtime option with the API can work for you?

esp-modbus v2.0.0-beta

mattiaVDM commented 5 months ago

Thanks a lot for the answer. Yes, this would work! do you have an eta for the stable release of the v2.0? will it be compatible with current versions?

alisitsyn commented 5 months ago

Yes, this would work! do you have an eta for the stable release of the v2.0? will it be compatible with current versions?

Unfortunately I can not give you any estimations for now. The public interface and options of this new release will be changed, but transition will require minimal changes of the existing projects. I am going to make this release compatible with the previous as much as possible.