50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#include <iostream>
|
|
#include <memory>
|
|
#include "scanner.h"
|
|
#include "scannerregs.h"
|
|
#include "usbservice.h"
|
|
#include "motorboard.h"
|
|
#include "ICapturer.h"
|
|
#include "Capturer.h"
|
|
#include "MonoCapturer.h"
|
|
#include "imageusbhandler.h"
|
|
#include "uartregsaccess.h"
|
|
#include "wakeup.hpp"
|
|
|
|
using namespace std;
|
|
|
|
int main()
|
|
{
|
|
remove("./out.text");
|
|
std::shared_ptr<WakeUp> wake;
|
|
wake.reset(new WakeUp());
|
|
std::shared_ptr<UartRegsAccess> uart;
|
|
wake->power_off();
|
|
uint reg_val = 0;
|
|
std::uint64_t index =0;
|
|
std::uint64_t error =0;
|
|
while(true)
|
|
{
|
|
index++;
|
|
std::this_thread::sleep_for(std::chrono::seconds(600));
|
|
wake->power_on();
|
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
uart.reset(new UartRegsAccess("/dev/ttyUSB0", 921600, 0x03, 0x83));
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
if(!uart->read(15,reg_val))
|
|
{
|
|
error++;
|
|
}
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
uart.reset();
|
|
std::this_thread::sleep_for(std::chrono::seconds(120));
|
|
wake->power_off();
|
|
std::string str = "测试次数 = "+to_string(index)+" 异常次数 = "+to_string(error);
|
|
printf("\n%s",str.c_str());
|
|
std::ofstream o("./out.text");
|
|
o << str;
|
|
o.close();
|
|
|
|
}
|
|
return 0;
|
|
} |