0001-some-fixes-for-FreeMODBUS-and-MODBUS-example.patch from Freddi Chopin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5372 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
1d7bb0fa07
commit
0ae06479d8
@ -217,7 +217,7 @@ static inline int modbus_initialize(void)
|
|||||||
/* Enable FreeModBus */
|
/* Enable FreeModBus */
|
||||||
|
|
||||||
mberr = eMBEnable();
|
mberr = eMBEnable();
|
||||||
if (mberr == MB_ENOERR)
|
if (mberr != MB_ENOERR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "modbus_main: "
|
fprintf(stderr, "modbus_main: "
|
||||||
"ERROR: eMBEnable failed: %d\n", mberr);
|
"ERROR: eMBEnable failed: %d\n", mberr);
|
||||||
@ -267,6 +267,8 @@ static void *modbus_pollthread(void *pvarg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
/* Then loop until we are commanded to shutdown */
|
/* Then loop until we are commanded to shutdown */
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -99,7 +99,7 @@ static xMBFunctionHandler xFuncHandlers[CONFIG_MB_FUNC_HANDLERS_MAX] = {
|
|||||||
#ifdef CONFIG_MB_FUNC_OTHER_REP_SLAVEID_ENABLED
|
#ifdef CONFIG_MB_FUNC_OTHER_REP_SLAVEID_ENABLED
|
||||||
{MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID},
|
{MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID},
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_MB_FUNC_READ_INPUT_ENABLE
|
#ifdef CONFIG_MB_FUNC_READ_INPUT_ENABLED
|
||||||
{MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister},
|
{MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister},
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_MB_FUNC_READ_HOLDING_ENABLED
|
#ifdef CONFIG_MB_FUNC_READ_HOLDING_ENABLED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user