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/DateModule.cpp
- Revision:
- 15:d1eaddb363be
- Parent:
- 13:9641bc42db92
- Child:
- 16:9e1edf28393f
--- a/Modules/DateModule.cpp Mon Aug 11 19:13:08 2014 +0000
+++ b/Modules/DateModule.cpp Tue Aug 12 04:25:08 2014 +0000
@@ -12,6 +12,7 @@
: Module(in_cDisplay)
, m_cRTclock(in_cRTclock)
{
+ ::memset(&m_sLastTM,0,sizeof(m_sLastTM));
}
DateModule::~DateModule()
@@ -81,12 +82,20 @@
return k_aCursor[inout_nIndex];
}
-void DateModule::show()
+void DateModule::show(bool in_bRefresh)
{
tm sTM;
// to get the current time information
if (!m_cRTclock.getTime(sTM)) GetTime(sTM);
-
- m_cDisplay.printf ("%s %02i/%02i/%04i ", k_aWeekDays[sTM.tm_wday], sTM.tm_mday, sTM.tm_mon + 1, 1900 + sTM.tm_year);
+
+ // 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 ("%s %02i/%02i/%04i ", k_aWeekDays[sTM.tm_wday], sTM.tm_mday, sTM.tm_mon + 1, 1900 + sTM.tm_year);
}
