1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
|
/*
* InitSequence.c
*
* Created on: Feb 12, 2019
* Author: shlomo
*/
#include <Container.h>
#include <DataDef.h>
#include "include.h"
#include <PMR/Diagnostics/EventType.pb-c.h>
#include "PMR/MachineStatus/MachineStatus.pb-c.h"
#include "Modules/General/MachineStatus.h"
#include "modules/General/GeneralHardware.h"
#include "modules/General/Safety.h"
#include "modules/thread/thread.h"
#include "modules/ids/ids.h"
#include "modules/control/control.h"
#include "modules/AlarmHandling/AlarmHandling.h"
#include "modules/heaters/heaters_ex.h"
#include "modules/Diagnostics/Diagnostics.h"
#include "Modules/General/process.h"
#include "Modules/Waste/Waste.h"
#include "StateMachines/Printing/PrintingSTM.h"
#include "InitSequence.h"
#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"
typedef enum
{
INIT_SEQUENCE_INIT,
INIT_SEQUENCE_RESET_REASON,
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,
INIT_SEQUENCE_MACHINE_READY_TO_DYE,
INIT_SEQUENCE_END,
}INIT_SEQUENCE_STAGES_ENUM;
INIT_SEQUENCE_STAGES_ENUM InitStages = INIT_SEQUENCE_INIT, StoredInitStages = INIT_SEQUENCE_INIT;
MACHINE_STATE_STAGES_ENUM MachineStateDetail = MACHINE_STATE_INIT;
MACHINE_STATE_STAGES_ENUM GetMachineState(void)
{
return MachineStateDetail;
}
void SetMachineState(MACHINE_STATE_STAGES_ENUM NewState)
{
MachineStateDetail = NewState;
}
uint32_t HWControlId,InitSchedulerControlId;
uint32_t MidTankControlId;
uint32_t RESET_Cause = 0;
void InitSequenceResetReason(void);
uint32_t InitSequenceBuiltInTest(void);
uint32_t InitSequenceInitialBlowerActivation(void);
uint32_t InitSequenceDispenserPressureBuildUpTest(void);
uint32_t InitSequenceThreadDetection(void);
uint32_t InitSequenceStartHeating(void);
uint32_t InitSequenceMachineReadyToDye(void);
uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue);
void StopInitSequence(void)
{
InitStages = INIT_SEQUENCE_END;
InitSequenceStateMachine(InitStages);
}
uint32_t InitSequenceCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
if (SafeRemoveControlCallback(HWControlId, InitSequenceCallBackFunction )==OK)
HWControlId = 0xFF;
else
Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceCallBackFunction,0);
if (HWConfigurationInit() == OK)
{
ActivateHeadMagnet();
InitStages++;
//InitSequenceStateMachine(InitStages);
}
else
{
//if (MachineStateDetail == MACHINE_STATE_HW_CONFIG)
{
Report("HWConfigurationInit failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceCallBackFunction,0);
MachineStateDetail = MACHINE_STATE_NO_CFG_FILE;
AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_HW_CONFIG_FAILED,ON);
SetMachineStatus(MACHINE_STATE__Error);
}
}
return OK;
}
/*******************************************************************************************************/
uint32_t InitScheduler(uint32_t IfIndex, uint32_t BusyFlag)
{
if (InitStages > StoredInitStages)
{
StoredInitStages = InitStages;
InitSequenceStateMachine(InitStages);
}
return OK;
}
/*******************************************************************************************************/
uint32_t Start_InitSequence(void)
{
MachineStateDetail = MACHINE_STATE_HW_CONFIG;
SetMachineStatus(MACHINE_STATE__PowerUp);
HWControlId = AddControlCallback("Init HW Init", InitSequenceCallBackFunction, 4* eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
InitSchedulerControlId = AddControlCallback("InitScheduler", InitScheduler, eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
return OK;
}
uint32_t ResetReason = 0;
void InitSequenceResetReason(void)
{
ResetReason = ReportResetReason();
InitStages++;
//InitSequenceStateMachine(InitStages);
//return OK;
}
void InitSequenceBuiltInTestCallBack(uint32_t IfIndex, uint32_t BusyFlag)
{
if (1)//BIT OK
{
InitStages++;
//InitSequenceStateMachine(InitStages);
AlarmHandlingSetAlarm(EVENT_TYPE__POWER_UP_BIT_FAILURE,false);
}
else
{
MachineStateDetail = MACHINE_STATE_BUILT_IN_FAILED;
AlarmHandlingSetAlarm(EVENT_TYPE__POWER_UP_BIT_FAILURE,true);
}
//return OK;
}
uint32_t InitSequenceBuiltInTest(void)
{
MachineStateDetail = MACHINE_STATE_BUILT_IN_TEST;
InitSequenceBuiltInTestCallBack(0,0);
return OK;
}
int MidTankOperationCounter = 0;
uint32_t InitSequenceMidTankCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
int MidTankOpenAir = 8;
int MidTankReadPressure = 16;
int MidTankCloseAir = 40;
int MidTankEnd = 48;
int portId;
if (MidTankOperationCounter >= MidTankEnd)
{
SafeRemoveControlCallback(MidTankControlId, InitSequenceMidTankCallBackFunction);
}
else if (MidTankOperationCounter >= MidTankCloseAir)
{
//close air valve for midtank (MidTankOperationCounter-MidTankCloseAir)
portId = (MidTankOperationCounter - MidTankCloseAir) ; //0-7
Disable_MidTank_Pressure_Reading(portId);
Valve_Set(IDS_Id_to_AirValve[portId], Atm_MidTank_OFF ); //Atm_MidTank_OFF/ON
Control3WayValvesWithCallback ((Valves_t)portId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
}
else if (MidTankOperationCounter >= MidTankReadPressure)
{
//read pressure for midtank (MidTankOperationCounter-MidTankCloseAir)
portId = MidTankOperationCounter%MAX_SYSTEM_DISPENSERS;
Read_MidTank_Pressure_Sensor(portId);
}
else if (MidTankOperationCounter >= MidTankOpenAir)
{
//open air valve for midtank (MidTankOperationCounter-MidTankOpenAir)
portId = (MidTankOperationCounter - MidTankOpenAir) ; //0-7
Enable_MidTank_Pressure_Reading(portId);
Valve_Set(IDS_Id_to_AirValve[portId], Atm_MidTank_ON ); //Atm_MidTank_OFF/ON
Control3WayValvesWithCallback ((Valves_t)portId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
}
MidTankOperationCounter++;
return OK;
}
uint32_t InitSequenceBlowerCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
if (SafeRemoveControlCallback(HWControlId, InitSequenceBlowerCallBackFunction )==OK)
HWControlId = 0xFF;
else
Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceBlowerCallBackFunction,0);
if (BlowerCfg.heatingvoltage)
Control_Voltage_To_Blower(BlowerCfg.heatingvoltage);
else
Control_Voltage_To_Blower(3000);
//WHS_Start_Blower_Control_Closed_Loop(2.5);
AlarmHandlingSetAlarm (EVENT_TYPE__MACHINE_STATE_INITIAL_BLOWER_FAILED,OFF); //handle alarm detection and operation
Safety_Init();
InitStages++;
//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 >= MAX_CURRENT_READING)
{
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)
{
ReportWithPackageFilter(InitFilter,"PowerManagementCallBack", __FILE__,MainHeaterStable,(int)(SecondaryHeaterStable), RpMessage, Maxcount_Heater_Current, 0);
ReportWithPackageFilter(InitFilter,"PowerManagementCallBack", __FILE__,GetHeaterState(HEATER_TYPE__DryerMainHeater),(int)(GetHeaterState(HEATER_TYPE__DryerSecondaryHeater)), RpMessage, Maxcount_Heater_Current, 0);
if ((MainHeaterStable == false)&&(Maxcount_Heater_Current<CURRENT_READING_ERROR_UNSTABLE))
{
InitDrierAcVoltage += ReadVAC();
InitDrierAcVoltageCount++;
ReportWithPackageFilter(InitFilter,"main heater current not stable", __FILE__,GetHeaterState(HEATER_TYPE__DryerMainHeater),(int)(StableCurrent*100), RpMessage, Maxcount_Heater_Current, 0);
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__,GetHeaterState(HEATER_TYPE__DryerMainHeater),(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__,GetHeaterState(HEATER_TYPE__DryerSecondaryHeater),(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)
{
if ((Head_Type >= HEAD_TYPE_SYLKO)&&(WHS_Type == WHS_TYPE_NEW))
{
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);
}
else
InitStages++;
return OK;
}
uint32_t InitSequenceInitialBlowerActivation(void)
{
MachineStateDetail = MACHINE_STATE_INITIAL_BLOWER_ACTIVATION;
//WHS_Start_Blower_Control_Closed_Loop(0.0);
Turn_the_Blower_On();//Turn on with the Default_Voltage
// if (BlowerCfg.voltage)
// Control_Voltage_To_Blower(BlowerCfg.voltage);
// else
Control_Voltage_To_Blower(4200);
HWControlId = AddControlCallback("Init Blower", InitSequenceBlowerCallBackFunction, 10* eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
/*if (RdInkCartridgeSensor()) //if there is a cartridge in the ink slot skip the valves procedure
{
MidTankOperationCounter = 32;
Report("There is a cartridge in the ink slot. skipping the valves procedure",__FILE__,__LINE__,(int)MidTankOperationCounter,RpWarning,(int)InitStages,0);
}*/
MidTankControlId = AddControlCallback("Init Midtank", InitSequenceMidTankCallBackFunction, 300/*eHundredMillisecond*/, TemplateDataReadCBFunction,0,0, 0 );
return OK;
}
int NumOfCheckedDispnsers = 0;
uint32_t InitSequenceDispenserPressureBuildUpTestCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
NumOfCheckedDispnsers--;
if(NumOfCheckedDispnsers==0)
{
InitStages++;
//InitSequenceStateMachine(InitStages);
MachineStateDetail = MACHINE_STATE_DISPENSER_PRESSURE_BUILDUP_TEST;
}
return OK;
}
uint32_t InitSequenceDispenserPressureBuildUpTest(void)
{
int Dispenser_i;
Report("InitSequenceDispenserPressureBuildUpTest",__FILE__,__LINE__,(int)0,RpWarning,(int)0,0);
for (Dispenser_i = 0;Dispenser_i<MAX_SYSTEM_DISPENSERS;Dispenser_i++)
{
if (isMotorConfigured(Dispenser_i + HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)==true)
{
IDS_Dispenser_Build_Pressure(Dispenser_i,InitSequenceDispenserPressureBuildUpTestCallBackFunction);
Report("IDS_Dispenser_Build_Pressure",__FILE__,__LINE__,(int)Dispenser_i,RpWarning,(int)Dispenser_i,0);
NumOfCheckedDispnsers++;
}
}
return OK;
}
uint32_t InitSequenceWaitForCoolerCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
MachineStateDetail = INIT_SEQUENCE_WAIT_FOR_COOLER;
if (SafeRemoveControlCallback(HWControlId, InitSequenceWaitForCoolerCallBackFunction )==OK)
HWControlId = 0xFF;
else
Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceWaitForCoolerCallBackFunction,0);
InitStages++;
return OK;
}
uint32_t InitSequenceWaitForCooler(void)
{
if (WHS_Type == WHS_TYPE_UNKNOWN)
{
InitStages++;
MachineStateDetail = INIT_SEQUENCE_WAIT_FOR_COOLER;
return OK;
}
if ((ResetReason & SYSCTL_CAUSE_SW)||(ResetReason & SYSCTL_CAUSE_WDOG1)||(ResetReason & SYSCTL_CAUSE_WDOG0))
{
//soft-warm reset
InitStages++;
MachineStateDetail = INIT_SEQUENCE_WAIT_FOR_COOLER;
}
else
{
//cold reset, wait 2 minutes for cooler start
// HWControlId = AddControlCallback("Init Cooler", InitSequenceWaitForCoolerCallBackFunction, 2*eOneMinute, TemplateDataReadCBFunction,0,0, 0 );
HWControlId = AddControlCallback("Init Cooler", InitSequenceWaitForCoolerCallBackFunction, 2*eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
}
//InitSequenceStateMachine(InitStages);
return OK;
}
uint32_t InitSequenceThreadDetection(void)
{
InitStages++;
MachineStateDetail = MACHINE_STATE_THREAD_DETECTION;
//InitSequenceStateMachine(InitStages);
return OK;
}
uint32_t InitSequenceStartHeatingCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
if (HeaterCheckReady()==true)
{
MachineStateDetail = MACHINE_STATE_MACHINE_READY_TO_DYE;
if (SafeRemoveControlCallback(HWControlId, InitSequenceStartHeatingCallBackFunction )==OK)
HWControlId = 0xFF;
else
Report("Remove control callback failed",__FILE__,__LINE__,(int)HWControlId,RpWarning,(int)InitSequenceStartHeatingCallBackFunction,0);
InitStages++;
//InitSequenceStateMachine(InitStages);
}
return OK;
}
bool InitialHeating = false;
void InitSequenceSetStartHeating(bool StartHeating)
{
REPORT_MSG(StartHeating,"InitSequenceStateMachine InitialHeating set");
InitialHeating = StartHeating;
}
uint32_t InitSequenceStartHeating(void)
{
if (InitialHeating)
{
if (ProcessParamsInit() ==OK)
{
MachineStateDetail = MACHINE_STATE_HEATING_STARTED;
HWControlId = AddControlCallback("Init Heating", InitSequenceStartHeatingCallBackFunction, 2*eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
//start heaters with predefined / store process parameters
}
else
{
MachineStateDetail = MACHINE_STATE_NO_PROCESS_PARAMS;
SetMachineStatus(MACHINE_STATE__Ready);
REPORT_MSG(MachineStateDetail,"InitSequenceStateMachine no processparameters file");
}
}
else
{
REPORT_MSG(InitialHeating,"InitSequenceStateMachine InitialHeating is OFF");
MachineStateDetail = MACHINE_STATE_MACHINE_READY_TO_DYE;
InitStages++;
}
if (AutoHoming_Config >= AutoHoming_PowerOn_off )
{
int Dispenser_i;
for ( Dispenser_i = 0;Dispenser_i < MAX_SYSTEM_DISPENSERS;Dispenser_i++)
{
if (Dispenser_i!=LUBRICANT_DISPENSER)
IDS_HomeDispenser (Dispenser_i, 1000 , NULL);
}
}
//activate second pump for 10 minutes
PumpActivation(600);
return OK;
}
uint32_t InitSequenceMachineReadyToDye(void)
{
SetMachineStatus(MACHINE_STATE__Ready);
InitStages++;
return OK;
}
uint32_t InitSequenceInitEnd(void)
{
RemoveControlCallback( InitSchedulerControlId,InitScheduler);
return OK;
}
uint32_t InitSequenceStateMachine( INIT_SEQUENCE_STAGES_ENUM ReadValue)
{
REPORT_MSG(ReadValue,"InitSequenceStateMachine");
switch (ReadValue)
{
case INIT_SEQUENCE_INIT:
MachineStateDetail = MACHINE_STATE_HW_CONFIG;
Start_InitSequence();
break;
case INIT_SEQUENCE_RESET_REASON:
InitSequenceResetReason();
break;
case INIT_SEQUENCE_BUILT_IN_TEST:
InitSequenceBuiltInTest();
break;
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;*/
case INIT_SEQUENCE_WAIT_FOR_COOLER:
InitSequenceWaitForCooler();
case INIT_SEQUENCE_THREAD_DETECTION:
InitSequenceThreadDetection();
break;
case INIT_SEQUENCE_START_HEATING:
InitSequenceStartHeating();
break;
case INIT_SEQUENCE_MACHINE_READY_TO_DYE:
InitSequenceMachineReadyToDye();
break;
case INIT_SEQUENCE_END:
InitSequenceInitEnd();
break;
default:
LOG_ERROR(ReadValue,"ERROR IN INIT STATE MACHINE");
RemoveControlCallback( InitSchedulerControlId,InitScheduler);
break;
}
return OK;
}
|