aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-02-18 10:19:36 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-02-18 10:19:36 +0200
commitb14dc1bc35994c4da27bd64e7de65ff66ae7ee0d (patch)
tree514890d752ef029d97730b6021682e95f17691ee /Software/Embedded_SW
parent493a38117c886c9c9599b67c5297025e54917cfe (diff)
downloadTango-b14dc1bc35994c4da27bd64e7de65ff66ae7ee0d.tar.gz
Tango-b14dc1bc35994c4da27bd64e7de65ff66ae7ee0d.zip
preparing rapid release
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c28
-rw-r--r--Software/Embedded_SW/Embedded/DataDef.h4
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/EEPROM/Head_EEPROM.c4
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c88
-rw-r--r--Software/Embedded_SW/Embedded/Main.c6
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c6
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c131
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h1
9 files changed, 200 insertions, 70 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 873c89b7e..e8d7f6f58 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -280,16 +280,22 @@ uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer)
Fresult = FR_DENIED;
else
{
- Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER);
- Fresult = f_open(DownloadFileHandle,request->filename,FA_READ );
- if (Fresult == FR_OK)
+ if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT))
{
- response.has_maxchunklength = true;
- response.maxchunklength = MAX_CHUNK_LENGTH;
- strcpy(FileHandleChar, "1234");
- response.downloadid = FileHandleChar; //supporting only single file at each time.
+ Fresult = f_open(DownloadFileHandle,request->filename,FA_READ );
+ if (Fresult == FR_OK)
+ {
+ response.has_maxchunklength = true;
+ response.maxchunklength = MAX_CHUNK_LENGTH;
+ strcpy(FileHandleChar, "1234");
+ response.downloadid = FileHandleChar; //supporting only single file at each time.
+ Report("data request", __FILE__, 1234, MAX_CHUNK_LENGTH, RpWarning, (int)fno->fsize, 0);
+ }
+ else
+ {
+ Semaphore_post(FFS_Sem);
+ }
}
-
}
}
@@ -323,10 +329,11 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
Buffer = my_malloc (MAX_CHUNK_LENGTH);
if (Buffer != NULL)
{
- Fresult = f_read(SentFileHandle,Buffer,2000,&ReadBytes );
+ Fresult = f_read(SentFileHandle,Buffer,MAX_CHUNK_LENGTH,&ReadBytes );
if(Fresult != FR_OK)
{
- LOG_ERROR (Fresult,"f_write error");
+ LOG_ERROR (Fresult,"f_read error");
+ Semaphore_post(FFS_Sem);
}
else
{
@@ -334,6 +341,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
response.buffer.len = ReadBytes;
response.buffer.data = Buffer;
FileSentLength += ReadBytes;
+ Report("sending data to MS", __FILE__, ReadBytes, FileSentLength, RpWarning, (int)FileLength, 0);
if (FileSentLength == FileLength)
{
REPORT_MSG (FileSentLength,"file download ended successfully");
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h
index 32e149968..4f7a5d2dc 100644
--- a/Software/Embedded_SW/Embedded/DataDef.h
+++ b/Software/Embedded_SW/Embedded/DataDef.h
@@ -26,8 +26,8 @@
#define USE_POWERSTEP01
//#define SPECIAL_DISPENSERS
-#define Use_Head_Card //for real card only
-#define Use_WHS_Card //for real card only
+//#define Use_Head_Card //for real card only
+//#define Use_WHS_Card //for real card only
//#define Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0
#define I2C_2_Data_Transfer_Rate_400kbps
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 a2f003840..25c264755 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
@@ -128,12 +128,12 @@ uint32_t Check_Head_Type_Via_EEPROM()
}
//temporary
- #ifdef Use_Head_Card
+/* #ifdef Use_Head_Card
Head_Type = HEAD_TYPE_SYLKO;
#else
Head_Type = HEAD_TYPE_SYLKO_WITHOUT_CARD;
#endif
-
+*/
//TODO to test and replace #ifdef Use_Head_Card with if(Head_Type != HEAD_TYPE_SYLKO_WITHOUT_CARD)
return status;
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c
index 47bbb7b60..4d8965de8 100644
--- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c
@@ -238,66 +238,60 @@ uint32_t HeadADCPT100_WriteReg(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t reg,
return Status;
}
-
-
-#ifdef Use_Head_Card
-
uint8_t HeadADCPT100_InitConfigReg()
{
uint8_t i;
-
- for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them
+ if (Head_Type >= HEAD_TYPE_SYLKO)//adjust the limit switches
{
- // - - - - - - - - - - Reg0 - - - - - - - - - -
- HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0
- HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3
- //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7
+ for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them
+ {
+ // - - - - - - - - - - Reg0 - - - - - - - - - -
+ HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0
+ HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3
+ //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7
- // - - - - - - - - - - Reg1 - - - - - - - - - -
+ // - - - - - - - - - - Reg1 - - - - - - - - - -
- HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0
- HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2
- HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3
- HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4
- HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7
+ HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0
+ HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2
+ HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3
+ HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4
+ HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7
- // - - - - - - - - - - Reg2 - - - - - - - - - -
+ // - - - - - - - - - - Reg2 - - - - - - - - - -
- HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2
- HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3
- HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5
- HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6
- HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7
+ HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2
+ HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3
+ HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5
+ HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6
+ HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7
- // - - - - - - - - - - Reg3 - - - - - - - - - -
- HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0
- HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4
- HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7
+ // - - - - - - - - - - Reg3 - - - - - - - - - -
+ HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0
+ HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4
+ HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7
- }
+ }
- for(i=HEAD_PT100_ZONE_1_0X80_0;i < HEAD_PT100_ZONE_2_0X80_1;i++)
- {
- HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7
- HeadTempSensConfig[i].SEL = HEAD_CONFIG_ODD_PT100_PT_SEL;
- }
+ for(i=HEAD_PT100_ZONE_1_0X80_0;i < HEAD_PT100_ZONE_2_0X80_1;i++)
+ {
+ HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7
+ HeadTempSensConfig[i].SEL = HEAD_CONFIG_ODD_PT100_PT_SEL;
+ }
- for(i=HEAD_PT100_ZONE_2_0X80_1;i < HEAD_PT100_RESERVE_0X8E_1;i++)
- {
- HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7
- HeadTempSensConfig[i].SEL = HEAD_CONFIG_EVEN_PT100_PT_SEL;
- }
+ for(i=HEAD_PT100_ZONE_2_0X80_1;i < HEAD_PT100_RESERVE_0X8E_1;i++)
+ {
+ HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7
+ HeadTempSensConfig[i].SEL = HEAD_CONFIG_EVEN_PT100_PT_SEL;
+ }
- HeadTempSensConfig[i].Config = 0;
+ HeadTempSensConfig[i].Config = 0;
- HeadTempSensConfig[i].MUX_Status = UNKNOWN;
+ HeadTempSensConfig[i].MUX_Status = UNKNOWN;
- return OK;
-}
-#else
- uint8_t HeadADCPT100_InitConfigReg()
+ }
+ else
{
- uint8_t i;
for(i=HEAD_PT100_ZONE_1_0X80_0;i<MAX_HEAD_CARD_TEMP_SENS_ID; i++)
{
@@ -328,10 +322,10 @@ uint8_t HeadADCPT100_InitConfigReg()
HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN3 ;//Bits 5-7
}
-
- return OK;
}
-#endif
+
+ return OK;
+}
uint32_t HeadADCPT100_Config_callback(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Stage)
{
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
index 6b5424d74..803a22cc4 100644
--- a/Software/Embedded_SW/Embedded/Main.c
+++ b/Software/Embedded_SW/Embedded/Main.c
@@ -298,6 +298,7 @@ int main(void)
//Turn_the_Blower_On();//Turn on with the Default_Voltage
ActivateChiller();//WHS Cooler SSR9
//ActivateHeadMagnet();
+ Set_Speed_Sensor_TypeII_Registers(10,5);//set default values
#endif
I2C_ReadingTask_Init();
//EMAC_initEMAC();
@@ -337,11 +338,6 @@ int main(void)
//
//test_avi(); //example for shai
-
-
-#ifndef EVALUATION_BOARD
- //Set_Speed_Sensor_TypeII_Registers(2,2);//set default values
-#endif
//Read_Speed_Sensor_TypeII();//must be delay between Set_Speed_Sensor_TypeII_Registers to Read_Speed_Sensor_TypeII
//Test_ADS120_Internal_Temperature_Sensor(0);
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index e5064ef70..23b303221 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -606,7 +606,7 @@ uint32_t MillisecLowLoop(uint32_t tick)
StartPT100 = TEMP_SENSE_ANALOG_DRYER_TEMP1;
if (Ten_msTick)
{
- //Speed_Data = Calculate_Speed_Sensor_Velocity();
+ Speed_Data = Read_Speed_Sensor_TypeII();
//MillisecReadFromTempSensor(Sensor_Read, NULL);
//if (Sensor_Read++ >= MAX_MAIN_CARD_TEMPERATURE_SENSOR_ID) Sensor_Read = 0;
if(Machine_Idle_Mode == true)
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
index f43cf8c56..6e4eed580 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c
@@ -27,9 +27,9 @@
uint32_t CloseValveTimeout = 10;
uint32_t OpenValveTimeout = 10;
-#define DISPENSER_BUILD_PRESSURE_SPEED 900
-#define DISPENSER_BUILD_PRESSURE_LIMIT 1.5
-#define DISPENSER_BUILD_PRESSURE_TIMEOUT 60000
+#define DISPENSER_BUILD_PRESSURE_SPEED 940
+#define DISPENSER_BUILD_PRESSURE_LIMIT 1.0
+#define DISPENSER_BUILD_PRESSURE_TIMEOUT 120000
#define DISPENSER_BUILD_PRESSURE_LAG 50
#define DEFAULT_NANOLITER_PER_PULSE 2.34
uint32_t DispenserPrepareSpeed = DISPENSER_BUILD_PRESSURE_SPEED;
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
index d1f667405..ba3a3e1a7 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.c
@@ -28,6 +28,7 @@
#include "drivers/I2C_Communication/DAC/Blower.h"
#include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h"
+#include "drivers/adc_sampling/adc.h"
#include "drivers/Valves/Valve.h"
#include "heaters/heaters_ex.h"
@@ -39,6 +40,7 @@
INIT_SEQUENCE_BUILT_IN_TEST,
INIT_SEQUENCE_INITIAL_BLOWER_ACTIVATION,
//INIT_SEQUENCE_DISPENSER_PRESSURE_BUILDUP_TEST,
+ INIT_SEQUENCE_POWER_MANAGEMENT_INIT,
INIT_SEQUENCE_WAIT_FOR_COOLER,
INIT_SEQUENCE_THREAD_DETECTION,
INIT_SEQUENCE_START_HEATING,
@@ -208,6 +210,132 @@ uint32_t InitSequenceBlowerCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
//InitSequenceStateMachine(InitStages);
return OK;
}
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+#define MAX_CURRENT_READING 5
+#define CURRENT_READING_ERROR_UNSTABLE 100
+int Heater_Current[MAX_CURRENT_READING] ;
+bool initial_wait = false;
+int count_Heater_Current = 0;
+int Maxcount_Heater_Current = 0;
+bool MainHeaterStable = false,SecondaryHeaterStable = false;
+double MainCurrent,SecondaryCurrent,StableCurrent;
+double InitDrierAcVoltage = 0.0;
+int InitDrierAcVoltageCount = 0;
+double Zone2Resistance = 0.0;
+void InitCurrentReadingStable(void)
+{
+ memset(Heater_Current,0,sizeof(Heater_Current));
+ initial_wait = false;
+ count_Heater_Current = 0;
+ Maxcount_Heater_Current = 0;
+ StableCurrent = 0.0;
+}
+
+bool DetectIfCurrentReadingStable(double HeaterCurrent)
+{
+ bool ret = false;
+ int i=0;
+ int sum = 0;
+ int average = 0;
+
+ Maxcount_Heater_Current++;
+ Heater_Current[count_Heater_Current++] = HeaterCurrent;
+ if ( count_Heater_Current >= 5)
+ {
+ count_Heater_Current = 0;
+ initial_wait = true;
+ }
+ if (initial_wait == false)
+ return false;
+ for (i=0;i<MAX_CURRENT_READING;i++)
+ sum += Heater_Current[i];
+ average = sum/MAX_CURRENT_READING;
+ if (fabs(average - HeaterCurrent)<0.2)
+ {
+ ret = true;
+ StableCurrent = average;
+ }
+ return ret;
+}
+double GetZone2RMSCurrent(double VAC)
+{
+ return (VAC/Zone2Resistance);
+}
+uint32_t PowerManagementCallBack(uint32_t IfIndex, uint32_t BusyFlag)
+{
+
+ if ((MainHeaterStable == false)&&(Maxcount_Heater_Current<CURRENT_READING_ERROR_UNSTABLE))
+ {
+ InitDrierAcVoltage += ReadVAC();
+ InitDrierAcVoltageCount++;
+ MainHeaterStable = DetectIfCurrentReadingStable(Get_Heaters_Current(HEATER_DRYER_CURRENT_1));
+ Read_Heaters_Current(HEATER_DRYER_CURRENT_1);
+ if (MainHeaterStable == true)
+ {
+ ReportWithPackageFilter(InitFilter,"main heater current stable", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0);
+ InitDrierAcVoltage /= InitDrierAcVoltageCount;
+ MainCurrent = StableCurrent;
+ InitCurrentReadingStable();
+ DeActivateHeater(HEATER_TYPE__DryerMainHeater);
+ ActivateHeater(HEATER_TYPE__DryerSecondaryHeater);
+ ReportWithPackageFilter(InitFilter,"starting secondary heater ", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0);
+ }
+ }
+ else
+ {
+ DeActivateHeater(HEATER_TYPE__DryerMainHeater);
+ if (Maxcount_Heater_Current>=CURRENT_READING_ERROR_UNSTABLE)
+ {
+ ReportWithPackageFilter(InitFilter,"drier heaters current not stable", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0);
+ if (SafeRemoveControlCallback(HWControlId, PowerManagementCallBack )==OK)
+ HWControlId = 0xFF;
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)PowerManagementCallBack,0);
+ AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_HEATERS_ZONE_1_CURRENT_OUT_OF_RANGE,ON);
+ DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater);
+ DeActivateHeater(HEATER_TYPE__DryerMainHeater);
+ InitStages++;
+ }
+ else //go to secondary
+ {
+ if ((SecondaryHeaterStable == false)&&(Maxcount_Heater_Current<CURRENT_READING_ERROR_UNSTABLE))
+ {
+ SecondaryHeaterStable = DetectIfCurrentReadingStable(Get_Heaters_Current(HEATER_DRYER_CURRENT_2));
+ Read_Heaters_Current(HEATER_DRYER_CURRENT_2);
+ if (SecondaryHeaterStable == true)
+ {
+ ReportWithPackageFilter(InitFilter,"main heater current stable", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0);
+ SecondaryCurrent = StableCurrent;
+ InitCurrentReadingStable();
+ DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater);
+ //do stuff for RMS 2
+ Zone2Resistance = InitDrierAcVoltage/SecondaryCurrent;
+ }
+ }
+ else
+ {
+ if (SafeRemoveControlCallback(HWControlId, PowerManagementCallBack )==OK)
+ HWControlId = 0xFF;
+ else
+ Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)PowerManagementCallBack,0);
+ DeActivateHeater(HEATER_TYPE__DryerSecondaryHeater);
+ DeActivateHeater(HEATER_TYPE__DryerMainHeater);
+ if (Maxcount_Heater_Current>=CURRENT_READING_ERROR_UNSTABLE)
+ AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_HEATERS_ZONE_2_CURRENT_OUT_OF_RANGE,ON);
+ InitStages++;
+ }
+ }
+ }
+return OK;
+}
+uint32_t InitSequencePowerManagementInit(void)
+{
+ InitCurrentReadingStable();
+ ActivateHeater(HEATER_TYPE__DryerMainHeater);
+ HWControlId = AddControlCallback("Init Power", PowerManagementCallBack, eHundredMillisecond, TemplateDataReadCBFunction,0,0, 0 );
+ ReportWithPackageFilter(InitFilter,"starting main heater ", __FILE__,__LINE__,(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0);
+ return OK;
+}
uint32_t InitSequenceInitialBlowerActivation(void)
{
MachineStateDetail = MACHINE_STATE_INITIAL_BLOWER_ACTIVATION;
@@ -385,6 +513,9 @@ uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue)
case INIT_SEQUENCE_INITIAL_BLOWER_ACTIVATION:
InitSequenceInitialBlowerActivation();
break;
+ case INIT_SEQUENCE_POWER_MANAGEMENT_INIT:
+ InitSequencePowerManagementInit();
+ break;
/*case INIT_SEQUENCE_DISPENSER_PRESSURE_BUILDUP_TEST:
InitSequenceDispenserPressureBuildUpTest();
break;*/
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h
index 105537721..f65329c4b 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h
+++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/InitSequence.h
@@ -33,6 +33,7 @@ void StopInitSequence(void);
MACHINE_STATE_STAGES_ENUM GetMachineState(void);
void SetMachineState(MACHINE_STATE_STAGES_ENUM);
void InitSequenceSetStartHeating(bool StartHeating);
+double GetZone2RMSCurrent(double VAC);
#endif /* STATEMACHINES_INITIALIZATION_INITSEQUENCE_H_ */