|
@@ -11,6 +11,8 @@
|
|
|
|
|
|
|
|
#ifdef ONECHIP_MINI_ONE
|
|
#ifdef ONECHIP_MINI_ONE
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#define MIN_TEMPERATUARE 5
|
|
#define MIN_TEMPERATUARE 5
|
|
|
#define MAX_TEMPERATUARE 120
|
|
#define MAX_TEMPERATUARE 120
|
|
|
#define COOL_WORK_THD 5
|
|
#define COOL_WORK_THD 5
|
|
@@ -27,6 +29,7 @@
|
|
|
#define HEAT_ARRIVE_EDGE 0.5
|
|
#define HEAT_ARRIVE_EDGE 0.5
|
|
|
#define GOTO_IDLE_GAP 3000
|
|
#define GOTO_IDLE_GAP 3000
|
|
|
#define HEATCHECK_OUT 85
|
|
#define HEATCHECK_OUT 85
|
|
|
|
|
+#define CARD_STDCHANGE_TIME 100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -50,6 +53,9 @@ void updatParm_lysis(void) {
|
|
|
sysinf.lysis.pid.Kp = sysinf.lysis_Kp;
|
|
sysinf.lysis.pid.Kp = sysinf.lysis_Kp;
|
|
|
sysinf.lysis.pid.Ki = sysinf.lysis_Ki ;
|
|
sysinf.lysis.pid.Ki = sysinf.lysis_Ki ;
|
|
|
sysinf.lysis.pid.Kd = sysinf.lysis_Kd;
|
|
sysinf.lysis.pid.Kd = sysinf.lysis_Kd;
|
|
|
|
|
+ sysinf.lysis.idletemp = sysinf.lysis_idleTemp;
|
|
|
|
|
+ sysinf.lysis.setgaol = sysinf.lysis_Goal;
|
|
|
|
|
+ sysinf.lysis.worktime = sysinf.lysis_HeatTime * 10;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -89,7 +95,6 @@ uint32_t Therm_Check(void) {
|
|
|
*/
|
|
*/
|
|
|
void set_lysis(float goal) {
|
|
void set_lysis(float goal) {
|
|
|
sysinf.lysis.pid.goal = goal;
|
|
sysinf.lysis.pid.goal = goal;
|
|
|
- sysinf.lysis.lastgaol = goal;
|
|
|
|
|
if(goal > (sysinf.lysis.overHeat + sysinf.lysis.pid.realtemp )){
|
|
if(goal > (sysinf.lysis.overHeat + sysinf.lysis.pid.realtemp )){
|
|
|
sysinf.lysis.pid_st = PID_OVERHEAT;
|
|
sysinf.lysis.pid_st = PID_OVERHEAT;
|
|
|
sysinf.lysis.pid.goal += sysinf.lysis.overHeat;
|
|
sysinf.lysis.pid.goal += sysinf.lysis.overHeat;
|
|
@@ -168,21 +173,23 @@ uint32_t Pid_work(void) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-uint32_t get_lysis_st(float *temp,unsigned int *st) {
|
|
|
|
|
|
|
+uint32_t get_lysis_st(float *temp,unsigned int *st,float *pwm) {
|
|
|
|
|
|
|
|
*temp = sysinf.lysis.pid.realtemp;
|
|
*temp = sysinf.lysis.pid.realtemp;
|
|
|
*st = sysinf.lysis.thermostat_st;
|
|
*st = sysinf.lysis.thermostat_st;
|
|
|
|
|
+ *pwm = sysinf.lysis.pid.variate;
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
uint32_t lysis_work(void) {
|
|
uint32_t lysis_work(void) {
|
|
|
float temp;
|
|
float temp;
|
|
|
static uint32_t last10ms;
|
|
static uint32_t last10ms;
|
|
|
|
|
+ static uint32_t cardStChang;
|
|
|
static float firstTemp;
|
|
static float firstTemp;
|
|
|
lysis_ctr_def *ptherm = &sysinf.lysis;
|
|
lysis_ctr_def *ptherm = &sysinf.lysis;
|
|
|
|
|
|
|
|
temp = getADC_Chanel_value(1);
|
|
temp = getADC_Chanel_value(1);
|
|
|
if(temp < MIN_TEMPERATUARE || temp > MAX_TEMPERATUARE){
|
|
if(temp < MIN_TEMPERATUARE || temp > MAX_TEMPERATUARE){
|
|
|
- error_set(ERROR_TEMPSENSOR_EER,1);
|
|
|
|
|
|
|
+ error_set(ERROR_TEMPSENSOR_EER, 1);
|
|
|
updateLysisState(SYS_STATE_ERROR_HW);
|
|
updateLysisState(SYS_STATE_ERROR_HW);
|
|
|
ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
|
ptherm->firstin = true;
|
|
ptherm->firstin = true;
|
|
@@ -196,10 +203,7 @@ uint32_t lysis_work(void) {
|
|
|
ptherm->firstin = false;
|
|
ptherm->firstin = false;
|
|
|
updateLysisState(SYS_STATE_PREPARE);sysinf.lysisState = SYS_STATE_PREPARE;
|
|
updateLysisState(SYS_STATE_PREPARE);sysinf.lysisState = SYS_STATE_PREPARE;
|
|
|
firstTemp = getADC_Chanel_value(1);
|
|
firstTemp = getADC_Chanel_value(1);
|
|
|
- set_lysis(95);
|
|
|
|
|
- ptherm->pid.goal = 95;
|
|
|
|
|
- ptherm->worktime = 3000;
|
|
|
|
|
- ptherm->lastgaol = 95;
|
|
|
|
|
|
|
+ set_lysis(sysinf.lysis.setgaol);
|
|
|
last10ms = sysinf.conter10ms;
|
|
last10ms = sysinf.conter10ms;
|
|
|
}else{
|
|
}else{
|
|
|
float heattemp = getADC_Chanel_value(1);
|
|
float heattemp = getADC_Chanel_value(1);
|
|
@@ -212,7 +216,7 @@ uint32_t lysis_work(void) {
|
|
|
/*超时判断*/
|
|
/*超时判断*/
|
|
|
ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
|
updateLysisState(SYS_STATE_ERROR_HW);
|
|
updateLysisState(SYS_STATE_ERROR_HW);
|
|
|
- error_set(ERROR_HEATFUC_EER,1);
|
|
|
|
|
|
|
+ error_set(ERROR_HEATFUC_EER, 1);
|
|
|
ptherm->firstin = true;
|
|
ptherm->firstin = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -260,43 +264,47 @@ uint32_t lysis_work(void) {
|
|
|
}break;
|
|
}break;
|
|
|
case THERMOSTAT_IDLE:{
|
|
case THERMOSTAT_IDLE:{
|
|
|
if(ptherm->firstin){
|
|
if(ptherm->firstin){
|
|
|
- updateLysisState(SYS_STATE_READY);
|
|
|
|
|
|
|
+ // updateLysisState(SYS_STATE_READY);
|
|
|
ptherm->firstin = false;
|
|
ptherm->firstin = false;
|
|
|
Close_therm(0);
|
|
Close_therm(0);
|
|
|
ptherm->recGoalFlag = 0;
|
|
ptherm->recGoalFlag = 0;
|
|
|
firstTemp = getADC_Chanel_value(1);
|
|
firstTemp = getADC_Chanel_value(1);
|
|
|
-
|
|
|
|
|
|
|
+ updateLysisState(SYS_STATE_CHECK);
|
|
|
|
|
+ cardStChang = 0;
|
|
|
}else{
|
|
}else{
|
|
|
- if(ptherm->recGoalFlag){
|
|
|
|
|
- set_lysis(ptherm->pid.goal);
|
|
|
|
|
- ptherm->recGoalFlag = 0;
|
|
|
|
|
- updateLysisState(SYS_STATE_PREHEAT);
|
|
|
|
|
- firstTemp = getADC_Chanel_value(1);
|
|
|
|
|
|
|
+ if(Read_Tupe()==1){
|
|
|
|
|
+ if(((sysinf.conter10ms - last10ms)>CARD_STDCHANGE_TIME)&&cardStChang){
|
|
|
|
|
+ set_lysis(ptherm->setgaol);
|
|
|
|
|
+ ptherm->recGoalFlag = 0;
|
|
|
|
|
+ firstTemp = getADC_Chanel_value(1);
|
|
|
|
|
+ ptherm->thermostat_st = THERMOSTAT_WORK;
|
|
|
|
|
+ ptherm->firstin = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
last10ms = sysinf.conter10ms;
|
|
last10ms = sysinf.conter10ms;
|
|
|
|
|
+ cardStChang = 1;
|
|
|
}
|
|
}
|
|
|
- if(ptherm->pid_stable){
|
|
|
|
|
- ptherm->thermostat_st = THERMOSTAT_INSERT;
|
|
|
|
|
- ptherm->firstin = true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }break;
|
|
|
|
|
+ case THERMOSTAT_INSERT:{
|
|
|
|
|
+ if(ptherm->firstin){
|
|
|
|
|
+ ptherm->firstin = false;
|
|
|
|
|
+ updateLysisState(SYS_STATE_RUNING);
|
|
|
|
|
+ last10ms = sysinf.conter10ms;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ /*加热异常判断*/
|
|
|
if(((ptherm->pid.realtemp - firstTemp) < HEAT_WORK_THD)&&
|
|
if(((ptherm->pid.realtemp - firstTemp) < HEAT_WORK_THD)&&
|
|
|
((sysinf.conter10ms-last10ms)> HEAT_TEST_TIME)&&((ptherm->pid.goal - firstTemp) > 10.0)){
|
|
((sysinf.conter10ms-last10ms)> HEAT_TEST_TIME)&&((ptherm->pid.goal - firstTemp) > 10.0)){
|
|
|
/*目标温差大于10,加热启动30s之内没升温2.5° 超时判断*/
|
|
/*目标温差大于10,加热启动30s之内没升温2.5° 超时判断*/
|
|
|
ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
|
updateLysisState(SYS_STATE_ERROR_HW);
|
|
updateLysisState(SYS_STATE_ERROR_HW);
|
|
|
- error_set(ERROR_HEATFUC_EER,1);
|
|
|
|
|
|
|
+ error_set(ERROR_HEATFUC_EER, 1);
|
|
|
ptherm->firstin = true;
|
|
ptherm->firstin = true;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }break;
|
|
|
|
|
- case THERMOSTAT_INSERT:{
|
|
|
|
|
- if(ptherm->firstin){
|
|
|
|
|
- updateLysisState(SYS_STATE_CHECK);
|
|
|
|
|
- ptherm->firstin = false;
|
|
|
|
|
- }else{
|
|
|
|
|
- if(Read_Tupe()){
|
|
|
|
|
|
|
+ if((ptherm->pid.realtemp + 5) >ptherm->setgaol ) {
|
|
|
ptherm->thermostat_st = THERMOSTAT_WORK;
|
|
ptherm->thermostat_st = THERMOSTAT_WORK;
|
|
|
- ptherm->firstin = true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ptherm->firstin = true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}break;
|
|
}break;
|
|
|
case THERMOSTAT_WORK:{
|
|
case THERMOSTAT_WORK:{
|
|
@@ -304,6 +312,7 @@ uint32_t lysis_work(void) {
|
|
|
updateLysisState(SYS_STATE_RUNING);
|
|
updateLysisState(SYS_STATE_RUNING);
|
|
|
ptherm->firstin = false;
|
|
ptherm->firstin = false;
|
|
|
ptherm->pid_stable_time = 0;
|
|
ptherm->pid_stable_time = 0;
|
|
|
|
|
+ last10ms = sysinf.conter10ms;
|
|
|
}else{
|
|
}else{
|
|
|
// if(Read_Tupe()){
|
|
// if(Read_Tupe()){
|
|
|
// last10ms = conter10ms;
|
|
// last10ms = conter10ms;
|
|
@@ -312,14 +321,14 @@ uint32_t lysis_work(void) {
|
|
|
// Close_therm(0);
|
|
// Close_therm(0);
|
|
|
// ptherm->eerst = THERMOSTAT_TUBENOEXIST_EER;
|
|
// ptherm->eerst = THERMOSTAT_TUBENOEXIST_EER;
|
|
|
// ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
// ptherm->thermostat_st = THERMOSTAT_ERROR;
|
|
|
-// error_set(ERROR_TUPE_MOVE);
|
|
|
|
|
|
|
+// error_set(ERROR_TUPE_MOVE, 1);
|
|
|
// last10ms = conter10ms;
|
|
// last10ms = conter10ms;
|
|
|
// ptherm->firstin = TRUE;
|
|
// ptherm->firstin = TRUE;
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
// if(ptherm->pid_stable)
|
|
// if(ptherm->pid_stable)
|
|
|
{
|
|
{
|
|
|
- ptherm->pid_stable_time ++;
|
|
|
|
|
|
|
+ ptherm->pid_stable_time = (sysinf.conter10ms - last10ms)/10;
|
|
|
if(ptherm->pid_stable_time > ptherm->worktime){
|
|
if(ptherm->pid_stable_time > ptherm->worktime){
|
|
|
ptherm->thermostat_st = THERMOSTAT_END;
|
|
ptherm->thermostat_st = THERMOSTAT_END;
|
|
|
ptherm->firstin = true;
|
|
ptherm->firstin = true;
|
|
@@ -334,12 +343,17 @@ uint32_t lysis_work(void) {
|
|
|
Close_therm(0);
|
|
Close_therm(0);
|
|
|
beep_set(BEEP_WORKEND);
|
|
beep_set(BEEP_WORKEND);
|
|
|
last10ms = sysinf.conter10ms;
|
|
last10ms = sysinf.conter10ms;
|
|
|
- }else{
|
|
|
|
|
- if((sysinf.conter10ms-last10ms)> GOTO_IDLE_GAP){
|
|
|
|
|
-// if(Read_Tupe() == 0){
|
|
|
|
|
|
|
+ cardStChang = 0;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(Read_Tupe() == 0){
|
|
|
/*管管移除,进入到预热状态*/
|
|
/*管管移除,进入到预热状态*/
|
|
|
- ptherm->thermostat_st = THERMOSTAT_IDLE;
|
|
|
|
|
- ptherm->firstin = true;
|
|
|
|
|
|
|
+ if(((sysinf.conter10ms - last10ms)>CARD_STDCHANGE_TIME)&&cardStChang){
|
|
|
|
|
+ ptherm->thermostat_st = THERMOSTAT_IDLE;
|
|
|
|
|
+ ptherm->firstin = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ last10ms = sysinf.conter10ms;
|
|
|
|
|
+ cardStChang = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}break;
|
|
}break;
|
|
@@ -361,4 +375,6 @@ uint32_t Close_Therm_work(void) {
|
|
|
ptherm->firstin = true;
|
|
ptherm->firstin = true;
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#endif /* ONECHIP_MINI_ONE */
|