Fix display t (time) and add T (date)

Fix display t (time) and add T (date)
This commit is contained in:
Theo Arends 2019-01-09 14:14:55 +01:00
parent ddb5ecf67d
commit b69f173706

View File

@ -427,13 +427,18 @@ void DisplayText(void)
cp += var; cp += var;
DisplayDrawFilledRectangle(disp_xpos, disp_ypos, temp, temp1, color); DisplayDrawFilledRectangle(disp_xpos, disp_ypos, temp, temp1, color);
break; break;
case 't': { case 't':
if (dp < (linebuf + DISPLAY_BUFFER_COLS) -5) { if (dp < (linebuf + DISPLAY_BUFFER_COLS) -5) {
snprintf_P(dp, 5, PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute); snprintf_P(dp, 6, PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute);
dp += 5; dp += 5;
} }
break; break;
} case 'T':
if (dp < (linebuf + DISPLAY_BUFFER_COLS) -8) {
snprintf_P(dp, 9, PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%02d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year%2000);
dp += 8;
}
break;
case 'd': case 'd':
// force draw grafics buffer // force draw grafics buffer
DisplayDrawFrame(); DisplayDrawFrame();
@ -465,7 +470,7 @@ void DisplayText(void)
break; break;
} }
} }
} }
} }
exit: exit:
// now draw buffer // now draw buffer