调整低功耗模式
This commit is contained in:
parent
eb56aec47d
commit
947e525ce8
|
@ -982,10 +982,23 @@ void HCamDevice::HtCamWriteADCReg(uint8_t addr, uint8_t data)
|
||||||
|
|
||||||
void HCamDevice::HtCamSetLowPower(bool val)
|
void HCamDevice::HtCamSetLowPower(bool val)
|
||||||
{
|
{
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
printf("重置\r\n");
|
||||||
|
ioctl(subDevicefd,200,NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("val :%d\r\n",val);
|
||||||
CamZ_Reg_4_New low_power ;
|
CamZ_Reg_4_New low_power ;
|
||||||
low_power.value = HtCamReadFpgaRegs(0x04);
|
low_power.value = HtCamReadFpgaRegs(0x04);
|
||||||
low_power.soft_rst_n = val;
|
low_power.soft_rst_n = val;
|
||||||
HtCamWriteFpgaRegs(0x04 , low_power.value);
|
HtCamWriteFpgaRegs(0x04 , low_power.value);
|
||||||
|
|
||||||
|
low_power.value = HtCamReadFpgaRegs(0x04);
|
||||||
|
printf("low_power:%d\r\n",low_power.soft_rst_n);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HCamDevice::HtCamReadADCReg_ALL(uint8_t addr)
|
void HCamDevice::HtCamReadADCReg_ALL(uint8_t addr)
|
||||||
|
|
|
@ -52,6 +52,8 @@ public:
|
||||||
|
|
||||||
virtual void setScanFlag(bool brun) = 0;
|
virtual void setScanFlag(bool brun) = 0;
|
||||||
|
|
||||||
|
virtual void SetLowPower(bool islow) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<FpgaComm> m_capFpageregs;
|
std::shared_ptr<FpgaComm> m_capFpageregs;
|
||||||
BlockingQueue<V4L2_DATAINFO> m_v4l2data;
|
BlockingQueue<V4L2_DATAINFO> m_v4l2data;
|
||||||
|
|
13
Keyboard.cpp
13
Keyboard.cpp
|
@ -2,9 +2,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#define KEYCODE_POWER 62
|
#define KEYCODE_POWER 116
|
||||||
#define KEYCODE_START 60
|
#define KEYCODE_START 60
|
||||||
#define KEYCODE_STOP 61
|
#define KEYCODE_STOP 115
|
||||||
|
|
||||||
namespace huagao
|
namespace huagao
|
||||||
{
|
{
|
||||||
|
@ -163,11 +163,15 @@ namespace huagao
|
||||||
{
|
{
|
||||||
if (!b_lowpwoer) //未进入低功耗 则触发低功耗模式
|
if (!b_lowpwoer) //未进入低功耗 则触发低功耗模式
|
||||||
{
|
{
|
||||||
b_lowpwoer = !b_lowpwoer;
|
b_lowpwoer = true;
|
||||||
m_event(2);
|
m_event(2);
|
||||||
}
|
}
|
||||||
else //已进入低功耗模式
|
else //已进入低功耗模式
|
||||||
|
{
|
||||||
b_lowpwoer = false;
|
b_lowpwoer = false;
|
||||||
|
m_event(3);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -175,10 +179,11 @@ namespace huagao
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEYCODE_START:
|
case KEYCODE_START:
|
||||||
|
printf("KEYCODE_START\r\n");
|
||||||
m_event(0);
|
m_event(0);
|
||||||
break;
|
break;
|
||||||
case KEYCODE_STOP:
|
case KEYCODE_STOP:
|
||||||
LOG("stop KEYCODE_STOP pressed!\n");
|
printf("stop KEYCODE_STOP pressed!\n");
|
||||||
m_event(1);
|
m_event(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -139,6 +139,11 @@ void *MultiFrameCapture::readFrameTest(int timeout)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
void MultiFrameCapture::SetLowPower(bool islow)
|
||||||
|
{
|
||||||
|
video->HtCamSetLowPower(islow);
|
||||||
|
}
|
||||||
|
|
||||||
#include<math.h>
|
#include<math.h>
|
||||||
uint32_t MultiFrameCapture::compute_frame(int paper_size,int dpi)
|
uint32_t MultiFrameCapture::compute_frame(int paper_size,int dpi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,6 +115,8 @@ private:
|
||||||
SIZE GetPaperSize(PaperSize paper, int dpi);
|
SIZE GetPaperSize(PaperSize paper, int dpi);
|
||||||
uint32_t compute_frame(int paper_size,int dpi); //计算固定幅面需要采集的帧数
|
uint32_t compute_frame(int paper_size,int dpi); //计算固定幅面需要采集的帧数
|
||||||
void compute_height(int width,int height); //在open 之前调用
|
void compute_height(int width,int height); //在open 之前调用
|
||||||
|
public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MultiFrameCapture(ScannerGlue glue, CISVendor vendor);
|
MultiFrameCapture(ScannerGlue glue, CISVendor vendor);
|
||||||
|
|
||||||
|
@ -159,4 +161,6 @@ public:
|
||||||
virtual void clearimages() override;
|
virtual void clearimages() override;
|
||||||
|
|
||||||
virtual void setScanFlag(bool brun) override;
|
virtual void setScanFlag(bool brun) override;
|
||||||
|
|
||||||
|
virtual void SetLowPower(bool islow);
|
||||||
};
|
};
|
22
Scanner.cpp
22
Scanner.cpp
|
@ -6,9 +6,10 @@
|
||||||
#include "SysInforTool.h"
|
#include "SysInforTool.h"
|
||||||
#include "USBProtocol.h"
|
#include "USBProtocol.h"
|
||||||
|
|
||||||
#define BTNSTART 0
|
#define BTN_START 0
|
||||||
#define BTNSTOP 1
|
#define BTN_STOP 1 //按键停止扫描
|
||||||
#define BTNPOWER 2
|
#define BTN_LOW_POWER 2 //按键低功耗
|
||||||
|
#define BTN_NORMAL_POWER 3 //按键正常模式 (退出低功耗)
|
||||||
|
|
||||||
Scanner::Scanner(ScannerGlue glue)
|
Scanner::Scanner(ScannerGlue glue)
|
||||||
: motorZouzhi(),
|
: motorZouzhi(),
|
||||||
|
@ -49,18 +50,25 @@ Scanner::Scanner(ScannerGlue glue)
|
||||||
{
|
{
|
||||||
if (!IsScanning()) //未扫描
|
if (!IsScanning()) //未扫描
|
||||||
{
|
{
|
||||||
if (eventtype == BTNPOWER)
|
if (eventtype == BTN_LOW_POWER)
|
||||||
{
|
{
|
||||||
system("echo mem > /sys/power/state");
|
//system("echo mem > /sys/power/state");
|
||||||
|
//capturer->SetLowPower(0);
|
||||||
|
system("/mnt/flash-disk/low_power.sh 1");
|
||||||
}
|
}
|
||||||
else if (eventtype == BTNSTART)
|
else if (eventtype == BTN_START)
|
||||||
{
|
{
|
||||||
// put(S_EVT_START_SCAN);
|
// put(S_EVT_START_SCAN);
|
||||||
}
|
}
|
||||||
|
else if(eventtype == BTN_NORMAL_POWER)
|
||||||
|
{
|
||||||
|
//capturer->SetLowPower(1);
|
||||||
|
system("/mnt/flash-disk/low_power.sh 0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else //扫描中
|
else //扫描中
|
||||||
{
|
{
|
||||||
if (eventtype == BTNSTOP)
|
if (eventtype == BTN_STOP)
|
||||||
{
|
{
|
||||||
put(S_EVT_STOP_SCAN);
|
put(S_EVT_STOP_SCAN);
|
||||||
LOG("BTN_STOP put(S_EVT_STOP_SCAN)");
|
LOG("BTN_STOP put(S_EVT_STOP_SCAN)");
|
||||||
|
|
|
@ -53,16 +53,14 @@ public:
|
||||||
void stop_scan()
|
void stop_scan()
|
||||||
{
|
{
|
||||||
printf("!!!!!!!!!!!!!!!!!!!!!stop_scan() waitting snap session done \n");
|
printf("!!!!!!!!!!!!!!!!!!!!!stop_scan() waitting snap session done \n");
|
||||||
//sensor->enableDoubleSensor(false);
|
|
||||||
sensor->cancelWaitPaper();
|
sensor->cancelWaitPaper();
|
||||||
m_DstScannum = 0;
|
m_DstScannum = 0;
|
||||||
//LOG("!!!!!!!!!!!!!!!!!!!!!!!!!!stop_scan() waitting snap session done \n");
|
|
||||||
if (threadRunScan.joinable())
|
if (threadRunScan.joinable())
|
||||||
threadRunScan.join();
|
threadRunScan.join();
|
||||||
motorZouzhi.stop();
|
motorZouzhi.stop();
|
||||||
motorCuozhi.stop();
|
motorCuozhi.stop();
|
||||||
// std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
|
||||||
//capturer->close();
|
|
||||||
put(S_EVT_SCAN_STOPPED);
|
put(S_EVT_SCAN_STOPPED);
|
||||||
SaveScaninfo(m_scaninfo);
|
SaveScaninfo(m_scaninfo);
|
||||||
start_enter_lowpwoer();
|
start_enter_lowpwoer();
|
||||||
|
|
Loading…
Reference in New Issue