调整按键和摩尔纹
This commit is contained in:
parent
7288701891
commit
37c23df3c9
|
@ -77,7 +77,7 @@ union CamZ_Reg_A_New
|
|||
unsigned int psen: 1; //使能相移 写低写高
|
||||
unsigned int psincdec : 1; //相移动反向
|
||||
unsigned int clr_psedon : 1;//清除相完成 写低写高
|
||||
unsigned int dpi: 2;//bit 12 //1: 300DPI 0: 600DPI
|
||||
unsigned int dpi: 1;//bit 12 //1: 300DPI 0: 600DPI
|
||||
unsigned int dpi_200: 1; //dpi=1的时候 dpi_200=1 200dpi dpi=1的时候 dpi_200=0 300dpi dpi=0的时候 dpi_200=0 600dpi
|
||||
};
|
||||
};
|
||||
|
|
|
@ -306,7 +306,9 @@ void HCamDevice::HtCamSetPeriod(double reg_value)
|
|||
{
|
||||
reg_value /= 10;
|
||||
printf("reg_value:%f\r\n",reg_value);
|
||||
double pr = reg_value == 0 ? 0x183C/2 :reg_value * 0x183C / 1;
|
||||
double pr = reg_value == 0 || reg_value > 10 ? 0x183C/2 :reg_value * 0x183C / 1;
|
||||
|
||||
printf("\r\n");
|
||||
|
||||
if (virBaseAddr == NULL)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "Keyboard.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "utilsfunc.h"
|
||||
#define KEYCODE_POWER 116
|
||||
#define KEYCODE_START 60
|
||||
#define KEYCODE_STOP 115
|
||||
|
@ -137,45 +137,40 @@ namespace huagao
|
|||
if (n == sizeof(input_event))
|
||||
{
|
||||
memcpy((void *)(&input_ev), buffer, sizeof(input_event));
|
||||
LOG("keyboard type=%d; code=%d; value=%d, sec=%ld, usec=%ld\n", (int)input_ev.type,
|
||||
(int)input_ev.code, (int)input_ev.value, input_ev.time.tv_sec, input_ev.time.tv_usec);
|
||||
if (input_ev.type == 0)
|
||||
if (input_ev.type == 0) // 非按键不响应
|
||||
{
|
||||
n = 0;
|
||||
continue;
|
||||
}
|
||||
if (input_ev.value == 1)
|
||||
|
||||
LOG("keyboard type=%d; code=%d; value=%d, sec=%ld, usec=%ld\n", (int)input_ev.type,
|
||||
(int)input_ev.code, (int)input_ev.value, input_ev.time.tv_sec, input_ev.time.tv_usec);
|
||||
|
||||
if (input_ev.value == 0 && input_ev.type == 1) //记录按下的时间状态
|
||||
{
|
||||
LOG("pressed....\n");
|
||||
time_pressed_sec = (long)input_ev.time.tv_sec;
|
||||
time_pressed_usec = (long)input_ev.time.tv_usec;
|
||||
n = 0;
|
||||
continue;
|
||||
}
|
||||
LOG("keyboard press tiem sec=%ld, usec=%ld\n", time_pressed_sec, time_pressed_usec);
|
||||
long delay = (input_ev.time.tv_usec - time_pressed_usec) / 1000;
|
||||
double delay = (input_ev.time.tv_usec - time_pressed_usec) / 1000;
|
||||
delay = delay + (input_ev.time.tv_sec - time_pressed_sec) * 1000;
|
||||
LOG("press delay:%ld\n", delay);
|
||||
LOG("press delay:%lf\n", delay);
|
||||
switch (input_ev.code)
|
||||
{
|
||||
case KEYCODE_POWER:
|
||||
if (delay >= 1000)
|
||||
|
||||
|
||||
if (delay >= 3000 && delay <= 200000)
|
||||
{
|
||||
if (!b_lowpwoer) //未进入低功耗 则触发低功耗模式
|
||||
{
|
||||
b_lowpwoer = true;
|
||||
m_event(2);
|
||||
}
|
||||
else //已进入低功耗模式
|
||||
{
|
||||
b_lowpwoer = false;
|
||||
m_event(3);
|
||||
}
|
||||
|
||||
printf("设备关机中。。。\r\n");
|
||||
system("poweroff");
|
||||
}
|
||||
else
|
||||
else if (get_devs_status(SLEEP_STATUS_PATH) == SCANNER_ERR_SLEEP)
|
||||
{
|
||||
b_lowpwoer = false;
|
||||
m_event(3);
|
||||
printf("按键唤醒设备中。。。\r\n");
|
||||
}
|
||||
break;
|
||||
case KEYCODE_START:
|
||||
|
@ -183,7 +178,7 @@ namespace huagao
|
|||
m_event(0);
|
||||
break;
|
||||
case KEYCODE_STOP:
|
||||
printf("stop KEYCODE_STOP pressed!\n");
|
||||
printf("按键停止扫描!!!\n");
|
||||
m_event(1);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -190,7 +190,8 @@ void MultiFrameCapture::UpdateScanParam(HG_ScanConfiguration config)
|
|||
|
||||
//width_ = paper_size_ == PaperSize::G400_MAXSIZE || paper_size_ ==PaperSize::G400_MAXAUTO &&
|
||||
printf("config.params.dc;%d\r\n",config.params.dc);
|
||||
video->HtCamSetPeriod(config.params.dc);
|
||||
|
||||
video->HtCamSetPeriod(config.params.dc < 0 || config.params.dc > 10 ? 5 : config.params.dc);
|
||||
|
||||
//int height = resolution_ == DPI_600 ? 342 : 900;
|
||||
int height = config.params.dpi == 3 ? 900 :(config.params.dpi == 2?999:300);
|
||||
|
@ -215,7 +216,7 @@ void MultiFrameCapture::UpdateScanParam(HG_ScanConfiguration config)
|
|||
//除摩尔纹模式
|
||||
if(config.params.slow_moire && config.params.dpi != 3)
|
||||
{
|
||||
int sp = fpgaparam.Sp + 232; //258 摩尔纹是400dpi 4677的高度
|
||||
int sp = fpgaparam.Sp + 241; //258 摩尔纹是400dpi 4677的高度
|
||||
|
||||
val = 400;
|
||||
video->HtCamSetSpTime(sp,fpgaparam.MaxExp); // 2344 灰色 //2023-8-10 最新2650
|
||||
|
|
Loading…
Reference in New Issue