From 6978fbc97bc9fdceb437ac3c4e405e783fb07427 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 8 Jun 2020 10:30:31 +0300 Subject: fix --- .../WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c | 1 + .../Embedded_SW/Embedded/Drivers/Motors/MotorActions.c | 18 ++++++++++++++++++ Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.h | 2 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 4 ++-- 4 files changed, 22 insertions(+), 3 deletions(-) (limited to 'Software') diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c index 27e2dd038..f50689d61 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/WHS_MAX11614_A2D.c @@ -364,6 +364,7 @@ double GetWHSAirFlow(uint8_t OR_Id) //Q_value = get_Q(value-orf3V0Value); Q_value = get_CurrentQ(DRIER_FLOW_METER); } + //Q_value = get_average_Q(HEAD_FLOW_METER); break; case NU_FLOW_METER: get_orf_2(&value); diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index 84369a03e..0d6cd35c7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -670,6 +670,7 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t { HoldRightDancer = true; } + //Report("MotorMovetoLimitSwitch RDANCER",__FILE__,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize,direction,RpMessage,HoldRightDancer,0); } MotorTimeout[MotorId] = 0; @@ -699,6 +700,8 @@ uint32_t MotorMoveToBreakSensorCallBackFunction(uint32_t IfIndex, uint32_t Limit return 0xFFFFFFFF; } MotorId = (TimerMotors_t)(IfIndex&0xFF); + MotorTimeout[MotorId]+=MotorTimeLag[MotorId]; + if (MotorControlId[MotorId] == 0xFF) return ERROR; @@ -721,6 +724,21 @@ uint32_t MotorMoveToBreakSensorCallBackFunction(uint32_t IfIndex, uint32_t Limit MotorCallback[MotorId](MotorId,LimitSwitch); } } + if ((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0)) //timeout + { + SafeRemoveHighControlCallback(MotorControlId[MotorId], MotorControlCallback[MotorId] ); + MotorControlCallback[MotorId] = 0; + MotorControlId[MotorId] = 0xFF; + MotorStop(MotorId,Hard_Hiz); //TODO in run time limit switch just reverse direction + + //possibly: start regular control (speed etc) + //uint32_t ControlId = AddControlCallback(NULL,ControlCBFunction Callback, eOneMillisecond, (IfTypeMotors*0x100+MotorId), deviceId, Parameter ); + + //call the module callback + if (MotorCallback[MotorId]) + MotorCallback[MotorId](MotorId,NO_LIMIT); + + } return OK; } uint32_t MotorMovetoBreakSensor (TimerMotors_t MotorId,bool direction, uint32_t Freq, callback_fptr callback,uint32_t timeout) diff --git a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.h b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.h index b2261979a..e281f1d83 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.h +++ b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/Uart.h @@ -1,4 +1,4 @@ -//void Init_U0(); +void Init_U0(); void test_Uart(); //uint32_t Uart_Tx(char *buffer,size_t length); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 0762db00e..0dc70efaa 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -825,12 +825,12 @@ JobEndReasonEnum AlarmHandlingPrepareJob(void *CurrentJob) ACTIVITY_GREEN_LED_OFF; if (n_segments == 0) { - ReportWithPackageFilter(AlarmFilter,"no segments in the job", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, AlarmItem[Alarm_i].DeviceId, 0); + ReportWithPackageFilter(AlarmFilter,"no segments in the job", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, 222, 0); return JOB_OK; } if (AlarmItem == NULL) { - ReportWithPackageFilter(AlarmFilter,"missing alarm file", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, AlarmItem[Alarm_i].DeviceId, 0); + ReportWithPackageFilter(AlarmFilter,"missing alarm file", __FILE__,__LINE__,0, DEBUG_LOG_CATEGORY__Warning, 223, 0); usnprintf(AlarmReasonStr, 100, "No alarm file in the machine",111); return JOB_UNSPECIFIED_ERROR; } -- cgit v1.3.1