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.
Dependencies: SX1276Lib AdaFruit_RGBLCD MCP23017 mbed
Fork of AdaFruit_RGBLCD by
Diff: Modules/TimeModule.cpp
- Revision:
- 15:d1eaddb363be
- Parent:
- 13:9641bc42db92
- Child:
- 16:9e1edf28393f
--- a/Modules/TimeModule.cpp Mon Aug 11 19:13:08 2014 +0000
+++ b/Modules/TimeModule.cpp Tue Aug 12 04:25:08 2014 +0000
@@ -24,6 +24,7 @@
: Module(in_cDisplay)
, m_cRTclock(in_cRTclock)
{
+ ::memset(&m_sLastTM,0,sizeof(m_sLastTM));
}
TimeModule::~TimeModule()
@@ -109,7 +110,7 @@
return k_aCursor[inout_nIndex];
}
-void TimeModule::show()
+void TimeModule::show(bool in_bRefresh)
{
tm sTM;
const char * pUnits = " ";
@@ -129,6 +130,15 @@
// If failed get internal time (as at least that's something
GetTime(sTM);
}
+
+ // if refreshing - only update if there's a change
+ if (in_bRefresh)
+ {
+ if (0 == ::memcmp(&sTM,&m_sLastTM,sizeof(sTM))) return;
+ }
+
+ // Ensure internal struct has new TM data
+ ::memcpy(&m_sLastTM,&sTM,sizeof(m_sLastTM));
m_cDisplay.printf ("%02i:%02i:%02i %s ", sTM.tm_hour, sTM.tm_min, sTM.tm_sec, pUnits);
}
