aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-06-25 13:53:15 +0300
committerAvi Levkovich <avi@twine-s.com>2018-06-25 13:53:15 +0300
commitc95a8fbe2746db2c1ef73a2c373004b322bdb5bf (patch)
tree410bcca9da486af969d6d4afb142512e3b88c2fc /Software/Embedded_SW/Embedded/Modules
parentc68262a29c29d0785337b5982e91ebf741e98b0f (diff)
parenta27ef72084d844ef703aaa9b1c6f4ec032ca182e (diff)
downloadTango-c95a8fbe2746db2c1ef73a2c373004b322bdb5bf.tar.gz
Tango-c95a8fbe2746db2c1ef73a2c373004b322bdb5bf.zip
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c84
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c27
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c8
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c79
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c42
7 files changed, 188 insertions, 54 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
index e8779d265..23560bd06 100644
--- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
+++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
@@ -27,6 +27,10 @@
#include <PMR/Diagnostics/StartDiagnosticsResponse.pb-c.h>
#include <PMR/Diagnostics/StopDiagnosticsRequest.pb-c.h>
#include <PMR/Diagnostics/StopDiagnosticsResponse.pb-c.h>
+#include <PMR/Diagnostics/Event.pb-c.h>
+#include <PMR/Diagnostics/EventType.pb-c.h>
+#include "PMR/debugging/DebugLogCategory.pb-c.h"
+
char DiagnosticsToken[36] = {0};
bool DiagnosticsActive = false;
@@ -131,8 +135,88 @@ void AlarmHandler_SendDiagnostics(void)
return ;
}
+/*typedef enum _EventType {
+ EVENT_TYPE__ThreadBreak = 0,
+ EVENT_TYPE__ThreadTensionControlFailure = 1,
+ EVENT_TYPE__FeederConeInsufficiant = 2,
+ EVENT_TYPE__WinderGeneralError = 3,
+ EVENT_TYPE__WinderConeNotExists = 4,
+ EVENT_TYPE__ThreadFeedingGeneralError = 5,
+ EVENT_TYPE__DyeingHeadOverTemperature = 6,
+ EVENT_TYPE__DHThermalCutoff = 7,
+ EVENT_TYPE__DryerOverTemperature = 8,
+ EVENT_TYPE__DryerThermalCutoff = 9,
+ EVENT_TYPE__DyeingHeadHeatersCurrentOutOfRange = 10,
+ EVENT_TYPE__DryerHeatersCurrentOutOfRange = 11,
+ EVENT_TYPE__DryerDHeadCoverOpen = 12,
+ EVENT_TYPE__AirFilterClogged = 13,
+ EVENT_TYPE__AirFilterNotInstalled = 14,
+ EVENT_TYPE__WHSFailure = 15,
+ EVENT_TYPE__WasteContainerIsAlmostFull = 16,
+ EVENT_TYPE__WasteContainerIsFull = 17,
+ EVENT_TYPE__DispenserEmpty = 18,
+ EVENT_TYPE__DispenserLowLevel = 19,
+ EVENT_TYPE__DispenserRefillFailure = 20,
+ EVENT_TYPE__MidTankEmpty = 21,
+ EVENT_TYPE__MidTankLowLevel = 22,
+ EVENT_TYPE__MidTankNotInPlace = 23,
+ EVENT_TYPE__SystemBITFail = 24,
+ EVENT_TYPE__GeneralInternalOverTemperature = 25,
+ EVENT_TYPE__MachineCoverOpen = 26,
+ EVENT_TYPE__EmergencyPushButtonPressed = 27,
+ EVENT_TYPE__SystemGeneralError = 28,
+ EVENT_TYPE__RequestSent = 29,
+ EVENT_TYPE__ResponseReceived = 30,
+ EVENT_TYPE__RequestFailed = 31,
+ EVENT_TYPE__ApplicationException = 32,
+ EVENT_TYPE__ApplicationInformation = 33,
+ EVENT_TYPE__ApplicationStarted = 34,
+ EVENT_TYPE__ApplicationTerminated = 35,
+ EVENT_TYPE__RecordingStarted = 36,
+ EVENT_TYPE__RecordingStopped = 37
+ PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(EVENT_TYPE)
+} EventType;
+ * */
+uint32_t AlarmHandlingConsequentActions(EventType EventId, DebugLogCategory Severity)
+{
+ switch (Severity)
+ {
+ case DEBUG_LOG_CATEGORY__Warning:
+
+ //raise flag fr next job
+ break;
+ case DEBUG_LOG_CATEGORY__Error:
+ AbortJob(NULL,event_type__descriptor.name[EventId]);
+//Stop Job
+ break;
+ case DEBUG_LOG_CATEGORY__Critical:
+ EndState(NULL,event_type__descriptor.name[EventId]);
+ //stop job
+ //turn machine off
+ break;
+ case DEBUG_LOG_CATEGORY__Debug:
+ case DEBUG_LOG_CATEGORY__Info:
+ default:
+ //do nothing
+ break;
+
+ }
+}
+
uint32_t AlarmHandlingLoop(uint32_t tick)
{
+ //read dispensers limit switches. 25 - send warning. up - stop job and send alarm
+
+ //Cone missing
+ //Dyeing head over temperature
+ //mixer over temperature
+ //dryer over temperature
+ //heaters failure
+ //dispenser pressure
+ //valve OCD
+ //Motor Status
+ //machine cover open
+
return OK;
}
void SendDiagnostics(void)
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 1f48d5953..a00c23739 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -80,13 +80,15 @@ Mailbox_Handle MotorsMsgQ[NUM_OF_MOTORS] = {NULL};
bool MillisecRestart;
static GateMutex_Handle gateMillisecDB;
-uint32_t MillisecDatalog[MAX_TANGO_CONTROL_DEVICES];
uint32_t Millisec_timerBase = TIMER1_BASE; //Timer handle
/******************** Functions ********************************************/
uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Read);
//**********************************************************************
/******************** CODE ********************************************/
//**********************************************************************
+uint32_t MSBacklog[1000]={0};
+uint8_t Motor_Id[1000]={0};
+uint16_t MsecLogindex = 0;
void MillisecInit(void)
{
@@ -103,7 +105,6 @@ void MillisecInit(void)
MillisecRestart = false;
- memset(MillisecDatalog,0,sizeof(uint32_t)*MAX_TANGO_CONTROL_DEVICES);
gateMillisecDB = GateMutex_create(NULL, &eb);
if (gateMillisecDB == NULL)
@@ -182,6 +183,14 @@ uint32_t MotorActivity = 0;
int32_t MillisecSetMotorSpeed(TimerMotors_t MotorId, unsigned long Data, int Length, MSecFptr Callback)
{
if (MotorId >= NUM_OF_MOTORS) return -1;
+ //==========================
+ MSBacklog[MsecLogindex]=Data;
+ Motor_Id[MsecLogindex]=MotorId;
+ MsecLogindex++;
+ if (MsecLogindex>=999)
+ MsecLogindex = 0;
+ //==========================
+
SpeedSetPending[MotorId].Callback = Callback;
SpeedSetPending[MotorId].Data = Data;
SpeedSetPending[MotorId].Length = Length;
@@ -209,6 +218,13 @@ int MillisecFlushMsgQ(TimerMotors_t MotorId)
int32_t MillisecWriteToMotor(TimerMotors_t MotorId, unsigned long Data, int Length, MSecFptr Callback)
{
MillisecMotorDataStruc MotorData = {0};
+ //==========================
+ MSBacklog[MsecLogindex]=Data;
+ Motor_Id[MsecLogindex]=MotorId;
+ MsecLogindex++;
+ if (MsecLogindex>=999)
+ MsecLogindex = 0;
+ //==========================
if (MotorId >= NUM_OF_MOTORS) return -1;
MotorActivity++;
MotorData.Callback = Callback;
@@ -223,6 +239,13 @@ int32_t MillisecReadFromMotor(TimerMotors_t MotorId, unsigned long Data, int Len
{
MillisecMotorDataStruc MotorData = {0};
if (MotorId >= NUM_OF_MOTORS) return -1;
+//==========================
+ MSBacklog[MsecLogindex]=Data;
+ Motor_Id[MsecLogindex]=MotorId;
+ MsecLogindex++;
+ if (MsecLogindex>=999)
+ MsecLogindex = 0;
+ //==========================
MotorActivity++;
MotorActivity++;
MotorData.Callback = Callback;
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
index 0ed71bf0d..cc87f6611 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
@@ -91,7 +91,6 @@ uint32_t HWConfigurationFunc(MessageContainer* requestContainer)
upload_hardware_configuration_request__free_unpacked(UploadRequest,NULL);
return ERROR;
}
- //status += HeaterConfigSetSharedHeatersParams (request->outputproportionalcycletime, request->outputproportionalsinglestep);
ControlStart();
//ThreadInitialTestStub(request);
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h
index 5759617cb..4cee9b196 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_ex.h
@@ -4,6 +4,7 @@
//uint32_t HeaterCommandRequestMessage(MessageContainer* requestContainer);
uint32_t HeaterConfigRequestMessage(HardwarePidControl* request);
uint32_t HeaterConfigSetSharedHeatersParams (uint32_t outputproportionalcycletime, uint32_t outputproportionalsinglestep);
+void HeatingTestSendResonse(uint32_t status, bool last,bool heater1Active,bool heater2Active, int temperature1, int temperature2,int Heater1Percentage,int Heater2Percentage, char* Message);
uint32_t HeaterCommandRequestMessage(int HeaterId, bool OnOff, int Temperature);
void HeatingTestRequest(MessageContainer* requestContainer);
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
index 3fa8cfa40..315e4c1e7 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
@@ -104,7 +104,6 @@ void HeatingTestRequest(MessageContainer* requestContainer)
HeaterId2, false,
request->dryerzone2temp);
}
- HeaterConfigSetSharedHeatersParams(1000,120000*12);
ControlStart();
StubHeatingTestResponse response = STUB_HEATING_TEST_RESPONSE__INIT;
@@ -276,7 +275,6 @@ uint32_t HeaterConfigRequestMessage(HardwarePidControl* request)
}
else
{
- HeaterConfigSetSharedHeatersParams(1000,120000*12); // initial setting 50Mhz
}
}
return OK;
@@ -333,8 +331,8 @@ uint32_t HeaterConfigSetSharedHeatersParams(uint32_t outputproportionalcycletime
}
/*
- * HeaterConfigSetSharedHeatersParams - prepare the time slices for A/C heaters co-ordinated operation
- * called by the general hardware HWConfigurationFunc
+ * HeaterRecalculateSharedHeatersParams -
+ *
* parameters - the cycle time for the coordinated operation, the size (in MCU cycles) of a single step.
*/
uint32_t HeaterRecalculateSharedHeatersParams(uint32_t deviceId, uint32_t new_outputproportionalpowerlimit)
@@ -392,7 +390,7 @@ uint32_t HeaterRecalculateHeaterParams(uint32_t deviceId, uint32_t new_outputpro
HeaterControl[deviceId].outputproportionalpowerlimit = new_outputproportionalpowerlimit;
//mark the time slices for heaters operation as empty / Heater1000 / Heater 200
- DCTimeSliceAllocation[deviceId] = HeaterControl[deviceId].outputproportionalpowerlimit * NumberOFSlicesInUse / 10000;
+ DCTimeSliceAllocation[deviceId] = (HeaterControl[deviceId].outputproportionalpowerlimit * NumberOFSlicesInUse) / 100;
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index 6f565f880..eb5736c1d 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -22,6 +22,7 @@
#include "heaters.h"
#include "Drivers/Heater/Heater.h"
+#include "Heaters_ex.h"
#include "Drivers/Heater/TemperatureSensor.h"
#include "StateMachines/Printing/PrintingSTM.h"
@@ -41,8 +42,8 @@ typedef struct HeatersControlMessage{
}HeatersControlMessageStruc;
/******************** GLOBAL PARAMETERS ********************************************/
-HeaterCommand HeaterCmd[MAX_HEATERS_NUM] = {};
-uint32_t ControlIdtoHeaterId [MAX_HEATERS_NUM] = {0xFF};
+HeaterCommand HeaterCmd[MAX_HEATERS_NUM];
+uint32_t ControlIdtoHeaterId [MAX_HEATERS_NUM] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
uint32_t DryerHeaterMaxTempControl = 0xFF;
uint32_t DryerInternalPT100Id = ANALOG_DRYER_TEMP2;
@@ -76,8 +77,10 @@ void HeatersControlInit(void)
{
int i;
HeatersControlMsgQ = Mailbox_create(sizeof(HeatersControlMessageStruc), 20, NULL,NULL);
+ HeaterConfigSetSharedHeatersParams(1000,120000*12);
ROM_TimerConfigure(Heater_timerBase, TIMER_CFG_PERIODIC); // 32 bits Timer
+ ROM_TimerEnable(Heater_timerBase, TIMER_A);
ROM_IntEnable(INT_TIMER2A);
ROM_TimerIntEnable(Heater_timerBase, TIMER_TIMA_TIMEOUT);
@@ -97,7 +100,7 @@ void HeatersControlStop(void)
TimerActivated = false;
HeatersRestart = false;
}
-#warning there is a need to separate the AC and DC heaters preparation!
+//#warning there is a need to separate the AC and DC heaters preparation!
void HeatersControlStart(void)
{
Report("HeatersControlStart ", __FILE__,__LINE__,0, RpMessage, 0, 0);
@@ -113,14 +116,26 @@ uint32_t HeatersEnd(void)
{
if (i > HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2) //DC Heaters
{
- status |= RemoveControlCallback(ControlIdtoHeaterId [i], DCHeaterControlCBFunction);
+ if (ControlIdtoHeaterId [i]!=0xFF)
+ {
+ status |= RemoveControlCallback(ControlIdtoHeaterId [i], DCHeaterControlCBFunction);
+ ControlIdtoHeaterId [i]=0xFF;
+ }
}
else if (i < HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2) //AC Heaters
{
- status |=RemoveControlCallback(ControlIdtoHeaterId [i] ,HeaterControlCBFunction);
+ if (ControlIdtoHeaterId [i]!=0xFF)
+ {
+ status |=RemoveControlCallback(ControlIdtoHeaterId [i] ,HeaterControlCBFunction);
+ ControlIdtoHeaterId [i]=0xFF;
+ }
}
if (i == HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w) //DC Heaters
- status |=RemoveControlCallback(DryerHeaterMaxTempControl ,HeaterMaxTempCBFunction);
+ if (ControlIdtoHeaterId [i]!=0xFF)
+ {
+ status |=RemoveControlCallback(DryerHeaterMaxTempControl ,HeaterMaxTempCBFunction);
+ ControlIdtoHeaterId [i]=0xFF;
+ }
DeActivateHeater(i);
}
return status;
@@ -134,10 +149,10 @@ void HeatersStartControlTimer (void)
return;
TimerActivated = true;
ROM_TimerConfigure(Heater_timerBase, TIMER_CFG_PERIODIC); // 32 bits Timer
- ROM_TimerLoadSet(Heater_timerBase, TIMER_A,OutputProportionalSingleStep/*twelve millisecond???*/);
+ ROM_TimerLoadSet(Heater_timerBase, TIMER_A,OutputProportionalSingleStep /*twelve millisecond???*/);
+ ROM_TimerEnable(Heater_timerBase, TIMER_A);
ROM_IntEnable(INT_TIMER2A);
ROM_TimerIntEnable(Heater_timerBase, TIMER_TIMA_TIMEOUT);
- TimerEnable(Heater_timerBase, TIMER_A);
Report("HeatersStartControlTimer ", __FILE__,__LINE__,0, RpMessage, 0, 0);
return;
}
@@ -236,10 +251,12 @@ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue)
if (HeaterId > HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2) //DC Heaters
{
ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0);
+ DCInitialHeating[HeaterId] = true;
}
else if (HeaterId < HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2) //AC Heaters
{
ControlIdtoHeaterId [HeaterId] = AddControlCallback( HeaterControlCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0);
+ InitialHeating = true;
}
HeaterReady[HeaterId] = false;
if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w) //Dryer Heaters
@@ -297,9 +314,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue)
LOG_ERROR (readValue, "Heater Cooled Off max temperature, turned on");
return OK;
}
-
- return OK;
-
+ return ERROR;
}
uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
{
@@ -368,18 +383,20 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0))
{
HeaterPIDConfig[index].m_mesuredParam = readValue;
- HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
- &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
-/* if (HeaterPIDConfig[index].m_calculatedError >= HeaterPIDConfig[index].m_params.MAX)
+ if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) //below proportional band
{
- HeaterPIDConfig[index].m_calculatedError = HeaterPIDConfig[index].m_params.MAX;
+ HeaterPIDConfig[index].m_calculatedError = 1.0;
+ HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
}
- if (HeaterPIDConfig[index].m_calculatedError < HeaterPIDConfig[index].m_params.MIN)
+ else if (readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))
{
- HeaterPIDConfig[index].m_calculatedError = HeaterPIDConfig[index].m_params.MIN;
+ HeaterPIDConfig[index].m_calculatedError = 0.0;
+ HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
}
-*/
- HeaterRecalculateSharedHeatersParams(index, HeaterPIDConfig[index].m_calculatedError);
+//check only for the proportional band limits
+// HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
+// &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+// HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
//SetMotorFreq (index, HeaterControl[index].m_calculatedError);
}
@@ -473,18 +490,20 @@ Data, 428, 80, 2641, False, False, 3, 4000, Standard DC
if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0))
{
HeaterPIDConfig[index].m_mesuredParam = readValue;
- HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
- &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
-/* if (HeaterPIDConfig[index].m_calculatedError >= HeaterPIDConfig[index].m_params.MAX)
+ if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) //below proportional band
{
- HeaterPIDConfig[index].m_calculatedError = HeaterPIDConfig[index].m_params.MAX;
+ HeaterPIDConfig[index].m_calculatedError = 1.0;
+ HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
}
- if (HeaterPIDConfig[index].m_calculatedError < HeaterPIDConfig[index].m_params.MIN)
+ else if (readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))
{
- HeaterPIDConfig[index].m_calculatedError = HeaterPIDConfig[index].m_params.MIN;
+ HeaterPIDConfig[index].m_calculatedError = 0.0;
+ HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
}
-*/
- HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
+//check only for the proportional band limits
+// HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam,
+// &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral);
+// HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError*100));
//SetMotorFreq (index, HeaterControl[index].m_calculatedError);
}
@@ -505,18 +524,18 @@ void EightMilliSecondHeatersInterrupt(UArg arg0)
ROM_IntMasterDisable();
HeatersControlMessageStruc Message;
- bool retcode = false;
+ //bool retcode = false;
//send message to the HeatersControl task
Message.messageId = HeatersControl;
Message.tick = UsersysTickGet();
Message.msglen = sizeof(HeatersControlMessageStruc);
if (HeatersControlMsgQ != NULL)
- retcode = Mailbox_post(HeatersControlMsgQ , &Message, BIOS_NO_WAIT);
+ /*retcode = */Mailbox_post(HeatersControlMsgQ , &Message, BIOS_NO_WAIT);
if (HeatersRestart == true)
{
- ROM_TimerLoadSet(Heater_timerBase, TIMER_A,OutputProportionalSingleStep/*twelve millisecond???*/);
+ ROM_TimerLoadSet(Heater_timerBase, TIMER_A,OutputProportionalSingleStep);
}
else
TimerDisable(Heater_timerBase, TIMER_A);
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index f5462e398..6740d6304 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -15,6 +15,8 @@
#include "PMR/Printing/JobSegment.pb-c.h"
#include "PMR/Printing/JobTicket.pb-c.h"
+#include <utils/ustdlib.h>
+
#include "StateMachines/Printing/PrintingSTM.h"
#include "drivers/Motors/Motor.h"
@@ -178,7 +180,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
pooler_counter++;
if (pooler_counter%10 == 0)
{
- SendJobProgress(CurrentProcessedLength/CurrentRequestedLength,CurrentSegmentId,false);
+ SendJobProgress(CurrentProcessedLength/CurrentRequestedLength,CurrentSegmentId,false, "Progress");
//SendJobProgress(/*KeepNormalizedError*/MotorControlConfig[index].m_calculatedError,CurrentSegmentId,false);
}
@@ -186,8 +188,8 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
//HeatingTestSendResonse(0, false,true,true, MotorDriverRequest[22].Speed,MotorDriverRequest[18].Speed,MotorDriverRequest[15].Speed,MotorDriverRequest[3].Speed, "MotorSpeed");
- HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/length,positionDiff/*(int)error_integered*/,CurrentProcessedLength,CurrentRequestedLength, "FeederLength");
- pooler_counter = 0;
+ //HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/length,positionDiff/*(int)error_integered*/,CurrentProcessedLength,CurrentRequestedLength, "FeederLength");
+ // pooler_counter = 0;
}
if (CurrentProcessedLength>=CurrentRequestedLength )
{
@@ -259,6 +261,8 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
int32_t TranslatedReadValue, avreageSampleValue = 0;
uint32_t calculated_speed;
double NormalizedError;
+ char Message[60];
+
if (IfIndex>>8 != IfTypeThread)
{
LOG_ERROR (IfIndex, "Wrong Interface type");
@@ -293,7 +297,8 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//TranslatedReadValue = 0;//test
MotorSamples[index][MotorSamplePointer[index]] = TranslatedReadValue;//(-1 * TranslatedReadValue);
MotorSamplePointer[index]++;
- if (MotorSamplePointer[index] >= MotorsControl[index].pvinputfilterfactormode) MotorSamplePointer[index] = 0;
+ if (MotorSamplePointer[index] >= MotorsControl[index].pvinputfilterfactormode)
+ MotorSamplePointer[index] = 0;
for (i=0;i<MotorsControl[index].pvinputfilterfactormode;i++)
avreageSampleValue += MotorSamples[index][i];
avreageSampleValue = avreageSampleValue / MotorsControl[index].pvinputfilterfactormode;
@@ -301,7 +306,9 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
if ((abs(avreageSampleValue)> DancerStopActivityLimit[index])&&(JobCounter > eOneSecond))
{
- EndState(CurrentJob);
+ usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint);
+
+ EndState(CurrentJob,Message );
}
NormalizedError = avreageSampleValue*NormalizedErrorCoEfficient[index];
MotorControlConfig[index].m_mesuredParam = NormalizedError;
@@ -339,8 +346,8 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
}*/
//HeatingTestSendResonse(0, false,true,true, MotorDriverRequest[22].Speed,MotorDriverRequest[18].Speed,MotorDriverRequest[15].Speed,MotorDriverRequest[3].Speed, "MotorSpeed");
- HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/_speed,OriginalMotorSpd_2PPS[index]/*(int)error_integered*/,MotorControlConfig[index].m_calculatedError,ReadValue, "FeederSpeed");
- pooler_counter = 0;
+ //HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/_speed,OriginalMotorSpd_2PPS[index]/*(int)error_integered*/,MotorControlConfig[index].m_calculatedError,ReadValue, "FeederSpeed");
+ // pooler_counter = 0;
}
}
@@ -472,7 +479,9 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
//set the speed only before the first segment, speed is constant accros job
JobTicket* JobTicket = JobDetails;
- float process_speed = JobTicket->processparameters->dyeingspeed;
+ float process_speed;
+ if (JobTicket->processparameters)
+ process_speed= JobTicket->processparameters->dyeingspeed;
SetOriginMotorSpeed(process_speed);
//ControlStart();
@@ -483,14 +492,14 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
//only for testing - when control works, these motors will take their speed from the dryer
//MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RDRIVING, OriginalMotorSpd_2PPS[FEEDER_MOTOR]);
-//#warning rocker disabled
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].has_directionthreadwize)
- MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 5);
- if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].has_directionthreadwize)
- MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 5);
-//#warning rocker disabled
+#warning rocker disabled
+// if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].has_directionthreadwize)
+// MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_RLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RLOADING].directionthreadwize);
+// MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_RLOADING, 5);
+// if (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].has_directionthreadwize)
+// MotorSetDirection((TimerMotors_t)HARDWARE_MOTOR_TYPE__MOTO_LLOADING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LLOADING].directionthreadwize);
+// MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_LLOADING, 5);
+#warning rocker disabled
// MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDRIVING].directionthreadwize, 0, GPI_LS_RLOADMOTOR_UP, EndState); //TODO
@@ -506,6 +515,7 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
{
ThreadUpdateProcessLength (0,(void *)NULL);
PreSegmentReady(Module_Thread,ModuleDone);
+ JobCounter = 0;
InitialProcess = false;
}