1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Display the day of the week in alarm clock

This commit is contained in:
Rhys Weatherley 2012-06-13 15:18:01 +10:00
parent fa7df64f52
commit 109a0ccc85
2 changed files with 13 additions and 3 deletions

View File

@ -70,6 +70,10 @@ void FrontScreenField::enterField(bool reverse)
updateAlarm();
}
const char *days[] = {
"Mon, ", "Tue, ", "Wed, ", "Thu, ", "Fri, ", "Sat, ", "Sun, "
};
const char *months[] = {
" Jan ", " Feb ", " Mar ", " Apr ", " May ", " Jun ",
" Jul ", " Aug ", " Sep ", " Oct ", " Nov ", " Dec "
@ -184,6 +188,7 @@ void FrontScreenField::set24HourMode(bool value)
void FrontScreenField::updateDate()
{
lcd()->setCursor(0, 0);
lcd()->write(days[RTC::dayOfWeek(&_date) - 1]);
if (_date.day < 10) {
lcd()->write('0' + _date.day);
} else {
@ -231,14 +236,16 @@ void FrontScreenField::updateTime()
void FrontScreenField::updateVoltage()
{
lcd()->setCursor(15, 0);
lcd()->setCursor(15, 1);
lcd()->write(_batteryBars);
/*
lcd()->setCursor(12, 1);
lcd()->write('0' + _voltageTrunc / 10);
lcd()->write('.');
lcd()->write('0' + _voltageTrunc % 10);
lcd()->write('v');
*/
}
#endif
@ -246,9 +253,9 @@ void FrontScreenField::updateVoltage()
void FrontScreenField::updateAlarm()
{
#ifdef USE_VOLTAGE_MONITOR
lcd()->setCursor(13, 0);
lcd()->setCursor(13, 1);
#else
lcd()->setCursor(14, 0);
lcd()->setCursor(14, 1);
#endif
lcd()->write(_alarmMode != AlarmOff ? IND_ALARM_ACTIVE1 : ' ');
lcd()->write(_alarmMode != AlarmOff ? IND_ALARM_ACTIVE2 : ' ');

View File

@ -112,6 +112,7 @@ void SetDate::updateCurrentDate()
}
}
extern const char *days[]; // Table of day names; e.g. "Mon, ".
extern const char *months[]; // Table of month names; e.g. " Jan ".
void SetDate::printDate()
@ -121,6 +122,8 @@ void SetDate::printDate()
int monthCol;
int yearCol;
int col = 0;
lcd()->write(days[RTC::dayOfWeek(&_value) - 1]);
col += 5;
dayCol = col;
if (_value.day < 10) {
lcd()->write('0' + _value.day);