homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Files at this revision

API Documentation at this revision

Comitter:
gatedClock
Date:
Thu Sep 12 14:46:50 2013 +0000
Parent:
86:388c2b4b7cf5
Child:
88:0b1b812945eb
Commit message:
improved granularity technique.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Sep 12 14:13:43 2013 +0000
+++ b/main.cpp	Thu Sep 12 14:46:50 2013 +0000
@@ -11,6 +11,7 @@
     
     improvements
     countdown timer needs to be sync'd to start button press.
+    this could not be done, use granularity setting instead.
     
     
 -----includes-----------------------------------//----------------------------*/
@@ -655,7 +656,7 @@
       {
         case RT_PRELOAD   :                     // preload with total time.
         {
-          dRemainingTime = giRemainingTime.dTotalTime * GRANULARITY;
+          dRemainingTime = giRemainingTime.dTotalTime * GRANULARITY + (GRANULARITY - 1);
           if (dRemainingTime > 180 * GRANULARITY) dRemainingTime = 180 * GRANULARITY;
           if (dRemainingTime <   0) dRemainingTime =   0;
           break;