调整gpio监控

lowmem
Matthew 2 months ago
parent b734a9cc2a
commit 5a8be5883b

@ -26,7 +26,9 @@ std::mutex GpioControl::m_locker;
std::vector<GpioControl::ITEM> GpioControl::m_items; std::vector<GpioControl::ITEM> GpioControl::m_items;
bool GpioControl::m_cameraPowerStatus = false; bool GpioControl::m_cameraPowerStatus = false;
#if 0 #define ENABLE_GPIO_TRACING
#ifdef ENABLE_GPIO_TRACING
class GpioDebugLogger class GpioDebugLogger
{ {
public: public:
@ -38,6 +40,14 @@ public:
CreateEmptyFile(m_path + ".enter"); CreateEmptyFile(m_path + ".enter");
} }
GpioDebugLogger(int cmd)
{
m_startTime = GetMicroTimeStamp();
m_path = std::string("/sdcard/com.xypower.mpapp/tmp/") + std::to_string(cmd) + std::string("_") + std::to_string(m_startTime) + "_get";
CreateEmptyFile(m_path + ".enter");
}
~GpioDebugLogger() ~GpioDebugLogger()
{ {
uint64_t ts = (GetMicroTimeStamp() - m_startTime); uint64_t ts = (GetMicroTimeStamp() - m_startTime);
@ -85,7 +95,7 @@ size_t GpioControl::turnOnImpl(const IOT_PARAM& param)
if (oldRef == 0/* || param.cmd != CMD_SET_3V3_PWR_EN*/) if (oldRef == 0/* || param.cmd != CMD_SET_3V3_PWR_EN*/)
{ {
#if 0 #ifdef ENABLE_GPIO_TRACING
GpioDebugLogger logger(param.cmd, param.value); GpioDebugLogger logger(param.cmd, param.value);
#endif #endif
fd = open(GPIO_NODE_MP, O_RDONLY); fd = open(GPIO_NODE_MP, O_RDONLY);
@ -114,7 +124,7 @@ void GpioControl::setInt(int cmd, int value)
// param.cmd = cmd; // param.cmd = cmd;
// param.value = value; // param.value = value;
#if 0 #ifdef ENABLE_GPIO_TRACING
GpioDebugLogger logger(cmd, value); GpioDebugLogger logger(cmd, value);
#endif #endif
int fd = open(GPIO_NODE_MP, O_RDONLY); int fd = open(GPIO_NODE_MP, O_RDONLY);
@ -132,6 +142,9 @@ void GpioControl::setInt(int cmd, int value)
int GpioControl::getInt(int cmd) int GpioControl::getInt(int cmd)
{ {
#ifdef ENABLE_GPIO_TRACING
GpioDebugLogger logger(cmd);
#endif
int fd = open(GPIO_NODE_MP, O_RDONLY); int fd = open(GPIO_NODE_MP, O_RDONLY);
// LOGE("get_int fd=%d,cmd=%d\r\n",fd, cmd); // LOGE("get_int fd=%d,cmd=%d\r\n",fd, cmd);
if( fd > 0 ) if( fd > 0 )

Loading…
Cancel
Save