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(); updateAlarm();
} }
const char *days[] = {
"Mon, ", "Tue, ", "Wed, ", "Thu, ", "Fri, ", "Sat, ", "Sun, "
};
const char *months[] = { const char *months[] = {
" Jan ", " Feb ", " Mar ", " Apr ", " May ", " Jun ", " Jan ", " Feb ", " Mar ", " Apr ", " May ", " Jun ",
" Jul ", " Aug ", " Sep ", " Oct ", " Nov ", " Dec " " Jul ", " Aug ", " Sep ", " Oct ", " Nov ", " Dec "
@ -184,6 +188,7 @@ void FrontScreenField::set24HourMode(bool value)
void FrontScreenField::updateDate() void FrontScreenField::updateDate()
{ {
lcd()->setCursor(0, 0); lcd()->setCursor(0, 0);
lcd()->write(days[RTC::dayOfWeek(&_date) - 1]);
if (_date.day < 10) { if (_date.day < 10) {
lcd()->write('0' + _date.day); lcd()->write('0' + _date.day);
} else { } else {
@ -231,14 +236,16 @@ void FrontScreenField::updateTime()
void FrontScreenField::updateVoltage() void FrontScreenField::updateVoltage()
{ {
lcd()->setCursor(15, 0); lcd()->setCursor(15, 1);
lcd()->write(_batteryBars); lcd()->write(_batteryBars);
/*
lcd()->setCursor(12, 1); lcd()->setCursor(12, 1);
lcd()->write('0' + _voltageTrunc / 10); lcd()->write('0' + _voltageTrunc / 10);
lcd()->write('.'); lcd()->write('.');
lcd()->write('0' + _voltageTrunc % 10); lcd()->write('0' + _voltageTrunc % 10);
lcd()->write('v'); lcd()->write('v');
*/
} }
#endif #endif
@ -246,9 +253,9 @@ void FrontScreenField::updateVoltage()
void FrontScreenField::updateAlarm() void FrontScreenField::updateAlarm()
{ {
#ifdef USE_VOLTAGE_MONITOR #ifdef USE_VOLTAGE_MONITOR
lcd()->setCursor(13, 0); lcd()->setCursor(13, 1);
#else #else
lcd()->setCursor(14, 0); lcd()->setCursor(14, 1);
#endif #endif
lcd()->write(_alarmMode != AlarmOff ? IND_ALARM_ACTIVE1 : ' '); lcd()->write(_alarmMode != AlarmOff ? IND_ALARM_ACTIVE1 : ' ');
lcd()->write(_alarmMode != AlarmOff ? IND_ALARM_ACTIVE2 : ' '); 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 ". extern const char *months[]; // Table of month names; e.g. " Jan ".
void SetDate::printDate() void SetDate::printDate()
@ -121,6 +122,8 @@ void SetDate::printDate()
int monthCol; int monthCol;
int yearCol; int yearCol;
int col = 0; int col = 0;
lcd()->write(days[RTC::dayOfWeek(&_value) - 1]);
col += 5;
dayCol = col; dayCol = col;
if (_value.day < 10) { if (_value.day < 10) {
lcd()->write('0' + _value.day); lcd()->write('0' + _value.day);