diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-20 13:36:07 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-11-20 13:36:07 +0000 |
commit | 6833671f0c73c1b3d4eda7251e64410e421600c4 (patch) | |
tree | 8890d3b19d49b96252d17192f135ff0823966eba | |
parent | 2754c39e6ec0fb03b74bb714ccc1374025773ff9 (diff) | |
download | px4-firmware-6833671f0c73c1b3d4eda7251e64410e421600c4.tar.gz px4-firmware-6833671f0c73c1b3d4eda7251e64410e421600c4.tar.bz2 px4-firmware-6833671f0c73c1b3d4eda7251e64410e421600c4.zip |
0001-some-fixes-for-FreeMODBUS-and-MODBUS-example.patch from Freddi Chopin
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5372 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | apps/examples/modbus/modbus_main.c | 4 | ||||
-rw-r--r-- | apps/modbus/mb.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/apps/examples/modbus/modbus_main.c b/apps/examples/modbus/modbus_main.c index 13967f6fd..2247fd675 100644 --- a/apps/examples/modbus/modbus_main.c +++ b/apps/examples/modbus/modbus_main.c @@ -217,7 +217,7 @@ static inline int modbus_initialize(void) /* Enable FreeModBus */ mberr = eMBEnable(); - if (mberr == MB_ENOERR) + if (mberr != MB_ENOERR) { fprintf(stderr, "modbus_main: " "ERROR: eMBEnable failed: %d\n", mberr); @@ -267,6 +267,8 @@ static void *modbus_pollthread(void *pvarg) return NULL; } + srand(time(NULL)); + /* Then loop until we are commanded to shutdown */ do diff --git a/apps/modbus/mb.c b/apps/modbus/mb.c index 8417d1274..54e96460d 100644 --- a/apps/modbus/mb.c +++ b/apps/modbus/mb.c @@ -99,7 +99,7 @@ static xMBFunctionHandler xFuncHandlers[CONFIG_MB_FUNC_HANDLERS_MAX] = { #ifdef CONFIG_MB_FUNC_OTHER_REP_SLAVEID_ENABLED {MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID}, #endif -#ifdef CONFIG_MB_FUNC_READ_INPUT_ENABLE +#ifdef CONFIG_MB_FUNC_READ_INPUT_ENABLED {MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister}, #endif #ifdef CONFIG_MB_FUNC_READ_HOLDING_ENABLED |