This commit is contained in:
parent
146fcf6640
commit
46e9da70e1
|
@ -550,11 +550,22 @@ static void ptz_hori_pid_task()
|
|||
g_ptz.hori_pid.hall_h2_count +
|
||||
g_ptz.hori_pid.hall_h3_count;
|
||||
|
||||
static uint32_t timeH, lastTimeH, horiTime;
|
||||
timeH = OSTimeGet();
|
||||
horiTime = timeH - lastTimeH;
|
||||
if (horiTime < 0) {
|
||||
continue;
|
||||
}
|
||||
lastTimeH = timeH;
|
||||
|
||||
if(g_ptz.hori_pid.hall_h123_count >= 2)
|
||||
{
|
||||
// g_ptz.hori_pid.hall_h123_motor_speed =
|
||||
// 60000.0 * (float)(g_ptz.hori_pid.hall_h123_count/* - 1*/) /
|
||||
// (float)PTZ_HORI_PID_T / PTZ_HORI_ONE_CYCLE_HALL_NUM;
|
||||
g_ptz.hori_pid.hall_h123_motor_speed =
|
||||
60000.0 * (float)(g_ptz.hori_pid.hall_h123_count/* - 1*/) /
|
||||
(float)PTZ_HORI_PID_T / PTZ_HORI_ONE_CYCLE_HALL_NUM;
|
||||
(float)horiTime / PTZ_HORI_ONE_CYCLE_HALL_NUM;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1191,14 +1202,25 @@ static void ptz_vert_pid_task()
|
|||
g_ptz.vert_pid.hall_h2_count +
|
||||
g_ptz.vert_pid.hall_h3_count;
|
||||
|
||||
static uint32_t timeV, lastTimeV, vertTime;
|
||||
timeV = OSTimeGet();
|
||||
vertTime = timeV - lastTimeV;
|
||||
if (vertTime < 0) {
|
||||
continue;
|
||||
}
|
||||
lastTimeV = timeV;
|
||||
|
||||
if(g_ptz.vert_pid.hall_h123_count >= 2)
|
||||
{
|
||||
// g_ptz.vert_pid.hall_h123_motor_speed =
|
||||
// 60000.0 * (float)(g_ptz.vert_pid.hall_h123_count /*-1*/) /
|
||||
// (float)PTZ_VERT_PID_T / PTZ_VERT_ONE_CYCLE_HALL_NUM;
|
||||
|
||||
g_ptz.vert_pid.hall_h123_motor_speed =
|
||||
60000.0 * (float)(g_ptz.vert_pid.hall_h123_count /*-1*/) /
|
||||
(float)PTZ_VERT_PID_T / PTZ_VERT_ONE_CYCLE_HALL_NUM;
|
||||
(float)vertTime / PTZ_VERT_ONE_CYCLE_HALL_NUM;
|
||||
|
||||
}
|
||||
|
||||
g_ptz.vert_motor_speed_hall_actual = g_ptz.vert_pid.hall_h123_motor_speed;
|
||||
|
||||
/* ********************************** */
|
||||
|
|
|
@ -237,7 +237,7 @@ void ptz_uart_dev_send(device_handle device, void *data, int len)
|
|||
if(device == uart_485_handle)
|
||||
{
|
||||
PTZ_UART_485_TX;
|
||||
OSTimeDlyHMSM(0u, 0u, 0u, 10u);
|
||||
OSTimeDlyHMSM(0u, 0u, 0u, 1u);
|
||||
|
||||
for (int i = 0; i<len; i++)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ void ptz_uart_dev_send(device_handle device, void *data, int len)
|
|||
}
|
||||
}
|
||||
|
||||
OSTimeDlyHMSM(0u, 0u, 0u, 10u);
|
||||
OSTimeDlyHMSM(0u, 0u, 0u, 1u);
|
||||
PTZ_UART_485_RX;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue