瀏覽代碼

Defines added

Bartosz Jakubski 2 月之前
父節點
當前提交
da4db34c45

+ 6 - 4
OZE_Sensor/Core/Inc/node-red-config.h

@@ -20,12 +20,14 @@
 
 #define MAX_X_AXE_ANGLE 360	// Max angle value for 100% range
 #define MAX_Y_AXE_ANGLE 360 // Max angle value for 100% range
-#define MOTOR_START_STOP_PWM_VALUE 60
-#define MOTOR_HIGH_SPEED_PWM_VALUE 100
+#define MOTOR_START_STOP_PWM_VALUE 60 // PWM duty for slow down/speed up movement phase
+#define MOTOR_HIGH_SPEED_PWM_VALUE 100 // PWM duty for normal movement phase
 
-#define ANGLE_RANGE_FOR_MOTOR_SPEED_LIMIT 5
+#define ANGLE_RANGE_FOR_MOTOR_SPEED_LIMIT 5 // percentage value for motor slow down/speed up boundary
+#define AXE_X_MIDDLE_VALUE 50 // percentage value of position for C limiter
+#define AXE_Y_MIDDLE_VALUE 50 // percentage value of position for C limiter
 #define TIME_MS_FOR_MOTOR_SPEED_LIMIT 1000
-#define NO_MOVE_TIMEOUT_MS 10000
+#define NO_MOVE_TIMEOUT_MS 1000 // timeout for no movement detection
 
 #define WATCHDOG_ENABLED
 //#define USER_MOCKS

+ 2 - 2
OZE_Sensor/Core/Src/meas_tasks.c

@@ -269,7 +269,7 @@ void LimiterSwitchTask (void* arg) {
             	sensorsInfo.limitYSwitchCenter = limiterSwitchData.pinState == GPIO_PIN_SET ? 1 : 0;
             	if (sensorsInfo.limitYSwitchCenter == 1)
             	{
-            		sensorsInfo.currentYPosition = 50;
+            		sensorsInfo.currentYPosition = AXE_Y_MIDDLE_VALUE;
             		sensorsInfo.positionYWeak = 0;
             	}
             	break;
@@ -285,7 +285,7 @@ void LimiterSwitchTask (void* arg) {
             	sensorsInfo.limitXSwitchCenter = limiterSwitchData.pinState == GPIO_PIN_SET ? 1 : 0;
             	if (sensorsInfo.limitXSwitchCenter == 1)
 				{
-					sensorsInfo.currentXPosition = 50;
+					sensorsInfo.currentXPosition = AXE_X_MIDDLE_VALUE;
 					sensorsInfo.positionXWeak = 0;
 				}
             	break;

+ 2 - 1
OZE_Sensor/Core/Src/position_task.c

@@ -189,7 +189,8 @@ void PositionControlTask (void* argument) {
 #endif
                         break;
                     case stopPhase:
-                        if ((*posCtrlTaskArg->currentPosition == *posCtrlTaskArg->positionSetting) || (timeLeftMS >= TIME_MS_FOR_MOTOR_SPEED_LIMIT)) {
+                    	float posDiff = sign > 0 ? posCtrlData.positionSettingValue - *posCtrlTaskArg->currentPosition : *posCtrlTaskArg->currentPosition - posCtrlData.positionSettingValue;
+                        if ((posDiff <= 0) || (timeLeftMS >= TIME_MS_FOR_MOTOR_SPEED_LIMIT)) {
                             motorStatus = MotorControl (posCtrlTaskArg->htim, posCtrlTaskArg->motorTimerConfigOC, posCtrlTaskArg->channel1, posCtrlTaskArg->channel2, posCtrlTaskArg->motorTimerHandle,
                             0, 0, *posCtrlTaskArg->switchLimiterUpStat, *posCtrlTaskArg->switchLimiterDownStat);
                             *posCtrlTaskArg->motorStatus = motorStatus;

文件差異過大導致無法顯示
+ 36172 - 36162
OZE_Sensor/Debug/OZE_Sensor.list


文件差異過大導致無法顯示
+ 1050 - 1050
OZE_Sensor/Debug/OZE_Sensor.map