freemodbus: fix issues when modbus master and slave work simultaneously

This commit is contained in:
aleks
2021-03-30 14:42:44 +02:00
committed by Alex Lisitsyn
parent 5ef3614e5f
commit 3f10640b67
3 changed files with 3 additions and 4 deletions

View File

@@ -54,7 +54,7 @@
#endif #endif
#ifndef MB_PORT_HAS_CLOSE #ifndef MB_PORT_HAS_CLOSE
#define MB_PORT_HAS_CLOSE 0 #define MB_PORT_HAS_CLOSE 1
#endif #endif
/* ----------------------- Static variables ---------------------------------*/ /* ----------------------- Static variables ---------------------------------*/

View File

@@ -57,7 +57,7 @@
/* ----------------------- Variables ----------------------------------------*/ /* ----------------------- Variables ----------------------------------------*/
static USHORT usT35TimeOut50us; static USHORT usT35TimeOut50us;
static const USHORT usTimerIndex = MB_TIMER_INDEX; // Initialize Modbus Timer index used by stack, static const USHORT usTimerIndex = MB_TIMER_INDEX ^ 1; // Initialize Modbus Timer index used by stack,
static const USHORT usTimerGroupIndex = MB_TIMER_GROUP; // Timer group index used by stack static const USHORT usTimerGroupIndex = MB_TIMER_GROUP; // Timer group index used by stack
static timer_isr_handle_t xTimerIntHandle; // Timer interrupt handle static timer_isr_handle_t xTimerIntHandle; // Timer interrupt handle

View File

@@ -28,7 +28,7 @@
#include "port_serial_slave.h" #include "port_serial_slave.h"
// Shared pointer to interface structure // Shared pointer to interface structure
static mb_slave_interface_t* mbs_interface_ptr = NULL; // &default_interface_inst; static mb_slave_interface_t* mbs_interface_ptr = NULL;
// Modbus task function // Modbus task function
static void modbus_slave_task(void *pvParameters) static void modbus_slave_task(void *pvParameters)
@@ -36,7 +36,6 @@ static void modbus_slave_task(void *pvParameters)
// Modbus interface must be initialized before start // Modbus interface must be initialized before start
MB_SLAVE_ASSERT(mbs_interface_ptr != NULL); MB_SLAVE_ASSERT(mbs_interface_ptr != NULL);
mb_slave_options_t* mbs_opts = &mbs_interface_ptr->opts; mb_slave_options_t* mbs_opts = &mbs_interface_ptr->opts;
MB_SLAVE_ASSERT(mbs_opts != NULL); MB_SLAVE_ASSERT(mbs_opts != NULL);
// Main Modbus stack processing cycle // Main Modbus stack processing cycle
for (;;) { for (;;) {