|
@@ -1570,6 +1570,9 @@ void ctr_TG_Clear(uint16_t clear_timeout)
|
|
|
LOG_I("清扫电机待机:%d",Electric_current);
|
|
LOG_I("清扫电机待机:%d",Electric_current);
|
|
|
#endif
|
|
#endif
|
|
|
static uint16_t clear_count = 0;
|
|
static uint16_t clear_count = 0;
|
|
|
|
|
+ /* 屏幕 workSta.t6「清扫结束剩余时间」用的尾段常量:
|
|
|
|
|
+ * 全程 = 正向推杆(clear_timeout*100ms) + 3s 停顿 + 反向复位(clear_timeout*100ms) + 2s 收尾 */
|
|
|
|
|
+ uint16_t clear_left_tail = (uint16_t)(clear_timeout / 10) + 3 + 2;
|
|
|
clear_count = clear_timeout;
|
|
clear_count = clear_timeout;
|
|
|
#if PWM_EN == 0
|
|
#if PWM_EN == 0
|
|
|
rt_pin_mode(CLEAR_R, PIN_MODE_OUTPUT);
|
|
rt_pin_mode(CLEAR_R, PIN_MODE_OUTPUT);
|
|
@@ -1585,6 +1588,7 @@ void ctr_TG_Clear(uint16_t clear_timeout)
|
|
|
Motor_Qingsao_L_PWM(OFF);
|
|
Motor_Qingsao_L_PWM(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
clear_count--;
|
|
clear_count--;
|
|
|
|
|
+ device_status.clear_left = (uint16_t)(clear_count / 10) + clear_left_tail; /* t6 剩余清扫时间(s) */
|
|
|
rt_thread_delay(100);
|
|
rt_thread_delay(100);
|
|
|
}
|
|
}
|
|
|
#if PWM_EN == 0
|
|
#if PWM_EN == 0
|
|
@@ -1608,6 +1612,7 @@ void ctr_TG_Clear(uint16_t clear_timeout)
|
|
|
// if(clear_count<200)
|
|
// if(clear_count<200)
|
|
|
// current_clear[clear_count] = atoi(device_status.power);
|
|
// current_clear[clear_count] = atoi(device_status.power);
|
|
|
clear_count++;
|
|
clear_count++;
|
|
|
|
|
+ device_status.clear_left = (uint16_t)((clear_timeout - clear_count) / 10) + 2; /* t6 反向复位剩余(s) */
|
|
|
rt_thread_delay(100);
|
|
rt_thread_delay(100);
|
|
|
}
|
|
}
|
|
|
#if PWM_EN == 0
|
|
#if PWM_EN == 0
|
|
@@ -1629,6 +1634,7 @@ void ctr_TG_Clear(uint16_t clear_timeout)
|
|
|
#endif
|
|
#endif
|
|
|
rt_thread_delay(2000);
|
|
rt_thread_delay(2000);
|
|
|
device_status.clear_status = 0;
|
|
device_status.clear_status = 0;
|
|
|
|
|
+ device_status.clear_left = 0; /* 清扫结束,倒计时清零 */
|
|
|
HMI_WRITE("cangWei.rotateFlag.val=%d",0);
|
|
HMI_WRITE("cangWei.rotateFlag.val=%d",0);
|
|
|
HMI_WRITE("sysTest.switchClear.val=%d",0);
|
|
HMI_WRITE("sysTest.switchClear.val=%d",0);
|
|
|
}
|
|
}
|
|
@@ -1849,6 +1855,8 @@ void calorstat(uint16_t heat_time)
|
|
|
// UpLoad_Data(); //从加热开始每5分钟上传的数据
|
|
// UpLoad_Data(); //从加热开始每5分钟上传的数据
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
|
|
+ /* 屏幕 workSta.t1:剩余加热时间(秒)。恒温等待阶段 n 未推进,剩余时间按同一口径显示 */
|
|
|
|
|
+ device_status.work_heat_left = (n < heat_time) ? (uint16_t)(heat_time - n) : 0;
|
|
|
//如果触发异常退出加热
|
|
//如果触发异常退出加热
|
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
|
{
|
|
{
|
|
@@ -1871,6 +1879,7 @@ void calorstat(uint16_t heat_time)
|
|
|
rt_kprintf("=======正在加热======:%d-%d\n",n,heat_time);
|
|
rt_kprintf("=======正在加热======:%d-%d\n",n,heat_time);
|
|
|
HMI_WRITE("workSta.g0.txt=\"正在加热!!!:%d-%d\"",n,heat_time);
|
|
HMI_WRITE("workSta.g0.txt=\"正在加热!!!:%d-%d\"",n,heat_time);
|
|
|
}
|
|
}
|
|
|
|
|
+ device_status.work_heat_left = 0; /* 加热结束,倒计时清零 */
|
|
|
ctr_Heat(OFF);
|
|
ctr_Heat(OFF);
|
|
|
//UpLoad_Data(); //加热结束的数据
|
|
//UpLoad_Data(); //加热结束的数据
|
|
|
}
|
|
}
|
|
@@ -1964,6 +1973,16 @@ void SunTest(void)
|
|
|
/*上电初始化*/
|
|
/*上电初始化*/
|
|
|
void ResetInit(void)
|
|
void ResetInit(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ /* 复位时清掉屏幕 workSta 页的实时倒计时/进度(t1~t6),避免残留旧值 */
|
|
|
|
|
+ device_status.work_heat_left = 0;
|
|
|
|
|
+ device_status.work_clt_left = 0;
|
|
|
|
|
+ device_status.work_door_left = 0;
|
|
|
|
|
+ device_status.work_progress = 0;
|
|
|
|
|
+ device_status.photo_left = 0;
|
|
|
|
|
+ device_status.clear_left = 0;
|
|
|
|
|
+ device_status.work_start_tick = 0;
|
|
|
|
|
+ device_status.work_total_sec = 0;
|
|
|
|
|
+
|
|
|
if(device_status.dtype==7)
|
|
if(device_status.dtype==7)
|
|
|
{
|
|
{
|
|
|
ctr_Motor_Driver(0, 0, 0, 0);
|
|
ctr_Motor_Driver(0, 0, 0, 0);
|
|
@@ -2578,6 +2597,47 @@ void WorkTask_BZYV2(void)
|
|
|
//滑台启动
|
|
//滑台启动
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* ==================== 工作进度(屏幕 workSta.t4 工作进度百分比) ====================
|
|
|
|
|
+ * 口径:按时间加权——进度 = 已用时间 / 本轮预计总时长 × 100%。
|
|
|
|
|
+ * 预计总时长在每轮工作开始时按参数估算:收集 + 加热 + 拍照(60s) + 清扫(105s) + 仓门动作预留(40s)。
|
|
|
|
|
+ * 实际存在仓门寻位、恒温等待、异常提前退出等偏差,故进度上限钳到 99%,
|
|
|
|
|
+ * 与 t1~t3/t5/t6 的实时倒计时配合显示即可反映真实过程;非工作态返回 0。 */
|
|
|
|
|
+void Work_Progress_Start(void)
|
|
|
|
|
+{
|
|
|
|
|
+ uint32_t total;
|
|
|
|
|
+
|
|
|
|
|
+ total = (uint32_t)device_status.clt_time * 60
|
|
|
|
|
+ + (uint32_t)device_status.heattime * 60
|
|
|
|
|
+ + WORK_PHOTO_SEC + WORK_CLEAR_SEC + WORK_DOOR_SEC;
|
|
|
|
|
+ if (total == 0) total = 1;
|
|
|
|
|
+ if (total > 0xFFFF) total = 0xFFFF; /* work_total_sec 为 uint16_t */
|
|
|
|
|
+
|
|
|
|
|
+ device_status.work_total_sec = (uint16_t)total;
|
|
|
|
|
+ device_status.work_start_tick = rt_tick_get();
|
|
|
|
|
+ device_status.work_progress = 0;
|
|
|
|
|
+ /* 新的一轮工作开始,清掉上一轮的实时倒计时 */
|
|
|
|
|
+ device_status.work_heat_left = 0;
|
|
|
|
|
+ device_status.work_clt_left = 0;
|
|
|
|
|
+ device_status.work_door_left = 0;
|
|
|
|
|
+ device_status.photo_left = 0;
|
|
|
|
|
+ device_status.clear_left = 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+uint8_t Work_Progress_Get(void)
|
|
|
|
|
+{
|
|
|
|
|
+ uint32_t elapsed;
|
|
|
|
|
+ uint32_t total = device_status.work_total_sec;
|
|
|
|
|
+
|
|
|
|
|
+ if (device_status.work_status != 1 || device_status.work_start_tick == 0 || total == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ elapsed = (rt_tick_get() - device_status.work_start_tick) / RT_TICK_PER_SECOND;
|
|
|
|
|
+ device_status.work_progress = (uint8_t)((elapsed >= total) ? 99 : (elapsed * 100 / total));
|
|
|
|
|
+ return device_status.work_progress;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
//工作任务流程s
|
|
//工作任务流程s
|
|
|
void WorkTask(void)
|
|
void WorkTask(void)
|
|
|
{
|
|
{
|
|
@@ -2590,6 +2650,10 @@ void WorkTask(void)
|
|
|
{
|
|
{
|
|
|
workloop++;
|
|
workloop++;
|
|
|
device_status.work_done = 0;
|
|
device_status.work_done = 0;
|
|
|
|
|
+ /* 每一轮工作开始(外层 while 每轮一次):记录进度起点与预计总时长,
|
|
|
|
|
+ * 并清零上一轮的实时倒计时(屏幕 workSta.t1~t6)。放在本轮循环体开头,
|
|
|
|
|
+ * 保证 24 小时/时控模式下连续多轮工作时进度与倒计时每轮都重新开始。 */
|
|
|
|
|
+ Work_Progress_Start();
|
|
|
if(clt_time==0)
|
|
if(clt_time==0)
|
|
|
{
|
|
{
|
|
|
#if 0
|
|
#if 0
|
|
@@ -2666,6 +2730,7 @@ void WorkTask(void)
|
|
|
ctr_Fan_IN(ON);
|
|
ctr_Fan_IN(ON);
|
|
|
#endif
|
|
#endif
|
|
|
clt_time --;
|
|
clt_time --;
|
|
|
|
|
+ device_status.work_clt_left = (uint16_t)clt_time; /* 屏幕 workSta.t2 收集倒计时(s) */
|
|
|
rt_thread_delay(1000);
|
|
rt_thread_delay(1000);
|
|
|
#if 0//LAMP_EN == 0
|
|
#if 0//LAMP_EN == 0
|
|
|
if(clt_time%30==0)
|
|
if(clt_time%30==0)
|
|
@@ -2705,6 +2770,7 @@ void WorkTask(void)
|
|
|
}
|
|
}
|
|
|
device_status.collt_status = 0;
|
|
device_status.collt_status = 0;
|
|
|
clt_time = 1;
|
|
clt_time = 1;
|
|
|
|
|
+ device_status.work_clt_left = 0; /* 收集结束,倒计时清零 */
|
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
|
{
|
|
{
|
|
|
ctr_lamp(OFF,1);
|
|
ctr_lamp(OFF,1);
|
|
@@ -2755,10 +2821,12 @@ void WorkTask(void)
|
|
|
while(heat_time!=0)
|
|
while(heat_time!=0)
|
|
|
{
|
|
{
|
|
|
heat_time--;
|
|
heat_time--;
|
|
|
|
|
+ device_status.work_heat_left = (uint16_t)heat_time; /* 屏幕 workSta.t1 剩余加热时间(s) */
|
|
|
LOG_I("正在加热状态!!!");
|
|
LOG_I("正在加热状态!!!");
|
|
|
rt_thread_delay(1000);
|
|
rt_thread_delay(1000);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ device_status.work_heat_left = 0;
|
|
|
//6.打开下仓门
|
|
//6.打开下仓门
|
|
|
if(device_status.rain_status==0)
|
|
if(device_status.rain_status==0)
|
|
|
{
|
|
{
|