fix stack thread not open

This commit is contained in:
AiYangSky 2023-12-06 10:28:50 +08:00
parent 62051a730b
commit c81716302d
4 changed files with 10 additions and 11 deletions

View File

@ -3,7 +3,7 @@
* @Author: L LC @amov * @Author: L LC @amov
* @Date: 2022-10-27 18:10:06 * @Date: 2022-10-27 18:10:06
* @LastEditors: L LC @amov * @LastEditors: L LC @amov
* @LastEditTime: 2023-12-05 17:23:48 * @LastEditTime: 2023-12-06 10:27:59
* @FilePath: /SpireCV/gimbal_ctrl/driver/src/AT10/AT10_gimbal_driver.cpp * @FilePath: /SpireCV/gimbal_ctrl/driver/src/AT10/AT10_gimbal_driver.cpp
*/ */
#include "AT10_gimbal_driver.h" #include "AT10_gimbal_driver.h"
@ -380,9 +380,10 @@ void AT10GimbalDriver::getExtRxPack(void)
} }
} }
void AT10GimbalDriver::parserStart(pAmovGimbalStateInvoke callback) void AT10GimbalDriver::parserStart(pAmovGimbalStateInvoke callback, void *caller)
{ {
this->updateGimbalStateCallback = callback; this->updateGimbalStateCallback = callback;
this->updataCaller = caller;
std::thread parser(&AT10GimbalDriver::parserLoop, this); std::thread parser(&AT10GimbalDriver::parserLoop, this);
std::thread getStdRxPackLoop(&AT10GimbalDriver::getStdRxPack, this); std::thread getStdRxPackLoop(&AT10GimbalDriver::getStdRxPack, this);

View File

@ -3,12 +3,11 @@
* @Author: L LC @amov * @Author: L LC @amov
* @Date: 2022-10-28 12:24:21 * @Date: 2022-10-28 12:24:21
* @LastEditors: L LC @amov * @LastEditors: L LC @amov
* @LastEditTime: 2023-12-05 16:30:42 * @LastEditTime: 2023-12-06 10:27:48
* @FilePath: /SpireCV/gimbal_ctrl/driver/src/AT10/AT10_gimbal_driver.h * @FilePath: /SpireCV/gimbal_ctrl/driver/src/AT10/AT10_gimbal_driver.h
*/ */
#ifndef __AT10_DRIVER_H #ifndef __AT10_DRIVER_H
#define __AT10_DRIVER_H #define __AT10_DRIVER_H
#include "../amov_gimbal_private.h" #include "../amov_gimbal_private.h"
#include "AT10_gimbal_struct.h" #include "AT10_gimbal_struct.h"
#include <mutex> #include <mutex>
@ -31,7 +30,7 @@ private:
void sendHeart(void); void sendHeart(void);
void sendStd(void); void sendStd(void);
void parserStart(pAmovGimbalStateInvoke callback); void parserStart(pAmovGimbalStateInvoke callback, void *caller);
void parserLoop(void); void parserLoop(void);
void getExtRxPack(void); void getExtRxPack(void);
void getStdRxPack(void); void getStdRxPack(void);

View File

@ -3,7 +3,7 @@
* @Author: L LC @amov * @Author: L LC @amov
* @Date: 2023-10-20 16:08:17 * @Date: 2023-10-20 16:08:17
* @LastEditors: L LC @amov * @LastEditors: L LC @amov
* @LastEditTime: 2023-12-05 17:37:59 * @LastEditTime: 2023-12-06 10:27:28
* @FilePath: /SpireCV/gimbal_ctrl/driver/src/GX40/GX40_gimbal_driver.cpp * @FilePath: /SpireCV/gimbal_ctrl/driver/src/GX40/GX40_gimbal_driver.cpp
*/ */
#include <string.h> #include <string.h>
@ -51,9 +51,10 @@ void GX40GimbalDriver::nopSend(void)
* pointer type. It is used to specify a callback function that will be invoked when the gimbal state * pointer type. It is used to specify a callback function that will be invoked when the gimbal state
* is updated. * is updated.
*/ */
void GX40GimbalDriver::parserStart(pAmovGimbalStateInvoke callback) void GX40GimbalDriver::parserStart(pAmovGimbalStateInvoke callback, void *caller)
{ {
this->updateGimbalStateCallback = callback; this->updateGimbalStateCallback = callback;
this->updataCaller = caller;
std::thread mainLoop(&GX40GimbalDriver::mainLoop, this); std::thread mainLoop(&GX40GimbalDriver::mainLoop, this);
std::thread sendNop(&GX40GimbalDriver::nopSend, this); std::thread sendNop(&GX40GimbalDriver::nopSend, this);

View File

@ -4,13 +4,11 @@
* @Author: L LC @amov * @Author: L LC @amov
* @Date: 2023-10-20 16:08:13 * @Date: 2023-10-20 16:08:13
* @LastEditors: L LC @amov * @LastEditors: L LC @amov
* @LastEditTime: 2023-12-05 16:29:20 * @LastEditTime: 2023-12-06 10:27:05
* @FilePath: /SpireCV/gimbal_ctrl/driver/src/GX40/GX40_gimbal_driver.h * @FilePath: /SpireCV/gimbal_ctrl/driver/src/GX40/GX40_gimbal_driver.h
*/ */
#ifndef __GX40_DRIVER_H #ifndef __GX40_DRIVER_H
#define __GX40_DRIVER_H #define __GX40_DRIVER_H
#include "../amov_gimbal_private.h" #include "../amov_gimbal_private.h"
#include "GX40_gimbal_struct.h" #include "GX40_gimbal_struct.h"
#include <mutex> #include <mutex>
@ -36,7 +34,7 @@ class GX40GimbalDriver : public amovGimbal::amovGimbalBase
std::thread::native_handle_type nopSendThreadHandle; std::thread::native_handle_type nopSendThreadHandle;
void nopSend(void); void nopSend(void);
void parserStart(pAmovGimbalStateInvoke callback); void parserStart(pAmovGimbalStateInvoke callback, void *caller);
public: public:
uint32_t pack(IN uint32_t cmd, uint8_t *pPayload, uint8_t payloadSize); uint32_t pack(IN uint32_t cmd, uint8_t *pPayload, uint8_t payloadSize);