调整低功耗模式

This commit is contained in:
modehua 2023-10-10 03:12:15 -07:00
parent eb56aec47d
commit 947e525ce8
7 changed files with 55 additions and 20 deletions

View File

@ -982,10 +982,23 @@ void HCamDevice::HtCamWriteADCReg(uint8_t addr, uint8_t data)
void HCamDevice::HtCamSetLowPower(bool val)
{
CamZ_Reg_4_New low_power ;
low_power.value = HtCamReadFpgaRegs(0x04);
low_power.soft_rst_n = val;
HtCamWriteFpgaRegs(0x04 , low_power.value);
if (val)
{
printf("重置\r\n");
ioctl(subDevicefd,200,NULL);
}
else
{
printf("val :%d\r\n",val);
CamZ_Reg_4_New low_power ;
low_power.value = HtCamReadFpgaRegs(0x04);
low_power.soft_rst_n = val;
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)

View File

@ -52,6 +52,8 @@ public:
virtual void setScanFlag(bool brun) = 0;
virtual void SetLowPower(bool islow) = 0;
protected:
std::shared_ptr<FpgaComm> m_capFpageregs;
BlockingQueue<V4L2_DATAINFO> m_v4l2data;

View File

@ -2,9 +2,9 @@
#include <stdio.h>
#include <sys/time.h>
#define KEYCODE_POWER 62
#define KEYCODE_POWER 116
#define KEYCODE_START 60
#define KEYCODE_STOP 61
#define KEYCODE_STOP 115
namespace huagao
{
@ -163,11 +163,15 @@ namespace huagao
{
if (!b_lowpwoer) //未进入低功耗 则触发低功耗模式
{
b_lowpwoer = !b_lowpwoer;
b_lowpwoer = true;
m_event(2);
}
else //已进入低功耗模式
{
b_lowpwoer = false;
m_event(3);
}
}
else
{
@ -175,10 +179,11 @@ namespace huagao
}
break;
case KEYCODE_START:
printf("KEYCODE_START\r\n");
m_event(0);
break;
case KEYCODE_STOP:
LOG("stop KEYCODE_STOP pressed!\n");
printf("stop KEYCODE_STOP pressed!\n");
m_event(1);
break;
default:

View File

@ -139,6 +139,11 @@ void *MultiFrameCapture::readFrameTest(int timeout)
{
return nullptr;
}
void MultiFrameCapture::SetLowPower(bool islow)
{
video->HtCamSetLowPower(islow);
}
#include<math.h>
uint32_t MultiFrameCapture::compute_frame(int paper_size,int dpi)
{
@ -249,7 +254,7 @@ void MultiFrameCapture::setFanMode(int mode)
void MultiFrameCapture::fpgaReload()
{
}
bool MultiFrameCapture::capturerImage()

View File

@ -115,6 +115,8 @@ private:
SIZE GetPaperSize(PaperSize paper, int dpi);
uint32_t compute_frame(int paper_size,int dpi); //计算固定幅面需要采集的帧数
void compute_height(int width,int height); //在open 之前调用
public:
public:
MultiFrameCapture(ScannerGlue glue, CISVendor vendor);
@ -159,4 +161,6 @@ public:
virtual void clearimages() override;
virtual void setScanFlag(bool brun) override;
virtual void SetLowPower(bool islow);
};

View File

@ -6,9 +6,10 @@
#include "SysInforTool.h"
#include "USBProtocol.h"
#define BTNSTART 0
#define BTNSTOP 1
#define BTNPOWER 2
#define BTN_START 0
#define BTN_STOP 1 //按键停止扫描
#define BTN_LOW_POWER 2 //按键低功耗
#define BTN_NORMAL_POWER 3 //按键正常模式 (退出低功耗)
Scanner::Scanner(ScannerGlue glue)
: motorZouzhi(),
@ -49,18 +50,25 @@ Scanner::Scanner(ScannerGlue glue)
{
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);
}
else if(eventtype == BTN_NORMAL_POWER)
{
//capturer->SetLowPower(1);
system("/mnt/flash-disk/low_power.sh 0");
}
}
else //扫描中
{
if (eventtype == BTNSTOP)
if (eventtype == BTN_STOP)
{
put(S_EVT_STOP_SCAN);
LOG("BTN_STOP put(S_EVT_STOP_SCAN)");

View File

@ -53,16 +53,14 @@ public:
void stop_scan()
{
printf("!!!!!!!!!!!!!!!!!!!!!stop_scan() waitting snap session done \n");
//sensor->enableDoubleSensor(false);
sensor->cancelWaitPaper();
m_DstScannum = 0;
//LOG("!!!!!!!!!!!!!!!!!!!!!!!!!!stop_scan() waitting snap session done \n");
if (threadRunScan.joinable())
threadRunScan.join();
motorZouzhi.stop();
motorCuozhi.stop();
// std::this_thread::sleep_for(std::chrono::milliseconds(200));
//capturer->close();
put(S_EVT_SCAN_STOPPED);
SaveScaninfo(m_scaninfo);
start_enter_lowpwoer();