test
This commit is contained in:
@ -49,7 +49,7 @@ uint16_t crc16(const uint8_t *data, size_t len, uint16_t polynomial)
|
|||||||
{
|
{
|
||||||
uint16_t i, j, tmp, CRC16;
|
uint16_t i, j, tmp, CRC16;
|
||||||
|
|
||||||
CRC16 = 0xFFFF; // CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ʼֵ
|
CRC16 = 0xFFFF; // CRC<52>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ʼֵ
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
CRC16 ^= data[i];
|
CRC16 ^= data[i];
|
||||||
@ -59,7 +59,7 @@ uint16_t crc16(const uint8_t *data, size_t len, uint16_t polynomial)
|
|||||||
CRC16 >>= 1;
|
CRC16 >>= 1;
|
||||||
if (tmp == 1)
|
if (tmp == 1)
|
||||||
{
|
{
|
||||||
CRC16 ^= polynomial; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
CRC16 ^= polynomial; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ size_t SendSettingCommand(u_char Command, size_t CommandLenth, u_char *Value, si
|
|||||||
|
|
||||||
int lenthforwrite = IRIS_Protocol_Pack(Command, (uint16_t)ValueLenth, Value, (uint8_t *)BufferFortempWrite);
|
int lenthforwrite = IRIS_Protocol_Pack(Command, (uint16_t)ValueLenth, Value, (uint8_t *)BufferFortempWrite);
|
||||||
SerialWrite(BufferFortempWrite, lenthforwrite);
|
SerialWrite(BufferFortempWrite, lenthforwrite);
|
||||||
// for 5 <20><>
|
// for 5 <20><>
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
size_t retunnumber = GetInfoBackFromSensorinTime(Command,1000);
|
size_t retunnumber = GetInfoBackFromSensorinTime(Command,1000);
|
||||||
@ -84,7 +84,7 @@ size_t SendSettingCommand(u_char Command, size_t CommandLenth, u_char *Value, si
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// <20><>I<EFBFBD>γ<EFBFBD><CEB3><EFBFBD> <20><><EFBFBD>ݻظ<DDBB><D8B8>쳣 <20><><EFBFBD><EFBFBD>ȷʵ <20><>Ӣ<EFBFBD>Ĵ<EFBFBD>ӡ
|
// <20><>I<EFBFBD>γ<EFBFBD><CEB3><EFBFBD> <20><><EFBFBD>ݻظ<DDBB><D8B8>쳣 <20><><EFBFBD><EFBFBD>ȷʵ <20><>Ӣ<EFBFBD>Ĵ<EFBFBD>ӡ
|
||||||
printf("warning try %d times: date not enough,try again!!\n",i);
|
printf("warning try %d times: date not enough,try again!!\n",i);
|
||||||
|
|
||||||
|
|
||||||
@ -100,19 +100,21 @@ size_t SendGetData(int shutter)
|
|||||||
{
|
{
|
||||||
uint8_t dataforsend=NONE_DATA;
|
uint8_t dataforsend=NONE_DATA;
|
||||||
int lenthforwrite=IRIS_Protocol_Pack(GET_DATA_FROM_SENSOR, (uint16_t)01, &dataforsend, (uint8_t *)BufferFortempWrite );
|
int lenthforwrite=IRIS_Protocol_Pack(GET_DATA_FROM_SENSOR, (uint16_t)01, &dataforsend, (uint8_t *)BufferFortempWrite );
|
||||||
|
|
||||||
SerialWrite(BufferFortempWrite, lenthforwrite);
|
SerialWrite(BufferFortempWrite, lenthforwrite);
|
||||||
for (int i=0;i<10;i++)
|
for (int i=0;i<10;i++)
|
||||||
{
|
{
|
||||||
size_t retunnumber = GetInfoBackFromSensorinTime(GET_DATA_FROM_SENSOR,2*shutter+2000);
|
size_t retunnumber = GetInfoBackFromSensorinTime(GET_DATA_FROM_SENSOR,3*shutter);
|
||||||
|
//size_t retunnumber = GetInfoBackFromSensorinTime(GET_DATA_FROM_SENSOR,2*shutter+2000);
|
||||||
if (retunnumber<OVERTIME) {
|
if (retunnumber<OVERTIME) {
|
||||||
return retunnumber;
|
return retunnumber;
|
||||||
}
|
}
|
||||||
if (i%5==0) {
|
if (i%2==0) {
|
||||||
printf("send command again\n");
|
printf("send command again\n");
|
||||||
SerialWrite(BufferFortempWrite, lenthforwrite);
|
SerialWrite(BufferFortempWrite, lenthforwrite);
|
||||||
|
|
||||||
}
|
}
|
||||||
// <20><>I<EFBFBD>γ<EFBFBD><CEB3><EFBFBD> <20><><EFBFBD>ݻظ<DDBB><D8B8>쳣 <20><><EFBFBD><EFBFBD>ȷʵ <20><>Ӣ<EFBFBD>Ĵ<EFBFBD>ӡ
|
// <20><>I<EFBFBD>γ<EFBFBD><CEB3><EFBFBD> <20><><EFBFBD>ݻظ<DDBB><D8B8>쳣 <20><><EFBFBD><EFBFBD>ȷʵ <20><>Ӣ<EFBFBD>Ĵ<EFBFBD>ӡ
|
||||||
printf("warning try %d times: date not enough,try again!!\n",i);
|
printf("warning try %d times: date not enough,try again!!\n",i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +146,7 @@ size_t GetSetBackFromSensor()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
size_t GetInfoBackFromSensor(uint8_t Command) // big <20><>ָ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>ֽڱ<D6BD>ʾ<EFBFBD><CABE><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> <20><>ʱֻ<CAB1><D6BB><EFBFBD>ֲɼ<D6B2><C9BC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
|
size_t GetInfoBackFromSensor(uint8_t Command) // big <20><>ָ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>ֽڱ<D6BD>ʾ<EFBFBD><CABE><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> <20><>ʱֻ<CAB1><D6BB><EFBFBD>ֲɼ<D6B2><C9BC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
|
||||||
{
|
{
|
||||||
delay(1);
|
delay(1);
|
||||||
TotalIndexNow = 0;
|
TotalIndexNow = 0;
|
||||||
@ -161,7 +163,7 @@ size_t GetInfoBackFromSensor(uint8_t Command) // big
|
|||||||
size_t retrunlenth=SerailRead(BufferForRead + TotalIndexNow, 5-TotalIndexNow);
|
size_t retrunlenth=SerailRead(BufferForRead + TotalIndexNow, 5-TotalIndexNow);
|
||||||
TotalIndexNow += retrunlenth;
|
TotalIndexNow += retrunlenth;
|
||||||
// if (retrunlenth!=0) {
|
// if (retrunlenth!=0) {
|
||||||
// //<2F><><EFBFBD><EFBFBD>bufferforread
|
// //<2F><><EFBFBD>bufferforread
|
||||||
// for (int i = 0; i < TotalIndexNow; i++) {
|
// for (int i = 0; i < TotalIndexNow; i++) {
|
||||||
// printf("%02x ", BufferForRead[i]);
|
// printf("%02x ", BufferForRead[i]);
|
||||||
// }
|
// }
|
||||||
@ -186,7 +188,7 @@ size_t GetInfoBackFromSensor(uint8_t Command) // big
|
|||||||
//delay(10);
|
//delay(10);
|
||||||
//delay(10);
|
//delay(10);
|
||||||
}
|
}
|
||||||
// <20><><EFBFBD><EFBFBD>bufferforread
|
// <20><><EFBFBD>bufferforread
|
||||||
printf("Data from sensor: ");
|
printf("Data from sensor: ");
|
||||||
int maxoutput= TotalIndexNow>50 ? 50 : TotalIndexNow;
|
int maxoutput= TotalIndexNow>50 ? 50 : TotalIndexNow;
|
||||||
for (int i = 0; i <maxoutput; i++) {
|
for (int i = 0; i <maxoutput; i++) {
|
||||||
@ -201,10 +203,10 @@ size_t GetInfoBackFromSensor(uint8_t Command) // big
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
size_t GetInfoBackFromSensorinTime(uint8_t Command,uint32_t waittime) // big <20><>ָ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>ֽڱ<D6BD>ʾ<EFBFBD><CABE><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> <20><>ʱֻ<CAB1><D6BB><EFBFBD>ֲɼ<D6B2><C9BC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
|
size_t GetInfoBackFromSensorinTime(uint8_t Command,uint32_t waittime) // big <20><>ָ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>ֽڱ<D6BD>ʾ<EFBFBD><CABE><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> <20><>ʱֻ<CAB1><D6BB><EFBFBD>ֲɼ<D6B2><C9BC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
|
||||||
{
|
{
|
||||||
delay(1);
|
// delay(1);
|
||||||
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
//<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
size_t begintime= get_system_uptime_ms();
|
size_t begintime= get_system_uptime_ms();
|
||||||
|
|
||||||
TotalIndexNow = 0;
|
TotalIndexNow = 0;
|
||||||
@ -221,7 +223,7 @@ size_t GetInfoBackFromSensorinTime(uint8_t Command,uint32_t waittime) // big
|
|||||||
size_t retrunlenth=SerailRead(BufferForRead + TotalIndexNow, 5-TotalIndexNow);
|
size_t retrunlenth=SerailRead(BufferForRead + TotalIndexNow, 5-TotalIndexNow);
|
||||||
TotalIndexNow += retrunlenth;
|
TotalIndexNow += retrunlenth;
|
||||||
// if (retrunlenth!=0) {
|
// if (retrunlenth!=0) {
|
||||||
// //<2F><><EFBFBD><EFBFBD>bufferforread
|
// //<2F><><EFBFBD>bufferforread
|
||||||
// for (int i = 0; i < TotalIndexNow; i++) {
|
// for (int i = 0; i < TotalIndexNow; i++) {
|
||||||
// printf("%02x ", BufferForRead[i]);
|
// printf("%02x ", BufferForRead[i]);
|
||||||
// }
|
// }
|
||||||
@ -252,7 +254,7 @@ size_t GetInfoBackFromSensorinTime(uint8_t Command,uint32_t waittime) // big
|
|||||||
//delay(10);
|
//delay(10);
|
||||||
//delay(10);
|
//delay(10);
|
||||||
}
|
}
|
||||||
// <20><><EFBFBD><EFBFBD>bufferforread
|
// <20><><EFBFBD>bufferforread
|
||||||
printf("Data from sensor: ");
|
printf("Data from sensor: ");
|
||||||
int maxoutput= TotalIndexNow>50 ? 50 : TotalIndexNow;
|
int maxoutput= TotalIndexNow>50 ? 50 : TotalIndexNow;
|
||||||
for (int i = 0; i <maxoutput; i++) {
|
for (int i = 0; i <maxoutput; i++) {
|
||||||
@ -283,7 +285,9 @@ size_t SerailRead(u_char *data, size_t lenth)
|
|||||||
{
|
{
|
||||||
if (MySerialRead != nullptr)
|
if (MySerialRead != nullptr)
|
||||||
{
|
{
|
||||||
return MySerialRead(data, lenth);
|
size_t aa= MySerialRead(data, lenth);
|
||||||
|
|
||||||
|
return aa;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import SetWorkmode from "./components/menubox/SetWorkmode.vue";
|
|||||||
import setCalibrate from "./components/menubox/SetCalibrate.vue";
|
import setCalibrate from "./components/menubox/SetCalibrate.vue";
|
||||||
import setCalibrateHH3 from "./components/menubox/SetCalibrateHH3.vue";
|
import setCalibrateHH3 from "./components/menubox/SetCalibrateHH3.vue";
|
||||||
import setWavelenthCoeff from "./components/menubox/SetWavelenthcoeff.vue";
|
import setWavelenthCoeff from "./components/menubox/SetWavelenthcoeff.vue";
|
||||||
|
import ReflectanceToIris from "./components/menubox/ReflectanceToIris.vue";
|
||||||
import Help from "./components/menubox/help.vue";
|
import Help from "./components/menubox/help.vue";
|
||||||
import Greet from "./components/Greet.vue";
|
import Greet from "./components/Greet.vue";
|
||||||
import EventBus from "./eventBus.js";
|
import EventBus from "./eventBus.js";
|
||||||
@ -123,6 +124,17 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command.type=="Tool")
|
||||||
|
{
|
||||||
|
if (command.name=="ReflectanceToIris")
|
||||||
|
{
|
||||||
|
this.modaltitle="反射率转iris";
|
||||||
|
this.modalcomponent=ReflectanceToIris
|
||||||
|
await this.$nextTick();
|
||||||
|
this.showModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (command.type=="Work")
|
if (command.type=="Work")
|
||||||
{
|
{
|
||||||
if (!this.isDevOpen())
|
if (!this.isDevOpen())
|
||||||
|
|||||||
@ -170,6 +170,10 @@ export default {
|
|||||||
<BDropdownItem @click="onmenuclick('Set','CalibrateHH3')">HH3定标</BDropdownItem>
|
<BDropdownItem @click="onmenuclick('Set','CalibrateHH3')">HH3定标</BDropdownItem>
|
||||||
</BNavItemDropdown>
|
</BNavItemDropdown>
|
||||||
|
|
||||||
|
<BNavItemDropdown text="工具" right>
|
||||||
|
<BDropdownItem @click="onmenuclick('Tool','ReflectanceToIris')">反射率转iris</BDropdownItem>
|
||||||
|
</BNavItemDropdown>
|
||||||
|
|
||||||
<BNavItemDropdown text="窗口" right>
|
<BNavItemDropdown text="窗口" right>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user