|
|
@@ -1361,7 +1361,7 @@ void thread1_signal_handler(int sig)
|
|
|
|
|
|
LOG_I("[对焦] 最佳位置:%d (清晰度:%.2f)", g_best_pos, g_best_sharpness);
|
|
|
|
|
|
- if(g_peak_counter>=3&¤t_sharpness>g_best_sharpness-2.0f){
|
|
|
+ if(g_peak_counter>=3&¤t_sharpness>g_best_sharpness-3.0f){
|
|
|
focus_done = true;
|
|
|
}else{
|
|
|
focus_done = false;
|
|
|
@@ -1422,7 +1422,7 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
rt_thread_delay(1000);
|
|
|
}
|
|
|
|
|
|
- slide_para.en_slide =4; //Z轴复位
|
|
|
+ slide_para.en_slide = 4; //Z轴复位
|
|
|
slide_para.pulse_period = mapSpeed(50);
|
|
|
while(slide_para.en_slide!=0){
|
|
|
LOG_D("等待Z轴电机完成复位!");
|
|
|
@@ -1439,7 +1439,8 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
//X轴电机运行到胶带位置
|
|
|
if(rt_pin_read(Limit_Motor_X)==1){
|
|
|
slide_para.xdir = 1; //1位反向,0位正向;
|
|
|
- slide_para.xdis = 1100;
|
|
|
+
|
|
|
+ slide_para.xdis = 1200;
|
|
|
slide_para.pulse_period = mapSpeed(50);
|
|
|
slide_para.en_slide = 1;
|
|
|
while(slide_para.en_slide!=0){
|
|
|
@@ -1459,7 +1460,8 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
}
|
|
|
//Y轴电机运行到指定距离
|
|
|
slide_para.ydir = 1;
|
|
|
- slide_para.ydis = 3350;
|
|
|
+ //slide_para.ydis = 3350;
|
|
|
+ slide_para.ydis = 9000;
|
|
|
slide_para.pulse_period = mapSpeed(50);
|
|
|
slide_para.en_slide = 6;
|
|
|
while(slide_para.en_slide!=0){
|
|
|
@@ -1624,6 +1626,8 @@ void Check_ParamConfig(void)
|
|
|
rt_sprintf(device_status.tempture, "-15");
|
|
|
rt_sprintf(device_status.humidity, "31");
|
|
|
rt_sprintf(device_status.mqttcfg1, "8.136.98.49");
|
|
|
+ device_status.x_init_dis = 500;
|
|
|
+ device_status.y_init_dis = 6000;
|
|
|
ef_set_env_blob("iSave", &device_status.iSave, sizeof(device_status.iSave)); //
|
|
|
ef_set_env_blob("ds", &device_status.ds, sizeof(device_status.ds));
|
|
|
ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
|
|
|
@@ -1657,6 +1661,8 @@ void Check_ParamConfig(void)
|
|
|
ef_set_env_blob("run_sta", &device_status.run_sta, sizeof(device_status.run_sta)); //
|
|
|
ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
|
|
|
ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
|
|
|
+ ef_set_env_blob("x_init_dis", &device_status.x_init_dis, sizeof(device_status.x_init_dis));
|
|
|
+ ef_set_env_blob("y_init_dis", &device_status.y_init_dis, sizeof(device_status.y_init_dis));
|
|
|
|
|
|
LOG_I("SOFTWARE VERSION:%s",device_status.driver);
|
|
|
LOG_I("Default paramconf is:");
|
|
|
@@ -1716,14 +1722,15 @@ void Check_ParamConfig(void)
|
|
|
ef_get_env_blob("Power_Type",&device_status.Power_Type,sizeof(device_status.Power_Type),NULL); //供电类型
|
|
|
ef_get_env_blob("deviceId",&device_status.deviceId,sizeof(device_status.deviceId),NULL); //设备编码
|
|
|
ef_get_env_blob("handle_bugger",&device_status.handle_bugger,sizeof(device_status.handle_bugger),NULL); //排虫
|
|
|
- device_status.light_over_tim = device_status.sunBar * 3600; //光控计数
|
|
|
+ ef_get_env_blob("x_init_dis",&device_status.x_init_dis,sizeof(device_status.x_init_dis),NULL);
|
|
|
+ ef_get_env_blob("y_init_dis",&device_status.y_init_dis,sizeof(device_status.y_init_dis),NULL); //光控计数
|
|
|
device_status.work_done = 0;
|
|
|
//工作完成标志位
|
|
|
if(device_status.dattim==0)
|
|
|
{
|
|
|
device_status.dattim = 10;
|
|
|
}
|
|
|
- /*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
|
|
|
+ /*设备类型,7孢子仪*/
|
|
|
device_status.dtype = 7;
|
|
|
device_status.version_type = 7;
|
|
|
if (device_status.version_type==7) {
|
|
|
@@ -1757,8 +1764,8 @@ void Check_ParamConfig(void)
|
|
|
LOG_I("孢子仪运行状态:%d",device_status.run_sta);
|
|
|
LOG_I("孢子仪采集时间:[%d-%d,%d-%d,%d-%d]",device_status.collecting_sh1,device_status.collecting_eh1,device_status.collecting_sh2,device_status.collecting_eh2,device_status.collecting_sh3,device_status.collecting_eh3);
|
|
|
LOG_I("PowerType:%d",device_status.Power_Type);
|
|
|
- LOG_I("deviceId:%s",device_status.deviceId);
|
|
|
- LOG_I("handle_bugger:%d",device_status.handle_bugger);
|
|
|
+ LOG_I("x_init_dis:%d",device_status.x_init_dis);
|
|
|
+ LOG_I("y_init_dis:%d",device_status.y_init_dis);
|
|
|
}
|
|
|
//RTC时间判断,如果当前年份小于2020,提示需要设置时间,切换为光控
|
|
|
if(device_status.update_flag==1)
|
|
|
@@ -1788,9 +1795,6 @@ void Check_ParamConfig(void)
|
|
|
//等待联网,
|
|
|
while(atoi(device_status.net)==1)
|
|
|
{
|
|
|
- if(Read_Real_Voltage()/100>5&&device_status.power_status==0)
|
|
|
- ctr_RTU_DTU(ON);
|
|
|
-
|
|
|
char *readinfo = makeJson_ReadInfo();
|
|
|
DTU_Write("%s",readinfo);
|
|
|
rt_free(readinfo);
|
|
|
@@ -1802,11 +1806,6 @@ void Check_ParamConfig(void)
|
|
|
{
|
|
|
device_status.timeSwitch = 0;
|
|
|
LOG_W("Time not set:%04d-%02d-%02d %02d:%02d:%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
- #if 0
|
|
|
- set_date(2020, 1, 1);
|
|
|
- set_time(0, 0, 0);
|
|
|
- #endif
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
connect_num = 0;
|
|
|
@@ -1843,40 +1842,7 @@ void ResetParamDefault(void)
|
|
|
ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
|
|
|
|
|
|
ef_set_env_blob("dattim",&device_status.dattim,sizeof(device_status.dattim)); //上传时间
|
|
|
- if(device_status.dtype==3)
|
|
|
- {
|
|
|
- device_status.clt_time = 10; //收集时间
|
|
|
- #if LAMP_EN == 0
|
|
|
- device_status.startBar = 20; //定时开始时间
|
|
|
- device_status.stopBar = 5; //定时结束时间
|
|
|
- #endif
|
|
|
- device_status.heattime = 10; //加热时间
|
|
|
- device_status.shake_ws = 1; //针对开关
|
|
|
- device_status.shake_sec = 1; //震动时间1-100ms
|
|
|
- #if LAMP_EN == 1
|
|
|
- device_status.sunBar = 3; //光控定时时长
|
|
|
- #else
|
|
|
- device_status.sunBar = 8;
|
|
|
- #endif
|
|
|
- device_status.tph = 70; //高温保护阈值
|
|
|
- device_status.tpl = -5; //低温保护阈值
|
|
|
- device_status.timeSwitch = 0; //定时模式:光控
|
|
|
- device_status.heatvalue=100; //加热温度
|
|
|
- ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
|
|
|
- ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar));
|
|
|
- ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar));
|
|
|
- ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch));
|
|
|
- ef_set_env_blob("sunBar", &device_status.sunBar, sizeof(device_status.sunBar));
|
|
|
- ef_set_env_blob("jtime", &device_status.heattime, sizeof(device_status.heattime));
|
|
|
- ef_set_env_blob("jheat", &device_status.heatvalue, sizeof(device_status.heatvalue));
|
|
|
- ef_set_env_blob("tph", &device_status.tph, sizeof(device_status.tph));
|
|
|
- ef_set_env_blob("tpl", &device_status.tpl, sizeof(device_status.tpl));
|
|
|
- ef_set_env_blob("shake_ws", &device_status.shake_ws, sizeof(device_status.shake_ws)); //震动开关
|
|
|
- ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec)); //震动时间
|
|
|
- device_status.handle_bugger = 0;
|
|
|
- ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
|
|
|
- }
|
|
|
- else if(device_status.dtype==7)
|
|
|
+ if(device_status.dtype==7)
|
|
|
{
|
|
|
device_status.run_sta = 0;
|
|
|
device_status.heatvalue = 25; //培养温度
|
|
|
@@ -1961,52 +1927,52 @@ void app_partion_backup(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- rt_kprintf("Clone %s partition to %s partition:\n", src_part_name, dst_part_name);
|
|
|
- if (fal_partition_erase(dst_part, 0, dst_part->len) >= 0)
|
|
|
- {
|
|
|
- int clone_pos = 0;
|
|
|
- int clone_len = 0, clone_tol_len;
|
|
|
- rt_uint8_t *buf = rt_malloc(4096);
|
|
|
-
|
|
|
- if (dst_part->len < src_part->len)
|
|
|
- clone_tol_len = dst_part->len;
|
|
|
- else
|
|
|
- clone_tol_len = src_part->len;
|
|
|
-
|
|
|
- while ((clone_pos < clone_tol_len) && (buf != RT_NULL))
|
|
|
- {
|
|
|
- clone_len = fal_partition_read(src_part, clone_pos, buf, 4096);
|
|
|
- if (clone_len < 0)
|
|
|
- {
|
|
|
- rt_kprintf("\nread %s partition failed, clone stop!\n", src_part_name);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (fal_partition_write(dst_part, clone_pos, buf, clone_len) < 0)
|
|
|
- {
|
|
|
- rt_kprintf("\nwrite %s partition failed, clone stop!\n", dst_part_name);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- HMI_WRITE("#");
|
|
|
- rt_kprintf("#");
|
|
|
- clone_pos += clone_len;
|
|
|
- }
|
|
|
-
|
|
|
- if (clone_pos >= clone_tol_len)
|
|
|
- {
|
|
|
-
|
|
|
- rt_kprintf("\nClone partition success, total %d bytes!\n", clone_tol_len);
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- rt_kprintf("Clone partition failed!");
|
|
|
-
|
|
|
- }
|
|
|
- if (buf)
|
|
|
- rt_free(buf);
|
|
|
- }
|
|
|
+ rt_kprintf("Clone %s partition to %s partition:\n", src_part_name, dst_part_name);
|
|
|
+ if (fal_partition_erase(dst_part, 0, dst_part->len) >= 0)
|
|
|
+ {
|
|
|
+ int clone_pos = 0;
|
|
|
+ int clone_len = 0, clone_tol_len;
|
|
|
+ rt_uint8_t *buf = rt_malloc(4096);
|
|
|
+
|
|
|
+ if (dst_part->len < src_part->len)
|
|
|
+ clone_tol_len = dst_part->len;
|
|
|
+ else
|
|
|
+ clone_tol_len = src_part->len;
|
|
|
+
|
|
|
+ while ((clone_pos < clone_tol_len) && (buf != RT_NULL))
|
|
|
+ {
|
|
|
+ clone_len = fal_partition_read(src_part, clone_pos, buf, 4096);
|
|
|
+ if (clone_len < 0)
|
|
|
+ {
|
|
|
+ rt_kprintf("\nread %s partition failed, clone stop!\n", src_part_name);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fal_partition_write(dst_part, clone_pos, buf, clone_len) < 0)
|
|
|
+ {
|
|
|
+ rt_kprintf("\nwrite %s partition failed, clone stop!\n", dst_part_name);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ HMI_WRITE("#");
|
|
|
+ rt_kprintf("#");
|
|
|
+ clone_pos += clone_len;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clone_pos >= clone_tol_len)
|
|
|
+ {
|
|
|
+
|
|
|
+ rt_kprintf("\nClone partition success, total %d bytes!\n", clone_tol_len);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rt_kprintf("Clone partition failed!");
|
|
|
+
|
|
|
+ }
|
|
|
+ if (buf)
|
|
|
+ rt_free(buf);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
void Debug_log_ON(void)
|