From 1e03af77d1e1a04de7084fa2f3bd90a86d150df9 Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Thu, 2 Feb 2017 15:24:14 +0200 Subject: Fix smDebug calls (swapped bushandle & verbosity level arguments when incorrect) --- simplemotion.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'simplemotion.c') diff --git a/simplemotion.c b/simplemotion.c index cdee1d1..b9ef9c0 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -225,25 +225,25 @@ smbus smOpenBus( const char * devicename ) return handle; } -/** Change baudrate of SM communication port. This does not affect already opened ports but the next smOpenBus will be opened at the new speed. - Calling this is optional. By default SM bus and all slave devices operates at 460800 BPS speed. - Parameters: - -bps: bus speed in bits per second. for possible choices, see rs232.c (but note that all speeds are not necessarily supported by SM devices) - Typical usage is: - - first call smSetParameter(handle,0,SMP_BUS_SPEED,N) to change speed of all connected slaves to N PBS - - then close port with smCloseBus - - then call smSetBaudrate(N) - - then open bus again with smOpenBus - - Note that in upcoming SM device firmware versions, bitrate will be reset to default (460800) if device side SM bus watchdog timer has been enabled, and it timeouts. - This allows re-establishing connection at defautl speed if connection breaks up and SM bus watchdog timeout gets exceeded. To identify is device supports this, - read parameter SMP_SM_VERSION. Values above 25 support this feature. Value 25 and below will not reset baudrate. - - Note also that SMP_BUS_SPEED will not be saved in device flash memory - it will reset to default at every reset & power on. - */ +/** Change baudrate of SM communication port. This does not affect already opened ports but the next smOpenBus will be opened at the new speed. + Calling this is optional. By default SM bus and all slave devices operates at 460800 BPS speed. + Parameters: + -bps: bus speed in bits per second. for possible choices, see rs232.c (but note that all speeds are not necessarily supported by SM devices) + Typical usage is: + - first call smSetParameter(handle,0,SMP_BUS_SPEED,N) to change speed of all connected slaves to N PBS + - then close port with smCloseBus + - then call smSetBaudrate(N) + - then open bus again with smOpenBus + + Note that in upcoming SM device firmware versions, bitrate will be reset to default (460800) if device side SM bus watchdog timer has been enabled, and it timeouts. + This allows re-establishing connection at defautl speed if connection breaks up and SM bus watchdog timeout gets exceeded. To identify is device supports this, + read parameter SMP_SM_VERSION. Values above 25 support this feature. Value 25 and below will not reset baudrate. + + Note also that SMP_BUS_SPEED will not be saved in device flash memory - it will reset to default at every reset & power on. + */ LIB void smSetBaudrate( unsigned long pbs ) { - SMBusBaudrate=pbs; + SMBusBaudrate=pbs; } /** Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening. @@ -582,7 +582,7 @@ SM_STATUS smGetQueuedSMCommandReturnValue( const smbus bushandle, smint32 *retV if(smBus[bushandle].cmd_recv_queue_bytes>=smBus[bushandle].recv_payloadsize) { - smDebug(Trace,bushandle,"Packet receive error, return data coudn't be parsed\n"); + smDebug(bushandle,Trace, "Packet receive error, return data coudn't be parsed\n"); //return 0 if(retValue!=NULL) *retValue=0;//check every time if retValue is set NULL by caller -> don't store anything to it if its NULL @@ -603,7 +603,7 @@ SM_STATUS smGetQueuedSMCommandReturnValue( const smbus bushandle, smint32 *retV smuint8 *readBuf=(smuint8*)&read; readBuf[1]=rxbyte; readBuf[0]=bufget8bit(smBus[bushandle].recv_rsbuf, smBus[bushandle].cmd_recv_queue_bytes++); - smDebug(Trace,bushandle,"RET16B: %d\n",read.retData); + smDebug(bushandle,Trace,"RET16B: %d\n",read.retData); if(retValue!=NULL) *retValue=read.retData; return recordStatus(bushandle,SM_OK); @@ -616,7 +616,7 @@ SM_STATUS smGetQueuedSMCommandReturnValue( const smbus bushandle, smint32 *retV readBuf[2]=rxbyte; readBuf[1]=bufget8bit(smBus[bushandle].recv_rsbuf, smBus[bushandle].cmd_recv_queue_bytes++); readBuf[0]=bufget8bit(smBus[bushandle].recv_rsbuf, smBus[bushandle].cmd_recv_queue_bytes++); - smDebug(Trace,bushandle,"RET24B: %d\n",read.retData); + smDebug(bushandle,Trace,"RET24B: %d\n",read.retData); if(retValue!=NULL) *retValue=read.retData; return recordStatus(bushandle,SM_OK); @@ -630,7 +630,7 @@ SM_STATUS smGetQueuedSMCommandReturnValue( const smbus bushandle, smint32 *retV readBuf[2]=bufget8bit(smBus[bushandle].recv_rsbuf, smBus[bushandle].cmd_recv_queue_bytes++); readBuf[1]=bufget8bit(smBus[bushandle].recv_rsbuf, smBus[bushandle].cmd_recv_queue_bytes++); readBuf[0]=bufget8bit(smBus[bushandle].recv_rsbuf, smBus[bushandle].cmd_recv_queue_bytes++); - smDebug(Trace,bushandle,"RET32B: %d\n",read.retData); + smDebug(bushandle,Trace,"RET32B: %d\n",read.retData); if(retValue!=NULL) *retValue=read.retData; return recordStatus(bushandle,SM_OK); @@ -641,7 +641,7 @@ SM_STATUS smGetQueuedSMCommandReturnValue( const smbus bushandle, smint32 *retV SMPayloadCommandRet8 read; smuint8 *readBuf=(smuint8*)&read; readBuf[0]=rxbyte; - smDebug(Trace,bushandle,"RET_OTHER: %d\n",read.retData); + smDebug(bushandle,Trace,"RET_OTHER: %d\n",read.retData); if(retValue!=NULL) *retValue=read.retData; return recordStatus(bushandle,SM_OK); -- cgit v1.2.3