homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Files at this revision

API Documentation at this revision

Comitter:
gatedClock
Date:
Wed Sep 11 18:07:15 2013 +0000
Parent:
67:1d9c85a4c3c1
Child:
69:55b836e8ced7
Commit message:
FSM not getting out of IDLE state.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 11 18:00:47 2013 +0000
+++ b/main.cpp	Wed Sep 11 18:07:15 2013 +0000
@@ -309,22 +309,26 @@
       
         if (dFSMstate == FSM_IDLE)              // idle state.
         {
+          pc.printf("\n\r FSM_IDLE");
           if (dButtonStart & !dDoorOpen & dTimeRemaining) dFSMstate = FSM_COOK;
         }
         else
         if (dFSMstate == FSM_COOK)              // cook state.
         {
-           if (dDoorOpen & dTimeRemaining) dFSMstate = FSM_PAUSE;
+          pc.printf("\n\r FSM_COOK");
+          if (dDoorOpen & dTimeRemaining) dFSMstate = FSM_PAUSE;
         }
         else
         if (dFSMstate == FSM_PAUSE)             // pause state.
         {
+          pc.printf("\n\r FSM_PAUSE");
           if (dButtonStart & !dDoorOpen & dTimeRemaining) dFSMstate = FSM_DONE;
           if (dButtonStop) dFSMstate = FSM_COOK;
         }       
         else
         if (dFSMstate == FSM_DONE)              // incomplete.
         {
+          pc.printf("\n\r FSM_DONE");
  //         timerFSMdone.reset();                 // reset the timer.
           dFSMstate = FSM_IDLE;                 // end of beep.
         }      
@@ -511,10 +515,7 @@
         if (dLCDtotalCookTimeSec  != dLCDtotalCookTimeSecLast  ||
             dCookTimeRemainingSec != dCookTimeRemainingSecLast || 
             fLCDcelsius           != fLCDcelsiusLast)
-        {
         lcd.cls();
-        pc.printf("\n\r cleared LCD.");
-        }
       
         LCD1;                                   // line 1.
         lcd.printf(" total   cook time: %d",dLCDtotalCookTimeSec);