From 9eae141ee477d03ad7ea713790f2d1b9fb6ba806 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Tue, 14 Sep 2021 16:45:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EG300/G400=E9=80=9F=E7=8E=87?= =?UTF-8?q?=E5=8F=AF=E9=85=8D=EF=BC=8C=E5=A4=84=E7=90=86G300/G400=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HaoGaoCOrrect修改记录.txt | 4 ++ HuaGoCorrect/A3.cpp | 74 +++++++++++++++++++++++++++------ HuaGoCorrect/A3.h | 9 ++++ HuaGoCorrect/A4.cpp | 12 +++++- HuaGoCorrect/HuaGoCorrect.rc | Bin 38488 -> 38614 bytes HuaGoCorrect/ImageMatQueue.cpp | 15 +++++-- HuaGoCorrect/Resource.h | Bin 13838 -> 14022 bytes HuaGoCorrect/gscn_drv.cpp | 17 ++++++++ 8 files changed, 112 insertions(+), 19 deletions(-) diff --git a/HaoGaoCOrrect修改记录.txt b/HaoGaoCOrrect修改记录.txt index 280e538..14a61fd 100644 --- a/HaoGaoCOrrect修改记录.txt +++ b/HaoGaoCOrrect修改记录.txt @@ -8,6 +8,10 @@ 2021年7月31日 1.增加3399 板子g100 g200 校正及配置功能 +2021年9月14日 +1、增加G300/G400速率可配置 +2、处理G300/G400不能出图问题 + 2021年8月17日 1. 界面增加速度模式配置功能; 2. 增加明场暗场校正最大明场值配置; diff --git a/HuaGoCorrect/A3.cpp b/HuaGoCorrect/A3.cpp index 6df90bd..4acc860 100644 --- a/HuaGoCorrect/A3.cpp +++ b/HuaGoCorrect/A3.cpp @@ -60,6 +60,13 @@ BOOL CA3::OnInitDialog() { m_cmbSpeedmode.InsertString(i, speedmodeMapString[i]); } + speedemodelen = speedmodeMap.size() + G300G400speedmodeMapString.size(); + size_t j = 1; + for (size_t i = speedmodeMap.size(); i < speedemodelen; i++) + { + m_cmbSpeedmode.InsertString(i, G300G400speedmodeMapString[j]); + ++j; + } return TRUE; // return TRUE unless you set the focus to a control // 쳣: OCX ҳӦ FALSE } @@ -288,35 +295,76 @@ void CA3::updatespeedmode(bool get) auto parent = (CHuaGoCorrectDlg*)GetParent(); if (parent != NULL) { - if (parent->m_drv.get() && parent->m_drv->IsConnected()) { + if (parent->m_drv.get() && parent->m_drv->IsConnected()) + { int speedmode; + std::string ver = parent->m_drv->GetFWVersion(); + if (!ver.empty()) + { + ver = ver.substr(0, 2); + } if (get) { parent->m_drv->GetSpeedMode(speedmode, true); bool bfound = false; - for (size_t i = 0; i < speedmodeMap.size(); i++) + if (ver != "G3" && ver != "G4") { - if (speedmodeMap[i].Speedmode == speedmode) + for (size_t i = 0; i < speedmodeMap.size(); i++) { - m_cmbSpeedmode.SetCurSel(i); - OnGetOrSetSp(true, 0);//»Ҷsp - OnGetOrSetSp(true, 1);//²ɫsp - bfound = true; - break; + if (speedmodeMap[i].Speedmode == speedmode) + { + m_cmbSpeedmode.SetCurSel(i); + OnGetOrSetSp(true, 0);//»Ҷsp + OnGetOrSetSp(true, 1);//²ɫsp + bfound = true; + break; + } } } + else + { + size_t j = 1; + for (size_t i = speedmodeMap.size(); i < speedemodelen; i++) + { + if (j == speedmode) + { + m_cmbSpeedmode.SetCurSel(i); + bfound = true; + break; + } + ++j; + } + } + + if (!bfound) MessageBox(L"δҵӦٶģʽ", L"ʾ", MB_OK | MB_ICONINFORMATION); } else { int cmbindex = m_cmbSpeedmode.GetCurSel(); - if (cmbindex != -1) + if (cmbindex != -1 && cmbindex < speedmodeMap.size()) { - auto t_speedmode = speedmodeMap[cmbindex]; - parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false); - parent->m_drv->SetSptime(0, t_speedmode.GraySp); - parent->m_drv->SetSptime(1, t_speedmode.ColorSp); + if (ver == "G3" || ver == "G4") + { + MessageBox(L"豸кǰλΪG3/G4ȷ豸", L"ѡ", MB_OK | MB_ICONINFORMATION); + return; + } + + auto t_speedmode = speedmodeMap[cmbindex]; + parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false); + parent->m_drv->SetSptime(0, t_speedmode.GraySp); + + } + else + { + if (ver != "G3" && ver != "G4") + { + MessageBox(L"豸кǰλΪG3/G4ȷ豸", L"ѡ", MB_OK | MB_ICONINFORMATION); + return; + } + cmbindex = cmbindex - speedmodeMap.size() + 1; + parent->m_drv->GetSpeedMode(cmbindex, false); } } } diff --git a/HuaGoCorrect/A3.h b/HuaGoCorrect/A3.h index f66a329..019abef 100644 --- a/HuaGoCorrect/A3.h +++ b/HuaGoCorrect/A3.h @@ -51,6 +51,7 @@ private: unsigned int ColorSp; unsigned int GraySp; }; + int speedemodelen; std::map speedmodeMap = { {0,{70,0x42d,0xc88}}, {1,{80,0x37f,0xa7f}}, @@ -70,5 +71,13 @@ private: {5,L"G200_120PPM"}, {6,L"G200_130PPM"} }; + + std::map G300G400speedmodeMapString = { + {1,L"G300/G400_40PPM"}, + {2,L"G300/G400_50PPM"}, + {3,L"G300/G400_60PPM"}, + {4,L"G300/G400_70PPM"}, + {5,L"G400_80PPM"}, + }; CComboBox m_cmbSpeedmode; }; diff --git a/HuaGoCorrect/A4.cpp b/HuaGoCorrect/A4.cpp index d36d583..4dcfbcd 100644 --- a/HuaGoCorrect/A4.cpp +++ b/HuaGoCorrect/A4.cpp @@ -400,12 +400,20 @@ void CA4::OnBnClickedBtnbdown() void CA4::UpdateGains(int id, bool increase) { UpdateData(TRUE); + int offect; + CString offectstr; + GetDlgItemText(IDC_tbxOffect, offectstr); + USES_CONVERSION; + std::string str_b(W2A(offectstr)); + offect = atoi(str_b.c_str()); + if (offect <= 0) + offect = 1; if ((id == IDC_BTNAUP || id == IDC_BTNBUP) && increase) { int startindex = id == IDC_BTNAUP ? 0 : 6; for (size_t i = startindex; i < (6+ startindex); i++) { - params.Gain[i] = params.Gain[i]++; + params.Gain[i] += offect; } } else if((id==IDC_BTNADOWN||id==IDC_BTNBDOWN)&&!increase) @@ -413,7 +421,7 @@ void CA4::UpdateGains(int id, bool increase) int startindex = id == IDC_BTNADOWN ? 0 : 6; for (size_t i = startindex; i < (6 + startindex); i++) { - params.Gain[i] = params.Gain[i]--; + params.Gain[i] -= offect; } } UpdateData(FALSE); diff --git a/HuaGoCorrect/HuaGoCorrect.rc b/HuaGoCorrect/HuaGoCorrect.rc index 272c3ec0fc239bee713de1270f90901d9dbe973f..bceb37031ce849b8e6b37dbd84faa27429631974 100644 GIT binary patch delta 110 zcmcbyhUwZ`rVS1vj3%2MMdk)hzGKEQ`Gbze7K$yyq%uvFh!(hx{2E;lH z<_wmT9i802+kS*HF16SDz>(&ULP fqLUpO#TH97A^5X8xF-9xa7?c2;@a%j(jf!@1P>k4 diff --git a/HuaGoCorrect/ImageMatQueue.cpp b/HuaGoCorrect/ImageMatQueue.cpp index 1b103c7..f57aacd 100644 --- a/HuaGoCorrect/ImageMatQueue.cpp +++ b/HuaGoCorrect/ImageMatQueue.cpp @@ -4,6 +4,8 @@ #include "filetools.h" #include "imageprocess.h" #include +#include +using namespace std; static int imgindex = 0; ImageMatQueue::ImageMatQueue(void) { @@ -111,11 +113,13 @@ void ImageMatQueue::proc() { if (pixType != -1) { - std::string csName; + //string csName; SYSTEMTIME st = { 0 }; GetLocalTime(&st); //ȡǰʱ ɾȷms - //csName.Format("%02d%02d%02d-%d.bmp", st.wHour, st.wMinute, st.wSecond,++imgindex); - + //csName.Format(_T("%02d%02d%02d-%d.bmp"), st.wHour, st.wMinute, st.wSecond,++imgindex); + char szDateTime[20] = { 0 }; + sprintf(szDateTime,"%02d%02d%02d-%d.bmp", st.wHour, st.wMinute, st.wSecond, ++imgindex); + string csName(szDateTime); cv::Mat matPicImage; cv::Mat matFront, matBack; //vector mats; @@ -138,13 +142,16 @@ void ImageMatQueue::proc() case 4://G500 ͼһͼϣҪͼ { std::string csImage; - csImage = csPath + "\\G300" + csName; + csImage = csPath + "\\G300"+ csName; + //cv::Mat mat = m_pImages.Take().getMat(pixType); //matPicImage = mat(cv::Rect(0, 0, mat.cols, mat.rows)); ////mats.push_back(matPicImage); //IplImage qqImg; //qqImg = IplImage(matPicImage); // cv::Mat -> IplImage //cvSaveImage(csImage, &qqImg); + cv::Mat mat = m_pImages.Take().getMat(pixType);//1 color 6 gray + cv::imwrite(csImage, mat); m_images.Put(csImage); } break; diff --git a/HuaGoCorrect/Resource.h b/HuaGoCorrect/Resource.h index 298b72c50848fbb575ee6117d1682d7bf2cb1707..4b68b22683515414b14316b32599b769c7167c3a 100644 GIT binary patch delta 62 zcmeCnIhMOYNo2Ad8^>fRE+n2LJNo4aakvEC}CtU@? diff --git a/HuaGoCorrect/gscn_drv.cpp b/HuaGoCorrect/gscn_drv.cpp index 31bb80d..f5cbd58 100644 --- a/HuaGoCorrect/gscn_drv.cpp +++ b/HuaGoCorrect/gscn_drv.cpp @@ -238,6 +238,23 @@ void GScn_Drv::SetFlatCallback(std::function func) void GScn_Drv::GetSpeedMode(int& speedmode, bool get) { + if (m_usb.get() && m_usb->is_connected()) + { + if (get) + { + + USBCB usb = { GET_SPEED_MODE ,speedmode,0 }; + m_usb->write_bulk(&usb, sizeof(usb)); + m_usb->read_bulk(&usb, sizeof(usb)); + speedmode = usb.u32_Data; + } + else + { + USBCB usb = { SET_SPEED_MODE,speedmode,0 }; + m_usb->write_bulk(&usb, sizeof(usb)); + } + } + } void GScn_Drv::reset()