From 91e90823cb19d1490d5223d2835f9064ea566c6f Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Tue, 11 Apr 2017 13:34:07 +0300 Subject: Fix wrong handles being passed to smBDRead in simplemotion.c smReceiveErrorHandler and smReceiveReturnPacket passed the smbus handle to smBDRead while smBDRead expects the smbusdevicehandle. This also corrects the type of SM_BUS.bdHandle from smint8 to smbusdevicehandle. --- simplemotion.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simplemotion.c b/simplemotion.c index 9a0b3fb..606eda0 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -34,7 +34,7 @@ SM_STATUS smReceiveReturnPacket( smbus bushandle ); typedef struct SM_BUS_ { - smint8 bdHandle; + smbusdevicehandle bdHandle; smbool opened; enum RecvState recv_state,recv_state_next; @@ -420,7 +420,7 @@ SM_STATUS smReceiveErrorHandler( smbus handle, smbool flushrx ) smbool success; do{ smuint8 rx; - success=smBDRead(handle,&rx); + success=smBDRead(smBus[handle].bdHandle,&rx); }while(success==smtrue); } smResetSM485variables(handle); @@ -644,7 +644,7 @@ SM_STATUS smReceiveReturnPacket( smbus bushandle ) smuint8 ret; SM_STATUS stat; - smbool succ=smBDRead(bushandle,&ret); + smbool succ=smBDRead(smBus[bushandle].bdHandle,&ret); if(succ==smfalse) { -- cgit v1.2.3