Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 5:fe1e88d6b0cb
- Parent:
- 4:379e05b2fc0d
- Child:
- 6:b1b74d1f8fab
--- a/main.cpp Wed Feb 20 15:35:56 2019 +0000
+++ b/main.cpp Wed Feb 20 18:43:15 2019 +0000
@@ -179,6 +179,10 @@
}//init
void checkUp(void){
+ #if defined(DEBUG_MODE)
+ if((GENERAL_TIME%5000==0)&&(STATUS==PRODUCTION))
+ pc.printf("Time: %ds\r\n",GENERAL_TIME/1000);
+ #endif
/*************************GENERAL INTERFACE CONTROL************************/
interface.check(); //Flash_control; Update_start_button_latch_each 50ms
@@ -227,11 +231,15 @@
}//checkUp
void ExtruderProduction(void){
- if((extruder.getTimer()>=EXTRUDER_CYCLE)&&(extruder.getPosition()<0.1)){//Check every 5s
+ if((extruder.getTimer()>=EXTRUDER_CYCLE)&&(extruder.getPosition()<0.1)){
+ if(tortilla.getExtruderCount()==0)
+ int addTime=GENERAL_TIME+CUTTER_WAIT_TIMER+CUTTER_FIRST_TIME;
+ else
+ int addTime=GENERAL_TIME+CUTTER_WAIT_TIMER;
+ tortilla.setCutterTrigger(tortilla.getExtruderCount(),addTime);
extruder.setTimer(0);
extruder.Step();
tortilla.addExtruder();
- cutter.setTimer(0);
#if defined(DEBUG_MODE)
pc.printf("Extruded dough number %d in position:%f\r\n",tortilla.getExtruderCount(),extruder.getPosition());
#endif
@@ -246,10 +254,15 @@
}//ExtruderProduction
void CutterProduction(void){
- if((cutter.getTimer()==5000)&&(interface.getTortilla()>tortilla.getCutterCount())){
+ int cutterMomentum=tortilla.getCutterTrigger(tortilla.getCutterCount());
+ if((cutterMomentum<=GENERAL_TIME)&&(cutterMomentum!=0)){
+ if(tortilla.getCutterCount()==0)
+ int addTime=GENERAL_TIME+GRIDDLE_WAIT_TIMER+GRIDDLE_FIRST_TIME;
+ else
+ int addTime=GENERAL_TIME+GRIDDLE_WAIT_TIMER;
cutter.cutt();
+ tortilla.setGriddleTrigger(tortilla.getCutterCount(),addTime);
tortilla.addCutter();
- griddle.setTimer(0);
#if defined(DEBUG_MODE)
pc.printf("Cutted tortilla number:%d\r\n",tortilla.getCutterCount());
#endif
@@ -258,10 +271,15 @@
}//CutterProduction
void GriddleProduction(void){
- if((griddle.getTimer()==5000)&&(interface.getTortilla()>tortilla.getGriddleCount())){
+ int griddleMomentum=tortilla.getGriddleTrigger(tortilla.getGriddleCount());
+ if((griddleMomentum<=GENERAL_TIME)&&(griddleMomentum!=0)){
+ if(tortilla.getGriddleCount()==0)
+ int addTime=GENERAL_TIME+OVEN_WAIT_TIMER+OVEN_FIRST_TIME;
+ else
+ int addTime=GENERAL_TIME+OVEN_WAIT_TIMER;
+ tortilla.setOvenTrigger(tortilla.getGriddleCount(),addTime);
griddle.press();
tortilla.addGriddle();
- oven.setTimer(0);
#if defined(DEBUG_MODE)
pc.printf("Griddled dough process number:%d\r\n",tortilla.getGriddleCount());
#endif
@@ -270,7 +288,8 @@
}//GriddleProduction
void OvenProduction(void){
- if((oven.getTimer()==5000)&&(interface.getTortilla()>tortilla.getOvenCount())){
+ int ovenMomentum=tortilla.getOvenTrigger(tortilla.getOvenCount());
+ if((ovenMomentum<=GENERAL_TIME)&&(ovenMomentum!=0)){
oven.open();
tortilla.addOven();
#if defined(DEBUG_MODE)