oid编码器更换,更改can_use处

This commit is contained in:
ZHAISHUI04 2025-05-29 19:37:09 +08:00
parent 553de3fa5e
commit 9fe37c6b89
3 changed files with 6 additions and 5 deletions

View File

@ -103,7 +103,7 @@
<bEvRecOn>1</bEvRecOn> <bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf> <bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf> <bTchkAxf>0</bTchkAxf>
<nTsel>6</nTsel> <nTsel>3</nTsel>
<sDll></sDll> <sDll></sDll>
<sDllPa></sDllPa> <sDllPa></sDllPa>
<sDlgDll></sDlgDll> <sDlgDll></sDlgDll>
@ -114,7 +114,7 @@
<tDlgDll></tDlgDll> <tDlgDll></tDlgDll>
<tDlgPa></tDlgPa> <tDlgPa></tDlgPa>
<tIfile></tIfile> <tIfile></tIfile>
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon> <pMon>BIN\CMSIS_AGDI.dll</pMon>
</DebugOpt> </DebugOpt>
<TargetDriverDllRegistry> <TargetDriverDllRegistry>
<SetRegEntry> <SetRegEntry>
@ -140,7 +140,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGUARM</Key> <Key>DLGUARM</Key>
<Name>(105=-1,-1,-1,-1,0)</Name> <Name></Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>

Binary file not shown.

View File

@ -32,7 +32,7 @@
#define CAN_M3508_MAX_ABS_CUR (20) #define CAN_M3508_MAX_ABS_CUR (20)
#define CAN_M2006_MAX_ABS_CUR (10) #define CAN_M2006_MAX_ABS_CUR (10)
#define CAN_ENCODER_RESOLUTION (32768) //欧艾迪编码器分辨率 #define CAN_ENCODER_RESOLUTION (4096) //欧艾迪编码器分辨率
CAN_RawRx_t raw_rx1;//原始的can数据 CAN_RawRx_t raw_rx1;//原始的can数据
CAN_RawRx_t raw_rx2; CAN_RawRx_t raw_rx2;
@ -93,7 +93,8 @@ void CAN_Encoder_Decode(CAN_EncoderFeedback_t *feedback,
{ {
case 0x01: case 0x01:
feedback->ecd =raw[3]|raw[4]<<8|raw[5]<<16|raw[6]<<24; feedback->ecd =raw[3]|raw[4]<<8|raw[5]<<16|raw[6]<<24;
feedback->angle=(fp32)feedback->ecd*360/CAN_ENCODER_RESOLUTION-151.0f; feedback->angle=(fp32)(4089-(fp32)feedback->ecd)/(4089-3861)*(70.0f-50.0f)+50.0f;
break; break;
} }
} }