aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-06-01 10:48:22 +0300
committerShlomo Hecht <shlomo@twine-s.com>2020-06-01 10:48:22 +0300
commit5baa36de16ba1e55cd8dd735e8e83caaf56a358e (patch)
treeb70f7e3a1afb6c4f64614b014d0b908e1848a337 /Software/Embedded_SW
parentac66473a022e6eecf5d8d7a92eaa90a5e334be73 (diff)
downloadTango-5baa36de16ba1e55cd8dd735e8e83caaf56a358e.tar.gz
Tango-5baa36de16ba1e55cd8dd735e8e83caaf56a358e.zip
fix head identification; remove adc interrupt
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c4
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c2
-rw-r--r--Software/Embedded_SW/Embedded/Embedded.cfg7
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c204
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c1
8 files changed, 159 insertions, 83 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 84d8fa725..794ef6d37 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -177,7 +177,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
if (ReceivedFileHandle==NULL)
{
Fresult = FR_DENIED;
- Report("file chunk uplad rejected - file not created", __FILE__, __LINE__, 4, RpWarning, (int)0, 0);
+ Report("file chunk upload rejected - file not created", __FILE__, __LINE__, 4, RpWarning, (int)0, 0);
FileDone = true;
}
else
diff --git a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c
index f495758ec..627ad45b9 100644
--- a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c
+++ b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c
@@ -349,7 +349,7 @@ void ADCAcquireInit(void) // (called by MillisecInit)
ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
ADCReferenceSet(ADC1_BASE, ADC_REF_EXT_3V);
- VOCAlarmsInit();
+ //VOCAlarmsInit();
if (!isInitialized)
{
// Create a periodic Clock Instance with _period - triggers the ADC sampling
@@ -391,7 +391,7 @@ void ADCAcquireStart(ProcessCallback _callback, uint32_t _period) // (called by
MAP_ADCIntClear(ADC1_BASE, 0);
MAP_ADCIntEnable(ADC0_BASE, 0);
MAP_ADCIntEnable(ADC0_BASE, 1);
- ROM_IntEnable(INT_ADC0SS0);
+ //ROM_IntEnable(INT_ADC0SS0);
// Store process
processCallBack = _callback;
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c
index d55e1f617..603c13ad0 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c
@@ -117,7 +117,7 @@ uint32_t Check_Head_Type_Via_EEPROM()
#ifndef EVALUATION_BOARD
- if(Head_i2c_status == I2C_MASTER_ERR_ADDR_ACK)
+ if((Head_i2c_status == I2C_MASTER_ERR_ADDR_ACK)||(status == 0xFF))
{
Head_Type = HEAD_TYPE_SYLKO_WITHOUT_CARD;
}
diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg
index fe3d71979..666d9f9b3 100644
--- a/Software/Embedded_SW/Embedded/Embedded.cfg
+++ b/Software/Embedded_SW/Embedded/Embedded.cfg
@@ -26,9 +26,10 @@ BIOS.heapSize = 60000; // bios heapmem
Clock.timerId = 7;
-var hwi0Params = new Hwi.Params();
-hwi0Params.instance.name = "adcHwi";
-Program.global.adcHwi = Hwi.create(30, "&ADC0SS0Handler", hwi0Params);
+//var hwi0Params = new Hwi.Params();
+//hwi0Params.instance.name = "adcHwi";
+//Program.global.adcHwi = Hwi.create(30, "&ADC0SS0Handler", hwi0Params);
+
var hwi1Params = new Hwi.Params();
hwi1Params.instance.name = "sysTick";
Program.global.sysTick = Hwi.create(15, "&SysTickHandler", hwi1Params);
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index d334c9001..9609e445e 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -626,6 +626,10 @@ uint32_t MillisecLowLoop(uint32_t tick)
Trigger_HeaterWriting();
}
+ if (m20msecTick)
+ {
+ ADC0SS0Handler();
+ }
if(Fifty_msTick)
{
WHS_Read_GPI_Registers();
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
index 3f9811636..5f6bb6424 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c
@@ -781,6 +781,9 @@ void DiagnosticOneSecCollection(void)
DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone10, MillisecGetTemperatures(HEAD_PT100_ZONE_10_0X88_1));
DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone11, MillisecGetTemperatures(HEAD_PT100_ZONE_11_0X8A_0));
DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone12, MillisecGetTemperatures(HEAD_PT100_ZONE_12_0X8A_1));
+
+ DiagnosticLoadTemperature(HEATER_TYPE__HeadCoverHeater1, MillisecGetTemperatures(HEAD_PT100_AIR_HEATER_2_0X8C_1));
+ DiagnosticLoadTemperature(HEATER_TYPE__HeadCoverHeater2, MillisecGetTemperatures(HEAD_PT100_AIR_HEATER_1_0X8C_0));
}
if (Head_Type == HEAD_TYPE_STAPLE_SPUN)
{
@@ -790,6 +793,8 @@ void DiagnosticOneSecCollection(void)
DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone3, MillisecGetTemperatures(HEAD_PT100_ZONE_3_0X82_0));
DiagnosticLoadTemperature(HEATER_TYPE__HeadCoverHeater1, MillisecGetTemperatures(HEAD_PT100_AIR_HEATER_2_0X8C_1));
DiagnosticLoadTemperature(HEATER_TYPE__HeadCoverHeater2, MillisecGetTemperatures(HEAD_PT100_AIR_HEATER_1_0X8C_0));
+ DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone4, MillisecGetTemperatures(HEAD_PT100_ZONE_4_0X82_1));
+ DiagnosticLoadTemperature(HEATER_TYPE__HeaterZone6, MillisecGetTemperatures(HEAD_PT100_ZONE_6_0X84_1));
}
DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1));
DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP2));
@@ -977,14 +982,23 @@ void SendDiagnostics(void)
DiagnosticsMonitor.n_headzone10temperature = HeaterCounterIndex[HEATER_TYPE__HeaterZone10];
DiagnosticsMonitor.n_headzone11temperature = HeaterCounterIndex[HEATER_TYPE__HeaterZone11];
DiagnosticsMonitor.n_headzone12temperature = HeaterCounterIndex[HEATER_TYPE__HeaterZone12];
+//temporary
+ DiagnosticsMonitor.headcoverheater1temperature = HeaterTemperature[HEATER_TYPE__HeadCoverHeater1];
+ DiagnosticsMonitor.headcoverheater2temperature = HeaterTemperature[HEATER_TYPE__HeadCoverHeater2];
+ DiagnosticsMonitor.n_headcoverheater1temperature = HeaterCounterIndex[HEATER_TYPE__HeadCoverHeater1];
+ DiagnosticsMonitor.n_headcoverheater2temperature = HeaterCounterIndex[HEATER_TYPE__HeadCoverHeater2];
}
- if ((Head_Type == HEAD_TYPE_SYLKO)||(Head_Type == HEAD_TYPE_STAPLE_SPUN))
-// if (Head_Type == HEAD_TYPE_STAPLE_SPUN)
+ //if ((Head_Type == HEAD_TYPE_SYLKO)||(Head_Type == HEAD_TYPE_STAPLE_SPUN))
+ if (Head_Type == HEAD_TYPE_STAPLE_SPUN)
{
DiagnosticsMonitor.headcoverheater1temperature = HeaterTemperature[HEATER_TYPE__HeadCoverHeater1];
DiagnosticsMonitor.headcoverheater2temperature = HeaterTemperature[HEATER_TYPE__HeadCoverHeater2];
DiagnosticsMonitor.n_headcoverheater1temperature = HeaterCounterIndex[HEATER_TYPE__HeadCoverHeater1];
DiagnosticsMonitor.n_headcoverheater2temperature = HeaterCounterIndex[HEATER_TYPE__HeadCoverHeater2];
+ DiagnosticsMonitor.headzone4temperature = HeaterTemperature[HEATER_TYPE__HeaterZone4];
+ DiagnosticsMonitor.headzone6temperature = HeaterTemperature[HEATER_TYPE__HeaterZone6];
+ DiagnosticsMonitor.n_headzone4temperature = HeaterCounterIndex[HEATER_TYPE__HeaterZone4];
+ DiagnosticsMonitor.n_headzone6temperature = HeaterCounterIndex[HEATER_TYPE__HeaterZone6];
}
DiagnosticsMonitor.dryerzone1temperature = HeaterTemperature[HEATER_TYPE__DryerAirHeater];
DiagnosticsMonitor.dryerzone2temperature = HeaterTemperature[HEATER_TYPE__DryerMainHeater];
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
index d81ab7abb..3b010247d 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
@@ -30,6 +30,7 @@
#include "drivers/Valves/Valve.h"
#include "Drivers/I2C_Communication/DAC/blower.h"
#include "drivers/Flash_ram/MCU_E2Prom.h"
+#include <Drivers/SSI_Comm/Dancer/Dancer.h>
#include "ids/ids_ex.h"
#include "General/process.h"
@@ -40,6 +41,9 @@ char HomingToken[NUM_OF_MOTORS][36+1]={0};
int HomingCounter[NUM_OF_MOTORS];
uint32_t HomingControlId[NUM_OF_MOTORS];
+uint32_t Diagnostics_Dryer_UnLoading(void);
+uint32_t Diagnostics_Dryer_Loading(void);
+
/********************************************************************************
* Motor Homing
********************************************************************************/
@@ -119,61 +123,9 @@ uint32_t D_numberOfSteps = 0;
float D_numberOfCycles = 0;
double D_DrierPrevLocation = 0;
-uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
-{
- Report("Diagnostics_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,D_numberOfCycles,RpMessage,0,0);
- //storeLoadArmParameters();
-
- SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
- if (HomingControlId[deviceID] != 0xff)
- {
- Report("MotorHomingProgressReport stopped",__FILE__,__LINE__,deviceID,RpMessage,HomingCounter[deviceID],0);
- RemoveControlCallback(HomingControlId[deviceID],MotorHomingProgressReport);
- HomingControlId[deviceID] = 0xff;
- }
- return OK;
-}
-
-uint32_t Diagnostics_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue)
-{
- D_numberOfCycles++;
- uint32_t temp = Read_Dryer_ENC_Position();
- Report("Thread_Load_Dryer_UnLoading_Callback",__FILE__,ReadValue,temp,RpMessage,D_DrierPrevLocation,0);
- //Report("Thread_Load_Dryer_UnLoading_Callback details",__FILE__,(int)(TotalLoadedLen),D_numberOfCycles,RpMessage,CallbackCounter,0);
- if ((abs (temp -D_DrierPrevLocation)>1000 )&&(ReadValue == NOTBUSY)) // OK - take another round
- {
- D_DrierPrevLocation = temp;
- Report("Thread_Load_Dryer_UnLoading cycles",__FILE__,D_numberOfCycles,LoadArmRounds,RpMessage,0,0);
- if (D_numberOfCycles<LoadArmRounds)
- {
- MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- D_numberOfSteps, Diagnostics_Dryer_UnLoading_Callback, 10000);
- }
- else //done enough cycles, go to the center point
- {
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Set_Load_Arm_To_Stopper_Callback,30000);
- MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-D_numberOfCycles);
- Report("Store Number of cycles in drier",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
- }
- }
- else //timeout or no movement
- {
- Report("Store Number of cycles in drier - halted",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
- MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-(D_numberOfCycles-2));//it takes two cycles to identify a stop of the arm
- Report("Drier unloading timeout(1) or no movement",__FILE__,temp,D_DrierPrevLocation,RpWarning,ReadValue,0);
- if (HomingControlId[MotorId] != 0xff)
- {
- Report("MotorHomingProgressReport stopped",__FILE__,__LINE__,MotorId,RpMessage,HomingCounter[MotorId],0);
- RemoveControlCallback(HomingControlId[MotorId],MotorHomingProgressReport);
- HomingControlId[MotorId] = 0xff;
- }
- }
- return OK;
-}
uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer)
{
- //uint32_t numberOfSteps = 0;
uint32_t status = FAILED;
MessageContainer responseContainer;
@@ -215,16 +167,7 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer)
{
if(MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
{
- D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
- Report("MotorHomingRequestFunc Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,D_numberOfSteps,RpMessage,LoadArmRounds,0);
- //MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize),
- // MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/2, MotorHomingRequestCallback,0,1000);
- MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- D_numberOfSteps-800, Diagnostics_Dryer_UnLoading_Callback, 10000);
- D_numberOfCycles = 0;
-
- //MotorMoveWithCallback(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize),
- // D_numberOfSteps, MotorHomingRequestCallback,1000);
+ Diagnostics_Dryer_UnLoading();
status = OK;
}
if ( Motor_Id_to_LS_IdDown[MotorId] != MAX_GPI)
@@ -265,18 +208,7 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer)
{
if(MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
{
- if (LoadArmRounds <= 2)
- LoadArmRounds = 30;
-
- D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
- D_numberOfSteps -= 100;
- D_numberOfCycles = LoadArmRounds;
- Report("MotorHomingRequestFunc Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,D_numberOfSteps,RpMessage,LoadArmRounds,0);
-
- MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4);
-
- MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- D_numberOfSteps, MotorHomingRequestCallback, 100000);
+ Diagnostics_Dryer_Loading();
status = OK;
}
if ( Motor_Id_to_LS_IdUp[MotorId] != MAX_GPI)
@@ -486,4 +418,128 @@ uint32_t DispenserAbortHomingRequestFunc(MessageContainer* requestContainer)
return OK;
}
+uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
+{
+
+ Report("Diagnostics_Set_Load_Arm_To_Stopper time",__FILE__,__LINE__,msec_millisecondCounter,RpMessage,0,0);
+
+ //NumberOfDrierLoaderCycles=0;
+ //storeLoadArmParameters();
+ SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
+
+ return OK;
+}
+
+uint32_t Diagnostics_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue)
+{
+ D_numberOfCycles++;
+ uint32_t temp = Read_Dryer_ENC_Position();
+ Report("Diagnostics_Dryer_UnLoading_Callback",__FILE__,ReadValue,temp,RpMessage,D_DrierPrevLocation,0);
+ //Report("Diagnostics_Dryer_UnLoading_Callback details",__FILE__,(int)(TotalLoadedLen),D_numberOfCycles,RpMessage,CallbackCounter,0);
+ if (ReadValue == NOTBUSY) // OK - take another round
+ {
+ D_DrierPrevLocation = temp;
+ Report("Diagnostics_Dryer_UnLoading cycles",__FILE__,D_numberOfCycles,LoadArmRounds,RpMessage,0,0);
+ if (D_numberOfCycles<LoadArmRounds)
+ {
+ MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
+ D_numberOfSteps, Diagnostics_Dryer_UnLoading_Callback, 10000);
+ }
+ else //done enough cycles, go to the center point
+ {
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Set_Load_Arm_To_Stopper_Callback,15000);
+ MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-D_numberOfCycles);
+ Report("Store Number of cycles in drier",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ }
+ }
+ else //timeout or no movement
+ {
+ Report("Store Number of cycles in drier - halted",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-(D_numberOfCycles-2));//it takes two cycles to identify a stop of the arm
+
+ Report("Drier unloading timeout(1) or no movement",__FILE__,temp,D_DrierPrevLocation,RpWarning,ReadValue,0);
+ }
+ return OK;
+}
+uint32_t Diagnostics_Dryer_UnLoading(void)
+{
+ uint32_t temp;
+
+ D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/**LoadArmRounds*/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
+ D_numberOfCycles = 0;
+
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds);
+ if (LoadArmRounds == 0) //prev trial stopped
+ {
+ LoadArmRounds = (int)dryerbufferlength;
+ }
+ if (LoadArmRounds <= 2)
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds);
+
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&temp);
+ D_DrierPrevLocation = temp;
+ Report("Diagnostics_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,D_DrierPrevLocation,RpMessage, LoadArmRounds,0);
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/6*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius);
+// status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize),
+// MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Diagnostics_Set_Load_Arm_To_Stopper_Callback,0,1000);
+ MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
+ D_numberOfSteps-800, Diagnostics_Dryer_UnLoading_Callback, 10000);
+
+ return OK;
+}
+uint32_t Diagnostics_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint32_t ReadValue)
+{
+ //Report("Diagnostics_Dryer_MovetoEncoderPosition_Callback",__FILE__,__LINE__,0,RpMessage,CallbackCounter,0);
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200);
+
+ return OK;
+}
+
+uint32_t Diagnostics_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue)
+{
+ D_numberOfCycles++;
+
+ Report("Diagnostics_Dryer_Loading_Callback",__FILE__,(int)D_numberOfCycles,(int)D_DrierPrevLocation,RpMessage,ReadValue,0);
+
+ if (ReadValue == NOTBUSY)
+ {
+ //Report("Diagnostics_Dryer_Loading_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
+ //Report("Diagnostics_Dryer_Loading_Callback details",__FILE__,(int)(TotalLoadedLen),numberOfCycles,RpMessage,CallbackCounter,0);
+ if (D_numberOfCycles<LoadArmRounds)
+ {
+ MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
+ D_numberOfSteps, Diagnostics_Dryer_Loading_Callback, 10000);
+ }
+ else
+ {
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Dryer_MovetoEncoderPosition_Callback,15000);
+ MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,D_numberOfCycles);
+ Report("Store Number of cycles in drier",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ }
+ }
+ else
+ {
+ Report("Store Number of cycles in drier - halted",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,D_numberOfCycles);
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200);
+ }
+ return OK;
+}
+
+uint32_t Diagnostics_Dryer_Loading(void)
+{
+ if (dryerbufferlength)
+ LoadArmRounds = (int)dryerbufferlength;
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&D_DrierPrevLocation);
+ D_numberOfCycles = 0;
+ D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/**LoadArmRounds*/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
+
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/6*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius);
+ //6 seconds per round
+
+ //SetMotHome(ThreadMotorIdToMotorId[Motor_i]);
+ MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
+ D_numberOfSteps-800, Diagnostics_Dryer_Loading_Callback, 10000);
+ return OK;
+}
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
index 402db9d1e..69df1c183 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c
@@ -93,6 +93,7 @@ void PowerIdleSetIdle(void)
ProcessParametersClear.headzone11temp = (ActiveProcessParameters.headzone11temp <80)? ActiveProcessParameters.headzone11temp :IdleHeadTemperature;
ProcessParametersClear.headzone12temp = (ActiveProcessParameters.headzone12temp <80)? ActiveProcessParameters.headzone12temp :IdleHeadTemperature;
ProcessParametersClear.dyeingspeed = (ActiveProcessParameters.dyeingspeed <40)? ActiveProcessParameters.dyeingspeed :IdleHeadTemperature;
+ ProcessParametersClear.dryerbufferlength = (ActiveProcessParameters.dryerbufferlength <30)? ActiveProcessParameters.dryerbufferlength :30;
ProcessParametersClear.rblowertemp = (ActiveProcessParameters.rblowertemp <80)? ActiveProcessParameters.rblowertemp :IdleHeadTemperature;
ProcessParametersClear.lblowertemp = (ActiveProcessParameters.lblowertemp <80)? ActiveProcessParameters.lblowertemp :IdleHeadTemperature;
ProcessParametersClear.rblowerflow = (ActiveProcessParameters.rblowerflow <96)? ActiveProcessParameters.rblowerflow :96;